portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r550717 - in /portals/jetspeed-2/trunk: applications/demo/src/webapp/WEB-INF/ applications/gems/src/java/org/apache/portals/gems/file/ applications/j2-admin/src/java/org/apache/jetspeed/portlets/site/ applications/j2-admin/src/webapp/WEB-IN...
Date Tue, 26 Jun 2007 07:06:45 GMT
Author: taylor
Date: Tue Jun 26 00:06:44 2007
New Revision: 550717

URL: http://svn.apache.org/viewvc?view=rev&rev=550717
Log:
https://issues.apache.org/jira/browse/JS2-716
contribution from Vivek Kumar

Added:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/ajax-xml/export.vm
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/ExportObject.java
    portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/importer-page-manager.xml
Modified:
    portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml
    portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/file/FilePortlet.java
    portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/jetspeed-portlet.xml
    portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/site/site-view.vm
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/CommonPortletServices.java
    portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/ajax-layout.xml
    portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/jetspeed-services.xml

Modified: portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml?view=diff&rev=550717&r1=550716&r2=550717
==============================================================================
--- portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml (original)
+++ portals/jetspeed-2/trunk/applications/demo/src/webapp/WEB-INF/portlet.xml Tue Jun 26 00:06:44 2007
@@ -875,6 +875,10 @@
             <mime-type>application/zip</mime-type>
             <portlet-mode>VIEW</portlet-mode>
         </supports>
+         <supports>
+            <mime-type>text/xml</mime-type>
+            <portlet-mode>VIEW</portlet-mode>
+        </supports>	       
         <supports>
             <mime-type>text/csv</mime-type>
             <portlet-mode>VIEW</portlet-mode>

Modified: portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/file/FilePortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/file/FilePortlet.java?view=diff&rev=550717&r1=550716&r2=550717
==============================================================================
--- portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/file/FilePortlet.java (original)
+++ portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/file/FilePortlet.java Tue Jun 26 00:06:44 2007
@@ -25,13 +25,15 @@
 import javax.portlet.PortletConfig;
 import javax.portlet.PortletException;
 import javax.portlet.PortletPreferences;
+import javax.portlet.PortletRequest;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
+import javax.servlet.http.HttpServletRequest;
 
 import org.apache.jetspeed.PortalReservedParameters;
+import org.apache.jetspeed.request.RequestContext;
 import org.apache.portals.bridges.common.GenericServletPortlet;
 
-
 /**
  * FilePortlet
  * 
@@ -40,6 +42,7 @@
  */
 public class FilePortlet extends GenericServletPortlet
 {
+
     /**
      * Name of portlet preference for source file url
      */
@@ -56,12 +59,13 @@
     public static final String PARAM_SOURCE_FILE_PATH = "filepath";
 
     /**
-     * Is the file stored in the webapp or outside of the webapp?
-     * valid values "webapp" and "filesystem", defaults to webapp
+     * Is the file stored in the webapp or outside of the webapp? valid values
+     * "webapp" and "filesystem", defaults to webapp
      */
     public static final String PARAM_LOCATION = "location";
+
     private boolean webappLocation = true;
-    
+
     /**
      * Default URL for the source file
      */
@@ -72,12 +76,12 @@
      */
     private String defaultSourceBasePath = null;
 
-    public void init(PortletConfig config)
-        throws PortletException
+    public void init(PortletConfig config) throws PortletException
     {
         super.init(config);
         this.defaultSourceFile = config.getInitParameter(PARAM_SOURCE_FILE);
-        this.defaultSourceBasePath = config.getInitParameter(PARAM_SOURCE_BASE_PATH);
+        this.defaultSourceBasePath = config
+                .getInitParameter(PARAM_SOURCE_BASE_PATH);
         String location = config.getInitParameter(PARAM_LOCATION);
         if (location != null && location.equals("filesystem"))
             webappLocation = false;
@@ -85,48 +89,97 @@
             webappLocation = true;
     }
 
+    private RequestContext getRequestContext(PortletRequest request)
+    {
+        return (RequestContext) request
+                .getAttribute(PortalReservedParameters.REQUEST_CONTEXT_ATTRIBUTE);
+
+    }
+
+    private HttpServletRequest getHttpServletRequest(PortletRequest pRequest)
+    {
+        return getRequestContext(pRequest).getRequest();
+
+    }
 
     public void doView(RenderRequest request, RenderResponse response)
-    throws PortletException, IOException
+            throws PortletException, IOException
     {
         // NOTE: this is Jetspeed specific
-        String path = (String)request.getAttribute(PortalReservedParameters.PATH_ATTRIBUTE);
-        if (null == path)
+        HttpServletRequest req = getHttpServletRequest(request);
+        String fileName = (String) req.getSession().getAttribute("file");
+        if (fileName != null && !fileName.equals(""))
         {
-            PortletPreferences prefs = request.getPreferences();
-            path = prefs.getValue(PARAM_SOURCE_FILE, this.defaultSourceFile);
-        }
-        
-        if (null == path && this.defaultSourceBasePath != null )
+            InputStream is = null;
+            try
+            {
+                fileName = getFilePath(fileName);
+                is = new FileInputStream(fileName);
+                if (is == null)
+                {
+                    byte[] bytes = ("File " + fileName + " not found.")
+                            .getBytes();
+                    response.getPortletOutputStream().write(bytes);
+                    return;
+                }
+                setContentType(fileName, response);
+                drain(is, response.getPortletOutputStream());
+                response.getPortletOutputStream().flush();
+                is.close();
+                req.getSession().removeAttribute("file");
+            } catch (Exception e)
+            {
+                if (is != null) is.close();
+                byte[] bytes = ("File " + fileName + " not found.").getBytes();
+                req.getSession().removeAttribute("file");
+                response.setContentType("text/html");
+                response.getPortletOutputStream().write(bytes);
+                return;
+            }
+        } else
         {
-            String filepath = request.getParameter(PARAM_SOURCE_FILE_PATH);
-            if (filepath == null)
+            String path = (String) request
+                    .getAttribute(PortalReservedParameters.PATH_ATTRIBUTE);
+            if (null == path)
             {
-                filepath = (String)request.getAttribute(PARAM_SOURCE_FILE_PATH);
+                PortletPreferences prefs = request.getPreferences();
+                path = prefs
+                        .getValue(PARAM_SOURCE_FILE, this.defaultSourceFile);
             }
 
-            if (filepath != null)
+            if (null == path && this.defaultSourceBasePath != null)
             {
-                path = ( ( this.defaultSourceBasePath.length() > 0 ) ? ( this.defaultSourceBasePath + "/" ) : "" ) + filepath;
+                String filepath = request.getParameter(PARAM_SOURCE_FILE_PATH);
+                if (filepath == null)
+                {
+                    filepath = (String) request
+                            .getAttribute(PARAM_SOURCE_FILE_PATH);
+                }
+
+                if (filepath != null)
+                {
+                    path = ((this.defaultSourceBasePath.length() > 0) ? (this.defaultSourceBasePath + "/")
+                            : "")
+                            + filepath;
+                }
             }
-        }
 
-        if (null == path)
-        {
-            response.setContentType("text/html");
-            response.getWriter().println("Could not find source document.");            
-        }
-        else
-        {
-            // default to 'content' area
-            File temp = new File(path);
-            if (webappLocation)
+            if (null == path)
             {
-                path = "/WEB-INF/" + temp.getPath();            
+                response.setContentType("text/html");
+                response.getWriter().println("Could not find source document.");
+            } else
+            {
+                // default to 'content' area
+                File temp = new File(path);
+                if (webappLocation)
+                {
+                    path = "/WEB-INF/" + temp.getPath();
+                }
+                setContentType(path, response);
+                renderFile(response, path);
             }
-            setContentType(path, response);        
-            renderFile(response, path);
-        }        
+        }
     }
 
     protected void setContentType(String path, RenderResponse response)
