Managing Runtime Artifacts

This chapter describes the usage of Runtime Artifacts and how to manage them via API.

Working with Runtime Artifacts

A RuntimeArtifact describes an artifact which can be deployed and is valid from a specified date at runtime.

Each runtime artifact consists of:

DeployedRuntimeArtifacts

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.

Querying Runtime Artifacts

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.

Implementing custom Artifact Types

Infinity provides SPI to implement a custom Artifact Type. Please refer to chapter Implementing a Custom Artifact Type Handler for details.

Managing Runtime Artifacts via AdministrationService

The AdministrationService provides the following functionality to manage runtime artifacts:

Deploying a new Artifact with a new OID

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.

Example usage

   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);

Overwriting the Content of a specified already deployed Artifact

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.

Example usage

   AdministrationService as = sf.getAdministrationService();
   
   RuntimeArtifact runtimeArtifact = as.getRuntimeArtifact(1);
   
   runtimeArtifact.setContent(ARTIFACT_NEW_CONTENT.getBytes());
   
   DeployedRuntimeArtifact deployedRuntimeArtifact = as.overwriteRuntimeArtifact(1,runtimeArtifact);

Deleting a deployed Artifact by OID

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.

Example usage

   AdministrationService as = sf.getAdministrationService();
   
   as.deleteRuntimeArtifact(1);

Retrieving an Artifact by its unique OID

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.

Example usage

   AdministrationService as = sf.getAdministrationService();
   
   RuntimeArtifact runtimeArtifact = as.getRuntimeArtifact(1);

Retrieving a List of supported Artifact Types

Method getSupportedRuntimeArtifactTypes returns a list of supported artifact types.

   @ExecutionPermission(id = ExecutionPermission.Id.readRuntimeArtifact)
   public List<ArtifactType> getSupportedRuntimeArtifactTypes();

Example usage

   public java.util.List<org.eclipse.stardust.engine.api.runtime.ArtifactType>
         getSupportedRuntimeArtifactTypes()
   {
      return ((org.eclipse.stardust.engine.api.runtime.AdministrationService)
            serviceProxy).getSupportedRuntimeArtifactTypes();
   }