ALBPM Process API (PAPI)

fuego.papi
Class InstanceId

java.lang.Object
  extended byfuego.papi.InstanceId
All Implemented Interfaces:
Comparable, Serializable
Direct Known Subclasses:
InstanceInfo

public class InstanceId
extends Object
implements Comparable, Serializable

Contains information about an instance, including process Id, instance identification number and thread identification number.

See Also:
Serialized Form

Field Summary
static String NAME_SEPARATOR
          Separates parts of an instance id
static String ORGANIZATION_SEPARATOR
          Organization separator
 
Constructor Summary
InstanceId(int processIn, int instanceIn, int threadIn)
          Creates a new InstanceId object.
 
Method Summary
static int compare(InstanceId a, InstanceId b)
          Compares two InstanceIds
 int compareTo(Object b)
          Implementation of the compareTo method from the Comparable interface.
static boolean equals(InstanceId a, InstanceId b)
          Returns true if the specified InstanceIds are equal.
 boolean equals(Object o)
          Returns true if the specified Object is equal to this instanceId.
static InstanceId getInstanceId(InstanceInfo instanceInfo)
          Gets the InstanceId from the specified InstanceInfo.
static String getInstanceId(String globalInstanceId)
          Returns the InstanceId without the organization.
 int getInstanceIn()
          Gets the instance identification number.
static int getInstanceIn(String instanceId)
          Returns the instance identification number.
static String getOrganization(String globalInstanceId)
          Gets the Organization name from the specified globalInstanceId.
static String getProcessId(String instanceId)
          Gets the Process Id from the specified InstanceId.
 int getProcessIn()
          Gets the process identification number.
 int getThreadIn()
          Gets the thread identification number.
If the instance has a father, the thread in is the number of child the instance is.
static int getThreadIn(String instanceId)
          Gets the thread identification number.
 int hashCode()
          Returns a hash code value for the object.
static boolean isProcessId(String instanceOrProcessId)
          Returns true if the specified Id is a ProcessId.
static boolean isValidInstanceId(String instanceId)
          Returns true if the specified InstanceId contains a process id, an instance identification number, and a thread identification number.
static String makeGlobalId(String organization, String processId, int instanceIn)
          Makes a global InstanceId using the specified organization, processId, and instance identification number.
static String makeGlobalId(String organization, String processId, int instanceIn, int threadIn)
          Makes a global InstanceId using the specified organization, processId, instance identification number, and thread identification number.
 String makeId(String processId)
          Makes a new InstanceId using the specified processId.
static String makeId(String processId, int instanceIn)
          Makes a new InstanceId using the specified processId and instance identification number.
static String makeId(String processId, int instanceIn, int threadIn)
          Makes a new InstanceId using the specified processId,instance identification number, and thread identification number.
 String toString()
          Returns a String containing the process identification number, the instance identification number, and the thread identification number.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME_SEPARATOR

public static final String NAME_SEPARATOR
Separates parts of an instance id

See Also:
Constant Field Values

ORGANIZATION_SEPARATOR

public static final String ORGANIZATION_SEPARATOR
Organization separator

See Also:
Constant Field Values
Constructor Detail

InstanceId

public InstanceId(int processIn,
                  int instanceIn,
                  int threadIn)
Creates a new InstanceId object.

Parameters:
processIn - process identification number.
instanceIn - instance identification number.
threadIn - thread identification number.
Method Detail

getInstanceId

public static InstanceId getInstanceId(InstanceInfo instanceInfo)
Gets the InstanceId from the specified InstanceInfo.

Parameters:
instanceInfo - InstanceInfo
Returns:
InstanceId from the specified InstanceInfo

compare

public static int compare(InstanceId a,
                          InstanceId b)
Compares two InstanceIds

Parameters:
a - first InstanceId
b - second InstanceId
Returns:
0 if the two are greater, 1 if a is greater, -1 if b is greater.

equals

public static boolean equals(InstanceId a,
                             InstanceId b)
Returns true if the specified InstanceIds are equal.

Parameters:
a - first InstanceId to compare.
b - second InstanceId to compare.
Returns:
true if the specified InstanceIds are equal.

getInstanceId

public static String getInstanceId(String globalInstanceId)
Returns the InstanceId without the organization.

Parameters:
globalInstanceId - InstanceId containing the organization. Cannot be null.
Returns:
InstanceId without the organization

