org.jboss.example.dna.repository
Class RepositoryClient

java.lang.Object
  extended by org.jboss.example.dna.repository.RepositoryClient

public class RepositoryClient
extends Object

Author:
Randall Hauch

Nested Class Summary
static class RepositoryClient.Api
           
 
Field Summary
static String INMEMORY_REPOSITORY_SOURCE_CLASSNAME
           
static String JAAS_LOGIN_CONTEXT_NAME
           
 
Constructor Summary
RepositoryClient()
           
 
Method Summary
 String buildPath(String current, String input)
          Utility to build a path given the current path and the input path as string, where the input path could be an absolute path or relative to the current and where the input may use "." and "..".
 List<String> getNamesOfRepositories()
          Get the names of the repositories.
 boolean getNodeInfo(String sourceName, String pathToNode, Map<String,Object[]> properties, List<String> children)
          Get the information about a node, using the API method.
 void logout()
          Calling this will lose the context
static void main(String[] args)
           
 void setApi(RepositoryClient.Api api)
          Set the API that this client should use to interact with the repositories.
 void setJaasContextName(String jaasContextName)
          Set the JAAS context name that should be used.
 void setUserInterface(UserInterface userInterface)
           
 void shutdown()
          Shut down the components and services and blocking until all resources have been released.
 void startRepositories()
          Start up the repositories.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INMEMORY_REPOSITORY_SOURCE_CLASSNAME

public static final String INMEMORY_REPOSITORY_SOURCE_CLASSNAME
See Also:
Constant Field Values

JAAS_LOGIN_CONTEXT_NAME

public static final String JAAS_LOGIN_CONTEXT_NAME
See Also:
Constant Field Values
Constructor Detail

RepositoryClient

public RepositoryClient()
Method Detail

main

public static void main(String[] args)
Parameters:
args -

setUserInterface

public void setUserInterface(UserInterface userInterface)
Parameters:
userInterface - Sets userInterface to the specified value.

setApi

public void setApi(RepositoryClient.Api api)
Set the API that this client should use to interact with the repositories.

Parameters:
api - The API that should be used

setJaasContextName

public void setJaasContextName(String jaasContextName)
Set the JAAS context name that should be used. If null (which is the default), then no authentication will be used.

Parameters:
jaasContextName - the JAAS context name, or null if no authentication should be performed

startRepositories

public void startRepositories()
                       throws IOException,
                              SAXException
Start up the repositories. This method loads the configuration, then creates the engine and starts it.

Throws:
IOException - if there is a problem initializing the repositories from the files.
SAXException - if there is a problem with the SAX Parser

getNamesOfRepositories

public List<String> getNamesOfRepositories()
Get the names of the repositories.

Returns:
the sorted but immutable list of repository names; never null

shutdown

public void shutdown()
              throws InterruptedException,
                     LoginException
Shut down the components and services and blocking until all resources have been released.

Throws:
InterruptedException - if the thread was interrupted before completing the shutdown.
LoginException

logout

public void logout()
            throws LoginException
Calling this will lose the context

Throws:
LoginException

getNodeInfo

public boolean getNodeInfo(String sourceName,
                           String pathToNode,
                           Map<String,Object[]> properties,
                           List<String> children)
                    throws Throwable
Get the information about a node, using the API method.

Parameters:
sourceName - the name of the repository source
pathToNode - the path to the node in the repository that is to be retrieved
properties - the map into which the property values will be placed; may be null if the properties are not to be retrieved
children - the collection into which the child names should be placed; may be null if the children are not to be retrieved
Returns:
true if the node was found, or false if it was not
Throws:
Throwable

buildPath

public String buildPath(String current,
                        String input)
Utility to build a path given the current path and the input path as string, where the input path could be an absolute path or relative to the current and where the input may use "." and "..".

Parameters:
current - the current path
input - the input path
Returns:
the resulting full and normalized path


Copyright © 2008-Present JBoss a division of Red Hat. All Rights Reserved.