    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class w3c.jigsaw.pics.SampleLabelService

    java.lang.Object
       |
       +----w3c.jigsaw.pics.SampleLabelService

public class SampleLabelService
extends Object
implements LabelServiceInterface

The internal representation of a LabelService. A LabelService is an object which should be able to deliver labels for any URL. This implementation doesn't use any fancy database (it should), it uses the file system as a Database, in fact.

Each service is assigned a directory, and for each requested labels, this directory is looked up for the appropriate URL. So if you want to label http://www.w3.org/pub/WWW you have to create, under this service directory a file named http/www.w3.org/pub/WWW/label. To label its Overview.html document define the http/www.w3.org/pub/WWW/Overview.html-label file. The label itself is the content of the file.

##

SampleLabelService(SampleLabelBureau, String)

##

dump(StringBuffer, int)
  Dump this service description into the given buffer.
filify(URL, boolean)
  Filify an URL.
getGenericLabel(URL)
  Get the most speicific generic label for an URL.
getGenericTreeLabels(URL)
  Get the generic tree labels for given URL.
getName()
  Get this service name.
getSpecificLabel(URL)
  Get the specific label for the given URL.
getTreeLabels(URL)
  Get the tree labels for the given URL.

##

SampleLabelService

      public SampleLabelService(SampleLabelBureau b,
                                String name) throws UnknownServiceException

##

filify

      public File filify(URL u,
                         boolean generic)

  Filify an URL. This methods takes an URL as input, and returns an uniq File object relative to the given SampleLabelService directory.
  Parameters:
    u - The URL to filify.
    generic - Filify for generic labels if true.

getName

      public String getName()

  Get this service name.
  Returns:
    A String instance, being the service name.

dump

      public void dump(StringBuffer into,
                       int format)

  Dump this service description into the given buffer.
  Parameters:
    into - The StringBuffer to dump the service to.

getSpecificLabel

      public LabelInterface getSpecificLabel(URL url)

  Get the specific label for the given URL.
  Parameters:
    url - The URL whose label is searched.

getGenericLabel

      public LabelInterface getGenericLabel(URL url)

  Get the most speicific generic label for an URL.
  Parameters:
    url - The URL whose generic label is to be retreived.
  Returns:
    An object conforming to the LabelInterface, or null if none was found.

getTreeLabels

      public LabelInterface[] getTreeLabels(URL url)

  Get the tree labels for the given URL.
  Parameters:
    url - The URL whose tree labels are to be retreived.
  Returns:
    An array of SampleLabel, each comforming to the LabelInterface.

getGenericTreeLabels

      public LabelInterface[] getGenericTreeLabels(URL url)

  Get the generic tree labels for given URL.
  Parameters:
    url - The URL whose tree labels are to be retreived.
  Returns:
    An array of SampleLabel, each of which conforms to the LabelInterface.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index