use of nl.nn.adapterframework.util.AppConstants in project iaf by ibissource.
the class IbisApplicationServlet method getIbisContext.
/**
* Retrieves the IbisContext from the ServletContext
* @param servletContext
* @return IbisContext or IllegalStateException when not found
*/
public static IbisContext getIbisContext(ServletContext servletContext) {
AppConstants appConstants = AppConstants.getInstance();
String ibisContextKey = appConstants.getResolvedProperty(KEY_CONTEXT);
IbisContext ibisContext = (IbisContext) servletContext.getAttribute(ibisContextKey);
if (ibisContext == null) {
Throwable t = (Throwable) servletContext.getAttribute(KEY_EXCEPTION);
throw new IllegalStateException("Unable to retrieve IbisContext from ServletContext attribute [" + KEY_CONTEXT + "]", t);
}
return ibisContext;
}
use of nl.nn.adapterframework.util.AppConstants in project iaf by ibissource.
the class ServerStatistics method getServerInformation.
@GET
@PermitAll
@Path("/server/info")
@Produces(MediaType.APPLICATION_JSON)
public Response getServerInformation() throws ApiException {
Map<String, Object> returnMap = new HashMap<>();
AppConstants appConstants = AppConstants.getInstance();
Map<String, Object> framework = new HashMap<>(2);
framework.put("name", "FF!");
framework.put("version", appConstants.getProperty("application.version"));
returnMap.put("framework", framework);
Map<String, Object> instance = new HashMap<>(2);
instance.put("version", appConstants.getProperty("instance.version"));
instance.put("name", getIbisContext().getApplicationName());
returnMap.put("instance", instance);
String dtapStage = appConstants.getProperty("dtap.stage");
returnMap.put("dtap.stage", dtapStage);
String dtapSide = appConstants.getProperty("dtap.side");
returnMap.put("dtap.side", dtapSide);
returnMap.put("configurations", getConfigurations());
String user = getUserPrincipalName();
if (user != null) {
returnMap.put("userName", user);
}
returnMap.put("applicationServer", servletConfig.getServletContext().getServerInfo());
returnMap.put("javaVersion", System.getProperty("java.runtime.name") + " (" + System.getProperty("java.runtime.version") + ")");
Map<String, Object> fileSystem = new HashMap<>(2);
fileSystem.put("totalSpace", Misc.getFileSystemTotalSpace());
fileSystem.put("freeSpace", Misc.getFileSystemFreeSpace());
returnMap.put("fileSystem", fileSystem);
returnMap.put("processMetrics", ProcessMetrics.toMap());
Date date = new Date();
returnMap.put("serverTime", date.getTime());
returnMap.put("machineName", Misc.getHostname());
ApplicationMetrics metrics = getIbisContext().getBean("metrics", ApplicationMetrics.class);
returnMap.put("uptime", (metrics != null) ? metrics.getUptimeDate() : "");
return Response.status(Response.Status.OK).entity(returnMap).build();
}
use of nl.nn.adapterframework.util.AppConstants in project iaf by ibissource.
the class FxfPropertySourcePostProcessor method convertProperties.
@Override
protected void convertProperties(Properties props) {
AppConstants appConstants = AppConstants.getInstance();
String fxfDir = appConstants.getResolvedProperty("fxf.dir");
if (fxfDir == null) {
// Use default location, see was.policy too
fxfDir = System.getProperty("APPSERVER_ROOT_DIR");
if (fxfDir != null) {
fxfDir = fxfDir + File.separator + "fxf-work";
}
}
if (fxfDir != null) {
appConstants.setProperty("fxf.dir", fxfDir);
props.put("fxf.dir", fxfDir);
}
log.debug("FxF directory: " + fxfDir);
}
use of nl.nn.adapterframework.util.AppConstants in project iaf by ibissource.
the class JdbcMessageBrowser method setOperationControls.
protected void setOperationControls() {
AppConstants ac = AppConstants.getInstance();
useParameters = ac.getBoolean(PROPERTY_USE_PARAMETERS, true);
assumePrimaryKeyUnique = ac.getBoolean(PROPERTY_ASSUME_PRIMARY_KEY_UNIQUE, true);
}
use of nl.nn.adapterframework.util.AppConstants in project iaf by ibissource.
the class TestTool method windiff.
// Used by saveResultToFile.jsp
public static void windiff(ServletContext application, HttpServletRequest request, String expectedFileName, String result, String expected) throws IOException, SenderException {
IbisContext ibisContext = getIbisContext(application);
AppConstants appConstants = getAppConstants(ibisContext);
String windiffCommand = appConstants.getResolvedProperty("larva.windiff.command");
if (windiffCommand == null) {
String servletPath = request.getServletPath();
int i = servletPath.lastIndexOf('/');
String realPath = application.getRealPath(servletPath.substring(0, i));
List<String> scenariosRootDirectories = new ArrayList<String>();
List<String> scenariosRootDescriptions = new ArrayList<String>();
String currentScenariosRootDirectory = TestTool.initScenariosRootDirectories(appConstants, realPath, null, scenariosRootDirectories, scenariosRootDescriptions, null);
windiffCommand = currentScenariosRootDirectory + "..\\..\\IbisAlgemeenWasbak\\WinDiff\\WinDiff.Exe";
}
File tempFileResult = writeTempFile(expectedFileName, result);
File tempFileExpected = writeTempFile(expectedFileName, expected);
String command = windiffCommand + " " + tempFileResult + " " + tempFileExpected;
ProcessUtil.executeCommand(command);
}
Aggregations