Example usage for org.aspectj.bridge Constants AOP_OSGI_XML

List of usage examples for org.aspectj.bridge Constants AOP_OSGI_XML

Introduction

In this page you can find the example usage for org.aspectj.bridge Constants AOP_OSGI_XML.

Prototype

String AOP_OSGI_XML

To view the source code for org.aspectj.bridge Constants AOP_OSGI_XML.

Click Source Link

Usage

From source file:kieker.monitoring.probe.aspectj.AspectJLoader.java

License:Apache License

private static boolean checkConfigurationFileAvailable() {
    if (Boolean.getBoolean(KIEKER_MONITORING_SKIP_DEFAULT_AOP_CONFIGURATION)) {
        return true;
    }/*w w w . j av a 2  s  . c om*/

    LOG.info(
            "Using Kieker's AspectJLoader. This is not recommended for multi-classloader environments such as JavaEE and OSGI. Use the additional VM"
                    + " parameter '-D" + KIEKER_MONITORING_SKIP_DEFAULT_AOP_CONFIGURATION
                    + "=true'. to disable Kieker's AspectJLoader");

    if (null != System.getProperty("aj5.def")) {
        return true;
    }

    if (null != System.getProperty("org.aspectj.weaver.loadtime.configuration")) {
        return true;
    }

    final ClassLoader cl = ClassLoader.getSystemClassLoader();
    try {
        final Enumeration<URL> aopUserXMLs = cl.getResources(Constants.AOP_USER_XML);
        final Enumeration<URL> aopAJCXMLs = cl.getResources(Constants.AOP_AJC_XML);
        final Enumeration<URL> aopOSGIXMLs = cl.getResources(Constants.AOP_OSGI_XML);

        final boolean anyConfigFileAvailable = aopUserXMLs.hasMoreElements() || aopAJCXMLs.hasMoreElements()
                || aopOSGIXMLs.hasMoreElements();
        return anyConfigFileAvailable; // NOPMD
    } catch (final IOException ex) {
        return false;
    }
}

From source file:se.crisp.codekvast.agent.collector.CodekvastCollector.java

License:Open Source License

private static void defineAspectjLoadTimeWeaverConfig(CollectorConfig config) {
    try {/*from   ww  w  .  j  a  v a2s.com*/
        Class.forName("org.aspectj.bridge.Constants");

        System.setProperty(ASPECTJ_WEAVER_CONFIGURATION, createAopXml(config) + ";" + Constants.AOP_USER_XML
                + ";" + Constants.AOP_AJC_XML + ";" + Constants.AOP_OSGI_XML);

        CodekvastCollector.out.printf("%s=%s%n", ASPECTJ_WEAVER_CONFIGURATION,
                System.getProperty(ASPECTJ_WEAVER_CONFIGURATION));
    } catch (ClassNotFoundException e) {
        CodekvastCollector.out.printf("Not using AspectJ load-time weaving.%n");
    }
}