Java 类org.springframework.beans.factory.xml.BeanDefinitionParser 实例源码

项目:leopard    文件:LeopardNamespaceHandler.java   
protected void registerParser(String elementName, String className) {
    // logger.info("registerParser elementName:" + elementName + " className:" + className);
    BeanDefinitionParser parser;
    try {
        parser = getBeanDefinitionParser(elementName, className);
        // logger.info("registerParser elementName:" + elementName + " parser:" + parser);
    }
    catch (Exception e) {
        logger.error(e.getMessage(), e);
        return;
    }
    // try {
    // parser = (BeanDefinitionParser) Class.forName(className).newInstance();
    // }
    // catch (Exception e) {
    // // throw new RuntimeException(e.getMessage(), e);
    // return;
    // }

    registerBeanDefinitionParser(elementName, parser);
}
项目:leopard    文件:LeopardNamespaceHandler.java   
protected BeanDefinitionParser getBeanDefinitionParser(String elementName, String className) throws Exception {
    boolean useH2 = isUseH2();
    if (!useH2) {
        return (BeanDefinitionParser) Class.forName(className).newInstance();
    }

    String h2ClassName = className.replace("io.leopard.schema", "io.leopard.schema.h2");
    Class<?> clazz;
    try {
        clazz = Class.forName(h2ClassName);
    }
    catch (ClassNotFoundException e) {
        clazz = Class.forName(className);
    }
    return (BeanDefinitionParser) clazz.newInstance();
}
项目:gemini.blueprint    文件:BlueprintBeanDefinitionParser.java   
private void parseListElement(Element ele, ParserContext parserContext) {
    BeanDefinitionParser parser = new BlueprintCollectionBeanDefinitionParser() {

        @Override
        protected CollectionType collectionType() {
            return CollectionType.LIST;
        }
    };
    parser.parse(ele, parserContext);
}
项目:gemini.blueprint    文件:BlueprintBeanDefinitionParser.java   
private void parseSetElement(Element ele, ParserContext parserContext) {
    BeanDefinitionParser parser = new BlueprintCollectionBeanDefinitionParser() {

        @Override
        protected CollectionType collectionType() {
            return CollectionType.SET;
        }
    };

    parser.parse(ele, parserContext);
}
项目:automation-test-engine    文件:StepTypeServiceBeanDefinitionParser.java   
private static void parseTestStepComponents(List<Element> childElements,
            BeanDefinition beanDef, ParserContext parserContext) {
        ManagedList<BeanDefinition> children = new ManagedList<BeanDefinition>(//NOPMD
                childElements.size());
        for (Element element : childElements) {
            BeanDefinitionParser bep = XsdNameSpaceParserRegistry.getNameSpaceHandlerRegistry().get(element.getLocalName());
            if (null == bep) throw GlobalUtils.createNotInitializedException("Name space handler not registered for this element: " + element.getTagName());
            BeanDefinition tmpBDef = bep.parse(element, parserContext);
            tmpBDef.getPropertyValues().removePropertyValue(tmpBDef.getPropertyValues().getPropertyValue(XsdElementConstants.MEMBER_BASETESTSTEP_TESTCASE));
            children.add(tmpBDef);

//          if (element.getTagName() == "ate:" //NOPMD
//                  + XsdElementConstants.ELEMENT_HOMESTEP) {
//              HomeStepBeanDefinitionParser homeStep = new HomeStepBeanDefinitionParser();
//              BeanDefinition tmpBDef = homeStep.parse(element, parserContext);
//              tmpBDef.getPropertyValues().removePropertyValue(tmpBDef.getPropertyValues().getPropertyValue(XsdElementConstants.MEMBER_BASETESTSTEP_TESTCASE));
//              
//              children.add(tmpBDef);
//          } else if (element.getTagName() == "ate:"
//                  + XsdElementConstants.ELEMENT_ELEMENTSTEP) {
//              ElementStepBeanDefinitionParser elementStep = new ElementStepBeanDefinitionParser();
//              BeanDefinition tmpBDef = elementStep.parse(element, parserContext);
//              tmpBDef.getPropertyValues().removePropertyValue(tmpBDef.getPropertyValues().getPropertyValue(XsdElementConstants.MEMBER_BASETESTSTEP_TESTCASE));
//              
//              children.add(tmpBDef);
//          } else if (element.getTagName() == "ate:"
//                  + XsdElementConstants.ELEMENT_LASTSTEP) {
//              LastStepBeanDefinitionParser lastStep = new LastStepBeanDefinitionParser();
//              BeanDefinition tmpBDef = lastStep.parse(element, parserContext);
//              tmpBDef.getPropertyValues().removePropertyValue(tmpBDef.getPropertyValues().getPropertyValue(XsdElementConstants.MEMBER_BASETESTSTEP_TESTCASE));
//              
//              children.add(tmpBDef);
//      
//          }
        }
        beanDef.getPropertyValues().addPropertyValue(
                XsdElementConstants.MEMBER_STEPTYPESERVICE_STEPSET, children);
    }
