org.arm4.arm40.transaction
Class ArmTransactionFactory

java.lang.Object
  extended by org.arm4.arm40.transaction.ArmInterface
      extended by org.arm4.arm40.transaction.ArmFactory
          extended by org.arm4.arm40.transaction.ArmTransactionFactory
All Implemented Interfaces:
ArmInterface, ArmTransactionFactory

public class ArmTransactionFactory
extends ArmFactory
implements ArmTransactionFactory

ArmTransactionFactory provides methods to create instances of the classes in the org.opengroup.arm40.transaction package. An error callback method can be registered for objects created with this factory. ArmTransactionFactory is instantiated using a class loader. The actual name of the factory implementation class is obtained from the system property whose name is provided in the propertyKey constant of ArmTransactionFactory.

Author:
dcarter

Field Summary
static java.lang.String propertyKey
           
 
Fields inherited from class org.arm4.arm40.transaction.ArmFactory
m_nativeLoaded
 
Fields inherited from class org.arm4.arm40.transaction.ArmInterface
m_errorCode, m_factory
 
Constructor Summary
ArmTransactionFactory()
           
 
Method Summary
 ArmApplication newArmApplication(ArmApplicationDefinition definition, java.lang.String group, java.lang.String instance, java.lang.String[] contextValues)
          Creates the ArmApplication object to which transaction instances are related.
 ArmApplicationDefinition newArmApplicationDefinition(java.lang.String name, ArmIdentityProperties identityProperties, ArmID id)
          Creates the ArmApplicationDefinition object that describes the metadata about an application.
 ArmCorrelator newArmCorrelator(byte[] corrBytes)
          Creates a correlator from a byte array in the correct format.
 ArmCorrelator newArmCorrelator(byte[] corrBytes, int offset)
          Creates a correlator from a byte array in the correct format.
 ArmID newArmID(byte[] idBytes)
          Creates the objects that contain an immutable 16-byte ID.
 ArmID newArmID(byte[] idBytes, int offset)
          Creates the objects that contain an immutable 16-byte ID.
 ArmIdentityProperties newArmIdentityProperties(java.lang.String[] identityNames, java.lang.String[] identityValues, java.lang.String[] contextNames)
          Creates an object that contains an immutable set of identity property names and values, and an immutable set of context property names.
 ArmIdentityPropertiesTransaction newArmIdentityPropertiesTransaction(java.lang.String[] identityNames, java.lang.String[] identityValues, java.lang.String[] contextNames, java.lang.String uriValue)
          Creates an object that extends newArmIdentityProperties to also include a URI property, which is also immutable.
 ArmTransaction newArmTransaction(ArmApplication app, ArmTransactionDefinition definition)
          Creates an object that represents an instance of a transaction.
 ArmTransactionDefinition newArmTransactionDefinition(ArmApplicationDefinition app, java.lang.String name, ArmIdentityPropertiesTransaction identityProperties, ArmID id)
          Creates an object that represents the metadata about a transaction.
 ArmUser newArmUser(java.lang.String name, ArmID id)
          Creates an ArmUser object that represents the user who invoked (directly or indirectly) the transaction.
 boolean setErrorCallback(ArmErrorCallback errorCallback)
          Registers an error callback for objects created through this factory.
 
Methods inherited from class org.arm4.arm40.transaction.ArmInterface
getErrorCode, getErrorMessage, getFactory, setErrorCode, setFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opengroup.arm40.transaction.ArmInterface
getErrorCode, getErrorMessage, setErrorCode
 

Field Detail

propertyKey

public static final java.lang.String propertyKey
See Also:
Constant Field Values
Constructor Detail

ArmTransactionFactory

public ArmTransactionFactory()
Method Detail

newArmApplication

public ArmApplication newArmApplication(ArmApplicationDefinition definition,
                                        java.lang.String group,
                                        java.lang.String instance,
                                        java.lang.String[] contextValues)
Description copied from interface: ArmTransactionFactory
Creates the ArmApplication object to which transaction instances are related. definition is the only required non-null parameter.

