com.bea.wli.config
Class Ref

java.lang.Object
  extended by com.bea.wli.config.Ref
All Implemented Interfaces:
Serializable, Comparable

public class Ref
extends Object
implements Serializable, Comparable

A Ref uniquely represents a resource, project or folder that is managed by the Configuration system. A Ref object has two components: A typeId that indicates whether it is a project, folder, or a resource, and an array of names of non-zero length. For a resource the array of names start with the project name, followed by folder names, and end with the resource name. For a project, the Ref object simply contains one name component, that is, the project name. A Ref object for a folder contains the project name followed by the names of the folders which it is nested under.

A special Ref DOMAIN refers to the whole domain.

Note: this class has a natural ordering that is inconsistent with equals.

See Also:
Serialized Form

Field Summary
static Ref DEFAULT_PROJECT_REF
          Default project reference
static Ref DOMAIN
          Reference to the domain
static String DOMAIN_REF
           
static String FOLDER_DATA_LOCAL_NAME
          Local name for folderdata
static String FOLDER_REF
           
static int MAX_FOLDER_OR_PROJECT_PART_LENGTH
           
static String PROJECT_DATA_LOCAL_NAME
          Local name for project data
static String PROJECT_REF
           
static char SEPARATOR_CHAR
          Character that separates hierarchical names
static String SEPARATOR_CHAR_PATTERN
          REgular expression representation of the separateor char for pattern matching purposes.
static long serialVersionUID
           
static Ref STATIC_PROJECT_REF
          Internal project that always exists
static Ref SYSTEM_PROJECT_REF
           
static Ref SYSTEM_UDDI_FOLDER
           
 
Constructor Summary
Ref(String typeId, Ref parent, String name)
          Constructor for creating a reference to an object under a particular parent
Ref(String typeId, String[] names)
          Constructor for creating an arbitrary reference.
 
Method Summary
static void _assertValidLocalNamePart(String name)
           
static void _assertValidProjectOrFolderPart(String name)
           
 int compareTo(Object o)
           
 boolean equals(Object o)
           
static Ref getDomainRef()
          Returns the (only) reference to the service bus domain
 String getFullName()
          Returns the full name of the object.
 String getGlobalName()
           
 String getLocalName()
          Returns the local name (last name) for the given ref
static String getLocalNamePart(String fullName)
          Returns the local name part of the full name.
 String[] getNames()
          Returns the hierarchical name for the object referenced.
static String[] getNames(String fullName)
          converts a fullname into its components by splitting it at the separator character SEPARATOR_CHAR
static String getParentNamePart(String fullName)
          Returns the parent name part of the full name.
 Ref getParentRef()
          Returns a reference to the parent.
 Ref getProject()
          Returns the project If this is a resource reference, project reference of a folder reference.
 String getProjectName()
          Returns the project name If this is a resource reference, project reference of a folder reference.
 String getTypeId()
          Returns the type of the reference
 int hashCode()
           
 boolean isDescendantOf(Ref ancestor)
          Returns true if this reference is a descendent (child, grandchild etc...) of the given reference
 boolean isDomainRef()
          Returns true if this is the domain reference
 boolean isFolderRef()
          Returns true if this is a folder reference
 boolean isProjectRef()
          Returns true if this is a project reference
 boolean isResourceRef()
          REturns true if this is a resource reference
static Ref makeBusinessSvcRef(Ref parent, String serviceName)
          Constructs a reference to a business service component
static Ref makeBusinessSvcRef(String businessSvcName)
          Deprecated.  
static Ref makeFolderRef(Ref parent, String folderName)
          Constructs a reference to a folder
static Ref makeLocationDataRef(Ref location)
          Creates a reference to the metadata that is kept for the given location (folder or project).
static Ref makeLocationRef(String location)
           Factory method to create parent ref for the given location.
static Ref makeMflRef(Ref parent, String mflId)
          Constructs a reference to an MFL component
static Ref makeParentRef(String fullName)
          Convenience method to create the parent ref for a given full name.
static Ref makeProjectRef(String projectName)
          Constructs a reference to project
static Ref makeProxyRef(Ref parent, String proxyName)
          Constructs a reference to a proxy service
static Ref makeProxyRef(String proxyName)
          Deprecated.  
static Ref makeRef(String typeId, Ref parent, String localname)
          Constructs a reference to an arbitrary object other than the domain and that is hierarchical.
static Ref makeRef(String typeId, String[] names)
          Constructs a reference to an arbitrary object other than the domain.
static Ref makeResourceRef(String resourceType, Ref projectOrFolderRef, String resourceName)
          Convenience constructor for creating an arbitrary resource reference