getInstanceIn

public static int getInstanceIn(String instanceId)
Returns the instance identification number.

Parameters:
instanceId - InstanceId. Cannot be null.
Returns:
Instance identification number, or -1 if an invalid instance Id.

getOrganization

public static String getOrganization(String globalInstanceId)
Gets the Organization name from the specified globalInstanceId.

Parameters:
globalInstanceId - InstanceId containing an organization name.
Returns:
Organization name from the specified globalInstanceId

getProcessId

public static String getProcessId(String instanceId)
Gets the Process Id from the specified InstanceId.

Parameters:
instanceId - InstanceId to check for processId.
Returns:
Process Id from the specified InstanceId.

isProcessId

public static boolean isProcessId(String instanceOrProcessId)
Returns true if the specified Id is a ProcessId.

Parameters:
instanceOrProcessId - Id to check.
Returns:
true if the specified Id is a ProcessId

getThreadIn

public static int getThreadIn(String instanceId)
Gets the thread identification number.

Parameters:
instanceId - InstanceId to check. Cannot be null.
Returns:
Thread identification number, or -1 if there is no thread identification number in this instance.

isValidInstanceId

public static boolean isValidInstanceId(String instanceId)
Returns true if the specified InstanceId contains a process id, an instance identification number, and a thread identification number.

Parameters:
instanceId - InstanceID to check. Cannot be null.
Returns:
true if the specified InstanceId contains a process id, an instance identification number, and a thread identification number

makeGlobalId

public static String makeGlobalId(String organization,
                                  String processId,
                                  int instanceIn)
Makes a global InstanceId using the specified organization, processId, and instance identification number.

Parameters:
organization - organization name. Cannot be null.
processId - process Id. Cannot be null.
instanceIn - instance identification number.
Returns:
InstanceId using the specified organization, processId, and instance identification number

makeGlobalId

public static String makeGlobalId(String organization,
                                  String processId,
                                  int instanceIn,
                                  int threadIn)
Makes a global InstanceId using the specified organization, processId, instance identification number, and thread identification number.

Parameters:
organization - organization name. Cannot be null.
processId - process Id. Cannot be null.
instanceIn - instance identification number.
threadIn - thread identification number.
Returns:
InstanceId using the specified organization, processId, instance identification number, and thread identification number

makeId

public static String makeId(String processId,
                            int instanceIn)
Makes a new InstanceId using the specified processId and instance identification number.

Parameters:
processId - process Id. Cannot be null.
instanceIn - instance identification number.
Returns:
New InstanceId using the specified processId and instance identification number

makeId

public static String makeId(String processId,
                            int instanceIn,
                            int threadIn)
Makes a new InstanceId using the specified processId,instance identification number, and thread identification number.

Parameters:
processId - process Id.
instanceIn - instance identification number.
threadIn - thread identification number.
Returns:
New InstanceId using the specified processId,instance identification number, and thread identification number.

getInstanceIn

public final int getInstanceIn()
Gets the instance identification number.

Returns:
Instance identification number

getProcessIn

public final int getProcessIn()
Gets the process identification number.

Returns:
Process identification number.

getThreadIn

public final int getThreadIn()
Gets the thread identification number.
If the instance has a father, the thread in is the number of child the instance is. Otherwise this number is 0.

Returns:
Thread identification number.

equals

public final boolean equals(Object o)
Returns true if the specified Object is equal to this instanceId.

Parameters:
o - Object to compare
Returns:
true if the specified Object is equal to this instanceId.

compareTo

public final int compareTo(Object b)
Implementation of the compareTo method from the Comparable interface. Calls compare(this, b)

Specified by:
compareTo in interface Comparable
Parameters:
b - InstanceId to compare
Returns:
0 if the two are greater, 1 if this is greater, -1 if b is greater.

hashCode

public int hashCode()
Returns a hash code value for the object.

Returns:
a hash code value for this object.

makeId

public String makeId(String processId)
Makes a new InstanceId using the specified processId.

Parameters:
processId - process Id. Cannot be null.
Returns:
New InstanceId using the specified processId.

toString

public String toString()
Returns a String containing the process identification number, the instance identification number, and the thread identification number.

Returns:
String containing the process identification number, the instance identification number, and the thread identification number.

ALBPM Process API (PAPI)

© Copyright 1996/2005 Fuego Inc. All Rights Reserved