@@ -135,57 +188,53 @@
         if (path.endsWith(".html"))
         {
             response.setContentType("text/html");
-        }
-        else if (path.endsWith(".pdf"))
+        } else if (path.endsWith(".pdf"))
         {
             response.setContentType("application/pdf");
-        }
-        else if (path.endsWith(".zip"))
+        } else if (path.endsWith(".zip"))
         {
             response.setContentType("application/zip");
-        }
-        else if (path.endsWith(".csv"))
+        } else if (path.endsWith(".csv"))
         {
             response.setContentType("text/csv");
-        }
-        else if (path.endsWith(".xml") || path.endsWith(".xsl"))
+        } else if (path.endsWith(".xml") || path.endsWith(".xsl"))
         {
             response.setContentType("text/xml");
-        }
-        else
+        } else if (path.endsWith(".psml") || path.endsWith(".link"))
+        {
+            response.setContentType("text/xml");
+        } else
         {
             response.setContentType("text/html");
         }
     }
-    
+
     protected void renderFile(RenderResponse response, String fileName)
-    throws PortletException, IOException
+            throws PortletException, IOException
     {
         InputStream is = null;
-        
+
         if (this.webappLocation)
         {
             is = this.getPortletContext().getResourceAsStream(fileName);
-        }
-        else
+        } else
         {
             is = new FileInputStream(fileName);
         }
         if (is == null)
         {
-            byte [] bytes = ("File " + fileName + " not found.").getBytes();
+            byte[] bytes = ("File " + fileName + " not found.").getBytes();
             response.getPortletOutputStream().write(bytes);
             return;
         }
         drain(is, response.getPortletOutputStream());
         response.getPortletOutputStream().flush();
-        is.close();        
+        is.close();
     }
-    
-    
-    static final int BLOCK_SIZE=4096;
 
-    public static void drain(InputStream r,OutputStream w) throws IOException
+    static final int BLOCK_SIZE = 4096;
+
+    public static void drain(InputStream r, OutputStream w) throws IOException
     {
         byte[] bytes = new byte[BLOCK_SIZE];
         try
@@ -199,12 +248,20 @@
                 }
                 length = r.read(bytes);
             }
-        }
-        finally
+        } finally
         {
             bytes = null;
         }
     }
-   
-    
+
+    private String getFilePath(String path)
+    {
+        String pageRoot = System.getProperty("java.io.tmpdir");
+        String sep = System.getProperty("file.separator");
+        if (sep == null || sep.equals("")) sep = "/";
+
+        String ar[] = path.split("_");
+        if (ar.length == 1) return pageRoot + sep + path;
+        return pageRoot + sep + ar[0] + sep + ar[1];
+    }
 }

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java?view=diff&rev=550717&r1=550716&r2=550717
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/site/PortalSiteManager.java Tue Jun 26 00:06:44 2007
@@ -16,7 +16,11 @@
  */
 package org.apache.jetspeed.portlets.site;
 
+import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
+import java.util.Iterator;
+
 import javax.portlet.ActionRequest;
 import javax.portlet.ActionResponse;
 import javax.portlet.PortletConfig;
@@ -24,6 +28,9 @@
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
 
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.fileupload.portlet.PortletFileUpload;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.CommonPortletServices;
@@ -32,6 +39,8 @@
 import org.apache.jetspeed.decoration.DecorationFactory;
 import org.apache.jetspeed.headerresource.HeaderResource;
 import org.apache.jetspeed.om.folder.Folder;
