org.w3c.jigsaw.admin
Class PlainRemoteResource

java.lang.Object
  extended by org.w3c.jigsaw.admin.PlainRemoteResource
All Implemented Interfaces:
RemoteResource

public class PlainRemoteResource
extends java.lang.Object
implements RemoteResource


Field Summary
protected  AdminContext admin
          The client side admin context
protected  AttributeDescription[] attributes
          The remote resource set of attributes.
protected  ResourceDescription description
          Our description
protected  RemoteResource[] frames
          Set of attached frames.
protected  java.lang.String identifier
          The name of that resource (ie it's identifier attribute).
protected  boolean iscontainer
          Is that resource a container resource ?
protected  boolean isDirectoryResource
          Is that resource a directory resource ?
protected  boolean isframed
          Is that resource a framed resource ?
protected  boolean isindexerscatalog
          Is that resource a indexers catalog ?
protected  java.net.URL parent
          The name of the parent of that resource, as an URL.
protected  java.net.URL url
          The admin URL for the wrapped resource.
protected  java.lang.Object[] values
          The remote resource attribute values.
 
Method Summary
protected  void createRemoteFrames()
           
protected  Request createRequest()
           
 void delete()
          Delete that resource, and detach it from its container.
 void dump(java.io.PrintStream prt)
          Dump that resource to the given output stream.
 java.lang.String[] enumerateResourceIdentifiers()
           
 AttributeDescription[] getAttributes()
          Get the target resource list of attributes.
 java.lang.String[] getClassHierarchy()
          Get the target resource class hierarchy.
 RemoteResource[] getFrames()
          Get the frames attached to that resource.
protected  java.io.InputStream getInputStream(Reply reply)
           
 java.lang.Object getValue(java.lang.String attr)
           
 java.lang.Object[] getValues(java.lang.String[] attrs)
           
 boolean isContainer()
           
 boolean isDirectoryResource()
          Is is a DirectoryResource
 boolean isFrame()
           
 boolean isFramed()
          Is this resource a framed resource ?
protected  boolean isFrameURL(java.net.URL furl)
           
 boolean isIndexersCatalog()
           
 RemoteResource loadResource(java.lang.String identifier)
           
protected  AttributeDescription lookupAttribute(java.lang.String name)
           
 RemoteResource registerFrame(java.lang.String id, java.lang.String classname)
          Attach a new frame to that resource.
 RemoteResource registerResource(java.lang.String id, java.lang.String classname)
          Register a new resource within this container.
 void reindex(boolean rec)
          Reindex the resource's children if this resource is a DirectoryResource.
protected  void setFrames(RemoteResource[] frames)
           
 void setValue(java.lang.String attr, java.lang.Object value)
           
 void setValues(java.lang.String[] names, java.lang.Object[] values)
          Set a set of attribute values in one shot.
 void unregisterFrame(RemoteResource frame)
          Unregister a given frame from that resource.
protected  void update()
          reload the RemoteResource.
 void updateURL(java.net.URL parentURL)
          Is this resource a filtered resource ?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

admin

protected AdminContext admin
The client side admin context


attributes

protected AttributeDescription[] attributes
The remote resource set of attributes.


values

protected java.lang.Object[] values
The remote resource attribute values.


iscontainer

protected boolean iscontainer
Is that resource a container resource ?


isindexerscatalog

protected boolean isindexerscatalog
Is that resource a indexers catalog ?


isDirectoryResource

protected boolean isDirectoryResource
Is that resource a directory resource ?


isframed

protected boolean isframed
Is that resource a framed resource ?


identifier

protected java.lang.String identifier
The name of that resource (ie it's identifier attribute).


parent

protected java.net.URL parent
The name of the parent of that resource, as an URL.


url

protected java.net.URL url
The admin URL for the wrapped resource.


frames

protected RemoteResource[] frames
Set of attached frames.


description

protected ResourceDescription description
Our description

Method Detail

createRequest

protected Request createRequest()

getInputStream

protected java.io.InputStream getInputStream(Reply reply)
                                      throws java.io.IOException
Throws:
java.io.IOException

setFrames

protected void setFrames(RemoteResource[] frames)

getClassHierarchy

public java.lang.String[] getClassHierarchy()
                                     throws RemoteAccessException
Get the target resource class hierarchy. This method will return the class hierarchy as an array of String. The first string in the array is the name of the resource class itself, the last string will always be java.lang.Object.

Specified by:
getClassHierarchy in interface RemoteResource
Returns:
A String array givimg the target resource's class description.
Throws:
RemoteAccessException - If somenetwork failure occured.

reindex

public void reindex(boolean rec)
             throws RemoteAccessException
Reindex the resource's children if this resource is a DirectoryResource.

Specified by:
reindex in interface RemoteResource
Parameters:
rec - recursivly?
Throws:
RemoteAccessException - If it's not a DirectoryResource

delete

public void delete()
            throws RemoteAccessException
Delete that resource, and detach it from its container.

Specified by:
delete in interface RemoteResource
Throws:
RemoteAccessException - If somenetwork failure occured.

getAttributes

public AttributeDescription[] getAttributes()
                                     throws RemoteAccessException
Get the target resource list of attributes. This method returns the target resource attributes description. The resulting array contains instances of the Attribute class, one item per described attributes.

Even though this returns all the attribute resources, only the ones that are advertized as being editable can be set through this interface.

Specified by:
getAttributes in interface RemoteResource
Returns:
An array of Attribute.
Throws:
RemoteAccessException - If somenetwork failure occured.

getValue

public java.lang.Object getValue(java.lang.String attr)
                          throws RemoteAccessException
Specified by:
getValue in interface RemoteResource
Parameters:
name - The attribute whose value is to be fetched, encoded as its name.
Throws:
RemoteAccessException - If somenetwork failure occured.

lookupAttribute

protected AttributeDescription lookupAttribute(java.lang.String name)

getValues

public java.lang.Object[] getValues(java.lang.String[] attrs)
                             throws RemoteAccessException
Specified by:
getValues in interface RemoteResource
Parameters:
attrs - The (ordered) set of attributes whose value is to be fetched.
Returns:
An (ordered) set of values, one per queried attribute.
Throws:
RemoteAccessException - If somenetwork failure occured.

setValue

public void setValue(java.lang.String attr,
                     java.lang.Object value)
              throws RemoteAccessException
Specified by:
setValue in interface RemoteResource
Parameters:
attr - The attribute to set, encoded as it's name.
value - The new value for that attribute.
Throws:
RemoteAccessException - If somenetwork failure occured.

setValues

public void setValues(java.lang.String[] names,
                      java.lang.Object[] values)
               throws RemoteAccessException
Set a set of attribute values in one shot. This method guarantees that either all setting is done, or none of them are.

Specified by:
setValues in interface RemoteResource
Parameters:
attrs - The (ordered) list of attribute to set, encoded as their names.
values - The (ordered) list of values, for each of the above attributes.
Throws:
RemoteAccessException - If somenetwork failure occured.

updateURL

public void updateURL(java.net.URL parentURL)
Description copied from interface: RemoteResource
Is this resource a filtered resource ?

Specified by:
updateURL in interface RemoteResource

isContainer

public boolean isContainer()
                    throws RemoteAccessException
Specified by:
isContainer in interface RemoteResource
Throws:
RemoteAccessException - If somenetwork failure occured.

isIndexersCatalog

public boolean isIndexersCatalog()
                          throws RemoteAccessException
Specified by:
isIndexersCatalog in interface RemoteResource
Throws:
RemoteAccessException - If somenetwork failure occured.

isDirectoryResource

public boolean isDirectoryResource()
                            throws RemoteAccessException
Is is a DirectoryResource

Specified by:
isDirectoryResource in interface RemoteResource
Throws:
RemoteAccessException - If somenetwork failure occured.

enumerateResourceIdentifiers

public java.lang.String[] enumerateResourceIdentifiers()
                                                throws RemoteAccessException
Specified by:
enumerateResourceIdentifiers in interface RemoteResource
Throws:
RemoteAccessException - If somenetwork failure occured.

loadResource

public RemoteResource loadResource(java.lang.String identifier)
                            throws RemoteAccessException
Specified by:
loadResource in interface RemoteResource
Throws:
RemoteAccessException - If somenetwork failure occured.

registerResource

public RemoteResource registerResource(java.lang.String id,
                                       java.lang.String classname)
                                throws RemoteAccessException
Register a new resource within this container.

Specified by:
registerResource in interface RemoteResource
Parameters:
id - The identifier of the resource to be created.
classname - The name of the class of the resource to be added.
Throws:
RemoteAccessException - If somenetwork failure occured.

isFramed

public boolean isFramed()
                 throws RemoteAccessException
Is this resource a framed resource ?

Specified by:
isFramed in interface RemoteResource
Returns:
A boolean, true if the resource is framed and it currently has some frames attached, false otherwise.
Throws:
RemoteAccessException - If somenetwork failure occured.

getFrames

public RemoteResource[] getFrames()
                           throws RemoteAccessException
Get the frames attached to that resource. Each frame is itself a resource, so it is returned as an instance of a remote resource.

Specified by:
getFrames in interface RemoteResource
Returns:
A (posssibly null) array of frames attached to that resource.
Throws:
RemoteAccessException - If somenetwork failure occured.

unregisterFrame

public void unregisterFrame(RemoteResource frame)
                     throws RemoteAccessException
Unregister a given frame from that resource.

Specified by:
unregisterFrame in interface RemoteResource
Parameters:
frame - The frame to unregister.
Throws:
RemoteAccessException - If somenetwork failure occured.

isFrame

public boolean isFrame()
Specified by:
isFrame in interface RemoteResource

isFrameURL

protected boolean isFrameURL(java.net.URL furl)

registerFrame

public RemoteResource registerFrame(java.lang.String id,
                                    java.lang.String classname)
                             throws RemoteAccessException
Attach a new frame to that resource.

Specified by:
registerFrame in interface RemoteResource
Parameters:
identifier - The name for this frame (if any).
clsname - The name of the frame's class.
Returns:
A remote handle to the (remotely) created frame instance.
Throws:
RemoteAccessException - If somenetwork failure occured.

createRemoteFrames

protected void createRemoteFrames()

dump

public void dump(java.io.PrintStream prt)
          throws RemoteAccessException
Dump that resource to the given output stream.

Parameters:
prt - A print stream to dump to.
Throws:
RemoteAccessException - If somenetwork failure occured.

update

protected void update()
               throws RemoteAccessException
reload the RemoteResource.

Throws:
RemoteAccessException