You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by st...@apache.org on 2002/07/09 23:41:34 UTC

cvs commit: xml-cocoon2/src/scratchpad/webapp/samples/slide rdf2html4content.xsl sitemap.xmap

stephan     2002/07/09 14:41:34

  Modified:    src/scratchpad/src/org/apache/cocoon/acting
                        SourceMultiAction.java
               src/scratchpad/src/org/apache/cocoon/components/source/impl
                        SlideSource.java SourceInspectorManager.java
               src/scratchpad/webapp/samples/slide rdf2html4content.xsl
                        sitemap.xmap
  Log:
  The source upload works now with a SourceMultiAction.
  SourceInspectorManager reacts correct now on SourceException from
  SourceInspectors.
  
  Revision  Changes    Path
  1.2       +12 -5     xml-cocoon2/src/scratchpad/src/org/apache/cocoon/acting/SourceMultiAction.java
  
  Index: SourceMultiAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/acting/SourceMultiAction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SourceMultiAction.java	8 Jul 2002 08:15:12 -0000	1.1
  +++ SourceMultiAction.java	9 Jul 2002 21:41:34 -0000	1.2
  @@ -104,6 +104,7 @@
       public final static String PRINCIPAL = "cocoon-principal";
       public final static String PASSWORD = "cocoon-password";
       public final static String UPLOAD_FILE = "cocoon-upload-file";
  +    public final static String SOURCE_FILENAME = "cocoon-source-filename";
   
       File uploadDir = null;
   
  @@ -123,7 +124,7 @@
           Request request = ObjectModelHelper.getRequest(objectModel);
   
           String uri = parameters.getParameter(SOURCE_URI, request.getParameter(SOURCE_URI));
  -        //String filename = parameters.getParameter("filename", request.getParameter("filename"));
  +        String filename = parameters.getParameter(SOURCE_FILENAME, request.getParameter(SOURCE_FILENAME));
           String principal = parameters.getParameter(PRINCIPAL,
                                 request.getParameter(PRINCIPAL));
           String password = parameters.getParameter(PASSWORD,
  @@ -135,7 +136,11 @@
   
               try {
                   if ((uri==null) || (uri.length()==0))
  -                    return EMPTY_MAP;
  +                    uri = filename;
  +                else if (uri.endsWith("/"))
  +                    uri = uri+filename;
  +                else
  +                    uri = uri+"/"+filename;
   
                   Source source = resolver.resolveURI(uri);
   
  @@ -161,9 +166,11 @@
                       throw new ProcessingException("Source isn't writeable");
   
               } catch (SourceException se) {
  -                throw new ProcessingException("Exception occurs while storing the content", se);
  +                getLogger().warn("Exception occurs while storing the content", se);
  +                return null;
               } catch (IOException ioe) {
  -                throw new ProcessingException("Exception occurs while storing the content", ioe);
  +                getLogger().warn("Exception occurs while storing the content", ioe);
  +                return null;
               }
           }
   
  
  
  
  1.11      +5 -3      xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SlideSource.java
  
  Index: SlideSource.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SlideSource.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SlideSource.java	8 Jul 2002 08:39:25 -0000	1.10
  +++ SlideSource.java	9 Jul 2002 21:41:34 -0000	1.11
  @@ -656,8 +656,10 @@
        * Set the credential for the source
        */
       public void setSourceCredential(SourceCredential sourcecredential) throws SourceException {
  -        if (sourcecredential==null)
  -            throw new NullPointerException();
  +        if ((sourcecredential==null) || 
  +            (sourcecredential.getPrincipal()==null) || (sourcecredential.getPrincipal().length()<=0))
  +            return;
  +
           this.sourcecredential = sourcecredential;
           this.credToken = new CredentialsToken(this.sourcecredential.getPrincipal());
           this.slideToken = new SlideTokenImpl(credToken);
  
  
  
  1.4       +15 -10    xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SourceInspectorManager.java
  
  Index: SourceInspectorManager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/source/impl/SourceInspectorManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SourceInspectorManager.java	2 Jul 2002 16:54:25 -0000	1.3
  +++ SourceInspectorManager.java	9 Jul 2002 21:41:34 -0000	1.4
  @@ -235,19 +235,24 @@
           for(int i=0; i<this.inspectors.size(); i++) {
               inspector = (SourceInspector)this.inspectors.get(i);
   
  -            properties = inspector.getSourceProperties(source);
  -            if (properties!=null)
  -                for(int j=0; j<properties.length; j++) {
  -                    propertyExists = false;
  -                    for(int k=0; k<list.size() && !propertyExists; k++) {
  -                        property = (SourceProperty)list.get(k);
  -                        if ((property.getNamespace().equals(properties[j].getNamespace())) &&
  -                            (property.getName().equals(properties[j].getName())))
  -                            propertyExists = true;
  +            try {
  +                properties = inspector.getSourceProperties(source);
  +
  +                if (properties!=null)
  +                    for(int j=0; j<properties.length; j++) {
  +                        propertyExists = false;
  +                        for(int k=0; k<list.size() && !propertyExists; k++) {
  +                            property = (SourceProperty)list.get(k);
  +                            if ((property.getNamespace().equals(properties[j].getNamespace())) &&
  +                                (property.getName().equals(properties[j].getName())))
  +                                propertyExists = true;
                       }
                       if (!propertyExists)
                           list.add(properties[j]);
                   }
  +            } catch (SourceException se) {
  +                getLogger().warn("Couldn't get properties from '"+source.getSystemId()+"'", se);
  +            }
           }
   
           properties = new SourceProperty[list.size()];
  
  
  
  1.5       +7 -5      xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html4content.xsl
  
  Index: rdf2html4content.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html4content.xsl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- rdf2html4content.xsl	8 Jul 2002 08:15:13 -0000	1.4
  +++ rdf2html4content.xsl	9 Jul 2002 21:41:34 -0000	1.5
  @@ -153,8 +153,9 @@
                     select="/rdf:RDF/rdf:Description[@rdf:about=$location]/dav:getlastmodified"/></td>
                   <td align="right">
                    <form action="" method="post">
  -                 <input type="hidden" name="uri" value="{../../@rdf:about}"/>
  -                 <input type="submit" name="cocoon-action-deletenode" value="Delete"/>
  +                  <input type="hidden" name="method" value="deleteSource"/>
  +                  <input type="hidden" name="cocoon-source-uri" value="{../../@rdf:about}"/>
  +                  <input type="submit" name="cocoon-action-deletesource" value="Delete"/>
                    </form>
                   </td>
                  </tr>
  @@ -162,13 +163,14 @@
       
                 <tr>
                  <form method="post" enctype="multipart/form-data">
  -                <input type="hidden" name="uri" value="{@rdf:about}"/>
  +                <input type="hidden" name="method" value="doUploadSource"/>
  +                <input type="hidden" name="cocoon-source-uri" value="{@rdf:about}"/>
                   <td align="left">
  -                 <input name="filename" type="text" size="25" maxlength="40"/>
  +                 <input type="text" name="cocoon-source-filename" size="25" maxlength="40"/>
                   </td>
                   <td align="left" colspan="3">
                    File:
  -                 <input type="file" name="file" size="25" maxlength="40"/>
  +                 <input type="file" name="cocoon-upload-file" size="25" maxlength="40"/>
                   </td>
                   <td align="right">
                    <input type="submit" name="cocoon-action-upload" value="Upload File" />
  
  
  
  1.7       +1 -18     xml-cocoon2/src/scratchpad/webapp/samples/slide/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/sitemap.xmap,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- sitemap.xmap	8 Jul 2002 21:20:30 -0000	1.6
  +++ sitemap.xmap	9 Jul 2002 21:41:34 -0000	1.7
  @@ -1,5 +1,4 @@
   <?xml version="1.0"?>
  -
   <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
    <map:components>
     <map:generators default="file">
  @@ -36,15 +35,6 @@
     <map:selectors default="browser"/>
   
     <map:actions>
  -<!--   <map:action logger="sitemap.action.slide.upload" name="source-upload"
  -               src="org.apache.cocoon.acting.SourceUploadAction"/>
  -   <map:action logger="sitemap.action.slide.addproperty" name="source-addproperty"
  -               src="org.apache.cocoon.acting.SourceAddPropertyAction"/>
  -   <map:action logger="sitemap.action.slide.deleteproperty" name="source-deleteproperty"
  -               src="org.apache.cocoon.acting.SourceDeletePropertyAction"/>
  -   <map:action logger="sitemap.action.slide.deletecontent" name="source-deletecontent"
  -               src="org.apache.cocoon.acting.SourceDeleteContentAction"/>-->
  -
      <map:action logger="sitemap.action.slide" name="source-actions"
                  src="org.apache.cocoon.acting.SourceMultiAction"/>
      <map:action logger="sitemap.action.slide" name="principal-actions"
  @@ -54,13 +44,6 @@
   
      <map:action name="auth-protect" logger="sitemap.action.auth-protect" 
                  src="org.apache.cocoon.webapps.authentication.acting.AuthAction"/>
  -<!--    <handlers>
  -     <handler name="slidehandler" xmlns:map="http://apache.org/cocoon/sitemap/1.0">
  -      <redirect-to    uri="cocoon://samples/slide/login.html"/>
  -      <authentication uri="cocoon://samples/slide/source-authuser"/>
  -     </handler>
  -    </handlers>
  -   </map:action>-->
   
      <map:action name="auth-login" logger="sitemap.action.auth-login"
                  src="org.apache.cocoon.webapps.authentication.acting.LoginAction"/>
  @@ -68,7 +51,6 @@
                  src="org.apache.cocoon.webapps.authentication.acting.LogoutAction"/>
      <map:action name="auth-loggedIn" logger="sitemap.action.auth-loggedIn"
                  src="org.apache.cocoon.webapps.authentication.acting.LoggedInAction"/>
  -
     </map:actions>
   
    </map:components>
  @@ -171,6 +153,7 @@
        <!-- ============= Source content ================== -->
        <map:match pattern="content/**">
         <map:act type="source-actions">
  +       <map:parameter name="method" value="{request:method}"/>
          <map:parameter name="cocoon-source-principal" value="root"/>
         </map:act>
   
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org