Expresso 5-6

com.jcorporate.expresso.kernel.util
Class LocatorUtils

java.lang.Object
  extended bycom.jcorporate.expresso.kernel.util.LocatorUtils

public class LocatorUtils
extends Object

Locator Utils are to allow walking the component hierarchy tree so you can reference components by a 'path name' instead of walking it manually yourself

Beacuse there are potentially more than one Runtime Environment in a Virtual Machine, you must associate a LocatorUtils object with any component within a tree. Once it has that figured out, it can locate any other component in the tree

Since:
Expresso 5.1
Version:
$Revision: 1.9 $ on $Date: 2004/11/17 20:48:17 $
Author:
Michael Rimov

Constructor Summary
LocatorUtils(ExpressoComponent component)
          Base constructor that locates the root component in the hierarchy as soon as it is instantiated.
 
Method Summary
 DataContext getDataContext(ExpressoComponent component)
          Retrieve the DataContext that the given component is a part of
 String getDataContextName(ExpressoComponent component)
          Given the component that we loaded, find the data context name we're a part of.
 String getPath(ExpressoComponent component)
          Return a path that the Locator utils could find later to relocate this component.
 ExpressoComponent locateComponent(String pathName)
          Allows you to locate the component via a 'bean utils' style string.
 ComponentConfig locateConfiguration(String pathName)
          Allows you to locate the component via a 'bean utils' style string.
 ComponentMetadata locateMetadata(String pathName)
          Allows you to locate the component metadata via a 'bean utils' style string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocatorUtils

public LocatorUtils(ExpressoComponent component)
Base constructor that locates the root component in the hierarchy as soon as it is instantiated.

Parameters:
component - any component in the Runtime Hierarchy
Method Detail

locateComponent

public ExpressoComponent locateComponent(String pathName)

Allows you to locate the component via a 'bean utils' style string.

Examples:

Locate a component in default context by the name of myComponent:
ExpressoComponent mycomponent = locator.locateComponent("default.myComponent");

Locate the root container:
ExpressoComponent rootContainer = locator.locateComponent("");

Parameters:
pathName - The pathname to use to locate the particular component as described in the above javadocs.
Returns:
ExpressoComponent found
Throws:
IllegalArgumentException - if either the pathName is improper or if the component doesn't seem to exist in the given traversal

locateConfiguration

public ComponentConfig locateConfiguration(String pathName)

Allows you to locate the component via a 'bean utils' style string.

Examples:

Locate a components configuration in default context by the name of myComponent:
ComponentConfig myconfig = locator.locateComponent("default.myComponent");

Locate the root container:
ComponentConfig rootContainerConfig = locator.locateComponent("");

Parameters:
pathName - The pathname to use to locate the particular component as described in the above javadocs.
Returns:
ComponentConfig found
Throws:
IllegalArgumentException - if either the pathName is improper or if the component doesn't seem to exist in the given traversal

locateMetadata

public ComponentMetadata locateMetadata(String pathName)

Allows you to locate the component metadata via a 'bean utils' style string.

Examples:

Locate a components configuration in default context by the name of myComponent:
ComponentConfig myconfig = locator.locateComponent("default.myComponent");

Locate the root container:
ComponentConfig rootContainerConfig = locator.locateComponent("");

Parameters:
pathName - The pathname to use to locate the particular component as described in the above javadocs.
Returns:
ComponentMetadata found
Throws:
IllegalArgumentException - if either the pathName is improper or if the component doesn't seem to exist in the given traversal

getPath

public String getPath(ExpressoComponent component)
Return a path that the Locator utils could find later to relocate this component.

Parameters:
component - The component to get the location string.
Returns:
java.lang.String possibly empty string if the component is root.

getDataContextName

public String getDataContextName(ExpressoComponent component)
Given the component that we loaded, find the data context name we're a part of.

Parameters:
component - the name of the component to retrieve the context name
Returns:
java.util.String of the data context name or null if the defined component is not embedded within a data context.

getDataContext

public DataContext getDataContext(ExpressoComponent component)
Retrieve the DataContext that the given component is a part of

Parameters:
component - the component in the hierarchy that we want to find what data context it is a part of.
Returns:
DataContext or null if the component is not part of a data context.

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.