[Castore-commits] PointToPointSchema.java 1.1.2.4 1.1.2.5 PpsElement.java 1.1.2.4 1.1.2.5

Stéphane Bouchet sbouchet at adullact1.hosting.cri74.org
Lun 6 Mar 17:12:14 CET 2006


Update of /cvsroot/castore/castore-core/src/java/fr/emn/castor/documents/retro/pointtopointschema
In directory adullact1:/tmp/cvs-serv8129/src/java/fr/emn/castor/documents/retro/pointtopointschema

Modified Files:
      Tag: v1_1_branch
	PointToPointSchema.java PpsElement.java 
Log Message:
Mise en page

Index: PpsElement.java
===================================================================
RCS file: /cvsroot/castore/castore-core/src/java/fr/emn/castor/documents/retro/pointtopointschema/PpsElement.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** PpsElement.java	7 Feb 2006 15:46:10 -0000	1.1.2.4
--- PpsElement.java	6 Mar 2006 16:12:12 -0000	1.1.2.5
***************
*** 49,52 ****
--- 49,53 ----
  import org.apache.commons.logging.LogFactory;
  import org.jdom.Element;
+ 
  /**
   * @author  rdelambe  TODO To change the template for this generated type comment go to Window -  Preferences - Java - Code Style - Code Templates
***************
*** 77,86 ****
  
      protected Map<String, Map<String, PpsElement>> allowedFollowingSiblingsOfChild = new TreeMap<String, Map<String, PpsElement>>();
!     
      protected PointToPointSchema pps;
  
!     public PpsElement(PointToPointSchema container_pps) 
!     {
!     	pps = container_pps;
      }
  
--- 78,86 ----
  
      protected Map<String, Map<String, PpsElement>> allowedFollowingSiblingsOfChild = new TreeMap<String, Map<String, PpsElement>>();
! 
      protected PointToPointSchema pps;
  
!     public PpsElement(PointToPointSchema container_pps) {
!         pps = container_pps;
      }
  
***************
*** 97,111 ****
  
          if (element.getAttribute(ATTR_MIXED_CONTENT) != null)
!             this.mixedContent = element.getAttributeValue(ATTR_MIXED_CONTENT).equalsIgnoreCase(TRUE);
  
          if (element.getAttribute(ATTR_TEXT_ONLY_CONTENT) != null)
!             this.textOnlyContent = element.getAttributeValue(ATTR_TEXT_ONLY_CONTENT).equalsIgnoreCase(TRUE);
!         
          if (element.getAttribute(ATTR_ALLOWED_EMPY_CONTENT) != null)
!             this.allowedEmptyContent = element.getAttributeValue(ATTR_ALLOWED_EMPY_CONTENT).equalsIgnoreCase(TRUE);
  
          if (element.getAttribute(ATTR_MANDATORY_EMPY_CONTENT) != null)
!             this.mandatoryEmptyContent = element.getAttributeValue(ATTR_MANDATORY_EMPY_CONTENT).equalsIgnoreCase(TRUE);
!         
          // Load complex attributes
  
--- 97,116 ----
  
          if (element.getAttribute(ATTR_MIXED_CONTENT) != null)
!             this.mixedContent = element
!                 .getAttributeValue(ATTR_MIXED_CONTENT)
!                 .equalsIgnoreCase(TRUE);
  
          if (element.getAttribute(ATTR_TEXT_ONLY_CONTENT) != null)
!             this.textOnlyContent = element.getAttributeValue(
!                 ATTR_TEXT_ONLY_CONTENT).equalsIgnoreCase(TRUE);
! 
          if (element.getAttribute(ATTR_ALLOWED_EMPY_CONTENT) != null)
!             this.allowedEmptyContent = element.getAttributeValue(
!                 ATTR_ALLOWED_EMPY_CONTENT).equalsIgnoreCase(TRUE);
  
          if (element.getAttribute(ATTR_MANDATORY_EMPY_CONTENT) != null)
!             this.mandatoryEmptyContent = element.getAttributeValue(
!                 ATTR_MANDATORY_EMPY_CONTENT).equalsIgnoreCase(TRUE);
! 
          // Load complex attributes
  
***************
*** 113,122 ****
  
          // Get the "AllowedChilds" node
!         Element theAllowedChildrenNode = (Element) element.getChild(ALLOWED_CHILDREN, PointToPointSchema.NAMESPACE);
  
          // there is only one such node (if it exists), get its "Element"
          // children
          if (theAllowedChildrenNode != null) {
!             List theAllowedChildrenElements = theAllowedChildrenNode.getChildren();
  
              allowedChildren = populateAllowedAttributes(theAllowedChildrenElements);
--- 118,129 ----
  
          // Get the "AllowedChilds" node
!         Element theAllowedChildrenNode = (Element) element.getChild(
!             ALLOWED_CHILDREN, PointToPointSchema.NAMESPACE);
  
          // there is only one such node (if it exists), get its "Element"
          // children
          if (theAllowedChildrenNode != null) {
!             List theAllowedChildrenElements = theAllowedChildrenNode
!                 .getChildren();
  
              allowedChildren = populateAllowedAttributes(theAllowedChildrenElements);
***************
*** 127,136 ****
  
          // Get the "AllowedFirstChilds" node
!         Element theAllowedFirstChildren = (Element) element.getChild(ALLOWED_FIRST_CHILDREN, PointToPointSchema.NAMESPACE);
!         
          // there is only one such node (if it exists), get its "Element"
          // children
          if (theAllowedFirstChildren != null) {
!             List theAllowedFirstChildrenElements = theAllowedFirstChildren.getChildren();
              allowedFirstChildren = populateAllowedAttributes(theAllowedFirstChildrenElements);
          }
--- 134,145 ----
  
          // Get the "AllowedFirstChilds" node
!         Element theAllowedFirstChildren = (Element) element.getChild(
!             ALLOWED_FIRST_CHILDREN, PointToPointSchema.NAMESPACE);
! 
          // there is only one such node (if it exists), get its "Element"
          // children
          if (theAllowedFirstChildren != null) {
!             List theAllowedFirstChildrenElements = theAllowedFirstChildren
!                 .getChildren();
              allowedFirstChildren = populateAllowedAttributes(theAllowedFirstChildrenElements);
          }
***************
*** 139,147 ****
  
          // Get the "AllowedLastChilds" node
!         Element theAllowedLastChildren = (Element) element.getChild(ALLOWED_LAST_CHILDREN, PointToPointSchema.NAMESPACE);
          // there is only one such node (if it exists), get its "Element"
          // children
          if (theAllowedLastChildren != null) {
!             List theAllowedLastChildrenElements = theAllowedLastChildren.getChildren();
              allowedLastChildren = populateAllowedAttributes(theAllowedLastChildrenElements);
          }
--- 148,158 ----
  
          // Get the "AllowedLastChilds" node
!         Element theAllowedLastChildren = (Element) element.getChild(
!             ALLOWED_LAST_CHILDREN, PointToPointSchema.NAMESPACE);
          // there is only one such node (if it exists), get its "Element"
          // children
          if (theAllowedLastChildren != null) {
!             List theAllowedLastChildrenElements = theAllowedLastChildren
!                 .getChildren();
              allowedLastChildren = populateAllowedAttributes(theAllowedLastChildrenElements);
          }
***************
*** 161,173 ****
       *            the Node list to read the information from
       */
