    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class w3c.jigsaw.pics.DataBaseService

    java.lang.Object
       |
       +----w3c.jigsaw.pics.DataBase
               |
               +----w3c.jigsaw.pics.DataBaseService

public class DataBaseService
extends DataBase
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 use a fancy database, via JDBC.

For each requested labels, the DataBaseService is looked up for the appropriate URL in the database. So if you want to consult a DataBaseService, you have to call DataBaseService (Properties P, String name) where P is a Properties Object containing information about the database and name the url relative to the service. The properties file (dbs.props) must be in the LabelBureau directory.

##

DB_GENERIC_FIELD_P
  The property key relative to the name of the field containing the generic flag.
DB_LABEL_FIELD_P
  The property key relative to the name of the label field.
DB_SERVICE_FIELD_P
  The property key relative to the name of the service field.
DB_URL_FIELD_P
  The property key relative to the name of the url field.

##

DataBaseService(Properties, String)

##

addLabel(String, String, boolean, boolean)
  Add a new label in the DataBaseService.
delLabel(String)
  Delete a label in the DataBaseService.
dump(StringBuffer, int)
  Dump this service description into the given buffer.
getGenericLabel(URL)
  Get the most specific generic label for an URL.
getGenericTreeLabels(URL)
  Get the generic tree labels for given URL.
getLabelFromUrl(String)
  Get the label telative to the given url in the DataBaseService.
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.
list()
  Get the list of the labels in HTML format

##

DB_SERVICE_FIELD_P

     public static final String DB_SERVICE_FIELD_P

  The property key relative to the name of the service field.

DB_URL_FIELD_P

     public static final String DB_URL_FIELD_P

  The property key relative to the name of the url field.

DB_LABEL_FIELD_P

     public static final String DB_LABEL_FIELD_P

  The property key relative to the name of the label field.

DB_GENERIC_FIELD_P

     public static final String DB_GENERIC_FIELD_P

  The property key relative to the name of the field containing the generic flag.

##

DataBaseService

     public DataBaseService(Properties P,
                            String name) throws UnknownServiceException

##

getName

     public String getName()

  Get this service name

  Returns:
    A String instance, being the service name.

list

     public String list()

  Get the list of the labels in HTML format

  Returns:
    A String instance, being the HTML list.

delLabel

     public boolean delLabel(String url)

  Delete a label in the DataBaseService.

  Parameters:
    url - The url labelled.
  Returns:
    true if the label was correctly deleted.

addLabel

     public boolean addLabel(String url,
                             String label,
                             boolean gen,
                             boolean ov) throws MalformedURLException

  Add a new label in the DataBaseService.

  Parameters:
    url - The url to label.
    label - The label relative to the given url.
    gen - Add generic label if true.
  Returns:
    true if the label was correctly added.

getLabelFromUrl

     public String getLabelFromUrl(String url)

  Get the label telative to the given url in the DataBaseService.

  Parameters:
    url - The url.
  Returns:
    String The label relative to the url or ""

getSpecificLabel

     public LabelInterface getSpecificLabel(URL u)

  Get the specific label for the given URL.

  Parameters:
    url - The URL whose label is searched.

getGenericLabel

     public LabelInterface getGenericLabel(URL u)

  Get the most specific 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 u)

  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 u)

  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.

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.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index