bea.com | products | dev2dev | support | askBEA
 Download Docs   Site Map   Glossary 
Search

Programming BPM Client Apps

 Previous Next Contents Index View as PDF  

Publishing Workflow Objects

This section describes publishable objects, and explains how to publish workflow objects, including the following topics:

For more information about the methods described in this section, see the com.bea.wlpi.server.admin.Admin Javadoc. For information about publishing workflow objects using the WebLogic Integration Studio, see Defining Workflow Templates in Using the WebLogic Integration Studio.

 


What Is a Publishable Object?

A publishable object consists of any object that implements the com.bea.wlpi.common.Publishable interface. The Publishable interface provides support for creating, exporting, and importing packages.

Using the WebLogic Integration Studio or a custom design client, you can create, export, or import workflow objects that are valid publishable objects.

The following table lists the publishable objects defined by the Publishable interface, along with their corresponding types.

Table 18-1 Publishable Objects and Types

Publishable Object

Type

BusinessCalendarInfo

BUSINESS_CALENDAR

ClassInvocationDescriptor

BUSINESS_OPERATION

EJBInvocationDescriptor

BUSINESS_OPERATION

EventKeyInfo

EVENT_KEY

OrganizationInfo

ORG

RepositoryFolderInfoHelper

XML_REPOSITORY_FOLDER

RoleInfo

ROLE

TemplateDefinitionInfo

TEMPLATE_DEFINITION

TemplateInfo

TEMPLATE

XMLEntityInfoHelper

XML_REPOSITORY_ENTITY

UserInfo

USER

The following table lists the methods, provided by the Publishable interface, that can be used to get publishable object information.

Table 18-2 Publishable Interface Methods  

Method

Description

public java.lang.Object getContents()

Gets the publishable object contents.

public java.lang.String getEntryName()

Gets the publishable object entry name.

public java.lang.String getOwnerName()

Gets the publishable object owner name.

public java.util.List getReferencedPublishables(
java.util.Map publishables
)

Gets all referenced publishables based on the specified publishables map object.

public int getType()

Gets publishable object type. For a list of valid types, see the table Publishable Objects and Types.


 

For more information, see the com.bea.wlpi.common.Publishable Javadoc.

 


Creating a Package Entry

To create a package entry in preparation of exporting, you must create a com.bea.wlpi.common.PackageEntry object.

The following example provides the constructor for creating a new PackageEntry object:

public PackageEntry(
com.bea.wlpi.common.Publishable p,
java.util.Map r,
boolean b
)

The following table describes the PackageEntry object data, the constructor parameters used to define the data, and the get and set methods that can be used to access that data after the object is defined.

Table 18-3 PackageEntry Object Data  

Object Data

Constructor Parameter

Get Method

Set Method

Publishable object

For a list of valid publishable objects, see What Is a Publishable Object?.

p

public com.bea.wlpi.common.Publishable getPublishable()

public void setPublishable(com.bea.wlpi.common.Publishable p)

Referenced publishable objects

For information about getting publishable object data, see the table Publishable Interface Methods.

r

public java.util.Map getReferences()

public void setReferences(java.util.Map r)

Boolean flag specifying whether or not the publishable object should be locked

b

public boolean getPublished()

public void setPublished(boolean b)

Entry type

For a list of valid types, see the table Publishable Objects and Types.

N/A

public java.lang.String getEntryType()

N/A


 

For more information, see the com.bea.wlpi.common.PackageEntry Javadoc.

 


Exporting a Package of Publishable Objects

To export a package of publishable objects to a JAR file, use the following com.bea.wlpi.server.admin.Admin method:

public byte[] exportPackage(
com.bea.wlpi.common.PublishPackage publishables,
java.lang.Object credential
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException

The following table describes the exportPackage() method parameters for which you must specify values.

Table 18-4 exportPackage() Method Parameters  

Parameter

Description

Valid Values

publishables

Publishable workflow objects to be exported.

An object of type com.bea.wlpi.common.PublishPackage containing the entries of type com.bea.wlpi.common.PackageEntry to be exported into the Jar package.

For a list of valid publishable types, see the table Publishable Objects and Types.

credential

Password value, if required.

A java.lang.Object object specifying a valid password, or null, if a password is not required.


 

This method returns a byte[] array that is an image of a JAR file containing all exported objects.

For example, the following code exports a package of publishable objects specified by the previously defined publishable Map object. In this example, admin represents the EJBObject reference to the Admin EJB.

byte[] exportResults = admin.exportPackage(publishableMap);

For more information about the exportPackage() method, see the com.bea.wlpi.server.admin.Admin Javadoc.

 


Importing a Package of Publishable Objects

To import a package of publishable objects, use the following com.bea.wlpi.server.admin.Admin method:

public java.lang.String importPackage(
byte[] pkg,
java.util.Map publishables,
java.lang.String orgId,
boolean activate,
java.lang.Object credential
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException

The following table describes the importPackage() method parameters for which you must specify values.

Table 18-5 importPackage() Method Parameters  

Parameter

Description

Valid Values

pkg

JAR file of publishable objects to be imported.

A valid byte[] object consisting of an image of a JAR file containing publishable objects.

For information about exporting a package of publishable objects, see Exporting a Package of Publishable Objects.

publishables

Publishable workflow objects to be imported.

A java.util.Map object with key-value pairs, specifying the publishable type as the key and the PackageEntry object as the value:

For a list of valid publishable types, see the table Publishable Objects and Types.

orgId

ID of the organization to which the package is being imported.

String specifying a valid organization ID.

For information about getting a list of organization IDs, see Getting All Organizations.

activate

Boolean flag specifying whether or not the package should be activated on import.

true (activate) or false (do not activate).

credential

Password value, if required.

A java.lang.Object object specifying a valid password, or null if a password is not required.


 

This method returns a string value containing any reported issues, such as unresolved references.

For example, the following code imports the publishable objects to the ORG1 organization as specified in the shipping.jar file and publishPackage map. In this example, admin represents the EJBObject reference to the Admin EJB:

//read JAR file into a byte array
File jarFile = new File("shipping.jar");
pkg = new byte[(int)jarFile.length()];
FileInputStream fin = new FileInputStream(jarFile);
fin.read(pkg);
fin.close();
//Map and import the contents
Map contents = admin.readPackage(pkg, "password");
String importResults = admin.importPackage(
pkg, contents, "ORG1", true, "password");

The publishable objects are activated upon import (the activate value is set to true), and the password used is abcd.

For more information about the importPackage() method, see the com.bea.wlpi.server.admin.Admin Javadoc.

 


Reading a Package of Publishable Objects

To read a package of publishable objects, use the following com.bea.wlpi.server.admin.Admin method:

public java.util.Map readPackage(
byte[] pkg,
java.lang.Object credential
) throws java.rmi.RemoteException,
com.bea.wlpi.common.WorkflowException

The following table describes the readPackage() method parameters for which you must specify values.

Table 18-6 readPackage() Method Parameters  

Parameter

Description

Valid Values

pkg

JAR file of publishable objects to be read.

A valid byte[] object consisting of an image of a JAR file containing publishable objects.

For information about exporting a package of publishable objects, see Exporting a Package of Publishable Objects.

credential

Password value, if required.

A java.lang.Object object specifying a valid password, or null, if a password is not required.


 

This method returns a java.util.Map object with key-value pairs, specifying the publishable types as the key, and a hetereogenous java.util.List object containing the xxxInfo object corresponding to the publishable type, as the value. For a list of valid publishable objects and types, see the table Publishable Objects and Types.

For example, the following code reads the publishable objects specified in the shipping.jar file, using the password abcd. In this example, admin represents the EJBObject reference to the Admin EJB.

byte[] pkg = readFile("shipping.jar");
Map contents = admin.readPackage(pkg, "abcd");

For more information about the readPackage() method, see the com.bea.wlpi.server.admin.Admin Javadoc.

 

Back to Top Previous Next