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

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.modules.input.AbstractInputModule
          extended by org.apache.cocoon.components.modules.input.NamingInputModule
All Implemented Interfaces:
Disposable, Initializable, Component, Configurable, LogEnabled, ThreadSafe, InputModule

public class NamingInputModule
extends 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 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Vadim Gritsenko

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.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
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
Overrides:
configure in class AbstractInputModule
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
Overrides:
dispose in class AbstractInputModule

getAttribute

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

Specified by:
getAttribute in interface InputModule
Overrides:
getAttribute in class AbstractInputModule
Parameters:
name - a String that specifies what the caller thinks would identify an attribute. This is mainly a fallback if no modeConf is present.
modeConf - column's mode configuration from resource description. This argument is optional.
Throws:
ConfigurationException

getAttributeNames

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

Specified by:
getAttributeNames in interface InputModule
Overrides:
getAttributeNames in class AbstractInputModule
Parameters:
modeConf - column's mode configuration from resource description. This argument is optional.
Throws:
ConfigurationException


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.