org.apache.cocoon.components.modules.input
Class NamingInputModule

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.components.modules.input.AbstractInputModule
          extended byorg.apache.cocoon.components.modules.input.NamingInputModule
All Implemented Interfaces:
Configurable, Disposable, Initializable, org.apache.cocoon.components.modules.input.InputModule, ThreadSafe

public class NamingInputModule
extends org.apache.cocoon.components.modules.input.AbstractInputModule
implements ThreadSafe, Initializable

NamingInputModule accesses values stored in the JNDI context.

This module accept any configuration parameters and passes them as properties to the InitialContext. When connecting to the Naming context of the server Cocoon is running in, no parameters are required.

Example module configuration when connecting to external WebLogic server:

   <java.naming.factory.initial>weblogic.jndi.WLInitialContextFactory</java.naming.factory.initial>
   <java.naming.provider.url>t3://localhost:7001</java.naming.provider.url>
 

Example usage:

   <map:generate src="{naming:java:comp/env/greeting}"/>
 
This lookups greeting entry from the environment of the webapp. Webapp's web.xml should define this entry:
   <env-entry>
     <env-entry-name>greeting</env-entry-name>
     <env-entry-value>Hello, World</env-entry-value>
     <env-entry-type>java.lang.String</env-entry-type>
   </env-entry>
 

Version:
$Id: NamingInputModule.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
 
Fields inherited from class org.apache.cocoon.components.modules.input.AbstractInputModule
settings
 
Fields inherited from interface org.apache.cocoon.components.modules.input.InputModule
ROLE
 
Constructor Summary
NamingInputModule()
           
 
Method Summary
 void configure(Configuration conf)
          Fill in InitialContext properties from passed configuration.
 void dispose()
          Close InitialContext.
 Object getAttribute(String name, Configuration modeConf, Map objectModel)
          Look up name from the InitialContext.
 Iterator getAttributeNames(Configuration modeConf, Map objectModel)
          Returns empty iterator
 void initialize()
          Creates InitialContext with configured properties.
 
Methods inherited from class org.apache.cocoon.components.modules.input.AbstractInputModule
getAttributeValues
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamingInputModule

public NamingInputModule()
Method Detail

configure

public void configure(Configuration conf)
               throws ConfigurationException
Fill in InitialContext properties from passed configuration.

Specified by:
configure in interface Configurable
Throws:
ConfigurationException

initialize

public void initialize()
                throws Exception
Creates InitialContext with configured properties.

Specified by:
initialize in interface Initializable
Throws:
Exception

dispose

public void dispose()
Close InitialContext.

Specified by:
dispose in interface Disposable

getAttribute

public Object getAttribute(String name,
                           Configuration modeConf,
                           Map objectModel)
                    throws ConfigurationException
Look up name from the InitialContext.

Specified by:
getAttribute in interface org.apache.cocoon.components.modules.input.InputModule
Throws:
ConfigurationException

getAttributeNames

public Iterator getAttributeNames(Configuration modeConf,
                                  Map objectModel)
                           throws ConfigurationException
Returns empty iterator

Specified by:
getAttributeNames in interface org.apache.cocoon.components.modules.input.InputModule
Throws:
ConfigurationException


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.