Examples of BundleActivator


Examples of org.osgi.framework.BundleActivator

            System.exit(-1);
        }
       
        // Register the Main class so that other bundles can inspect the command line args.
        final CountDownLatch shutdown = new CountDownLatch(1);
        BundleActivator activator = new BundleActivator() {
            private ServiceRegistration registration;
            public void start(BundleContext context)
            {
                registration = context.registerService(MainService.class.getName(), main, null);
            }
View Full Code Here

Examples of org.osgi.framework.BundleActivator

            InputStream is = url.openStream();
            try {
                Manifest mf = new Manifest(is);
                className = mf.getMainAttributes().getValue(KARAF_ACTIVATOR);
                if (className != null) {
                    BundleActivator activator = (BundleActivator) classLoader.loadClass(className).newInstance();
                    activator.start(framework.getBundleContext());
                    karafActivators.add(activator);
                }
            } catch (Throwable e) {
                if (className != null) {
                    System.err.println("Error starting karaf activator " + className + ": " + e.getMessage());
View Full Code Here

Examples of org.osgi.framework.BundleActivator

        m_configProps.setProperty(BundleCache.CACHE_ROOTDIR_PROP, servicemixBase.getPath() + "/data");
        m_configProps.setProperty(Constants.FRAMEWORK_STORAGE, "cache");

        // Register the Main class so that other bundles can inspect the command line args.
        BundleActivator activator = new BundleActivator() {
            private ServiceRegistration registration;

            public void start(BundleContext context) {
                registration = context.registerService(MainService.class.getName(), Main.this, null);
            }
View Full Code Here

Examples of org.osgi.framework.BundleActivator

    public void start() throws Exception {
        Set<String> jars = getJars(Felix.class);
        ClassLoader classLoader = new GuardClassLoader(toURLs(jars.toArray(new String[jars.size()])), null);

        BundleActivator activator = new BundleActivator() {
            private ServiceRegistration registration;

            public void start(BundleContext context) {
                registration = context.registerService(MainService.class.getName(), new MainService() {
                    public String[] getArgs() {
View Full Code Here

Examples of org.osgi.framework.BundleActivator

            Constructor felixConstructor = felixClass.getConstructor(Map.class, List.class);
            List<BundleActivator> activators = new ArrayList<BundleActivator>();

            Class<?> autoActivatorClass = cl.loadClass("org.apache.felix.main.AutoActivator");
            Constructor autoActivatorConstructor = autoActivatorClass.getConstructor(Map.class);
            BundleActivator autoActivator = (BundleActivator)autoActivatorConstructor.newInstance(props);           
            activators.add(autoActivator);

            felix = felixConstructor.newInstance(props, activators);
            ((Bundle)felix).start();
            bundleContext = ((Bundle)felix).getBundleContext();
           
           
        } catch (Exception e) {
           
            // This is the older Felix API which has been retained temporarily to avoid build break
            // TODO: Remove these once Felix 1.0.0 is released.
           
            Class<?> propertyResolverClass = cl.loadClass("org.apache.felix.framework.util.MutablePropertyResolver");
            Class<?> propertyResolverImplClass = cl.loadClass("org.apache.felix.framework.util.MutablePropertyResolverImpl");

            Constructor implConstructor = propertyResolverImplClass.getConstructor(Map.class);
            Object mutableProps = implConstructor.newInstance(props);
           
           
            try {
                Constructor felixConstructor = felixClass.getConstructor(propertyResolverClass, List.class);
                List<BundleActivator> activators = new ArrayList<BundleActivator>();
                felix = felixConstructor.newInstance(mutableProps, activators);
                ((Bundle)felix).start();
                bundleContext = ((Bundle)felix).getBundleContext();
            } catch (Exception e1) {
               
       
                felix = felixClass.newInstance();
                Method startMethod = felixClass.getMethod("start", propertyResolverClass, List.class);
                List<BundleActivator> activators = new ArrayList<BundleActivator>();
                BundleActivator activator = new FelixRuntime();
                activators.add(activator);
                startMethod.invoke(felix, mutableProps, activators);
       
                synchronized (activator) {
                    int retries = 0;
                    while (bundleContext == null && retries++ < 10) {
                        activator.wait(1000);
                    }
                }
            }
        }
       
View Full Code Here

Examples of org.osgi.framework.BundleActivator

            InputStream is = url.openStream();
            try {
                Manifest mf = new Manifest(is);
                className = mf.getMainAttributes().getValue(KARAF_ACTIVATOR);
                if (className != null) {
                    BundleActivator activator = (BundleActivator) classLoader.loadClass(className).newInstance();
                    activator.start(framework.getBundleContext());
                    karafActivators.add(activator);
                }
            } catch (Throwable e) {
                if (className != null) {
                    System.err.println("Error starting karaf activator " + className + ": " + e.getMessage());
View Full Code Here

Examples of org.osgi.framework.BundleActivator

               
       
                felix = felixClass.newInstance();
                Method startMethod = felixClass.getMethod("start", propertyResolverClass, List.class);
                List<BundleActivator> activators = new ArrayList<BundleActivator>();
                BundleActivator activator = new FelixRuntime();
                activators.add(activator);
                startMethod.invoke(felix, mutableProps, activators);
       
                synchronized (activator) {
                    int retries = 0;
                    while (bundleContext == null && retries++ < 10) {
                        activator.wait(1000);
                    }
                }
            }
        }
       
View Full Code Here

Examples of org.osgi.framework.BundleActivator

            System.exit(-1);
        }
       
        // Register the Main class so that other bundles can inspect the command line args.
        final CountDownLatch shutdown = new CountDownLatch(1);
        BundleActivator activator = new BundleActivator() {
            private ServiceRegistration registration;
            public void start(BundleContext context)
            {
                registration = context.registerService(MainService.class.getName(), main, null);
            }
View Full Code Here

Examples of org.osgi.framework.BundleActivator

            {
                String fragmentActivator = frag.getSymbolicName() + ".FragmentActivator";
                Class<?> c = Class.forName(fragmentActivator);
                if (c != null)
                {
                    BundleActivator bActivator = (BundleActivator) c.newInstance();
                    bActivator.start(_context);
                    _activatedFragments.add(bActivator);
                }
            }
            catch (NullPointerException e)
            {
View Full Code Here

Examples of org.osgi.framework.BundleActivator

        if (activatorClass != null)
        {
            try
            {
// TODO: SECURITY - Should this consider security?
                BundleActivator activator = (BundleActivator)
                    felix.getClass().getClassLoader().loadClass(
                        activatorClass.trim()).newInstance();

// TODO: EXTENSIONMANAGER - This is kind of hacky, can we improve it?
                felix.m_activatorList.add(activator);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.