!     private Map<String, PpsElement> populateAllowedAttributes(List children) 
!     {
          // initialize vector
!     	Map<String, PpsElement> attributeMap = new TreeMap<String, PpsElement>();
!         for (int i = 0; i < children.size(); i++) 
!         {
              // each child is an entry in allowedChildren
!         	Element refElement = (Element) children.get(i);
!         	String refElementName = PointToPointSchema.getName(refElement);
              PpsElement toBeAdded = pps.getElement(refElementName);
              attributeMap.put(refElementName, toBeAdded);
--- 172,182 ----
       *            the Node list to read the information from
       */
!     private Map<String, PpsElement> populateAllowedAttributes(List children) {
          // initialize vector
!         Map<String, PpsElement> attributeMap = new TreeMap<String, PpsElement>();
!         for (int i = 0; i < children.size(); i++) {
              // each child is an entry in allowedChildren
!             Element refElement = (Element) children.get(i);
!             String refElementName = PointToPointSchema.getName(refElement);
              PpsElement toBeAdded = pps.getElement(refElementName);
              attributeMap.put(refElementName, toBeAdded);
***************
*** 181,189 ****
       * @param element
       */
!     private TreeMap<String, Map<String, PpsElement>> populateAllowedFollowingSiblingsOfChild(Element element) {
  
          TreeMap<String, Map<String, PpsElement>> allowedFollowingSiblingsOfChildMap = new TreeMap<String, Map<String, PpsElement>>();
  
!         List allowedFollowingSiblingsOfChildList = element.getChildren(ALLOWED_FOLLOWING_SIBLINGS_OF_CHILD, PointToPointSchema.NAMESPACE);
  
          // These nodes (if they exists) are <AllowedFollowingSiblingOfChild>,
--- 190,201 ----
       * @param element
       */
!     private TreeMap<String, Map<String, PpsElement>> populateAllowedFollowingSiblingsOfChild(
!             Element element) {
  
          TreeMap<String, Map<String, PpsElement>> allowedFollowingSiblingsOfChildMap = new TreeMap<String, Map<String, PpsElement>>();
  
!         List allowedFollowingSiblingsOfChildList = element.getChildren(
!             ALLOWED_FOLLOWING_SIBLINGS_OF_CHILD,
!             PointToPointSchema.NAMESPACE);
  
          // These nodes (if they exists) are <AllowedFollowingSiblingOfChild>,
***************
*** 194,207 ****
  
          // loop on these <AllowedFollowingSiblingOfChild> nodes
!         for (int i = 0; i < allowedFollowingSiblingsOfChildList.size(); i++) 
!         {
              // each of them has a unique <Child> element as well as a unique
              // <AllowedFollowingSibling> element: get them
!         	Element ithElement = (Element) allowedFollowingSiblingsOfChildList.get(i);
!         	// Child = Text or Element
!             Element child = (Element) ithElement.getChild(CHILD, PointToPointSchema.NAMESPACE).getChildren().get(0);
              String childName = PointToPointSchema.getName(child);
! 	            
!             Element allowedFollowingSiblings = ithElement.getChild(ALLOWED_FOLLOWING_SIBLING, PointToPointSchema.NAMESPACE);
  
              // the <AllowedFollowingSibling> node has one or many <Element>
--- 206,221 ----
  
          // loop on these <AllowedFollowingSiblingOfChild> nodes
!         for (int i = 0; i < allowedFollowingSiblingsOfChildList.size(); i++) {
              // each of them has a unique <Child> element as well as a unique
              // <AllowedFollowingSibling> element: get them
!             Element ithElement = (Element) allowedFollowingSiblingsOfChildList
!                 .get(i);
!             // Child = Text or Element
!             Element child = (Element) ithElement.getChild(
!                 CHILD, PointToPointSchema.NAMESPACE).getChildren().get(0);
              String childName = PointToPointSchema.getName(child);
! 
!             Element allowedFollowingSiblings = ithElement.getChild(
!                 ALLOWED_FOLLOWING_SIBLING, PointToPointSchema.NAMESPACE);
  
              // the <AllowedFollowingSibling> node has one or many <Element>
***************
*** 213,221 ****
              Map<String, PpsElement> ppsElementMap = new TreeMap<String, PpsElement>();
  
!             for (int j = 0; j < elementList.size(); j++) 
!             {
!             	Element allowedFollowingSibling = (Element) elementList.get(j);
!             	String allowedFollowingSiblingName = PointToPointSchema.getName(allowedFollowingSibling);
!             	ppsElementMap.put(allowedFollowingSiblingName, pps.getElement(allowedFollowingSiblingName));
              }
  
--- 227,237 ----
              Map<String, PpsElement> ppsElementMap = new TreeMap<String, PpsElement>();
  
!             for (int j = 0; j < elementList.size(); j++) {
!                 Element allowedFollowingSibling = (Element) elementList
!                     .get(j);
!                 String allowedFollowingSiblingName = PointToPointSchema
!                     .getName(allowedFollowingSibling);
!                 ppsElementMap.put(allowedFollowingSiblingName, pps
!                     .getElement(allowedFollowingSiblingName));
              }
  
***************
*** 232,244 ****
       * @return true if element is an allowed child, false otherwise
       */
!     public boolean isAllowedChild(String elementName) 
!     {
!         if (allowedChildren == null)
!         {
!         	return false;
!         }
!         else
!         {
!         	return allowedChildren.containsKey(elementName);
          }
      }
--- 248,256 ----
       * @return true if element is an allowed child, false otherwise
       */
!     public boolean isAllowedChild(String elementName) {
!         if (allowedChildren == null) {
!             return false;
!         } else {
!             return allowedChildren.containsKey(elementName);
          }
      }
***************
*** 249,261 ****
       * @return true if element is an allowed first child, false otherwise
       */
!     public boolean isAllowedFirstChild(String elementName) 
!     {
!         if (allowedFirstChildren == null)
!         {
!         	return false;
!         }
!         else
!         {
!         	return allowedFirstChildren.containsKey(elementName);
          }
      }
--- 261,269 ----
       * @return true if element is an allowed first child, false otherwise
       */
!     public boolean isAllowedFirstChild(String elementName) {
!         if (allowedFirstChildren == null) {
!             return false;
!         } else {
!             return allowedFirstChildren.containsKey(elementName);
          }
      }
***************
*** 266,278 ****
       * @return true if element is an allowed last child, false otherwise
       */
!     public boolean isAllowedLastChild(String elementName) 
!     {
!         if (allowedLastChildren == null)
!         {
!         	return false;
!         }
!         else
!         {
!         	return allowedLastChildren.containsKey(elementName);
          }
      }
--- 274,282 ----
       * @return true if element is an allowed last child, false otherwise
       */
!     public boolean isAllowedLastChild(String elementName) {
!         if (allowedLastChildren == null) {
!             return false;
!         } else {
!             return allowedLastChildren.containsKey(elementName);
          }
      }
***************
*** 285,306 ****
       *         of child named "childName", false otherwise
       */
!     public boolean isAllowedFollowingSiblingOfChild(String childName,
!             String elementName) 
!     {
!         if (allowedFollowingSiblingsOfChild == null)
!         {
!         	return false;
!         }
!         else
!         {
!         	Map ppsElementMap = (Map) allowedFollowingSiblingsOfChild.get(childName);
!         	if (ppsElementMap != null)
!         	{
!         		return ppsElementMap.containsKey(elementName);
!         	}
!         	else
!         	{
!         		return false;
!         	}
          }
      }
--- 289,304 ----
       *         of child named "childName", false otherwise
       */
!     public boolean isAllowedFollowingSiblingOfChild(
!             String childName, String elementName) {
!         if (allowedFollowingSiblingsOfChild == null) {
!             return false;
!         } else {
!             Map ppsElementMap = (Map) allowedFollowingSiblingsOfChild
!                 .get(childName);
!             if (ppsElementMap != null) {
!                 return ppsElementMap.containsKey(elementName);
!             } else {
!                 return false;
!             }
          }
      }
***************
*** 311,354 ****
       * @return the vector of the allowed following siblings of child
       */
!     public Collection getAllowedFollowingSiblingsOfChild(String childName) 
!     {
!         return ((Map) allowedFollowingSiblingsOfChild.get(childName)).values();
      }
  
!     public void displayAllowedFollowingSiblingsOfChild() 
!     {
!     	
!         if (allowedFollowingSiblingsOfChild != null && allowedFollowingSiblingsOfChild.size() > 0) 
!         {
              logger.debug("@allowedFollowingSiblingsOfChild: ");
!             
              Set KeySet = allowedFollowingSiblingsOfChild.keySet();
!         	for (Iterator iter = KeySet.iterator(); iter.hasNext();) 
!         	{
! 				String childName = (String) iter.next();
! 				
! 				String keyVals = "(";
! 				Collection keyMappedValues = getAllowedFollowingSiblingsOfChild(childName);
! 				for (Iterator iter2 = keyMappedValues.iterator(); iter2
! 						.hasNext();) 
! 				{
! 					PpsElement element = (PpsElement) iter2.next();
! 					keyVals += (String) element.name;
! 					keyVals += ";";					
! 				}
! 	            keyVals += ")";
! 	            
! 	            logger.debug("child key = " + childName + " -> AFS mapped values = "
! 	                    + keyVals);	
! 			}
!             logger.debug("end of @allowedFollowingSiblingsOfChild");        	
          }
      }
  
      /**
! 	 * getter method for "name" attribute
! 	 * @return  the name
! 	 * @uml.property  name="name"
! 	 */
      public String getName() {
          return name;
--- 309,349 ----
       * @return the vector of the allowed following siblings of child
       */
!     public Collection getAllowedFollowingSiblingsOfChild(String childName) {
!         return ((Map) allowedFollowingSiblingsOfChild.get(childName))
!             .values();
      }
  
!     public void displayAllowedFollowingSiblingsOfChild() {
! 
!         if (allowedFollowingSiblingsOfChild != null
!                 && allowedFollowingSiblingsOfChild.size() > 0) {
              logger.debug("@allowedFollowingSiblingsOfChild: ");
! 
              Set KeySet = allowedFollowingSiblingsOfChild.keySet();
!             for (Iterator iter = KeySet.iterator(); iter.hasNext();) {
!                 String childName = (String) iter.next();
! 
!                 String keyVals = "(";
!                 Collection keyMappedValues = getAllowedFollowingSiblingsOfChild(childName);
!                 for (Iterator iter2 = keyMappedValues.iterator(); iter2
!                     .hasNext();) {
!                     PpsElement element = (PpsElement) iter2.next();
!                     keyVals += (String) element.name;
!                     keyVals += ";";
!                 }
!                 keyVals += ")";
! 
!                 logger.debug("child key = " + childName
!                         + " -> AFS mapped values = " + keyVals);
!             }
!             logger.debug("end of @allowedFollowingSiblingsOfChild");
          }
      }
  
      /**
!      * getter method for "name" attribute
!      * @return  the name
!      * @uml.property  name="name"
!      */
      public String getName() {
          return name;
***************
*** 356,385 ****
  
      /**
! 	 * getter method for "allowedChildren" attribute
! 	 * @return
! 	 * @uml.property  name="allowedChildren"
! 	 */
!     public Collection getAllowedChildren() 
!     {
          return allowedChildren.values();
      }
  
      /**
! 	 * getter method for "allowedFirstChildren" attribute
! 	 * @return
! 	 * @uml.property  name="allowedFirstChildren"
! 	 */
!     public Collection getAllowedFirstChildren() 
!     {
          return allowedFirstChildren.values();
      }
  
      /**
! 	 * getter method for "allowedLastChildren" attribute
! 	 * @return
! 	 * @uml.property  name="allowedLastChildren"
! 	 */
!     public Collection getAllowedLastChildren() 
!     {
          return allowedLastChildren.values();
      }
--- 351,377 ----
  
      /**
!      * getter method for "allowedChildren" attribute
!      * @return
!      * @uml.property  name="allowedChildren"
!      */
!     public Collection getAllowedChildren() {
          return allowedChildren.values();
      }
  
      /**
!      * getter method for "allowedFirstChildren" attribute
!      * @return
!      * @uml.property  name="allowedFirstChildren"
!      */
!     public Collection getAllowedFirstChildren() {
          return allowedFirstChildren.values();
      }
  
      /**
!      * getter method for "allowedLastChildren" attribute
!      * @return
!      * @uml.property  name="allowedLastChildren"
!      */
!     public Collection getAllowedLastChildren() {
          return allowedLastChildren.values();
      }
***************
*** 412,459 ****
          logger.debug("  @textOnlyContent = " + this.textOnlyContent);
          logger.debug("  @allowedEmptyContent = " + this.allowedEmptyContent);
!         logger.debug("  @mandatoryEmptyContent = " + this.mandatoryEmptyContent);
  
!         if (allowedChildren != null && allowedChildren.size() > 0) 
!         {
              logger.debug("@allowedChildren: ");
!             
              Set allowedChildrenSet = allowedChildren.entrySet();
!         	for (Iterator iter = allowedChildrenSet.iterator(); iter.hasNext();) 
!         	{
! 				PpsElement element = (PpsElement) iter.next();
! 				logger.debug("  " + element.name);	
! 			}
              logger.debug("end of @allowedChildren");
          }
  
!         if (allowedFirstChildren != null && allowedFirstChildren.size() > 0) 
!         {
              logger.debug("@allowedFirstChildren: ");
!             
              Set allowedFirstChildrenSet = allowedFirstChildren.entrySet();
!         	for (Iterator iter = allowedFirstChildrenSet.iterator(); iter.hasNext();) 
!         	{
! 				PpsElement element = (PpsElement) iter.next();
! 				logger.debug("  " + element.name);	
! 			}
!             logger.debug("end of @allowedFirstChildren");        	
          }
  
!         if (allowedLastChildren != null && allowedLastChildren.size() > 0) 
!         {
              logger.debug("@allowedLastChildren: ");
!             
              Set allowedFirstChildrenSet = allowedLastChildren.entrySet();
!         	for (Iterator iter = allowedFirstChildrenSet.iterator(); iter.hasNext();) 
!         	{
! 				PpsElement element = (PpsElement) iter.next();
! 				logger.debug("  " + element.name);	
! 			}
!             logger.debug("end of @allowedLastChildren");        	
          }
  
          if (allowedFollowingSiblingsOfChild != null
!                 && allowedFollowingSiblingsOfChild.size() > 0) 
!         {
              displayAllowedFollowingSiblingsOfChild();
          }
--- 404,448 ----
          logger.debug("  @textOnlyContent = " + this.textOnlyContent);
          logger.debug("  @allowedEmptyContent = " + this.allowedEmptyContent);
!         logger.debug("  @mandatoryEmptyContent = "
!                 + this.mandatoryEmptyContent);
  
!         if (allowedChildren != null && allowedChildren.size() > 0) {
              logger.debug("@allowedChildren: ");
! 
              Set allowedChildrenSet = allowedChildren.entrySet();
!             for (Iterator iter = allowedChildrenSet.iterator(); iter
!                 .hasNext();) {
!                 PpsElement element = (PpsElement) iter.next();
!                 logger.debug("  " + element.name);
!             }
              logger.debug("end of @allowedChildren");
          }
  
!         if (allowedFirstChildren != null && allowedFirstChildren.size() > 0) {
              logger.debug("@allowedFirstChildren: ");
! 
              Set allowedFirstChildrenSet = allowedFirstChildren.entrySet();
!             for (Iterator iter = allowedFirstChildrenSet.iterator(); iter
!                 .hasNext();) {
!                 PpsElement element = (PpsElement) iter.next();
!                 logger.debug("  " + element.name);
!             }
!             logger.debug("end of @allowedFirstChildren");
          }
  
!         if (allowedLastChildren != null && allowedLastChildren.size() > 0) {
              logger.debug("@allowedLastChildren: ");
! 
              Set allowedFirstChildrenSet = allowedLastChildren.entrySet();
!             for (Iterator iter = allowedFirstChildrenSet.iterator(); iter
!                 .hasNext();) {
!                 PpsElement element = (PpsElement) iter.next();
!                 logger.debug("  " + element.name);
!             }
!             logger.debug("end of @allowedLastChildren");
          }
  
          if (allowedFollowingSiblingsOfChild != null
!                 && allowedFollowingSiblingsOfChild.size() > 0) {
              displayAllowedFollowingSiblingsOfChild();
          }
***************
*** 465,469 ****
       * Class constants
       */
!        
      // Attribute names
      private static final String ATTR_NAME = "name";
--- 454,458 ----
       * Class constants
       */
! 
      // Attribute names
      private static final String ATTR_NAME = "name";
***************
*** 479,484 ****
      /**
       * XML Tags
!      */   
!    
      private static final String ALLOWED_CHILDREN = "AllowedChilds";
  
--- 468,473 ----
      /**
       * XML Tags
!      */
! 
      private static final String ALLOWED_CHILDREN = "AllowedChilds";
  
***************
*** 492,496 ****
  
      private static final String CHILD = "Child";
!        
      /**
       * Boolean values
--- 481,485 ----
  
      private static final String CHILD = "Child";
! 
      /**
       * Boolean values

Index: PointToPointSchema.java
===================================================================
RCS file: /cvsroot/castore/castore-core/src/java/fr/emn/castor/documents/retro/pointtopointschema/PointToPointSchema.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** PointToPointSchema.java	7 Feb 2006 15:46:10 -0000	1.1.2.4
--- PointToPointSchema.java	6 Mar 2006 16:12:12 -0000	1.1.2.5
***************
*** 60,63 ****
--- 60,64 ----
      /** le logger.*/
      private static Log logger = LogFactory.getLog(PointToPointSchema.class);
+ 
      /**
       * Default constructor
***************
*** 104,110 ****
       *  
       */
!     public void load(){
!     	
! 		Document ppsDoc = XMLUtils.getDocumentFromXMLFile(ppsXMLFilePath);
  
          // Get the node list of this document
--- 105,111 ----
       *  
       */
!     public void load() {
! 
!         Document ppsDoc = XMLUtils.getDocumentFromXMLFile(ppsXMLFilePath);
  
          // Get the node list of this document
***************
*** 112,130 ****
  
          Element ppsRoot = ppsDoc.getRootElement();
!         
          // /PointToPointSchema/AllowedRootElements        
!         Element theAllowedRootElementsNode = ppsRoot.getChild(ALLOWED_ROOT_ELEMENTS, NAMESPACE);
  
-                    
          // populate "allowedRootElements" attribute list; there is only one
          // "AllowRootElements" node
          if (theAllowedRootElementsNode != null)
!         	populateAllowedRootElements(theAllowedRootElementsNode);
  
          // the following nodes are "Element" nodes
          // create a vector containing all "Element" nodes, and only these nodes
!         List ElementsDefinition = ppsRoot.getChildren(ELEMENT_DEFINITION, NAMESPACE);
          int elementsDefinitionCount = ElementsDefinition.size();
!         
          // First pass to create empty PpsElement in order
          // to be able, in a second pass, to create the lists 
--- 113,132 ----
  
          Element ppsRoot = ppsDoc.getRootElement();
! 
          // /PointToPointSchema/AllowedRootElements        
!         Element theAllowedRootElementsNode = ppsRoot.getChild(
!             ALLOWED_ROOT_ELEMENTS, NAMESPACE);
  
          // populate "allowedRootElements" attribute list; there is only one
          // "AllowRootElements" node
          if (theAllowedRootElementsNode != null)
!             populateAllowedRootElements(theAllowedRootElementsNode);
  
          // the following nodes are "Element" nodes
          // create a vector containing all "Element" nodes, and only these nodes
!         List ElementsDefinition = ppsRoot.getChildren(
!             ELEMENT_DEFINITION, NAMESPACE);
          int elementsDefinitionCount = ElementsDefinition.size();
! 
          // First pass to create empty PpsElement in order
          // to be able, in a second pass, to create the lists 
***************
*** 132,139 ****
          // allowedFirstChild, ...) as lists of PPsELement
          PpsElement ppsElem;
!         for (int i = 1; i < elementsDefinitionCount; i++) 
!         {
!         	Element ithElement = (Element) ElementsDefinition.get(i);
!         	String ithElementName = ithElement.getAttributeValue(ATTR_NAME);
              // Create ppsElement for this element
              ppsElem = new PpsElement(this);
--- 134,140 ----
          // allowedFirstChild, ...) as lists of PPsELement
          PpsElement ppsElem;
!         for (int i = 1; i < elementsDefinitionCount; i++) {
!             Element ithElement = (Element) ElementsDefinition.get(i);
!             String ithElementName = ithElement.getAttributeValue(ATTR_NAME);
              // Create ppsElement for this element
              ppsElem = new PpsElement(this);
***************
*** 147,157 ****
          // Second pass to load information from input PointToPointSchema 
          // into PpsElements created in first pass        
!         for (int i = 1; i < elementsDefinitionCount; i++) 
!         {
!           	Element ithElement = (Element) ElementsDefinition.get(i);
!         	String ithElementName = ithElement.getAttributeValue(ATTR_NAME);
!         	ppsElem = (PpsElement) elements.get(ithElementName);
!         	// Load information from input PointToPointSchema
!         	ppsElem.load(ithElement);
          }
      }
--- 148,157 ----
          // Second pass to load information from input PointToPointSchema 
          // into PpsElements created in first pass        
!         for (int i = 1; i < elementsDefinitionCount; i++) {
!             Element ithElement = (Element) ElementsDefinition.get(i);
!             String ithElementName = ithElement.getAttributeValue(ATTR_NAME);
!             ppsElem = (PpsElement) elements.get(ithElementName);
!             // Load information from input PointToPointSchema
!             ppsElem.load(ithElement);
          }
      }
***************
*** 166,174 ****
  
          // <allowedRootElements><element>XXX</element><element>YYY</element></allowedRootElements>
!         List theAllowedRootElementList = theAllowedRootElementsElement.getChildren(ELEMENT, NAMESPACE);
  
!         for (int i = 0; i < theAllowedRootElementList.size(); i++) 
!         {
!             Element ithAllowedRootElement = (Element) theAllowedRootElementList.get(i);
              // Create a PpsElement for this element
              PpsElement ppsElem = new PpsElement(this);
--- 166,175 ----
  
          // <allowedRootElements><element>XXX</element><element>YYY</element></allowedRootElements>
!         List theAllowedRootElementList = theAllowedRootElementsElement
!             .getChildren(ELEMENT, NAMESPACE);
  
!         for (int i = 0; i < theAllowedRootElementList.size(); i++) {
!             Element ithAllowedRootElement = (Element) theAllowedRootElementList
!                 .get(i);
              // Create a PpsElement for this element
              PpsElement ppsElem = new PpsElement(this);
***************
*** 176,188 ****
              ppsElem.load(ithAllowedRootElement);
              // Add it to the "allowedRootElements" attribute list
!             allowedRootElements.put(ithAllowedRootElement.getAttributeValue(ATTR_NAME), ppsElem);
          }
      }
  
      /**
! 	 * getter method for ppsXMLFilePath class member
! 	 * @return
! 	 * @uml.property  name="ppsXMLFilePath"
! 	 */
      public String getPpsXMLFilePath() {
          return ppsXMLFilePath;
--- 177,190 ----
              ppsElem.load(ithAllowedRootElement);
              // Add it to the "allowedRootElements" attribute list
!             allowedRootElements.put(ithAllowedRootElement
!                 .getAttributeValue(ATTR_NAME), ppsElem);
          }
      }
  
      /**
!      * getter method for ppsXMLFilePath class member
!      * @return
!      * @uml.property  name="ppsXMLFilePath"
!      */
      public String getPpsXMLFilePath() {
          return ppsXMLFilePath;
***************
*** 190,197 ****
  
      /**
! 	 * setter method for ppsXMLFilePath class member
! 	 * @param  thePath
! 	 * @uml.property  name="ppsXMLFilePath"
! 	 */
      public void setPpsXMLFilePath(String thePath) {
          ppsXMLFilePath = thePath;
--- 192,199 ----
  
      /**
!      * setter method for ppsXMLFilePath class member
!      * @param  thePath
!      * @uml.property  name="ppsXMLFilePath"
!      */
      public void setPpsXMLFilePath(String thePath) {
          ppsXMLFilePath = thePath;
***************
*** 199,218 ****
  
      /**
! 	 * getter method for allowedRootElements class member
! 	 * @return  the list of the allowed root elements
! 	 * @uml.property  name="allowedRootElements"
! 	 */
!     public Collection getAllowedRootElements() 
!     {
          return allowedRootElements.values();
      }
  
      /**
! 	 * getter method for elements class member
! 	 * @return  the list of the elements
! 	 * @uml.property  name="elements"
! 	 */
!     public Collection getElements() 
!     {
          return elements.values();
      }
--- 201,218 ----
  
      /**
!      * getter method for allowedRootElements class member
!      * @return  the list of the allowed root elements
!      * @uml.property  name="allowedRootElements"
!      */
!     public Collection getAllowedRootElements() {
          return allowedRootElements.values();
      }
  
      /**
!      * getter method for elements class member
!      * @return  the list of the elements
!      * @uml.property  name="elements"
!      */
!     public Collection getElements() {
          return elements.values();
      }
***************
*** 224,236 ****
       */
      public PpsElement getElement(String elementName) {
!     	if (elements.containsKey(elementName))
!     	{
!     		return (PpsElement) elements.get(elementName);
!     	}
!     	else
!     	{
!     		logger.info(ELEMENT_NOT_FOUND + elementName);
!     		return null;
!     	}
      }
  
--- 224,233 ----
       */
      public PpsElement getElement(String elementName) {
!         if (elements.containsKey(elementName)) {
!             return (PpsElement) elements.get(elementName);
!         } else {
!             logger.info(ELEMENT_NOT_FOUND + elementName);
!             return null;
!         }
      }
  
***************
*** 241,263 ****
       *         otherwise
       */
!     public boolean allowedRootElement(String elementName) 
!     {
!     	return allowedRootElements.containsKey(elementName);
      }
!     
!     public static String getName(Element element)
!     {
!     	String name;
!         if (element.getName() == TEXT)
!     	{
!         	name = TEXT_NAME;
!     	}
!     	else
!     	{ 		
!     		name = element.getAttributeValue(ATTR_NAME);
!     	}
          return name;
      }
!     
      public void display() {
          logger.debug("PointToPointSchema");
--- 238,255 ----
       *         otherwise
       */
!     public boolean allowedRootElement(String elementName) {
!         return allowedRootElements.containsKey(elementName);
      }
! 
!     public static String getName(Element element) {
!         String name;
!         if (element.getName() == TEXT) {
!             name = TEXT_NAME;
!         } else {
!             name = element.getAttributeValue(ATTR_NAME);
!         }
          return name;
      }
! 
      public void display() {
          logger.debug("PointToPointSchema");
***************
*** 271,283 ****
       *  
       */
!     private void displayAllowedRootElements() 
!     {
          logger.debug("@allowedRootElements");
!     	for (Iterator iter = allowedRootElements.entrySet().iterator(); iter.hasNext();) 
!     	{
! 			PpsElement element = (PpsElement) iter.next();
! 	        element.display();
! 		}
!     	logger.debug("end of @allowedRootElements");
      }
  
--- 263,274 ----
       *  
       */
!     private void displayAllowedRootElements() {
          logger.debug("@allowedRootElements");
!         for (Iterator iter = allowedRootElements.entrySet().iterator(); iter
!             .hasNext();) {
!             PpsElement element = (PpsElement) iter.next();
!             element.display();
!         }
!         logger.debug("end of @allowedRootElements");
      }
  
***************
*** 286,298 ****
       *  
       */
!     private void displayElements() 
!     {
!     	logger.debug("@elements");    	
!     	for (Iterator iter = elements.entrySet().iterator(); iter.hasNext();) 
!     	{
!     		PpsElement element = (PpsElement) iter.next();
! 	        element.display();
! 		}
!     	logger.debug("end of @elements");
      }
  
--- 277,287 ----
       *  
       */
!     private void displayElements() {
!         logger.debug("@elements");
!         for (Iterator iter = elements.entrySet().iterator(); iter.hasNext();) {
!             PpsElement element = (PpsElement) iter.next();
!             element.display();
!         }
!         logger.debug("end of @elements");
      }
  
***************
*** 301,305 ****
       */
      private static final String ALLOWED_ROOT_ELEMENTS = "AllowedRootElements";
!     
      private static final String ELEMENT_DEFINITION = "ElementDefinition";
  
--- 290,294 ----
       */
      private static final String ALLOWED_ROOT_ELEMENTS = "AllowedRootElements";
! 
      private static final String ELEMENT_DEFINITION = "ElementDefinition";
  
***************
*** 310,320 ****
      // Attribute names
      private static final String ATTR_NAME = "name";
!     
      // XML Tags
      private static final String TEXT = "Text";
!     
      // Misc
      public static final String TEXT_NAME = "_Text";
!     
!     public static Namespace NAMESPACE = Namespace.getNamespace("urn:xgs:names:reverse:xmlns:pps:1.0");
  }
--- 299,310 ----
      // Attribute names
      private static final String ATTR_NAME = "name";
! 
      // XML Tags
      private static final String TEXT = "Text";
! 
      // Misc
      public static final String TEXT_NAME = "_Text";
! 
!     public static Namespace NAMESPACE = Namespace
!         .getNamespace("urn:xgs:names:reverse:xmlns:pps:1.0");
  }




Plus d'informations sur la liste de diffusion Castore-commits