项目:automation-test-engine    文件:BaseTestStepBeanDefinitionParser.java   
private static void parseAsserterComponents(List<Element> childElements,
        BeanDefinition beanDef, ParserContext parserContext) {
    ManagedList<BeanDefinition> children = new ManagedList<BeanDefinition>(//NOPMD
            childElements.size());
    for (Element element : childElements) {
        BeanDefinitionParser bep = XsdNameSpaceParserRegistry.getNameSpaceHandlerRegistry().get(element.getLocalName());
        if (null == bep) throw GlobalUtils.createNotInitializedException("Name space handler not registered for this element: " + element.getTagName());
        BeanDefinition tmpBDef = bep.parse(element, parserContext);
        children.add(tmpBDef);

    }
    beanDef.getPropertyValues().addPropertyValue(
            "expectedResultAsserter", children);
}
项目:automation-test-engine    文件:AteNamespaceHandler.java   
/**
 * {@inheritDoc}
 */
@Override
public void init() {
    Map<String, BeanDefinitionParser> userParsers = XsdNameSpaceParserRegistry.getNameSpaceHandlerRegistry();
    for (Map.Entry<String, BeanDefinitionParser> parser : userParsers.entrySet()) {
        registerBeanDefinitionParser(parser.getKey(), parser.getValue());
    }
}
项目:automation-test-engine    文件:JavaCodedStep.java   
/**
 * {@inheritDoc}
 */
@Override
public BeanDefinitionParser getParser() {
    final JavaCodedStepNameSpaceParser nameSpaceParser2 = nameSpaceParser;
    if (nameSpaceParser2 == null) {
        return new JavaCodedStepNameSpaceParser();// NOPMD
    } else {
        return nameSpaceParser2;

    }
}
项目:further-open-core    文件:CoreNamespaceHandler.java   
/**
 * Register bean definition parsers for supported boxed-primitive creation elements.
 * Use reflection to attach the correct parsers by naming conventions of both the
 * elements and parser classes
 *
 * @param boxedElementTypes
 *            list of supported boxed-primitive types
 */
private void registerBoxedTypeElementParsers(final List<Class<?>> boxedElementTypes)
{
    for (final Class<?> elementType : boxedElementTypes)
    {
        final String typeName = elementType.getSimpleName();
        final String elementName = typeName.toLowerCase();
        final Class<? extends BeanDefinitionParser> parserClass = loadParserClass(
                elementName, typeName + BOXED_BEAN_DEFINITION_PARSER_SUFFIX);
        final BeanDefinitionParser parserInstance = getParserInstance(parserClass);
        registerBeanDefinitionParser(elementName, parserInstance);
    }
}
项目:gemini.blueprint    文件:BlueprintBeanDefinitionParser.java   
private void parseReferenceElement(Element ele, ParserContext parserContext) {
    BeanDefinitionParser parser = new BlueprintReferenceBeanDefinitionParser();
    parser.parse(ele, parserContext);
}
项目:gemini.blueprint    文件:BlueprintBeanDefinitionParser.java   
private void parseServiceElement(Element ele, ParserContext parserContext) {
    BeanDefinitionParser parser = new BlueprintServiceDefinitionParser();
    parser.parse(ele, parserContext);
}
项目:cacheonix-core    文件:GigaSpacesNamespaceHandler.java   
protected BeanDefinitionParser getCacheProviderFacadeParser() {
  return cacheProviderFacadeParser;
}
项目:cacheonix-core    文件:JcsNamespaceHandler.java   
protected BeanDefinitionParser getCacheProviderFacadeParser() {
  return cacheProviderFacadeParser;
}
项目:cacheonix-core    文件:EhCacheNamespaceHandler.java   
protected BeanDefinitionParser getCacheProviderFacadeParser() {
  return cacheProviderFacadeParser;
}
项目:cacheonix-core    文件:OsCacheNamespaceHandler.java   
protected BeanDefinitionParser getCacheProviderFacadeParser() {
  return cacheProviderFacadeParser;
}
项目:cacheonix-core    文件:CoherenceNamespaceHandler.java   
protected BeanDefinitionParser getCacheProviderFacadeParser() {
  return cacheProviderFacadeParser;
}
项目:cacheonix-core    文件:CacheonixNamespaceHandler.java   
protected BeanDefinitionParser getCacheProviderFacadeParser() {
   return cacheProviderFacadeParser;
}
项目:cacheonix-core    文件:JbossCacheNamespaceHandler.java   
protected BeanDefinitionParser getCacheProviderFacadeParser() {
  return cacheProviderFacadeParser;
}
项目:spring_nats    文件:NatsNamespaceHandler.java   
@Override
public void init() {
    registerBeanDefinitionParser("config", (BeanDefinitionParser)new NatsConfigBeanDefinitionParser());     
}
项目:automation-test-engine    文件:XsdNameSpaceParserRegistry.java   
/**
 * @return the nameSpaceHandlerRegistry
 */
