com.hp.hpl.swade.portal
Class DataSource

java.lang.Object
  |
  +--com.hp.hpl.swade.portal.DataSource
All Implemented Interfaces:
java.lang.Comparable

public class DataSource
extends java.lang.Object
implements java.lang.Comparable

This represents the definition of a portal data set to be browsed. It is encapsulated as an object so that a single portal installation can provide separate views onto multiple distinct datasets.

This gives convenient access to the configuration information (definition of facets, template locations) plus a route to access the RDF data in the dataset.

Version:
$Revision: 1.8 $ on $Date: 2004/07/09 15:15:03 $
Author:
Dave Reynolds

Field Summary
protected  com.hp.hpl.jena.ontology.OntResource config
          The base specification resource for the data source
protected  java.lang.String encoding
          The encoding string for the data source
protected  java.util.List facets
          The list of facets applicable to this data source
protected  HarvestManager harvestManager
          The harvester for this data source
protected  ModelIndex index
          The text index for this data source, may be null
protected  java.lang.String name
          Name of the data source.
protected  PathContext pcontext
          the context though which other resource may be loaded
protected  java.util.List realFacets
          The list of facets applicable to this data source, excluding the psuedo text search facet
protected  Facet searchFacet
          The special facet used to support free text queries
protected  DataStore store
          The datastore which provides content data for this defined source
protected  TemplateMap templates
          The set of render templates to use for viewing this data source
 
Constructor Summary
DataSource(DataSource base, com.hp.hpl.jena.rdf.model.Model model)
          Constructor - this is used for constructing dummy data sources which descend from a known data source but have a different data model.
DataSource(com.hp.hpl.jena.ontology.OntResource config, PathContext context)
          Constructor - doesn't do loading until requested
 
Method Summary
 void addNewFacet(com.hp.hpl.jena.rdf.model.Resource facet)
          Add a dynamic facet definition to the list of facets in use.
 int compareTo(java.lang.Object o1)
          Comparison based on an order property or name
 com.hp.hpl.jena.ontology.OntResource getConfigResource()
          Return the base specification resource for the data source
 com.hp.hpl.jena.rdf.model.Model getDataModel()
          Conventience function to return a Model interface onto the aggregated stored data associated with this source definition.
 DataStore getDataStore()
          Return the data store of content data for this data source.
 java.lang.String getEncoding()
          Return the encoding string which can be used to identify this data source in a URL request to the portal.
 Facet getFacet(java.lang.String enc)
          Return the facet corresponding to the given facet encoding.
 Facet getFacetForConcept(NodeWrapper concept)
          This takes a ResourceWrapper representing a concept in some classification scheme and finds the facet corresponding to that concept or null if there isn't one.
 java.util.List getFacets()
          Return an ordered list of the facets suitable for browsing this data source.
 HarvestManager getHarvestManager()
          Return the harvest manager for this source or null if there is none specified.
 ModelIndex getIndex()
          Return the text indexer for this data source or null if the index is not defined.
 java.lang.String getName()
          Return the descriptive name for the data source
 java.lang.String getPageviewTemplateName()
          Return the top level template which should be used for page level viewing of a selected resource.
 java.util.List getRealFacets()
          Return the real facets, i.e. those that don't include the pseudo text search facet
 NodeWrapper getResource(java.lang.String url)
          Return a wrapped resource from a URI string.
 Facet getSearchFacet()
          Return the facet used to represent a free text search if supported.
 PathContext getServletContext()
          Return the context for this datasource, used to define paths for accessing data files.
 com.hp.hpl.jena.rdf.model.Resource getSourceDefinition()
          Return the data source configuration resource.
 java.lang.String getSourceProperty(ResourceWrapper src, com.hp.hpl.jena.rdf.model.Property p)
          Return the property of a source URL, tries the harvester database first and if that fails checks the whole data set.
 java.lang.String getSourceURLBanner(ResourceWrapper src)
          Return any banner text for a given source URL known to this datasource.
 java.lang.String getSourceURLDescription(ResourceWrapper src)
          Return the descriptive text, if any, for a given source URL known to this datasource.
 java.lang.String getTemplateBase()
          Return the base URL for finding templates.
 TemplateMap getTemplates()
          Return the template map which should be used for rendering resources found in this datasource.
 java.lang.String getViewer(javax.servlet.http.HttpServletRequest request)
          Return the link address for a basic view on this data source, used by scripts that are going to pass in extra parameters so includes a trailing '&' character
 java.lang.String getViewTemplateName()
          Return the top level template which should be used for viewing filtered sets of portal resources.
 void setDataStore(DataStore store)
          Set the store for this source - used when overriding the default store configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

protected com.hp.hpl.jena.ontology.OntResource config
The base specification resource for the data source


name

protected java.lang.String name
Name of the data source.


encoding

protected java.lang.String encoding
The encoding string for the data source