+import org.apache.jetspeed.om.page.Link;
+import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.page.PageManager;
 import org.apache.jetspeed.request.RequestContext;
 import org.apache.portals.gems.dojo.AbstractDojoVelocityPortlet;
@@ -60,6 +69,7 @@
     public final static String JSROOT = "jsroot";   
     public static final String ALL_SECURITY_REFS = "allSecurityRefs";
     
+	protected PageManager castorPageManager;
     
     public void init(PortletConfig config)
     throws PortletException 
@@ -82,8 +92,13 @@
         {
             PortletException pe = new PortletException("Failed to find the Decoration Factory on SiteViewController initialization");
             throw new RuntimeException(pe);             
-        }                
-        
+        }
+        castorPageManager = (PageManager) getPortletContext().getAttribute(CommonPortletServices.CPS_IMPORTER_MANAGER);
+        if (null == castorPageManager) {
+            PortletException pe = new PortletException(
+                    "Failed to find the castorPageManager on SiteViewController initialization");
+            throw new RuntimeException(pe);
+        }
     }
     
     public void doView(RenderRequest request, RenderResponse response)
@@ -183,9 +198,65 @@
     public void processAction(ActionRequest request, ActionResponse actionResponse) throws PortletException, java.io.IOException
     {
         String add = request.getParameter("Save");
+        String fileName ="";
+        String baseName="";
+        String destPath="";
+        String fileType="";
+
         if (add != null)
         { 
             processPreferencesAction(request, actionResponse);
+        } else {
+            try {
+                DiskFileItemFactory diskFileItemFactory = new DiskFileItemFactory();
+                PortletFileUpload portletFileUpload = new PortletFileUpload(diskFileItemFactory);
+                if (PortletFileUpload.isMultipartContent(request)) {
+                    Iterator fileIt = portletFileUpload.parseRequest(request).iterator();
+                    while (fileIt.hasNext()) {
+                        FileItem fileItem = (FileItem) fileIt.next();
+                        if (fileItem.getFieldName().equals("psmlFile")) {
+                            synchronized (this) {
+                                fileName = fileItem.getName();
+                                String folder = getTempFolder(request);
+                                String path = System.getProperty("file.separator");
+                                String filePath = folder + path + fileItem.getName();
+                                FileOutputStream out = new FileOutputStream(filePath);
+                                out.write(fileItem.get());
+                                out.close();
+                            }
+                        }else if(fileItem.isFormField() && fileItem.getFieldName().equalsIgnoreCase("newName")){
+                            baseName = fileItem.getString();
+                        }else if(fileItem.isFormField() && fileItem.getFieldName().equalsIgnoreCase("importPath")){
+                            destPath= fileItem.getString();
+                        }else if(fileItem.isFormField() && fileItem.getFieldName().equalsIgnoreCase("fileType")){
+                            fileType= fileItem.getString();
+                        }   
+                    }
+                    if (fileType != null && !fileType.equals("")&& baseName != null && !baseName.equals("") && destPath != null && !destPath.equals("")) {
+                        Folder folder = castorPageManager.getFolder(request.getUserPrincipal().toString());
+                        if(fileType.equalsIgnoreCase("psml")){
+                            Page source = folder.getPage(fileName);
+                            Page page = pageManager.copyPage(source, destPath + "/" + baseName);
+                            pageManager.updatePage(page);                           
+                        }else if(fileType.equalsIgnoreCase("link")){
+                            Link source = folder.getLink(fileName);
+                            Link page = pageManager.copyLink(source, destPath + "/" + baseName);
+                            pageManager.updateLink(page);                           
+                        }
+
+                    }
+                }
+            } catch (Exception e) {
+                // TODO: handle exception
+            }
         }
+
     }    
+	private String getTempFolder(ActionRequest request) {
+		String dir = System.getProperty("java.io.tmpdir");
+		String path = System.getProperty("file.separator");
+		File file = new File(dir + path + request.getUserPrincipal());
+		file.mkdir();
+		return dir + path + request.getUserPrincipal();
+    }
 }

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/jetspeed-portlet.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/jetspeed-portlet.xml?view=diff&rev=550717&r1=550716&r2=550717
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/jetspeed-portlet.xml (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/jetspeed-portlet.xml Tue Jun 26 00:06:44 2007
@@ -133,6 +133,7 @@
         <js:service name='SecurityAccessController'/>  
         <js:service name='PortletTrackingManager'/>     
         <js:service name='PortalConfiguration'/>
+        <js:service name='ImporterManager'/>
 	</js:services>
 
 </portlet-app>

Modified: portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/site/site-view.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/site/site-view.vm?view=diff&rev=550717&r1=550716&r2=550717
==============================================================================
--- portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/site/site-view.vm (original)
+++ portals/jetspeed-2/trunk/applications/j2-admin/src/webapp/WEB-INF/view/site/site-view.vm Tue Jun 26 00:06:44 2007
@@ -20,6 +20,7 @@
 #set($rooturl = "${req.scheme}://${req.serverName}:${req.serverPort}${req.contextPath}/")
 #set($treeName = $renderRequest.getParameter("treeName"))
 #set($renderURL = $renderResponse.createRenderURL())
+#set($actionURL = $renderResponse.createActionURL())
   <div dojoType="dialog" id="CopyResourceDialog" bgColor="grey" bgOpacity="0.5" toggle="fade" toggleDuration="250" >
     <form onsubmit="return false;">
     <table>
@@ -572,7 +573,8 @@
         ajaxInvoke("getfolder", names, values, new FolderHandler() );     
         dojo.widget.byId( "saveFInfoButton" ).setDisabled(true);
         dojo.widget.byId( "revertFInfoButton" ).setDisabled(true);
-        displayTabs( [ "infoTabFolder", "securityTab", "metaTab", "menusTab", "orderTab" ] );
+        displayTabs( [ "infoTabFolder", "securityTab", "metaTab", "menusTab", "orderTab","import","export"] );
+		populateImport(node);		
     }
     if ( node.object == "Page" )
     {
@@ -581,7 +583,7 @@
         ajaxInvoke("getpage", names, values, new PageHandler() );     
         dojo.widget.byId( "savePInfoButton" ).setDisabled(true);
         dojo.widget.byId( "revertPInfoButton" ).setDisabled(true);
-        displayTabs( [ "infoTabPage", "securityTab", "metaTab" ] );
+        displayTabs( [ "infoTabPage", "securityTab", "metaTab","export" ] );
     }
     else if ( node.object == "Link" )
     {
@@ -589,10 +591,33 @@
         var values = new Array(node.widgetId);
         ajaxInvoke("getlink", names, values, new LinkHandler() );         
         dojo.widget.byId( "saveLInfoButton" ).setDisabled(true);
-        dojo.widget.byId( "revertLInfoButton" ).setDisabled(true);
-        displayTabs( [ "infoTabLinks", "securityTab", "metaTab" ] );
+        dojo.widget.byId( "revertLInfoButton" ).setDisabled(true);        
+		displayTabs( [ "infoTabLinks", "securityTab", "metaTab","export" ] );
     }
