org.nodal
Class Nodal

java.lang.Object
  extended byorg.nodal.Nodal

public class Nodal
extends java.lang.Object

Author:
Lee Iverson

Nested Class Summary
static class Nodal.DriverBase
          All RepositoryDriver implementations should extend this class in order to be properly registered with the top-level and available to openRepository().
 
Constructor Summary
Nodal()
           
 
Method Summary
static Document createDocument(Path path, DocumentFormat format)
          Create a new Document that can be accessed with the given Path.
static Node nodeNamed(Name nm)
          Access a Node defined by the Name as a Node id.
static Document openDocument(Path docPath)
          Open a Document given a Path.
static Document openDocument(java.lang.String uri)
          Open a Document named by a given URI.
static Repository openRepository(Path path)
          Open a Repository named by the given URI.
static Repository openRepository(java.lang.String uri)
          Open a Repository named by the given URI.
static Path openURL(java.lang.String uri)
          Open a URL for access by the NODAL interfaces.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Nodal

public Nodal()
Method Detail

openURL

public static Path openURL(java.lang.String uri)
                    throws Path.Failure
Open a URL for access by the NODAL interfaces. Parses and binds the URL, returning a bound Path or signalling failure.

Parameters:
uri - a String representing the URI to be parsed
Returns:
a bound Path that has the given URI
Throws:
Path.Failure

nodeNamed

public static Node nodeNamed(Name nm)
Access a Node defined by the Name as a Node id. The id will exist in a Namespace that identifies the Document context. If a Document cannot be associated with the Namespace, or the Document cannot be accessed, then this method fails and return null.

Parameters:
nm - a Name to identify the Node
Returns:
a Node if there is one accessible from this Name or null

openDocument

public static Document openDocument(Path docPath)
Open a Document given a Path. If the Path is not absolute or the Document does not exist then we return null.

Parameters:
docPath - an absolute Path defining a Document
Returns:
a Document containing the Path requested or null

openDocument

public static Document openDocument(java.lang.String uri)
                             throws Path.Failure
Open a Document named by a given URI. If the URI is not absolute or the Document does not exist then we return null.

Parameters:
uri - an absolute URI defining a Document
Returns:
a Document containing the Path requested or null
Throws:
Path.Failure - if the uri is an invalid Path

createDocument

public static Document createDocument(Path path,
                                      DocumentFormat format)
Create a new Document that can be accessed with the given Path.

Parameters:
path - a Path to attach this Document to.
Returns:
a new Document object with this Path
Throws:
java.lang.RuntimeException - if a Document already ex

openRepository

public static Repository openRepository(java.lang.String uri)
                                 throws Path.Failure
Open a Repository named by the given URI. If the URI references a file or object inside a Repository, then this should successfully return the containing Repository.

Parameters:
uri - a String naming a Repository
Returns:
the Repository containing the named resource
Throws:
Path.Failure - if the uri is an invalid Path

openRepository

public static Repository openRepository(Path path)
                                 throws Path.Failure
Open a Repository named by the given URI. If the URI references a file or object inside a Repository, then this should successfully return the containing Repository.

Parameters:
path - an absolute Path naming a Repository
Returns:
the Repository containing the named resource
Throws:
Path.Failure