You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-commits@incubator.apache.org by cl...@apache.org on 2005/11/22 23:40:36 UTC
svn commit: r348293 - in /incubator/graffito/trunk: applications/browser/
applications/browser/src/java/org/apache/portals/graffito/portlets/browser/actions/
applications/graffito-portlets/ components/
Author: clombart
Date: Tue Nov 22 15:40:19 2005
New Revision: 348293
URL: http://svn.apache.org/viewcvs?rev=348293&view=rev
Log:
* Support Jetspeed2 - apply patch provided by Randy
* Review deployment.
Modified:
incubator/graffito/trunk/applications/browser/maven.xml
incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/portlets/browser/actions/DocumentAction.java
incubator/graffito/trunk/applications/graffito-portlets/maven.xml
incubator/graffito/trunk/components/maven.xml
incubator/graffito/trunk/components/project.xml
Modified: incubator/graffito/trunk/applications/browser/maven.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/maven.xml?rev=348293&r1=348292&r2=348293&view=diff
==============================================================================
--- incubator/graffito/trunk/applications/browser/maven.xml (original)
+++ incubator/graffito/trunk/applications/browser/maven.xml Tue Nov 22 15:40:19 2005
@@ -1,39 +1,37 @@
-<project default="java:jar" xmlns:j="jelly:core" xmlns:define="jelly:define">
- <!-- ================================================================ -->
- <!-- Deploy -->
- <!-- ================================================================ -->
- <goal name="deploy">
- <echo message="Deploy portal war into ${org.apache.jetspeed.deploy.war.dir}"/>
- <!-- j:set var="maven.build.dir" value="./target" />
- <j:set var="maven.war.final.name" value="${pom.artifactId}.war" />
- <attainGoal name="jetspeed2:deploy" / -->
-
- <copy todir="${org.apache.jetspeed.deploy.war.dir}/jetspeed/WEB-INF/deploy" file="${maven.build.dir}/${pom.artifactId}.war" />
- </goal>
-
- <preGoal name="deploy">
- <attainGoal name= "war:install"/>
- </preGoal>
- <goal name="undeploy">
- <echo message="Undeploy ${org.apache.jetspeed.deploy.war.dir}jetspeed/WEB-INF/deploy/${pom.artifactId}.war"/>
- <delete file="${org.apache.jetspeed.deploy.war.dir}jetspeed/WEB-INF/deploy/${pom.artifactId}.war"/>
- </goal>
-
- <!-- ================================================================ -->
- <!-- Hot Deploy for mundane everyday development under Catalina -->
- <!-- ================================================================ -->
- <goal name="hotdeploy">
- <echo message="Hot Deploying ${org.apache.jetspeed.portlet.app.name} to ${org.apache.jetspeed.deploy.war.dir}"/>
- <copy todir="${org.apache.jetspeed.deploy.war.dir}/${org.apache.jetspeed.portlet.app.name}/WEB-INF/classes">
- <fileset dir="${maven.build.dir}/classes">
- </fileset>
- </copy>
- <copy todir="${org.apache.jetspeed.deploy.war.dir}/${org.apache.jetspeed.portlet.app.name}/">
- <fileset dir="./src/webapp">
- </fileset>
- </copy>
- </goal>
- <preGoal name="hotdeploy">
- <attainGoal name= "java:compile"/>
- </preGoal>
-</project>
\ No newline at end of file
+<project default="java:jar" xmlns:j="jelly:core" xmlns:define="jelly:define">
+ <!-- ================================================================ -->
+ <!-- Deploy -->
+ <!-- ================================================================ -->
+ <goal name="deploy">
+ <echo message="Deploy Graffito Browser into ${org.apache.jetspeed.deploy.war.dir}/jetspeed/WEB-INF/deploy"/>
+ <copy todir="${org.apache.jetspeed.deploy.war.dir}/jetspeed/WEB-INF/deploy" overwrite="true">
+ <fileset file="${basedir}/target/${pom.artifactId}.war" />
+ </copy>
+ </goal>
+
+ <preGoal name="deploy">
+ <attainGoal name= "war:install"/>
+ </preGoal>
+ <goal name="undeploy">
+ <echo message="Undeploy ${org.apache.jetspeed.deploy.war.dir}jetspeed/WEB-INF/deploy/${pom.artifactId}.war"/>
+ <delete file="${org.apache.jetspeed.deploy.war.dir}jetspeed/WEB-INF/deploy/${pom.artifactId}.war"/>
+ </goal>
+
+ <!-- ================================================================ -->
+ <!-- Hot Deploy for mundane everyday development under Catalina -->
+ <!-- ================================================================ -->
+ <goal name="hotdeploy">
+ <echo message="Hot Deploying ${org.apache.jetspeed.portlet.app.name} to ${org.apache.jetspeed.deploy.war.dir}"/>
+ <copy todir="${org.apache.jetspeed.deploy.war.dir}/${org.apache.jetspeed.portlet.app.name}/WEB-INF/classes">
+ <fileset dir="${maven.build.dir}/classes">
+ </fileset>
+ </copy>
+ <copy todir="${org.apache.jetspeed.deploy.war.dir}/${org.apache.jetspeed.portlet.app.name}/">
+ <fileset dir="./src/webapp">
+ </fileset>
+ </copy>
+ </goal>
+ <preGoal name="hotdeploy">
+ <attainGoal name= "java:compile"/>
+ </preGoal>
+</project>
Modified: incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/portlets/browser/actions/DocumentAction.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/portlets/browser/actions/DocumentAction.java?rev=348293&r1=348292&r2=348293&view=diff
==============================================================================
--- incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/portlets/browser/actions/DocumentAction.java (original)
+++ incubator/graffito/trunk/applications/browser/src/java/org/apache/portals/graffito/portlets/browser/actions/DocumentAction.java Tue Nov 22 15:40:19 2005
@@ -1,337 +1,348 @@
-/*
- * Copyright 2000-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.portals.graffito.portlets.browser.actions;
-
-
-import java.io.UnsupportedEncodingException;
-import java.sql.Timestamp;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletException;
-import javax.portlet.PortletMode;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-
-import org.apache.commons.fileupload.FileItem;
-import org.apache.portals.graffito.exception.ContentManagementException;
-import org.apache.portals.graffito.model.core.Folder;
-import org.apache.portals.graffito.model.dm.Document;
-import org.apache.portals.graffito.portlets.bean.BeanUtil;
-import org.apache.portals.graffito.portlets.browser.BrowserPortlet;
-import org.apache.portals.graffito.portlets.browser.dto.DocumentDTO;
-import org.apache.portals.graffito.portlets.browser.dto.PathDTO;
-import org.apache.portals.graffito.portlets.browser.session.BrowserSession;
-import org.apache.portals.graffito.portlets.browser.session.SessionUtil;
-import org.apache.portals.graffito.portlets.page.action.PortletActionInfo;
-import org.apache.portals.graffito.portlets.page.manager.PortletPageManager;
-import org.apache.portals.graffito.portlets.upload.PortletDiskFileUpload;
-import org.apache.portals.graffito.portlets.util.ServiceUtil;
-import org.apache.portals.graffito.services.core.ContentModelService;
-import org.apache.portals.graffito.services.core.ContentServerService;
-import org.apache.portals.graffito.services.dm.DocumentModelService;
-import org.apache.portals.graffito.util.UriUtil;
-
-/**
- * Portlet Action used to manage the Graffito Folders
- *
- * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
- * @version $Id: Exp $
- */
-public class DocumentAction extends BrowserAction
-{
-
- public void retrieve(PortletActionInfo actionInfo) throws PortletException
- {
- try
- {
-
- RenderRequest request = (RenderRequest) actionInfo.getRequest();
- RenderResponse response = (RenderResponse) actionInfo.getResponse();
- PortletPageManager portletPageManager = actionInfo.getPortletPageManager();
-
- DocumentModelService modelService = ServiceUtil.getDocumentService();
- ContentServerService serverService = ServiceUtil.getServerService();
- response.setContentType(BrowserActionConstants.HTML_CONTENT_TYPE);
-
- PathDTO pathDTO = new PathDTO();
- DocumentDTO documentDTO = new DocumentDTO();
-
- // Retrieve the document
- String uri = this.getUri(request);
- Document document = modelService.getDocument(uri);
-
- // Init the path DTO
- String scopeServer = UriUtil.getServerScope(uri);
- pathDTO.setServer(serverService.getServer(scopeServer));
- pathDTO.setCmsObject(document);
-
- // Init the document DTO
- documentDTO.setDocument(document);
- documentDTO.setDocumentLanguages(((BrowserPortlet)portletPageManager.getPortlet()).getDocumentLanguages());
- documentDTO.setDocumentTypes(((BrowserPortlet)portletPageManager.getPortlet()).getDocumentTypes());
-
- // Init the Session Browser info
- if (request.getPortletMode().equals(PortletMode.EDIT))
- {
- SessionUtil.setOperation(request, BrowserSession.UPDATE);
- }
-
- portletPageManager.addContextObject(request, BrowserActionConstants.VELOCITY_DOCUMENT_DTO, documentDTO);
- portletPageManager.addContextObject(request, BrowserActionConstants.VELOCITY_PATH_DTO, pathDTO);
-
-
- }
- catch (Exception e)
- {
- throw new PortletException("Impossible to retrieve a document ", e);
- }
-
- }
-
- public void createWizard(PortletActionInfo actionInfo) throws PortletException
- {
-
- try
- {
-
- RenderRequest request = (RenderRequest) actionInfo.getRequest();
- RenderResponse response = (RenderResponse) actionInfo.getResponse();
- PortletPageManager portletPageManager = actionInfo.getPortletPageManager();
-
- ContentModelService modelService = ServiceUtil.getModelService();
- DocumentModelService documentService = ServiceUtil.getDocumentService();
- ContentServerService serverService = ServiceUtil.getServerService();
-
- response.setContentType(BrowserActionConstants.HTML_CONTENT_TYPE);
-
- Document document = (Document) SessionUtil.getWizardInfo(request);
-
- String parentUri = this.getUri(request);
- // First step in the wizard : init the document
- if (document == null)
- {
- Folder parentFolder = modelService.getFolder(parentUri);
- document = documentService.createDocument();
- document.setParentFolder(parentFolder);
- }
-
- // Init the path DTO
- PathDTO pathDTO = new PathDTO();
- String scopeServer = UriUtil.getServerScope(parentUri);
- pathDTO.setServer(serverService.getServer(scopeServer));
- pathDTO.setCmsObject(document);
-
- // Init the Document DTO
- DocumentDTO documentDTO = new DocumentDTO();
- documentDTO.setDocument(document);
-
- documentDTO.setDocumentLanguages(((BrowserPortlet)portletPageManager.getPortlet()).getDocumentLanguages());
- documentDTO.setDocumentTypes(((BrowserPortlet)portletPageManager.getPortlet()).getDocumentTypes());
- SessionUtil.setOperation(request, BrowserSession.INSERT);
- SessionUtil.setWizardInfo(request, document);
-
- portletPageManager.addContextObject(request, BrowserActionConstants.VELOCITY_DOCUMENT_DTO, documentDTO);
- portletPageManager.addContextObject(request, BrowserActionConstants.VELOCITY_PATH_DTO, pathDTO);
-
- }
- catch (Exception e)
- {
- throw new PortletException("Impossible to create a folder ", e);
- }
-
- }
-
- public void updateProperties(PortletActionInfo actionInfo) throws PortletException
- {
- ActionRequest request = (ActionRequest) actionInfo.getRequest();
- ActionResponse response = (ActionResponse) actionInfo.getResponse();
- PortletPageManager portletPageManager = actionInfo.getPortletPageManager();
-
- BrowserSession browserSession = SessionUtil.getBrowserSession(request);
-
- Document document = (Document) SessionUtil.getWizardInfo(request);
- BeanUtil.populate(request, document);
- document.setProperty("title", request.getParameter("title"));
- document.setProperty("description", request.getParameter("description"));
- document.setProperty("owner", request.getParameter("owner"));
-
- document.setCreationDate(new Timestamp(System.currentTimeMillis()));
- document.setLastModified(new Timestamp(System.currentTimeMillis()));
- document.setUri(browserSession.getUri() + "/" + document.getName());
- document.setVersionNumber("1.0");
-
- String type = request.getParameter("documentType");
- if (type.equals("document.type.text"))
- {
- document.setContentType("text/plain");
- portletPageManager.setSelectedEditPageId(request, "textEdit");
- }
-
- if (type.equals("document.type.html"))
- {
- document.setContentType("text/html");
- portletPageManager.setSelectedEditPageId(request, "htmlEdit");
-
- }
-
- if (type.equals("document.type.upload"))
- {
- portletPageManager.setSelectedEditPageId(request, "uploadEdit");
- }
-
- browserSession.setWizardInfo(document);
- SessionUtil.setBrowserSession(request, browserSession);
- }
-
-
- public void insert(PortletActionInfo actionInfo) throws PortletException
- {
- try
- {
- ActionRequest request = (ActionRequest) actionInfo.getRequest();
- ActionResponse response = (ActionResponse) actionInfo.getResponse();
- PortletPageManager portletPageManager = actionInfo.getPortletPageManager();
- DocumentModelService documentService = ServiceUtil.getDocumentService();
- BrowserSession browserSession = SessionUtil.getBrowserSession(request);
- Document document = (Document) browserSession.getWizardInfo();
-
- BeanUtil.populate(request, document);
- String documentContent = request.getParameter("documentContent");
- if (documentContent != null)
- {
- try
- {
- document.getDocumentStream().setContent(documentContent.getBytes(request.getCharacterEncoding()));
- document.getDocumentStream().setEncoding(request.getCharacterEncoding());
- }
- catch (UnsupportedEncodingException e)
- {
- document.getDocumentStream().setContent(documentContent.getBytes());
- }
- document.setSize(documentContent.length());
- }
-
- documentService.addDocument(document);
- portletPageManager.setSelectedEditPageId(request, "folderEdit");
- SessionUtil.setOperation(request, null);
-
- }
- catch (ContentManagementException e)
- {
- throw new PortletException("Impossible to create a document ", e);
- }
-
- }
-
-
- public void save(PortletActionInfo actionInfo) throws PortletException
- {
- try
- {
- ActionRequest request = (ActionRequest) actionInfo.getRequest();
- ActionResponse response = (ActionResponse) actionInfo.getResponse();
- PortletPageManager portletPageManager = actionInfo.getPortletPageManager();
- DocumentModelService documentService = ServiceUtil.getDocumentService();
-
- BrowserSession browserSession = SessionUtil.getBrowserSession(request);
-
- String uri = this.getUri(request);
- Document document = documentService.getDocument(uri);
-
- BeanUtil.populate(request, document);
- document.setProperty("title", request.getParameter("title"));
- document.setProperty("description", request.getParameter("description"));
- document.setProperty("owner", request.getParameter("owner"));
-
- String documentContent = request.getParameter("documentContent");
- if (documentContent != null)
- {
- try
- {
- document.getDocumentStream().setContent(documentContent.getBytes(request.getCharacterEncoding()));
- document.getDocumentStream().setEncoding(request.getCharacterEncoding());
- }
- catch (UnsupportedEncodingException e)
- {
- document.getDocumentStream().setContent(documentContent.getBytes());
- }
- document.setSize(documentContent.length());
- }
-
- documentService.updateDocument(document);
-
-
- }
- catch (ContentManagementException e)
- {
- throw new PortletException("Impossible to create a document ", e);
- }
-
- }
-
-
- public void upload(PortletActionInfo actionInfo) throws PortletException
- {
- try
- {
- ActionRequest request = (ActionRequest) actionInfo.getRequest();
- ActionResponse response = (ActionResponse) actionInfo.getResponse();
- PortletPageManager portletPageManager = actionInfo.getPortletPageManager();
- BrowserSession browserSession = SessionUtil.getBrowserSession(request);
- DocumentModelService documentService = ServiceUtil.getDocumentService();
-
- Document document = null;
- if (browserSession.isInsert())
- {
- document = (Document) browserSession.getWizardInfo();
- }
- else
- {
- document = documentService.getDocument(browserSession.getUri());
- }
-
- PortletDiskFileUpload diskFileUpload = actionInfo.getDiskFileUpload();
- diskFileUpload.setRepositoryPath(ServiceUtil.getUploadFolder());
- FileItem fileItem = diskFileUpload.getFileItem(request, "file");
- document.setContentType(fileItem.getContentType());
- document.getDocumentStream().setContent(fileItem.get());
- document.getDocumentStream().setEncoding(request.getCharacterEncoding());
-
- document.setSize(fileItem.getSize());
-
- if (browserSession.isInsert())
- {
- documentService.addDocument(document);
- portletPageManager.setSelectedEditPageId(request, "folderEdit");
- SessionUtil.setOperation(request, null);
- }
- else
- {
- documentService.updateDocument(document);
- }
-
-
-
- }
- catch (Exception e)
- {
- throw new PortletException("Impossible to upload a document ", e);
- }
- }
-
-
-}
+/*
+ * Copyright 2000-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.portals.graffito.portlets.browser.actions;
+
+
+import java.io.UnsupportedEncodingException;
+import java.sql.Timestamp;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.portals.graffito.exception.ContentManagementException;
+import org.apache.portals.graffito.model.core.Folder;
+import org.apache.portals.graffito.model.dm.Document;
+import org.apache.portals.graffito.portlets.bean.BeanUtil;
+import org.apache.portals.graffito.portlets.browser.BrowserPortlet;
+import org.apache.portals.graffito.portlets.browser.dto.DocumentDTO;
+import org.apache.portals.graffito.portlets.browser.dto.PathDTO;
+import org.apache.portals.graffito.portlets.browser.session.BrowserSession;
+import org.apache.portals.graffito.portlets.browser.session.SessionUtil;
+import org.apache.portals.graffito.portlets.page.action.PortletActionInfo;
+import org.apache.portals.graffito.portlets.page.manager.PortletPageManager;
+import org.apache.portals.graffito.portlets.upload.PortletDiskFileUpload;
+import org.apache.portals.graffito.portlets.util.ServiceUtil;
+import org.apache.portals.graffito.services.core.ContentModelService;
+import org.apache.portals.graffito.services.core.ContentServerService;
+import org.apache.portals.graffito.services.dm.DocumentModelService;
+import org.apache.portals.graffito.util.UriUtil;
+
+/**
+ * Portlet Action used to manage the Graffito Folders
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
+ * @version $Id: Exp $
+ */
+public class DocumentAction extends BrowserAction
+{
+
+ public void retrieve(PortletActionInfo actionInfo) throws PortletException
+ {
+ try
+ {
+
+ RenderRequest request = (RenderRequest) actionInfo.getRequest();
+ RenderResponse response = (RenderResponse) actionInfo.getResponse();
+ PortletPageManager portletPageManager = actionInfo.getPortletPageManager();
+
+ DocumentModelService modelService = ServiceUtil.getDocumentService();
+ ContentServerService serverService = ServiceUtil.getServerService();
+ response.setContentType(BrowserActionConstants.HTML_CONTENT_TYPE);
+
+ PathDTO pathDTO = new PathDTO();
+ DocumentDTO documentDTO = new DocumentDTO();
+
+ // Retrieve the document
+ String uri = this.getUri(request);
+ Document document = modelService.getDocument(uri);
+
+ // Init the path DTO
+ String scopeServer = UriUtil.getServerScope(uri);
+ pathDTO.setServer(serverService.getServer(scopeServer));
+ pathDTO.setCmsObject(document);
+
+ // Init the document DTO
+ documentDTO.setDocument(document);
+ documentDTO.setDocumentLanguages(((BrowserPortlet)portletPageManager.getPortlet()).getDocumentLanguages());
+ documentDTO.setDocumentTypes(((BrowserPortlet)portletPageManager.getPortlet()).getDocumentTypes());
+
+ // Init the Session Browser info
+ if (request.getPortletMode().equals(PortletMode.EDIT))
+ {
+ SessionUtil.setOperation(request, BrowserSession.UPDATE);
+ }
+
+ portletPageManager.addContextObject(request, BrowserActionConstants.VELOCITY_DOCUMENT_DTO, documentDTO);
+ portletPageManager.addContextObject(request, BrowserActionConstants.VELOCITY_PATH_DTO, pathDTO);
+
+
+ }
+ catch (Exception e)
+ {
+ throw new PortletException("Impossible to retrieve a document ", e);
+ }
+
+ }
+
+ public void createWizard(PortletActionInfo actionInfo) throws PortletException
+ {
+
+ try
+ {
+
+ RenderRequest request = (RenderRequest) actionInfo.getRequest();
+ RenderResponse response = (RenderResponse) actionInfo.getResponse();
+ PortletPageManager portletPageManager = actionInfo.getPortletPageManager();
+
+ ContentModelService modelService = ServiceUtil.getModelService();
+ DocumentModelService documentService = ServiceUtil.getDocumentService();
+ ContentServerService serverService = ServiceUtil.getServerService();
+
+ response.setContentType(BrowserActionConstants.HTML_CONTENT_TYPE);
+
+ Document document = (Document) SessionUtil.getWizardInfo(request);
+
+ String parentUri = this.getUri(request);
+ // First step in the wizard : init the document
+ if (document == null)
+ {
+ Folder parentFolder = modelService.getFolder(parentUri);
+ document = documentService.createDocument();
+ document.setParentFolder(parentFolder);
+ }
+
+ // Init the path DTO
+ PathDTO pathDTO = new PathDTO();
+ String scopeServer = UriUtil.getServerScope(parentUri);
+ pathDTO.setServer(serverService.getServer(scopeServer));
+ pathDTO.setCmsObject(document);
+
+ // Init the Document DTO
+ DocumentDTO documentDTO = new DocumentDTO();
+ documentDTO.setDocument(document);
+
+ documentDTO.setDocumentLanguages(((BrowserPortlet)portletPageManager.getPortlet()).getDocumentLanguages());
+ documentDTO.setDocumentTypes(((BrowserPortlet)portletPageManager.getPortlet()).getDocumentTypes());
+ SessionUtil.setOperation(request, BrowserSession.INSERT);
+ SessionUtil.setWizardInfo(request, document);
+
+ portletPageManager.addContextObject(request, BrowserActionConstants.VELOCITY_DOCUMENT_DTO, documentDTO);
+ portletPageManager.addContextObject(request, BrowserActionConstants.VELOCITY_PATH_DTO, pathDTO);
+
+ }
+ catch (Exception e)
+ {
+ throw new PortletException("Impossible to create a folder ", e);
+ }
+
+ }
+
+ public void updateProperties(PortletActionInfo actionInfo) throws PortletException
+ {
+ ActionRequest request = (ActionRequest) actionInfo.getRequest();
+ ActionResponse response = (ActionResponse) actionInfo.getResponse();
+ PortletPageManager portletPageManager = actionInfo.getPortletPageManager();
+
+ BrowserSession browserSession = SessionUtil.getBrowserSession(request);
+
+ Document document = (Document) SessionUtil.getWizardInfo(request);
+ BeanUtil.populate(request, document);
+ document.setProperty("title", request.getParameter("title"));
+ document.setProperty("description", request.getParameter("description"));
+ document.setProperty("owner", request.getParameter("owner"));
+
+ document.setCreationDate(new Timestamp(System.currentTimeMillis()));
+ document.setLastModified(new Timestamp(System.currentTimeMillis()));
+ document.setUri(browserSession.getUri() + "/" + document.getName());
+ document.setVersionNumber("1.0");
+
+ String type = request.getParameter("documentType");
+ if (type.equals("document.type.text"))
+ {
+ document.setContentType("text/plain");
+ portletPageManager.setSelectedEditPageId(request, "textEdit");
+ }
+
+ if (type.equals("document.type.html"))
+ {
+ document.setContentType("text/html");
+ portletPageManager.setSelectedEditPageId(request, "htmlEdit");
+
+ }
+
+ if (type.equals("document.type.upload"))
+ {
+ portletPageManager.setSelectedEditPageId(request, "uploadEdit");
+ }
+
+ browserSession.setWizardInfo(document);
+ SessionUtil.setBrowserSession(request, browserSession);
+ }
+
+
+ public void insert(PortletActionInfo actionInfo) throws PortletException
+ {
+ try
+ {
+ ActionRequest request = (ActionRequest) actionInfo.getRequest();
+ ActionResponse response = (ActionResponse) actionInfo.getResponse();
+ PortletPageManager portletPageManager = actionInfo.getPortletPageManager();
+ DocumentModelService documentService = ServiceUtil.getDocumentService();
+ BrowserSession browserSession = SessionUtil.getBrowserSession(request);
+ Document document = (Document) browserSession.getWizardInfo();
+
+ BeanUtil.populate(request, document);
+ String documentContent = request.getParameter("documentContent");
+ if (documentContent != null)
+ {
+ try
+ {
+ if (request.getCharacterEncoding() == null)
+ {
+ throw new UnsupportedEncodingException("missing request character encoding");
+ }
+ document.getDocumentStream().setContent(documentContent.getBytes(request.getCharacterEncoding()));
+ document.getDocumentStream().setEncoding(request.getCharacterEncoding());
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ document.getDocumentStream().setContent(documentContent.getBytes());
+ }
+ document.setSize(documentContent.length());
+ }
+
+ documentService.addDocument(document);
+ portletPageManager.setSelectedEditPageId(request, "folderEdit");
+ SessionUtil.setOperation(request, null);
+
+ }
+ catch (ContentManagementException e)
+ {
+ throw new PortletException("Impossible to create a document ", e);
+ }
+
+ }
+
+
+ public void save(PortletActionInfo actionInfo) throws PortletException
+ {
+ try
+ {
+ ActionRequest request = (ActionRequest) actionInfo.getRequest();
+ ActionResponse response = (ActionResponse) actionInfo.getResponse();
+ PortletPageManager portletPageManager = actionInfo.getPortletPageManager();
+ DocumentModelService documentService = ServiceUtil.getDocumentService();
+
+ BrowserSession browserSession = SessionUtil.getBrowserSession(request);
+
+ String uri = this.getUri(request);
+ Document document = documentService.getDocument(uri);
+
+ BeanUtil.populate(request, document);
+ document.setProperty("title", request.getParameter("title"));
+ document.setProperty("description", request.getParameter("description"));
+ document.setProperty("owner", request.getParameter("owner"));
+
+ String documentContent = request.getParameter("documentContent");
+ if (documentContent != null)
+ {
+ try
+ {
+ if (request.getCharacterEncoding() == null)
+ {
+ throw new UnsupportedEncodingException("missing request character encoding");
+ }
+ document.getDocumentStream().setContent(documentContent.getBytes(request.getCharacterEncoding()));
+ document.getDocumentStream().setEncoding(request.getCharacterEncoding());
+ }
+ catch (UnsupportedEncodingException e)
+ {
+ document.getDocumentStream().setContent(documentContent.getBytes());
+ }
+ document.setSize(documentContent.length());
+ }
+
+ documentService.updateDocument(document);
+
+
+ }
+ catch (ContentManagementException e)
+ {
+ throw new PortletException("Impossible to create a document ", e);
+ }
+
+ }
+
+
+ public void upload(PortletActionInfo actionInfo) throws PortletException
+ {
+ try
+ {
+ ActionRequest request = (ActionRequest) actionInfo.getRequest();
+ ActionResponse response = (ActionResponse) actionInfo.getResponse();
+ PortletPageManager portletPageManager = actionInfo.getPortletPageManager();
+ BrowserSession browserSession = SessionUtil.getBrowserSession(request);
+ DocumentModelService documentService = ServiceUtil.getDocumentService();
+
+ Document document = null;
+ if (browserSession.isInsert())
+ {
+ document = (Document) browserSession.getWizardInfo();
+ }
+ else
+ {
+ document = documentService.getDocument(browserSession.getUri());
+ }
+
+ PortletDiskFileUpload diskFileUpload = actionInfo.getDiskFileUpload();
+ diskFileUpload.setRepositoryPath(ServiceUtil.getUploadFolder());
+ FileItem fileItem = diskFileUpload.getFileItem(request, "file");
+ document.setContentType(fileItem.getContentType());
+ document.getDocumentStream().setContent(fileItem.get());
+ if (request.getCharacterEncoding() != null)
+ {
+ document.getDocumentStream().setEncoding(request.getCharacterEncoding());
+ }
+
+ document.setSize(fileItem.getSize());
+
+ if (browserSession.isInsert())
+ {
+ documentService.addDocument(document);
+ portletPageManager.setSelectedEditPageId(request, "folderEdit");
+ SessionUtil.setOperation(request, null);
+ }
+ else
+ {
+ documentService.updateDocument(document);
+ }
+
+
+
+ }
+ catch (Exception e)
+ {
+ throw new PortletException("Impossible to upload a document ", e);
+ }
+ }
+
+
+}
Modified: incubator/graffito/trunk/applications/graffito-portlets/maven.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/graffito-portlets/maven.xml?rev=348293&r1=348292&r2=348293&view=diff
==============================================================================
--- incubator/graffito/trunk/applications/graffito-portlets/maven.xml (original)
+++ incubator/graffito/trunk/applications/graffito-portlets/maven.xml Tue Nov 22 15:40:19 2005
@@ -1,36 +1,37 @@
-<project default="java:jar" xmlns:j="jelly:core" xmlns:define="jelly:define">
- <!-- ================================================================ -->
- <!-- Deploy -->
- <!-- ================================================================ -->
- <goal name="deploy">
- <echo message="Deploy portal war into ${org.apache.jetspeed.deploy.war.dir}"/>
- <j:set var="maven.build.dir" value="./target" />
- <j:set var="maven.war.final.name" value="${pom.artifactId}.war" />
- <attainGoal name="jetspeed2:deploy" />
- </goal>
-
- <preGoal name="deploy">
- <attainGoal name= "war:install"/>
- </preGoal>
- <goal name="undeploy">
- <echo message="Undeploy ${org.apache.jetspeed.deploy.war.dir}jetspeed/WEB-INF/deploy/${pom.artifactId}.war"/>
- <delete file="${org.apache.jetspeed.deploy.war.dir}jetspeed/WEB-INF/deploy/${pom.artifactId}.war"/>
- </goal>
- <!-- ================================================================ -->
- <!-- Hot Deploy for mundane everyday development under Catalina -->
- <!-- ================================================================ -->
- <goal name="hotdeploy">
- <echo message="Hot Deploying ${org.apache.jetspeed.portlet.app.name} to ${org.apache.jetspeed.deploy.war.dir}"/>
- <copy todir="${org.apache.jetspeed.deploy.war.dir}/${org.apache.jetspeed.portlet.app.name}/WEB-INF/classes">
- <fileset dir="${maven.build.dir}/classes">
- </fileset>
- </copy>
- <copy todir="${org.apache.jetspeed.deploy.war.dir}/${org.apache.jetspeed.portlet.app.name}/">
- <fileset dir="./src/webapp">
- </fileset>
- </copy>
- </goal>
- <preGoal name="hotdeploy">
- <attainGoal name= "java:compile"/>
- </preGoal>
-</project>
\ No newline at end of file
+<project default="java:jar" xmlns:j="jelly:core" xmlns:define="jelly:define">
+ <!-- ================================================================ -->
+ <!-- Deploy -->
+ <!-- ================================================================ -->
+ <goal name="deploy">
+
+ <echo message="Deploy Graffito Browser into ${org.apache.jetspeed.deploy.war.dir}/jetspeed/WEB-INF/deploy"/>
+ <copy todir="${org.apache.jetspeed.deploy.war.dir}/jetspeed/WEB-INF/deploy" overwrite="true">
+ <fileset file="${basedir}/target/${pom.artifactId}.war" />
+ </copy>
+ </goal>
+
+ <preGoal name="deploy">
+ <attainGoal name= "war:install"/>
+ </preGoal>
+ <goal name="undeploy">
+ <echo message="Undeploy ${org.apache.jetspeed.deploy.war.dir}jetspeed/WEB-INF/deploy/${pom.artifactId}.war"/>
+ <delete file="${org.apache.jetspeed.deploy.war.dir}jetspeed/WEB-INF/deploy/${pom.artifactId}.war"/>
+ </goal>
+ <!-- ================================================================ -->
+ <!-- Hot Deploy for mundane everyday development under Catalina -->
+ <!-- ================================================================ -->
+ <goal name="hotdeploy">
+ <echo message="Hot Deploying ${org.apache.jetspeed.portlet.app.name} to ${org.apache.jetspeed.deploy.war.dir}"/>
+ <copy todir="${org.apache.jetspeed.deploy.war.dir}/${org.apache.jetspeed.portlet.app.name}/WEB-INF/classes">
+ <fileset dir="${maven.build.dir}/classes">
+ </fileset>
+ </copy>
+ <copy todir="${org.apache.jetspeed.deploy.war.dir}/${org.apache.jetspeed.portlet.app.name}/">
+ <fileset dir="./src/webapp">
+ </fileset>
+ </copy>
+ </goal>
+ <preGoal name="hotdeploy">
+ <attainGoal name= "java:compile"/>
+ </preGoal>
+</project>
Modified: incubator/graffito/trunk/components/maven.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/maven.xml?rev=348293&r1=348292&r2=348293&view=diff
==============================================================================
--- incubator/graffito/trunk/components/maven.xml (original)
+++ incubator/graffito/trunk/components/maven.xml Tue Nov 22 15:40:19 2005
@@ -12,289 +12,290 @@
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.
- -->
-<project default="java:jar" xmlns:j="jelly:core" xmlns:define="jelly:define" xmlns:maven="jelly:maven" >
- <!-- ================================================================ -->
- <!-- TEST -->
- <!-- ================================================================ -->
- <preGoal name="test:test">
- <attainGoal name="dbSetup"/>
- <attainGoal name="db.reinit.test" />
- </preGoal>
- <goal name="dbSetup">
- <j:set var="maven.junit.sysproperties"
- value="${maven.junit.sysproperties} org.apache.portals.graffito.database.url org.apache.portals.graffito.database.driver org.apache.portals.graffito.database.user org.apache.portals.graffito.database.password"
- />
- <j:set var="org.apache.portals.graffito.database.url" value="${org.apache.portals.graffito.test.database.url}"/>
- <j:set var="org.apache.portals.graffito.database.driver" value="${org.apache.portals.graffito.test.database.driver}"/>
- <j:set var="org.apache.portals.graffito.database.user" value="${org.apache.portals.graffito.test.database.user}"/>
- <j:set var="org.apache.portals.graffito.database.password" value="${org.apache.portals.graffito.test.database.password}"/>
- <copy file="src/test/repository.xml" todir="${maven.test.dest}" overwrite="true" failonerror="false">
- <filterset begintoken="@" endtoken="@">
- <filter token="PLATFORM" value="${org.apache.portals.graffito.database.ojb.platform}"/>
- </filterset>
- <filterset begintoken="@" endtoken="@">
- <filter token="DATASOURCE" value="${org.apache.portals.graffito.database.ojb.datasource}"/>
- </filterset>
- </copy>
- <path id="jdbc.drivers.path" path="${org.apache.portals.graffito.test.jdbc.drivers.path}"/>
- <maven:addPath id="maven.dependency.classpath" refid="jdbc.drivers.path"/>
- </goal>
- <!-- ================================================================ -->
- <!-- CREATE Graffito Server Master DB Script -->
- <!-- ================================================================ -->
- <goal name="db.scripts.gen" prereqs="torque:init" description="Build SQL scripts using Torque generator">
- <echo message="Generating SQL schema creation scripts for HSQLDB"/>
- <torque-sql basePathToDbProps="sql/base/" contextProperties="${torque.contextProperties}"
- controlTemplate="${torque.template.sql}" idTableXMLFile="${torque.idTableXMLFile}"
- outputDirectory="${maven.build.src}/sql/hsql" outputFile="report.${torque.project}.sql.generation"
- sqldbmap="${maven.build.src}/sql/hsql/sqldb.map" targetDatabase="hypersonic" useClasspath="true">
- <fileset dir="${torque.schema.dir}" includes="${torque.schema.sql.includes}" excludes="${torque.schema.sql.excludes}"
- />
+ -->
+<project default="java:jar" xmlns:j="jelly:core" xmlns:define="jelly:define" xmlns:maven="jelly:maven" >
+ <!-- ================================================================ -->
+ <!-- TEST -->
+ <!-- ================================================================ -->
+ <preGoal name="test:test">
+ <attainGoal name="dbSetup"/>
+ <attainGoal name="db.reinit.test" />
+ </preGoal>
+ <goal name="dbSetup">
+ <j:set var="maven.junit.sysproperties"
+ value="${maven.junit.sysproperties} org.apache.portals.graffito.database.url org.apache.portals.graffito.database.driver org.apache.portals.graffito.database.user org.apache.portals.graffito.database.password"
+ />
+ <j:set var="org.apache.portals.graffito.database.url" value="${org.apache.portals.graffito.test.database.url}"/>
+ <j:set var="org.apache.portals.graffito.database.driver" value="${org.apache.portals.graffito.test.database.driver}"/>
+ <j:set var="org.apache.portals.graffito.database.user" value="${org.apache.portals.graffito.test.database.user}"/>
+ <j:set var="org.apache.portals.graffito.database.password" value="${org.apache.portals.graffito.test.database.password}"/>
+ <copy file="src/test/repository.xml" todir="${maven.test.dest}" overwrite="true" failonerror="false">
+ <filterset begintoken="@" endtoken="@">
+ <filter token="PLATFORM" value="${org.apache.portals.graffito.database.ojb.platform}"/>
+ </filterset>
+ <filterset begintoken="@" endtoken="@">
+ <filter token="DATASOURCE" value="${org.apache.portals.graffito.database.ojb.datasource}"/>
+ </filterset>
+ </copy>
+ <path id="jdbc.drivers.path" path="${org.apache.portals.graffito.test.jdbc.drivers.path}"/>
+ <maven:addPath id="maven.dependency.classpath" refid="jdbc.drivers.path"/>
+ </goal>
+ <!-- ================================================================ -->
+ <!-- CREATE Graffito Server Master DB Script -->
+ <!-- ================================================================ -->
+ <goal name="db.scripts.gen" prereqs="torque:init" description="Build SQL scripts using Torque generator">
+ <echo message="Generating SQL schema creation scripts for MySQL"/>
+ <torque-sql basePathToDbProps="sql/base/" contextProperties="${torque.contextProperties}"
+ controlTemplate="${torque.template.sql}" idTableXMLFile="${torque.idTableXMLFile}"
+ outputDirectory="${maven.build.src}/sql/mysql" outputFile="report.${torque.project}.sql.generation"
+ sqldbmap="${maven.build.src}/sql/mysql/sqldb.map" targetDatabase="mysql" useClasspath="true">
+ <fileset dir="${torque.schema.dir}" includes="${torque.schema.sql.includes}" excludes="${torque.schema.sql.excludes}"
+ />
+ </torque-sql>
+ <echo message="Generating SQL schema creation scripts for HSQLDB"/>
+ <torque-sql basePathToDbProps="sql/base/" contextProperties="${torque.contextProperties}"
+ controlTemplate="${torque.template.sql}" idTableXMLFile="${torque.idTableXMLFile}"
+ outputDirectory="${maven.build.src}/sql/hsql" outputFile="report.${torque.project}.sql.generation"
+ sqldbmap="${maven.build.src}/sql/hsql/sqldb.map" targetDatabase="hypersonic" useClasspath="true">
+ <fileset dir="${torque.schema.dir}" includes="${torque.schema.sql.includes}" excludes="${torque.schema.sql.excludes}"
+ />
+ </torque-sql>
+ <replace file="${maven.build.src}/sql/hsql/graffitostore-schema.sql" token="CONTENT," value="CONTENT LONGVARBINARY," />
+
+ <echo message="Generating SQL schema creation scripts for Oracle"/>
+ <torque-sql basePathToDbProps="sql/base/" contextProperties="${torque.contextProperties}"
+ controlTemplate="${torque.template.sql}" idTableXMLFile="${torque.idTableXMLFile}"
+ outputDirectory="${maven.build.src}/sql/oracle" outputFile="report.${torque.project}.sql.generation"
+ sqldbmap="${maven.build.src}/sql/oracle/sqldb.map" targetDatabase="oracle" useClasspath="true">
+ <fileset dir="${torque.schema.dir}" includes="${torque.schema.sql.includes}" excludes="${torque.schema.sql.excludes}"
+ />
+ </torque-sql>
+ <echo message="Generating SQL schema creation scripts for MS SQL"/>
+ <torque-sql basePathToDbProps="sql/base/" contextProperties="${torque.contextProperties}"
+ controlTemplate="${torque.template.sql}" idTableXMLFile="${torque.idTableXMLFile}"
+ outputDirectory="${maven.build.src}/sql/mssql" outputFile="report.${torque.project}.sql.generation"
+ sqldbmap="${maven.build.src}/sql/mssql/sqldb.map" targetDatabase="mssql" useClasspath="true">
+ <fileset dir="${torque.schema.dir}" includes="${torque.schema.sql.includes}" excludes="${torque.schema.sql.excludes}"
+ />
</torque-sql>
- <replace file="${maven.build.src}/sql/hsql/graffitostore-schema.sql" token="CONTENT," value="CONTENT LONGVARBINARY," />
- <echo message="Generating SQL schema creation scripts for MySQL"/>
- <torque-sql basePathToDbProps="sql/base/" contextProperties="${torque.contextProperties}"
- controlTemplate="${torque.template.sql}" idTableXMLFile="${torque.idTableXMLFile}"
- outputDirectory="${maven.build.src}/sql/mysql" outputFile="report.${torque.project}.sql.generation"
- sqldbmap="${maven.build.src}/sql/mysql/sqldb.map" targetDatabase="mysql" useClasspath="true">
- <fileset dir="${torque.schema.dir}" includes="${torque.schema.sql.includes}" excludes="${torque.schema.sql.excludes}"
- />
- </torque-sql>
- <echo message="Generating SQL schema creation scripts for Oracle"/>
- <torque-sql basePathToDbProps="sql/base/" contextProperties="${torque.contextProperties}"
- controlTemplate="${torque.template.sql}" idTableXMLFile="${torque.idTableXMLFile}"
- outputDirectory="${maven.build.src}/sql/oracle" outputFile="report.${torque.project}.sql.generation"
- sqldbmap="${maven.build.src}/sql/oracle/sqldb.map" targetDatabase="oracle" useClasspath="true">
- <fileset dir="${torque.schema.dir}" includes="${torque.schema.sql.includes}" excludes="${torque.schema.sql.excludes}"
- />
- </torque-sql>
- <echo message="Generating SQL schema creation scripts for MS SQL"/>
- <torque-sql basePathToDbProps="sql/base/" contextProperties="${torque.contextProperties}"
- controlTemplate="${torque.template.sql}" idTableXMLFile="${torque.idTableXMLFile}"
- outputDirectory="${maven.build.src}/sql/mssql" outputFile="report.${torque.project}.sql.generation"
- sqldbmap="${maven.build.src}/sql/mssql/sqldb.map" targetDatabase="mssql" useClasspath="true">
- <fileset dir="${torque.schema.dir}" includes="${torque.schema.sql.includes}" excludes="${torque.schema.sql.excludes}"
- />
- </torque-sql>
- <echo message="Generating SQL schema creation scripts for Postgres"/>
- <torque-sql basePathToDbProps="sql/base/" contextProperties="${torque.contextProperties}"
- controlTemplate="${torque.template.sql}" idTableXMLFile="${torque.idTableXMLFile}"
- outputDirectory="${maven.build.src}/sql/postgres" outputFile="report.${torque.project}.sql.generation"
- sqldbmap="${maven.build.src}/sql/postgres/sqldb.map" targetDatabase="postgresql" useClasspath="true">
- <fileset dir="${torque.schema.dir}" includes="${torque.schema.sql.includes}" excludes="${torque.schema.sql.excludes}"
- />
- </torque-sql>
- </goal>
- <!-- ================================================================ -->
- <!-- SQL SCRIPT EXEC TEMPLATE -->
- <!-- TODO: I'd like to implement this as a plugin or use commons SQL -->
- <!-- Don't call this goal directly, call : -->
- <!-- db.create.test or db.create.production -->
- <!-- ================================================================ -->
- <goal name="db.execute">
- <sql driver="${org.apache.portals.graffito.database.driver}" url="${org.apache.portals.graffito.database.url}"
- userid="${org.apache.portals.graffito.database.user}" password="${org.apache.portals.graffito.database.password}"
- src="${database.arg.script}">
- <classpath>
- <path refid="maven.dependency.classpath"/>
- <pathelement path="${org.apache.portals.graffito.jdbc.drivers.path}"/>
- </classpath>
- </sql>
- </goal>
- <goal name="db.test.properties">
- <echo
- message="org.apache.portals.graffito.test.database.default.name : ${org.apache.portals.graffito.test.database.default.name}"/>
- <echo message="org.apache.portals.graffito.test.database.url : ${org.apache.portals.graffito.test.database.url}"/>
- <echo message="org.apache.portals.graffito.test.database.driver : ${org.apache.portals.graffito.test.database.driver}"/>
- <echo message="org.apache.portals.graffito.test.database.user : ${org.apache.portals.graffito.test.database.user}"/>
- <echo
- message="org.apache.portals.graffito.test.database.password : ${org.apache.portals.graffito.test.database.password}"/>
- <echo message="org.apache.portals.graffito.test.database.path : ${org.apache.portals.graffito.test.jdbc.drivers.path}"/>
- <echo message="org.apache.portals.graffito.test.jetspeed : ${org.apache.portals.graffito.test.jetspeed}"/>
- <j:set var="name" value="${org.apache.portals.graffito.test.database.default.name}X"/>
- <j:set var="url" value="${org.apache.portals.graffito.test.database.url}X"/>
- <j:set var="driver" value="${org.apache.portals.graffito.test.database.driver}X"/>
- <j:set var="password" value="${org.apache.portals.graffito.test.database.password}X"/>
- <j:set var="jarpath" value="${org.apache.portals.graffito.test.jdbc.drivers.path}X"/>
- <j:set var="jetspeed" value="${org.apache.portals.graffito.test.jetspeed}X"/>
- <j:if test="${name == 'X'}">
- <echo message="No value found for the build property org.apache.portals.graffito.test.database.default.name"/>
- <j:set var="status" value="error"/>
- </j:if >
- <j:if test="${url == 'X'}">
- <echo message="No value found for the build property org.apache.portals.graffito.test.database.url"/>
- <j:set var="status" value="error"/>
- </j:if >
- <j:if test="${driver == 'X'}">
- <echo message="No value found for the build property org.apache.portals.graffito.test.database.driver"/>
- <j:set var="status" value="error"/>
- </j:if >
- <j:if test="${password == 'X'}">
- <echo message="No value found for the build property org.apache.portals.graffito.test.database.password"/>
- </j:if >
- <j:if test="${jarpath == 'X'}">
- <echo message="No value found for the build property org.apache.portals.graffito.test.database.path"/>
- <j:set var="status" value="error"/>
- </j:if >
- <j:if test="${jetspeed == 'X'}">
- <echo message="No value found for the build property org.apache.portals.graffito.test.jetspeed"/>
- <j:set var="status" value="error"/>
- </j:if >
- <j:if test="${status == 'error'}" >
- <fail
- message="Impossible to continue if all Graffito build properties are not set in the build.properties defined in your USER_HOME folder"/>
- </j:if>
- <j:set var="org.apache.portals.graffito.database.default.name"
- value="${org.apache.portals.graffito.test.database.default.name}"/>
- <j:set var="org.apache.portals.graffito.database.url" value="${org.apache.portals.graffito.test.database.url}"/>
- <j:set var="org.apache.portals.graffito.database.driver" value="${org.apache.portals.graffito.test.database.driver}"/>
- <j:set var="org.apache.portals.graffito.database.user" value="${org.apache.portals.graffito.test.database.user}"/>
- <j:set var="org.apache.portals.graffito.database.password" value="${org.apache.portals.graffito.test.database.password}"/>
- <j:set var="org.apache.portals.graffito.jdbc.drivers.path" value="${org.apache.portals.graffito.test.jdbc.drivers.path}"/>
- </goal>
- <goal name="db.production.properties">
- <echo
- message="org.apache.portals.graffito.production.database.default.name : ${org.apache.portals.graffito.production.database.default.name}"/>
- <echo
- message="org.apache.portals.graffito.production.database.url : ${org.apache.portals.graffito.production.database.url}"/>
- <echo
- message="org.apache.portals.graffito.production.database.driver : ${org.apache.portals.graffito.production.database.driver}"/>
- <echo
- message="org.apache.portals.graffito.production.database.user : ${org.apache.portals.graffito.production.database.user}"/>
- <echo
- message="org.apache.portals.graffito.production.database.password : ${org.apache.portals.graffito.production.database.password}"/>
- <echo
- message="org.apache.portals.graffito.production.database.path : ${org.apache.portals.graffito.production.jdbc.drivers.path}"/>
- <echo message="org.apache.portals.graffito.production.jetspeed : ${org.apache.portals.graffito.production.jetspeed}"/>
- <j:set var="name" value="${org.apache.portals.graffito.production.database.default.name}X"/>
- <j:set var="url" value="${org.apache.portals.graffito.production.database.url}X"/>
- <j:set var="driver" value="${org.apache.portals.graffito.production.database.driver}X"/>
- <j:set var="password" value="${org.apache.portals.graffito.production.database.password}X"/>
- <j:set var="jarpath" value="${org.apache.portals.graffito.production.jdbc.drivers.path}X"/>
- <j:set var="jetspeed" value="${org.apache.portals.graffito.production.jetspeed}X"/>
- <j:if test="${name == 'X'}">
- <echo message="No value found for the build property org.apache.portals.graffito.production.database.default.name"/>
- <j:set var="status" value="error"/>
- </j:if >
- <j:if test="${url == 'X'}">
- <echo message="No value found for the build property org.apache.portals.graffito.production.database.url"/>
- <j:set var="status" value="error"/>
- </j:if >
- <j:if test="${driver == 'X'}">
- <echo message="No value found for the build property org.apache.portals.graffito.production.database.driver"/>
- <j:set var="status" value="error"/>
- </j:if >
- <j:if test="${password == 'X'}">
- <echo message="No value found for the build property org.apache.portals.graffito.production.database.password"/>
- </j:if >
- <j:if test="${jarpath == 'X'}">
- <echo message="No value found for the build property org.apache.portals.graffito.production.database.path"/>
- <j:set var="status" value="error"/>
- </j:if >
- <j:if test="${jetspeed == 'X'}">
- <echo message="No value found for the build property org.apache.portals.graffito.production.jetspeed"/>
- <j:set var="status" value="error"/>
- </j:if >
- <j:if test="${status == 'error'}" >
- <fail
- message="Impossible to continue if all Graffito build properties are not set in the build.properties defined in your USER_HOME folder"/>
- </j:if>
- <j:set var="org.apache.portals.graffito.database.default.name"
- value="${org.apache.portals.graffito.production.database.default.name}"/>
- <j:set var="org.apache.portals.graffito.database.url" value="${org.apache.portals.graffito.production.database.url}"/>
- <j:set var="org.apache.portals.graffito.database.driver"
- value="${org.apache.portals.graffito.production.database.driver}"/>
- <j:set var="org.apache.portals.graffito.database.user" value="${org.apache.portals.graffito.production.database.user}"/>
- <j:set var="org.apache.portals.graffito.database.password"
- value="${org.apache.portals.graffito.production.database.password}"/>
- <j:set var="org.apache.portals.graffito.jdbc.drivers.path"
- value="${org.apache.portals.graffito.production.jdbc.drivers.path}"/>
- </goal>
- <!-- ================================================================ -->
- <!-- EXECUTE CREATE DB SQL SCRIPTS -->
- <!-- TODO: I'd like to implement this as a plugin or use commons SQL -->
- <!-- ================================================================ -->
- <goal name="db.create.test">
- <attainGoal name="db.test.properties"/>
- <attainGoal name="db.create"/>
- </goal>
- <goal name="db.create.production">
- <attainGoal name="db.production.properties"/>
+ <echo message="Generating SQL schema creation scripts for Postgres"/>
+ <torque-sql basePathToDbProps="sql/base/" contextProperties="${torque.contextProperties}"
+ controlTemplate="${torque.template.sql}" idTableXMLFile="${torque.idTableXMLFile}"
+ outputDirectory="${maven.build.src}/sql/postgres" outputFile="report.${torque.project}.sql.generation"
+ sqldbmap="${maven.build.src}/sql/postgres/sqldb.map" targetDatabase="postgresql" useClasspath="true">
+ <fileset dir="${torque.schema.dir}" includes="${torque.schema.sql.includes}" excludes="${torque.schema.sql.excludes}"
+ />
+ </torque-sql>
+ </goal>
+ <!-- ================================================================ -->
+ <!-- SQL SCRIPT EXEC TEMPLATE -->
+ <!-- TODO: I'd like to implement this as a plugin or use commons SQL -->
+ <!-- Don't call this goal directly, call : -->
+ <!-- db.create.test or db.create.production -->
+ <!-- ================================================================ -->
+ <goal name="db.execute">
+ <sql driver="${org.apache.portals.graffito.database.driver}" url="${org.apache.portals.graffito.database.url}"
+ userid="${org.apache.portals.graffito.database.user}" password="${org.apache.portals.graffito.database.password}"
+ src="${database.arg.script}">
+ <classpath>
+ <path refid="maven.dependency.classpath"/>
+ <pathelement path="${org.apache.portals.graffito.jdbc.drivers.path}"/>
+ </classpath>
+ </sql>
+ </goal>
+ <goal name="db.test.properties">
+ <echo
+ message="org.apache.portals.graffito.test.database.default.name : ${org.apache.portals.graffito.test.database.default.name}"/>
+ <echo message="org.apache.portals.graffito.test.database.url : ${org.apache.portals.graffito.test.database.url}"/>
+ <echo message="org.apache.portals.graffito.test.database.driver : ${org.apache.portals.graffito.test.database.driver}"/>
+ <echo message="org.apache.portals.graffito.test.database.user : ${org.apache.portals.graffito.test.database.user}"/>
+ <echo
+ message="org.apache.portals.graffito.test.database.password : ${org.apache.portals.graffito.test.database.password}"/>
+ <echo message="org.apache.portals.graffito.test.database.path : ${org.apache.portals.graffito.test.jdbc.drivers.path}"/>
+ <echo message="org.apache.portals.graffito.test.jetspeed : ${org.apache.portals.graffito.test.jetspeed}"/>
+ <j:set var="name" value="${org.apache.portals.graffito.test.database.default.name}X"/>
+ <j:set var="url" value="${org.apache.portals.graffito.test.database.url}X"/>
+ <j:set var="driver" value="${org.apache.portals.graffito.test.database.driver}X"/>
+ <j:set var="password" value="${org.apache.portals.graffito.test.database.password}X"/>
+ <j:set var="jarpath" value="${org.apache.portals.graffito.test.jdbc.drivers.path}X"/>
+ <j:set var="jetspeed" value="${org.apache.portals.graffito.test.jetspeed}X"/>
+ <j:if test="${name == 'X'}">
+ <echo message="No value found for the build property org.apache.portals.graffito.test.database.default.name"/>
+ <j:set var="status" value="error"/>
+ </j:if >
+ <j:if test="${url == 'X'}">
+ <echo message="No value found for the build property org.apache.portals.graffito.test.database.url"/>
+ <j:set var="status" value="error"/>
+ </j:if >
+ <j:if test="${driver == 'X'}">
+ <echo message="No value found for the build property org.apache.portals.graffito.test.database.driver"/>
+ <j:set var="status" value="error"/>
+ </j:if >
+ <j:if test="${password == 'X'}">
+ <echo message="No value found for the build property org.apache.portals.graffito.test.database.password"/>
+ </j:if >
+ <j:if test="${jarpath == 'X'}">
+ <echo message="No value found for the build property org.apache.portals.graffito.test.database.path"/>
+ <j:set var="status" value="error"/>
+ </j:if >
+ <j:if test="${jetspeed == 'X'}">
+ <echo message="No value found for the build property org.apache.portals.graffito.test.jetspeed"/>
+ <j:set var="status" value="error"/>
+ </j:if >
+ <j:if test="${status == 'error'}" >
+ <fail
+ message="Impossible to continue if all Graffito build properties are not set in the build.properties defined in your USER_HOME folder"/>
+ </j:if>
+ <j:set var="org.apache.portals.graffito.database.default.name"
+ value="${org.apache.portals.graffito.test.database.default.name}"/>
+ <j:set var="org.apache.portals.graffito.database.url" value="${org.apache.portals.graffito.test.database.url}"/>
+ <j:set var="org.apache.portals.graffito.database.driver" value="${org.apache.portals.graffito.test.database.driver}"/>
+ <j:set var="org.apache.portals.graffito.database.user" value="${org.apache.portals.graffito.test.database.user}"/>
+ <j:set var="org.apache.portals.graffito.database.password" value="${org.apache.portals.graffito.test.database.password}"/>
+ <j:set var="org.apache.portals.graffito.jdbc.drivers.path" value="${org.apache.portals.graffito.test.jdbc.drivers.path}"/>
+ </goal>
+ <goal name="db.production.properties">
+ <echo
+ message="org.apache.portals.graffito.production.database.default.name : ${org.apache.portals.graffito.production.database.default.name}"/>
+ <echo
+ message="org.apache.portals.graffito.production.database.url : ${org.apache.portals.graffito.production.database.url}"/>
+ <echo
+ message="org.apache.portals.graffito.production.database.driver : ${org.apache.portals.graffito.production.database.driver}"/>
+ <echo
+ message="org.apache.portals.graffito.production.database.user : ${org.apache.portals.graffito.production.database.user}"/>
+ <echo
+ message="org.apache.portals.graffito.production.database.password : ${org.apache.portals.graffito.production.database.password}"/>
+ <echo
+ message="org.apache.portals.graffito.production.database.path : ${org.apache.portals.graffito.production.jdbc.drivers.path}"/>
+ <echo message="org.apache.portals.graffito.production.jetspeed : ${org.apache.portals.graffito.production.jetspeed}"/>
+ <j:set var="name" value="${org.apache.portals.graffito.production.database.default.name}X"/>
+ <j:set var="url" value="${org.apache.portals.graffito.production.database.url}X"/>
+ <j:set var="driver" value="${org.apache.portals.graffito.production.database.driver}X"/>
+ <j:set var="password" value="${org.apache.portals.graffito.production.database.password}X"/>
+ <j:set var="jarpath" value="${org.apache.portals.graffito.production.jdbc.drivers.path}X"/>
+ <j:set var="jetspeed" value="${org.apache.portals.graffito.production.jetspeed}X"/>
+ <j:if test="${name == 'X'}">
+ <echo message="No value found for the build property org.apache.portals.graffito.production.database.default.name"/>
+ <j:set var="status" value="error"/>
+ </j:if >
+ <j:if test="${url == 'X'}">
+ <echo message="No value found for the build property org.apache.portals.graffito.production.database.url"/>
+ <j:set var="status" value="error"/>
+ </j:if >
+ <j:if test="${driver == 'X'}">
+ <echo message="No value found for the build property org.apache.portals.graffito.production.database.driver"/>
+ <j:set var="status" value="error"/>
+ </j:if >
+ <j:if test="${password == 'X'}">
+ <echo message="No value found for the build property org.apache.portals.graffito.production.database.password"/>
+ </j:if >
+ <j:if test="${jarpath == 'X'}">
+ <echo message="No value found for the build property org.apache.portals.graffito.production.database.path"/>
+ <j:set var="status" value="error"/>
+ </j:if >
+ <j:if test="${jetspeed == 'X'}">
+ <echo message="No value found for the build property org.apache.portals.graffito.production.jetspeed"/>
+ <j:set var="status" value="error"/>
+ </j:if >
+ <j:if test="${status == 'error'}" >
+ <fail
+ message="Impossible to continue if all Graffito build properties are not set in the build.properties defined in your USER_HOME folder"/>
+ </j:if>
+ <j:set var="org.apache.portals.graffito.database.default.name"
+ value="${org.apache.portals.graffito.production.database.default.name}"/>
+ <j:set var="org.apache.portals.graffito.database.url" value="${org.apache.portals.graffito.production.database.url}"/>
+ <j:set var="org.apache.portals.graffito.database.driver"
+ value="${org.apache.portals.graffito.production.database.driver}"/>
+ <j:set var="org.apache.portals.graffito.database.user" value="${org.apache.portals.graffito.production.database.user}"/>
+ <j:set var="org.apache.portals.graffito.database.password"
+ value="${org.apache.portals.graffito.production.database.password}"/>
+ <j:set var="org.apache.portals.graffito.jdbc.drivers.path"
+ value="${org.apache.portals.graffito.production.jdbc.drivers.path}"/>
+ </goal>
+ <!-- ================================================================ -->
+ <!-- EXECUTE CREATE DB SQL SCRIPTS -->
+ <!-- TODO: I'd like to implement this as a plugin or use commons SQL -->
+ <!-- ================================================================ -->
+ <goal name="db.create.test">
+ <attainGoal name="db.test.properties"/>
+ <attainGoal name="db.create"/>
+ </goal>
+ <goal name="db.create.production">
+ <attainGoal name="db.production.properties"/>
<attainGoal name="db.create"/>
<j:set var="database.arg.script"
value="./src/sql/GraffitoServer/insert-j2-security.sql" />
<attainGoal name="db.execute" />
-
- </goal>
- <goal name="db.create">
- <j:if test="${jetspeed == 'falseX'}">
- <j:set var="database.arg.script"
- value="./target/src/sql/${org.apache.portals.graffito.database.default.name}/security-schema.sql" />
- <attainGoal name="db.execute" />
- <j:set var="database.arg.script"
- value="./target/src/sql/${org.apache.portals.graffito.database.default.name}/ojb-schema.sql" />
- <attainGoal name="db.execute" />
- </j:if>
- <j:set var="database.arg.script"
- value="./target/src/sql/${org.apache.portals.graffito.database.default.name}/graffitostore-schema.sql" />
- <attainGoal name="db.execute" />
- <j:set var="database.arg.script" value="./src/sql/GraffitoServer/insert-db.sql" />
- <attainGoal name="db.execute" />
- </goal>
- <!-- ================================================================ -->
- <!-- EXECUTE DROP DB SQL SCRIPTS -->
- <!-- TODO: I'd like to implement this as a plugin or use commons SQL -->
- <!-- ================================================================ -->
- <goal name="db.drop.test">
- <attainGoal name="db.test.properties"/>
- <attainGoal name="db.drop"/>
- </goal>
- <goal name="db.drop.production">
- <attainGoal name="db.production.properties"/>
+
+ </goal>
+ <goal name="db.create">
+ <j:if test="${jetspeed == 'falseX'}">
+ <j:set var="database.arg.script"
+ value="./target/src/sql/${org.apache.portals.graffito.database.default.name}/security-schema.sql" />
+ <attainGoal name="db.execute" />
+ <j:set var="database.arg.script"
+ value="./target/src/sql/${org.apache.portals.graffito.database.default.name}/ojb-schema.sql" />
+ <attainGoal name="db.execute" />
+ </j:if>
+ <j:set var="database.arg.script"
+ value="./target/src/sql/${org.apache.portals.graffito.database.default.name}/graffitostore-schema.sql" />
+ <attainGoal name="db.execute" />
+ <j:set var="database.arg.script" value="./src/sql/GraffitoServer/insert-db.sql" />
+ <attainGoal name="db.execute" />
+ </goal>
+ <!-- ================================================================ -->
+ <!-- EXECUTE DROP DB SQL SCRIPTS -->
+ <!-- TODO: I'd like to implement this as a plugin or use commons SQL -->
+ <!-- ================================================================ -->
+ <goal name="db.drop.test">
+ <attainGoal name="db.test.properties"/>
+ <attainGoal name="db.drop"/>
+ </goal>
+ <goal name="db.drop.production">
+ <attainGoal name="db.production.properties"/>
<attainGoal name="db.drop"/>
<j:set var="database.arg.script"
value="./src/sql/GraffitoServer/delete-j2-security.sql" />
<attainGoal name="db.execute" />
-
- </goal>
- <goal name="db.drop">
- <j:set var="database.arg.script"
- value="./src/sql/GraffitoServer/${org.apache.portals.graffito.database.default.name}/drop-db.sql" />
- <attainGoal name="db.execute" />
- <j:if test="${jetspeed == 'falseX'}">
- <j:set var="database.arg.script"
- value="./src/sql/GraffitoServer/${org.apache.portals.graffito.database.default.name}/drop-security.sql" />
- <attainGoal name="db.execute" />
- <j:set var="database.arg.script"
- value="./src/sql/GraffitoServer/${org.apache.portals.graffito.database.default.name}/drop-ojb.sql" />
- <attainGoal name="db.execute" />
- </j:if>
- </goal>
- <!-- ================================================================ -->
- <!-- EXECUTE DELETE DB SQL SCRIPTS -->
- <!-- TODO: I'd like to implement this as a plugin or use commons SQL -->
- <!-- ================================================================ -->
- <goal name="db.delete.test">
- <attainGoal name="db.test.properties"/>
- <attainGoal name="db.delete"/>
- </goal>
- <goal name="db.delete.production">
- <attainGoal name="db.production.properties"/>
- <attainGoal name="db.delete"/>
- </goal>
- <goal name="db.delete">
- <j:set var="database.arg.script" value="./src/sql/GraffitoServer/delete-db.sql" />
- <attainGoal name="db.execute" />
- </goal>
- <!-- ================================================================ -->
- <!-- EXECUTE DROP & CREATE DB SQL SCRIPTS -->
- <!-- TODO: I'd like to implement this as a plugin or use commons SQL -->
- <!-- ================================================================ -->
- <goal name="db.reinit.test">
- <attainGoal name="db.scripts.gen"/>
- <attainGoal name="db.drop.test"/>
- <attainGoal name="db.create.test"/>
+
+ </goal>
+ <goal name="db.drop">
+ <j:set var="database.arg.script"
+ value="./src/sql/GraffitoServer/${org.apache.portals.graffito.database.default.name}/drop-db.sql" />
+ <attainGoal name="db.execute" />
+ <j:if test="${jetspeed == 'falseX'}">
+ <j:set var="database.arg.script"
+ value="./src/sql/GraffitoServer/${org.apache.portals.graffito.database.default.name}/drop-security.sql" />
+ <attainGoal name="db.execute" />
+ <j:set var="database.arg.script"
+ value="./src/sql/GraffitoServer/${org.apache.portals.graffito.database.default.name}/drop-ojb.sql" />
+ <attainGoal name="db.execute" />
+ </j:if>
+ </goal>
+ <!-- ================================================================ -->
+ <!-- EXECUTE DELETE DB SQL SCRIPTS -->
+ <!-- TODO: I'd like to implement this as a plugin or use commons SQL -->
+ <!-- ================================================================ -->
+ <goal name="db.delete.test">
+ <attainGoal name="db.test.properties"/>
+ <attainGoal name="db.delete"/>
+ </goal>
+ <goal name="db.delete.production">
+ <attainGoal name="db.production.properties"/>
+ <attainGoal name="db.delete"/>
+ </goal>
+ <goal name="db.delete">
+ <j:set var="database.arg.script" value="./src/sql/GraffitoServer/delete-db.sql" />
+ <attainGoal name="db.execute" />
+ </goal>
+ <!-- ================================================================ -->
+ <!-- EXECUTE DROP & CREATE DB SQL SCRIPTS -->
+ <!-- TODO: I'd like to implement this as a plugin or use commons SQL -->
+ <!-- ================================================================ -->
+ <goal name="db.reinit.test">
+ <attainGoal name="db.scripts.gen"/>
+ <attainGoal name="db.drop.test"/>
+ <attainGoal name="db.create.test"/>
</goal>
<goal name="db.reinit.production">
@@ -302,14 +303,14 @@
<attainGoal name="db.drop.production"/>
<attainGoal name="db.create.production"/>
</goal>
-
- <!-- ================================================================ -->
- <!-- Intstall Graffito services & Graffito dependencies into -->
- <!-- a deployed J2 application -->
- <!-- ================================================================ -->
- <goal name="deploy">
- <copy todir="${org.apache.jetspeed.deploy.war.dir}/jetspeed/WEB-INF/lib" overwrite="true">
- <fileset file="${basedir}/target/${maven.final.name}.jar" />
- </copy>
- </goal>
+
+ <!-- ================================================================ -->
+ <!-- Intstall Graffito services & Graffito dependencies into -->
+ <!-- a deployed J2 application -->
+ <!-- ================================================================ -->
+ <goal name="deploy">
+ <copy todir="${org.apache.jetspeed.deploy.war.dir}/jetspeed/WEB-INF/lib" overwrite="true">
+ <fileset file="${basedir}/target/${maven.final.name}.jar" />
+ </copy>
+ </goal>
</project>
Modified: incubator/graffito/trunk/components/project.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/project.xml?rev=348293&r1=348292&r2=348293&view=diff
==============================================================================
--- incubator/graffito/trunk/components/project.xml (original)
+++ incubator/graffito/trunk/components/project.xml Tue Nov 22 15:40:19 2005
@@ -30,11 +30,11 @@
</description>
<shortDescription>Graffito Components</shortDescription>
- <repository>
- <connection>scm:subversion:https://svn.apache.org/repos/asf/incubator/graffito/trunk/components</connection>
- <developerConnection>scm:subversion:https://svn.apache.org/repos/asf/incubator/graffito/trunk/components</developerConnection>
- <url>http://svn.apache.org/viewcvs</url>
- </repository>
+ <repository>
+ <connection>scm:subversion:https://svn.apache.org/repos/asf/incubator/graffito/trunk/components</connection>
+ <developerConnection>scm:subversion:https://svn.apache.org/repos/asf/incubator/graffito/trunk/components</developerConnection>
+ <url>http://svn.apache.org/viewcvs</url>
+ </repository>
<dependencies>
@@ -52,12 +52,6 @@
</dependency>
<dependency>
- <id>jetspeed-persistence</id>
- <groupId>jetspeed2</groupId>
- <version>&jetspeed-version;</version>
- </dependency>
-
- <dependency>
<id>jetspeed-api</id>
<groupId>jetspeed2</groupId>
<version>&jetspeed-version;</version>
@@ -147,6 +141,11 @@
<version>1.2</version>
</dependency>
+ <dependency>
+ <id>commons-codec</id>
+ <version>1.3</version>
+ </dependency>
+
<dependency>
<id>xml-apis</id>
<version>2.0.2</version>
@@ -178,27 +177,7 @@
</dependency>
<dependency>
- <id>springframework:spring-core</id>
- <version>1.1.5</version>
- </dependency>
-
- <dependency>
- <id>springframework:spring-aop</id>
- <version>1.1.5</version>
- </dependency>
-
- <dependency>
- <id>springframework:spring-context</id>
- <version>1.1.5</version>
- </dependency>
-
- <dependency>
- <id>springframework:spring-dao</id>
- <version>1.1.5</version>
- </dependency>
-
- <dependency>
- <id>springframework:spring-orm</id>
+ <id>springframework:spring</id>
<version>1.1.5</version>
</dependency>
@@ -216,14 +195,7 @@
<id>oro</id>
<version>2.0.7</version>
</dependency>
-
- <dependency>
- <groupId>maven-plugins</groupId>
- <artifactId>maven-torque-plugin</artifactId>
- <version>3.2</version>
- <type>plugin</type>
- <properties/>
- </dependency>
+
</dependencies>