1313import network .crypta .client .InsertException .InsertExceptionMode ;
1414import network .crypta .client .InsertException ;
1515import network .crypta .client .async .BaseClientPutter ;
16- import network .crypta .client .async .ClientContext ;
1716import network .crypta .client .async .ClientPutCallback ;
1817import network .crypta .client .events .ClientEvent ;
1918import network .crypta .client .events .ClientEventDispatchContext ;
2322import network .crypta .client .events .SplitfileProgressEvent ;
2423import network .crypta .client .events .StartedCompressionEvent ;
2524import network .crypta .keys .FreenetURI ;
26- import network .crypta .keys .InsertableClientSSK ;
2725import network .crypta .support .api .Bucket ;
2826import org .slf4j .Logger ;
2927import org .slf4j .LoggerFactory ;
3432 * <p>The class centralizes common state tracking for {@link ClientPut} and {@link ClientPutDir},
3533 * wiring FCP-facing identifiers, scheduling metadata, persistence constraints, and node callbacks
3634 * into a single state machine. Instances travel through connection-bound and forever-persistent
37- * modes, reattaching to {@link ClientContext}s after deserialization, driving {@link
38- * BaseClientPutter} progress, and translating internal events into client-visible FCP messages. It
39- * is designed to be thread-aware: mutations happen under synchronization, while outbound messages
40- * are dispatched via handler abstractions to avoid deadlocks.
35+ * modes, reattaching to {@link network.crypta.client.async.ClientContext ClientContext}s after
36+ * deserialization, driving {@link BaseClientPutter} progress, and translating internal events into
37+ * client-visible FCP messages. It is designed to be thread-aware: mutations happen under
38+ * synchronization, while outbound messages are dispatched via handler abstractions to avoid
39+ * deadlocks.
4140 *
4241 * <p>Typical usage involves subclassing to provide data-specific logic (single file or directory
4342 * tree) while relying on {@code ClientPutBase} to manage retries, metadata capture, and reporting.
@@ -63,7 +62,8 @@ public abstract class ClientPutBase extends ClientRequest
6362 /**
6463 * Per-request insert context seeded from the node defaults. It carries retry rules, redundancy
6564 * knobs, and compatibility flags and therefore must be explicitly cleaned up in {@link
66- * #requestWasRemoved(ClientContext)} to avoid leaking stale listeners.
65+ * #requestWasRemoved(network.crypta.client.async.ClientContext) requestWasRemoved(ClientContext)}
66+ * to avoid leaking stale listeners.
6767 */
6868 final InsertContext ctx ;
6969
@@ -236,19 +236,13 @@ protected ClientPutBase() {
236236 *
237237 * @param uri candidate URI that may lack routing data; callers must not pass {@code null}
238238 * @param filename optional document name; when missing the method chooses {@code "key"}
239- * @param context client context providing the randomness source used to mint new keys
239+ * @param runtimeSupport insert runtime support that owns placeholder-SSK normalization
240240 * @return original URI when already complete or a freshly derived insert URI with the filename
241241 * applied; the result is never {@code null}
242242 */
243- static FreenetURI checkEmptySSK (FreenetURI uri , String filename , ClientContext context ) {
244- if ("SSK" .equals (uri .getKeyType ()) && uri .getDocName () == null && uri .getRoutingKey () == null ) {
245- if (filename == null || filename .isEmpty ()) filename = "key" ;
246- // SSK@ = use a random SSK.
247- InsertableClientSSK key = InsertableClientSSK .createRandom (context .random , "" );
248- return key .getInsertURI ().setDocName (filename );
249- } else {
250- return uri ;
251- }
243+ static FreenetURI checkEmptySSK (
244+ FreenetURI uri , String filename , FcpInsertRuntimeSupport runtimeSupport ) {
245+ return runtimeSupport .normalizeInsertUri (uri , filename );
252246 }
253247
254248 /**
@@ -313,16 +307,16 @@ protected static FreenetURI derivePublicURI(FreenetURI insertUri) throws Malform
313307 * leaving persistent ones untouched so they can resume later without extra chatter.
314308 *
315309 * <p>The method keeps side effects intentionally small. It does not throw nor block; instead it
316- * simply triggers {@link #cancel(ClientContext)} for requests that were declared {@link
317- * Persistence#CONNECTION}. Persistent and forever requests ignore the event because they expect
318- * to be resumed through {@link network.crypta.client.async.ClientRequester} after
319- * deserialization.
310+ * simply triggers {@link #cancel(network.crypta.client.async. ClientContext)
311+ * cancel(ClientContext)} for requests that were declared {@link Persistence#CONNECTION}.
312+ * Persistent and forever requests ignore the event because they expect to be resumed through
313+ * {@link network.crypta.client.async.ClientRequester} after deserialization.
320314 *
321315 * @param context client context that supplies cancellation helpers and resource pools; the value
322316 * may be reused across many requests and must not be {@code null}
323317 */
324318 @ Override
325- public void onLostConnection (ClientContext context ) {
319+ public void onLostConnection (network . crypta . client . async . ClientContext context ) {
326320 if (persistence == Persistence .CONNECTION ) cancel (context );
327321 // otherwise ignore
328322 }
@@ -496,7 +490,7 @@ public void onGeneratedMetadata(Bucket metadata, BaseClientPutter state) {
496490 * @param context client context through which cleanup helpers and factories can be reached
497491 */
498492 @ Override
499- public void requestWasRemoved (ClientContext context ) {
493+ public void requestWasRemoved (network . crypta . client . async . ClientContext context ) {
500494 // if the request is still running, send a PutFailed with code=canceled
501495 if (!finished ) {
502496 synchronized (this ) {
@@ -960,7 +954,8 @@ private void writeObject(ObjectOutputStream out) throws IOException {
960954
961955 /**
962956 * Restores persistent fields during deserialization. Subclasses are expected to rebuild transient
963- * collaborators during {@link #innerResume(ClientContext)} rather than in this hook.
957+ * collaborators during {@link #innerResume(network.crypta.client.async.ClientContext)
958+ * innerResume(ClientContext)} rather than in this hook.
964959 *
965960 * @param in source stream containing a previously serialized form of the object
966961 * @throws IOException when reading fails
0 commit comments