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


Java MutableBeanMetadata.setInitMethod方法代码示例

本文整理汇总了Java中org.apache.aries.blueprint.mutable.MutableBeanMetadata.setInitMethod方法的典型用法代码示例。如果您正苦于以下问题:Java MutableBeanMetadata.setInitMethod方法的具体用法?Java MutableBeanMetadata.setInitMethod怎么用?Java MutableBeanMetadata.setInitMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.aries.blueprint.mutable.MutableBeanMetadata的用法示例。


在下文中一共展示了MutableBeanMetadata.setInitMethod方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createBeanMetadata

import org.apache.aries.blueprint.mutable.MutableBeanMetadata; //导入方法依赖的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

示例2: registerBean

import org.apache.aries.blueprint.mutable.MutableBeanMetadata; //导入方法依赖的package包/类
protected void registerBean(ParserContext context, String contextId, AbstractCamelFactoryBean<?> fact) {
    String id = fact.getId();

    fact.setCamelContextId(contextId);

    MutablePassThroughMetadata eff = context.createMetadata(MutablePassThroughMetadata.class);
    eff.setId(".camelBlueprint.bean.passthrough." + id);
    eff.setObject(new PassThroughCallable<Object>(fact));

    MutableBeanMetadata ef = context.createMetadata(MutableBeanMetadata.class);
    ef.setId(".camelBlueprint.bean.factory." + id);
    ef.setFactoryComponent(eff);
    ef.setFactoryMethod("call");
    ef.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));
    ef.setInitMethod("afterPropertiesSet");
    ef.setDestroyMethod("destroy");

    MutableBeanMetadata e = context.createMetadata(MutableBeanMetadata.class);
    e.setId(id);
    e.setRuntimeClass(fact.getObjectType());
    e.setFactoryComponent(ef);
    e.setFactoryMethod("getObject");
    e.addDependsOn(".camelBlueprint.processor.bean." + contextId);

    context.getComponentDefinitionRegistry().registerComponentDefinition(e);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:27,代码来源:CamelNamespaceHandler.java

示例3: parseEndpointNode

import org.apache.aries.blueprint.mutable.MutableBeanMetadata; //导入方法依赖的package包/类
private Metadata parseEndpointNode(Element element, ParserContext context) {
    LOG.trace("Parsing Endpoint {}", element);
    // now parse the rests with JAXB
    Binder<Node> binder;
    try {
        binder = getJaxbContext().createBinder();
    } catch (JAXBException e) {
        throw new ComponentDefinitionException("Failed to create the JAXB binder : " + e, e);
    }
    Object value = parseUsingJaxb(element, context, binder);
    if (!(value instanceof CamelEndpointFactoryBean)) {
        throw new ComponentDefinitionException("Expected an instance of " + CamelEndpointFactoryBean.class);
    }

    CamelEndpointFactoryBean rcfb = (CamelEndpointFactoryBean) value;
    String id = rcfb.getId();

    MutablePassThroughMetadata factory = context.createMetadata(MutablePassThroughMetadata.class);
    factory.setId(".camelBlueprint.passThrough." + id);
    factory.setObject(new PassThroughCallable<Object>(rcfb));

    MutableBeanMetadata factory2 = context.createMetadata(MutableBeanMetadata.class);
    factory2.setId(".camelBlueprint.factory." + id);
    factory2.setFactoryComponent(factory);
    factory2.setFactoryMethod("call");
    factory2.setInitMethod("afterPropertiesSet");
    factory2.setDestroyMethod("destroy");
    factory2.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));

    MutableBeanMetadata ctx = context.createMetadata(MutableBeanMetadata.class);
    ctx.setId(id);
    ctx.setRuntimeClass(Endpoint.class);
    ctx.setFactoryComponent(factory2);
    ctx.setFactoryMethod("getObject");
    // must be lazy as we want CamelContext to be activated first
    ctx.setActivation(ACTIVATION_LAZY);

    LOG.trace("Parsing endpoint done, returning {}", element, ctx);
    return ctx;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:41,代码来源:CamelNamespaceHandler.java

示例4: parseKeyStoreParametersNode

import org.apache.aries.blueprint.mutable.MutableBeanMetadata; //导入方法依赖的package包/类
private Metadata parseKeyStoreParametersNode(Element element, ParserContext context) {
    LOG.trace("Parsing KeyStoreParameters {}", element);
    // now parse the key store parameters with JAXB
    Binder<Node> binder;
    try {
        binder = getJaxbContext().createBinder();
    } catch (JAXBException e) {
        throw new ComponentDefinitionException("Failed to create the JAXB binder : " + e, e);
    }
    Object value = parseUsingJaxb(element, context, binder);
    if (!(value instanceof KeyStoreParametersFactoryBean)) {
        throw new ComponentDefinitionException("Expected an instance of " + KeyStoreParametersFactoryBean.class);
    }

    KeyStoreParametersFactoryBean kspfb = (KeyStoreParametersFactoryBean) value;
    String id = kspfb.getId();

    MutablePassThroughMetadata factory = context.createMetadata(MutablePassThroughMetadata.class);
    factory.setId(".camelBlueprint.passThrough." + id);
    factory.setObject(new PassThroughCallable<Object>(kspfb));

    MutableBeanMetadata factory2 = context.createMetadata(MutableBeanMetadata.class);
    factory2.setId(".camelBlueprint.factory." + id);
    factory2.setFactoryComponent(factory);
    factory2.setFactoryMethod("call");
    factory2.setInitMethod("afterPropertiesSet");
    factory2.setDestroyMethod("destroy");
    factory2.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));

    MutableBeanMetadata ctx = context.createMetadata(MutableBeanMetadata.class);
    ctx.setId(id);
    ctx.setRuntimeClass(KeyStoreParameters.class);
    ctx.setFactoryComponent(factory2);
    ctx.setFactoryMethod("getObject");
    // must be lazy as we want CamelContext to be activated first
    ctx.setActivation(ACTIVATION_LAZY);

    LOG.trace("Parsing KeyStoreParameters done, returning {}", ctx);
    return ctx;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:41,代码来源:CamelNamespaceHandler.java

