org.w3c.jigsaw.pics
Class LabelBureauResource

java.lang.Object
  extended by org.w3c.tools.resources.AttributeHolder
      extended by org.w3c.tools.resources.Resource
          extended by org.w3c.tools.resources.FramedResource
              extended by org.w3c.jigsaw.pics.LabelBureauResource
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, FrameEventListener

public class LabelBureauResource
extends FramedResource

An HTTP interface to query a Label bureau. This conforms to the PICS protocol specification.

This entity defines the following parameter:

The list of parameters
Parameter name Semantics Default value Type
bureau Name of the LabelBureau database none java.lang.String

This entity also inherits the parameters from the PostableResource.


Field Summary
protected static int ATTR_BUREAU_DEBUG
          Attribute index - debug flag.
protected static int ATTR_BUREAU_IDENTIFIER
          Attribute index - Our label bureau identifier.
protected static int ATTR_BUREAU_SERVICES
          Attribute index - Our label bureau identifier.
protected  LabelBureauInterface bureau
          Our loaded label bureau:
 
Fields inherited from class org.w3c.tools.resources.FramedResource
ATTR_OID, attrListener, debugEvent, event_disabled, framesRef, structListener
 
Fields inherited from class org.w3c.tools.resources.Resource
ATTR_CONTEXT, ATTR_HELP_URL, ATTR_IDENTIFIER, ATTR_LAST_MODIFIED, ATTR_PARENT, ATTR_RESOURCE_FRAMES, ATTR_STORE_ENTRY, ATTR_URL, co, id
 
Fields inherited from class org.w3c.tools.resources.AttributeHolder
attributes, values
 
Constructor Summary
LabelBureauResource()
           
 
Method Summary
protected  void acquireBureau()
          Check that we have loaded our bureau, or load it.
 java.io.File getBureauIdentifier()
          Get our label bureau identifier.
 boolean getDebugFlag()
           
protected  Reply getGenericLabels(Request request, int format, java.lang.String[] urls, java.lang.String[] services, URLDecoder data)
          Get the generic labels for a set of service and a set of urls.
protected  Reply getGenericTreeLabels(Request request, int format, java.lang.String[] urls, java.lang.String[] services, URLDecoder data)
          Get generic tree labels.
protected  Reply getNormalLabels(Request request, int format, java.lang.String[] urls, java.lang.String[] services, URLDecoder data)
          Get the normal (generic or specific) labels.
 java.lang.String[] getServices()
          Get the service list
protected  Reply getTreeLabels(Request request, int format, java.lang.String[] urls, java.lang.String[] services, URLDecoder data)
          Get tree labels.
 void initialize(java.lang.Object[] values)
          Initialize the frames of that framed resource.
protected  Reply makePICSErrorReply(Request request, java.lang.String msg)
           
protected  Reply makePICSReply(Request request, java.lang.StringBuffer buffer)
          Build a PICS reply out of the given content.
 void setValue(int idx, java.lang.Object value)
          Set some of this resource attribute.
 
Methods inherited from class org.w3c.tools.resources.FramedResource
addAttributeChangedListener, addStructureChangedListener, collectFramesReference, delete, disableEvent, displayEvent, enableEvent, eventDisabled, fireAttributeChangeEvent, fireStructureChangedEvent, fireStructureChangedEvent, frameAdded, frameModified, frameRemoved, getClone, getFrame, getFrame, getFrameReference, getFrameReference, getFramesReference, getOid, lookup, markModified, notifyUnload, perform, performFrames, postAttributeChangeEvent, postEvent, postStructureChangedEvent, postStructureChangedEvent, processEvent, registerFrame, registerFrameIfNone, removeAttributeChangedListener, removeStructureChangedListener, setSilentValue, setSilentValue, unregisterFrame
 
Methods inherited from class org.w3c.tools.resources.Resource
acceptUnload, checkMultipleLock, collectFrames, getContext, getFrame, getFrames, getHelpURL, getHelpURL, getIdentifier, getLastModified, getParent, getResourceReference, getServer, getSpace, getSpaceEntry, getStoreEntry, getURLPath, getValue, getValue, initialize, isInitialized, isUnloaded, pickleValues, setContext, setContext, setValue, unsafeGetContext, unsafeGetFrame, unsafeGetFrames, unsafeGetIdentifier, unsafeGetResourceReference, unsafeGetURLPath, unsafeGetValue, updateAttributes
 
