portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bl...@apache.org
Subject cvs commit: jakarta-pluto/portal/src/java/org/apache/pluto/portalImpl Deploy.java
Date Thu, 29 Jul 2004 13:46:30 GMT
blumm       2004/07/29 06:46:30

  Modified:    portal/src/java/org/apache/pluto/portalImpl/om/servlet/impl
                        WebApplicationDefinitionImpl.java
               portal/src/webapp/WEB-INF/data/xml
                        servletdefinitionmapping.xml
               portal/src/java/org/apache/pluto/portalImpl/xml
                        XmlParser.java
               portal/src/java/org/apache/pluto/portalImpl Deploy.java
  Added:       portal/src/java/org/apache/pluto/portalImpl/om/servlet/impl
                        TagDefinitionSet.java ResourceRef.java
  Log:
  Changes made to Pluto to swallow WSAD generated JSR168 war files:
  
   [1] Ignore extra elements and attributes in Web.xml and do not do validation while parsing
the document.
  
  [2] Modified code for handling of multiple <taglib>s.
  
  [3] Added code to handle <resource-ref> tag.
  
  Submitted by: 	  Yongcheng Li/ycli@us.ibm.com
  
  Revision  Changes    Path
  1.6       +42 -30    jakarta-pluto/portal/src/java/org/apache/pluto/portalImpl/om/servlet/impl/WebApplicationDefinitionImpl.java
  
  Index: WebApplicationDefinitionImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-pluto/portal/src/java/org/apache/pluto/portalImpl/om/servlet/impl/WebApplicationDefinitionImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- WebApplicationDefinitionImpl.java	7 Jun 2004 13:21:42 -0000	1.5
  +++ WebApplicationDefinitionImpl.java	29 Jul 2004 13:46:30 -0000	1.6
  @@ -49,20 +49,20 @@
   
   
       // <not used variables - only for castor>
  -    public String icon;
  -    public String distributable;
  -    public String sessionConfig;
  -    public String mimeMapping;
  -    public String welcomeFileList;
  -    public String errorPage;
  -    public String resourceRef;
  -    public String securityConstraint;
  -    public String loginConfig;
  -    public String securityRole;
  -    public String envEntry;
  -    public String ejbRef;
  -    private Collection castorMimeMappings = new ArrayList();
  -    // </not used variables - only for castor>
  +    public String icon = null;
  +    public String distributable = null;
  +    public String sessionConfig = null;
  +    public String mimeMapping = null;
  +    public String welcomeFileList = null;
  +    public String errorPage = null;
  +    public String taglib = null;
  +    public String resourceRef = null;
  +    public String securityConstraint = null;
  +    public String loginConfig = null;
  +    public String securityRole = null;
  +    public String envEntry = null;
  +    public String ejbRef = null;
  +    private Collection castorMimeMappings = new ArrayList();    // </not used variables
