Search in sources :

Example 26 with AppConstants

use of nl.nn.adapterframework.util.AppConstants in project iaf by ibissource.

the class StatisticsKeeperLogger method end.

public void end(Object data) {
    super.end(data);
    if (StringUtils.isNotEmpty(getDirectory())) {
        AppConstants ac = AppConstants.getInstance();
        String filenamePattern = ac.getResolvedProperty("instance.name.lc") + "-stats_";
        String extension = ".log";
        File outfile = FileUtils.getWeeklyRollingFile(directory, filenamePattern, extension, retentionDays);
        FileWriter fw = null;
        try {
            fw = new FileWriter(outfile, true);
            fw.write(getXml(data).toXML());
            fw.write("\n");
        } catch (IOException e) {
            log.error("Could not write statistics to file [" + outfile.getPath() + "]", e);
        } finally {
            if (fw != null) {
                try {
                    fw.close();
                } catch (Exception e) {
                    log.error("Could not close statistics file [" + outfile.getPath() + "]", e);
                }
            }
        }
    }
}
Also used : FileWriter(java.io.FileWriter) IOException(java.io.IOException) File(java.io.File) IOException(java.io.IOException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) AppConstants(nl.nn.adapterframework.util.AppConstants)

Example 27 with AppConstants

use of nl.nn.adapterframework.util.AppConstants in project iaf by ibissource.

the class IbisSoapServlet method init.

@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    AppConstants appConstants = AppConstants.getInstance();
    String attributeKey = appConstants.getProperty(ConfigurationServlet.KEY_CONTEXT);
    IbisContext ibisContext = (IbisContext) config.getServletContext().getAttribute(attributeKey);
    if (ibisContext == null)
        throw new IllegalStateException("No ibis context found with " + ConfigurationServlet.KEY_CONTEXT);
    ibisManager = ibisContext.getIbisManager();
    if ("false".equals(appConstants.getProperty("wsdl.caching"))) {
        caching = false;
    }
}
Also used : IbisContext(nl.nn.adapterframework.configuration.IbisContext) AppConstants(nl.nn.adapterframework.util.AppConstants)

Example 28 with AppConstants

use of nl.nn.adapterframework.util.AppConstants in project iaf by ibissource.

the class ConfigurationServlet method init.

@Override
public void init() throws ServletException {
    super.init();
    ServletContext servletContext = getServletContext();
    AppConstants appConstants = AppConstants.getInstance();
    String realPath = servletContext.getRealPath("/");
    if (realPath != null) {
        appConstants.put("webapp.realpath", realPath);
    } else {
        log.warn("Could not determine webapp.realpath");
    }
    String projectBaseDir = Misc.getProjectBaseDir();
    if (projectBaseDir != null) {
        appConstants.put("project.basedir", projectBaseDir);
    } else {
        log.info("Could not determine project.basedir");
    }
    setUploadPathInServletContext();
    ibisContext = new IbisContext();
    setDefaultApplicationServerType(ibisContext);
    String attributeKey = appConstants.getResolvedProperty(KEY_CONTEXT);
    servletContext.setAttribute(attributeKey, ibisContext);
    log.debug("stored IbisContext [" + ClassUtils.nameOf(ibisContext) + "][" + ibisContext + "] in ServletContext under key [" + attributeKey + "]");
    ibisContext.init();
    if (ibisContext.getIbisManager() == null)
        log.warn("Servlet init finished without successfully initializing the ibisContext");
    else
        log.debug("Servlet init finished");
}
Also used : IbisContext(nl.nn.adapterframework.configuration.IbisContext) ServletContext(javax.servlet.ServletContext) AppConstants(nl.nn.adapterframework.util.AppConstants)

Example 29 with AppConstants

use of nl.nn.adapterframework.util.AppConstants in project iaf by ibissource.

the class WsdlGenerator method getSoapAction.

protected String getSoapAction(IListener<?> listener) {
    AppConstants appConstants = AppConstants.getInstance(pipeLine.getAdapter().getConfiguration().getClassLoader());
    String sa = appConstants.getResolvedProperty("wsdl." + getName() + "." + listener.getName() + ".soapAction");
    if (sa != null) {
        return sa;
    }
    sa = appConstants.getResolvedProperty("wsdl." + getName() + ".soapAction");
    if (sa != null) {
        return sa;
    }
    sa = appConstants.getResolvedProperty("wsdl.soapAction");
    if (sa != null) {
        return sa;
    }
    if (esbSoapOperationName != null && esbSoapOperationVersion != null) {
        return esbSoapOperationName + "_" + esbSoapOperationVersion;
    }
    return "${wsdl." + getName() + "." + listener.getName() + ".soapAction}";
}
Also used : AppConstants(nl.nn.adapterframework.util.AppConstants)

Example 30 with AppConstants

use of nl.nn.adapterframework.util.AppConstants in project iaf by ibissource.

the class StatisticsKeeperLogger method end.

@Override
public void end(XmlBuilder data) {
    super.end(data);
    if (StringUtils.isNotEmpty(getDirectory())) {
        AppConstants ac = AppConstants.getInstance();
        String filenamePattern = ac.getResolvedProperty("instance.name.lc") + "-stats_";
        String extension = ".log";
        File outfile = FileUtils.getWeeklyRollingFile(directory, filenamePattern, extension, retentionDays);
        FileWriter fw = null;
        try {
            fw = new FileWriter(outfile, true);
            fw.write(data.toXML());
            fw.write("\n");
        } catch (IOException e) {
            log.error("Could not write statistics to file [" + outfile.getPath() + "]", e);
        } finally {
            if (fw != null) {
                try {
                    fw.close();
                } catch (Exception e) {
                    log.error("Could not close statistics file [" + outfile.getPath() + "]", e);
                }
            }
        }
    }
}
Also used : FileWriter(java.io.FileWriter) IOException(java.io.IOException) File(java.io.File) IOException(java.io.IOException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) AppConstants(nl.nn.adapterframework.util.AppConstants)

Aggregations

AppConstants (nl.nn.adapterframework.util.AppConstants)42 IbisContext (nl.nn.adapterframework.configuration.IbisContext)7 File (java.io.File)6 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)6 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)3 FileWriter (java.io.FileWriter)2 URL (java.net.URL)2 Enumeration (java.util.Enumeration)2 ServletContext (javax.servlet.ServletContext)2 ServletException (javax.servlet.ServletException)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 ZipEntry (java.util.zip.ZipEntry)1 ZipInputStream (java.util.zip.ZipInputStream)1