Methods inherited from class org.w3c.tools.resources.AttributeHolder
definesAttribute, definesAttribute, getAttributes, getBoolean, getChar, getClone, getClone, getDouble, getFloat, getInt, getLong, getString, getValue, lookupAttribute, print, setBoolean, setChar, setDouble, setFloat, setInt, setLong, setString, setValue, unsafeDefinesAttribute, unsafeGetDouble, unsafeGetString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_BUREAU_IDENTIFIER

protected static int ATTR_BUREAU_IDENTIFIER
Attribute index - Our label bureau identifier.


ATTR_BUREAU_SERVICES

protected static int ATTR_BUREAU_SERVICES
Attribute index - Our label bureau identifier.


ATTR_BUREAU_DEBUG

protected static int ATTR_BUREAU_DEBUG
Attribute index - debug flag.


bureau

protected LabelBureauInterface bureau
Our loaded label bureau:

Constructor Detail

LabelBureauResource

public LabelBureauResource()
Method Detail

getBureauIdentifier

public java.io.File getBureauIdentifier()
Get our label bureau identifier.


getServices

public java.lang.String[] getServices()
Get the service list


getDebugFlag

public boolean getDebugFlag()

acquireBureau

protected final void acquireBureau()
Check that we have loaded our bureau, or load it.


makePICSReply

protected Reply makePICSReply(Request request,
                              java.lang.StringBuffer buffer)
Build a PICS reply out of the given content.

Parameters:
request - The request to reply to.
sb - The StringBuffer containing the content to send back.

makePICSErrorReply

protected Reply makePICSErrorReply(Request request,
                                   java.lang.String msg)

getGenericLabels

protected Reply getGenericLabels(Request request,
                                 int format,
                                 java.lang.String[] urls,
                                 java.lang.String[] services,
                                 URLDecoder data)
                          throws HTTPException
Get the generic labels for a set of service and a set of urls.

Parameters:
request - the incomminmg request
format - the pics format
urls - the urls to label
services - the services to ask
data - the URLDecoder
Returns:
A Reply instance
Throws:
HTTPException - if processing the request failed.

getNormalLabels

protected Reply getNormalLabels(Request request,
                                int format,
                                java.lang.String[] urls,
                                java.lang.String[] services,
                                URLDecoder data)
                         throws HTTPException
Get the normal (generic or specific) labels.

Parameters:
request - the incomminmg request
format - the pics format
urls - the urls to label
services - the services to ask
data - the URLDecoder
Returns:
A Reply instance
Throws:
HTTPException - if processing the request failed.

getTreeLabels

protected Reply getTreeLabels(Request request,
                              int format,
                              java.lang.String[] urls,
                              java.lang.String[] services,
                              URLDecoder data)
                       throws HTTPException
Get tree labels.

Parameters:
request - the incomminmg request
format - the pics format
urls - the urls to label
services - the services to ask
data - the URLDecoder
Returns:
A Reply instance
Throws:
HTTPException - if processing the request failed.

getGenericTreeLabels

protected Reply getGenericTreeLabels(Request request,
                                     int format,
                                     java.lang.String[] urls,
                                     java.lang.String[] services,
                                     URLDecoder data)
                              throws HTTPException
Get generic tree labels.

Parameters:
request - the incomminmg request
format - the pics format
urls - the urls to label
services - the services to ask
data - the URLDecoder
Returns:
A Reply instance
Throws:
HTTPException - if processing the request failed.

setValue

public void setValue(int idx,
                     java.lang.Object value)
Description copied from class: FramedResource
Set some of this resource attribute. We overide setValue to post events.

Overrides:
setValue in class FramedResource
Parameters:
idx - The index of the attribute to modify.
value - The new attribute value.

initialize

public void initialize(java.lang.Object[] values)
Description copied from class: FramedResource
Initialize the frames of that framed resource.

Overrides:
initialize in class FramedResource
Parameters:
values - Default attribute values.