org.osgi.service.component.ComponentInstance Java Examples
The following examples show how to use
org.osgi.service.component.ComponentInstance.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FactoryComponent.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * */ ComponentInstance newInstance(Dictionary<String,Object> instanceProps) { if (!isSatisfied()) { throw new ComponentException("Factory is not satisfied"); } String ccId = cmConfig.isEmpty() ? NO_CCID : cmConfig.getCCIds()[0]; final ComponentConfiguration cc = newComponentConfiguration(ccId, instanceProps); scr.postponeCheckin(); ComponentContextImpl cci; try { cci = cc.activate(null, true); } finally { scr.postponeCheckout(); } if (isSatisfied()) { cc.registerComponentService(null); return cci.getComponentInstance(); } else { // Make sure it is disposed, perhaps we should "lock" protect this code instead cc.dispose(KF_DEACTIVATION_REASON_COMPONENT_DEACTIVATING, true); throw new ComponentException("Factory is/has been deactivated"); } }
Example #2
Source File: Component.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see org.apache.felix.scr.Component.getComponentInstance */ public ComponentInstance getComponentInstance() { final ComponentConfiguration cc = getFirstComponentConfiguration(); if (cc != null) { // TODO: what about factories final ComponentContext ctxt = cc.getActiveContext(null, null); if (ctxt != null) { return ctxt.getComponentInstance(); } } return null; }
Example #3
Source File: ComponentFactoryImpl.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * */ public ComponentInstance newInstance(@SuppressWarnings("rawtypes") Dictionary instanceProps) { final FactoryComponent fc = factoryComponent; if (fc != null) { @SuppressWarnings("unchecked") final Dictionary<String, Object> ip = instanceProps; return fc.newInstance(ip); } throw new ComponentException("Component factory has been disposed"); }
Example #4
Source File: PrototypeComponentConfiguration.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override synchronized ComponentContextImpl getContext(Bundle b, Object instance) { if (instance != null) { for (ComponentContextImpl cci : ccis) { ComponentInstance ci = cci.getComponentInstance(); if (ci != null && ci.getInstance() == instance) { return cci; } } } return null; }
Example #5
Source File: TestComponentContext.java From carbon-device-mgt with Apache License 2.0 | 4 votes |
@Override public ComponentInstance getComponentInstance() { return null; }
Example #6
Source File: ComponentContextImpl.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * */ public ComponentInstance getComponentInstance() { return componentInstance; }
Example #7
Source File: TestProtocol.java From karaf-decanter with Apache License 2.0 | 4 votes |
@Override public ComponentInstance getComponentInstance() { return null; }
Example #8
Source File: LogAppenderTest.java From karaf-decanter with Apache License 2.0 | 4 votes |
@Override public ComponentInstance getComponentInstance() { return null; }
Example #9
Source File: JmsCollectorTest.java From karaf-decanter with Apache License 2.0 | 4 votes |
@Override public ComponentInstance getComponentInstance() { return null; }
Example #10
Source File: SocketCollectorTest.java From karaf-decanter with Apache License 2.0 | 4 votes |
@Override public ComponentInstance getComponentInstance() { throw new NoSuchMethodError("Unimplemented method"); }
Example #11
Source File: MqttCollectorTest.java From karaf-decanter with Apache License 2.0 | 4 votes |
@Override public ComponentInstance getComponentInstance() { throw new NoSuchMethodError("Unimplemented method"); }
Example #12
Source File: SystemCollectorTest.java From karaf-decanter with Apache License 2.0 | 4 votes |
@Override public ComponentInstance getComponentInstance() { throw new NoSuchMethodError("Unimplemented method"); }
Example #13
Source File: ComponentContextAdapter.java From onos with Apache License 2.0 | 4 votes |
@Override public ComponentInstance getComponentInstance() { return null; }
Example #14
Source File: Component.java From knopflerfish.org with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * Returns the <code>org.osgi.service.component.ComponentInstance</code> * representing this component or <code>null</code> if this component * is not been activated yet. * * @since 1.2 */ ComponentInstance getComponentInstance();