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 prefixed JCR name for the given qualified name.
 Name getQName(String name)
          Parses the prefixed JCR name and returns the resolved qualified name.
 
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 name)
              throws IllegalNameException,
                     NamespaceException
Parses the prefixed JCR name and returns the resolved qualified name.

Specified by:
getQName in interface NameResolver
Parameters:
name - prefixed JCR name
Returns:
qualified name
Throws:
IllegalNameException - if the JCR name format is invalid
NamespaceException - if the namespace prefix can not be resolved

getJCRName

public String getJCRName(Name name)
                  throws NamespaceException
Returns the prefixed JCR name for the given qualified name. 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 returned the JCR name.

Specified by:
getJCRName in interface NameResolver
Parameters:
name - qualified name
Returns:
prefixed JCR name
Throws:
NamespaceException - if the namespace URI can not be resolved


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