- only for castor>
   
   
       private String contextPath = null;        
  @@ -74,7 +74,12 @@
       private Collection servletMappings = new ArrayList();
       private ServletDefinitionList servlets = new ServletDefinitionListImpl();
       private SecurityRoleSet securityRoles = new org.apache.pluto.portalImpl.om.common.impl.SecurityRoleSetImpl();
  -    private Collection castorTagDefinitions = new ArrayList();
  +
  +    // modified by YCLI: START :: to handle multiple taglib tags and resource-ref tag
  +    // private TagDefinition castorTagDefinition = new TagDefinition();
  +    private TagDefinitionSet taglibs = new TagDefinitionSet();
  +    private ResourceRef castorResourceRef = new ResourceRef();
  +    // modified by YCLI: END
   
       // WebApplicationDefinition implementation.
       
  @@ -293,15 +298,6 @@
               buffer.append(((ServletMappingImpl)iterator.next()).toString(indent+2));
           }
   
  -        iterator = castorTagDefinitions.iterator();
  -        if (iterator.hasNext()) {
  -            StringUtils.newLine(buffer,indent);
  -            buffer.append("CastorTagDefinitions:");
  -        }
  -        while (iterator.hasNext()) {
  -            buffer.append(((TagDefinitionImpl)iterator.next()).toString(indent+2));
  -        }
  -
           StringUtils.newLine(buffer,indent);
           buffer.append("contextPath='"); buffer.append(contextPath); buffer.append("'");
           StringUtils.newLine(buffer,indent);
  @@ -312,16 +308,32 @@
       /**
        * @return
        */
  +
  +    // modified by YCLI: START :: handling multiple taglib tags and resource-ref tag
  +
  +    public TagDefinitionSet getTagDefinitionSet()
  +    {
  +        return taglibs;
  +    }
  +
       public Collection getCastorTagDefinitions() {
  -        return castorTagDefinitions;
  +        return (TagDefinitionSet) taglibs;
       }
   
  -    /**
  -     * @param definition
  -     */
  -    public void setCastorTagDefinitions(Collection definition) {
  -        castorTagDefinitions = definition;
  +    public void setCastorTagDefinitions(TagDefinitionSet taglibs)
  +    {
  +        this.taglibs = taglibs;
       }
  +
  +    public ResourceRef getResourceRef() {
  +        return castorResourceRef;
  +    }
  +
  +    public void setResourceRef(ResourceRef resourceRef) {
  +        castorResourceRef = resourceRef;
  +    }
  +    // modified by YCLI: END
  +
       /**
        * @return Returns the castorMimeMappings.
        */
  
  
  
  1.1                  jakarta-pluto/portal/src/java/org/apache/pluto/portalImpl/om/servlet/impl/TagDefinitionSet.java
  
  Index: TagDefinitionSet.java
  ===================================================================
  /*
   * Copyright 2003,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /* 
  
   */
  
  package org.apache.pluto.portalImpl.om.servlet.impl;
  
  import java.util.Iterator;
  import java.util.Locale;
  
  import org.apache.pluto.portalImpl.om.common.AbstractSupportSet;
  import org.apache.pluto.portalImpl.om.common.Support;
  import org.apache.pluto.util.StringUtils;
  
  public class TagDefinitionSet extends AbstractSupportSet implements java.io.Serializable,
Support {
  
      // DescriptionSet implemenation.
      public TagDefinition get(Locale locale)
      {        
  	return null;
      }
  
      // Support implementation.
      
      /* (non-Javadoc)
       * @see org.apache.pluto.portalImpl.om.common.Support#postBuild(Object)
       */
      public void postBuild(Object parameter) throws Exception {
      }
  
      /* (non-Javadoc)
       * @see org.apache.pluto.portalImpl.om.common.Support#postLoad(Object)
       */
      public void postLoad(Object parameter) throws Exception {
      }
  
      /* (non-Javadoc)
       * @see org.apache.pluto.portalImpl.om.common.Support#postStore(Object)
       */
      public void postStore(Object parameter) throws Exception {
      }
  
      /* (non-Javadoc)
       * @see org.apache.pluto.portalImpl.om.common.Support#preBuild(Object)
       */
      public void preBuild(Object parameter) throws Exception {
      }
  
      /* (non-Javadoc)
       * @see org.apache.pluto.portalImpl.om.common.Support#preStore(Object)
       */
      public void preStore(Object parameter) throws Exception {
      }
  
      // additional methods
  
  
      public String toString()
      {
          return toString(0);
      }
  
      public String toString(int indent)
      {
  /*
          StringBuffer buffer = new StringBuffer(50);
          StringUtils.newLine(buffer,indent);
          buffer.append(getClass().toString());
          buffer.append(": ");
          Iterator iterator = this.iterator();
          while (iterator.hasNext()) {
              buffer.append(((TagDefinition)iterator.next()).toString(indent+2));
          }
          return buffer.toString();
  */
  	return null;
      }
  
  }
  
  
  
  1.1                  jakarta-pluto/portal/src/java/org/apache/pluto/portalImpl/om/servlet/impl/ResourceRef.java
  
  Index: ResourceRef.java
  ===================================================================
  /*
   * Copyright 2003,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  /* 
   * (C) Copyright IBM Corp. 2003 
   */
  package org.apache.pluto.portalImpl.om.servlet.impl;
  
  public class ResourceRef  {
      
      private String description = "my description";
      private String name = "name";
      private String type = "type";
      private String auth = "container";
      private String sharing = "shareable";
      
      /**
       * @return
       */
      public String getDescription() {
          return description;
      }
  
      /**
       * @return
       */
      public String getName() {
          return name;
      }
  
      public String getType() {
          return type;
      }
  
      public String getAuth() {
          return auth;
      }
  
      public String getSharing() {
          return sharing;
      }
  
      /**
       * @param string
       */
      public void setDescription(String string) {
          description = string;
      }
  
      /**
       * @param string
       */
      public void setName(String string) {
          name = string;
      }
  
      public void setType(String string) {
          type = string;
      }
  
      public void setAuth(String string) {
          auth = string;
      }
  
      public void setSharing(String string) {
          sharing = string;
      }
  
  }
  
  
  
  1.6       +29 -3     jakarta-pluto/portal/src/webapp/WEB-INF/data/xml/servletdefinitionmapping.xml
  
  Index: servletdefinitionmapping.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-pluto/portal/src/webapp/WEB-INF/data/xml/servletdefinitionmapping.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- servletdefinitionmapping.xml	7 Jun 2004 13:21:42 -0000	1.5
  +++ servletdefinitionmapping.xml	29 Jul 2004 13:46:30 -0000	1.6
  @@ -40,6 +40,30 @@
   
     </class>
     
  +  <class name="org.apache.pluto.portalImpl.om.servlet.impl.ResourceRef">
  +
  +    <field name="description" type="java.lang.String" required="false">
  +      <bind-xml name="description" node="element"/>
  +    </field>
  +
  +    <field name="name" type="java.lang.String" required="false">
  +      <bind-xml name="res-ref-name" node="element"/>
  +    </field>
  +
  +    <field name="type" type="java.lang.String" required="false">
  +      <bind-xml name="res-type" node="element"/>
  +    </field>
  +
  +    <field name="auth" type="java.lang.String" required="false">
  +      <bind-xml name="res-auth" node="element"/>
  +    </field>
  +
  +    <field name="sharing" type="java.lang.String" required="false">
  +      <bind-xml name="res-sharing-scope" node="element"/>
  +    </field>
  +
  +  </class>
  +  
     <class name="org.apache.pluto.portalImpl.om.servlet.impl.MimeTypeImpl">
   
       <field name="extension" type="java.lang.String" required="true">
  @@ -208,6 +232,11 @@
          <bind-xml name="taglib" node="element" />
       </field>
   
  +    <field name="resourceRef" 
  +	type="org.apache.pluto.portalImpl.om.servlet.impl.ResourceRef"> 
  +        <bind-xml name="resource-ref" node="element"/>
  +    </field>
  +
       <!-- only for completion, not used in class file -->
       <field name="icon" transient="true" direct="true">
           <bind-xml name="icon" node="element"/>
  @@ -232,9 +261,6 @@
           <bind-xml name="error-page" node="element"/>
       </field>
       
  -    <field name="resourceRef" transient="true" direct="true">
  -        <bind-xml name="resource-ref" node="element"/>
  -    </field>
       <field name="securityConstraint" transient="true" direct="true">
           <bind-xml name="security-constraint" node="element"/>
       </field>
  
  
  
  1.3       +3 -1      jakarta-pluto/portal/src/java/org/apache/pluto/portalImpl/xml/XmlParser.java
  
  Index: XmlParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-pluto/portal/src/java/org/apache/pluto/portalImpl/xml/XmlParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XmlParser.java	2 Mar 2004 14:48:58 -0000	1.2
  +++ XmlParser.java	29 Jul 2004 13:46:30 -0000	1.3
  @@ -75,7 +75,9 @@
                                                          Constants.RES_WEB_DTD,
                                                          Constants.RES_WEB_DTD_NAME));
               
  -        domParser.setFeature("http://xml.org/sax/features/validation", true);
  +	// modified by YCLI: START :: do not do validation for web.xml
  +        domParser.setFeature("http://xml.org/sax/features/validation", false);
  +	// modified by YCLI: END 
           domParser.setFeature("http://apache.org/xml/features/dom/include-ignorable-whitespace",
false);
   
           InputSource source = new InputSource( webXml );
  
  
  
  1.9       +12 -1     jakarta-pluto/portal/src/java/org/apache/pluto/portalImpl/Deploy.java
  
  Index: Deploy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-pluto/portal/src/java/org/apache/pluto/portalImpl/Deploy.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Deploy.java	9 Jul 2004 10:35:26 -0000	1.8
  +++ Deploy.java	29 Jul 2004 13:46:30 -0000	1.9
  @@ -189,6 +189,12 @@
                   XmlParser.parsePortletXml(new FileInputStream(portletXml));
   
               Unmarshaller unmarshaller = new Unmarshaller(mappingPortletXml);
  +
  +            // modified by YCLI: START :: to ignore extra elements and attributes
  +            unmarshaller.setIgnoreExtraElements(true);
  +            unmarshaller.setIgnoreExtraAttributes(true);
  +            // modified by YCLI: END 
  +
               PortletApplicationDefinitionImpl portletApp =
                   (PortletApplicationDefinitionImpl) unmarshaller.unmarshal(
                       portletDocument);
  @@ -213,7 +219,12 @@
                       XmlParser.parseWebXml(new FileInputStream(webXml));
   
                   Unmarshaller unmarshallerWeb = new Unmarshaller(mappingWebXml);
  -    			unmarshallerWeb.setIgnoreExtraElements(true);
  +
  +                // modified by YCLI: START :: to ignore extra elements and attributes
  +                unmarshallerWeb.setIgnoreExtraElements(true);
  +                unmarshallerWeb.setIgnoreExtraAttributes(true);
  +                // modified by YCLI: END 
  +
                   webApp =
                       (WebApplicationDefinitionImpl) unmarshallerWeb.unmarshal(
                           webDocument);
  
  
  

Mime
View raw message