use of nl.nn.adapterframework.configuration.Configuration in project iaf by ibissource.
the class ShowConfiguration method getConfigurationByName.
@GET
@RolesAllowed({ "IbisObserver", "IbisDataAdmin", "IbisAdmin", "IbisTester" })
@Path("/configurations/{configuration}")
@Produces(MediaType.APPLICATION_XML)
public Response getConfigurationByName(@PathParam("configuration") String configurationName, @QueryParam("loadedConfiguration") boolean loadedConfiguration) throws ApiException {
initBase(servletConfig);
String result = "";
Configuration configuration = ibisManager.getConfiguration(configurationName);
if (configuration == null) {
throw new ApiException("Configuration not found!");
}
if (loadedConfiguration) {
result = configuration.getOriginalConfiguration();
} else {
result = configuration.getLoadedConfiguration();
}
return Response.status(Response.Status.CREATED).entity(result).build();
}
use of nl.nn.adapterframework.configuration.Configuration in project iaf by ibissource.
the class ShowConfiguration method makeConfigurationActive.
@GET
@RolesAllowed({ "IbisTester" })
@Path("/configurations/manage/{configuration}/activate/{version}")
@Produces(MediaType.APPLICATION_JSON)
public Response makeConfigurationActive(@PathParam("configuration") String configurationName, @PathParam("version") String version, @QueryParam("realm") String jmsRealm) throws ApiException {
initBase(servletConfig);
Configuration configuration = ibisManager.getConfiguration(configurationName);
if (configuration == null) {
throw new ApiException("Configuration not found!");
}
if (version == null || version.isEmpty()) {
throw new ApiException("No version supplied!");
}
if (StringUtils.isEmpty(version))
version = null;
if (StringUtils.isEmpty(jmsRealm))
jmsRealm = null;
try {
if (ConfigurationUtils.makeConfigActive(ibisContext, configurationName, version, jmsRealm))
return Response.status(Response.Status.ACCEPTED).entity("{\"status\":\"ok\"}").build();
else
return Response.status(Response.Status.BAD_REQUEST).build();
} catch (ConfigurationException e) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
}
use of nl.nn.adapterframework.configuration.Configuration in project iaf by ibissource.
the class ShowConfiguration method getXMLConfiguration.
@GET
@RolesAllowed({ "IbisObserver", "IbisDataAdmin", "IbisAdmin", "IbisTester" })
@Path("/configurations")
@Produces(MediaType.APPLICATION_XML)
public Response getXMLConfiguration(@QueryParam("loadedConfiguration") boolean loadedConfiguration) throws ApiException {
initBase(servletConfig);
String result = "";
for (Configuration configuration : ibisManager.getConfigurations()) {
if (loadedConfiguration) {
result = result + configuration.getOriginalConfiguration();
} else {
result = result + configuration.getLoadedConfiguration();
}
}
return Response.status(Response.Status.CREATED).entity(result).build();
}
use of nl.nn.adapterframework.configuration.Configuration in project iaf by ibissource.
the class ShowConfigurationStatus method mapAdapter.
private Map<String, Object> mapAdapter(Adapter adapter) {
Map<String, Object> adapterInfo = new HashMap<String, Object>();
Configuration config = adapter.getConfiguration();
String adapterName = adapter.getName();
adapterInfo.put("name", adapterName);
adapterInfo.put("description", adapter.getDescription());
adapterInfo.put("configuration", config.getName());
// replace low line (x'5f') by asterisk (x'2a) so it's sorted before any digit and letter
String nameUC = StringUtils.upperCase(StringUtils.replace(adapterName, "_", "*"));
adapterInfo.put("nameUC", nameUC);
RunStateEnum adapterRunState = adapter.getRunState();
adapterInfo.put("started", adapterRunState.equals(RunStateEnum.STARTED));
String state = adapterRunState.toString().toLowerCase().replace("*", "");
adapterInfo.put("state", state);
adapterInfo.put("configured", adapter.configurationSucceeded());
adapterInfo.put("upSince", adapter.getStatsUpSinceDate().getTime());
Date lastMessage = adapter.getLastMessageDateDate();
adapterInfo.put("lastMessage", (lastMessage == null) ? null : lastMessage.getTime());
adapterInfo.put("messagesInProcess", adapter.getNumOfMessagesInProcess());
adapterInfo.put("messagesProcessed", adapter.getNumOfMessagesProcessed());
adapterInfo.put("messagesInError", adapter.getNumOfMessagesInError());
return adapterInfo;
}
use of nl.nn.adapterframework.configuration.Configuration in project iaf by ibissource.
the class ShowScheduler method getJobGroupNamesWithJobs.
private Map<String, Object> getJobGroupNamesWithJobs(Scheduler scheduler) throws ApiException {
Map<String, Object> jobGroups = new HashMap<String, Object>();
try {
String[] jobGroupNames = scheduler.getJobGroupNames();
for (int i = 0; i < jobGroupNames.length; i++) {
Map<String, Object> jobsInGroup = new HashMap<String, Object>();
String jobGroupName = jobGroupNames[i];
String[] jobNames = scheduler.getJobNames(jobGroupName);
for (int j = 0; j < jobNames.length; j++) {
String jobName = jobNames[j];
Map<String, Object> jobData = new HashMap<String, Object>();
JobDef jobDef = null;
for (Configuration configuration : ibisManager.getConfigurations()) {
jobDef = configuration.getScheduledJob(jobName);
if (jobDef != null) {
break;
}
}
JobDetail job = scheduler.getJobDetail(jobName, jobGroupName);
jobData.put("fullName", job.getFullName());
jobData.put("name", job.getName());
String description = "-";
if (StringUtils.isNotEmpty(job.getDescription()))
description = job.getDescription();
jobData.put("description", description);
jobData.put("stateful", job.isStateful());
jobData.put("durable", job.isDurable());
jobData.put("volatile", job.isVolatile());
jobData.put("jobClass", job.getJobClass().getName());
jobData.put("triggers", getJobTriggers(scheduler, jobName, jobGroupName));
jobData.put("messages", getJobMessages(jobDef));
JobDataMap jobMap = job.getJobDataMap();
jobData.put("containsTransientData", jobMap.containsTransientData());
jobData.put("allowsTransientData", jobMap.getAllowsTransientData());
jobData.put("properties", getJobData(jobMap));
jobsInGroup.put(jobName, jobData);
}
jobGroups.put(jobGroupName, jobsInGroup);
}
} catch (Exception e) {
log.error(e);
}
return jobGroups;
}
Aggregations