Package org.dom4j

Examples of org.dom4j.Attribute


      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 );
      }
    }
  }
View Full Code Here


      }
    }
  }

  private void parseMappingElement(Element mappingElement, String name) {
    final Attribute resourceAttribute = mappingElement.attribute( "resource" );
    final Attribute fileAttribute = mappingElement.attribute( "file" );
    final Attribute jarAttribute = mappingElement.attribute( "jar" );
    final Attribute packageAttribute = mappingElement.attribute( "package" );
    final Attribute classAttribute = mappingElement.attribute( "class" );

    if ( resourceAttribute != null ) {
      final String resourceName = resourceAttribute.getValue();
            LOG.debugf("Session-factory config [%s] named resource [%s] for mapping", name, resourceName);
      addResource( resourceName );
    }
    else if ( fileAttribute != null ) {
      final String fileName = fileAttribute.getValue();
            LOG.debugf("Session-factory config [%s] named file [%s] for mapping", name, fileName);
      addFile( fileName );
    }
    else if ( jarAttribute != null ) {
      final String jarFileName = jarAttribute.getValue();
            LOG.debugf("Session-factory config [%s] named jar file [%s] for mapping", name, jarFileName);
      addJar( new File( jarFileName ) );
    }
    else if ( packageAttribute != null ) {
      final String packageName = packageAttribute.getValue();
            LOG.debugf("Session-factory config [%s] named package [%s] for mapping", name, packageName);
      addPackage( packageName );
    }
    else if ( classAttribute != null ) {
      final String className = classAttribute.getValue();
            LOG.debugf("Session-factory config [%s] named class [%s] for mapping", name, className);
      try {
        addAnnotatedClass( ReflectHelper.classForName( className ) );
      }
      catch ( Exception e ) {
View Full Code Here

    }

    public void add(XmlDocument metadataXml) {
      final Document document = metadataXml.getDocumentTree();
      final Element hmNode = document.getRootElement();
      Attribute packNode = hmNode.attribute( "package" );
      String defaultPackage = packNode != null ? packNode.getValue() : "";
      Set<String> entityNames = new HashSet<String>();
      findClassNames( defaultPackage, hmNode, entityNames );
      for ( String entity : entityNames ) {
        hbmMetadataByEntityNameXRef.put( entity, metadataXml );
      }
View Full Code Here

        int dbType = 0;
        String javaType = null;
        String columnName = null;
        String index = null;
        Iterator<Attribute> attrIterator = container.attributeIterator();
        Attribute attribute;

        while( attrIterator.hasNext() ) {
            attribute = ( Attribute )attrIterator.next();

            if( attribute.getName().equals( "dbType" ) ) {
                dbType = Integer.parseInt( attribute.getText() );
            }
            else if( attribute.getName().equals( "name" ) ) {
                columnName = attribute.getText();
            }
            else if( attribute.getName().equals( "javaType" ) ) {
                javaType = attribute.getText();
            }
            else if( attribute.getName().equals( "index" ) ) {
                index = attribute.getText();
            }
        }

        return new SchemaColumn( columnId, columnName, dbType, javaType, index );
    }
View Full Code Here

                "OPC Compliance error [M4.1]: there is more than one core properties relationship in the package !");

        /* End OPC Compliance */

        // TargetMode (default value "Internal")
        Attribute targetModeAttr = element
            .attribute(PackageRelationship.TARGET_MODE_ATTRIBUTE_NAME);
        TargetMode targetMode = TargetMode.INTERNAL;
        if (targetModeAttr != null) {
          targetMode = targetModeAttr.getValue().toLowerCase()
              .equals("internal") ? TargetMode.INTERNAL
              : TargetMode.EXTERNAL;
        }

        // Target converted in URI
View Full Code Here

        throw new InvalidFormatException("Namespace error : " + elName
            + " shouldn't have the following naemspace -> "
            + PackageProperties.NAMESPACE_DCTERMS);

      // Check for the 'xsi:type' attribute
      Attribute typeAtt = el.attribute(new QName("type", namespaceXSI));
      if (typeAtt == null)
        throw new InvalidFormatException("The element '" + elName
            + "' must have the '" + namespaceXSI.getPrefix()
            + ":type' attribute present !");

      // Check for the attribute value => 'dcterms:W3CDTF'
      if (!typeAtt.getValue().equals("dcterms:W3CDTF"))
        throw new InvalidFormatException("The element '" + elName
            + "' must have the '" + namespaceXSI.getPrefix()
            + ":type' attribute with the value 'dcterms:W3CDTF' !");
    }
View Full Code Here

        // Get creator
        ParentChildCreatorInterface creator = null;
        String absoluteDoctypesPath = sitemapParentPath + doctypesPath;
        Document doctypesDoc = new SAXReader().read("file:" + absoluteDoctypesPath +
                "doctypes.xconf");
        Attribute creator_src = (Attribute) doctypesDoc.selectSingleNode("/doctypes/doc[@type='" +
                doctype + "']/creator/@src");

        if (creator_src != null) {
            getLogger().info(".act(): Creator found for \"" + doctype + "\": " +
                creator_src.getName() + " " + creator_src.getPath() + " " + creator_src.getValue());

            // now get the constructor that accepts the configuration
            Class creatorClass = Class.forName(creator_src.getValue());
            creator = (ParentChildCreatorInterface) creatorClass.newInstance();
        } else {
            getLogger().warn("No creator found for \"" + doctype +
                "\". DefaultBranchCreator will be taken.");
            creator = new org.apache.lenya.cms.authoring.DefaultBranchCreator();
View Full Code Here

        // Get creator
        ParentChildCreatorInterface creator = null;
        String absoluteDoctypesPath = publication.getDirectory() + File.separator + doctypesPath;
        Document doctypesDoc = new SAXReader().read("file:" + absoluteDoctypesPath +
                "doctypes.xconf");
        Attribute creator_src = (Attribute) doctypesDoc.selectSingleNode("/doctypes/doc[@type='" +
                doctype + "']/creator/@src");

        if (creator_src != null) {
            log.info("Creator found for \"" + doctype + "\": " + creator_src.getName() + " " + creator_src.getPath() + " " + creator_src.getValue());

            // now get the constructor that accepts the configuration
            Class creatorClass = Class.forName(creator_src.getValue());
            creator = (ParentChildCreatorInterface) creatorClass.newInstance();
        } else {
            log.warn("No creator found for \"" + doctype + "\". DefaultBranchCreator will be taken.");
            creator = new org.apache.lenya.cms.authoring.DefaultBranchCreator();
        }
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

    }
  }

  private static void bindImport(Element importNode, Mappings mappings) {
    String className = getClassName( importNode.attribute( "class" ), mappings );
    Attribute renameNode = importNode.attribute( "rename" );
    String rename = ( renameNode == null ) ?
            StringHelper.unqualify( className ) :
            renameNode.getValue();
    log.debug( "Import: " + rename + " -> " + className );
    mappings.addImport( className, rename );
  }
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.