All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openas2.app.HealthCheck Maven / Gradle / Ivy

Go to download

Open source implementation of the AS2 standard for signed encrypted and compressed document transfer

There is a newer version: 2.10.1
Show newest version
package org.openas2.app;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openas2.ComponentNotFoundException;
import org.openas2.processor.ProcessorModule;
import org.openas2.processor.receiver.HealthCheckHandler;

public class HealthCheck {

    private Log logger = LogFactory.getLog(HealthCheckHandler.class.getSimpleName());

    /*
     * Runs a check of application status to try to determine if ther is any issue to be dealt with
     * @param module the module that invoked the health check
     * @return a string array of issues identified in executing the health check. the array will be empty if no errors are identified
     */
    public List runCheck(ProcessorModule module) {
	// Invoke each configured modules healthcheck method with any results returned in the failures array
	List failures = new ArrayList();
	try {
	    if (module == null) logger.warn("Module passed in to helathcheck is NULL so not module check was performed.");
	    else module.getSession().getProcessor().checkActiveModules(failures);
	} catch (ComponentNotFoundException e) {
	    failures.add("Error executing module check: " + e.getMessage());
	    e.printStackTrace();
	}
	// TODO : Add other (non-module) checks 

	return failures;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy