Module agentforge4j.config.loader
Class WorkflowBundleLocator
java.lang.Object
com.agentforge4j.config.loader.workflow.WorkflowBundleLocator
Resolves shipped workflow bundle resources from the classpath.
Resources are resolved through ClassLoader.getResource(String) on this class's own
loader, not Class.getResource(String): the shipped catalog ships as a separate
module/jar (the independently-versioned workflow catalog), so its resources are not in this
loader's own module. The shipped-workflows root contains a hyphen, so it does not map to
a Java package and is therefore not JPMS-encapsulated — it is discoverable across the class path
and the module path. When no catalog is present on the classpath the shipped index is simply
absent and shippedWorkflowIds() is empty.
-
Method Summary
Modifier and TypeMethodDescriptionstatic URLlocateWorkflowJson(String workflowId) Resolves theworkflow.jsonresource for a shipped workflow id.static InputStreamopenBundleResource(String classpathPath, String workflowId) Opens a shipped workflow bundle resource.retrieveWorkflowBundleFiles(String workflowId) Returns bundle entries listed in a shipped workflow bundle index.Returns workflow ids listed in the shipped workflow index.static StringworkflowPath(String workflowId) Classpath prefix for the given shipped workflow id (trailing slash), undershipped-workflows/.
-
Method Details
-
shippedWorkflowIds
Returns workflow ids listed in the shipped workflow index.- Returns:
- immutable list of shipped workflow ids, empty when no catalog is present
-
locateWorkflowJson
Resolves theworkflow.jsonresource for a shipped workflow id.- Parameters:
workflowId- workflow id listed in the shipped workflow index- Returns:
- classpath URL of the workflow definition
- Throws:
IllegalStateException- when the workflow resource is not present
-
retrieveWorkflowBundleFiles
Returns bundle entries listed in a shipped workflow bundle index.- Parameters:
workflowId- workflow id listed in the shipped workflow index- Returns:
- classpath-relative bundle entry paths, or an empty list when no index is present
- Throws:
IllegalStateException- when the bundle index cannot be read
-
openBundleResource
Opens a shipped workflow bundle resource.- Parameters:
classpathPath- classpath path to a bundle entry (no leading slash)workflowId- owning workflow id, used in error messages- Returns:
- open input stream for the requested resource
- Throws:
IllegalStateException- when the resource does not existUncheckedIOException- when the resource exists but cannot be opened
-
workflowPath
Classpath prefix for the given shipped workflow id (trailing slash), undershipped-workflows/. The prefix has no leading slash so it composes withClassLoader.getResource(String). The id is validated against path traversal and separators so a malicious or malformed catalog index cannot steer resolution outside theshipped-workflows/root — mirroring the agent bundle-entry guard. (Not exploitable for a trusted, build-time catalog, but the same surface admits third-party catalogs on the roadmap, andClassLoader.getResourcecan normalise..on exploded-directory classpath entries.)- Parameters:
workflowId- id fromshippedWorkflowIds(); must not be blank, contain.., or contain path separators- Returns:
- path such as
shipped-workflows/my.workflow/
-