org.apache.jackrabbit.spi.commons.conversion
Class ParsingNameResolver

java.lang.Object
  extended by org.apache.jackrabbit.spi.commons.conversion.ParsingNameResolver
All Implemented Interfaces:
NameResolver

public class ParsingNameResolver
extends Object
implements NameResolver

Name resolver that parsers and formats prefixed JCR names. A NamespaceResolver is used for resolving the namespace prefixes.


Constructor Summary
ParsingNameResolver(NameFactory nameFactory, NamespaceResolver resolver)
          Creates a parsing name resolver.
 
Method Summary
 String getJCRName(Name name)
          Returns the qualified JCR name for the given Name object.
 Name getQName(String jcrName)
          Parses the given JCR name and returns the resolved Name object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParsingNameResolver

public ParsingNameResolver(NameFactory nameFactory,
                           NamespaceResolver resolver)
Creates a parsing name resolver.

Parameters:
nameFactory - the name factory.
resolver - namespace resolver
Method Detail

getQName

public Name getQName(String jcrName)
              throws IllegalNameException,
                     NamespaceException
Parses the given JCR name and returns the resolved Name object.

Specified by:
getQName in interface NameResolver
Parameters:
jcrName - A JCR name String
Returns:
A Name object.
Throws:
IllegalNameException - if the JCR name format is invalid
NamespaceException - if the namespace prefix can not be resolved.
See Also:
NameResolver.getQName(String)

getJCRName

public String getJCRName(Name name)
                  throws NamespaceException
Returns the qualified JCR name for the given Name object. If the name is in the default namespace, then the local name is returned without a prefix. Otherwise the prefix for the namespace is resolved and used to construct the JCR name.

Specified by:
getJCRName in interface NameResolver
Parameters:
name - A Name object.
Returns:
A qualified JCR name string.
Throws:
NamespaceException - if the namespace URI can not be resolved.
See Also:
NameResolver.getJCRName(org.apache.jackrabbit.spi.Name)


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.