Specified by:
newArmApplication in interface ArmTransactionFactory
Parameters:
definition - metadata describing the type of the ARM application. Must not be null.
group - Name of the group the application belongs to. May be null.
instance - Name this application instance is given. May be null.
contextValues - An array of strings providing the value parts of (name,value) context properties. May be null.
Returns:
a new ArmApplication instance.
See Also:
ArmApplication

newArmApplicationDefinition

public ArmApplicationDefinition newArmApplicationDefinition(java.lang.String name,
                                                            ArmIdentityProperties identityProperties,
                                                            ArmID id)
Description copied from interface: ArmTransactionFactory
Creates the ArmApplicationDefinition object that describes the metadata about an application. That is, the descriptive data that is the same for all instances of the same application. name is the only required non-null parameter.

Specified by:
newArmApplicationDefinition in interface ArmTransactionFactory
Parameters:
name - the name of the application type. A name should be chosen that is unique. Must not be null
identityProperties - a set of properties contibuting to the identity of the application definition. May be null. See ArmTransactionFactory.newArmIdentityProperties(java.lang.String[], java.lang.String[], java.lang.String[]).
id - An optional 16-byte ID associated with the identity of the application definition.
Returns:
a new ArmApplicationDefinition.
See Also:
ArmApplicationDefinition

newArmCorrelator

public ArmCorrelator newArmCorrelator(byte[] corrBytes)
Description copied from interface: ArmTransactionFactory
Creates a correlator from a byte array in the correct format. No length field is passed to this method because ARM requires that the length of the correlator be found in the first two bytes (in network byte order) of the byte array. The correlator must be no longer than ArmConstants.ARM_CORR_MAX_LENGTH. If the correlator is longer than the ARM implementation supports, an ArmCorrelator object will be created, but it may contain dummy data, at the discretion of the ARM implementation.

Specified by:
newArmCorrelator in interface ArmTransactionFactory
Parameters:
corrBytes - a byte array containig correlator data.
Returns:
a new ArmCorrelator.
See Also:
ArmCorrelator

newArmCorrelator

public ArmCorrelator newArmCorrelator(byte[] corrBytes,
                                      int offset)
Description copied from interface: ArmTransactionFactory
Creates a correlator from a byte array in the correct format. See description of ArmTransactionFactory.newArmCorrelator(byte[]). Since the start of the correlator bytes within the array is at position offset, the length of the correlator is taken from the bytes at offset and offset+1.

Specified by:
newArmCorrelator in interface ArmTransactionFactory
Parameters:
corrBytes - a byte array containig correlator data.
offset - start of the correlator bytes within the array.
Returns:
a new ArmCorrelator.

newArmID

public ArmID newArmID(byte[] idBytes)
Description copied from interface: ArmTransactionFactory
Creates the objects that contain an immutable 16-byte ID. Having 16-byte IDs accommodates some widely used IDs, such as the UUID (universally unique identifier) defined in the DCE and IETF standards.

Specified by:
newArmID in interface ArmTransactionFactory
Parameters:
idBytes - a byte array containig ID data.
Returns:
a new ArmID.
See Also:
ArmID

newArmID

public ArmID newArmID(byte[] idBytes,
                      int offset)
Description copied from interface: ArmTransactionFactory
Creates the objects that contain an immutable 16-byte ID. See description of ArmTransactionFactory.newArmID(byte[]).

Specified by:
newArmID in interface ArmTransactionFactory
Parameters:
idBytes - a byte array containig ID data.
offset - start of the ID bytes within the array.
Returns:
a new ArmID.

newArmIdentityProperties

public ArmIdentityProperties newArmIdentityProperties(java.lang.String[] identityNames,
                                                      java.lang.String[] identityValues,
                                                      java.lang.String[] contextNames)
Description copied from interface: ArmTransactionFactory
Creates an object that contains an immutable set of identity property names and values, and an immutable set of context property names. These properties describe identity properties that are common to all instances of an application or transaction.

