Search in sources :

Example 1 with MembraneCommandLine

use of com.predic8.membrane.core.MembraneCommandLine in project service-proxy by membrane.

the class CoreActivator method start.

@Override
public void start(BundleContext context) throws Exception {
    super.start(context);
    if (new File("configuration/log4j.properties").exists())
        PropertyConfigurator.configure("configuration/log4j.properties");
    Platform.addLogListener(logListener);
    final MembraneCommandLine cl = new MembraneCommandLine();
    cl.parse(fixArguments(Platform.getCommandLineArgs()));
    if (cl.hasConfiguration()) {
        log.info("loading monitor beans from command line argument: " + getConfigurationFileName(cl));
        router = Router.init(getConfigurationFileName(cl), this.getClass().getClassLoader());
    } else {
        try {
            if (ClassloaderUtil.fileExists(getConfigurationFileName())) {
                log.info("Eclipse framework found config file: " + getConfigurationFileName());
                readBeanConfigWhenStartedAsProduct();
            } else {
                readBeanConfigWhenStartedInEclipse();
            }
        } catch (Exception e1) {
            log.error("Unable to read bean configuration file: " + e1.getMessage());
            log.error("Unable to read bean configuration file: " + e1.getStackTrace());
            e1.printStackTrace();
        }
    }
    sr = context.registerService(router.getClass().getName(), router, null);
}
Also used : MembraneCommandLine(com.predic8.membrane.core.MembraneCommandLine) File(java.io.File) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException)

Aggregations

MembraneCommandLine (com.predic8.membrane.core.MembraneCommandLine)1 File (java.io.File)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1