org.openorb.util
Class RepoIDHelper

java.lang.Object
  |
  +--org.openorb.util.RepoIDHelper

public final class RepoIDHelper
extends java.lang.Object

This class provides helper methods for repositiory id handling.

Version:
$Revision: 1.8 $ $Date: 2002/07/14 19:12:40 $
Author:
Chris Wood

Field Summary
static int TYPE_DEFAULT_FACTORY
          A default factory type (???).
static int TYPE_HELPER
          A helper class type (ITFHelper.java).
static int TYPE_HOLDER
          A holder class type (ITFHolder.java).
static int TYPE_IMPLBASE
          An implbase class type (ITFImplBase.java (BOA)).
static int TYPE_OPERATIONS
          A operations class type (ITFOperations.java).
static int TYPE_PLAIN
          A plain class type (ITF.java).
static int TYPE_POA
          A POA class type (ITFPOA.java).
static int TYPE_POATIE
          A POA tie class type (ITFPOATie.java).
static int TYPE_STUB
          A stub class type (ITFStub.java).
static int TYPE_TIE
          A tie class type (_ITFTie.java).
 
Constructor Summary
RepoIDHelper()
           
 
Method Summary
static boolean checkID(java.lang.String id)
          This methods checks whether the passed repository identifier is valid or not.
static boolean checkIdentifier(java.lang.String name)
          This methods checks an indetifier for validity in the target language.
static java.lang.Object createIsATest(java.lang.String id)
          This returns an object which can be used to test if some other repository ID is an instance of this one.
static java.lang.String decorate(java.lang.String name, int type)
          This methods decorates a class name with the suffixes depending on the type of the class about to be created.
static java.lang.String idToClass(java.lang.String name)
          This method tries to extract the class name from the repository id.
static java.lang.String idToClass(java.lang.String name, int type)
          This method tries to extract the class name from the repository id.
static java.lang.String idToClassname(java.lang.String name)
          Convert the repository id to a class name.
static java.lang.String idToPackage(java.lang.String name)
          Extract the Java package name from the IDL repository identifier.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_PLAIN

public static final int TYPE_PLAIN
A plain class type (ITF.java).

TYPE_STUB

public static final int TYPE_STUB
A stub class type (ITFStub.java).

TYPE_HELPER

public static final int TYPE_HELPER
A helper class type (ITFHelper.java).

TYPE_HOLDER

public static final int TYPE_HOLDER
A holder class type (ITFHolder.java).

TYPE_DEFAULT_FACTORY

public static final int TYPE_DEFAULT_FACTORY
A default factory type (???).

TYPE_OPERATIONS

public static final int TYPE_OPERATIONS
A operations class type (ITFOperations.java).

TYPE_IMPLBASE

public static final int TYPE_IMPLBASE
An implbase class type (ITFImplBase.java (BOA)).

TYPE_POA

public static final int TYPE_POA
A POA class type (ITFPOA.java).

TYPE_POATIE

public static final int TYPE_POATIE
A POA tie class type (ITFPOATie.java).

TYPE_TIE

public static final int TYPE_TIE
A tie class type (_ITFTie.java).
Constructor Detail

RepoIDHelper

public RepoIDHelper()
Method Detail

decorate

public static java.lang.String decorate(java.lang.String name,
                                        int type)
This methods decorates a class name with the suffixes depending on the type of the class about to be created.
Parameters:
name - The class name to be decorated.
type - The type of the class about to be created.
Returns:
The decorated name.

checkID

public static boolean checkID(java.lang.String id)
This methods checks whether the passed repository identifier is valid or not.
Parameters:
id - The repository id to check.
Returns:
True if id is a valid repository identifier, false otherwise.

checkIdentifier

public static boolean checkIdentifier(java.lang.String name)
This methods checks an indetifier for validity in the target language. The identifier must match the following pattern ([a-z][A-Z])+([a-z][A-Z_][0-9])*.
Parameters:
name - The identifier to check.
Returns:
True if ??? false otherwise.

idToPackage

public static java.lang.String idToPackage(java.lang.String name)
Extract the Java package name from the IDL repository identifier.
Parameters:
name - The repository id to extract the package name from.
Returns:
The package information converted from the repository id.

idToClassname

public static java.lang.String idToClassname(java.lang.String name)
Convert the repository id to a class name.
Parameters:
name - The repository id to extract the class name from.
Returns:
The name of the class extracted from the repository id.

idToClass

public static java.lang.String idToClass(java.lang.String name)
This method tries to extract the class name from the repository id.
Parameters:
name - The repository id name.
Returns:
The Java class name for the repository id.

idToClass

public static java.lang.String idToClass(java.lang.String name,
                                         int type)
This method tries to extract the class name from the repository id.
Parameters:
name - The repository id name.
type - The type of the class to create.
Returns:
The Java class name for the repository id.

createIsATest

public static java.lang.Object createIsATest(java.lang.String id)
This returns an object which can be used to test if some other repository ID is an instance of this one.

Examples:

 RepoIDHelper.createIsATest( "IDL:MyObj:1.0" ).equals( 
         "IDL:MyObj:1.0" ) == true
 RepoIDHelper.createIsATest( "IDL:MyObj:1.1" ).equals(
         "IDL:MyObj:1.0" ) == true
 RepoIDHelper.createIsATest( "IDL:MyObj:1.0" ).equals(
         "IDL:MyObj:1.1" ) == false
 RepoIDHelper.createIsATest( "IDL:MyObj:2.0" ).equals(
         "IDL:MyObj:1.1" ) == false
 
Parameters:
id - The repository id to test.
Returns:
The test object or the id if the parsing failed.