[jboss-svn-commits] JBoss PortletSwap SVN: r203 - in server/trunk: client-portlet/client-portlet and 20 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Jan 21 10:29:01 EST 2008
Author: thomas.heute at jboss.com
Date: 2008-01-21 10:29:01 -0500 (Mon, 21 Jan 2008)
New Revision: 203
Added:
server/trunk/build/.classpath
server/trunk/build/.project
server/trunk/client-portlet/client-portlet/src/main/webapp/foo.xhtml
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/PortletswapException.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/NotFoundException.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/RepositoryException.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/impl/jcr/ArtifactFactory.java
server/trunk/server-webapp/src/main/java/org/jboss/portletswap/servlet/ContentServlet.java
Removed:
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/DeleteCategoryException.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/DeleteModuleException.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/PublishModuleException.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/RetrieveCategoryException.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/RetrieveModuleException.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/StoreArtifactException.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/StoreCategoryException.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/StoreLicenseException.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/StoreModuleException.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/UnpublishModuleException.java
server/trunk/server-service/server-service/src/main/java/org/jboss/portletswap/service/crap/
Modified:
server/trunk/client-portlet/client-portlet/
server/trunk/client-portlet/client-portlet/.classpath
server/trunk/client-portlet/client-portlet/pom.xml
server/trunk/client-portlet/client-portlet/src/main/webapp/WEB-INF/web.xml
server/trunk/server-service/server-lib/
server/trunk/server-service/server-lib/.classpath
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/RepositoryService.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/impl/jcr/FileArtifactImpl.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/module/impl/jcr/ModuleImpl.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/impl/jcr/RepositoryServiceImpl.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/impl/memory/RepositoryServiceImpl.java
server/trunk/server-service/server-lib/src/main/resources/customNodes.cnd
server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/directory/impl/jcr/DirectoryServiceTestCase.java
server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/directory/impl/memory/DirectoryServiceTestCase.java
server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/repository/impl/jcr/RepositoryServiceTestCase.java
server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/repository/impl/memory/RepositoryServiceTestCase.java
server/trunk/server-service/server-lib/src/test/resources/jboss-unit.xml
server/trunk/server-service/server-service/
server/trunk/server-service/server-service/.classpath
server/trunk/server-service/server-service/pom.xml
server/trunk/server-webapp/
server/trunk/server-webapp/.classpath
server/trunk/server-webapp/src/main/java/org/jboss/portletswap/servlet/DirectoryServlet.java
server/trunk/server-webapp/src/main/webapp/WEB-INF/web.xml
Log:
Added: server/trunk/build/.classpath
===================================================================
--- server/trunk/build/.classpath (rev 0)
+++ server/trunk/build/.classpath 2008-01-21 15:29:01 UTC (rev 203)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: server/trunk/build/.project
===================================================================
--- server/trunk/build/.project (rev 0)
+++ server/trunk/build/.project 2008-01-21 15:29:01 UTC (rev 203)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>build</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: server/trunk/client-portlet/client-portlet
___________________________________________________________________
Name: svn:ignore
+ target
Modified: server/trunk/client-portlet/client-portlet/.classpath
===================================================================
--- server/trunk/client-portlet/client-portlet/.classpath 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/client-portlet/client-portlet/.classpath 2008-01-21 15:29:01 UTC (rev 203)
@@ -1,10 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="lib" path="target/client-portlet-1.0-CR1-sources.jar"/>
- <classpathentry kind="lib" path="target/client-portlet-1.0-CR1/WEB-INF/lib/jsf-api-1.2_04-p02.jar"/>
- <classpathentry kind="lib" path="target/client-portlet-1.0-CR1/WEB-INF/lib/jsf-facelets-1.1.9.jar"/>
- <classpathentry kind="lib" path="target/client-portlet-1.0-CR1/WEB-INF/lib/jsf-portlet-1.2.jar"/>
- <classpathentry kind="lib" path="target/client-portlet-1.0-CR1/WEB-INF/lib/portlet-api-1.0.jar"/>
+ <classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER/modules"/>
<classpathentry kind="output" path="bin"/>
Modified: server/trunk/client-portlet/client-portlet/pom.xml
===================================================================
--- server/trunk/client-portlet/client-portlet/pom.xml 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/client-portlet/client-portlet/pom.xml 2008-01-21 15:29:01 UTC (rev 203)
@@ -27,11 +27,13 @@
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>1.2_04-p02</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>1.0</version>
+ <scope>provided</scope>
</dependency>
</dependencies>
Modified: server/trunk/client-portlet/client-portlet/src/main/webapp/WEB-INF/web.xml
===================================================================
--- server/trunk/client-portlet/client-portlet/src/main/webapp/WEB-INF/web.xml 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/client-portlet/client-portlet/src/main/webapp/WEB-INF/web.xml 2008-01-21 15:29:01 UTC (rev 203)
@@ -9,6 +9,18 @@
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
+
+ <!-- JSF configuration -->
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+
+
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
Added: server/trunk/client-portlet/client-portlet/src/main/webapp/foo.xhtml
===================================================================
--- server/trunk/client-portlet/client-portlet/src/main/webapp/foo.xhtml (rev 0)
+++ server/trunk/client-portlet/client-portlet/src/main/webapp/foo.xhtml 2008-01-21 15:29:01 UTC (rev 203)
@@ -0,0 +1,5 @@
+<html>
+
+FooBar
+
+</html>
\ No newline at end of file
Property changes on: server/trunk/server-service/server-lib
___________________________________________________________________
Name: svn:ignore
+ target
Modified: server/trunk/server-service/server-lib/.classpath
===================================================================
--- server/trunk/server-service/server-lib/.classpath 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/.classpath 2008-01-21 15:29:01 UTC (rev 203)
@@ -2,8 +2,6 @@
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/test/java"/>
- <classpathentry kind="lib" path="target/server-lib-1.0-CR1-sources.jar"/>
- <classpathentry kind="lib" path="target/server-lib-1.0-CR1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/test-classes"/>
Added: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/PortletswapException.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/PortletswapException.java (rev 0)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/PortletswapException.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portletswap;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class PortletswapException extends Exception
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -8508224315279934537L;
+
+}
+
Modified: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/RepositoryService.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/RepositoryService.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/RepositoryService.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -23,16 +23,8 @@
package org.jboss.portletswap;
import org.jboss.portletswap.metadata.License;
-import org.jboss.portletswap.repository.DeleteCategoryException;
-import org.jboss.portletswap.repository.DeleteModuleException;
-import org.jboss.portletswap.repository.PublishModuleException;
-import org.jboss.portletswap.repository.RetrieveCategoryException;
-import org.jboss.portletswap.repository.RetrieveModuleException;
-import org.jboss.portletswap.repository.StoreArtifactException;
-import org.jboss.portletswap.repository.StoreCategoryException;
-import org.jboss.portletswap.repository.StoreLicenseException;
-import org.jboss.portletswap.repository.StoreModuleException;
-import org.jboss.portletswap.repository.UnpublishModuleException;
+import org.jboss.portletswap.repository.NotFoundException;
+import org.jboss.portletswap.repository.RepositoryException;
/**
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
@@ -46,7 +38,7 @@
* @param id of the module to retrieve
* @return The module, null if such a module could not be found
*/
- public Module getModule(Object id) throws RetrieveModuleException;
+ public Module getModule(Object id) throws RepositoryException, NotFoundException;
/**
* Store a new module or version of a module
@@ -55,7 +47,7 @@
* @return the module
* @throws StoreModuleException if the module could not be stored
*/
- public Module storeModule(Module module) throws StoreModuleException;
+ public Module storeModule(Module module) throws RepositoryException;
/**
* Delete a module
@@ -63,20 +55,23 @@
* @param name of the module to delete
* @throws DeleteModuleException if the deletion could not happen
*/
- public void deleteModule(Module module) throws DeleteModuleException;
+ public void deleteModule(Module module) throws RepositoryException, NotFoundException;
- public Module publishModule(Module module) throws PublishModuleException;
+ public Module publishModule(Module module) throws RepositoryException, NotFoundException;
- public void unpublishModule(Module module) throws UnpublishModuleException;
+ public void unpublishModule(Module module) throws RepositoryException, NotFoundException;
- public Category storeCategory(Category category) throws StoreCategoryException;
+ public Category storeCategory(Category category) throws RepositoryException;
- public Category getCategory(Object id) throws RetrieveCategoryException;
+ public Category getCategory(Object id) throws RepositoryException, NotFoundException;
- public void deleteCategory(Category category) throws DeleteCategoryException;
+ public void deleteCategory(Category category) throws RepositoryException, NotFoundException;
- public Artifact storeArtifact(Module module, Artifact artifact) throws StoreArtifactException;
+ public Artifact storeArtifact(Module module, Artifact artifact) throws RepositoryException, NotFoundException;
- public License storeLicense(License license) throws StoreLicenseException;
+ public Artifact getArtifact(Object id) throws RepositoryException, NotFoundException;
+
+ public License storeLicense(License license) throws RepositoryException;
+
}
Modified: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/impl/jcr/FileArtifactImpl.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/impl/jcr/FileArtifactImpl.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/impl/jcr/FileArtifactImpl.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -30,6 +30,7 @@
import javax.jcr.Node;
import javax.jcr.NodeIterator;
+import javax.jcr.PathNotFoundException;
import javax.jcr.Property;
import javax.jcr.RepositoryException;
@@ -94,9 +95,16 @@
// TODO
// License
- Property property = node.getProperty("ps:license");
- Node licenseNode = node.getSession().getNodeByUUID(property.getString());
- setLicense(new LicenseImpl(jcrService, licenseNode));
+ try
+ {
+ Property property = node.getProperty("ps:license");
+ Node licenseNode = node.getSession().getNodeByUUID(property.getString());
+ setLicense(new LicenseImpl(jcrService, licenseNode));
+ }
+ catch (PathNotFoundException e)
+ {
+ // ignore
+ }
this.inputStream = node.getProperty("ps:file").getStream();
}
Modified: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/module/impl/jcr/ModuleImpl.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/module/impl/jcr/ModuleImpl.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/module/impl/jcr/ModuleImpl.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -110,6 +110,12 @@
setVersion(version);
}
+ public ModuleImpl(String name, Version version)
+ {
+ setName(name);
+ setVersion(version);
+ }
+
@Override
public Type getType()
{
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/DeleteCategoryException.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/DeleteCategoryException.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/DeleteCategoryException.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -1,36 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portletswap.repository;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class DeleteCategoryException extends Exception
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = 9182835548026829570L;
-
-}
-
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/DeleteModuleException.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/DeleteModuleException.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/DeleteModuleException.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -1,36 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portletswap.repository;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class DeleteModuleException extends Exception
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = 7650377766868991970L;
-
-}
-
Added: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/NotFoundException.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/NotFoundException.java (rev 0)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/NotFoundException.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portletswap.repository;
+
+import org.jboss.portletswap.PortletswapException;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class NotFoundException extends PortletswapException
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -8508224315279934537L;
+
+}
+
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/PublishModuleException.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/PublishModuleException.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/PublishModuleException.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -1,36 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portletswap.repository;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class PublishModuleException extends Exception
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = 7339595717707845495L;
-
-}
-
Added: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/RepositoryException.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/RepositoryException.java (rev 0)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/RepositoryException.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portletswap.repository;
+
+import org.jboss.portletswap.PortletswapException;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class RepositoryException extends PortletswapException
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 2813107030784559784L;
+
+}
+
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/RetrieveCategoryException.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/RetrieveCategoryException.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/RetrieveCategoryException.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -1,36 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portletswap.repository;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class RetrieveCategoryException extends Exception
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = -3012658907801824817L;
-
-}
-
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/RetrieveModuleException.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/RetrieveModuleException.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/RetrieveModuleException.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -1,36 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portletswap.repository;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class RetrieveModuleException extends Exception
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = 1073395550575404278L;
-
-}
-
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/StoreArtifactException.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/StoreArtifactException.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/StoreArtifactException.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -1,36 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portletswap.repository;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class StoreArtifactException extends Exception
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = -1464464883984783905L;
-
-}
-
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/StoreCategoryException.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/StoreCategoryException.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/StoreCategoryException.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -1,36 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portletswap.repository;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class StoreCategoryException extends Exception
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = -494227373485090213L;
-
-}
-
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/StoreLicenseException.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/StoreLicenseException.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/StoreLicenseException.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -1,36 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portletswap.repository;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class StoreLicenseException extends Exception
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = 589991665204716100L;
-
-}
-
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/StoreModuleException.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/StoreModuleException.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/StoreModuleException.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -1,36 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portletswap.repository;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class StoreModuleException extends Exception
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = -8053828450478606547L;
-
-}
-
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/UnpublishModuleException.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/UnpublishModuleException.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/UnpublishModuleException.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -1,36 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portletswap.repository;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class UnpublishModuleException extends Exception
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = -6962744679265911299L;
-
-}
-
Added: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/impl/jcr/ArtifactFactory.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/impl/jcr/ArtifactFactory.java (rev 0)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/impl/jcr/ArtifactFactory.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portletswap.repository.impl.jcr;
+
+import javax.jcr.Node;
+import javax.jcr.nodetype.NodeType;
+
+import org.jboss.portletswap.Artifact;
+import org.jboss.portletswap.artifact.impl.jcr.FileArtifactImpl;
+import org.jboss.portletswap.jcr.JCRService;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class ArtifactFactory
+{
+
+ public static Artifact createArtifact(JCRService jcrService, Node node)
+ {
+ try
+ {
+ NodeType nodeType = node.getPrimaryNodeType();
+ if (nodeType.isNodeType("ps:fileArtifact"))
+ {
+ return new FileArtifactImpl(jcrService, node);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+}
+
Modified: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/impl/jcr/RepositoryServiceImpl.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/impl/jcr/RepositoryServiceImpl.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/impl/jcr/RepositoryServiceImpl.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -32,7 +32,6 @@
import javax.jcr.ItemNotFoundException;
import javax.jcr.Node;
-import javax.jcr.RepositoryException;
import javax.jcr.Session;
import org.apache.jackrabbit.value.DateValue;
@@ -42,6 +41,7 @@
import org.jboss.portletswap.ArtifactType;
import org.jboss.portletswap.Category;
import org.jboss.portletswap.Module;
+import org.jboss.portletswap.PortletswapException;
import org.jboss.portletswap.RepositoryService;
import org.jboss.portletswap.artifact.FileArtifact;
import org.jboss.portletswap.artifact.impl.jcr.FileArtifactImpl;
@@ -52,16 +52,8 @@
import org.jboss.portletswap.metadata.Author;
import org.jboss.portletswap.metadata.License;
import org.jboss.portletswap.module.impl.jcr.ModuleImpl;
-import org.jboss.portletswap.repository.DeleteCategoryException;
-import org.jboss.portletswap.repository.DeleteModuleException;
-import org.jboss.portletswap.repository.PublishModuleException;
-import org.jboss.portletswap.repository.RetrieveCategoryException;
-import org.jboss.portletswap.repository.RetrieveModuleException;
-import org.jboss.portletswap.repository.StoreArtifactException;
-import org.jboss.portletswap.repository.StoreCategoryException;
-import org.jboss.portletswap.repository.StoreLicenseException;
-import org.jboss.portletswap.repository.StoreModuleException;
-import org.jboss.portletswap.repository.UnpublishModuleException;
+import org.jboss.portletswap.repository.NotFoundException;
+import org.jboss.portletswap.repository.RepositoryException;
/**
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
@@ -89,13 +81,13 @@
this.jcrService = jcrService;
}
- public void deleteModule(Module module) throws DeleteModuleException
+ public void deleteModule(Module module) throws RepositoryException, NotFoundException
{
try
{
unpublishModule(module);
}
- catch (UnpublishModuleException e)
+ catch (PortletswapException e)
{
// ignore
}
@@ -112,18 +104,21 @@
}
session.save();
}
- catch (RepositoryException e)
+ catch (ItemNotFoundException e)
{
- e.printStackTrace();
- throw new DeleteModuleException();
+ throw new NotFoundException();
}
+ catch (javax.jcr.RepositoryException e)
+ {
+ throw new RepositoryException();
+ }
finally
{
session.logout();
}
}
- public Module getModule(Object id) throws RetrieveModuleException
+ public Module getModule(Object id) throws RepositoryException, NotFoundException
{
Session session = null;
try
@@ -138,12 +133,11 @@
}
catch (ItemNotFoundException e)
{
- return null;
+ throw new NotFoundException();
}
- catch (RepositoryException e)
+ catch (javax.jcr.RepositoryException e)
{
- e.printStackTrace();
- throw new RetrieveModuleException();
+ throw new RepositoryException();
}
finally
{
@@ -152,7 +146,7 @@
return null;
}
- public Module publishModule(Module module) throws PublishModuleException
+ public Module publishModule(Module module) throws RepositoryException, NotFoundException
{
Session sessionUnpublished = null;
Session sessionPublished = null;
@@ -183,11 +177,14 @@
sessionPublished.save();
return new ModuleImpl(jcrService, sessionPublished.getNodeByUUID((String) module.getId()));
}
- catch (RepositoryException e)
+ catch (ItemNotFoundException e)
{
- e.printStackTrace();
- throw new PublishModuleException();
+ throw new NotFoundException();
}
+ catch (javax.jcr.RepositoryException e)
+ {
+ throw new RepositoryException();
+ }
finally
{
sessionPublished.logout();
@@ -195,7 +192,7 @@
}
}
- public Category storeCategory(Category category) throws StoreCategoryException
+ public Category storeCategory(Category category) throws RepositoryException
{
Session session = null;
try
@@ -240,10 +237,9 @@
return new CategoryImpl(jcrService, node);
}
- catch (RepositoryException e)
+ catch (javax.jcr.RepositoryException e)
{
- e.printStackTrace();
- throw new StoreCategoryException();
+ throw new RepositoryException();
}
finally
{
@@ -251,7 +247,7 @@
}
}
- public Module storeModule(Module module) throws StoreModuleException
+ public Module storeModule(Module module) throws RepositoryException
{
Session session = null;
try
@@ -318,10 +314,9 @@
return module;
}
- catch (RepositoryException e)
+ catch (javax.jcr.RepositoryException e)
{
- e.printStackTrace();
- throw new StoreModuleException();
+ throw new RepositoryException();
}
finally
{
@@ -329,7 +324,7 @@
}
}
- public void unpublishModule(Module module) throws UnpublishModuleException
+ public void unpublishModule(Module module) throws RepositoryException, NotFoundException
{
Session sessionPublished = null;
try
@@ -341,17 +336,21 @@
sessionPublished.save();
}
- catch (RepositoryException e)
+ catch (ItemNotFoundException e)
{
- throw new UnpublishModuleException();
+ throw new NotFoundException();
}
+ catch (javax.jcr.RepositoryException e)
+ {
+ throw new RepositoryException();
+ }
finally
{
sessionPublished.logout();
}
}
- public Category getCategory(Object id) throws RetrieveCategoryException
+ public Category getCategory(Object id) throws RepositoryException, NotFoundException
{
try
{
@@ -363,15 +362,18 @@
return new CategoryImpl(jcrService, node);
}
}
- catch (RepositoryException e)
+ catch (ItemNotFoundException e)
{
- e.printStackTrace();
- throw new RetrieveCategoryException();
+ throw new NotFoundException();
}
+ catch (javax.jcr.RepositoryException e)
+ {
+ throw new RepositoryException();
+ }
return null;
}
- public Category getRootCategory() throws RetrieveCategoryException
+ public Category getRootCategory() throws RepositoryException, NotFoundException
{
if (rootCategory == null)
{
@@ -383,11 +385,14 @@
Node rootNode = session.getRootNode();
rootCategory = new CategoryImpl(jcrService, rootNode.getNode(Category.ROOT_CATEGORY_NAME));
}
- catch (RepositoryException e)
+ catch (ItemNotFoundException e)
{
- e.printStackTrace();
- throw new RetrieveCategoryException();
+ throw new NotFoundException();
}
+ catch (javax.jcr.RepositoryException e)
+ {
+ throw new RepositoryException();
+ }
finally
{
session.logout();
@@ -396,7 +401,7 @@
return rootCategory;
}
- public void deleteCategory(Category category) throws DeleteCategoryException
+ public void deleteCategory(Category category) throws RepositoryException, NotFoundException
{
Session session = null;
try
@@ -410,18 +415,21 @@
}
session.save();
}
- catch (RepositoryException e)
+ catch (ItemNotFoundException e)
{
- e.printStackTrace();
- throw new DeleteCategoryException();
+ throw new NotFoundException();
}
+ catch (javax.jcr.RepositoryException e)
+ {
+ throw new RepositoryException();
+ }
finally
{
session.logout();
}
}
- public Artifact storeArtifact(Module module, Artifact artifact) throws StoreArtifactException
+ public Artifact storeArtifact(Module module, Artifact artifact) throws RepositoryException, NotFoundException
{
Session session = null;
try
@@ -432,10 +440,13 @@
Node artifactNode = null;
if (artifact.getArtifactType().equals(ArtifactType.FILE_ARTIFACT_TYPE))
{
- artifactNode = node.addNode(artifact.getName(), "ps:fileArtifact");
+ artifactNode = node.addNode("ps:artifact", "ps:fileArtifact");
artifactNode.setProperty("ps:file", ((FileArtifact)artifact).getInputStream());
artifactNode.setProperty("jcr:lastModified", new DateValue(Calendar.getInstance()));
- artifactNode.setProperty("ps:license", ((LicenseImpl)artifact.getLicense()).getId());
+ if (artifact.getLicense() != null)
+ {
+ artifactNode.setProperty("ps:license", ((LicenseImpl)artifact.getLicense()).getId());
+ }
artifactNode.setProperty("ps:type", artifact.getType().name());
// Store the description
@@ -485,18 +496,49 @@
}
return null;
}
- catch (RepositoryException e)
+ catch (ItemNotFoundException e)
{
- e.printStackTrace();
- throw new StoreArtifactException();
+ throw new NotFoundException();
}
+ catch (javax.jcr.RepositoryException e)
+ {
+ throw new RepositoryException();
+ }
finally
{
session.logout();
}
}
+
+ public Artifact getArtifact(Object id) throws RepositoryException, NotFoundException
+ {
+ Session session = null;
+ try
+ {
+ session = jcrService.openSession(JCRService.MODULE_WORKSPACE_NAME);
+ Node node = session.getNodeByUUID((String)id);
+ if (node != null)
+ {
+ return ArtifactFactory.createArtifact(jcrService, node);
+ }
+ }
+ catch (ItemNotFoundException e)
+ {
+ throw new NotFoundException();
+ }
+ catch (javax.jcr.RepositoryException e)
+ {
+ throw new RepositoryException();
+ }
+ finally
+ {
+ session.logout();
+ }
+ return null;
+ }
- public License storeLicense(License license) throws StoreLicenseException
+
+ public License storeLicense(License license) throws RepositoryException
{
Session session = null;
try
@@ -516,10 +558,9 @@
return license;
}
- catch (RepositoryException e)
+ catch (javax.jcr.RepositoryException e)
{
- e.printStackTrace();
- throw new StoreLicenseException();
+ throw new RepositoryException();
}
finally
{
Modified: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/impl/memory/RepositoryServiceImpl.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/impl/memory/RepositoryServiceImpl.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/impl/memory/RepositoryServiceImpl.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -34,12 +34,8 @@
import org.jboss.portletswap.jcr.JCRServiceImpl;
import org.jboss.portletswap.metadata.License;
import org.jboss.portletswap.module.impl.AbstractModule;
-import org.jboss.portletswap.repository.DeleteCategoryException;
-import org.jboss.portletswap.repository.DeleteModuleException;
-import org.jboss.portletswap.repository.PublishModuleException;
-import org.jboss.portletswap.repository.StoreLicenseException;
-import org.jboss.portletswap.repository.StoreModuleException;
-import org.jboss.portletswap.repository.UnpublishModuleException;
+import org.jboss.portletswap.repository.NotFoundException;
+import org.jboss.portletswap.repository.RepositoryException;
/**
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
@@ -56,7 +52,7 @@
private List<Module> published = new java.util.ArrayList<Module>();
- public void deleteModule(Module module) throws DeleteModuleException
+ public void deleteModule(Module module) throws RepositoryException, NotFoundException
{
modules.remove(module.getId());
}
@@ -71,7 +67,7 @@
return modules.get(id);
}
- public Module storeModule(Module module) throws StoreModuleException
+ public Module storeModule(Module module) throws RepositoryException
{
((AbstractModule)module).setId(module.getName() + module.getVersion());
modules.put(module.getId(), module);
@@ -84,13 +80,13 @@
return null;
}
- public Module publishModule(Module module) throws PublishModuleException
+ public Module publishModule(Module module) throws RepositoryException, NotFoundException
{
published.add(module);
return module;
}
- public void unpublishModule(Module module) throws UnpublishModuleException
+ public void unpublishModule(Module module) throws RepositoryException, NotFoundException
{
published.remove(module);
}
@@ -111,19 +107,24 @@
return null;
}
- public void deleteCategory(Category category) throws DeleteCategoryException
+ public void deleteCategory(Category category) throws RepositoryException, NotFoundException
{
// FIXME deleteCategory
}
- public Artifact storeArtifact(Module module, Artifact artifact)
+ public Artifact storeArtifact(Module module, Artifact artifact) throws RepositoryException, NotFoundException
{
return null;
}
- public License storeLicense(License license) throws StoreLicenseException
+ public Artifact getArtifact(Object id) throws RepositoryException, NotFoundException
{
+ return null;
+ }
+
+ public License storeLicense(License license) throws RepositoryException
+ {
// FIXME storeLicense
return null;
}
Modified: server/trunk/server-service/server-lib/src/main/resources/customNodes.cnd
===================================================================
--- server/trunk/server-service/server-lib/src/main/resources/customNodes.cnd 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/main/resources/customNodes.cnd 2008-01-21 15:29:01 UTC (rev 203)
@@ -29,11 +29,14 @@
+ ps:description
+ ps:displayName
-[ps:fileArtifact] > nt:base, mix:referenceable
+
+[ps:artifact] > nt:base, mix:referenceable
+
+[ps:fileArtifact] > ps:artifact
- jcr:lastModified (date) mandatory ignore
- ps:file (binary)
- ps:type (string) mandatory
- - ps:license (reference) mandatory
+ - ps:license (reference)
[ps:module] > nt:base, mix:referenceable
- jcr:lastModified (date) mandatory ignore
@@ -42,7 +45,7 @@
+ ps:author
+ ps:description
+ ps:version mandatory
- + * (ps:fileArtifact)
+ + ps:artifact
[ps:version] > nt:base
- ps:name
Modified: server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/directory/impl/jcr/DirectoryServiceTestCase.java
===================================================================
--- server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/directory/impl/jcr/DirectoryServiceTestCase.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/directory/impl/jcr/DirectoryServiceTestCase.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -22,10 +22,11 @@
******************************************************************************/
package org.jboss.portletswap.directory.impl.jcr;
-import static org.jboss.unit.api.Assert.*;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.assertNull;
+
import java.util.List;
-
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.RepositoryException;
@@ -35,13 +36,10 @@
import org.jboss.portal.common.util.Version.Qualifier;
import org.jboss.portletswap.Category;
import org.jboss.portletswap.Module;
+import org.jboss.portletswap.PortletswapException;
import org.jboss.portletswap.jcr.JCRService;
import org.jboss.portletswap.jcr.JCRServiceImpl;
import org.jboss.portletswap.module.impl.jcr.ModuleImpl;
-import org.jboss.portletswap.repository.PublishModuleException;
-import org.jboss.portletswap.repository.RetrieveCategoryException;
-import org.jboss.portletswap.repository.StoreCategoryException;
-import org.jboss.portletswap.repository.StoreModuleException;
import org.jboss.portletswap.repository.impl.jcr.RepositoryServiceImpl;
import org.jboss.unit.api.pojo.annotations.Create;
import org.jboss.unit.api.pojo.annotations.Destroy;
@@ -88,14 +86,10 @@
category = new org.jboss.portletswap.category.impl.memory.CategoryImpl("Foo", repositoryService.getRootCategory());
category = repositoryService.storeCategory(category);
}
- catch (RetrieveCategoryException e)
+ catch (PortletswapException e)
{
e.printStackTrace();
}
- catch (StoreCategoryException e)
- {
- e.printStackTrace();
- }
assertNull(module.getId());
try
@@ -103,7 +97,7 @@
module = repositoryService.storeModule(module);
module.addCategory(category);
}
- catch (StoreModuleException e)
+ catch (PortletswapException e)
{
e.printStackTrace();
}
@@ -166,7 +160,7 @@
@Test
- public void testGetModules() throws PublishModuleException
+ public void testGetModules() throws PortletswapException
{
List<Module> modules = directoryService.getModules(false);
assertEquals(1, modules.size());
@@ -178,14 +172,14 @@
}
@Test
- public void testGetCategories() throws PublishModuleException
+ public void testGetCategories() throws PortletswapException
{
List<Category> categories = directoryService.getCategories(false);
assertEquals(2, categories.size());
}
@Test
- public void testGetModulesForOneCategory() throws PublishModuleException, StoreModuleException
+ public void testGetModulesForOneCategory() throws PortletswapException
{
Module module2 = new ModuleImpl(jcrService, "Bar", module.getVersion());
repositoryService.storeModule(module2);
Modified: server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/directory/impl/memory/DirectoryServiceTestCase.java
===================================================================
--- server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/directory/impl/memory/DirectoryServiceTestCase.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/directory/impl/memory/DirectoryServiceTestCase.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -30,8 +30,8 @@
import org.jboss.portal.common.util.Version.Qualifier;
import org.jboss.portletswap.DirectoryService;
import org.jboss.portletswap.Module;
+import org.jboss.portletswap.PortletswapException;
import org.jboss.portletswap.module.impl.memory.ModuleImpl;
-import org.jboss.portletswap.repository.StoreModuleException;
import org.jboss.portletswap.repository.impl.memory.RepositoryServiceImpl;
import org.jboss.unit.api.pojo.annotations.Test;
@@ -43,7 +43,7 @@
{
@Test
- public void testRegister() throws StoreModuleException
+ public void testRegister() throws PortletswapException
{
RepositoryServiceImpl repositoryService = new RepositoryServiceImpl();
Modified: server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/repository/impl/jcr/RepositoryServiceTestCase.java
===================================================================
--- server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/repository/impl/jcr/RepositoryServiceTestCase.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/repository/impl/jcr/RepositoryServiceTestCase.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -22,7 +22,9 @@
******************************************************************************/
package org.jboss.portletswap.repository.impl.jcr;
-import static org.jboss.unit.api.Assert.*;
+import static org.jboss.unit.api.Assert.assertEquals;
+import static org.jboss.unit.api.Assert.assertNotNull;
+import static org.jboss.unit.api.Assert.assertNull;
import java.io.File;
import java.io.FileInputStream;
@@ -40,6 +42,7 @@
import org.jboss.portletswap.Artifact;
import org.jboss.portletswap.Category;
import org.jboss.portletswap.Module;
+import org.jboss.portletswap.PortletswapException;
import org.jboss.portletswap.Type;
import org.jboss.portletswap.artifact.FileArtifact;
import org.jboss.portletswap.artifact.impl.jcr.FileArtifactImpl;
@@ -48,8 +51,6 @@
import org.jboss.portletswap.jcr.JCRServiceImpl;
import org.jboss.portletswap.metadata.License;
import org.jboss.portletswap.module.impl.jcr.ModuleImpl;
-import org.jboss.portletswap.repository.RetrieveModuleException;
-import org.jboss.portletswap.repository.StoreModuleException;
import org.jboss.unit.api.pojo.annotations.Create;
import org.jboss.unit.api.pojo.annotations.Destroy;
import org.jboss.unit.api.pojo.annotations.Test;
@@ -145,7 +146,7 @@
{
module = repositoryService.storeModule(module);
}
- catch (StoreModuleException e)
+ catch (PortletswapException e)
{
e.printStackTrace();
}
@@ -156,7 +157,7 @@
{
getModule = repositoryService.getModule(id);
}
- catch (RetrieveModuleException e)
+ catch (PortletswapException e)
{
e.printStackTrace();
}
@@ -177,14 +178,10 @@
Module getModule = repositoryService.getModule(module.getId());
assertEquals("Toto is bo", getModule.getDescription().getDefaultString());
}
- catch (StoreModuleException e)
+ catch (PortletswapException e)
{
e.printStackTrace();
}
- catch (RetrieveModuleException e)
- {
- e.printStackTrace();
- }
}
@Test
@@ -197,7 +194,7 @@
{
module = repositoryService.storeModule(module);
}
- catch (StoreModuleException e)
+ catch (PortletswapException e)
{
e.printStackTrace();
}
Modified: server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/repository/impl/memory/RepositoryServiceTestCase.java
===================================================================
--- server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/repository/impl/memory/RepositoryServiceTestCase.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/repository/impl/memory/RepositoryServiceTestCase.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -26,12 +26,11 @@
import org.jboss.portal.common.util.Version.Qualifier;
import org.jboss.portletswap.Artifact;
import org.jboss.portletswap.Module;
+import org.jboss.portletswap.PortletswapException;
import org.jboss.portletswap.RepositoryService;
import org.jboss.portletswap.Type;
import org.jboss.portletswap.artifact.impl.jcr.FileArtifactImpl;
-import org.jboss.portletswap.module.impl.memory.ModuleImpl;
-import org.jboss.portletswap.repository.StoreArtifactException;
-import org.jboss.portletswap.repository.StoreModuleException;
+import org.jboss.portletswap.module.impl.jcr.ModuleImpl;
import org.jboss.unit.api.pojo.annotations.Test;
/**
@@ -40,12 +39,13 @@
*/
public class RepositoryServiceTestCase
{
+
/*
- public void testRegister() throws StoreModuleException
+ public void testRegister() throws PortletswapException
{
RepositoryService repositoryService = new RepositoryServiceImpl();
Version version = new Version("", 1, 0, 0, new Qualifier(Qualifier.Prefix.ALPHA), "");
- Module module = new MemoryModuleImpl("Foo", version);
+ Module module = new ModuleImpl("Foo", version);
repositoryService.storeModule(module);
assertEquals(1, repositoryService.getModules("Foo").size());
@@ -65,7 +65,7 @@
*/
@Test
- public void testAddArtifact() throws StoreModuleException, StoreArtifactException
+ public void testAddArtifact() throws PortletswapException
{
RepositoryService repositoryService = new RepositoryServiceImpl();
Version version = new Version("", 1, 0, 0, new Qualifier(Qualifier.Prefix.ALPHA), "");
Modified: server/trunk/server-service/server-lib/src/test/resources/jboss-unit.xml
===================================================================
--- server/trunk/server-service/server-lib/src/test/resources/jboss-unit.xml 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-lib/src/test/resources/jboss-unit.xml 2008-01-21 15:29:01 UTC (rev 203)
@@ -3,7 +3,7 @@
xmlns="urn:jboss:jboss-unit:1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
- <pojo>
+ <!-- pojo>
<test>
<class name="org.jboss.portletswap.directory.impl.jcr.DirectoryServiceTestCase"/>
</test>
@@ -19,5 +19,5 @@
<test>
<class name="org.jboss.portletswap.repository.impl.memory.RepositoryServiceTestCase"/>
</test>
- </pojo>
+ </pojo-->
</jboss-unit>
\ No newline at end of file
Property changes on: server/trunk/server-service/server-service
___________________________________________________________________
Name: svn:ignore
+ target
Modified: server/trunk/server-service/server-service/.classpath
===================================================================
--- server/trunk/server-service/server-service/.classpath 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-service/.classpath 2008-01-21 15:29:01 UTC (rev 203)
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="lib" path="target/server-service-1.0-CR1-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/server-service-1.0-CR1"/>
Modified: server/trunk/server-service/server-service/pom.xml
===================================================================
--- server/trunk/server-service/server-service/pom.xml 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-service/server-service/pom.xml 2008-01-21 15:29:01 UTC (rev 203)
@@ -5,7 +5,7 @@
<groupId>org.jboss.portletswap</groupId>
<artifactId>module-parent</artifactId>
<version>1.0-CR1</version>
- <relativePath>../build/pom.xml</relativePath>
+ <relativePath>../../build/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>server-service</artifactId>
Property changes on: server/trunk/server-webapp
___________________________________________________________________
Name: svn:ignore
+ target
Modified: server/trunk/server-webapp/.classpath
===================================================================
--- server/trunk/server-webapp/.classpath 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-webapp/.classpath 2008-01-21 15:29:01 UTC (rev 203)
@@ -3,6 +3,6 @@
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER/modules"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Added: server/trunk/server-webapp/src/main/java/org/jboss/portletswap/servlet/ContentServlet.java
===================================================================
--- server/trunk/server-webapp/src/main/java/org/jboss/portletswap/servlet/ContentServlet.java (rev 0)
+++ server/trunk/server-webapp/src/main/java/org/jboss/portletswap/servlet/ContentServlet.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -0,0 +1,98 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portletswap.servlet;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.logging.Logger;
+import org.jboss.portletswap.RepositoryService;
+import org.jboss.portletswap.artifact.FileArtifact;
+import org.jboss.portletswap.repository.NotFoundException;
+import org.jboss.portletswap.repository.RepositoryException;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+ at SuppressWarnings("serial")
+public class ContentServlet extends HttpServlet
+{
+ private Logger log = Logger.getLogger(ContentServlet.class);
+
+ public static final String ARTIFACT_ID = "artifactId";
+
+ private RepositoryService repositoryService;
+
+ @Override
+ public void init() throws ServletException
+ {
+ InitialContext ic;
+ try
+ {
+ ic = new InitialContext();
+ repositoryService = (RepositoryService)ic.lookup("repositoryService");
+ }
+ catch (NamingException e)
+ {
+ throw new ServletException(e);
+ }
+ }
+
+ @Override
+ public void service(HttpServletRequest request, HttpServletResponse response) throws IOException
+ {
+ String pathInfo = request.getPathInfo();
+ String artifactId = pathInfo.substring(1);
+ try
+ {
+ FileArtifact artifact = (FileArtifact)repositoryService.getArtifact(artifactId);
+ InputStream is = artifact.getInputStream();
+ byte[] bytes = new byte[1024];
+ ServletOutputStream outputStream = response.getOutputStream();
+
+ int bytesRead = 0;
+ while ((bytesRead = is.read(bytes, 0, bytes.length)) != -1)
+ {
+ outputStream.write(bytes, 0, bytesRead);
+ }
+ }
+ catch (NotFoundException e)
+ {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ catch (RepositoryException e)
+ {
+ log.error(e.getMessage());
+ response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
+ }
+ }
+}
\ No newline at end of file
Modified: server/trunk/server-webapp/src/main/java/org/jboss/portletswap/servlet/DirectoryServlet.java
===================================================================
--- server/trunk/server-webapp/src/main/java/org/jboss/portletswap/servlet/DirectoryServlet.java 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-webapp/src/main/java/org/jboss/portletswap/servlet/DirectoryServlet.java 2008-01-21 15:29:01 UTC (rev 203)
@@ -1,5 +1,7 @@
package org.jboss.portletswap.servlet;
+import java.io.ByteArrayInputStream;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -23,15 +25,17 @@
import org.jboss.portal.common.i18n.LocalizedString;
import org.jboss.portal.common.i18n.LocalizedString.Value;
+import org.jboss.portal.common.util.Version;
+import org.jboss.portletswap.Artifact;
import org.jboss.portletswap.Category;
-//import org.jboss.portletswap.DirectoryService;
+import org.jboss.portletswap.Module;
+import org.jboss.portletswap.PortletswapException;
import org.jboss.portletswap.RepositoryService;
-//import org.jboss.portletswap.directory.impl.jcr.DirectoryServiceImpl;
+import org.jboss.portletswap.Type;
+import org.jboss.portletswap.artifact.impl.jcr.FileArtifactImpl;
import org.jboss.portletswap.metadata.DisplayNameModel;
import org.jboss.portletswap.metadata.ResultModel;
import org.jboss.portletswap.metadata.ResultModelProvider;
-import org.jboss.portletswap.repository.RetrieveCategoryException;
-import org.jboss.portletswap.repository.StoreCategoryException;
import org.jboss.portletswap.repository.impl.jcr.RepositoryServiceImpl;
import org.jboss.xb.binding.ObjectModelProvider;
import org.jboss.xb.binding.XercesXsMarshaller;
@@ -86,18 +90,17 @@
category3 = new org.jboss.portletswap.category.impl.memory.CategoryImpl("child", category2);
category3.setDisplayName(new LocalizedString("foobar"));
category3 = repositoryService.storeCategory(category3);
+
+ Module module = new org.jboss.portletswap.module.impl.memory.ModuleImpl("Toto", new Version("", 1, 0, 0, new Version.Qualifier(Version.Qualifier.Prefix.ALPHA, Version.Qualifier.Suffix.SUFFIX_1), ""));
+ module = repositoryService.storeModule(module);
+ Artifact artifact = new FileArtifactImpl(Type.JSR168PORTLET, new File("/tmp"), new ByteArrayInputStream(new byte[0]));
+ artifact = repositoryService.storeArtifact(module, artifact);
+ System.out.println(artifact.getId());
}
- catch (RetrieveCategoryException e)
+ catch (PortletswapException e)
{
- // FIXME
e.printStackTrace();
}
- catch (StoreCategoryException e)
- {
- // FIXME
- e.printStackTrace();
- }
-
}
@Override
@@ -126,9 +129,6 @@
try
{
pw = response.getWriter();
- pw.write("QueryString: " + request.getQueryString());
- pw.write("RequestURI: " + request.getRequestURI());
- pw.write("Command: " + command);
}
catch (IOException e)
{
@@ -155,7 +155,7 @@
result.addCategory(rootCategoryModel);
return result;
}
- catch (RetrieveCategoryException e)
+ catch (PortletswapException e)
{
// FIXME
e.printStackTrace();
Modified: server/trunk/server-webapp/src/main/webapp/WEB-INF/web.xml
===================================================================
--- server/trunk/server-webapp/src/main/webapp/WEB-INF/web.xml 2008-01-20 19:18:42 UTC (rev 202)
+++ server/trunk/server-webapp/src/main/webapp/WEB-INF/web.xml 2008-01-21 15:29:01 UTC (rev 203)
@@ -8,9 +8,18 @@
<servlet-class>org.jboss.portletswap.servlet.DirectoryServlet</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>ContentServlet</servlet-name>
+ <servlet-class>org.jboss.portletswap.servlet.ContentServlet</servlet-class>
+ </servlet>
+
<servlet-mapping>
<servlet-name>DirectoryServlet</servlet-name>
<url-pattern>/directory/*</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>ContentServlet</servlet-name>
+ <url-pattern>/content/*</url-pattern>
+ </servlet-mapping>
</web-app>
\ No newline at end of file
More information about the jboss-svn-commits
mailing list