Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* Description : K2GO-427. Bridges one SAF-read archive to a box-visible path the core can ingest.
* proot runs with -r <rootfs> and no separate bind for /library, so box /library maps
* to host <rootfs>/library (EnvironmentControl.rootfs = filesDir/rootfs/installed-rootfs/
* iiab). This writes the staged archive under host <rootfs>/library/.cx-staging and
* reports the matching box path /library/.cx-staging/<name> for POST /v1/import/item.
* The core default CX_STAGING_DIR is /library/.cx-staging (its is_within_dir guard).
* iiab). This writes the staged archive under host <rootfs>/library/.conex-staging and
* reports the matching box path /library/.conex-staging/<name> for POST /v1/import/item.
* The core default CONEX_STAGING_DIR is /library/.conex-staging (its is_within_dir guard).
* ============================================================================
*/
package org.appdevforall.k2go.contentexchange.data;
Expand All @@ -25,9 +25,9 @@

public final class BoxImportStaging {

/** The box-side import area, matching the core's default {@code CX_STAGING_DIR}. */
private static final String BOX_STAGING_DIR = "/library/.cx-staging";
private static final String HOST_STAGING_SUBPATH = "library/.cx-staging";
/** The box-side import area, matching the core's default {@code CONEX_STAGING_DIR}. */
private static final String BOX_STAGING_DIR = "/library/.conex-staging";
private static final String HOST_STAGING_SUBPATH = "library/.conex-staging";

private final File hostDir;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* ============================================================================
* Name : CxCoreDataSource.java
* Name : ConexCoreDataSource.java
* Author : AppDevForAll
* Copyright : Copyright (c) 2026 AppDevForAll
* Description : K2GO-427 / K2GO-507. App-side client of the content-exchange core (cx-core)
* Description : K2GO-427 / K2GO-507. App-side client of the content-exchange core (conex-core)
* through dash-node's relay (/k2go-api/v1/*). Read side (list + storage)
* plus the export long operation (prepare / status / fetch / abort) and the
* import calls. Same HttpURLConnection shape as content/RestContentClient. The
Expand All @@ -28,14 +28,14 @@

/**
* The one place in this feature that touches {@link HttpURLConnection}. It issues
* GETs to the cx-core read endpoints and returns the parsed JSON object; mapping
* GETs to the conex-core read endpoints and returns the parsed JSON object; mapping
* to domain entities lives in {@link ContentRepositoryImpl}.
*
* <p>Must be called off the main thread.
*/
public final class CxCoreDataSource {
public final class ConexCoreDataSource {

/** cx-core API root behind dash-node's relay: {@code http://localhost:8085/k2go-api/v1}. */
/** conex-core API root behind dash-node's relay: {@code http://localhost:8085/k2go-api/v1}. */
private static final String V1 = BoxEndpoints.API + "/v1";

private static final int CONNECT_TIMEOUT_MS = 5000;
Expand Down Expand Up @@ -100,7 +100,7 @@ public JSONObject postExportPrepare(String app, String localRef) throws Exceptio

/**
* {@code GET /v1/export/status/{opId}} -> {@code {state, stagedBytes, totalBytes, error?}}. A 404
* means the op was swept; it surfaces as {@link CxHttpException} with {@code code() == 404} so the
* means the op was swept; it surfaces as {@link ConexHttpException} with {@code code() == 404} so the
* caller can re-prepare rather than keep polling a dead id. K2GO-507.
*/
public JSONObject getExportStatus(String opId) throws Exception {
Expand All @@ -126,7 +126,7 @@ public Stream openExportFetch(String opId) throws Exception {
if (code < 200 || code >= 400) {
String text = readAll(c.getErrorStream());
c.disconnect();
throw new CxHttpException(code, text);
throw new ConexHttpException(code, text);
}
String filename = parseContentDispositionFilename(c.getHeaderField("Content-Disposition"));
return new Stream(c, c.getInputStream(), filename);
Expand All @@ -142,13 +142,13 @@ public JSONObject deleteExportOp(String opId) throws Exception {
}

// ---- share gate (K2GO-376) -----------------------------------------------------------------
// These hit the sender's OWN cx-core over the loopback relay. The receiver reaches the same
// These hit the sender's OWN conex-core over the loopback relay. The receiver reaches the same
// session over the hotspot (a separate off-loopback exposure); the app never copies bytes. The
// token minted here is the session's only auth and travels in the X-Share-Token header.

/**
* {@code POST /v1/share} with {@code {items:[{app,localRef}]}} -> {@code {sessionId, token,
* manifestUrl}}. Opens a scoped share session on the local cx-core and returns the token the
* manifestUrl}}. Opens a scoped share session on the local conex-core and returns the token the
* sender puts in the QR; no token header (this call mints it). K2GO-376.
*/
public ShareCreated postShareCreate(List<ItemRef> items) throws Exception {
Expand Down Expand Up @@ -221,7 +221,7 @@ private static JSONObject postJson(String urlStr, JSONObject body, String shareT
boolean ok = code >= 200 && code < 400;
String text = readAll(ok ? c.getInputStream() : c.getErrorStream());
if (!ok) {
throw new CxHttpException(code, text);
throw new ConexHttpException(code, text);
}
return new JSONObject(text.isEmpty() ? "{}" : text);
} finally {
Expand Down Expand Up @@ -249,7 +249,7 @@ private static JSONObject deleteJson(String urlStr, String shareToken) throws Ex
boolean ok = code >= 200 && code < 400;
String text = readAll(ok ? c.getInputStream() : c.getErrorStream());
if (!ok) {
throw new CxHttpException(code, text);
throw new ConexHttpException(code, text);
}
return new JSONObject(text.isEmpty() ? "{}" : text);
} finally {
Expand All @@ -269,7 +269,7 @@ private static JSONObject getJson(String urlStr) throws Exception {
boolean ok = code >= 200 && code < 400;
String text = readAll(ok ? c.getInputStream() : c.getErrorStream());
if (!ok) {
throw new CxHttpException(code, text);
throw new ConexHttpException(code, text);
}
return new JSONObject(text.isEmpty() ? "{}" : text);
} finally {
Expand Down Expand Up @@ -323,10 +323,10 @@ private static String parseContentDispositionFilename(String header) {
* status poll treats {@code code() == 404} as "operation swept" and re-prepares. Extends
* {@link Exception}, so callers that only {@code catch (Exception)} keep working. K2GO-507.
*/
public static final class CxHttpException extends Exception {
public static final class ConexHttpException extends Exception {
private final int code;

CxHttpException(int code, String message) {
ConexHttpException(int code, String message) {
super("HTTP " + code + ": " + message);
this.code = code;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* ============================================================================
* Name : CxCoreDeleteSource.java
* Name : ConexCoreDeleteSource.java
* Author : AppDevForAll
* Copyright : Copyright (c) 2026 AppDevForAll
* Description : K2GO-427. Data-layer implementation of the delete source port against
* cx-core (through dash-node's /v1 relay): DELETE /v1/content/{app}/{localRef}.
* conex-core (through dash-node's /v1 relay): DELETE /v1/content/{app}/{localRef}.
* Maps the core JSON {ok, freedBytes} | {ok:false, reason} onto the domain
* DeleteResult, so the domain stays JSON-free.
* ============================================================================
Expand All @@ -23,11 +23,11 @@
* 4xx/5xx) throws; a reached box that could not delete the item returns {@code {ok:false, reason}},
* which maps to {@link DeleteResult#failure}.
*/
public final class CxCoreDeleteSource implements ContentDeleteSource {
public final class ConexCoreDeleteSource implements ContentDeleteSource {

private final CxCoreDataSource dataSource;
private final ConexCoreDataSource dataSource;

public CxCoreDeleteSource(CxCoreDataSource dataSource) {
public ConexCoreDeleteSource(ConexCoreDataSource dataSource) {
this.dataSource = dataSource;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* ============================================================================
* Name : CxCoreExportSource.java
* Name : ConexCoreExportSource.java
* Author : AppDevForAll
* Copyright : Copyright (c) 2026 AppDevForAll
* Description : K2GO-427 / K2GO-507. Data-layer implementation of the export source port against
* cx-core (through dash-node's /v1 relay): POST /v1/export/plan, the export long
* conex-core (through dash-node's /v1 relay): POST /v1/export/plan, the export long
* operation (prepare / status / fetch / abort), and the collection-manifest assembly.
* ============================================================================
*/
Expand Down Expand Up @@ -34,14 +34,14 @@
*
* <p>Instances are single-run and used off the main thread; the capture is not shared.
*/
public final class CxCoreExportSource implements ContentExportSource {
public final class ConexCoreExportSource implements ContentExportSource {

private final CxCoreDataSource dataSource;
private final ConexCoreDataSource dataSource;

/** Captured plan entries for the manifest, by item, preserving request order. */
private final Map<ItemRef, JSONObject> entries = new LinkedHashMap<>();

public CxCoreExportSource(CxCoreDataSource dataSource) {
public ConexCoreExportSource(ConexCoreDataSource dataSource) {
this.dataSource = dataSource;
}

Expand Down Expand Up @@ -110,7 +110,7 @@ public ExportStatus status(String opId) throws Exception {
JSONObject r;
try {
r = dataSource.getExportStatus(opId);
} catch (CxCoreDataSource.CxHttpException e) {
} catch (ConexCoreDataSource.ConexHttpException e) {
if (e.code() == 404) {
return ExportStatus.gone(); // the op was swept: the caller re-prepares
}
Expand All @@ -134,7 +134,7 @@ public ExportStatus status(String opId) throws Exception {

@Override
public ItemPayload fetch(String opId) throws Exception {
CxCoreDataSource.Stream stream = dataSource.openExportFetch(opId);
ConexCoreDataSource.Stream stream = dataSource.openExportFetch(opId);
return new ItemPayload(stream.body(), stream.filename(), stream);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* ============================================================================
* Name : CxCoreImportSource.java
* Name : ConexCoreImportSource.java
* Author : AppDevForAll
* Copyright : Copyright (c) 2026 AppDevForAll
* Description : K2GO-427. Data-layer implementation of the import source port against cx-core
* Description : K2GO-427. Data-layer implementation of the import source port against conex-core
* (through dash-node's /v1 relay): POST /v1/import/validate (per-item verdict),
* POST /v1/import/item (ingest one staged item), and DELETE /v1/content (reclaim).
* The manifest entries are passed to the core unchanged; the core owns the shape.
Expand All @@ -21,11 +21,11 @@
import java.util.ArrayList;
import java.util.List;

public final class CxCoreImportSource implements ImportSource {
public final class ConexCoreImportSource implements ImportSource {

private final CxCoreDataSource dataSource;
private final ConexCoreDataSource dataSource;

public CxCoreImportSource(CxCoreDataSource dataSource) {
public ConexCoreImportSource(ConexCoreDataSource dataSource) {
this.dataSource = dataSource;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

/**
* Data-layer implementation of the domain {@link ContentRepository} port. Maps the
* cx-core JSON (via {@link CxCoreDataSource}) into domain entities.
* conex-core JSON (via {@link ConexCoreDataSource}) into domain entities.
*
* <p>Per the port contract: {@link #fetchApps()} / {@link #fetchContent()} throw on
* a real failure (box unreachable); {@link #fetchStorage()} never throws and returns
Expand All @@ -23,11 +23,11 @@
*/
public final class ContentRepositoryImpl implements ContentRepository {

private static final String TAG = "CxContentRepository";
private static final String TAG = "ConexContentRepository";

private final CxCoreDataSource dataSource;
private final ConexCoreDataSource dataSource;

public ContentRepositoryImpl(CxCoreDataSource dataSource) {
public ContentRepositoryImpl(ConexCoreDataSource dataSource) {
this.dataSource = dataSource;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* Author : AppDevForAll
* Copyright : Copyright (c) 2026 AppDevForAll
* Description : K2GO-376. The network ImportCarrier: the mirror of SafImportCarrier, but each item is
* read over HTTP from the sender's live cx-core gate on the shared hotspot, not from a
* read over HTTP from the sender's live conex-core gate on the shared hotspot, not from a
* SAF drive. readManifest() GETs the invite's manifest URL; openPayload(itemRef) GETs
* /v1/share/<id>/fetch/<itemRef>, retrying while the sender stages the item; the token
* rides the X-Share-Token header, never the URL. Everything downstream (stage to
* /library/.cx-staging, POST /v1/import/item) is unchanged from the disk path, so the
* /library/.conex-staging, POST /v1/import/item) is unchanged from the disk path, so the
* carrier is the only sender-specific dependency of the import service. On a clean finish
* the carrier POSTs /complete so the gate releases the session (the receiver-driven close).
* ============================================================================
Expand Down Expand Up @@ -51,7 +51,7 @@
*/
public final class NetworkImportCarrier implements ImportCarrier {

private static final String TAG = "IIAB-CxNetCarrier";
private static final String TAG = "IIAB-ConexNetCarrier";

private static final int CONNECT_TIMEOUT_MS = 8000;
/** Small JSON reads (manifest, complete response). */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* Pure validation of a Share invite (ADR "Pillar Share"). The invite carries the sender's reachable
* address and port, a session token, and the manifest path. On the sender these come from trusted
* local sources (the hotspot owner and the sender's own cx-core), but the RECEIVER scans the same
* local sources (the hotspot owner and the sender's own conex-core), but the RECEIVER scans the same
* QR as untrusted input, and both forks build against this one rule so the contract cannot drift.
*
* <p>The receiver later composes URLs from these fields ({@code http://host:port} + a share path),
Expand All @@ -25,7 +25,7 @@
*/
public final class ShareInviteValidator {

/** The cx-core token is {@code secrets.token_urlsafe(32)}: url-safe base64, ~43 chars. */
/** The conex-core token is {@code secrets.token_urlsafe(32)}: url-safe base64, ~43 chars. */
private static final int MAX_TOKEN_LEN = 256;
/** The manifest path is short ({@code /v1/share/<id>/manifest}); cap it well above that. */
private static final int MAX_PATH_LEN = 512;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Transport settings for granular wireless Share (K2GO-376).
*
* <p>Share is the network twin of Export: the receiver PULLS from the sender's live cx-core
* <p>Share is the network twin of Export: the receiver PULLS from the sender's live conex-core
* (ADR "Pillar Share"). On the sender the share session is created over the loopback relay, but
* the RECEIVER reaches the gate over the hotspot at {@code http://<senderHotspotIp>:SHARE_PORT}.
* That off-loopback exposure is a separate server-side slice (plain HTTP, v1 only); this is the
Expand All @@ -26,7 +26,7 @@ private ShareTransport() {
}

/**
* TCP port the sender's cx-core is exposed on, off loopback, for the paired receiver. Must
* TCP port the sender's conex-core is exposed on, off loopback, for the paired receiver. Must
* match the scoped-exposure slice (candidate 8095, plain HTTP for v1). The loopback relay the
* sender uses to CREATE the session is unrelated to this port.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import androidx.core.content.ContextCompat;

import org.appdevforall.k2go.R;
import org.appdevforall.k2go.contentexchange.data.CxCoreDataSource;
import org.appdevforall.k2go.contentexchange.data.CxCoreDeleteSource;
import org.appdevforall.k2go.contentexchange.data.ConexCoreDataSource;
import org.appdevforall.k2go.contentexchange.data.ConexCoreDeleteSource;
import org.appdevforall.k2go.contentexchange.domain.ContentDeleteSource;
import org.appdevforall.k2go.contentexchange.domain.DeleteJob;
import org.appdevforall.k2go.contentexchange.domain.DeleteResult;
Expand Down Expand Up @@ -172,7 +172,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {
* in flight finishes.
*/
private void drain() {
ContentDeleteSource source = new CxCoreDeleteSource(new CxCoreDataSource());
ContentDeleteSource source = new ConexCoreDeleteSource(new ConexCoreDataSource());
DeleteJob job = SESSION.job();

for (int i = job.firstPending(); i >= 0; i = job.firstPending()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Author : AppDevForAll
* Copyright : Copyright (c) 2026 AppDevForAll
* Description : K2GO-427. Foreground service that drains the export queue: plan the selected
* items, then per item pull the streaming archive from cx-core and write it to the
* items, then per item pull the streaming archive from conex-core and write it to the
* SAF destination, writing the collection manifest last over the items that landed.
* Reuses the download-service pattern (foreground specialUse + per-item queue +
* retry + notification), but the bytes flow phone <- box -> drive here, so it is a
Expand All @@ -31,8 +31,8 @@
import androidx.core.content.ContextCompat;

import org.appdevforall.k2go.R;
import org.appdevforall.k2go.contentexchange.data.CxCoreDataSource;
import org.appdevforall.k2go.contentexchange.data.CxCoreExportSource;
import org.appdevforall.k2go.contentexchange.data.ConexCoreDataSource;
import org.appdevforall.k2go.contentexchange.data.ConexCoreExportSource;
import org.appdevforall.k2go.contentexchange.data.SafExportCarrier;
import org.appdevforall.k2go.contentexchange.domain.ContentExportSource;
import org.appdevforall.k2go.contentexchange.domain.ExportCarrier;
Expand Down Expand Up @@ -216,7 +216,7 @@ public int onStartCommand(Intent intent, int flags, int startId) {
*/
private void drain(boolean fresh) {
ExportCarrier carrier;
ContentExportSource source = new CxCoreExportSource(new CxCoreDataSource());
ContentExportSource source = new ConexCoreExportSource(new ConexCoreDataSource());
try {
carrier = new SafExportCarrier(getApplicationContext(), Uri.parse(SESSION.treeUri()));
} catch (Exception e) {
Expand Down
Loading
Loading