public static Map<String, BeanDefinitionParser> getNameSpaceHandlerRegistry() {
    return nameSpaceHandlerRegistry;
}
项目:automation-test-engine    文件:TestCaseBeanDefinitionParser.java   
private static void parseTestStepComponents(List<Element> childElements,
            BeanDefinitionBuilder factory, ParserContext parserContext) {
        if (!childElements.isEmpty()) {
            ManagedList<BeanDefinition> children = new ManagedList<BeanDefinition>(//NOPMD
                    childElements.size());
            for (Element element : childElements) {
                BeanDefinitionParser bep = XsdNameSpaceParserRegistry.getNameSpaceHandlerRegistry().get(element.getLocalName());
                if (null == bep) throw GlobalUtils.createNotInitializedException("Name space handler not registered for this element: " + element.getTagName());
                children.add(bep.parse(element, parserContext));
//              if (element.getTagName().equalsIgnoreCase("ate:" // NOPMD
//                      + XsdElementConstants.ELEMENT_HOMESTEP)) {
//                  HomeStepBeanDefinitionParser homeStep = new HomeStepBeanDefinitionParser();
//                  children.add(homeStep.parse(element, parserContext));
//              } else if (element.getTagName().equalsIgnoreCase("ate:"
//                      + XsdElementConstants.ELEMENT_ELEMENTSTEP)) {
//                  ElementStepBeanDefinitionParser elementStep = new ElementStepBeanDefinitionParser();
//                  children.add(elementStep.parse(element, parserContext));
//              } else if (element.getTagName().equalsIgnoreCase("ate:"
//                      + JavaCodedStep.XSD_ELEMENT_JAVACODEDSTEP)) {
//                  BeanDefinitionParser javastep = new JavaCodedStep().getParser();
//                  children.add(javastep.parse(element, parserContext));
//              } else if (element.getTagName().equalsIgnoreCase("ate:"
//                      + XsdElementConstants.ELEMENT_REPEATSTEP)) {
//                  RepeatStepBeanDefinitionParser repeatStep = new RepeatStepBeanDefinitionParser();
//                  children.add(repeatStep.parse(element, parserContext));
//              } else if (element.getTagName().equalsIgnoreCase("ate:"
//                      + XsdElementConstants.ELEMENT_LASTSTEP)) {
//                  LastStepBeanDefinitionParser lastStep = new LastStepBeanDefinitionParser();
//                  children.add(lastStep.parse(element, parserContext));
//              } else if (element.getTagName().equalsIgnoreCase("ate:"
//                      + XsdElementConstants.ELEMENT_CASETYPESERVICE)) {
//                  CaseTypeServiceBeanDefinitionParser caseService = new CaseTypeServiceBeanDefinitionParser();
//                  children.add(caseService.parse(element, parserContext));
//              } else if (element
//                      .getTagName()
//                      .equalsIgnoreCase("ate:"
//                              + XsdElementConstants.ELEMENT_STEPTYPESERVICEREFERENCE)) {
//                  String stepServiceDefRef = element
//                          .getAttribute(XsdElementConstants.ATTR_STEPTYPESERVICEREFERENCE_STEPTYPESERVICEDEFINITIONID);
//                  if (StringUtils.isEmpty(stepServiceDefRef)) {
//                      throw GlobalUtils
//                              .createNotInitializedException("STEPTYPESERVICEDEFINITIONID");
//                  } else {
//                      children.add(parserContext.getRegistry()
//                              .getBeanDefinition(stepServiceDefRef));
//                  }
//
//              }
            }
            factory.addPropertyValue(
                    XsdElementConstants.PROP_TESTCASE_TESTSTEPLIST, children);
        }
    }
项目:gemini.blueprint    文件:BlueprintBeanDefinitionParser.java   
/**
 * Parses a &lt;type-converters&gt;.
 * 
 * @param ele
 * @param parserContext
 */
protected void parseConvertersElement(Element ele, ParserContext parserContext) {
    BeanDefinitionParser parser = new TypeConverterBeanDefinitionParser();
    parser.parse(ele, parserContext);
}
项目:cacheonix-core    文件:AbstractCacheNamespaceHandler.java   
/**
 * @return the parser for the XML elements with name "config"
 */
protected abstract BeanDefinitionParser getCacheProviderFacadeParser();
项目:automation-test-engine    文件:IXsdBeanDefinitionParser.java   
/**
 * Gets the parser.
 *
 * @return the parser
 */
BeanDefinitionParser getParser();
项目:automation-test-engine    文件:XsdNameSpaceParserRegistry.java   
/**
 * Register name space handler.
 *
 * @param elementName the element name
 * @param parser the parser
 */
public static void registerNameSpaceHandler(String elementName,
        BeanDefinitionParser parser) {
    XsdNameSpaceParserRegistry.getNameSpaceHandlerRegistry().put(
            elementName, parser);
}