static Ref makeSecurityPolicyRef(Ref parent, String policyName)
          Constructs a reference to a security policy component
static Ref makeServiceAccountRef(Ref parent, String accountName)
          Constructs a reference to a service account component
static Ref makeServiceProviderRef(Ref parent, String providerName)
          Constructs a reference to a service provider component
static Ref makeStatisticDomainRef(Ref parent, String domainName)
          Constructs a reference to a statistic domain component
static Ref makeStatisticRef(Ref parent, String resourceID)
          Constructs a reference to a Statistic component
static Ref makeTaskRef(Ref parent, String taskName)
          Constructs a reference to a Task component
static Ref makeWsdlRef(Ref parent, String wsdlId)
          Constructs a reference to a WSDL component
static Ref makeXmlSchemaRef(Ref parent, String schemaId)
          Constructs a reference to an xml schema component
static Ref makeXqueryRef(Ref parent, String xqueryId)
          Constructs a reference to an Xquery component
static Ref makeXsltRef(Ref parent, String xsltId)
          Constructs a reference to an XSLT component
static Ref parseGlobalName(String globalName)
           
 Object readResolve()
           
static void sort(List<Ref> refList)
           This method returns sorted Ref list
 String toString()
           
static boolean validateProjectOrFolderPart(StringBuilder resultMsg, String name, Locale locale)
          Utility method for validating a folder or project name.
static boolean validateResourceLocalNamePart(StringBuilder resultMsg, String name, Locale locale)
          Utility method for validating the local name of a resource.
static Ref valueOf(String str)
          Parses a references that was stringified via toString()
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values

DOMAIN_REF

public static final String DOMAIN_REF
See Also:
Constant Field Values

PROJECT_REF

public static final String PROJECT_REF
See Also:
Constant Field Values

FOLDER_REF

public static final String FOLDER_REF
See Also:
Constant Field Values

MAX_FOLDER_OR_PROJECT_PART_LENGTH

public static final int MAX_FOLDER_OR_PROJECT_PART_LENGTH
See Also:
Constant Field Values

DOMAIN

public static final Ref DOMAIN
Reference to the domain


DEFAULT_PROJECT_REF

public static final Ref DEFAULT_PROJECT_REF
Default project reference


STATIC_PROJECT_REF

public static final Ref STATIC_PROJECT_REF
Internal project that always exists


SYSTEM_PROJECT_REF

public static final Ref SYSTEM_PROJECT_REF

SYSTEM_UDDI_FOLDER

public static final Ref SYSTEM_UDDI_FOLDER

PROJECT_DATA_LOCAL_NAME

public static final String PROJECT_DATA_LOCAL_NAME
Local name for project data

See Also:
Constant Field Values

FOLDER_DATA_LOCAL_NAME

public static final String FOLDER_DATA_LOCAL_NAME
Local name for folderdata

See Also:
Constant Field Values

SEPARATOR_CHAR

public static final char SEPARATOR_CHAR
Character that separates hierarchical names

See Also:
Constant Field Values

SEPARATOR_CHAR_PATTERN

public static final String SEPARATOR_CHAR_PATTERN
REgular expression representation of the separateor char for pattern matching purposes. This string is the same as SEPARATOR_CHAR except that if the sep char is a special char it contains escape prefix "\"

See Also:
Constant Field Values
Constructor Detail

Ref

public Ref(String typeId,
           Ref parent,
           String name)
Constructor for creating a reference to an object under a particular parent

Parameters:
typeId - The type of the reference that will be created - expected to be canonical
parent - the parent. If the typeId is project the parent must be the domain reference. If the typeId is folder the parent must be a project or another folder. If the typeId indicates a resource the parent must be a project or a folder.
name - non-qualified name of the object that will be created. The full name of the created object will be computed by appending this name to the full name of the parent.

Ref

public Ref(String typeId,
           String[] names)
Constructor for creating an arbitrary reference.

Parameters:
typeId - - expected to be canonical
names -
Method Detail

getTypeId

public String getTypeId()
Returns the type of the reference

Returns:

isDomainRef

public boolean isDomainRef()
Returns true if this is the domain reference


isProjectRef

public boolean isProjectRef()
Returns true if this is a project reference


isFolderRef

public boolean isFolderRef()
Returns true if this is a folder reference


isResourceRef

public boolean isResourceRef()
REturns true if this is a resource reference


getNames

public String[] getNames()
Returns the hierarchical name for the object referenced.

Returns:

getFullName

