Fuego Process API

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 the declaration of an instance.

An instance is formed by: the processId, the instance in, and the thread in.

Here are available all those operations over an instance id, such as obtaining the process id, or the thread in from it.

See Also:
Serialized Form

Field Summary
static String NAME_SEPARATOR
           
static String ORGANIZATION_SEPARATOR
           
 
Constructor Summary
InstanceId(int processIn, int instanceIn, int threadIn)
          simple constructor for using key
 
Method Summary
static int compare(InstanceId a, InstanceId b)
           
 int compareTo(Object b)
          Implementation of the method inherited from the interface Comparable
static boolean equals(InstanceId a, InstanceId b)
           
 boolean equals(Object o)
          Implementation of the method inherited from the interface Comparable
static InstanceId getInstanceId(InstanceInfo instanceInfo)
          Generate a new InstanceId from a InstanceInfo.
static String getInstanceId(String globalInstanceId)
          Returns the Instance Id without the organization
 int getInstanceIn()
          Gets the instance identification number
static int getInstanceIn(String instanceId)
          Returns the Instance IN from a specific Instance Id
static String getOrganization(String globalInstanceId)
          Returns the Organization from a specific GlobalInstanceId
static String getProcessId(String instanceId)
          Returns the Process Id from a specific InstanceId
 int getProcessIn()
          Gets the process identification number where this instance has been created
 int getThreadIn()
          Gets the instance thread identification number.
static int getThreadIn(String instanceId)
          Returns the Instance Thread from a specific Instance Id.
 int hashCode()
          Gets the hashcode for this instance
static boolean isProcessId(String instanceOrProcessId)
           
static boolean isValidInstanceId(String instanceId)
          Validates the correct sintax of a specific Instance Id.
static String makeGlobalId(String organization, String processId, int instanceIn)
          Through this method a new global instance id will be created
static String makeGlobalId(String organization, String processId, int instanceIn, int threadIn)
          Through this method a new global instance id will be created
 String makeId(String processId)
          Through this method a new instance id will be retrieved for the given process id
static String makeId(String processId, int instanceIn)
          Through this method a new instance id will be created
static String makeId(String processId, int instanceIn, int threadIn)
          Through this method a new instance id will be created
 String toString()
          Gets the String representation of the instance
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME_SEPARATOR


public static final String NAME_SEPARATOR
See Also:
Constant Field Values

ORGANIZATION_SEPARATOR


public static final String ORGANIZATION_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

InstanceId


public InstanceId(int processIn,
                  int instanceIn,
                  int threadIn)
simple constructor for using key

Parameters:
processIn -
instanceIn -
threadIn -
Method Detail

getInstanceId


public static final InstanceId getInstanceId(InstanceInfo instanceInfo)
Generate a new InstanceId from a InstanceInfo.

Parameters:
instanceInfo -
Returns:

getInstanceIn


public final int getInstanceIn()
Gets the instance identification number


getProcessIn


public final int getProcessIn()
Gets the process identification number where this instance has been created


getThreadIn


public final int getThreadIn()
Gets the instance 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.


compare


public static final int compare(InstanceId a,
                                InstanceId b)

equals


public final boolean equals(Object o)
Implementation of the method inherited from the interface Comparable


equals


public static final boolean equals(InstanceId a,
                                   InstanceId b)

compareTo


public final int compareTo(Object b)
Implementation of the method inherited from the interface Comparable

Specified by:
compareTo in interface Comparable

getInstanceId


public static String getInstanceId(String globalInstanceId)
Returns the Instance Id without the organization

Parameters:
globalInstanceId - Global Instance Id. Note: this parameter must not be null
Returns:

getInstanceIn


public static int getInstanceIn(String instanceId)
Returns the Instance IN from a specific Instance Id

Parameters:
instanceId - Instance Id. Note: this parameter must not be null.
Returns:
Returns an Instance IN if exist and -1 if not exist.
Throws:
NullPointerException - when instanceId is null.

getOrganization


public static String getOrganization(String globalInstanceId)
Returns the Organization from a specific GlobalInstanceId

Parameters:
globalInstanceId - Global Instance Id (Instance Id with the Organization)
Returns:

getProcessId


public static String getProcessId(String instanceId)
Returns the Process Id from a specific InstanceId

Parameters:
instanceId - Instance Id
Returns:

isProcessId


public static boolean isProcessId(String instanceOrProcessId)

getThreadIn


public static int getThreadIn(String instanceId)
Returns the Instance Thread from a specific Instance Id.

Parameters:
instanceId - Instance Id. Note: this parameter must not be null.
Returns:
Returns an Instance Thread if exist and -1 if not exist.
Throws:
NullPointerException - when instanceId is null.

isValidInstanceId


public static boolean isValidInstanceId(String instanceId)
Validates the correct sintax of a specific Instance Id.

Parameters:
instanceId - It must not be null.
Throws:
NullPointerException - when instanceId is null.

hashCode


public int hashCode()
Gets the hashcode for this instance


makeGlobalId


public static String makeGlobalId(String organization,
                                  String processId,
                                  int instanceIn)
Through this method a new global instance id will be created

Parameters:
organization -
processId -
instanceIn -
Returns:
an Instance Id for specified Organization, Process Id and Instance Identification Number.

makeGlobalId


public static String makeGlobalId(String organization,
                                  String processId,
                                  int instanceIn,
                                  int threadIn)
Through this method a new global instance id will be created

Parameters:
organization -
processId -
instanceIn -
threadIn -
Returns:
an Instance Id for specified Organization, Process Id, Instance Identification Number and Thread Identification Number.

makeId


public String makeId(String processId)
Through this method a new instance id will be retrieved for the given process id


makeId


public static String makeId(String processId,
                            int instanceIn)
Through this method a new instance id will be created

Parameters:
processId -
instanceIn -
Returns:
an instance id for specific Process Id and Instance Identification Number.

makeId


public static String makeId(String processId,
                            int instanceIn,
                            int threadIn)
Through this method a new instance id will be created

Parameters:
processId -
instanceIn -
threadIn -
Returns:
an Instance Id for specified Process Id, Instance Identification Number and Thread Identification Number.

toString


public String toString()
Gets the String representation of the instance


Fuego Process API

© Copyright 1996/2003 Fuego Inc. All Rights Reserved