pcontext

protected PathContext pcontext
the context though which other resource may be loaded


templates

protected TemplateMap templates
The set of render templates to use for viewing this data source


facets

protected java.util.List facets
The list of facets applicable to this data source


realFacets

protected java.util.List realFacets
The list of facets applicable to this data source, excluding the psuedo text search facet


searchFacet

protected Facet searchFacet
The special facet used to support free text queries


store

protected DataStore store
The datastore which provides content data for this defined source


harvestManager

protected HarvestManager harvestManager
The harvester for this data source


index

protected ModelIndex index
The text index for this data source, may be null

Constructor Detail

DataSource

public DataSource(com.hp.hpl.jena.ontology.OntResource config,
                  PathContext context)
Constructor - doesn't do loading until requested

Parameters:
config - the resource from which all source config parameters can be located
context - the servlet context though which other resource may be loaded

DataSource

public DataSource(DataSource base,
                  com.hp.hpl.jena.rdf.model.Model model)
Constructor - this is used for constructing dummy data sources which descend from a known data source but have a different data model. This is really just a hack to allow us to use the same wrapper machinery we use for data to build the web pages we use for harvester controls.

Parameters:
model - the data to use
Method Detail

getName

public java.lang.String getName()
Return the descriptive name for the data source


getServletContext

public PathContext getServletContext()
Return the context for this datasource, used to define paths for accessing data files.


getConfigResource

public com.hp.hpl.jena.ontology.OntResource getConfigResource()
Return the base specification resource for the data source


getEncoding

public java.lang.String getEncoding()
Return the encoding string which can be used to identify this data source in a URL request to the portal.


compareTo

public int compareTo(java.lang.Object o1)
Comparison based on an order property or name

Specified by:
compareTo in interface java.lang.Comparable

getSourceDefinition

public com.hp.hpl.jena.rdf.model.Resource getSourceDefinition()
Return the data source configuration resource.


getFacets

public java.util.List getFacets()
Return an ordered list of the facets suitable for browsing this data source.


getSearchFacet

public Facet getSearchFacet()
Return the facet used to represent a free text search if supported.


getRealFacets

public java.util.List getRealFacets()
Return the real facets, i.e. those that don't include the pseudo text search facet


getFacet

public Facet getFacet(java.lang.String enc)
Return the facet corresponding to the given facet encoding. This currently uses the facet's parameterName property as the encoding.


getTemplates

public TemplateMap getTemplates()
Return the template map which should be used for rendering resources found in this datasource.


getViewTemplateName

public java.lang.String getViewTemplateName()
Return the top level template which should be used for viewing filtered sets of portal resources. This defaults to portal://templates/view.vm.


getPageviewTemplateName

public java.lang.String getPageviewTemplateName()
Return the top level template which should be used for page level viewing of a selected resource. This defaults to portal://templates/pageview.vm.


getTemplateBase

public java.lang.String getTemplateBase()
Return the base URL for finding templates. When an unknown action is invoked a template name relative to this base will be synthesised and invoked.


addNewFacet

public void addNewFacet(com.hp.hpl.jena.rdf.model.Resource facet)
Add a dynamic facet definition to the list of facets in use. This will blow away any caches.


getFacetForConcept

public Facet getFacetForConcept(NodeWrapper concept)
This takes a ResourceWrapper representing a concept in some classification scheme and finds the facet corresponding to that concept or null if there isn't one.


getViewer

public java.lang.String getViewer(javax.servlet.http.HttpServletRequest request)
Return the link address for a basic view on this data source, used by scripts that are going to pass in extra parameters so includes a trailing '&' character


getDataStore

public DataStore getDataStore()
Return the data store of content data for this data source.


setDataStore

public void setDataStore(DataStore store)
Set the store for this source - used when overriding the default store configuration.


getDataModel

public com.hp.hpl.jena.rdf.model.Model getDataModel()
Conventience function to return a Model interface onto the aggregated stored data associated with this source definition.


getHarvestManager

public HarvestManager getHarvestManager()
Return the harvest manager for this source or null if there is none specified.


getIndex

public ModelIndex getIndex()
Return the text indexer for this data source or null if the index is not defined.


getResource

public NodeWrapper getResource(java.lang.String url)
Return a wrapped resource from a URI string.


getSourceURLDescription

public java.lang.String getSourceURLDescription(ResourceWrapper src)
Return the descriptive text, if any, for a given source URL known to this datasource.


getSourceURLBanner

public java.lang.String getSourceURLBanner(ResourceWrapper src)
Return any banner text for a given source URL known to this datasource.


getSourceProperty

public java.lang.String getSourceProperty(ResourceWrapper src,
                                          com.hp.hpl.jena.rdf.model.Property p)
Return the property of a source URL, tries the harvester database first and if that fails checks the whole data set.



Copyright © 2004 Hewlett-Packard. All Rights Reserved.