com.apelon.dts.common
Class IIDGenerator

java.lang.Object
  extended by com.apelon.dts.common.IIDGenerator

public class IIDGenerator
extends Object

Description: Generates a Unique Instance Identifier (IID) for the given namespace. The IIDs are unique as the namespace id is embedded as 16 MSB and 48 LSB have the sequence number.

IIDs are unique numbers to identify an instance of an DTS Schema Object (ex: Property, Association, Qualifier, etc)

Copyright: Copyright (c) 2005

Company: Apelon, Inc.

Version:
1.0
Author:
unascribed

Field Summary
static int EXIT_OPTION
           
static int IID_OPTION
           
static int LIMIT_OPTION
           
static String PROMPT
           
 
Constructor Summary
IIDGenerator()
           
 
Method Summary
static long getIdFromIID(long iid)
          Given an IID, this method will get the sequence_id (48 lsb bits) for it
static long getIID(int namespace_id, long seq_id)
          Synthesis a IID from a given namespace id (16 bits), object id (48 bits)
static int getNamespaceIdFromGid(long gid)
          Given a GID, its namespaceId can be found with this method.
static long[] getNamespaceMaxAndMinGID(int namespace_id)
          Deprecated. Use getNamespaceMaxAndMinIID() instead
static long[] getNamespaceMaxAndMinIID(int namespace_id)
          A method to get the IID boundaries per namespace.
static void main(String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROMPT

public static String PROMPT

IID_OPTION

public static int IID_OPTION

LIMIT_OPTION

public static int LIMIT_OPTION

EXIT_OPTION

public static int EXIT_OPTION
Constructor Detail

IIDGenerator

public IIDGenerator()
Method Detail

getIID

public static long getIID(int namespace_id,
                          long seq_id)
Synthesis a IID from a given namespace id (16 bits), object id (48 bits)

Parameters:
namespace_id - the namespace id
seq_id - the object id
Returns:
the IID value

getNamespaceIdFromGid

public static int getNamespaceIdFromGid(long gid)
Given a GID, its namespaceId can be found with this method.

Parameters:
gid - The gid whose namespace id is to be found
Returns:
The namespace id

getIdFromIID

public static long getIdFromIID(long iid)
Given an IID, this method will get the sequence_id (48 lsb bits) for it

Parameters:
iid - The IID value to be inspected
Returns:
the sequence_id in above IID.

getNamespaceMaxAndMinGID

public static long[] getNamespaceMaxAndMinGID(int namespace_id)
Deprecated. Use getNamespaceMaxAndMinIID() instead

A method to get the IID boundaries per namespace. Can be useful when making selective queries and the table does not have namespace information (id).

Parameters:
namespace_id - the namespace id
Returns:
a long array of size 2, with minimum IID value as the first element and maximum IID value as the second element

getNamespaceMaxAndMinIID

public static long[] getNamespaceMaxAndMinIID(int namespace_id)
A method to get the IID boundaries per namespace. Can be useful when making selective queries and the table does not have namespace information (id).

Parameters:
namespace_id - the namespace id
Returns:
a long array of size 2, with minimum IID value as the first element and maximum IID value as the second element

main

public static void main(String[] args)


Copyright © 2011. All Rights Reserved.