You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2005/10/06 09:20:20 UTC

svn commit: r306548 - in /lenya/trunk/src: java/org/apache/lenya/cms/workflow/ webapp/lenya/pubs/default/config/ webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/publication/templating/

Author: andreas
Date: Thu Oct  6 00:20:05 2005
New Revision: 306548

URL: http://svn.apache.org/viewcvs?rev=306548&view=rev
Log:
Allow URIs as workflow schema locations. It is not necessary to copy workflow files when a publication is instanciated.

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java
    lenya/trunk/src/webapp/lenya/pubs/default/config/publication.xconf
    lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/publication/templating/Instantiator.java

Modified: lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java?rev=306548&r1=306547&r2=306548&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/workflow/DocumentWorkflowable.java Thu Oct  6 00:20:05 2005
@@ -53,7 +53,8 @@
      * @param document The document.
      * @param logger The logger.
      */
-    public DocumentWorkflowable(ServiceManager manager, Session session, Document document, Logger logger) {
+    public DocumentWorkflowable(ServiceManager manager, Session session, Document document,
+            Logger logger) {
         this.document = document;
         this.session = session;
         this.manager = manager;
@@ -61,9 +62,9 @@
     }
 
     private Session session;
-    
+
     private ServiceManager manager;
-    
+
     /**
      * @return The service manager.
      */
@@ -195,24 +196,19 @@
 
         String[] parts = string.split(" ");
         for (int i = 0; i < parts.length; i++) {
-            String[] steps = parts[i].split(":",2);
+            String[] steps = parts[i].split(":", 2);
             if (steps[0].equals("event")) {
                 event = steps[1];
-            }
-            else if (steps[0].equals("state")) {
+            } else if (steps[0].equals("state")) {
                 state = steps[1];
-            }
-            else if (steps[0].equals("user")) {
-            	user = steps[1];
-            }
-            else if (steps[0].equals("date")) {
-            	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss", Locale.US);
-            	date = sdf.parse(steps[1],new ParsePosition(0));
-            }
-            else if (steps[0].equals("machine")) {
-            	machine = steps[1];
-            }
-            else if (steps[0].equals("var")) {
+            } else if (steps[0].equals("user")) {
+                user = steps[1];
+            } else if (steps[0].equals("date")) {
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss", Locale.US);
+                date = sdf.parse(steps[1], new ParsePosition(0));
+            } else if (steps[0].equals("machine")) {
+                machine = steps[1];
+            } else if (steps[0].equals("var")) {
                 String[] nameValue = steps[1].split("=");
                 variables.put(nameValue[0], nameValue[1]);
             }
@@ -236,9 +232,14 @@
         String uri = null;
         String schema = getWorkflowSchema();
         if (schema != null) {
-            uri = this.document.getPublication().getSourceURI() + "/config/workflow/" + schema;
-            uri = uri.substring("lenya://".length());
-            uri = "context://" + uri;
+
+            if (schema.indexOf("://") != -1) {
+                return schema;
+            } else {
+                uri = this.document.getPublication().getSourceURI() + "/config/workflow/" + schema;
+                uri = uri.substring("lenya://".length());
+                uri = "context://" + uri;
+            }
         }
         return uri;
     }

Modified: lenya/trunk/src/webapp/lenya/pubs/default/config/publication.xconf
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/config/publication.xconf?rev=306548&r1=306547&r2=306548&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/config/publication.xconf (original)
+++ lenya/trunk/src/webapp/lenya/pubs/default/config/publication.xconf Thu Oct  6 00:20:05 2005
@@ -28,10 +28,10 @@
   <breadcrumb-prefix/>
   <site-manager name="tree"/>
   
-  <resource-type name="xhtml" workflow="workflow.xml"/>
-  <resource-type name="homepage" workflow="workflow.xml"/>
-  <resource-type name="links" workflow="workflow.xml"/>
-  <resource-type name="search" workflow="workflow.xml"/>
+  <resource-type name="xhtml" workflow="fallback://config/workflow/workflow.xml"/>
+  <resource-type name="homepage" workflow="fallback://config/workflow/workflow.xml"/>
+  <resource-type name="links" workflow="fallback://config/workflow/workflow.xml"/>
+  <resource-type name="search" workflow="fallback://config/workflow/workflow.xml"/>
   
   <module name="xhtml"/>
   <module name="links"/>

Modified: lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/publication/templating/Instantiator.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/publication/templating/Instantiator.java?rev=306548&r1=306547&r2=306548&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/publication/templating/Instantiator.java (original)
+++ lenya/trunk/src/webapp/lenya/pubs/default/java/src/org/apache/lenya/defaultpub/cms/publication/templating/Instantiator.java Thu Oct  6 00:20:05 2005
@@ -53,8 +53,7 @@
 
     protected static final String[] sourcesToCopy = { "publication.xml",
             "config/publication.xconf", "config/ac/passwd/", "config/ac/ac.xconf",
-            "config/ac/policies/", "config/ac/usecase-policies.xml",
-            "config/workflow/workflow.xml", "content/" };
+            "config/ac/policies/", "config/ac/usecase-policies.xml", "content/" };
 
     /**
      * @see org.apache.lenya.cms.publication.templating.Instantiator#instantiate(org.apache.lenya.cms.publication.Publication,
@@ -97,7 +96,8 @@
             configSource = (ModifiableSource) resolver.resolveURI(publicationsUri + "/"
                     + newPublicationId + "/config/publication.xconf");
             DefaultConfiguration config = (DefaultConfiguration) new DefaultConfigurationBuilder().build(configSource.getInputStream());
-            DefaultConfiguration templatesConfig = (DefaultConfiguration) config.getChild("templates", false);
+            DefaultConfiguration templatesConfig = (DefaultConfiguration) config.getChild("templates",
+                    false);
             if (templatesConfig == null) {
                 templatesConfig = new DefaultConfiguration("templates");
                 config.addChild(templatesConfig);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org