Search in sources :

Example 46 with ConfigurationException

use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.

the class FileSystemActor method checkConfiguration.

private void checkConfiguration(FileSystemAction action2) throws ConfigurationException {
    if (!actions.contains(action2))
        throw new ConfigurationException(ClassUtils.nameOf(owner) + ": unknown or invalid action [" + action2 + "] supported actions are " + actions.toString() + "");
    // Check if necessary parameters are available
    actionRequiresAtLeastOneOfTwoParametersOrAttribute(owner, parameterList, action2, FileSystemAction.WRITE, PARAMETER_CONTENTS1, PARAMETER_FILENAME, "filename", getFilename());
    actionRequiresAtLeastOneOfTwoParametersOrAttribute(owner, parameterList, action2, FileSystemAction.MOVE, PARAMETER_DESTINATION, null, "destination", getDestination());
    actionRequiresAtLeastOneOfTwoParametersOrAttribute(owner, parameterList, action2, FileSystemAction.COPY, PARAMETER_DESTINATION, null, "destination", getDestination());
    actionRequiresAtLeastOneOfTwoParametersOrAttribute(owner, parameterList, action2, FileSystemAction.RENAME, PARAMETER_DESTINATION, null, "destination", getDestination());
    actionRequiresAtLeastOneOfTwoParametersOrAttribute(owner, parameterList, action2, FileSystemAction.FORWARD, PARAMETER_DESTINATION, null, "destination", getDestination());
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException)

Example 47 with ConfigurationException

use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.

the class FileSystemActor method configure.

public void configure(FS fileSystem, ParameterList parameterList, IConfigurable owner) throws ConfigurationException {
    this.owner = owner;
    this.fileSystem = fileSystem;
    this.parameterList = parameterList;
    if (fileSystem instanceof IWritableFileSystem) {
        actions.addAll(Arrays.asList(ACTIONS_WRITABLE_FS));
    }
    if (fileSystem instanceof IMailFileSystem) {
        actions.addAll(Arrays.asList(ACTIONS_MAIL_FS));
    }
    if (parameterList != null && parameterList.findParameter(PARAMETER_CONTENTS2) != null && parameterList.findParameter(PARAMETER_CONTENTS1) == null) {
        ConfigurationWarnings.add(owner, log, "parameter [" + PARAMETER_CONTENTS2 + "] has been replaced with [" + PARAMETER_CONTENTS1 + "]");
        parameterList.findParameter(PARAMETER_CONTENTS2).setName(PARAMETER_CONTENTS1);
    }
    if (action != null) {
        if (getAction() == FileSystemAction.DOWNLOAD) {
            ConfigurationWarnings.add(owner, log, "action [" + FileSystemAction.DOWNLOAD + "] has been replaced with [" + FileSystemAction.READ + "]");
            action = FileSystemAction.READ;
        }
        if (getAction() == FileSystemAction.UPLOAD) {
            ConfigurationWarnings.add(owner, log, "action [" + FileSystemAction.UPLOAD + "] has been replaced with [" + FileSystemAction.WRITE + "]");
            action = FileSystemAction.WRITE;
        }
        checkConfiguration(getAction());
    } else if (parameterList == null || parameterList.findParameter(PARAMETER_ACTION) == null) {
        throw new ConfigurationException(ClassUtils.nameOf(owner) + ": either attribute [action] or parameter [" + PARAMETER_ACTION + "] must be specified");
    }
    if (StringUtils.isNotEmpty(getInputFolder()) && parameterList != null && parameterList.findParameter(PARAMETER_INPUTFOLDER) != null) {
        ConfigurationWarnings.add(owner, log, "inputFolder configured via attribute [inputFolder] as well as via parameter [" + PARAMETER_INPUTFOLDER + "], parameter will be ignored");
    }
    if (!(fileSystem instanceof IWritableFileSystem)) {
        if (getNumberOfBackups() > 0) {
            throw new ConfigurationException("FileSystem [" + ClassUtils.nameOf(fileSystem) + "] does not support setting attribute 'numberOfBackups'");
        }
        if (getRotateDays() > 0) {
            throw new ConfigurationException("FileSystem [" + ClassUtils.nameOf(fileSystem) + "] does not support setting attribute 'rotateDays'");
        }
    }
    eolArray = System.getProperty("line.separator").getBytes();
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException)

Example 48 with ConfigurationException

use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.

the class WebServiceListener method configure.

/**
 * initialize listener and register <code>this</code> to the JNDI
 */
