本文整理汇总了Java中org.apache.felix.dm.ServiceDependency类的典型用法代码示例。如果您正苦于以下问题:Java ServiceDependency类的具体用法?Java ServiceDependency怎么用?Java ServiceDependency使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServiceDependency类属于org.apache.felix.dm包,在下文中一共展示了ServiceDependency类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getComponents
import org.apache.felix.dm.ServiceDependency; //导入依赖的package包/类
/**
* -- IMPLEMENT FUNCTIONS
*/
public List<ServiceDependency> getComponents(DependencyManager dm){
List<ServiceDependency> components = new ArrayList<ServiceDependency>() ;
components.add(dm.createServiceDependency()
.setService(Radar.class)
.setRequired(true)
);
components.add(dm.createServiceDependency()
.setService(GPS.class)
.setRequired(true)
);
components.add(dm.createServiceDependency()
.setService(Engine.class)
.setRequired(true)
);
components.add(dm.createServiceDependency()
.setService(Gun.class)
.setRequired(true)
);
return components;
}
示例2: handleDependencies
import org.apache.felix.dm.ServiceDependency; //导入依赖的package包/类
private void handleDependencies(Component component, Object service){
Dependency annotation = service.getClass().getAnnotation(Dependency.class);
if (annotation != null){
ServiceDependency serviceDependency = manager.createServiceDependency();
String filter = annotation.filter();
if (StringUtils.isNotEmpty(filter)){
serviceDependency.setService(annotation.serviceName(), filter);
} else {
serviceDependency.setService(annotation.serviceName());
}
serviceDependency.setRequired(annotation.mandatory());
String added = StringUtils.isNotEmpty(annotation.addedCallbackMethod()) ? annotation.addedCallbackMethod() : null ;
String changed = StringUtils.isNotEmpty(annotation.changedCallbackMethod()) ? annotation.changedCallbackMethod() : null ;
String removed = StringUtils.isNotEmpty(annotation.removedCallbackMethod()) ? annotation.removedCallbackMethod() : null ;
serviceDependency.setCallbacks(service, added, changed, removed);
component.add(serviceDependency);
}
}
示例3: init
import org.apache.felix.dm.ServiceDependency; //导入依赖的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);
}
示例4: setService
import org.apache.felix.dm.ServiceDependency; //导入依赖的package包/类
@SuppressWarnings("rawtypes") // can't change org.apache.felix.dm.ServiceDependency
@Override
public ServiceDependency setService(Class serviceName) {
this.m_dep.setService(serviceName, "(containerName="
+ this.containerName + ")");
return this;
}
示例5: ContainerServiceDependency
import org.apache.felix.dm.ServiceDependency; //导入依赖的package包/类
private ContainerServiceDependency(ServiceDependency explicitDependency,
String containerName) {
this.m_dep = explicitDependency;
this.containerName = containerName;
}
示例6: setDefaultImplementation
import org.apache.felix.dm.ServiceDependency; //导入依赖的package包/类
@Override
public ServiceDependency setDefaultImplementation(Object implementation) {
this.m_dep.setDefaultImplementation(implementation);
return this;
}
示例7: setRequired
import org.apache.felix.dm.ServiceDependency; //导入依赖的package包/类
@Override
public ServiceDependency setRequired(boolean required) {
this.m_dep.setRequired(required);
return this;
}
示例8: setAutoConfig
import org.apache.felix.dm.ServiceDependency; //导入依赖的package包/类
@Override
public ServiceDependency setAutoConfig(boolean autoConfig) {
this.m_dep.setAutoConfig(autoConfig);
return this;
}
示例9: setCallbacks
import org.apache.felix.dm.ServiceDependency; //导入依赖的package包/类
@Override
public ServiceDependency setCallbacks(String added, String removed) {
this.m_dep.setCallbacks(added, removed);
return this;
}
示例10: setPropagate
import org.apache.felix.dm.ServiceDependency; //导入依赖的package包/类
@Override
public ServiceDependency setPropagate(boolean propagate) {
this.m_dep.setPropagate(propagate);
return this;
}
示例11: setInstanceBound
import org.apache.felix.dm.ServiceDependency; //导入依赖的package包/类
@Override
public ServiceDependency setInstanceBound(boolean isInstanceBound) {
this.m_dep.setInstanceBound(isInstanceBound);
return this;
}
示例12: createCopy
import org.apache.felix.dm.ServiceDependency; //导入依赖的package包/类
@Override
public Dependency createCopy() {
return new ContainerServiceDependency((ServiceDependency) this.m_dep
.createCopy(), this.containerName);
}
示例13: createContainerServiceDependency
import org.apache.felix.dm.ServiceDependency; //导入依赖的package包/类
/**
* Return a ServiceDependency customized ad hoc for slicing, this
* essentially the same org.apache.felix.dm.ServiceDependency just
* with some filters pre-set
*
* @param containerName containerName for which we want to create the dependency
*
* @return a ServiceDependency
*/
protected ServiceDependency createContainerServiceDependency(
String containerName) {
return (new ContainerServiceDependency(this.dm, containerName));
}
示例14: createServiceDependency
import org.apache.felix.dm.ServiceDependency; //导入依赖的package包/类
/**
* Return a ServiceDependency as provided by Dependency Manager as it's
*
*
* @return a ServiceDependency
*/
protected ServiceDependency createServiceDependency() {
return this.dm.createServiceDependency();
}
示例15: getComponents
import org.apache.felix.dm.ServiceDependency; //导入依赖的package包/类
public abstract Iterable<? extends ServiceDependency> getComponents(DependencyManager dependencyManager);