+	populateExport(node);
+}
+
+function populateImport(node)
+{
+	document.getElementById('importPath').value = node.widgetId;    
+}
+function populateExport(node)
+{
+	document.getElementById("exportAns").innerHTML = '';
+	if ( node.object == "Folder" )
+    {
+		document.getElementById('exptRecurs').style.display = 'block';
+	}
+	else
+	{
+		document.getElementById('exptRecurs').style.display = 'none';
+	}
+	document.getElementById('exportObject').value = node.title;
+	document.getElementById('objName').value = node.title;
+	document.getElementById('objType').value = node.object;
+	document.getElementById('objPath').value = node.widgetId;    
 }
+
 function validateNewField()
 {
     dojo.widget.byId("res.save").setDisabled(disableNewSave());    
@@ -1610,6 +1635,68 @@
 <p>Coming soon...</p>
 </div> <!-- End Tab Order -->
 
+	<div id="import" dojoType="ContentPane" label="Import">
+		<form action="$actionURL" method="post" name="importObject" enctype="multipart/form-data">
+		<table class="formAnswer" style="width: 100%;">
+			<tr>
+				<td colspan="2" width="100%" class="emphasise"><b>Import</b><br>
+				Select a file destination from tree
+				</td>
+			</tr>
+			<tr>
+				<td width="20%" class="emphasise">File to Import</td>
+					<td width="80%"><input type="file" name="psmlFile"></td>
+			</tr>
+			<tr>
+				<td width="20%" class="emphasise">File Type</td>
+				<td width="80%">Link <input onClick="javascript:setType('link');" type="radio" name="type"/>Page
+				<input type="radio" onClick="javascript:setType('psml');" name="type"/></td>
+			</tr>			
+			<tr>
+				<td width="20%" class="emphasise">File name</td>
+				<td width="80%"><input type="text" size="20" name="newName" id="newName"
+				onChange="javascript:validImportName();"/></td>
+			</tr>
+			<tr>
+				<td width="20%" class="emphasise">File destination</td>
+				<td width="80%"><input type="text" name="importPath" id="importPath" readonly /></td>
+			</tr>
+			<tr>
+				<td colspan="2" width="100%">
+				<input type="hidden" name="fileType" id="fileType"/>
+				<input type="button" value="Import" onClick="javascript:submtimport();"/>
+				</td>
+			</tr>				
+		</table>
+		</form>
+	</div>
+	<div id="export" dojoType="ContentPane" label="Export">
+		<form>
+		<table class="formAnswer" style="width: 100%;">
+			<tr>
+				<td colspan="2" width="100%" class="emphasise"><b>Export</b><br><br></td>
+			</tr>
+			<tr>
+				<td width="20%" class="emphasise">Export Object</td>
+				<td width="80%"><input type="text" name="exportObject" id="exportObject" readonly /></td>
+			</tr>			
+			<tr id="exptRecurs" style="display:none">
+				<td width="20%" class="emphasise">Export recursively</td>
+				<td width="80%"><input type="checkbox" name="exportRecursively" id="exportRecursively" value='1' /></td>
+			</tr>			
+			<tr>
+				<td colspan="2" width="100%">
+				<input type="hidden" id="objName" name="objName">
+				<input type="hidden" id="objType" name="objType">
+				<input type="hidden" id="objPath" name="objPath">							
+				<input type="button" value="Export" id="exprtBtn" onClick="javascript:submtexport();"/>
+				</td>
+			</tr>				
+			<tr><td colspan="2" width="100%" id="exportAns"></td>
+			</tr>
+		</table>
+		</form>
+	</div>
 </div> <!-- End Tab Container -->
 
 <div dojoType="LayoutContainer" widgetId="MajorActions" minHeight="20" layoutAlign="bottom" style="width: 20%; height: 55px">
@@ -1630,7 +1717,7 @@
 <script type="text/javascript">
 // var starttime=new Date().getTime();
 
-var siteViewAllTabIds = [ "infoTabFolder", "infoTabPage", "infoTabLinks", "securityTab", "metaTab", "menusTab", "orderTab" ];
+var siteViewAllTabIds = [ "infoTabFolder", "infoTabPage", "infoTabLinks", "securityTab", "metaTab", "menusTab", "orderTab","import","export" ];
 var siteViewAllTabWidgets = {};
 function displayTabs( tabIdList )
 {
@@ -2408,6 +2495,100 @@
 {
 	dojo.widget.byId("copy.save").setDisabled(true);
 }
+
+var ExportHandler = function()
+{
+  this.populate = function(xml) 
+  {
+	var path = xml.getElementsByTagName("link");
+	if (path != null && path.length > 0)
+	{    
+	   for (ix=0; ix < path.length; ix++)
+	   {
+		  var refName = path[ix].firstChild.nodeValue;
+	   }
+	}
+	var pgCol = document.getElementById("exportAns");
+	var	a = document.createElement("a");
+	a.innerHTML ='Download';
+	a.href = refName;
+	a.setAttribute("target","_blank");
+	a.setAttribute("onClick","javascript:downloadObject()");
+	pgCol.appendChild(a);              
+
+  }     
+  this.failure = function(data)
+  {
+  }
+}
+function downloadObject(){
+	document.getElementById("exportAns").innerHTML = '';
+}
+function submtimport()
+{
+	if(validImportName())
+	{
+		document.importObject.submit();
+	}
+}
+function setType(type)
+{
+	document.getElementById("fileType").value=type;
+}
+function validImportName()
+{
+	var type = document.getElementById("fileType").value;
+	var name = document.getElementById("newName").value;
+	var regex;
+	if(type == '')
+	{
+		alert('Please choose file type');
+		document.getElementById("newName").value='';
+		return false;
+	}
+	if(name == '')
+	{
+		alert('Please choose a valid name');
+		return false;
+	}
+	if(type=='link')
+	{
+		regex = new RegExp(".*\.link")
+	}else if(type == 'page')
+	{
+		regex = new RegExp(".*\.psml");
+	}
+    if (name.match(regex))
+    {
+		alert('Please choose a valid name');
+		document.getElementById("newName").value='';
+		return false;
+    }
+	return true;
+}
+
+function submtexport()
+{
+	var objName;
+	var objType;
+	var objPath;
+	var exptRecusive='';
+	document.getElementById("exportAns").innerHTML = '';
+	objName = document.getElementById("objName").value;
+	objType = document.getElementById("objType").value;
+	objType = objType.toLowerCase();
+	objPath = document.getElementById("objPath").value;
+	if(document.getElementById("exportRecursively").checked)
+	{
+		exptRecusive = document.getElementById("exportRecursively").value;
+	}
+	
+	var names = new Array("objName","objType","objPath","exptRecusive");
+    var values = new Array(objName,objType,objPath,exptRecusive);
+    ajaxInvoke("export", names, values, new ExportHandler() );     
+	//document.export.submit();
+}
+
 function addListeners()
 {
   var tabContainer = dojo.widget.byId("mainTabContainer");

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/ajax-xml/export.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/ajax-xml/export.vm?view=auto&rev=550717
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/ajax-xml/export.vm (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/ajax-xml/export.vm Tue Jun 26 00:06:44 2007
@@ -0,0 +1,21 @@
+#*
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+*#
+<js>
+    <status>$status</status>
+    <action>$action</action>
+    <link>$link</link>
+</js>
\ No newline at end of file

Added: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/ExportObject.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/ExportObject.java?view=auto&rev=550717
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/ExportObject.java (added)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/layout/impl/ExportObject.java Tue Jun 26 00:06:44 2007
@@ -0,0 +1,309 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.jetspeed.layout.impl;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.JetspeedActions;
+import org.apache.jetspeed.ajax.AjaxAction;
+import org.apache.jetspeed.ajax.AjaxBuilder;
+import org.apache.jetspeed.exception.JetspeedException;
+import org.apache.jetspeed.layout.PortletActionSecurityBehavior;
+import org.apache.jetspeed.om.folder.Folder;
+import org.apache.jetspeed.om.page.Link;
+import org.apache.jetspeed.om.page.Page;
+import org.apache.jetspeed.page.PageManager;
+import org.apache.jetspeed.request.RequestContext;
+/**
+ * Exporting the object using Ajax command
+ * 
+ * @author <a href="mailto:firevelocity@gmail.com">Vivek Kumar</a>
+ * @version $Id$
+ */
+public class ExportObject extends BaseGetResourceAction implements AjaxAction, AjaxBuilder, Constants {
+	protected Log log = LogFactory.getLog(GetFolderAction.class);
+
+	protected PageManager castorPageManager;
+
+	protected String pageRoot;
+
+	private static final String OBJECT_NAME = "objName";
+
+	private static final String OBJECT_TYPE = "objType";
+
+	private static final String OBJECT_PATH = "objPath";
+
+	private static final String RECURSIVE = "exptRecusive";
+	String pathSeprator = System.getProperty("file.separator");
+	public ExportObject(String template, String errorTemplate, PageManager pageManager,
+			PortletActionSecurityBehavior securityBehavior, PageManager castorpagemanager, String dir) {
+		super(template, errorTemplate, pageManager, securityBehavior);
+		this.castorPageManager = castorpagemanager;
+		this.pageRoot = dir;
+	}
+
+	public boolean run(RequestContext requestContext, Map resultMap) {
+		boolean success = true;
+		String status = "success";
+		String userName = requestContext.getUserPrincipal().toString();
+		try {
+			resultMap.put(ACTION, "export");
+			if (false == checkAccess(requestContext, JetspeedActions.VIEW)) {
+				success = false;
+				resultMap.put(REASON, "Insufficient access to get portlets");
+				return success;
+			}
+			String objectName = getActionParameter(requestContext, OBJECT_NAME);
+			String objectType = getActionParameter(requestContext, OBJECT_TYPE);
+			String objectPath = getActionParameter(requestContext, OBJECT_PATH);
+			String recursive = getActionParameter(requestContext, RECURSIVE);
+			boolean isRecursive = recursive != null && recursive.equals("1") ? true : false;
+
+			if (!cleanUserFolder(userName))
+				success = false;
+			if (success) {
+				if (objectType.equalsIgnoreCase("folder")) {
+					Folder folder = pageManager.getFolder(objectPath);
+					if (isRecursive) {
+							importFolder(folder,userName);
+					} else {
+						Folder destFolder = castorPageManager.copyFolder(folder, getUserFolder(userName, true)
+								+ objectName);
+						castorPageManager.updateFolder(destFolder);
+					}
+				} else if (objectType.equalsIgnoreCase("page")) {
+					objectPath = getParentPath(objectPath);
+					Folder folder = pageManager.getFolder(objectPath);
+					Page page = folder.getPage(objectName);
+					Page destPage = castorPageManager.copyPage(page, getUserFolder(userName, true) + objectName);
+					castorPageManager.updatePage(destPage);
+				} else if (objectType.equalsIgnoreCase("link")) {
+					objectPath = getParentPath(objectPath);
+					Folder folder = pageManager.getFolder(objectPath);
+					Link link = folder.getLink(objectName);
+					Link destLink = castorPageManager.copyLink(link, getUserFolder(userName, true) + objectName);
+					castorPageManager.updateLink(destLink);
+				}
+				String link = userName + "_" + objectName;
+				if (objectType.equalsIgnoreCase("folder")) link = userName + ".zip";
+				requestContext.getRequest().getSession().setAttribute("file", link);
+				resultMap.put("link", getDownloadLink(requestContext, objectName, userName, objectType));
+			}
+			if (!success)
+				status = "failure";
+
+			resultMap.put(STATUS, status);
+		} catch (Exception e) {
+			// Log the exception
+			e.printStackTrace();
+			log.error("exception while getting folder info", e);
+
+			// Return a failure indicator
+			success = false;
+		}
+
+		return success;
+	}
+
+	private String getDownloadLink(RequestContext requestContext, String ObjectName, String userName, String objectType)
+			throws Exception {
+		String link = "";
+		String basePath = requestContext.getRequest().getContextPath() + "/fileserver/_content/";
+		if (objectType.equalsIgnoreCase("folder")) {
+			String sourcePath = getUserFolder(userName, false);
+			String target = sourcePath + ".zip";
+			boolean success = zipObject(sourcePath, target);
+			if (!success)
+				throw new Exception("Error Occurered in zipping the file");
+
+			link = basePath + ObjectName+".zip";
+		} else {
+			link = basePath + userName + "/" +  ObjectName;
+		}
+		return link;
+	}
+
+	private boolean cleanUserFolder(String userName) {
+		boolean success = false;
+		synchronized (this) {
+			String folder = getUserFolder(userName, false);
+			File dir = new File(pageRoot+pathSeprator+userName+".zip");
+			if(dir.exists()) dir.delete();
+			
+			dir = new File(folder);
+			if (dir.exists()) {
+				if (dir.isDirectory()) {
+					String[] children = dir.list();
+					for (int i = 0; i < children.length; i++) {
+						File tmpFile = new File(dir, children[i]);
+						if (tmpFile.isDirectory()) {
+							success = deleteDir(tmpFile);
+						} else {
+							success = tmpFile.delete();
+						}
+						if (!success) {
+							return false;
+						}
+					}
+				}
+			} else {
+				dir.mkdir();
+			}
+		}
+		return true;
+	}
+
+	public boolean deleteDir(File dir) {
+		if (dir.isDirectory()) {
+			String[] children = dir.list();
+			for (int i = 0; i < children.length; i++) {
+				boolean success = deleteDir(new File(dir, children[i]));
+				if (!success) {
+					return false;
+				}
+			}
+		}
+		return true;
+	}
+
+	private String getUserFolder(String userName, boolean fullPath) {
+		if (pathSeprator == null || pathSeprator.equals(""))
+			pathSeprator = "/";
+		if (fullPath) {
+			return userName + pathSeprator;
+		} else {
+			return pageRoot + pathSeprator + userName;
+		}
+	}
+
+	private String getParentPath(String path) {
+		int index = path.lastIndexOf("/");
+
+		if (index == 0) {
+			return "/";
+		} else {
+			return path.substring(0, index);
+		}
+	}
+
+	private boolean zipObject(String sourcePath, String target) {
+		ZipOutputStream cpZipOutputStream = null;
+		try {
+			File cpFile = new File(sourcePath);
+			if (!cpFile.isDirectory()) {
+				return false;
+			}
+			cpZipOutputStream = new ZipOutputStream(new FileOutputStream(target));
+			cpZipOutputStream.setLevel(9);
+			zipFiles(cpFile, sourcePath, cpZipOutputStream);
+			cpZipOutputStream.finish();
+			cpZipOutputStream.close();
+		} catch (Exception e) {	
+			e.printStackTrace();
+			return false;
+		}
+		finally{
+		}
+		return true;
+	}
+
+	private void zipFiles(File cpFile, String sourcePath, ZipOutputStream cpZipOutputStream) {
+
+		if (cpFile.isDirectory()) {
+			File[] fList = cpFile.listFiles();
+			for (int i = 0; i < fList.length; i++) {
+				zipFiles(fList[i], sourcePath, cpZipOutputStream);
+			}
+		} else {
+			try {
+				String strAbsPath = cpFile.getAbsolutePath();
+				String strZipEntryName = strAbsPath.substring(sourcePath.length() + 1, strAbsPath.length());
+				byte[] b = new byte[(int) (cpFile.length())];
+				FileInputStream cpFileInputStream = new FileInputStream(cpFile);
+				int i = cpFileInputStream.read(b, 0, (int) cpFile.length());
+				ZipEntry cpZipEntry = new ZipEntry(strZipEntryName);
+				cpZipOutputStream.putNextEntry(cpZipEntry);
+				cpZipOutputStream.write(b, 0, (int) cpFile.length());
+				cpZipOutputStream.closeEntry();
+				cpFileInputStream.close();
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+	private Folder importFolder(Folder srcFolder,String userName) throws JetspeedException {
+		Folder dstFolder = lookupFolder(srcFolder.getPath());
+		dstFolder = castorPageManager.copyFolder(srcFolder, getUserFolder(userName, true) + srcFolder.getPath());
+		castorPageManager.updateFolder(dstFolder);
+
+		Iterator pages = srcFolder.getPages().iterator();
+		while (pages.hasNext()) {
+			Page srcPage = (Page) pages.next();
+			Page dstPage = lookupPage(srcPage.getPath());
+			dstPage = castorPageManager.copyPage(srcPage, getUserFolder(userName, true) +srcPage.getPath());
+			castorPageManager.updatePage(dstPage);
+		}
+
+		Iterator links = srcFolder.getLinks().iterator();
+		while (links.hasNext()) {
+			Link srcLink = (Link) links.next();
+			Link dstLink = lookupLink(srcLink.getPath());
+			dstLink = castorPageManager.copyLink(srcLink, getUserFolder(userName, true) +srcLink.getPath());
+			castorPageManager.updateLink(dstLink);
+		}
+		Iterator folders = srcFolder.getFolders().iterator();
+		while (folders.hasNext()) {
+			Folder folder = (Folder) folders.next();
+			importFolder(folder,userName);
+		}
+
+		return dstFolder;
+	}
+
+	private Page lookupPage(String path) {
+		try {
+			return castorPageManager.getPage(path);
+		} catch (Exception e) {
+			return null;
+		}
+	}
+
+	private Link lookupLink(String path) {
+		try {
+			return castorPageManager.getLink(path);
+		} catch (Exception e) {
+			return null;
+		}
+	}
+
+	private Folder lookupFolder(String path) {
+		try {
+			return castorPageManager.getFolder(path);
+		} catch (Exception e) {
+			return null;
+		}
+	}
+}

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/CommonPortletServices.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/CommonPortletServices.java?view=diff&rev=550717&r1=550716&r2=550717
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/CommonPortletServices.java (original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/CommonPortletServices.java Tue Jun 26 00:06:44 2007
@@ -49,5 +49,6 @@
     public final static String CPS_PASSWORD_ENCODER_COMPONENT = "cps:PasswordEncodingService";
     public final static String CPS_SECURITY_ACCESS_CONTROLLER = "cps:SecurityAccessController";
     public final static String CPS_PORTLET_TRACKING_MANAGER = "cps:PortletTrackingManager";
-    public final static String CPS_PORTAL_CONFIGURATION = "cps:PortalConfiguration";   
+    public final static String CPS_PORTAL_CONFIGURATION = "cps:PortalConfiguration";
+    public final static String CPS_IMPORTER_MANAGER = "cps:ImporterManager";
 }

Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/ajax-layout.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/ajax-layout.xml?view=diff&rev=550717&r1=550716&r2=550717
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/ajax-layout.xml (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/ajax-layout.xml Tue Jun 26 00:06:44 2007
@@ -543,6 +543,27 @@
     </constructor-arg>
 </bean>
     
+<bean id="AjaxExportObject"
+    class="org.apache.jetspeed.layout.impl.ExportObject">
+    <constructor-arg index="0">
+        <value>org/apache/jetspeed/layout/ajax-xml/export.vm</value>
+    </constructor-arg>
+    <constructor-arg index="1">
+        <value>org/apache/jetspeed/layout/ajax-xml/error.vm</value>
+    </constructor-arg>
+    <constructor-arg index='2'>    
+        <ref bean="org.apache.jetspeed.page.PageManager"/>        
+    </constructor-arg>
+    <constructor-arg index='3'>
+        <ref bean="PortletActionSecurityBehavior"/>
+    </constructor-arg>
+    <constructor-arg index='4'>
+        <ref bean="importerCastorPageManager"/>
+    </constructor-arg>
+	<constructor-arg index='5'>
+		<value>${java.io.tmpdir}</value>
+    </constructor-arg>
+</bean>
 <bean id="AjaxActionMap" class="java.util.HashMap">
     <constructor-arg index="0">
         <map>
@@ -627,6 +648,9 @@
             <entry key="getuserlist">
                 <ref bean="AjaxGetUserList"/>                
             </entry>
+            <entry key="export">
+                <ref bean="AjaxExportObject"/>                
+            </entry>                        
         </map>
     </constructor-arg>    
 </bean>    

Added: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/importer-page-manager.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/importer-page-manager.xml?view=auto&rev=550717
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/importer-page-manager.xml (added)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/importer-page-manager.xml Tue Jun 26 00:06:44 2007
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You 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.
+-->
+<beans>
+  <!-- PageManager -->
+  <bean id="ImportPsmlDocumentHandler"      
+       class="org.apache.jetspeed.page.document.psml.CastorFileSystemDocumentHandler" >         
+       <constructor-arg index="0"><value>/JETSPEED-INF/castor/page-mapping.xml</value></constructor-arg>
+       <constructor-arg index="1"><value>.psml</value></constructor-arg>
+       <constructor-arg index="2" ><value>org.apache.jetspeed.om.page.psml.PageImpl</value></constructor-arg>       
+       <constructor-arg index="3" ><value>${java.io.tmpdir}</value></constructor-arg>
+       <constructor-arg index="4" ><ref bean="ImportPageFileCache"/></constructor-arg>
+  </bean>
+  
+  <bean id="ImportLinkDocumentHandler"       
+       class="org.apache.jetspeed.page.document.psml.CastorFileSystemDocumentHandler" >         
+       <constructor-arg index="0"><value>/JETSPEED-INF/castor/page-mapping.xml</value></constructor-arg>
+       <constructor-arg index="1"><value>.link</value></constructor-arg>
+       <constructor-arg index="2" ><value>org.apache.jetspeed.om.page.psml.LinkImpl</value></constructor-arg>       
+       <constructor-arg index="3" ><value>${java.io.tmpdir}</value></constructor-arg>
+       <constructor-arg index="4" ><ref bean="ImportPageFileCache"/></constructor-arg>
+  </bean>
+  
+  <bean id="ImportFolderMetaDataDocumentHandler"         
+       class="org.apache.jetspeed.page.document.psml.CastorFileSystemDocumentHandler" >         
+       <constructor-arg index="0"><value>/JETSPEED-INF/castor/page-mapping.xml</value></constructor-arg>
+       <constructor-arg index="1"><value>folder.metadata</value></constructor-arg>
+       <constructor-arg index="2" ><value>org.apache.jetspeed.om.folder.psml.FolderMetaDataImpl</value></constructor-arg>       
+       <constructor-arg index="3" ><value>${java.io.tmpdir}</value></constructor-arg>
+       <constructor-arg index="4" ><ref bean="ImportPageFileCache"/></constructor-arg>
+  </bean>
+  
+  <bean id="ImportPageSecurityDocumentHandler"       
+       class="org.apache.jetspeed.page.document.psml.CastorFileSystemDocumentHandler" >         
+       <constructor-arg index="0"><value>/JETSPEED-INF/castor/page-mapping.xml</value></constructor-arg>
+       <constructor-arg index="1"><value>page.security</value></constructor-arg>
+       <constructor-arg index="2" ><value>org.apache.jetspeed.om.page.psml.PageSecurityImpl</value></constructor-arg>       
+       <constructor-arg index="3" ><value>${java.io.tmpdir}</value></constructor-arg>
+       <constructor-arg index="4" ><ref bean="ImportPageFileCache"/></constructor-arg>
+  </bean>
+  
+  <bean id="ImportDocumentHandlerFactory"        
+       class="org.apache.jetspeed.page.document.psml.DocumentHandlerFactoryImpl" >      
+        <constructor-arg>
+        <map>
+          <entry key=".psml">
+            <ref bean="ImportPsmlDocumentHandler" />
+          </entry>
+          <entry key=".link">
+            <ref bean="ImportLinkDocumentHandler" />
+          </entry>  
+          <entry key="folder.metadata">
+            <ref bean="ImportFolderMetaDataDocumentHandler" />
+          </entry>        
+          <entry key="page.security">
+            <ref bean="ImportPageSecurityDocumentHandler" />
+          </entry>        
+        </map>
+       </constructor-arg>
+  </bean>
+  
+  <bean id="ImportFolderHandler"         
+       class="org.apache.jetspeed.page.document.psml.FileSystemFolderHandler" >         
+       <constructor-arg index="0"><value>${java.io.tmpdir}</value></constructor-arg>
+       <constructor-arg index="1"><ref bean="ImportDocumentHandlerFactory"/></constructor-arg>
+       <constructor-arg index="2"><ref bean="ImportPageFileCache"/></constructor-arg>        
+  </bean>
+    
+  <bean id="org.apache.jetspeed.page.CastorPageManager" 
+       name="importerCastorPageManager"
+       class="org.apache.jetspeed.page.psml.CastorXmlPageManager">         
+       <constructor-arg index="0"><ref bean="ImportIdGenerator"/></constructor-arg>
+       <constructor-arg index="1"><ref bean="ImportDocumentHandlerFactory"/></constructor-arg>
+       <constructor-arg index="2"><ref bean="ImportFolderHandler"/></constructor-arg>
+       <constructor-arg index="3"><ref bean="ImportPageFileCache"/></constructor-arg>        
+       <!-- permissions security enabled flag, default=false -->
+       <constructor-arg index="4"><value>false</value></constructor-arg>
+       <!-- constraints security enabled flag, default=true -->
+       <constructor-arg index="5"><value>false</value></constructor-arg>
+  </bean>
+
+    <!-- Page File Cache -->
+    <bean id="ImportPageFileCache" class="org.apache.jetspeed.cache.file.FileCache" init-method="startFileScanner" destroy-method="stopFileScanner">
+        <!-- Scan rate for changes in cached files on the file system -->
+        <constructor-arg index="0">
+            <value>10</value>
+        </constructor-arg>
+        <!-- Cache size -->
+        <constructor-arg index="1">
+            <value>100</value>
+        </constructor-arg>
+    </bean>
+
+    <bean id="ImportIdGenerator" class="org.apache.jetspeed.idgenerator.JetspeedIdGenerator" init-method="start" destroy-method="stop">
+        <!-- ID Start value -->
+        <constructor-arg index="0">
+            <value>65536</value>
+        </constructor-arg>
+        <!-- ID Prefix -->
+        <constructor-arg index="1">
+            <value>P-</value>
+        </constructor-arg>
+        <!-- ID Suffix -->
+        <constructor-arg index="2">
+            <value></value>
+        </constructor-arg>
+    </bean>
+
+</beans>

Modified: portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/jetspeed-services.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/jetspeed-services.xml?view=diff&rev=550717&r1=550716&r2=550717
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/jetspeed-services.xml (original)
+++ portals/jetspeed-2/trunk/src/webapp/WEB-INF/assembly/jetspeed-services.xml Tue Jun 26 00:06:44 2007
@@ -114,6 +114,9 @@
           <entry key ="PortalConfiguration">
           	<ref bean="PortalConfiguration"/>
           </entry>
+          <entry key="ImporterManager">
+            <ref bean="importerCastorPageManager"/>
+          </entry>          
           
 <!-- first uncomment the below service bean in security-spi-atn.xml
          <entry key="PasswordEncodingService">



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message