com.bea.portal.tools.resource
Class ResourceID

java.lang.Object
  extended by com.bea.portal.tools.resource.ResourceID
All Implemented Interfaces
Serializable
Direct Known Subclasses:
InvalidResourceID, com.bea.portal.tools.resource.framework.TaggedResourceID, UnknownResourceID

public abstract class ResourceID
extends Object
implements Serializable

Abstract, opaque, persistent resource identifier.

See Also
Serialized Form

Constructor Summary
protected ResourceID(ResourceIDBuilder builder)
          Constructor.
  ResourceID(String resourceURN)
          Constructor.
 
Method Summary
protected abstract  StringBuilder appendResourcePath(boolean canonicalResourceURN, StringBuilder buffer)
          Append the resource path of the referrent resource.
protected  StringBuilder appendResourceTypeNamespaceURI(StringBuilder buffer)
          Append the namespace URI of the ResourceType.
protected  String computeResourceURN()
          Compute the URN of the referrent resource.
protected  StringBuilder computeResourceURN(StringBuilder buffer)
          Compute the URN of the referrent resource.
 boolean equals(Object that)
          Determine if the given Object is equal to this ResourceID.
 String getCanonicalResourceURN()
          Deprecated use getResourceURN()
 ResourceEnvironment getResourceEnvironment()
          Get the ResourceEnvironment of the referrent resource.
protected  ResourceIDBuilder getResourceIDBuilder()
          Get the ResourceIDBuilder.
 ResourceType getResourceType()
          Get the ResourceType of the referrent resource.
 String getResourceURN()
          Get the URN of the referrent resource.
 int hashCode()
          Get the hash code of this ResourceID.
static
<T extends ResourceID>
T
narrow(Class<T> type, ResourceID resourceID)
          Convert the given ResourceID to an instance of the specified ResourceID type.
protected  void setCanonicalResourceURN(String canonicalResourceURN)
           
protected  void setResourceURN(String resourceURN)
           
 String toString()
          Get a string representation of this ResourceID.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResourceID

public ResourceID(String resourceURN)
Constructor.

Parameters
resourceURN - the URN of the referrent resource

ResourceID

protected ResourceID(ResourceIDBuilder builder)
Constructor.

Parameters
builder - the ResourceIDBuilder (must not be null)
Method Detail

narrow

public static <T extends ResourceID> T narrow(Class<T> type,
                                              ResourceID resourceID)
                                   throws ResourceIDException
Convert the given ResourceID to an instance of the specified ResourceID type.

Parameters
type - the desired ResourceID type
resourceID - the ResourceID
Returns
the narrowed ResourceID
Throws
ResourceIDException

hashCode

public final int hashCode()
Get the hash code of this ResourceID.

The hash code is computed from the URN of the referrent resource.

Overrides:
hashCode in class Object
Returns
the hash code of this ResourceID

equals

public final boolean equals(Object that)
Determine if the given Object is equal to this ResourceID.

The given Object is considered to be equal to this ResourceID if and only if all of these statements are true:

  1. The given Object is an instance of ResourceID or a subtype of ResourceID.
  2. The given Object (a ResourceID) has a ResourceType that equals the ResourceType of this ResourceID.
  3. The given Object (a ResourceID) has a resource URN that is identical to the resource URN.

Overrides:
equals in class Object
Returns
true if the given Object is equal to this ResourceID and false otherwise

getResourceIDBuilder

protected ResourceIDBuilder getResourceIDBuilder()
Get the ResourceIDBuilder.

Returns
the the ResourceIDBuilder

getResourceType

public final ResourceType getResourceType()
Get the ResourceType of the referrent resource.

Returns
the ResourceType of the referrent resource

getResourceEnvironment

public ResourceEnvironment getResourceEnvironment()
Get the ResourceEnvironment of the referrent resource.

Returns
the ResourceEnvironment of the referrent resource

getResourceURN

public final String getResourceURN()
Get the URN of the referrent resource.

Returns
the URN of the referrent resource

setResourceURN

protected void setResourceURN(String resourceURN)

getCanonicalResourceURN

public final String getCanonicalResourceURN()
Deprecated use getResourceURN()

Get the canonical URN of the referrent resource.

This method may return null if the resource type is invalid or unknown.

Returns
the canonical URN of the referrent resource

setCanonicalResourceURN

protected void setCanonicalResourceURN(String canonicalResourceURN)

computeResourceURN

protected String computeResourceURN()
Compute the URN of the referrent resource.

Returns
the URN of the referrent resource

computeResourceURN

protected StringBuilder computeResourceURN(StringBuilder buffer)
Compute the URN of the referrent resource.

Parameters
buffer - the StringBuilder for the URN of the referrent resource
Returns
the StringBuilder with the URN of the referrent resource appended to it

appendResourceTypeNamespaceURI

protected StringBuilder appendResourceTypeNamespaceURI(StringBuilder buffer)
Append the namespace URI of the ResourceType.

Parameters
buffer - the StringBuilder for the namespace URI of the ResourceType
Returns
the StringBuilder with the namespace URI of the ResourceType appended to it

appendResourcePath

protected abstract StringBuilder appendResourcePath(boolean canonicalResourceURN,
                                                    StringBuilder buffer)
Append the resource path of the referrent resource.

Parameters
buffer - the StringBuilder for the resource path of the referrent resource
canonicalResourceURN - indicates if the canonical resource URN should be computed. Since this is no longer supported this should always be true.
Returns
the StringBuilder with the resource path of the referrent resource appended to it

toString

public final String toString()
Get a string representation of this ResourceID.

This method returns the URN of the referrent resource.

Overrides:
toString in class Object
Returns
a string representation of this ResourceID
See Also
getResourceURN()


Copyright © 2011, Oracle. All rights reserved.