Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 942293 Details for
Bug 1147491
Unable to start both IPActivator and EPNActivator inside one OSGI bundle (on Fuse)
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
BundleListActivator - can start and stop more activators
BundleListActivator.java (text/plain), 2.25 KB, created by
Martin Swiech
on 2014-09-29 11:59:31 UTC
(
hide
)
Description:
BundleListActivator - can start and stop more activators
Filename:
MIME Type:
Creator:
Martin Swiech
Created:
2014-09-29 11:59:31 UTC
Size:
2.25 KB
patch
obsolete
>package org.jboss.soa.qa.rtgct.osgi; > >import org.osgi.framework.Bundle; >import org.osgi.framework.BundleActivator; >import org.osgi.framework.BundleContext; >import org.osgi.framework.BundleException; >import org.osgi.framework.wiring.BundleWiring; > >import java.util.ArrayList; >import java.util.Dictionary; >import java.util.List; > >/** > * BundleActivator which contains more BundleActivators defined in OSGI property "Bundle-Activator-List". > */ >public class BundleListActivator implements BundleActivator { > > /** > * Name of OSGI property where bundle activators can be found. > */ > public static final String ACTIVATOR_LIST_HEADER = "Bundle-Activator-List"; > > private BundleActivator[] activators; > > @Override > public void start(BundleContext context) throws Exception { > activators = getBundleActivators(context); > for (int i = 0; i < activators.length; i++) { > activators[i].start(context); > } > } > > @Override > public void stop(BundleContext context) throws Exception { > if (activators != null) { > for (int i = activators.length - 1; i >= 0; i--) { > activators[i].stop(context); > } > } > activators = null; > } > > private BundleActivator[] getBundleActivators(final BundleContext context) throws Exception { > final Dictionary<String, String> headers = context.getBundle().getHeaders(); > final String listStr = headers.get(ACTIVATOR_LIST_HEADER); > final List<BundleActivator> activatorsList = new ArrayList<BundleActivator>(); > > if (listStr != null && !listStr.trim().isEmpty()) { > final String[] listStrArr = listStr.trim().split("\\s*[;,]\\s*"); > for (final String className : listStrArr) { > if (className != null && !className.isEmpty()) { > final BundleActivator ba = createBundleActivator(className, context.getBundle()); > activatorsList.add(ba); > } > } > } > return activatorsList.toArray(new BundleActivator[activatorsList.size()]); > } > > private BundleActivator createBundleActivator(final String className, final Bundle bundle) throws Exception { > final ClassLoader bundleCl = bundle.adapt(BundleWiring.class).getClassLoader(); > final Class clazz; > try { > clazz = Class.forName(className, false, bundleCl); > } catch (ClassNotFoundException ex) { > throw new BundleException("Not found: " + className, ex); > } > return (BundleActivator) clazz.newInstance(); > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1147491
: 942293