com.hp.hpl.jena.util
Class LocationMapper

java.lang.Object
  extended by com.hp.hpl.jena.util.LocationMapper

public class LocationMapper
extends java.lang.Object

Alternative locations for URIs. Maintains two maps: single item alternatives and alternative prefixes. To suggest an alternative location, first check the single items, then check the prefixes. A LocationMapper can be configured by an RDF file. The default for this is "etc/location-mapping.n3". There is a default LocationMapper which is used by the global @link{FileManager}.

Version:
$Id: LocationMapper.java,v 1.1 2009/06/29 08:55:47 castagna Exp $
Author:
Andy Seaborne
See Also:
FileManager

Field Summary
static java.lang.String DEFAULT_PATH
          The default path for searching for the location mapper
static java.lang.String GlobalMapperSystemProperty1
           
static java.lang.String GlobalMapperSystemProperty2
           
 
Constructor Summary
LocationMapper()
          Create a LocationMapper with no mapping yet
LocationMapper(LocationMapper locMapper)
          Create a LocationMapper made like another one This is a deep copy of the location and prefix maps..
LocationMapper(Model model)
          Create a LocationMapper from an existing model
LocationMapper(java.lang.String config)
          Create a LocationMapper from a config file
 
Method Summary
 void addAltEntry(java.lang.String uri, java.lang.String alt)
           
 void addAltPrefix(java.lang.String uriPrefix, java.lang.String altPrefix)
           
 java.lang.String altMapping(java.lang.String uri)
           
 java.lang.String altMapping(java.lang.String uri, java.lang.String otherwise)
          Apply mappings: first try for an exact alternative location, then try to remap by prefix, finally, try the special case of filenames in a specific base directory.
 boolean equals(java.lang.Object obj)
           
static LocationMapper get()
          Get the global LocationMapper
 java.lang.String getAltEntry(java.lang.String uri)
           
 java.lang.String getAltPrefix(java.lang.String uriPrefix)
           
 int hashCode()
           
 java.util.Iterator<java.lang.String> listAltEntries()
          Iterate over all the entries registered
 java.util.Iterator<java.lang.String> listAltPrefixes()
          Iterate over all the prefixes registered
static LocationMapper makeGlobal()
          Make a location mapper from the path settings
 void processConfig(Model m)
           
 void removeAltEntry(java.lang.String uri)
           
 void removeAltPrefix(java.lang.String uriPrefix)
           
static void setGlobalLocationMapper(LocationMapper globalLocationMapper)
          Set the global lcoation mapper.
 Model toModel()
           
 void toModel(Model model)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PATH

public static final java.lang.String DEFAULT_PATH
The default path for searching for the location mapper

See Also:
Constant Field Values

GlobalMapperSystemProperty1

public static final java.lang.String GlobalMapperSystemProperty1
See Also:
Constant Field Values

GlobalMapperSystemProperty2

public static final java.lang.String GlobalMapperSystemProperty2
See Also:
Constant Field Values
Constructor Detail

LocationMapper

public LocationMapper()
Create a LocationMapper with no mapping yet


LocationMapper

public LocationMapper(LocationMapper locMapper)
Create a LocationMapper made like another one This is a deep copy of the location and prefix maps..


LocationMapper

public LocationMapper(Model model)
Create a LocationMapper from an existing model

See Also:
LocationMappingVocab

LocationMapper

public LocationMapper(java.lang.String config)
Create a LocationMapper from a config file

Method Detail

get

public static LocationMapper get()
Get the global LocationMapper


setGlobalLocationMapper

public static void setGlobalLocationMapper(LocationMapper globalLocationMapper)
Set the global lcoation mapper. (as returned by get()) If called before any call to get(), then the usual default global location mapper is not created

Parameters:
globalLocationMapper -

makeGlobal

public static LocationMapper makeGlobal()
Make a location mapper from the path settings


altMapping

public java.lang.String altMapping(java.lang.String uri)

altMapping

public java.lang.String altMapping(java.lang.String uri,
                                   java.lang.String otherwise)
Apply mappings: first try for an exact alternative location, then try to remap by prefix, finally, try the special case of filenames in a specific base directory.

Parameters:
uri -
otherwise -
Returns:
The alternative location choosen

addAltEntry

public void addAltEntry(java.lang.String uri,
                        java.lang.String alt)

addAltPrefix

public void addAltPrefix(java.lang.String uriPrefix,
                         java.lang.String altPrefix)

listAltEntries

public java.util.Iterator<java.lang.String> listAltEntries()
Iterate over all the entries registered


listAltPrefixes

public java.util.Iterator<java.lang.String> listAltPrefixes()
Iterate over all the prefixes registered


removeAltEntry

public void removeAltEntry(java.lang.String uri)

removeAltPrefix

public void removeAltPrefix(java.lang.String uriPrefix)

getAltEntry

public java.lang.String getAltEntry(java.lang.String uri)

getAltPrefix

public java.lang.String getAltPrefix(java.lang.String uriPrefix)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toModel

public Model toModel()

toModel

public void toModel(Model model)

processConfig

public void processConfig(Model m)


Copyright © 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Hewlett-Packard Development Company, LP