com.webmethods.portal.system
Interface IURI

All Superinterfaces:
Cloneable, Serializable
All Known Subinterfaces:
IContext, IThingID

public interface IURI
extends Cloneable, Serializable

IURI is the interface used to represent an object that references a particular portal resource. All objects in the system can be looked up via an IURI.

All URIs point to one distinct object in the system. The URIs are looked up via the PortalSystem.lookup(com.webmethods.portal.system.IURI) method, where the corresponding service resolves the URI into portal object. URIs are obtained via the PortalSystem.acquireURI(java.lang.String) method, where the corresponding service constructs the unique URI for the object, and are in the form /[service name]/[service dependent string].

Also URIs are pooled by default, meaning a reference should not be cached for a URI beyond the scope of a request. If a URI is required to held for longer, use the IURI.clone() method should be used to obtain a non-pooled copy of the URI object.


Method Summary
 Object clone()
          This creates a non-pooled clone of the object.
 String getSegment(int segment)
          Get the specified segment.
 String getSegments(int start)
          Get the partial URI starting with the supplied segment to the end of the URI.
 String getSegments(int start, int end)
          Get the segments that fall within the given range, inclusively.
 String getServiceName()
          Returns the service name to which the identified resource belongs, or null if not determined.
 int getSize()
          Get the number of segments in this URI
 void initialize(String uri)
          Initialize this URI with the given String.
 String toString()
          Gets the resource's string id.
 

Method Detail

initialize

void initialize(String uri)
                throws PortalException
Initialize this URI with the given String. Should only be called by the URI factory.

Parameters:
uri - the String version of the URI
Throws:
PortalException - if invalid uri

getServiceName

String getServiceName()
Returns the service name to which the identified resource belongs, or null if not determined.


getSize

int getSize()
Get the number of segments in this URI

Returns:
the amount of segments, always >= 1

getSegment

String getSegment(int segment)
Get the specified segment. The segments are 0 based, so the last segment is getSize () - 1.

Parameters:
segment - the index of the segment to retrieve (0 based)
Returns:
the specified segment, or null if no such segment exists

getSegments

String getSegments(int start,
                   int end)
Get the segments that fall within the given range, inclusively.

Parameters:
start - the starting segment
end - the last segment to retrieve
Returns:
a String representing this section of the URI

getSegments

String getSegments(int start)
Get the partial URI starting with the supplied segment to the end of the URI.

Parameters:
start - the segment to start the URI
Returns:
a String representing the partial URI

toString

String toString()
Gets the resource's string id.

Overrides:
toString in class Object

clone

Object clone()
             throws CloneNotSupportedException
This creates a non-pooled clone of the object. Therefore, if you're original IURI was from an object pool, the cloned version will not be.

Returns:
a non-pooled version of thie IURI
Throws:
CloneNotSupportedException