org.sapia.archie
Class Archie

java.lang.Object
  extended by org.sapia.archie.Archie

public class Archie
extends java.lang.Object

An instance of this class wraps a Node and offers a user-friendly API on top of the latter.

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2003 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site

Constructor Summary
Archie()
           
Archie(Node root)
           
 
Method Summary
 void bind(Name n, java.lang.Object o)
          Binds the given object under the given name.
 NameParser getNameParser()
          This method can be used by client applications to acquire the NameParser that this instance holds, in order to create object representation of string-based names.
 Node getRoot()
          The root node that this instance holds can be acquired to be manipulated in an application-defined way - by applying a custom lookup algorithm, for example.
 java.lang.Object lookup(Name n)
          Looks up the object with the given name.
 Node lookupNode(Name n, boolean create)
          Looks up the Node with the given name.
 void rebind(Name n, java.lang.Object o)
          Binds the given object under the given name; if an object already exists under the given name, it is overwritten.
 void unbind(Name n)
          Unbinds the value under the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Archie

public Archie()
       throws ProcessingException
Throws:
ProcessingException

Archie

public Archie(Node root)
Method Detail

getRoot

public Node getRoot()
The root node that this instance holds can be acquired to be manipulated in an application-defined way - by applying a custom lookup algorithm, for example.

Returns:
the root Node of this instance.
See Also:
LookupStrategy

lookup

public java.lang.Object lookup(Name n)
                        throws NotFoundException,
                               ProcessingException
Looks up the object with the given name.

Parameters:
n - a Name
Returns:
the Object that corresponds to the given name.
Throws:
NotFoundException - if no object could be found for the given name.
ProcessingException - if a problem occurs while performing the lookup.

getNameParser

public NameParser getNameParser()
This method can be used by client applications to acquire the NameParser that this instance holds, in order to create object representation of string-based names.

Example:

 Name aName      = archie.getNameParser().parse("some/object/name");
 Object anObject = archie.lookup(aName);
 

Returns:
the NameParser that this instance uses.

lookupNode

public Node lookupNode(Name n,
                       boolean create)
                throws NotFoundException,
                       ProcessingException
Looks up the Node with the given name.

Parameters:
n - a Name
Returns:
the Node that corresponds to the given name.
Throws:
NotFoundException - if no node could be found for the given name.
ProcessingException - if a problem occurs while performing the lookup.

unbind

public void unbind(Name n)
            throws ProcessingException
Unbinds the value under the given name.

Parameters:
n - a Name.
Throws:
ProcessingException

bind

public void bind(Name n,
                 java.lang.Object o)
          throws DuplicateException,
                 ProcessingException
Binds the given object under the given name.

Parameters:
n - a Name
o - the Object to bind.
Throws:
DuplicateException - if a object already exists for the given name.
ProcessingException - if a problem occurs while performing the binding.

rebind

public void rebind(Name n,
                   java.lang.Object o)
            throws ProcessingException
Binds the given object under the given name; if an object already exists under the given name, it is overwritten.

Parameters:
n - a Name
o - the Object to bind.
Throws:
DuplicateException - if a object already exists for the given name.
ProcessingException - if a problem occurs while performing the binding.


Copyright © 2010 Sapia OSS. All Rights Reserved.