The names and values are provided in arrays of strings. There can be up to twenty elements in each of the arrays. A null reference and a zero-length string are both treated as a null element. It is permissible to have null elements in the middle of the array. For example, it is permissible for the elements at indices 0 and 19 to be non-null and all the elements from indices 1 to 18 to be null. The arrays are position sensitive.

The identity property name and value arrays should contain the same number of elements at the same array indices; for each non-null name or value, there should be a corresponding non-null value or name, respectively, at the same array index. For any array index, if either the name or the value is null, both the name and the value are ignored.

The context property names are provided in this object. The context values are provided in an ArmApplication, ArmTransaction or ArmTranReport object. If the name at an array index is null, the corresponding value in those objects is ignored.

Specified by:
newArmIdentityProperties in interface ArmTransactionFactory
Parameters:
identityNames - an array of identity property names.
identityValues - an array of identity property values.
contextNames - an array of identity property names.
Returns:
a new object.
See Also:
ArmIdentityProperties

newArmIdentityPropertiesTransaction

public ArmIdentityPropertiesTransaction newArmIdentityPropertiesTransaction(java.lang.String[] identityNames,
                                                                            java.lang.String[] identityValues,
                                                                            java.lang.String[] contextNames,
                                                                            java.lang.String uriValue)
Description copied from interface: ArmTransactionFactory
Creates an object that extends newArmIdentityProperties to also include a URI property, which is also immutable. See the ArmTransactionFactory.newArmIdentityProperties(java.lang.String[], java.lang.String[], java.lang.String[]) description for all other parameters.

Specified by:
newArmIdentityPropertiesTransaction in interface ArmTransactionFactory
Parameters:
identityNames - an array of identity property names.
identityValues - an array of identity property values.
contextNames - an array of identity property names.
uriValue - the URI property value.
Returns:
a new object.
See Also:
ArmIdentityPropertiesTransaction

newArmTransaction

public ArmTransaction newArmTransaction(ArmApplication app,
                                        ArmTransactionDefinition definition)
Description copied from interface: ArmTransactionFactory
Creates an object that represents an instance of a transaction.

Specified by:
newArmTransaction in interface ArmTransactionFactory
Parameters:
app - the application instance the transaction belongs to.
definition - the metadata describing the type of the transaction.
Returns:
a new ArmTransaction instance.
See Also:
ArmTransaction

newArmTransactionDefinition

public ArmTransactionDefinition newArmTransactionDefinition(ArmApplicationDefinition app,
                                                            java.lang.String name,
                                                            ArmIdentityPropertiesTransaction identityProperties,
                                                            ArmID id)
Description copied from interface: ArmTransactionFactory
Creates an object that represents the metadata about a transaction.

Specified by:
newArmTransactionDefinition in interface ArmTransactionFactory
Parameters:
app - the metadata describing the type of the containing application. Must not be null.
name - the name of the transaction type. A name should be chosen that is unique. Must not be null.
identityProperties - a set of properties contibuting to the identity of the transaction definition. May be null. See ArmTransactionFactory.newArmIdentityProperties(java.lang.String[], java.lang.String[], java.lang.String[]).
id - An optional 16-byte ID associated with the identity of the transaction definition.
Returns:
a new ArmTransactionDefinition.
See Also:
ArmTransactionDefinition

newArmUser

public ArmUser newArmUser(java.lang.String name,
                          ArmID id)
Description copied from interface: ArmTransactionFactory
Creates an ArmUser object that represents the user who invoked (directly or indirectly) the transaction.

Specified by:
newArmUser in interface ArmTransactionFactory
Parameters:
name - name of the user.
id - An optional 16-byte ID associated with the user.
Returns:
a new ArmUser object.
See Also:
ArmUser

setErrorCallback

public boolean setErrorCallback(ArmErrorCallback errorCallback)
Description copied from interface: ArmTransactionFactory
Registers an error callback for objects created through this factory. See the error handling philosophy comment in the description of this interface.

Specified by:
setErrorCallback in interface ArmTransactionFactory
Overrides:
setErrorCallback in class ArmFactory
Parameters:
errorCallback - an application object implementing the ArmErrorCallback> interface.
Returns:
true if registration is accepted.