This chapter describes the usage of Runtime Artifacts and how to manage them via API.
A RuntimeArtifact describes an artifact which can be deployed and is valid from a specified date at runtime.
Each runtime artifact consists of:
Class DeployedRuntimeArtifact describes a deployed runtime artifact. It does not contain binary content like the RuntimeArtifact. The RuntimeArtifact including the content can be retrieved by OID using other service methods like AdministrationService and QueryService.
For searching Runtime Artifacts applying to specific criteria, e.g. to find out which runtime artifact is active at a certain date, refer to chapter Searching for Deployed Runtime Artifacts in the Querying Workflow section.
Stardust provides SPI to implement a custom Artifact Type. Please refer to chapter Implementing a Custom Artifact Type Handler for details.
The AdministrationService provides the following functionality to manage runtime artifacts:
Method deployRuntimeArtifact deploys a new artifact with a new OID.
If an artifact with the same validFrom date already exists,
the newly deployed artifact takes priority when querying for active artifacts.
@ExecutionPermission(id = ExecutionPermission.Id.deployRuntimeArtifact) public DeployedRuntimeArtifact deployRuntimeArtifact(RuntimeArtifact runtimeArtifact);
The method returns the deployed artifact including an assigned OID.
ServiceFactory sf = getServiceFactory(null, null, null, "motu", "motu");
AdministrationService as = sf.getAdministrationService();
RuntimeArtifact ra = new RuntimeArtifact(BENCHMARK_ARTIFACT_TYPE_ID, artifactId, ARTIFACT_NAME,
ARTIFACT_CONTENT.getBytes(), new Date(1));
DeployedRuntimeArtifact deployedRuntimeArtifact = as.deployRuntimeArtifact(ra);
Method overwriteRuntimeArtifact overwrites only content of a specified
already deployed artifact. Note that other fields cannot be changed.
@ExecutionPermission(id = ExecutionPermission.Id.deployRuntimeArtifact) public DeployedRuntimeArtifact overwriteRuntimeArtifact(long oid, RuntimeArtifact runtimeArtifact) throws ObjectNotFoundException;
The method returns the updated artifact.
AdministrationService as = sf.getAdministrationService(); RuntimeArtifact runtimeArtifact = as.getRuntimeArtifact(1); runtimeArtifact.setContent(ARTIFACT_NEW_CONTENT.getBytes()); DeployedRuntimeArtifact deployedRuntimeArtifact = as.overwriteRuntimeArtifact(1,runtimeArtifact);
Method deleteRuntimeArtifact deletes a deployed artifact specified by
its OID.
@ExecutionPermission(id = ExecutionPermission.Id.deployRuntimeArtifact) public void deleteRuntimeArtifact(long oid) throws ObjectNotFoundException;
If no runtime artifact with the specified OID exists, an ObjectNotFoundException is thrown.
AdministrationService as = sf.getAdministrationService(); as.deleteRuntimeArtifact(1);
Method getRuntimeArtifact retrieves the artifact specified by its unique
OID.
@ExecutionPermission(id = ExecutionPermission.Id.readRuntimeArtifact) public RuntimeArtifact getRuntimeArtifact(long oid);
The method returns the artifact or null if it does not exist.
AdministrationService as = sf.getAdministrationService(); RuntimeArtifact runtimeArtifact = as.getRuntimeArtifact(1);
Method getSupportedRuntimeArtifactTypes returns a list of supported
artifact types.
@ExecutionPermission(id = ExecutionPermission.Id.readRuntimeArtifact) public List<ArtifactType> getSupportedRuntimeArtifactTypes();
public java.util.List<org.eclipse.stardust.engine.api.runtime.ArtifactType>
getSupportedRuntimeArtifactTypes()
{
return ((org.eclipse.stardust.engine.api.runtime.AdministrationService)
serviceProxy).getSupportedRuntimeArtifactTypes();
}