Dynamo performs name resolution for Nucleus components whenever it encounters component names in a tag. For example, the <dsp:droplet name= and <dsp:valueof bean=...> tags both specify component names that Dynamo needs to resolve to pointers to actual objects. In performing this name resolution, Dynamo is able to create objects if they do not exist, and merge session and global namespaces automatically.

Nucleus also provides a way to connect objects to each other by naming those objects in properties files. For example, if the Person object needs a pointer to a Talents object, the Person object defines a property of type Talents, and specifies the component name of that Talents object as the value of that property in the properties file. Nucleus automatically resolves the name, creating the Talents object if necessary.

If you write your own servlet beans in Java, you might also want to resolve component names to Java objects. This functionality is provided by the resolveName() method of the DynamoHttpServletRequest class. The resolveName() method handles both absolute and relative names, and also implements the merged global and session namespaces.

For example, the following code obtains a pointer to the /services/scheduler/Scheduler component:

import atg.naming.*;
import atg.service.scheduler.*;


public void service (DynamoHttpServletRequest request,
                     DynamoHttpServletResponse response)
     throws ServletException, IOException
  Scheduler scheduler = (Scheduler)
    request.resolveName ("/services/scheduler/Scheduler");



Because resolution is a potentially expensive operation, you should consider caching the results of a name lookup of a global scope component, rather than requiring a name lookup be performed on every request.

There might be times when you want to look up an existing component, but you do not want to create an instance of the component if it does not already exist. In that case, use the resolveName() method with a false Boolean argument.

If you want to create a session-scoped or request-scoped component that looks up another session-scoped or request-scoped component, then add a property of type DynamoHttpServletRequest to your component. For example, to look up another request-scoped component, you might set a property called request as follows:


Your component can now call getRequest().resolveName("target-component"), in your component’s doStartService() method, where target-component is the name of the component you are looking up. For instance, you can display the request locale in Java code with:

if (request.getRequestLocale() != null)

You can use the URI of the request as the action attribute of a form tag in a JavaServer Page like this:

<dsp:getvalueof id="form0" bean="/OriginatingRequest.requestURI"
  <dsp:form action="<%=form0%>"/>

If you are using a session-scoped component, the value of the request property becomes invalid upon completion of the current request. To work around this problem, add the following line at the end your doStartService() method:


Note: It is not standard practice to have a session-scoped component refer to a request-scoped value. This is a special case that you can use in a restricted way to access the request that creates your session-scoped component.

If you want to resolve the name of a Nucleus component from Java code that is not itself a Nucleus service, you must first initialize Nucleus with this construct:

Nucleus.getGlobalNucleus().resolveName("target component")

where target component is the name of the component you are looking up. Note that this construct works only for components with global scope.

You can also resolve names of Nucleus components using the Java Naming and Directory Interface (JNDI). The following example shows how you can use JNDI to access the Scheduler component:

String jndiName = "dynamo:/atg/dynamo/service/Scheduler";
Context ctx = new javax.naming.InitialContext ();
Scheduler s = (Scheduler) ctx.lookup (jndiName);

Before using these methods to resolve names, make sure that the functionality you want is not already provided by configuration files or droplet tags.

loading table of contents...