Search in sources :

Example 1 with IbisContext

use of nl.nn.adapterframework.configuration.IbisContext in project iaf by ibissource.

the class BatchTransformerPipeBase method configure.

public void configure() throws ConfigurationException {
    super.configure();
    IbisContext ibisContext = getAdapter().getConfiguration().getIbisManager().getIbisContext();
    querySender = (FixedQuerySender) ibisContext.createBeanAutowireByName(FixedQuerySender.class);
    querySender.setName("source of " + getName());
    querySender.configure();
}
Also used : IbisContext(nl.nn.adapterframework.configuration.IbisContext)

Example 2 with IbisContext

use of nl.nn.adapterframework.configuration.IbisContext in project iaf by ibissource.

the class Result2LobWriterBase method configure.

public void configure() throws ConfigurationException {
    super.configure();
    IbisContext ibisContext = getPipe().getAdapter().getConfiguration().getIbisManager().getIbisContext();
    querySender = (FixedQuerySender) ibisContext.createBeanAutowireByName(FixedQuerySender.class);
    querySender.setName("querySender of " + getName());
    querySender.configure();
}
Also used : IbisContext(nl.nn.adapterframework.configuration.IbisContext)

Example 3 with IbisContext

use of nl.nn.adapterframework.configuration.IbisContext in project iaf by ibissource.

the class ActionBase method initAction.

/**
 * Initializes the fields in the <code>Action</code> for this specific
 * application. Most important: it retrieves the Configuration object
 * from the servletContext.
 * @see nl.nn.adapterframework.configuration.Configuration
 */
public void initAction(HttpServletRequest request) {
    locale = getLocale(request);
    messageResources = getResources(request);
    errors = new ActionErrors();
    session = request.getSession();
    String attributeKey = AppConstants.getInstance().getProperty(ConfigurationServlet.KEY_CONTEXT);
    IbisContext ibisContext = (IbisContext) getServlet().getServletContext().getAttribute(attributeKey);
    ibisManager = null;
    if (ibisContext != null) {
        ibisManager = ibisContext.getIbisManager();
    }
    if (ibisManager == null) {
        log.warn("Could not retrieve ibisManager from context");
    } else {
        log.debug("retrieved ibisManager [" + ClassUtils.nameOf(ibisManager) + "][" + ibisManager + "] from servlet context attribute [" + attributeKey + "]");
    }
}
Also used : IbisContext(nl.nn.adapterframework.configuration.IbisContext) ActionErrors(org.apache.struts.action.ActionErrors)

Example 4 with IbisContext

use of nl.nn.adapterframework.configuration.IbisContext in project iaf by ibissource.

the class CreateRestViewPipe method retrieveParameters.

private Map retrieveParameters(HttpServletRequest httpServletRequest, ServletContext servletContext, String srcPrefix) throws DomBuilderException {
    String attributeKey = AppConstants.getInstance().getProperty(ConfigurationServlet.KEY_CONTEXT);
    IbisContext ibisContext = (IbisContext) servletContext.getAttribute(attributeKey);
    Map parameters = new Hashtable();
    String requestInfoXml = "<requestInfo>" + "<servletRequest>" + "<serverInfo><![CDATA[" + servletContext.getServerInfo() + "]]></serverInfo>" + "<serverName>" + httpServletRequest.getServerName() + "</serverName>" + "</servletRequest>" + "</requestInfo>";
    parameters.put("requestInfo", XmlUtils.buildNode(requestInfoXml));
    parameters.put("upTime", XmlUtils.buildNode("<upTime>" + ibisContext.getUptime() + "</upTime>"));
    String machineNameXml = "<machineName>" + Misc.getHostname() + "</machineName>";
    parameters.put("machineName", XmlUtils.buildNode(machineNameXml));
    String fileSystemXml = "<fileSystem>" + "<totalSpace>" + Misc.getFileSystemTotalSpace() + "</totalSpace>" + "<freeSpace>" + Misc.getFileSystemFreeSpace() + "</freeSpace>" + "</fileSystem>";
    parameters.put("fileSystem", XmlUtils.buildNode(fileSystemXml));
    String applicationConstantsXml = appConstants.toXml(true);
    parameters.put("applicationConstants", XmlUtils.buildNode(applicationConstantsXml));
    String processMetricsXml = ProcessMetrics.toXml();
    parameters.put("processMetrics", XmlUtils.buildNode(processMetricsXml));
    parameters.put("menuBar", XmlUtils.buildNode(retrieveMenuBarParameter(srcPrefix)));
    parameters.put(SRCPREFIX, srcPrefix);
    return parameters;
}
Also used : IbisContext(nl.nn.adapterframework.configuration.IbisContext) Hashtable(java.util.Hashtable) Map(java.util.Map)

Example 5 with IbisContext

use of nl.nn.adapterframework.configuration.IbisContext in project iaf by ibissource.

the class RestListenerUtils method retrieveIbisManager.

public static IbisManager retrieveIbisManager(IPipeLineSession session) {
    ServletContext servletContext = (ServletContext) session.get(IPipeLineSession.SERVLET_CONTEXT_KEY);
    if (servletContext != null) {
        String attributeKey = AppConstants.getInstance().getProperty(ConfigurationServlet.KEY_CONTEXT);
        IbisContext ibisContext = (IbisContext) servletContext.getAttribute(attributeKey);
        if (ibisContext != null) {
            return ibisContext.getIbisManager();
        }
    }
    return null;
}
Also used : IbisContext(nl.nn.adapterframework.configuration.IbisContext) ServletContext(javax.servlet.ServletContext)

Aggregations

IbisContext (nl.nn.adapterframework.configuration.IbisContext)15 AppConstants (nl.nn.adapterframework.util.AppConstants)3 SQLException (java.sql.SQLException)2 Map (java.util.Map)2 ServletContext (javax.servlet.ServletContext)2 Configuration (nl.nn.adapterframework.configuration.Configuration)2 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)2 IbisManager (nl.nn.adapterframework.configuration.IbisManager)2 IAdapter (nl.nn.adapterframework.core.IAdapter)2 JdbcException (nl.nn.adapterframework.jdbc.JdbcException)2 RunStateEnum (nl.nn.adapterframework.util.RunStateEnum)2 File (java.io.File)1 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1 Connection (java.sql.Connection)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Hashtable (java.util.Hashtable)1 Iterator (java.util.Iterator)1 LinkedHashMap (java.util.LinkedHashMap)1