本文整理汇总了Java中org.osgi.service.blueprint.reflect.ReferenceMetadata类的典型用法代码示例。如果您正苦于以下问题:Java ReferenceMetadata类的具体用法?Java ReferenceMetadata怎么用?Java ReferenceMetadata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReferenceMetadata类属于org.osgi.service.blueprint.reflect包,在下文中一共展示了ReferenceMetadata类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: buildBeanDefinition
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
private AbstractBeanDefinition buildBeanDefinition(ComponentMetadata metadata) {
if (metadata instanceof BeanMetadata) {
return buildLocalComponent((BeanMetadata) metadata);
}
if (metadata instanceof ServiceMetadata) {
return buildExporter((ServiceMetadata) metadata);
}
if (metadata instanceof ServiceReferenceMetadata) {
if (metadata instanceof ReferenceListMetadata) {
return buildReferenceCollection((ReferenceListMetadata) metadata);
}
if (metadata instanceof ReferenceMetadata) {
return buildReferenceProxy((ReferenceMetadata) metadata);
}
}
// unknown rich metadata type, unable to perform conversion
throw new IllegalArgumentException("Unknown metadata type" + metadata.getClass());
}
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:23,代码来源:BeanDefinitionFactory.java
示例2: testDefaultsOnNestedBeans
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
public void testDefaultsOnNestedBeans() throws Exception {
ComponentMetadata metadata = blueprintContainer.getComponentMetadata("nested");
assertEquals(ComponentMetadata.ACTIVATION_LAZY, metadata.getActivation());
assertNull("null scope expected", ((BeanMetadata)metadata).getScope());
BeanMetadata meta = (BeanMetadata) metadata;
List<BeanProperty> props = meta.getProperties();
assertEquals(2, props.size());
BeanProperty propA = props.get(0);
ReferenceMetadata nestedRef = (ReferenceMetadata) propA.getValue();
assertEquals(ReferenceMetadata.AVAILABILITY_MANDATORY, nestedRef.getAvailability());
assertEquals(300, nestedRef.getTimeout());
BeanProperty propB = props.get(1);
ReferenceListMetadata nestedList = (ReferenceListMetadata) propB.getValue();
assertEquals(ReferenceMetadata.AVAILABILITY_OPTIONAL, nestedList.getAvailability());
assertEquals(ReferenceListMetadata.USE_SERVICE_REFERENCE, nestedList.getMemberType());
}
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:18,代码来源:DefaultsTest.java
示例3: createBeanMetadata
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
private static MutableBeanMetadata createBeanMetadata(final ParserContext context, final String id,
final Class<?> runtimeClass, final boolean initMethod, final boolean destroyMethod) {
MutableBeanMetadata metadata = context.createMetadata(MutableBeanMetadata.class);
metadata.setId(id);
metadata.setScope(BeanMetadata.SCOPE_SINGLETON);
metadata.setActivation(ReferenceMetadata.ACTIVATION_EAGER);
metadata.setRuntimeClass(runtimeClass);
if (initMethod) {
metadata.setInitMethod("init");
}
if (destroyMethod) {
metadata.setDestroyMethod("destroy");
}
return metadata;
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:19,代码来源:OpendaylightNamespaceHandler.java
示例4: createServiceRef
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
private ComponentMetadata createServiceRef(String id, Class<?> iface) {
final MutableReferenceMetadata refMeta = pc.createMetadata(MutableReferenceMetadata.class);
refMeta.setActivation(getDefaultActivation(pc));
refMeta.setAvailability(ReferenceMetadata.AVAILABILITY_MANDATORY);
refMeta.setRuntimeInterface(iface);
refMeta.setTimeout(Integer.parseInt(pc.getDefaultTimeout()));
List<String> emptyList = Collections.emptyList();
refMeta.setDependsOn(emptyList);
refMeta.setId(id);
return refMeta;
}
开发者ID:apache,项目名称:aries-jpa,代码行数:12,代码来源:JpaComponentProcessor.java
示例5: createJPAServiceRef
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
private ComponentMetadata createJPAServiceRef(String unitName, Class<?> iface) {
final MutableReferenceMetadata refMeta = pc.createMetadata(MutableReferenceMetadata.class);
refMeta.setActivation(getDefaultActivation(pc));
refMeta.setAvailability(ReferenceMetadata.AVAILABILITY_MANDATORY);
refMeta.setRuntimeInterface(iface);
refMeta.setFilter(String.format("(%s=%s)", JPA_UNIT_NAME, unitName));
refMeta.setTimeout(Integer.parseInt(pc.getDefaultTimeout()));
List<String> emptyList = Collections.emptyList();
refMeta.setDependsOn(emptyList);
refMeta.setId(getId(unitName, iface));
return refMeta;
}
开发者ID:apache,项目名称:aries-jpa,代码行数:13,代码来源:JpaComponentProcessor.java
示例6: testSimpleBean
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
public void testSimpleBean() throws Exception {
ServiceReferenceMetadata metadata = getReferenceMetadata("simple");
System.out.println(metadata.getClass().getName());
assertNull(metadata.getFilter());
String intf = metadata.getInterface();
assertEquals(Cloneable.class.getName(), intf);
assertEquals(ReferenceMetadata.AVAILABILITY_MANDATORY, metadata.getAvailability());
assertEquals(0, metadata.getReferenceListeners().size());
}
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:10,代码来源:ImporterMetadataTest.java
示例7: testBeanWithOptions
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
public void testBeanWithOptions() throws Exception {
ServiceReferenceMetadata metadata = getReferenceMetadata("options");
assertEquals("(name=foo)", metadata.getFilter());
String intf = metadata.getInterface();
assertEquals(Serializable.class.getName(), intf);
assertEquals(ReferenceMetadata.AVAILABILITY_OPTIONAL, metadata.getAvailability());
Collection<ReferenceListener> listeners = metadata.getReferenceListeners();
assertEquals(1, listeners.size());
}
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:10,代码来源:ImporterMetadataTest.java
示例8: testMultipleInterfaces
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
public void testMultipleInterfaces() throws Exception {
ServiceReferenceMetadata metadata = getReferenceMetadata("multipleInterfaces");
String intf = metadata.getInterface();
assertEquals(Cloneable.class.getName(), intf);
assertEquals(ReferenceMetadata.AVAILABILITY_MANDATORY, metadata.getAvailability());
assertEquals(0, metadata.getReferenceListeners().size());
}
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:8,代码来源:ImporterMetadataTest.java
示例9: testNestedMandatoryReference
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
public void testNestedMandatoryReference() throws Exception {
BeanMetadata metadata = (BeanMetadata) blueprintContainer.getComponentMetadata("nestedReference");
BeanProperty prop = (BeanProperty) metadata.getProperties().get(0);
Metadata value = prop.getValue();
assertTrue(value instanceof ReferenceMetadata);
ReferenceMetadata ref = (ReferenceMetadata) value;
assertEquals(1000, ref.getTimeout());
assertEquals(ReferenceMetadata.ACTIVATION_LAZY, ref.getActivation());
}
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:10,代码来源:ImporterMetadataTest.java
示例10: testNestedMandatoryCollectionReference
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
public void testNestedMandatoryCollectionReference() throws Exception {
BeanMetadata metadata = (BeanMetadata) blueprintContainer.getComponentMetadata("nestedCollectionReference");
BeanProperty prop = (BeanProperty) metadata.getProperties().get(0);
Metadata value = prop.getValue();
assertTrue(value instanceof ReferenceListMetadata);
ReferenceListMetadata ref = (ReferenceListMetadata) value;
assertEquals(ReferenceListMetadata.USE_SERVICE_REFERENCE, ref.getMemberType());
assertEquals(ReferenceMetadata.ACTIVATION_LAZY, ref.getActivation());
}
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:10,代码来源:ImporterMetadataTest.java
示例11: testDefaultActivation
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
public void testDefaultActivation() throws Exception {
ComponentMetadata metadata = blueprintContainer.getComponentMetadata("lazy-ref");
assertEquals(ReferenceMetadata.ACTIVATION_LAZY, metadata.getActivation());
metadata = blueprintContainer.getComponentMetadata("lazy-col");
assertEquals(ReferenceMetadata.ACTIVATION_LAZY, metadata.getActivation());
metadata = blueprintContainer.getComponentMetadata("lazy-service");
assertEquals(ReferenceMetadata.ACTIVATION_LAZY, metadata.getActivation());
}
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:9,代码来源:DefaultsTest.java
示例12: registerRoutedRpcRegistrationConverter
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
private static void registerRoutedRpcRegistrationConverter(final ParserContext context) {
ComponentDefinitionRegistry registry = context.getComponentDefinitionRegistry();
if (registry.getComponentDefinition(ROUTED_RPC_REG_CONVERTER_NAME) == null) {
MutableBeanMetadata metadata = createBeanMetadata(context, ROUTED_RPC_REG_CONVERTER_NAME,
RoutedRpcRegistrationConverter.class, false, false);
metadata.setActivation(ReferenceMetadata.ACTIVATION_LAZY);
registry.registerTypeConverter(metadata);
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:OpendaylightNamespaceHandler.java
示例13: createServiceRef
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
private static MutableReferenceMetadata createServiceRef(final ParserContext context, final Class<?> cls,
final String filter) {
MutableReferenceMetadata metadata = context.createMetadata(MutableReferenceMetadata.class);
metadata.setRuntimeInterface(cls);
metadata.setInterface(cls.getName());
metadata.setActivation(ReferenceMetadata.ACTIVATION_EAGER);
metadata.setAvailability(ReferenceMetadata.AVAILABILITY_MANDATORY);
if (filter != null) {
metadata.setFilter(filter);
}
return metadata;
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:15,代码来源:OpendaylightNamespaceHandler.java
示例14: lookupByType
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
public static <T> Map<String, T> lookupByType(BlueprintContainer blueprintContainer, Class<T> type, boolean includeNonSingletons) {
Bundle bundle = (Bundle) blueprintContainer.getComponentInstance("blueprintBundle");
Map<String, T> objects = new LinkedHashMap<String, T>();
Set<String> ids = blueprintContainer.getComponentIds();
for (String id : ids) {
try {
ComponentMetadata metadata = blueprintContainer.getComponentMetadata(id);
Class<?> cl = null;
if (metadata instanceof BeanMetadata) {
BeanMetadata beanMetadata = (BeanMetadata)metadata;
// should we skip the bean if its prototype and we are only looking for singletons?
if (!includeNonSingletons) {
String scope = beanMetadata.getScope();
if (BeanMetadata.SCOPE_PROTOTYPE.equals(scope)) {
continue;
}
}
cl = bundle.loadClass(beanMetadata.getClassName());
} else if (metadata instanceof ReferenceMetadata) {
ReferenceMetadata referenceMetadata = (ReferenceMetadata)metadata;
cl = bundle.loadClass(referenceMetadata.getInterface());
}
if (cl != null && type.isAssignableFrom(cl)) {
Object o = blueprintContainer.getComponentInstance(metadata.getId());
objects.put(metadata.getId(), type.cast(o));
}
} catch (Throwable t) {
// ignore
}
}
return objects;
}
开发者ID:HydAu,项目名称:Camel,代码行数:33,代码来源:BlueprintContainerRegistry.java
示例15: getDefaultActivation
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
private static int getDefaultActivation(ParserContext ctx) {
return "ACTIVATION_EAGER".equalsIgnoreCase(ctx.getDefaultActivation())
? ReferenceMetadata.ACTIVATION_EAGER : ReferenceMetadata.ACTIVATION_LAZY;
}
开发者ID:apache,项目名称:aries-jpa,代码行数:5,代码来源:JpaComponentProcessor.java
示例16: buildReferenceProxy
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
private AbstractBeanDefinition buildReferenceProxy(ReferenceMetadata metadata) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(SINGLE_SERVICE_IMPORTER_CLASS);
addServiceReferenceProperties(metadata, builder);
throw new UnsupportedOperationException("not implemented yet");
// return builder.getBeanDefinition();
}
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:7,代码来源:BeanDefinitionFactory.java
示例17: testTimeout
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
public void testTimeout() throws Exception {
ServiceReferenceMetadata metadata = getReferenceMetadata("timeout");
assertTrue(metadata instanceof ReferenceMetadata);
assertEquals(1234, ((ReferenceMetadata) metadata).getTimeout());
}
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:6,代码来源:ImporterMetadataTest.java
示例18: testOverriddenActivation
import org.osgi.service.blueprint.reflect.ReferenceMetadata; //导入依赖的package包/类
public void testOverriddenActivation() throws Exception {
ComponentMetadata metadata = blueprintContainer.getComponentMetadata("overriden-activation");
assertEquals(ReferenceMetadata.ACTIVATION_EAGER, metadata.getActivation());
metadata = blueprintContainer.getComponentMetadata("overriden-service");
assertEquals(ReferenceMetadata.ACTIVATION_EAGER, metadata.getActivation());
}
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:7,代码来源:DefaultsTest.java
注:本文中的org.osgi.service.blueprint.reflect.ReferenceMetadata类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论