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);
}
}
}
}
}
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;
}
}
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");
}
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}";
}
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);
}
}
}
}
}
Aggregations