ubiware.core
Class ResourcePrefixer

java.lang.Object
  extended by ubiware.core.ResourcePrefixer

public class ResourcePrefixer
extends java.lang.Object

Extracted form Ubiware agent, this class provides methods for replacing the whole name of a resource by their prefix example: to sapl:MyResource This class is mainly used for producing nicer output. 8.3.2010

Author:
Michael Cochez for UBIWARE project

Constructor Summary
ResourcePrefixer()
           
 
Method Summary
(package private)  void addNameSpaces(java.util.HashMap<java.lang.String,java.lang.String> namespaces)
          Adds namespaces to this ResourcePrefixer.
 java.lang.String prefixResource(java.lang.String resource)
          prefix a resource using known namespaces
 java.lang.String prefixResource(java.lang.String resource, java.util.Map<java.lang.String,java.lang.String> usedNS)
          prefix a resource using known namespaces
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourcePrefixer

public ResourcePrefixer()
Method Detail

prefixResource

public java.lang.String prefixResource(java.lang.String resource)
prefix a resource using known namespaces

Parameters:
resource - The resource whose url should be replaced by its prefix
Returns:
The prefixed string

prefixResource

public java.lang.String prefixResource(java.lang.String resource,
                                       java.util.Map<java.lang.String,java.lang.String> usedNS)
prefix a resource using known namespaces

Parameters:
resource - The resource whose url should be replaced by its prefix
usedNS - a map to which the namespace - prefix pair which was used will be added
Returns:
The prefixed string

addNameSpaces

void addNameSpaces(java.util.HashMap<java.lang.String,java.lang.String> namespaces)
Adds namespaces to this ResourcePrefixer. If a previous namespace was defined with the another prefix, the old value will be overwritten.

Parameters:
namespaces - The pairs of prefix -> namespace