//TODO Replace this with java.util.Collections!
@GET
	@PermitAll
	@Path("/server/info")
	@Produces(MediaType.APPLICATION_JSON)
	public Response getServerInformation() throws ApiException {
		Map<String, Object> returnMap = new HashMap<String, Object>();
		List<Object> configurations = new ArrayList<Object>();
		AppConstants appConstants = AppConstants.getInstance();
		for (Configuration configuration : getIbisManager().getConfigurations()) {
			Map<String, Object> cfg = new HashMap<String, Object>();
			cfg.put("name", configuration.getName());
			cfg.put("version", configuration.getVersion());
			cfg.put("stubbed", configuration.isStubbed());
			cfg.put("type", configuration.getClassLoaderType());
			if(configuration.getConfigurationException() != null) {
				cfg.put("exception", configuration.getConfigurationException().getMessage());
			}
			ClassLoader classLoader = configuration.getClassLoader();
			if(classLoader instanceof DatabaseClassLoader) {
				cfg.put("filename", ((DatabaseClassLoader) classLoader).getFileName());
				cfg.put("created", ((DatabaseClassLoader) classLoader).getCreationDate());
				cfg.put("user", ((DatabaseClassLoader) classLoader).getUser());
			}
			String parentConfig = AppConstants.getInstance().getString("configurations." + configuration.getName() + ".parentConfig", null);
			if(parentConfig != null)
				cfg.put("parent", parentConfig);
				configurations.add(cfg);
		}
		//TODO Replace this with java.util.Collections!
		Collections.sort(configurations, new Comparator<Map<String, String>>() {
			@Override
			public int compare(Map<String, String> lhs, Map<String, String> rhs) {
				String name1 = lhs.get("name");
				String name2 = rhs.get("name");
				return name1.startsWith("IAF_") ? -1 : name2.startsWith("IAF_") ? 1 : name1.compareTo(name2);
			}
		});
		returnMap.put("configurations", configurations);
		Map<String, Object> framework = new HashMap<String, Object>(2);
		framework.put("name", "FF!");
		framework.put("version", appConstants.getProperty("application.version"));
		returnMap.put("framework", framework);
		Map<String, Object> instance = new HashMap<String, Object>(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("applicationServer", servletConfig.getServletContext().getServerInfo());
		returnMap.put("javaVersion", System.getProperty("java.runtime.name") + " (" + System.getProperty("java.runtime.version") + ")");
		Map<String, Object> fileSystem = new HashMap<String, Object>(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();
	}
configurations.add(cfg);
}
//TODO Replace this with java.util.Collections!
Collections.sort(configurations, new Comparator<Map<String, String>>() {
@Override
if(classLoader instanceof DatabaseClassLoader) {
cfg.put("filename", ((DatabaseClassLoader) classLoader).getFileName());
cfg.put("created", ((DatabaseClassLoader) classLoader).getCreationDate());
cfg.put("user", ((DatabaseClassLoader) classLoader).getUser());
}
String parentConfig = AppConstants.getInstance().getString("configurations." + configuration.getName() + ".parentConfig", null);
if(parentConfig != null)
cfg.put("parent", parentConfig);
configurations.add(cfg);
}
//TODO Replace this with java.util.Collections!
Collections.sort(configurations, new Comparator<Map<String, String>>() {
@Override
public int compare(Map<String, String> lhs, Map<String, String> rhs) {
String name1 = lhs.get("name");
String name2 = rhs.get("name");
return name1.startsWith("IAF_") ? -1 : name2.startsWith("IAF_") ? 1 : name1.compareTo(name2);
}
});
returnMap.put("configurations", configurations);
Map<String, Object> framework = new HashMap<String, Object>(2);
for (Configuration configuration : getIbisManager().getConfigurations()) {
Map<String, Object> cfg = new HashMap<String, Object>();
cfg.put("name", configuration.getName());
cfg.put("version", configuration.getVersion());
cfg.put("stubbed", configuration.isStubbed());
cfg.put("type", configuration.getClassLoaderType());
if(configuration.getConfigurationException() != null) {
cfg.put("exception", configuration.getConfigurationException().getMessage());
}
ClassLoader classLoader = configuration.getClassLoader();
if(classLoader instanceof DatabaseClassLoader) {
cfg.put("filename", ((DatabaseClassLoader) classLoader).getFileName());
cfg.put("created", ((DatabaseClassLoader) classLoader).getCreationDate());
cfg.put("user", ((DatabaseClassLoader) classLoader).getUser());
}
String parentConfig = AppConstants.getInstance().getString("configurations." + configuration.getName() + ".parentConfig", null);
if(parentConfig != null)
cfg.put("parent", parentConfig);
configurations.add(cfg);
}
//TODO Replace this with java.util.Collections!
Collections.sort(configurations, new Comparator<Map<String, String>>() {
@Override
public int compare(Map<String, String> lhs, Map<String, String> rhs) {
String name1 = lhs.get("name");
String name2 = rhs.get("name");
return name1.startsWith("IAF_") ? -1 : name2.startsWith("IAF_") ? 1 : name1.compareTo(name2);
}
});
returnMap.put("configurations", configurations);
Map<String, Object> framework = new HashMap<String, Object>(2);
framework.put("name", "FF!");
framework.put("version", appConstants.getProperty("application.version"));
returnMap.put("framework", framework);
Map<String, Object> instance = new HashMap<String, Object>(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");