Search in sources :

Example 1 with ConfigurationException

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 + "]");
    }
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) AppConstants(nl.nn.adapterframework.util.AppConstants)

Example 2 with ConfigurationException

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);
    }
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) SenderException(nl.nn.adapterframework.core.SenderException)

Example 3 with ConfigurationException

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");
    }
}
Also used : ConfigurationWarnings(nl.nn.adapterframework.configuration.ConfigurationWarnings) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException)

Example 4 with ConfigurationException

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");
    }
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) AppConstants(nl.nn.adapterframework.util.AppConstants)

Example 5 with ConfigurationException

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();
    }
}
Also used : Configuration(nl.nn.adapterframework.configuration.Configuration) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) Path(javax.ws.rs.Path) RolesAllowed(javax.annotation.security.RolesAllowed) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)113 IOException (java.io.IOException)26 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)20 PipeRunException (nl.nn.adapterframework.core.PipeRunException)17 ConfigurationWarnings (nl.nn.adapterframework.configuration.ConfigurationWarnings)16 URL (java.net.URL)13 ArrayList (java.util.ArrayList)12 Parameter (nl.nn.adapterframework.parameters.Parameter)12 ParameterList (nl.nn.adapterframework.parameters.ParameterList)11 File (java.io.File)7 Iterator (java.util.Iterator)6 ListenerException (nl.nn.adapterframework.core.ListenerException)6 PipeForward (nl.nn.adapterframework.core.PipeForward)6 PipeLineSessionBase (nl.nn.adapterframework.core.PipeLineSessionBase)6 HashMap (java.util.HashMap)5 Map (java.util.Map)5 StringTokenizer (java.util.StringTokenizer)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 FileNotFoundException (java.io.FileNotFoundException)4 LinkedList (java.util.LinkedList)4