Search in sources :

Example 56 with ConfigurationWarnings

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

the class XsltParamPipe method configure.

public void configure() throws ConfigurationException {
    ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
    String msg = getLogPrefix(null) + "The class [" + getClass().getName() + "] has been deprecated. Please change to [" + getClass().getSuperclass().getName() + "]";
    configWarnings.add(log, msg);
    super.configure();
}
Also used : ConfigurationWarnings(nl.nn.adapterframework.configuration.ConfigurationWarnings)

Example 57 with ConfigurationWarnings

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

the class ConfigurationServlet method setDefaultApplicationServerType.

private void setDefaultApplicationServerType(IbisContext ibisContext) {
    ServletContext context = getServletContext();
    String serverInfo = context.getServerInfo();
    String defaultApplicationServerType = null;
    if (StringUtils.containsIgnoreCase(serverInfo, "WebSphere Liberty")) {
        defaultApplicationServerType = "WLP";
    } else if (StringUtils.containsIgnoreCase(serverInfo, "WebSphere")) {
        defaultApplicationServerType = "WAS";
    } else if (StringUtils.containsIgnoreCase(serverInfo, "Tomcat")) {
        defaultApplicationServerType = "TOMCAT";
    } else if (StringUtils.containsIgnoreCase(serverInfo, "JBoss")) {
        defaultApplicationServerType = "JBOSS";
    } else if (StringUtils.containsIgnoreCase(serverInfo, "jetty")) {
        String javaHome = AppConstants.getInstance().getString("java.home", "");
        if (StringUtils.containsIgnoreCase(javaHome, "tibco")) {
            defaultApplicationServerType = "TIBCOAMX";
        } else {
            defaultApplicationServerType = "JETTYMVN";
        }
    } else {
        ConfigurationWarnings configWarnings = ConfigurationWarnings.getInstance();
        configWarnings.add(log, "Unknown server info [" + serverInfo + "] default application server type could not be determined, TOMCAT will be used as default value");
        defaultApplicationServerType = "TOMCAT";
    }
    ibisContext.setDefaultApplicationServerType(defaultApplicationServerType);
}
Also used : ConfigurationWarnings(nl.nn.adapterframework.configuration.ConfigurationWarnings) ServletContext(javax.servlet.ServletContext)

Example 58 with ConfigurationWarnings

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

the class ServerStatistics method getServerConfiguration.

@GET
@PermitAll
@Path("/server/warnings")
@Produces(MediaType.APPLICATION_JSON)
public Response getServerConfiguration() throws ApiException {
    initBase(servletConfig);
    ConfigurationWarnings globalConfigWarnings = ConfigurationWarnings.getInstance();
    // (globalConfigWarnings.size() + 1); //Add 1 for ESR
    List<Object> warnings = new ArrayList<Object>();
    boolean showCountErrorStore = AppConstants.getInstance().getBoolean("errorStore.count.show", true);
    List<IAdapter> registeredAdapters = ibisManager.getRegisteredAdapters();
    long esr = 0;
    if (showCountErrorStore) {
        for (Iterator<IAdapter> adapterIt = registeredAdapters.iterator(); adapterIt.hasNext(); ) {
            Adapter adapter = (Adapter) adapterIt.next();
            for (Iterator<?> receiverIt = adapter.getReceiverIterator(); receiverIt.hasNext(); ) {
                ReceiverBase receiver = (ReceiverBase) receiverIt.next();
                ITransactionalStorage errorStorage = receiver.getErrorStorage();
                if (errorStorage != null) {
                    try {
                        esr += errorStorage.getMessageCount();
                    } catch (Exception e) {
                        // error("error occured on getting number of errorlog records for adapter ["+adapter.getName()+"]",e);
                        log.warn("Assuming there are no errorlog records for adapter [" + adapter.getName() + "]");
                    }
                }
            }
        }
    } else {
        esr = -1;
    }
    if (esr != 0) {
        Map<String, Object> messageObj = new HashMap<String, Object>(2);
        String message;
        if (esr == -1) {
            message = "Errorlog might contain records. This is unknown because errorStore.count.show is not set to true";
        } else if (esr == 1) {
            message = "Errorlog contains 1 record. Service management should check whether this record has to be resent or deleted";
        } else {
            message = "Errorlog contains " + esr + " records. Service Management should check whether these records have to be resent or deleted";
        }
        messageObj.put("message", message);
        messageObj.put("type", "severe");
        warnings.add(messageObj);
    }
    for (Configuration config : ibisManager.getConfigurations()) {
        if (config.getConfigurationException() != null) {
            Map<String, Object> messageObj = new HashMap<String, Object>(2);
            String message = config.getConfigurationException().getMessage();
            messageObj.put("message", message);
            messageObj.put("type", "exception");
            warnings.add(messageObj);
        }
    }
    // Configuration specific warnings
    for (Configuration configuration : ibisManager.getConfigurations()) {
        BaseConfigurationWarnings configWarns = configuration.getConfigurationWarnings();
        for (int j = 0; j < configWarns.size(); j++) {
            Map<String, Object> messageObj = new HashMap<String, Object>(1);
            messageObj.put("message", configWarns.get(j));
            messageObj.put("configuration", configuration.getName());
            warnings.add(messageObj);
        }
    }
    // Global warnings
    if (globalConfigWarnings.size() > 0) {
        for (int j = 0; j < globalConfigWarnings.size(); j++) {
            Map<String, Object> messageObj = new HashMap<String, Object>(1);
            messageObj.put("message", globalConfigWarnings.get(j));
            warnings.add(messageObj);
        }
    }
    return Response.status(Response.Status.CREATED).entity(warnings).build();
}
Also used : ReceiverBase(nl.nn.adapterframework.receivers.ReceiverBase) ConfigurationWarnings(nl.nn.adapterframework.configuration.ConfigurationWarnings) BaseConfigurationWarnings(nl.nn.adapterframework.configuration.BaseConfigurationWarnings) Configuration(nl.nn.adapterframework.configuration.Configuration) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ArrayList(java.util.ArrayList) Adapter(nl.nn.adapterframework.core.Adapter) IAdapter(nl.nn.adapterframework.core.IAdapter) ITransactionalStorage(nl.nn.adapterframework.core.ITransactionalStorage) IAdapter(nl.nn.adapterframework.core.IAdapter) BaseConfigurationWarnings(nl.nn.adapterframework.configuration.BaseConfigurationWarnings) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) PermitAll(javax.annotation.security.PermitAll)

Aggregations

ConfigurationWarnings (nl.nn.adapterframework.configuration.ConfigurationWarnings)58 ConfigurationException (nl.nn.adapterframework.configuration.ConfigurationException)16 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)5 ArrayList (java.util.ArrayList)4 ITransactionalStorage (nl.nn.adapterframework.core.ITransactionalStorage)3 PipeForward (nl.nn.adapterframework.core.PipeForward)3 ReceiverBase (nl.nn.adapterframework.receivers.ReceiverBase)3 URL (java.net.URL)2 BaseConfigurationWarnings (nl.nn.adapterframework.configuration.BaseConfigurationWarnings)2 Configuration (nl.nn.adapterframework.configuration.Configuration)2 HasPhysicalDestination (nl.nn.adapterframework.core.HasPhysicalDestination)2 ISender (nl.nn.adapterframework.core.ISender)2 EsbSoapWrapperPipe (nl.nn.adapterframework.extensions.esb.EsbSoapWrapperPipe)2 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Connection (java.sql.Connection)1 DatabaseMetaData (java.sql.DatabaseMetaData)1 SQLException (java.sql.SQLException)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1