org.osgi.framework.ServiceListener#org.osgi.service.component.ComponentInstance源码实例Demo

下面列出了org.osgi.framework.ServiceListener#org.osgi.service.component.ComponentInstance 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: knopflerfish.org   文件: FactoryComponent.java
/**
 *
 */
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");
  }
}
 
源代码2 项目: knopflerfish.org   文件: Component.java
/**
 * @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;
}
 
源代码3 项目: knopflerfish.org   文件: ComponentFactoryImpl.java
/**
 *
 */
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");
}
 
@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;
}
 
源代码5 项目: carbon-device-mgt   文件: TestComponentContext.java
@Override
public ComponentInstance getComponentInstance() {
    return null;
}
 
源代码6 项目: knopflerfish.org   文件: ComponentContextImpl.java
/**
 *
 */
public ComponentInstance getComponentInstance() {
  return componentInstance;
}
 
源代码7 项目: karaf-decanter   文件: TestProtocol.java
@Override
public ComponentInstance getComponentInstance() {
    return null;
}
 
源代码8 项目: karaf-decanter   文件: LogAppenderTest.java
@Override
public ComponentInstance getComponentInstance() {
    return null;
}
 
源代码9 项目: karaf-decanter   文件: JmsCollectorTest.java
@Override
public ComponentInstance getComponentInstance() {
    return null;
}
 
源代码10 项目: karaf-decanter   文件: SocketCollectorTest.java
@Override
public ComponentInstance getComponentInstance() {
    throw new NoSuchMethodError("Unimplemented method");
}
 
源代码11 项目: karaf-decanter   文件: MqttCollectorTest.java
@Override
public ComponentInstance getComponentInstance() {
    throw new NoSuchMethodError("Unimplemented method");
}
 
源代码12 项目: karaf-decanter   文件: SystemCollectorTest.java
@Override
public ComponentInstance getComponentInstance() {
    throw new NoSuchMethodError("Unimplemented method");
}
 
源代码13 项目: onos   文件: ComponentContextAdapter.java
@Override
public ComponentInstance getComponentInstance() {
    return null;
}
 
源代码14 项目: knopflerfish.org   文件: Component.java
/**
 * 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();