lenya/src/java/org/apache/lenya/cms/cocoon/acting DefaultCreatorAction.java,1.2,1.3

Christian Egli <[email protected]> Tue, 20 May 2003 20:25:00 +0200
Newsgroups gmane.comp.cms.wyona.cvs
Message-ID <[email protected]>
Update of /repository/lenya/src/java/org/apache/lenya/cms/cocoon/acting
In directory erbium:/tmp/cvs-serv21589/src/java/org/apache/lenya/cms/cocoon/acting

Modified Files:
	DefaultCreatorAction.java 
Log Message:
As this action is now invoked from the usecase sitemap the old trick
to find the sitemap path doesn't work. Use a Publication and the
PublicationFactory instead.


Index: DefaultCreatorAction.java
===================================================================
RCS file: /repository/lenya/src/java/org/apache/lenya/cms/cocoon/acting/DefaultCreatorAction.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DefaultCreatorAction.java	14 May 2003 10:18:20 -0000	1.2
--- DefaultCreatorAction.java	20 May 2003 18:24:58 -0000	1.3
***************
*** 77,80 ****
--- 77,82 ----
  import org.apache.lenya.cms.publication.DefaultSiteTree;
  import org.apache.lenya.cms.publication.Label;
+ import org.apache.lenya.cms.publication.Publication;
+ import org.apache.lenya.cms.publication.PublicationFactory;
  
  import org.apache.lenya.cms.authoring.ParentChildCreatorInterface;
***************
*** 118,126 ****
      public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String src,
          Parameters parameters) throws Exception {
!         org.apache.cocoon.environment.Source input_source = resolver.resolve("");
!         String sitemapParentPath = input_source.getSystemId();
!         sitemapParentPath = sitemapParentPath.substring(5); // Remove "file:" protocol
! 
!         getLogger().debug(".act(): PARENT PATH OF SITEMAP: " + sitemapParentPath);
  
          // Get request object
--- 120,127 ----
      public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String src,
          Parameters parameters) throws Exception {
! 	
! 	Publication publication = PublicationFactory.getPublication(objectModel);
! 	
!         getLogger().debug(".act(): PARENT PATH OF SITEMAP: " + publication.getDirectory());
  
          // Get request object
***************
*** 169,173 ****
          // Get creator
          ParentChildCreatorInterface creator = null;
!         String absoluteDoctypesPath = sitemapParentPath + doctypesPath;
          Document doctypesDoc = new SAXReader().read("file:" + absoluteDoctypesPath +
                  "doctypes.xconf");
--- 170,175 ----
          // Get creator
          ParentChildCreatorInterface creator = null;
!         String absoluteDoctypesPath = publication.getDirectory() +
! 	    File.separator + doctypesPath;
          Document doctypesDoc = new SAXReader().read("file:" + absoluteDoctypesPath +
                  "doctypes.xconf");
***************
*** 208,216 ****
  	
  	// add a node to the tree
!         getLogger().debug("invoking DefaultSiteTree(" + sitemapParentPath
! 			  + treeAuthoringPath + ")");
  	
! 	DefaultSiteTree siteTree = new DefaultSiteTree(sitemapParentPath +
! 						       treeAuthoringPath);
  	Label[] labels = new Label[1];
   	labels[0] = new Label(childname, null);
--- 210,218 ----
  	
  	// add a node to the tree
!         getLogger().debug("invoking DefaultSiteTree(" + publication.getDirectory() +
! 			  File.separator + treeAuthoringPath + ")");
  	
! 	DefaultSiteTree siteTree = new DefaultSiteTree(new File(publication.getDirectory(),
! 								treeAuthoringPath));
  	Label[] labels = new Label[1];
   	labels[0] = new Label(childname, null);
***************
*** 264,268 ****
  	try {
              creator.create(new File(absoluteDoctypesPath + "samples"),
! 			   new File(sitemapParentPath + docsPath + parentid),
  			   childid, childType, childname, allParameters);
          } catch (Exception e) {
--- 266,270 ----
  	try {
              creator.create(new File(absoluteDoctypesPath + "samples"),
! 			   new File(publication.getDirectory(), docsPath + parentid),
  			   childid, childType, childname, allParameters);
          } catch (Exception e) {