Package org.dom4j

Examples of org.dom4j.Attribute


  public static java.util.List getExtendsNeeded(Document doc, Mappings mappings) {
    java.util.List extendz = new ArrayList();
    Iterator[] subclasses = new Iterator[3];
    final Element hmNode = doc.getRootElement();

    Attribute packNode = hmNode.attribute( "package" );
    final String packageName = packNode == null ? null : packNode.getValue();
    if ( packageName != null ) {
      mappings.setDefaultPackage( packageName );
    }

    // first, iterate over all elements capable of defining an extends attribute
View Full Code Here


    String queryName = queryElem.attribute( "name" ).getValue();
    if (path!=null) queryName = path + '.' + queryName;

    boolean cacheable = "true".equals( queryElem.attributeValue( "cacheable" ) );
    String region = queryElem.attributeValue( "cache-region" );
    Attribute tAtt = queryElem.attribute( "timeout" );
    Integer timeout = tAtt == null ? null : new Integer( tAtt.getValue() );
    Attribute fsAtt = queryElem.attribute( "fetch-size" );
    Integer fetchSize = fsAtt == null ? null : new Integer( fsAtt.getValue() );
    Attribute roAttr = queryElem.attribute( "read-only" );
    boolean readOnly = roAttr != null && "true".equals( roAttr.getValue() );
    Attribute cacheModeAtt = queryElem.attribute( "cache-mode" );
    String cacheMode = cacheModeAtt == null ? null : cacheModeAtt.getValue();
    Attribute cmAtt = queryElem.attribute( "comment" );
    String comment = cmAtt == null ? null : cmAtt.getValue();

    java.util.List synchronizedTables = new ArrayList();
    Iterator tables = queryElem.elementIterator( "synchronize" );
    while ( tables.hasNext() ) {
      synchronizedTables.add( ( (Element) tables.next() ).attributeValue( "table" ) );
    }
    boolean callable = "true".equals( queryElem.attributeValue( "callable" ) );

    NamedSQLQueryDefinition namedQuery;
    Attribute ref = queryElem.attribute( "resultset-ref" );
    String resultSetRef = ref == null ? null : ref.getValue();
    if ( StringHelper.isNotEmpty( resultSetRef ) ) {
      namedQuery = new NamedSQLQueryDefinition(
          queryElem.getText(),
          resultSetRef,
          synchronizedTables,
View Full Code Here

      if ( "mapping".equals( subelementName ) ) {
        parseMappingElement( subelement, name );
      }
      else if ( "class-cache".equals( subelementName ) ) {
        String className = subelement.attributeValue( "class" );
        Attribute regionNode = subelement.attribute( "region" );
        final String region = ( regionNode == null ) ? className : regionNode.getValue();
        boolean includeLazy = !"non-lazy".equals( subelement.attributeValue( "include" ) );
        setCacheConcurrencyStrategy( className, subelement.attributeValue( "usage" ), region, includeLazy );
      }
      else if ( "collection-cache".equals( subelementName ) ) {
        String role = subelement.attributeValue( "collection" );
        Attribute regionNode = subelement.attribute( "region" );
        final String region = ( regionNode == null ) ? role : regionNode.getValue();
        setCollectionCacheConcurrencyStrategy( role, subelement.attributeValue( "usage" ), region );
      }
      else if ( "listener".equals( subelementName ) ) {
        parseListener( subelement );
      }
View Full Code Here

      }
    }
  }

  protected void parseMappingElement(Element subelement, String name) {
    Attribute rsrc = subelement.attribute( "resource" );
    Attribute file = subelement.attribute( "file" );
    Attribute jar = subelement.attribute( "jar" );
    Attribute pkg = subelement.attribute( "package" );
    Attribute clazz = subelement.attribute( "class" );
    if ( rsrc != null ) {
      log.debug( name + "<-" + rsrc );
      addResource( rsrc.getValue() );
    }
    else if ( jar != null ) {
      log.debug( name + "<-" + jar );
      addJar( new File( jar.getValue() ) );
    }
    else if ( pkg != null ) {
      throw new MappingException(
          "An AnnotationConfiguration instance is required to use <mapping package=\"" +
          pkg.getValue() + "\"/>"
        );
    }
    else if ( clazz != null ) {
      throw new MappingException(
          "An AnnotationConfiguration instance is required to use <mapping class=\"" +
          clazz.getValue() + "\"/>"
        );
    }
    else {
      if ( file == null ) {
        throw new MappingException(
View Full Code Here

      if ( "mapping".equals( subelementName ) ) {
        parseMappingElement( subelement, name );
      }
      else if ( "class-cache".equals( subelementName ) ) {
        String className = subelement.attributeValue( "class" );
        Attribute regionNode = subelement.attribute( "region" );
        final String region = ( regionNode == null ) ? className : regionNode.getValue();
        boolean includeLazy = !"non-lazy".equals( subelement.attributeValue( "include" ) );
        setCacheConcurrencyStrategy( className, subelement.attributeValue( "usage" ), region, includeLazy );
      }
      else if ( "collection-cache".equals( subelementName ) ) {
        String role = subelement.attributeValue( "collection" );
        Attribute regionNode = subelement.attribute( "region" );
        final String region = ( regionNode == null ) ? role : regionNode.getValue();
        setCollectionCacheConcurrencyStrategy( role, subelement.attributeValue( "usage" ), region );
      }
      else if ( "listener".equals( subelementName ) ) {
        parseListener( subelement );
      }
View Full Code Here

      }
    }
  }

  protected void parseMappingElement(Element subelement, String name) {
    Attribute rsrc = subelement.attribute( "resource" );
    Attribute file = subelement.attribute( "file" );
    Attribute jar = subelement.attribute( "jar" );
    Attribute pkg = subelement.attribute( "package" );
    Attribute clazz = subelement.attribute( "class" );
    if ( rsrc != null ) {
      log.debug( name + "<-" + rsrc );
      addResource( rsrc.getValue() );
    }
    else if ( jar != null ) {
      log.debug( name + "<-" + jar );
      addJar( new File( jar.getValue() ) );
    }
    else if ( pkg != null ) {
      throw new MappingException(
          "An AnnotationConfiguration instance is required to use <mapping package=\"" +
          pkg.getValue() + "\"/>"
        );
    }
    else if ( clazz != null ) {
      throw new MappingException(
          "An AnnotationConfiguration instance is required to use <mapping class=\"" +
          clazz.getValue() + "\"/>"
        );
    }
    else {
      if ( file == null ) {
        throw new MappingException(
View Full Code Here

    String queryName = queryElem.attribute( "name" ).getValue();
    if (path!=null) queryName = path + '.' + queryName;

    boolean cacheable = "true".equals( queryElem.attributeValue( "cacheable" ) );
    String region = queryElem.attributeValue( "cache-region" );
    Attribute tAtt = queryElem.attribute( "timeout" );
    Integer timeout = tAtt == null ? null : new Integer( tAtt.getValue() );
    Attribute fsAtt = queryElem.attribute( "fetch-size" );
    Integer fetchSize = fsAtt == null ? null : new Integer( fsAtt.getValue() );
    Attribute roAttr = queryElem.attribute( "read-only" );
    boolean readOnly = roAttr != null && "true".equals( roAttr.getValue() );
    Attribute cacheModeAtt = queryElem.attribute( "cache-mode" );
    String cacheMode = cacheModeAtt == null ? null : cacheModeAtt.getValue();
    Attribute cmAtt = queryElem.attribute( "comment" );
    String comment = cmAtt == null ? null : cmAtt.getValue();

    java.util.List synchronizedTables = new ArrayList();
    Iterator tables = queryElem.elementIterator( "synchronize" );
    while ( tables.hasNext() ) {
      synchronizedTables.add( ( (Element) tables.next() ).attributeValue( "table" ) );
    }
    boolean callable = "true".equals( queryElem.attributeValue( "callable" ) );

    NamedSQLQueryDefinition namedQuery;
    Attribute ref = queryElem.attribute( "resultset-ref" );
    String resultSetRef = ref == null ? null : ref.getValue();
    if ( StringHelper.isNotEmpty( resultSetRef ) ) {
      namedQuery = new NamedSQLQueryDefinition(
          queryElem.getText(),
          resultSetRef,
          synchronizedTables,
View Full Code Here

      if ( "mapping".equals( subelementName ) ) {
        parseMappingElement( subelement, name );
      }
      else if ( "class-cache".equals( subelementName ) ) {
        String className = subelement.attributeValue( "class" );
        Attribute regionNode = subelement.attribute( "region" );
        final String region = ( regionNode == null ) ? className : regionNode.getValue();
        boolean includeLazy = !"non-lazy".equals( subelement.attributeValue( "include" ) );
        setCacheConcurrencyStrategy( className, subelement.attributeValue( "usage" ), region, includeLazy );
      }
      else if ( "collection-cache".equals( subelementName ) ) {
        String role = subelement.attributeValue( "collection" );
        Attribute regionNode = subelement.attribute( "region" );
        final String region = ( regionNode == null ) ? role : regionNode.getValue();
        setCollectionCacheConcurrencyStrategy( role, subelement.attributeValue( "usage" ), region );
      }
      else if ( "listener".equals( subelementName ) ) {
        parseListener( subelement );
      }
View Full Code Here

      }
    }
  }

  protected void parseMappingElement(Element subelement, String name) {
    Attribute rsrc = subelement.attribute( "resource" );
    Attribute file = subelement.attribute( "file" );
    Attribute jar = subelement.attribute( "jar" );
    Attribute pkg = subelement.attribute( "package" );
    Attribute clazz = subelement.attribute( "class" );
    if ( rsrc != null ) {
      log.debug( name + "<-" + rsrc );
      addResource( rsrc.getValue() );
    }
    else if ( jar != null ) {
      log.debug( name + "<-" + jar );
      addJar( new File( jar.getValue() ) );
    }
    else if ( pkg != null ) {
      throw new MappingException(
          "An AnnotationConfiguration instance is required to use <mapping package=\"" +
          pkg.getValue() + "\"/>"
        );
    }
    else if ( clazz != null ) {
      throw new MappingException(
          "An AnnotationConfiguration instance is required to use <mapping class=\"" +
          clazz.getValue() + "\"/>"
        );
    }
    else {
      if ( file == null ) {
        throw new MappingException(
View Full Code Here

    java.util.List names = HbmBinder.getExtendsNeeded( doc, mappings );
    if ( !names.isEmpty() ) {
      // classes mentioned in extends not available - so put it in queue
      Element hmNode = doc.getRootElement();
      Attribute packNode = hmNode.attribute( "package" );
      String packageName = null;
      if ( packNode != null ) {
        packageName = packNode.getValue();
      }
      Iterator itr = names.iterator();
      while ( itr.hasNext() ) {
        String extendsName = (String) itr.next();
        mappings.addToExtendsQueue( new ExtendsQueueEntry( extendsName, packageName, doc ) );
View Full Code Here

TOP

Related Classes of org.dom4j.Attribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.