当前位置: 首页>>代码示例>>Java>>正文


Java Metadata类代码示例

本文整理汇总了Java中org.osgi.service.blueprint.reflect.Metadata的典型用法代码示例。如果您正苦于以下问题:Java Metadata类的具体用法?Java Metadata怎么用?Java Metadata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Metadata类属于org.osgi.service.blueprint.reflect包,在下文中一共展示了Metadata类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import org.osgi.service.blueprint.reflect.Metadata; //导入依赖的package包/类
@Override
public Metadata parse(final Element element, final ParserContext context) {
    LOG.debug("In parse for {}", element);

    if (nodeNameEquals(element, RpcImplementationBean.RPC_IMPLEMENTATION)) {
        return parseRpcImplementation(element, context);
    } else if (nodeNameEquals(element, RoutedRpcMetadata.ROUTED_RPC_IMPLEMENTATION)) {
        return parseRoutedRpcImplementation(element, context);
    } else if (nodeNameEquals(element, RPC_SERVICE)) {
        return parseRpcService(element, context);
    } else if (nodeNameEquals(element, NotificationListenerBean.NOTIFICATION_LISTENER)) {
        return parseNotificationListener(element, context);
    } else if (nodeNameEquals(element, CLUSTERED_APP_CONFIG)) {
        return parseClusteredAppConfig(element, context);
    } else if (nodeNameEquals(element, SPECIFIC_SERVICE_REF_LIST)) {
        return parseSpecificReferenceList(element, context);
    } else if (nodeNameEquals(element, STATIC_REFERENCE)) {
        return parseStaticReference(element, context);
    } else if (nodeNameEquals(element, ACTION_SERVICE)) {
        return parseActionService(element, context);
    } else if (nodeNameEquals(element, ActionProviderBean.ACTION_PROVIDER)) {
        return parseActionProvider(element, context);
    }

    throw new ComponentDefinitionException("Unsupported standalone element: " + element.getNodeName());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:27,代码来源:OpendaylightNamespaceHandler.java

示例2: parseActionProvider

import org.osgi.service.blueprint.reflect.Metadata; //导入依赖的package包/类
private static Metadata parseActionProvider(final Element element, final ParserContext context) {
    registerRpcProviderServiceRefBean(context);
    registerRpcRegistryServiceRefBean(context);
    registerSchemaServiceRefBean(context);

    MutableBeanMetadata metadata = createBeanMetadata(context, context.generateId(), ActionProviderBean.class,
            true, true);
    addBlueprintBundleRefProperty(context, metadata);
    metadata.addProperty("rpcProviderService", createRef(context, RPC_PROVIDER_SERVICE_NAME));
    metadata.addProperty("rpcRegistry", createRef(context, RPC_REGISTRY_NAME));
    metadata.addProperty("schemaService", createRef(context, SCHEMA_SERVICE_NAME));
    metadata.addProperty("interfaceName", createValue(context, element.getAttribute(INTERFACE)));

    if (element.hasAttribute(REF_ATTR)) {
        metadata.addProperty("implementation", createRef(context, element.getAttribute(REF_ATTR)));
    }

    LOG.debug("parseActionProvider returning {}", metadata);
    return metadata;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:21,代码来源:OpendaylightNamespaceHandler.java

示例3: parseRpcImplementation

import org.osgi.service.blueprint.reflect.Metadata; //导入依赖的package包/类
private static Metadata parseRpcImplementation(final Element element, final ParserContext context) {
    registerRpcRegistryServiceRefBean(context);

    MutableBeanMetadata metadata = createBeanMetadata(context, context.generateId(), RpcImplementationBean.class,
            true, true);
    addBlueprintBundleRefProperty(context, metadata);
    metadata.addProperty("rpcRegistry", createRef(context, RPC_REGISTRY_NAME));
    metadata.addProperty("implementation", createRef(context, element.getAttribute(REF_ATTR)));

    if (element.hasAttribute(INTERFACE)) {
        metadata.addProperty("interfaceName", createValue(context, element.getAttribute(INTERFACE)));
    }

    LOG.debug("parseRpcImplementation returning {}", metadata);
    return metadata;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:17,代码来源:OpendaylightNamespaceHandler.java

示例4: testParseContainer

import org.osgi.service.blueprint.reflect.Metadata; //导入依赖的package包/类
@Test
public void testParseContainer() throws Exception {
    Element root = parseRootElement();
    NodeList nodes = root.getElementsByTagNameNS(NAMESPACE_URI, "container");
    Element element = (Element) nodes.item(0);

    Metadata parsed = handler.parse(element, parserContext);
    assertTrue(parsed instanceof BeanMetadata);
    BeanMetadata beanMetadata = (BeanMetadata) parsed;

    assertEquals(OsgiContainer.class.getName(), beanMetadata.getClassName());
    assertEquals(2, beanMetadata.getArguments().size());
    final BeanArgument argument1 = beanMetadata.getArguments().get(0);
    assertTrue(argument1.getValue() instanceof RefMetadata);
    RefMetadata bundleContextRef = (RefMetadata) argument1.getValue();
    assertEquals("blueprintBundleContext", bundleContextRef.getComponentId());
    assertEquals(BundleContext.class.getName(), argument1.getValueType());

    final BeanArgument argument2 = beanMetadata.getArguments().get(1);
    assertTrue(argument2.getValue() instanceof ValueMetadata);
    ValueMetadata quietPeriodInMs = (ValueMetadata) argument2.getValue();
    assertEquals("1000", quietPeriodInMs.getStringValue());
    assertEquals(Long.TYPE.getName(), quietPeriodInMs.getType());
    assertEquals(Long.TYPE.getName(), argument2.getValueType());
}
 
开发者ID:Microbule,项目名称:microbule,代码行数:26,代码来源:MicrobuleNamespaceHandlerTest.java

示例5: testParseProxy

import org.osgi.service.blueprint.reflect.Metadata; //导入依赖的package包/类
@Test
public void testParseProxy() throws Exception {
    Element root = parseRootElement();
    NodeList nodes = root.getElementsByTagNameNS(NAMESPACE_URI, "proxy");
    Element element = (Element) nodes.item(0);

    Metadata parsed = handler.parse(element, parserContext);

    assertTrue(parsed instanceof BeanMetadata);
    BeanMetadata beanMetadata = (BeanMetadata) parsed;
    assertEquals("createProxy", beanMetadata.getFactoryMethod());
    assertTrue(beanMetadata.getFactoryComponent() instanceof RefMetadata);

    RefMetadata omnibusFactoryRef = (RefMetadata) beanMetadata.getFactoryComponent();
    assertEquals(MicrobuleNamespaceHandler.JAXRS_PROXY_FACTORY_ID, omnibusFactoryRef.getComponentId());
    assertEquals(Collections.singletonList(MicrobuleNamespaceHandler.JAXRS_PROXY_FACTORY_ID), beanMetadata.getDependsOn());
    verify(parserContext, atLeastOnce()).getComponentDefinitionRegistry();
    verify(componentDefinitionRegistry).containsComponentDefinition(MicrobuleNamespaceHandler.JAXRS_PROXY_FACTORY_ID);
    verify(componentDefinitionRegistry).registerComponentDefinition(jaxrsProxyFactoryCaptor.capture());
}
 
开发者ID:Microbule,项目名称:microbule,代码行数:21,代码来源:MicrobuleNamespaceHandlerTest.java

示例6: testParseProxyWhenJaxrsProxyAlreadyDefined

import org.osgi.service.blueprint.reflect.Metadata; //导入依赖的package包/类
@Test
public void testParseProxyWhenJaxrsProxyAlreadyDefined() throws Exception {
    Element root = parseRootElement();
    NodeList nodes = root.getElementsByTagNameNS(NAMESPACE_URI, "proxy");
    Element element = (Element) nodes.item(0);
    when(componentDefinitionRegistry.containsComponentDefinition(MicrobuleNamespaceHandler.JAXRS_PROXY_FACTORY_ID)).thenReturn(true);
    Metadata parsed = handler.parse(element, parserContext);

    assertTrue(parsed instanceof BeanMetadata);
    BeanMetadata beanMetadata = (BeanMetadata) parsed;
    assertEquals("createProxy", beanMetadata.getFactoryMethod());
    assertTrue(beanMetadata.getFactoryComponent() instanceof RefMetadata);

    RefMetadata omnibusFactoryRef = (RefMetadata) beanMetadata.getFactoryComponent();
    assertEquals(MicrobuleNamespaceHandler.JAXRS_PROXY_FACTORY_ID, omnibusFactoryRef.getComponentId());
    assertEquals(Collections.singletonList(MicrobuleNamespaceHandler.JAXRS_PROXY_FACTORY_ID), beanMetadata.getDependsOn());
    verify(parserContext, atLeastOnce()).getComponentDefinitionRegistry();
    verify(componentDefinitionRegistry).containsComponentDefinition(MicrobuleNamespaceHandler.JAXRS_PROXY_FACTORY_ID);
    verifyNoMoreInteractions(componentDefinitionRegistry);
}
 
开发者ID:Microbule,项目名称:microbule,代码行数:21,代码来源:MicrobuleNamespaceHandlerTest.java

示例7: parse

import org.osgi.service.blueprint.reflect.Metadata; //导入依赖的package包/类
public Metadata parse(Element element, ParserContext context) {
    Metadata answer = null;
    String s = element.getLocalName();
    if ("cxfEndpoint".equals(s)) {
        LOG.debug("parsing the cxfEndpoint element");
        answer = new EndpointDefinitionParser().parse(element, context);
    }
    if ("rsClient".equals(s)) {
        LOG.debug("parsing the rsClient element");
        answer = new RsClientDefinitionParser().parse(element, context);
    }
    if ("rsServer".equals(s)) {
        LOG.debug("parsing the rsServer element");
        answer = new RsServerDefinitionParser().parse(element, context);
    }
    
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:CxfNamespaceHandler.java

示例8: parse

import org.osgi.service.blueprint.reflect.Metadata; //导入依赖的package包/类
public Metadata parse(Element element, ParserContext context, Class<?> runtime) {
    MutableBeanMetadata config = createBeanMetadata(element, context, runtime);
    config.setScope(BeanMetadata.SCOPE_PROTOTYPE);
    String camelContextId = "camelContext";
    NamedNodeMap atts = element.getAttributes();
    for (int i = 0; i < atts.getLength(); i++) {
        Attr node = (Attr) atts.item(i);
        String val = node.getValue();
        //String pre = node.getPrefix();
        String name = node.getLocalName();
        if ("camelContextId".equals(name)) {
            camelContextId = val;
        }
    }
    config.addDependsOn(camelContextId);
    config.addProperty("camelContext", createRef(context, camelContextId));
    return config;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:19,代码来源:AbstractBeanDefinitionParser.java

示例9: getMetadata

import org.osgi.service.blueprint.reflect.Metadata; //导入依赖的package包/类
static <E> List<Metadata> getMetadata(Collection<E> collection) {
	if (collection.isEmpty()) {
		return Collections.emptyList();
	}

	List<Metadata> list = new ArrayList<Metadata>(collection.size());

	for (Object value : collection) {
		list.add(ValueFactory.buildValue(value));
	}

	return Collections.unmodifiableList(list);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:14,代码来源:ValueFactory.java

示例10: getEntries

import org.osgi.service.blueprint.reflect.Metadata; //导入依赖的package包/类
static <K, V> List<MapEntry> getEntries(Map<K, V> map) {
	if (map.isEmpty())
		return Collections.emptyList();

	List<MapEntry> entries = new ArrayList<MapEntry>(map.size());
	// convert map objects
	for (Map.Entry<K, V> entry : map.entrySet()) {
		NonNullMetadata key = (NonNullMetadata) ValueFactory.buildValue(entry.getKey());
		Metadata value = (Metadata) ValueFactory.buildValue(entry.getValue());

		entries.add(new SimpleMapEntry(key, value));
	}
	return Collections.unmodifiableList(entries);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:15,代码来源:ValueFactory.java

示例11: testNestedMandatoryReference

import org.osgi.service.blueprint.reflect.Metadata; //导入依赖的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

示例12: testNestedMandatoryCollectionReference

import org.osgi.service.blueprint.reflect.Metadata; //导入依赖的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

示例13: parseRoutedRpcImplementation

import org.osgi.service.blueprint.reflect.Metadata; //导入依赖的package包/类
private static Metadata parseRoutedRpcImplementation(final Element element, final ParserContext context) {
    registerRpcRegistryServiceRefBean(context);
    registerRoutedRpcRegistrationConverter(context);

    ComponentFactoryMetadata metadata = new RoutedRpcMetadata(getId(context, element),
            element.getAttribute(INTERFACE), element.getAttribute(REF_ATTR));

    LOG.debug("parseRoutedRpcImplementation returning {}", metadata);

    return metadata;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:12,代码来源:OpendaylightNamespaceHandler.java

示例14: parseActionService

import org.osgi.service.blueprint.reflect.Metadata; //导入依赖的package包/类
private static Metadata parseActionService(final Element element, final ParserContext context) {
    ComponentFactoryMetadata metadata = new ActionServiceMetadata(getId(context, element),
            element.getAttribute(INTERFACE));

    LOG.debug("parseActionService returning {}", metadata);

    return metadata;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:OpendaylightNamespaceHandler.java

示例15: parseRpcService

import org.osgi.service.blueprint.reflect.Metadata; //导入依赖的package包/类
private static Metadata parseRpcService(final Element element, final ParserContext context) {
    ComponentFactoryMetadata metadata = new RpcServiceMetadata(getId(context, element),
            element.getAttribute(INTERFACE));

    LOG.debug("parseRpcService returning {}", metadata);

    return metadata;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:9,代码来源:OpendaylightNamespaceHandler.java


注:本文中的org.osgi.service.blueprint.reflect.Metadata类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。