public String getFullName()
Returns the full name of the object. This is a dot separated sequence of reference type followed by names .

Returns:

getLocalName

public String getLocalName()
Returns the local name (last name) for the given ref


getProject

public Ref getProject()
               throws IllegalStateException
Returns the project If this is a resource reference, project reference of a folder reference. Otherwise throws IllegalStateException

Returns:
Throws:
IllegalStateException - if this is not a project, folder or resource reference

getProjectName

public String getProjectName()
                      throws IllegalStateException
Returns the project name If this is a resource reference, project reference of a folder reference. Otherwise throws IllegalStateException

Returns:
Throws:
IllegalStateException - if this is not a project, folder or resource reference

getParentRef

public Ref getParentRef()
Returns a reference to the parent. Returns null if this is domain ref. Returns domain ref, if this is a project reference. Returns the parent (project or folder) reference if this is a folder or a resource.


isDescendantOf

public boolean isDescendantOf(Ref ancestor)
Returns true if this reference is a descendent (child, grandchild etc...) of the given reference

Parameters:
ancestor -
Returns:

getGlobalName

public String getGlobalName()

parseGlobalName

public static Ref parseGlobalName(String globalName)

toString

public String toString()
Overrides:
toString in class Object

valueOf

public static Ref valueOf(String str)
Parses a references that was stringified via toString()

Parameters:
str -
Returns:

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

readResolve

public Object readResolve()

makeProxyRef

public static Ref makeProxyRef(String proxyName)
Deprecated. 

Factory method for creating a reference to a proxy service

Parameters:
proxyName -

makeBusinessSvcRef

public static Ref makeBusinessSvcRef(String businessSvcName)
Deprecated. 

Factory method for creating a reference to a business service

Parameters:
businessSvcName -

makeLocationRef

public static Ref makeLocationRef(String location)
 Factory method to create parent ref for the given location.
 For Eg: if location is project1/folder1/folder2 it creates Ref object for folder2.
 

Parameters:
location -
Returns:

makeLocationDataRef

public static Ref makeLocationDataRef(Ref location)
Creates a reference to the metadata that is kept for the given location (folder or project).

Parameters:
location - the folder/project for which the location data reference will be computed
Returns:
reference to the resource that contains metadata about the given location

makeParentRef

public static Ref makeParentRef(String fullName)
Convenience method to create the parent ref for a given full name.

Parameters:
fullName -
Returns:

makeProxyRef

public static Ref makeProxyRef(Ref parent,
                               String proxyName)
Constructs a reference to a proxy service

Parameters:
parent - the parent. This can be a folder or a project.
proxyName - name of the proxy service
Returns:
a reference to a service

makeBusinessSvcRef

public static Ref makeBusinessSvcRef(Ref parent,
                                     String serviceName)
Constructs a reference to a business service component

Parameters:
parent - the parent. This can be a folder or a project.
serviceName - name of the service
Returns:
a reference to a service

makeServiceProviderRef

public static Ref makeServiceProviderRef(Ref parent,
                                         String providerName)
Constructs a reference to a service provider component

Parameters:
parent - the parent. This can be a folder or a project.
providerName - name of the service provider
Returns:
a reference to a service provider

makeServiceAccountRef

public static Ref makeServiceAccountRef(Ref parent,
                                        String accountName)
Constructs a reference to a service account component

Parameters:
parent - the parent. This can be a folder or a project.
accountName - name of the service account
Returns:
a reference to a service account

makeSecurityPolicyRef

public static Ref makeSecurityPolicyRef(Ref parent,
                                        String policyName)
Constructs a reference to a security policy component

Parameters:
parent - the parent. This can be a folder or a project.
policyName - name of the security policy
Returns:
a reference to a security policy

makeXqueryRef

public static Ref makeXqueryRef(Ref parent,
                                String xqueryId)
Constructs a reference to an Xquery component

Parameters:
parent - the parent. This can be a folder or a project.
xqueryId - id of the Xquery
Returns:
a reference to an Xquery

makeMflRef

public static Ref makeMflRef(Ref parent,
                             String mflId)
Constructs a reference to an MFL component

Parameters:
parent - the parent. This can be a folder or a project.
mflId - id of the MFL
Returns:
a reference to an MFL

makeXsltRef

public static Ref makeXsltRef(Ref parent,
                              String xsltId)
Constructs a reference to an XSLT component

Parameters:
parent - the parent. This can be a folder or a project.
xsltId - id of the XSLT
Returns:
a reference to an XSLT

makeXmlSchemaRef

public static Ref makeXmlSchemaRef(Ref parent,
                                   String schemaId)
