use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class MonitorAdapterBase method configure.
public void configure() throws ConfigurationException {
if (StringUtils.isEmpty(getName())) {
setName(ClassUtils.nameOf(this));
}
hostname = Misc.getHostname();
AppConstants appConstants = AppConstants.getInstance();
sourceId = appConstants.getResolvedProperty(SOURCE_ID_KEY);
if (StringUtils.isEmpty(sourceId)) {
throw new ConfigurationException("cannot read sourceId from [" + SOURCE_ID_KEY + "]");
}
}
use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class SenderMonitorAdapter method configure.
public void configure() throws ConfigurationException {
if (getSender() == null) {
throw new ConfigurationException("must have sender configured");
}
if (StringUtils.isEmpty(getSender().getName())) {
getSender().setName("sender of " + getName());
}
super.configure();
if (!senderConfigured) {
getSender().configure();
senderConfigured = true;
} else {
try {
getSender().close();
} catch (SenderException e) {
log.error("cannot close sender", e);
}
}
try {
getSender().open();
} catch (SenderException e) {
throw new ConfigurationException("cannot open sender", e);
}
}
use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class LdapChallengePipe method configure.
public void configure() throws ConfigurationException {
super.configure();
ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
configWarnings.add(log, "LdapChallengePipe is deprecated, please use LdapSender with operation challenge and check for returned message <LdapResult>Success</LdapResult>");
if (StringUtils.isEmpty(ldapProviderURL) && getParameterList().findParameter("ldapProviderURL") == null) {
throw new ConfigurationException("ldapProviderURL must be specified, either as attribute or as parameter");
}
if (StringUtils.isNotEmpty(ldapProviderURL) && getParameterList().findParameter("ldapProviderURL") != null) {
throw new ConfigurationException("ldapProviderURL can only be specified once, either as attribute or as parameter");
}
if (getParameterList().findParameter("principal") == null) {
throw new ConfigurationException("Parameter 'principal' must be specified");
}
if (getParameterList().findParameter("credentials") == null) {
throw new ConfigurationException("Parameter 'credentials' must be specified");
}
}
use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.
the class GalmMonitorAdapter method configure.
public void configure() throws ConfigurationException {
super.configure();
hostname = Misc.getHostname();
AppConstants appConstants = AppConstants.getInstance();
sourceId = appConstants.getResolvedProperty(SOURCE_ID_KEY);
if (StringUtils.isEmpty(sourceId)) {
throw new ConfigurationException("cannot read sourceId from [" + SOURCE_ID_KEY + "]");
}
if (sourceId.indexOf(' ') >= 0) {
StringBuffer replacement = new StringBuffer();
boolean replacementsMade = false;
for (int i = 0; i < sourceId.length(); i++) {
char c = sourceId.charAt(i);
if (Character.isLetterOrDigit(c) || c == '_') {
replacement.append(c);
} else {
replacement.append('_');
replacementsMade = true;
}
}
if (replacementsMade) {
if (log.isDebugEnabled())
log.debug("sourceId [" + sourceId + "] read from [" + SOURCE_ID_KEY + "] contains spaces, replacing them with underscores, resulting in [" + replacement.toString() + "]");
sourceId = replacement.toString();
}
}
dtapStage = appConstants.getString(DTAP_STAGE_KEY, null);
if (StringUtils.isEmpty(dtapStage)) {
throw new ConfigurationException("cannot read dtapStage from [" + DTAP_STAGE_KEY + "]");
}
if (!("DEV".equals(dtapStage)) && !("TEST".equals(dtapStage)) && !("ACCEPT".equals(dtapStage)) && !("PROD".equals(dtapStage))) {
throw new ConfigurationException("dtapStage [" + dtapStage + "] read from [" + DTAP_STAGE_KEY + "] not equal to one of DEV, TEST, ACCEPT, PROD");
}
}
use of nl.nn.adapterframework.configuration.ConfigurationException 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();
}
}
Aggregations