本文整理汇总了Java中org.apache.felix.dm.Component.add方法的典型用法代码示例。如果您正苦于以下问题:Java Component.add方法的具体用法?Java Component.add怎么用?Java Component.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.felix.dm.Component
的用法示例。
在下文中一共展示了Component.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureInstance
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function that is called when configuration of the dependencies is
* required.
*
* @param c
* dependency manager Component object, used for configuring the
* dependencies exported and imported
* @param imp
* Implementation class that is being configured, needed as long
* as the same routine can configure multiple implementations
* @param containerName
* The containerName being configured, this allow also optional
* per-container different behavior if needed, usually should not
* be the case though.
*/
@Override
public void configureInstance(Component c, Object imp, String containerName) {
if (imp.equals(NetworkHandler.class)) {
c.setInterface(INeutronNetworkAware.class.getName(), null);
}
if (imp.equals(SubnetHandler.class)) {
c.setInterface(INeutronSubnetAware.class.getName(), null);
}
if (imp.equals(PortHandler.class)) {
c.setInterface(INeutronPortAware.class.getName(), null);
}
// Create service dependencies.
c.add(createServiceDependency().setService(BindingAwareBroker.class).setCallbacks("setBindingAwareBroker", "unsetBindingAwareBroker")
.setRequired(true));
}
示例2: configureGlobalInstance
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function that is called when configuration of the dependencies is required.
*
* @param c
* dependency manager Component object, used for configuring the
* dependencies exported and imported
* @param imp
* Implementation class that is being configured, needed as long
* as the same routine can configure multiple implementations
*/
public void configureGlobalInstance(Component c, Object imp) {
if (imp.equals(ConnectionService.class)) {
c.setInterface(
new String[] { IConnectionService.class.getName(),
IPluginOutConnectionService.class.getName() },
null);
c.add(createServiceDependency()
.setService(IPluginInConnectionService.class)
.setCallbacks("setPluginService", "unsetPluginService")
.setRequired(false));
c.add(createServiceDependency()
.setService(IConnectionListener.class)
.setCallbacks("setListener", "unsetListener")
.setRequired(false));
}
}
示例3: configureGlobalInstance
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function that is called when configuration of the dependencies is required.
*
* @param c
* dependency manager Component object, used for configuring the
* dependencies exported and imported
* @param imp
* Implementation class that is being configured, needed as long
* as the same routine can configure multiple implementations
*/
public void configureGlobalInstance(Component c, Object imp) {
if (imp.equals(Inventory.class)) {
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put("scope", "Global");
// export the service
c.setInterface(
new String[] { IPluginOutInventoryService.class.getName(),
IInventoryService.class.getName() }, props);
// Now lets add a service dependency to make sure the
// provider of service exists
c.add(createServiceDependency()
.setService(IListenInventoryUpdates.class, "(scope=Global)")
.setCallbacks("setUpdateService", "unsetUpdateService")
.setRequired(false));
c.add(createServiceDependency()
.setService(IPluginInInventoryService.class, "(scope=Global)")
.setCallbacks("setPluginService", "unsetPluginService")
.setRequired(true));
}
}
示例4: configureGlobalInstance
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Configure the dependency for a given instance Global
*
* @param c Component assigned for this instance, this will be
* what will be used for configuration
* @param imp implementation to be configured
* @param containerName container on which the configuration happens
*/
protected void configureGlobalInstance(Component c, Object imp) {
if (imp.equals(ConfigurationImpl.class)) {
Dictionary<String, Set<String>> props = new Hashtable<String, Set<String>>();
Set<String> propSet = new HashSet<String>();
propSet.add("config.event.save");
props.put("cachenames", propSet);
// export the service
c.setInterface(
new String[] { IConfigurationService.class.getName(),
ICacheUpdateAware.class.getName()},
props);
c.add(createServiceDependency().setService(
IClusterGlobalServices.class).setCallbacks(
"setClusterServices", "unsetClusterServices").setRequired(
true));
c.add(createServiceDependency().setService(
IConfigurationAware.class).setCallbacks(
"addConfigurationAware", "removeConfigurationAware")
.setRequired(false));
}
}
示例5: configureInstance
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function that is called when configuration of the dependencies is
* required.
*
* @param c
* dependency manager Component object, used for configuring the
* dependencies exported and imported
* @param imp
* Implementation class that is being configured, needed as long
* as the same routine can configure multiple implementations
* @param containerName
* The containerName being configured, this allow also optional
* per-container different behavior if needed, usually should not
* be the case though.
*/
public void configureInstance(Component c, Object imp, String containerName) {
if (imp.equals(StatisticsManager.class)) {
// export the service
c.setInterface(new String[] {
IStatisticsManager.class.getName(),
IReadServiceListener.class.getName(),
IListenInventoryUpdates.class.getName() }, null);
c.add(createContainerServiceDependency(containerName).setService(IReadService.class)
.setCallbacks("setReaderService", "unsetReaderService").setRequired(true));
c.add(createContainerServiceDependency(containerName).setService(IClusterContainerServices.class)
.setCallbacks("setClusterContainerService", "unsetClusterContainerService").setRequired(true));
c.add(createContainerServiceDependency(containerName).setService(IContainer.class)
.setCallbacks("setIContainer", "unsetIContainer").setRequired(true));
}
}
示例6: init
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
@Override
public void init(BundleContext bundleContext, DependencyManager dependencyManager) throws Exception {
Tactic tactic = new SimpleTactic();
Component component = createComponent()
.setInterface(Tactic.class.getName(), null)
.setImplementation(tactic)
.setCallbacks("init", "startTactic", "stopTactic", "destroy");
for(ServiceDependency dep : tactic.getComponents(dependencyManager)) {
component.add(dep);
}
component.add(
createServiceDependency()
.setService(ArchitectureEventController.class)
.setRequired(true)
);
component.add(
createServiceDependency()
.setService(Subscriber.class)
.setRequired(true)
);
component.add(
createServiceDependency()
.setService(Discoverer.class)
.setRequired(true)
);
component.add(
createServiceDependency()
.setService(DroneInit.class)
.setRequired(true)
);
dependencyManager.add(component);
}
示例7: configureInstance
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
public void configureInstance(Component c, Object imp, String containerName) {
log.trace("Configuring instance");
if (imp.equals(DissectorHandler.class)) {
// Define exported and used services for DissectorHandler component.
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put("salListenerName", "myDissectorHandler");
// Export IListenDataPacket interface to receive packet-in events.
c.setInterface(new String[] {IListenDataPacket.class.getName()}, props);
// Need the DataPacketService for encoding, decoding, sending data packets
c.add(createContainerServiceDependency(containerName).setService(
IDataPacketService.class).setCallbacks(
"setDataPacketService", "unsetDataPacketService")
.setRequired(true));
// Need FlowProgrammerService for programming flows
c.add(createContainerServiceDependency(containerName).setService(
IFlowProgrammerService.class).setCallbacks(
"setFlowProgrammerService", "unsetFlowProgrammerService")
.setRequired(true));
// Need SwitchManager service for enumerating ports of switch
c.add(createContainerServiceDependency(containerName).setService(
ISwitchManager.class).setCallbacks(
"setSwitchManagerService", "unsetSwitchManagerService")
.setRequired(true));
}
}
示例8: configureInstance
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
public void configureInstance(Component c, Object imp, String containerName) {
if (imp.equals(PacketHandler.class)) {
log.trace("Configuring packet handler");
// Export IListenDataPacket interface to receive packet-in events.
Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put("salListenerName", "sdnmq");
c.setInterface(new String[] {IListenDataPacket.class.getName()}, props);
// Need the DataPacketService for decoding data packets
c.add(createContainerServiceDependency(containerName).setService(
IDataPacketService.class).setCallbacks(
"setDataPacketService", "unsetDataPacketService").setRequired(true));
} else if (imp.equals(PacketForwarder.class)) {
log.trace("Configuring packet forwarder");
// Need the DataPacketService for encoding and sending packets
c.add(createContainerServiceDependency(containerName).setService(
IDataPacketService.class).setCallbacks(
"setDataPacketService", "unsetDataPacketService").setRequired(true));
// Need SwitchManager service for finding nodes and node connectors
c.add(createContainerServiceDependency(containerName).setService(
ISwitchManager.class).setCallbacks(
"setSwitchManagerService", "unsetSwitchManagerService").setRequired(true));
} else if (imp.equals(FlowProgrammer.class)) {
log.trace("Configuring flow programmer");
// Need SwitchManager service for finding nodes and node connectors
c.add(createContainerServiceDependency(containerName).setService(
ISwitchManager.class).setCallbacks(
"setSwitchManagerService", "unsetSwitchManagerService").setRequired(true));
// Need FlowProgrammerService for programming flows
c.add(createContainerServiceDependency(containerName).setService(
IFlowProgrammerService.class).setCallbacks(
"setFlowProgrammerService", "unsetFlowProgrammerService").setRequired(true));
}
}
示例9: init
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
@Override
public void init(BundleContext context, DependencyManager manager) throws Exception {
// get the Hobson plugin class from the OSGi bundle manifest
String pluginClass = getHobsonPluginClass(context.getBundle().getHeaders().get("Provide-Capability"));
if (pluginClass != null) {
final String pluginId = context.getBundle().getSymbolicName();
logger.debug("Loading plugin: {}", pluginId);
// register plugin as a service with all necessary dependencies
Component c = manager.createComponent();
Properties props = new Properties();
props.setProperty("pluginId", pluginId);
props.setProperty("version", context.getBundle().getVersion().toString());
c.setInterface(HobsonPlugin.class.getName(), props);
c.setFactory(new HobsonPluginFactory(context, pluginClass, pluginId), "create");
c.add(createServiceDependency().setService(AccessManager.class).setRequired(true));
c.add(createServiceDependency().setService(DeviceManager.class).setRequired(true));
c.add(createServiceDependency().setService(DiscoManager.class).setRequired(true));
c.add(createServiceDependency().setService(EventManager.class).setRequired(true));
c.add(createServiceDependency().setService(HubManager.class).setRequired(true));
c.add(createServiceDependency().setService(ActionManager.class).setRequired(true));
c.add(createServiceDependency().setService(PluginManager.class).setRequired(true));
c.add(createServiceDependency().setService(TaskManager.class).setRequired(true));
c.add(createServiceDependency().setService(DataStreamManager.class).setRequired(false));
manager.add(c);
} else {
logger.error("No hobson.plugin provided capability found for plugin {}", context.getBundle().getSymbolicName());
}
}
示例10: declareDependencies
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
@Override
public void declareDependencies(Component component, DependencyManager dependencyManager) {
LOGGER.info("declare dependencies...");
component.add(dependencyManager.createServiceDependency()
.setService(Object.class, "(key=bla)")
.setRequired(true));
}
示例11: configureInstance
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function that is called when configuration of the dependencies
* is required.
*
* @param c dependency manager Component object, used for
* configuring the dependencies exported and imported
* @param imp Implementation class that is being configured,
* needed as long as the same routine can configure multiple
* implementations
* @param containerName The containerName being configured, this allow
* also optional per-container different behavior if needed, usually
* should not be the case though.
*/
public void configureInstance(Component c, Object imp, String containerName) {
if (imp.equals(StaticRoutingImplementation.class)) {
Dictionary<String, Set<String>> props = new Hashtable<String, Set<String>>();
Set<String> propSet = new HashSet<String>();
propSet.add("forwarding.staticrouting.configSaveEvent");
props.put("cachenames", propSet);
// export the service
c.setInterface(new String[] { ICacheUpdateAware.class.getName(),
IForwardingStaticRouting.class.getName(),
IfNewHostNotify.class.getName(),
IConfigurationContainerAware.class.getName() }, props);
c.add(createContainerServiceDependency(containerName).setService(
IClusterContainerServices.class).setCallbacks(
"setClusterContainerService",
"unsetClusterContainerService").setRequired(true));
c.add(createContainerServiceDependency(containerName).setService(
IfIptoHost.class).setCallbacks("setHostTracker",
"unsetHostTracker").setRequired(true));
// Static routing aware there could be many
c.add(createContainerServiceDependency(containerName).setService(
IStaticRoutingAware.class).setCallbacks(
"setStaticRoutingAware", "unsetStaticRoutingAware")
.setRequired(false));
}
}
示例12: configureGlobalInstance
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Configure the dependency for a given instance Global
*
* @param c Component assigned for this instance, this will be
* what will be used for configuration
* @param imp implementation to be configured
* @param containerName container on which the configuration happens
*/
protected void configureGlobalInstance(Component c, Object imp) {
if (imp.equals(ContainerManager.class)) {
// export the service
c.setInterface(new String[] { IContainerManager.class.getName() },
null);
c.add(createServiceDependency().setService(
IClusterGlobalServices.class).setCallbacks(
"setClusterServices", "unsetClusterServices").setRequired(
true));
// Key kick-starter for container creation in each component
c.add(createServiceDependency().setService(IContainerAware.class)
.setCallbacks("setIContainerAware", "unsetIContainerAware")
.setRequired(false));
// Optional interface expected to be exported by the
// protocol plugins to setup proper filtering based on
// slicing events
c.add(createServiceDependency()
.setService(IContainerListener.class).setCallbacks(
"setIContainerListener", "unsetIContainerListener")
.setRequired(false));
}
}
示例13: configureInstance
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function that is called when configuration of the dependencies
* is required.
*
* @param c dependency manager Component object, used for
* configuring the dependencies exported and imported
* @param imp Implementation class that is being configured,
* needed as long as the same routine can configure multiple
* implementations
* @param containerName The containerName being configured, this allow
* also optional per-container different behavior if needed, usually
* should not be the case though.
*/
public void configureInstance(Component c, Object imp, String containerName) {
if (imp.equals(DijkstraImplementation.class)) {
// export the service
Dictionary<String, String> props = new Hashtable<String, String>();
props.put("topoListenerName", "routing.Dijkstra");
c.setInterface(new String[] { ITopologyManagerAware.class.getName(),
IRouting.class.getName() }, props);
// Now lets add a service dependency to make sure the
// provider of service exists
c.add(createContainerServiceDependency(containerName).setService(
IListenRoutingUpdates.class).setCallbacks(
"setListenRoutingUpdates", "unsetListenRoutingUpdates")
.setRequired(false));
c.add(createContainerServiceDependency(containerName).setService(
ISwitchManager.class).setCallbacks("setSwitchManager",
"unsetSwitchManager").setRequired(true));
c.add(createContainerServiceDependency(containerName).setService(
ITopologyManager.class).setCallbacks("setTopologyManager",
"unsetTopologyManager").setRequired(true));
c.add(createContainerServiceDependency(containerName).setService(
IReadService.class).setCallbacks("setReadService",
"unsetReadService").setRequired(true));
}
}
示例14: configureInstance
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function that is called when configuration of the dependencies
* is required.
*
* @param c dependency manager Component object, used for
* configuring the dependencies exported and imported
* @param imp Implementation class that is being configured,
* needed as long as the same routine can configure multiple
* implementations
* @param containerName The containerName being configured, this allow
* also optional per-container different behavior if needed, usually
* should not be the case though.
*/
@Override
public void configureInstance(Component c, Object imp, String containerName) {
if (imp.equals(ClusterContainerManager.class)) {
c.setInterface(new String[] { IClusterContainerServices.class.getName() },
null);
c.add(createServiceDependency()
.setService(IClusterServices.class)
.setCallbacks("setClusterService", "unsetClusterService")
.setRequired(true));
// CacheUpdate services will be none or many so the
// dependency is optional
c.add(createContainerServiceDependency(containerName)
.setService(ICacheUpdateAware.class)
.setCallbacks("setCacheUpdateAware", "unsetCacheUpdateAware")
.setRequired(false));
// Coordinator change event can be one or many so
// dependency is optional
c.add(createContainerServiceDependency(containerName)
.setService(ICoordinatorChangeAware.class)
.setCallbacks("setCoordinatorChangeAware", "unsetCoordinatorChangeAware")
.setRequired(false));
}
}
示例15: configureGlobalInstance
import org.apache.felix.dm.Component; //导入方法依赖的package包/类
/**
* Function that is called when configuration of the dependencies
* is required.
*
* @param c dependency manager Component object, used for
* configuring the dependencies exported and imported
* @param imp Implementation class that is being configured,
* needed as long as the same routine can configure multiple
* implementations
*/
@Override
public void configureGlobalInstance(Component c, Object imp) {
if (imp.equals(ClusterManager.class)) {
// export the service for Apps and Plugins
c.setInterface(new String[] { IClusterServices.class.getName(), IContainerAware.class.getName() }, null);
}
if (imp.equals(ClusterGlobalManager.class)) {
c.setInterface(new String[] { IClusterGlobalServices.class.getName() }, null);
c.add(createServiceDependency()
.setService(IClusterServices.class)
.setCallbacks("setClusterService", "unsetClusterService")
.setRequired(true));
// CacheUpdate services will be none or many so the
// dependency is optional
c.add(createServiceDependency()
.setService(ICacheUpdateAware.class)
.setCallbacks("setCacheUpdateAware", "unsetCacheUpdateAware")
.setRequired(false));
// Coordinator change event can be one or many so
// dependency is optional
c.add(createServiceDependency()
.setService(ICoordinatorChangeAware.class)
.setCallbacks("setCoordinatorChangeAware", "unsetCoordinatorChangeAware")
.setRequired(false));
}
}