示例5: parseSecureRandomParametersNode

import org.apache.aries.blueprint.mutable.MutableBeanMetadata; //导入方法依赖的package包/类
private Metadata parseSecureRandomParametersNode(Element element, ParserContext context) {
    LOG.trace("Parsing SecureRandomParameters {}", element);
    // now parse the key store parameters with JAXB
    Binder<Node> binder;
    try {
        binder = getJaxbContext().createBinder();
    } catch (JAXBException e) {
        throw new ComponentDefinitionException("Failed to create the JAXB binder : " + e, e);
    }
    Object value = parseUsingJaxb(element, context, binder);
    if (!(value instanceof SecureRandomParametersFactoryBean)) {
        throw new ComponentDefinitionException("Expected an instance of " + SecureRandomParametersFactoryBean.class);
    }

    SecureRandomParametersFactoryBean srfb = (SecureRandomParametersFactoryBean) value;
    String id = srfb.getId();

    MutablePassThroughMetadata factory = context.createMetadata(MutablePassThroughMetadata.class);
    factory.setId(".camelBlueprint.passThrough." + id);
    factory.setObject(new PassThroughCallable<Object>(srfb));

    MutableBeanMetadata factory2 = context.createMetadata(MutableBeanMetadata.class);
    factory2.setId(".camelBlueprint.factory." + id);
    factory2.setFactoryComponent(factory);
    factory2.setFactoryMethod("call");
    factory2.setInitMethod("afterPropertiesSet");
    factory2.setDestroyMethod("destroy");
    factory2.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));

    MutableBeanMetadata ctx = context.createMetadata(MutableBeanMetadata.class);
    ctx.setId(id);
    ctx.setRuntimeClass(SecureRandomParameters.class);
    ctx.setFactoryComponent(factory2);
    ctx.setFactoryMethod("getObject");
    // must be lazy as we want CamelContext to be activated first
    ctx.setActivation(ACTIVATION_LAZY);

    LOG.trace("Parsing SecureRandomParameters done, returning {}", ctx);
    return ctx;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:41,代码来源:CamelNamespaceHandler.java

示例6: parseSSLContextParametersNode

import org.apache.aries.blueprint.mutable.MutableBeanMetadata; //导入方法依赖的package包/类
private Metadata parseSSLContextParametersNode(Element element, ParserContext context) {
    LOG.trace("Parsing SSLContextParameters {}", element);
    // now parse the key store parameters with JAXB
    Binder<Node> binder;
    try {
        binder = getJaxbContext().createBinder();
    } catch (JAXBException e) {
        throw new ComponentDefinitionException("Failed to create the JAXB binder : " + e, e);
    }
    Object value = parseUsingJaxb(element, context, binder);
    if (!(value instanceof SSLContextParametersFactoryBean)) {
        throw new ComponentDefinitionException("Expected an instance of " + SSLContextParametersFactoryBean.class);
    }

    SSLContextParametersFactoryBean scpfb = (SSLContextParametersFactoryBean) value;
    String id = scpfb.getId();

    MutablePassThroughMetadata factory = context.createMetadata(MutablePassThroughMetadata.class);
    factory.setId(".camelBlueprint.passThrough." + id);
    factory.setObject(new PassThroughCallable<Object>(scpfb));

    MutableBeanMetadata factory2 = context.createMetadata(MutableBeanMetadata.class);
    factory2.setId(".camelBlueprint.factory." + id);
    factory2.setFactoryComponent(factory);
    factory2.setFactoryMethod("call");
    factory2.setInitMethod("afterPropertiesSet");
    factory2.setDestroyMethod("destroy");
    factory2.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));

    MutableBeanMetadata ctx = context.createMetadata(MutableBeanMetadata.class);
    ctx.setId(id);
    ctx.setRuntimeClass(SSLContextParameters.class);
    ctx.setFactoryComponent(factory2);
    ctx.setFactoryMethod("getObject");
    // must be lazy as we want CamelContext to be activated first
    ctx.setActivation(ACTIVATION_LAZY);

    LOG.trace("Parsing SSLContextParameters done, returning {}", ctx);
    return ctx;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:41,代码来源:CamelNamespaceHandler.java


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