Constructs a reference to an xml schema component

Parameters:
parent - the parent. This can be a folder or a project.
schemaId - id of the xml schema
Returns:
a reference to an xml schema

makeWsdlRef

public static Ref makeWsdlRef(Ref parent,
                              String wsdlId)
Constructs a reference to a WSDL component

Parameters:
parent - the parent. This can be a folder or a project.
wsdlId - the id of the WSDL
Returns:
a reference to a WSDL component

makeTaskRef

public static Ref makeTaskRef(Ref parent,
                              String taskName)
Constructs a reference to a Task component

Parameters:
taskName - name of the task
Returns:
a reference to a statistic

makeStatisticRef

public static Ref makeStatisticRef(Ref parent,
                                   String resourceID)
Constructs a reference to a Statistic component

Parameters:
parent - the parent. This can be a folder or a project.
resourceID - name of the OperationalResource
Returns:
a reference to a statistic

makeStatisticDomainRef

public static Ref makeStatisticDomainRef(Ref parent,
                                         String domainName)
Constructs a reference to a statistic domain component

Parameters:
parent - the parent. This can be a folder or a project.
domainName - name of the domain
Returns:
a reference to a statistic domain

makeProjectRef

public static Ref makeProjectRef(String projectName)
Constructs a reference to project

Parameters:
projectName - name of the project
Returns:
a reference to the project whose name is given.

makeFolderRef

public static Ref makeFolderRef(Ref parent,
                                String folderName)
Constructs a reference to a folder

Parameters:
parent - the parent. This can be a folder or a project.
folderName - name of the folder
Returns:
a reference to a folder

makeRef

public static Ref makeRef(String typeId,
                          Ref parent,
                          String localname)
Constructs a reference to an arbitrary object other than the domain and that is hierarchical.

Parameters:
typeId - Type of the reference to construct
parent - the parent. This can be a folder or a project.
localname - local name for the reference

makeRef

public static Ref makeRef(String typeId,
                          String[] names)
Constructs a reference to an arbitrary object other than the domain.

Parameters:
typeId - Type of the reference to construct
names - array of names that describe the path to the object being referenced.

makeResourceRef

public static Ref makeResourceRef(String resourceType,
                                  Ref projectOrFolderRef,
                                  String resourceName)
Convenience constructor for creating an arbitrary resource reference

Parameters:
resourceType - type of the resource
projectOrFolderRef - parent folder or project
resourceName - name of the resource
Returns:

getDomainRef

public static Ref getDomainRef()
Returns the (only) reference to the service bus domain


getNames

public static String[] getNames(String fullName)
converts a fullname into its components by splitting it at the separator character SEPARATOR_CHAR

Parameters:
fullName - the full (hierarchical) name to the instance

validateProjectOrFolderPart

public static boolean validateProjectOrFolderPart(StringBuilder resultMsg,
                                                  String name,
                                                  Locale locale)
Utility method for validating a folder or project name. If the name argument is valid a true value is returned and resultMsg is not affected. If the name argument is not valid, an error msg is appended to the resultMsg argument, and a false value is returned.

Parameters:
resultMsg - Error message is appended to this builder if the name is invalid.
name - the local name of the project or folder (relative to the project), e.g., myProject, or folderA
Returns:

validateResourceLocalNamePart

public static boolean validateResourceLocalNamePart(StringBuilder resultMsg,
                                                    String name,
                                                    Locale locale)
Utility method for validating the local name of a resource. If the name argument is valid a true value is returned and resultMsg is not affected. If the name argument is not valid, an error msg is appended to the resultMsg argument, and a false value is returned.

Parameters:
resultMsg - Error message is appended to this builder if the name is invalid.
name - the local name of the resource (relative to its location), e.g., myResource, myWSDL
Returns:

_assertValidProjectOrFolderPart

public static void _assertValidProjectOrFolderPart(String name)
                                            throws IllegalArgumentException
Throws:
IllegalArgumentException

_assertValidLocalNamePart

public static void _assertValidLocalNamePart(String name)
                                      throws IllegalArgumentException
Throws:
IllegalArgumentException

getLocalNamePart

public static String getLocalNamePart(String fullName)
Returns the local name part of the full name. Local name is the last component in a full path.

Parameters:
fullName -
Returns:

getParentNamePart

public static String getParentNamePart(String fullName)
Returns the parent name part of the full name. The parent name is the project or containing folder in the full path.

Parameters:
fullName -
Returns:

sort

public static void sort(List<Ref> refList)
 This method returns sorted Ref list
 

Parameters:
refList - List