@Override
public void configure() throws ConfigurationException {
    super.configure();
    if (StringUtils.isEmpty(getAddress()) && isMtomEnabled())
        throw new ConfigurationException("can only use MTOM when address attribute has been set");
    if (StringUtils.isNotEmpty(getAddress()) && getAddress().contains(":"))
        throw new ConfigurationException("address cannot contain colon ( : ) character");
    if (StringUtils.isNotEmpty(getAttachmentSessionKeys())) {
        StringTokenizer stringTokenizer = new StringTokenizer(getAttachmentSessionKeys(), " ,;");
        while (stringTokenizer.hasMoreTokens()) {
            attachmentSessionKeysList.add(stringTokenizer.nextToken());
        }
    }
    if (isSoap()) {
        // String msg = ClassUtils.nameOf(this) +"["+getName()+"]: the use of attribute soap=true has been deprecated. Please use the SoapWrapperPipe instead";
        // ConfigurationWarnings.getInstance().add(log, msg, true);
        soapWrapper = SoapWrapper.getInstance();
    }
    if (StringUtils.isEmpty(getServiceNamespaceURI()) && StringUtils.isEmpty(getAddress())) {
        String msg = "calling webservices via de ServiceDispatcher_ServiceProxy is deprecated. Please specify an address or serviceNamespaceURI and modify the call accordingly";
        ConfigurationWarnings.add(this, log, msg, SuppressKeys.DEPRECATION_SUPPRESS_KEY, null);
    }
    Bus bus = getApplicationContext().getBean("cxf", Bus.class);
    if (bus instanceof SpringBus) {
        cxfBus = (SpringBus) bus;
        log.debug("found CXF SpringBus id [" + bus.getId() + "]");
    } else {
        throw new ConfigurationException("unable to find SpringBus, cannot register " + this.getClass().getSimpleName());
    }
}
Also used : Bus(org.apache.cxf.Bus) SpringBus(org.apache.cxf.bus.spring.SpringBus) StringTokenizer(java.util.StringTokenizer) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) SpringBus(org.apache.cxf.bus.spring.SpringBus)

Example 49 with ConfigurationException

use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.

the class Samba1FileSystem method configure.

@Override
public void configure() throws ConfigurationException {
    if (getShare() == null)
        throw new ConfigurationException("server share endpoint is required");
    if (!getShare().startsWith("smb://"))
        throw new ConfigurationException("attribute share must begin with [smb://]");
    // Setup credentials if applied, may be null.
    // NOTE: When using NtmlPasswordAuthentication without username it returns GUEST
    CredentialFactory cf = new CredentialFactory(getAuthAlias(), getUsername(), getPassword());
    if (StringUtils.isNotEmpty(cf.getUsername())) {
        auth = new NtlmPasswordAuthentication(getDomain(), cf.getUsername(), cf.getPassword());
        log.debug("setting authentication to [" + auth.toString() + "]");
    }
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) CredentialFactory(nl.nn.adapterframework.util.CredentialFactory) NtlmPasswordAuthentication(jcifs.smb.NtlmPasswordAuthentication)

Example 50 with ConfigurationException

use of nl.nn.adapterframework.configuration.ConfigurationException in project iaf by ibissource.

the class IbisWebServiceSender method configure.

@Override
public void configure() throws ConfigurationException {
    if (ibisInstance == null) {
        ibisInstance = AppConstants.getInstance().getResolvedProperty("instance.name");
    }
    try {
        proxy = new ServiceDispatcher_ServiceProxy();
        proxy.setEndPoint(new URL(getEndPoint()));
    } catch (MalformedURLException e) {
        throw new ConfigurationException("IbisWebServiceSender cannot find URL from [" + getEndPoint() + "]", e);
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) ServiceDispatcher_ServiceProxy(nl.nn.adapterframework.receivers.ServiceDispatcher_ServiceProxy) URL(java.net.URL)

Aggregations

ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)187 IOException (java.io.IOException)52 PipeRunException (nl.nn.adapterframework.core.PipeRunException)25 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)24 Parameter (nl.nn.adapterframework.parameters.Parameter)20 ArrayList (java.util.ArrayList)19 URL (java.net.URL)17 ParameterList (nl.nn.adapterframework.parameters.ParameterList)16 SAXException (org.xml.sax.SAXException)14 TransformerException (javax.xml.transform.TransformerException)12 Test (org.junit.Test)12 CredentialFactory (nl.nn.adapterframework.util.CredentialFactory)11 HashMap (java.util.HashMap)10 File (java.io.File)9 StringTokenizer (java.util.StringTokenizer)8 Connection (java.sql.Connection)7 Map (java.util.Map)7 ListenerException (nl.nn.adapterframework.core.ListenerException)7 ParameterException (nl.nn.adapterframework.core.ParameterException)7 JdbcException (nl.nn.adapterframework.jdbc.JdbcException)7