SmartFrog 3.10.000

org.smartfrog.sfcore.reference
Class ReferencePart

java.lang.Object
  extended by org.smartfrog.sfcore.reference.ReferencePart
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Copying
Direct Known Subclasses:
HereReferencePart, HostReferencePart, IPropertyReferencePart, ParentReferencePart, ProcessReferencePart, PropertyReferencePart, RootReferencePart, ThisReferencePart

public abstract class ReferencePart
extends java.lang.Object
implements Copying, java.lang.Cloneable, java.io.Serializable

Implements the commn reference part. A reference part is relative to the context the reference is sitting in. Programs can use the static creation methods (eg. ReferencePart.root()) to create the common referenceparts.

See Also:
Serialized Form

Constructor Summary
ReferencePart()
           
 
Method Summary
static ReferencePart attrib(java.lang.Object s)
          Creates a reference part to a attribute of a containing component.
 java.lang.Object clone()
          Returns a clone of this reference part or null if not cloneable.
 java.lang.Object copy()
          Returns a copy of the reference part.
abstract  boolean equals(java.lang.Object refPart)
          Compares this reference part with another one.
protected  java.lang.Object forwardReference(java.lang.Object rr, Reference r, int index)
          Used internally to forward references once this reference part has been resolved.
abstract  int hashCode()
          ReferenceParts need to implement hashCode.
static ReferencePart here(java.lang.Object s)
          Creates a reference part to the current component.
static ReferencePart host(java.lang.String s)
          Creates a reference part which resolves to a host's root process compound component.
static ReferencePart iproperty(java.lang.Object s)
          Creates an integer property part which resolves to a system property.
static ReferencePart parent()
          Creates a reference part to the parent component.
static ReferencePart process()
          Creates a reference part which resolves to the process compound component.
static ReferencePart property(java.lang.Object s)
          Creates a property part which resolves to a system property.
abstract  java.lang.Object resolve(ReferenceResolver rr, Reference r, int index)
          Resolves this reference part using the reference resolver.
abstract  java.lang.Object resolve(RemoteReferenceResolver rr, Reference r, int index)
          Resolves this reference part using the remote reference resolver.
static ReferencePart root()
          Creates a reference part to the root component.
static ReferencePart thisref()
          Creates a reference part to the containing component.
abstract  java.lang.String toString()
          Returns a string representation of the reference part.
 java.lang.String toString(int index)
          Return a string which is a representation of the reference part in a reference in the index position given.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReferencePart

public ReferencePart()
Method Detail

here

public static ReferencePart here(java.lang.Object s)
Creates a reference part to the current component.

Parameters:
s - id of attribute
Returns:
reference part

parent

public static ReferencePart parent()
Creates a reference part to the parent component.

Returns:
reference part

root

public static ReferencePart root()
Creates a reference part to the root component.

Returns:
reference part

attrib

public static ReferencePart attrib(java.lang.Object s)
Creates a reference part to a attribute of a containing component.

Parameters:
s - id of attribute
Returns:
reference part

thisref

public static ReferencePart thisref()
Creates a reference part to the containing component.

Returns:
reference part

property

public static ReferencePart property(java.lang.Object s)
Creates a property part which resolves to a system property.

Parameters:
s - id of attribute
Returns:
reference part

iproperty

public static ReferencePart iproperty(java.lang.Object s)
Creates an integer property part which resolves to a system property.

Parameters:
s - id of attribute
Returns:
reference part

host

public static ReferencePart host(java.lang.String s)
Creates a reference part which resolves to a host's root process compound component.

Parameters:
s - id of host
Returns:
reference part

process

public static ReferencePart process()
Creates a reference part which resolves to the process compound component.

Returns:
reference part

toString

public abstract java.lang.String toString()
Returns a string representation of the reference part. Overrides Object.toString.

Overrides:
toString in class java.lang.Object
Returns:
stringified reference part

copy

public java.lang.Object copy()
Returns a copy of the reference part. The result of clone is returned. Subclasses that hold more than immutable objects should override this to make a deep copy of those.

Specified by:
copy in interface Copying
Returns:
copy of part

clone

public java.lang.Object clone()
Returns a clone of this reference part or null if not cloneable. Overrides Object.clone.

Specified by:
clone in interface Copying
Overrides:
clone in class java.lang.Object
Returns:
clone of this reference part

toString

public java.lang.String toString(int index)
Return a string which is a representation of the reference part in a reference in the index position given. It defaults to calling the "toString()" method, but may be overridden in a sub-class. An index of 0 indicate the fist part of a reference.

Parameters:
index - the position in the reference
Returns:
the representation

equals

public abstract boolean equals(java.lang.Object refPart)
Compares this reference part with another one.

Overrides:
equals in class java.lang.Object
Parameters:
refPart - to be compared to
Returns:
true if equal, false if not

hashCode

public abstract int hashCode()
ReferenceParts need to implement hashCode. Overrides Object.hashCode.

Overrides:
hashCode in class java.lang.Object
Returns:
hash code for part

resolve

public abstract java.lang.Object resolve(ReferenceResolver rr,
                                         Reference r,
                                         int index)
                                  throws SmartFrogResolutionException
Resolves this reference part using the reference resolver. The originating reference and index are needed to enable request forwarding

Parameters:
rr - reference resolver
r - reference which this part sits in
index - index of this reference part in r
Returns:
the attribute found on resolution
Throws:
SmartFrogResolutionException - if failed to resolve reference

resolve

public abstract java.lang.Object resolve(RemoteReferenceResolver rr,
                                         Reference r,
                                         int index)
                                  throws SmartFrogResolutionException
Resolves this reference part using the remote reference resolver. The originating reference and index are needed to enable request forwarding

Parameters:
rr - reference resolver
r - reference which this part sits in
index - index of this reference part in r
Returns:
the attribute found on resolution
Throws:
SmartFrogResolutionException - if failed to resolve reference

forwardReference

protected java.lang.Object forwardReference(java.lang.Object rr,
                                            Reference r,
                                            int index)
                                     throws SmartFrogResolutionException
Used internally to forward references once this reference part has been resolved. Currently only ReferenceResolver and RemoteReferenceResolver interfaces are recognized

Parameters:
rr - reference resolver to forward to
r - reference to resolve
index - index into reference to resolve next
Returns:
Object
Throws:
SmartFrogResolutionException - if failed to resolve reference

SmartFrog CORE 3.10.000

(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP