[jboss-svn-commits] JBoss PortletSwap SVN: r204 - in server/trunk: server-service/server-lib/src/main/java/org/jboss/portletswap/artifact and 23 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Jan 21 11:39:44 EST 2008
Author: thomas.heute at jboss.com
Date: 2008-01-21 11:39:44 -0500 (Mon, 21 Jan 2008)
New Revision: 204
Added:
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/Artifact.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/Category.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/FileArtifact.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/Module.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/ReferencedArtifact.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/AbstractArtifactImpl.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/CategoryImpl.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/FileArtifactImpl.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/LicenseImpl.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/ModuleImpl.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/ReferencedArtifact.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/jcr/
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/jcr/JCRCategoryImpl.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/jcr/JCRModuleImpl.java
Removed:
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/Artifact.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/Category.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/Module.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/FileArtifact.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/ReferencedArtifact.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/impl/AbstractArtifactImpl.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/artifact/impl/jcr/LicenseImpl.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/category/impl/AbstractCategory.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/category/impl/jcr/CategoryImpl.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/category/impl/memory/CategoryImpl.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/module/impl/AbstractModule.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/module/impl/memory/ModuleImpl.java
Modified:
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/DirectoryService.java
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/directory/impl/jcr/DirectoryServiceImpl.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/directory/impl/memory/DirectoryServiceImpl.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/filter/CategoryFilter.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/filter/Filter.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/filter/TypeFilter.java
server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/jcr/JCRServiceImpl.java
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/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/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-webapp/src/main/java/org/jboss/portletswap/servlet/ContentServlet.java
server/trunk/server-webapp/src/main/java/org/jboss/portletswap/servlet/DirectoryServlet.java
Log:
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/Artifact.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/Artifact.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/Artifact.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -1,61 +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;
-
-import org.jboss.portal.common.i18n.LocalizedString;
-import org.jboss.portletswap.metadata.CompatibilityList;
-import org.jboss.portletswap.metadata.License;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public interface Artifact
-{
-
- public Object getId();
-
- public String getName();
-
- public ArtifactType getArtifactType();
-
- public Type getType();
-
- public LocalizedString getDescription();
-
- public void setDescription(LocalizedString description);
-
- public LocalizedString getDisplayName();
-
- public void setDisplayName(LocalizedString displayName);
-
- public CompatibilityList getCompatibilityList();
-
- public void setCompatibilityList(CompatibilityList compatibilityList);
-
- public License getLicense();
-
- public void setLicense(License license);
-
-}
-
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/Category.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/Category.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/Category.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -1,53 +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;
-
-import java.util.List;
-
-import org.jboss.portal.common.i18n.LocalizedString;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public interface Category
-{
-
- public static final String ROOT_CATEGORY_NAME = "org.jboss.portletswap.RootCategoryNode";
-
- public Category getParent();
-
- public void addChild(Category category);
-
- public List<Category> getChildren();
-
- public Object getId();
-
- public String getName();
-
- public LocalizedString getDisplayName();
-
- public void setDisplayName(LocalizedString displayName);
-
-}
-
Modified: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/DirectoryService.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/DirectoryService.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/DirectoryService.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -25,6 +25,8 @@
import java.util.List;
import org.jboss.portletswap.filter.Filter;
+import org.jboss.portletswap.model.Category;
+import org.jboss.portletswap.model.Module;
/**
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/Module.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/Module.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/Module.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -1,64 +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;
-
-import java.util.List;
-
-import org.jboss.portal.common.i18n.LocalizedString;
-import org.jboss.portal.common.util.Version;
-import org.jboss.portletswap.Artifact;
-import org.jboss.portletswap.metadata.Author;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public interface Module
-{
-
- public void setId(Object id);
-
- public Object getId();
-
- public String getName();
-
- public Type getType();
-
- public Version getVersion();
-
- public LocalizedString getDescription();
-
- public List<Author> getAuthors();
-
- public void setDescription(LocalizedString localizedString);
-
- public List<Artifact> getArtifacts();
-
- public void addArtifact(Artifact artifact);
-
- public List<Category> getCategories();
-
- public void addCategory(Category category);
-
-}
-
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-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/RepositoryService.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -23,6 +23,9 @@
package org.jboss.portletswap;
import org.jboss.portletswap.metadata.License;
+import org.jboss.portletswap.model.Artifact;
+import org.jboss.portletswap.model.Category;
+import org.jboss.portletswap.model.Module;
import org.jboss.portletswap.repository.NotFoundException;
import org.jboss.portletswap.repository.RepositoryException;
@@ -73,5 +76,7 @@
public License storeLicense(License license) throws RepositoryException;
+ public Category getRootCategory() throws RepositoryException, NotFoundException;;
+
}
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/FileArtifact.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/FileArtifact.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/FileArtifact.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -1,40 +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.artifact;
-
-import java.io.File;
-import java.io.InputStream;
-
-import org.jboss.portletswap.Artifact;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public interface FileArtifact extends Artifact
-{
- public InputStream getInputStream();
-
- public File getFile();
-}
-
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/ReferencedArtifact.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/ReferencedArtifact.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/ReferencedArtifact.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -1,37 +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.artifact;
-
-import java.net.URL;
-
-import org.jboss.portletswap.Artifact;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public interface ReferencedArtifact extends Artifact
-{
- public URL getUrl();
-}
-
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/impl/AbstractArtifactImpl.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/impl/AbstractArtifactImpl.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/impl/AbstractArtifactImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -1,136 +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.artifact.impl;
-
-import org.jboss.portal.common.i18n.LocalizedString;
-import org.jboss.portletswap.Artifact;
-import org.jboss.portletswap.ArtifactType;
-import org.jboss.portletswap.Type;
-import org.jboss.portletswap.metadata.CompatibilityList;
-import org.jboss.portletswap.metadata.License;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public abstract class AbstractArtifactImpl implements Artifact
-{
- private Object id;
-
- private String name;
-
- private ArtifactType artifactType;
-
- private Type type;
-
- private LocalizedString description;
-
- private LocalizedString displayName;
-
- private CompatibilityList compatibilityList;
-
- private License license;
-
- public ArtifactType getArtifactType()
- {
- return artifactType;
- }
-
- public void setArtifactType(ArtifactType artifactType)
- {
- this.artifactType = artifactType;
- }
-
- public Type getType()
- {
- return type;
- }
-
- public void setType(Type type)
- {
- this.type = type;
- }
-
- public LocalizedString getDescription()
- {
- return description;
- }
-
- public void setDescription(LocalizedString description)
- {
- this.description = description;
- }
-
- public LocalizedString getDisplayName()
- {
- return displayName;
- }
-
- public void setDisplayName(LocalizedString displayName)
- {
- this.displayName = displayName;
- }
-
- public CompatibilityList getCompatibilityList()
- {
- return compatibilityList;
- }
-
- public void setCompatibilityList(CompatibilityList compatibilityList)
- {
- this.compatibilityList = compatibilityList;
- }
-
- public License getLicense()
- {
- return license;
- }
-
- public void setLicense(License license)
- {
- this.license = license;
- }
-
- public Object getId()
- {
- return id;
- }
-
- public void setId(Object id)
- {
- this.id = id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
-
-}
-
Deleted: 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-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/impl/jcr/FileArtifactImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -1,128 +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.artifact.impl.jcr;
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-
-import org.jboss.portal.common.i18n.LocalizedString;
-import org.jboss.portletswap.ArtifactType;
-import org.jboss.portletswap.Type;
-import org.jboss.portletswap.artifact.FileArtifact;
-import org.jboss.portletswap.artifact.impl.AbstractArtifactImpl;
-import org.jboss.portletswap.jcr.JCRService;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class FileArtifactImpl extends AbstractArtifactImpl implements FileArtifact
-{
-
- private InputStream inputStream;
-
- private File file;
-
- public FileArtifactImpl(Type type, File file, InputStream inputStream)
- {
- setType(type);
- this.inputStream = inputStream;
- this.file = file;
- }
-
- public FileArtifactImpl(JCRService jcrService, Node node) throws RepositoryException
- {
- setName(node.getName());
- setId(node.getUUID());
-
- Property typeProperty = node.getProperty("ps:type");
- setType(Type.valueOf(typeProperty.getString()));
-
- // Description
- NodeIterator it = node.getNodes("ps:description");
- Map<Locale, String> values = new HashMap<Locale, String>();
- while (it.hasNext())
- {
- Node tmpNode = it.nextNode();
- Locale locale = new Locale(tmpNode.getProperty("jcr:language").getString());
- String value = tmpNode.getProperty("ps:value").getString();
- values.put(locale, value);
- }
- setDescription(new LocalizedString(values, Locale.ENGLISH));
-
- // DisplayName
- it = node.getNodes("ps:displayName");
- values = new HashMap<Locale, String>();
- while (it.hasNext())
- {
- Node tmpNode = it.nextNode();
- Locale locale = new Locale(tmpNode.getProperty("jcr:language").getString());
- String value = tmpNode.getProperty("ps:value").getString();
- values.put(locale, value);
- }
- setDisplayName(new LocalizedString(values, Locale.ENGLISH));
-
- // Compatibility List
- // TODO
-
- // License
- 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();
- }
-
- public InputStream getInputStream()
- {
- return inputStream;
- }
-
- public File getFile()
- {
- return file;
- }
-
- public ArtifactType getArtifactType()
- {
- return ArtifactType.FILE_ARTIFACT_TYPE;
- }
-
-}
-
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/impl/jcr/LicenseImpl.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/impl/jcr/LicenseImpl.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/impl/jcr/LicenseImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -1,78 +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.artifact.impl.jcr;
-
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-
-import org.jboss.portletswap.jcr.JCRService;
-import org.jboss.portletswap.metadata.License;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class LicenseImpl implements License
-{
- private String id;
-
- private String name;
-
- private String text;
-
- public LicenseImpl(String name, String text)
- {
- this.name = name;
- this.text = text;
- }
-
- public LicenseImpl(JCRService jcrService, Node licenseNode) throws RepositoryException
- {
- id = licenseNode.getUUID();
- name = licenseNode.getProperty("ps:name").getString();
- text = licenseNode.getProperty("ps:text").getString();
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getText()
- {
- return text;
- }
-
- public String getId()
- {
- return id;
- }
-
- public void setId(String id)
- {
- this.id = id;
-
- }
-
-}
-
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/category/impl/AbstractCategory.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/category/impl/AbstractCategory.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/category/impl/AbstractCategory.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -1,93 +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.category.impl;
-
-import java.util.List;
-
-import org.jboss.portal.common.i18n.LocalizedString;
-import org.jboss.portletswap.Category;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public abstract class AbstractCategory implements Category
-{
-
- private Object id;
-
- private LocalizedString displayName;
-
- private String name;
-
- public abstract Category getParent();
-
- public abstract void addChild(Category category);
-
- public abstract List<Category> getChildren();
-
- public Object getId()
- {
- return id;
- }
-
- public void setId(Object id)
- {
- if (this.id == null)
- {
- this.id = id;
- }
- else
- {
- throw new IllegalStateException("Not allowed to change the id");
- }
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- if (this.name == null)
- {
- this.name = name;
- }
- else
- {
- throw new IllegalStateException("Not allowed to change the name");
- }
- }
-
- public LocalizedString getDisplayName()
- {
- return displayName;
- }
-
- public void setDisplayName(LocalizedString displayName)
- {
- this.displayName = displayName;
- }
-}
-
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/category/impl/jcr/CategoryImpl.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/category/impl/jcr/CategoryImpl.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/category/impl/jcr/CategoryImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -1,137 +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.category.impl.jcr;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.UnsupportedRepositoryOperationException;
-
-import org.jboss.portletswap.Category;
-import org.jboss.portletswap.category.impl.AbstractCategory;
-import org.jboss.portletswap.jcr.JCRService;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class CategoryImpl extends AbstractCategory
-{
-
- private JCRService jcrService;
-
- public CategoryImpl(JCRService jcrService, Node node)
- {
- this.jcrService = jcrService;
- try
- {
- this.setId(node.getUUID());
- this.setName(node.getName());
- }
- catch (UnsupportedRepositoryOperationException e)
- {
- // FIXME
- e.printStackTrace();
- }
- catch (RepositoryException e)
- {
- // FIXME
- e.printStackTrace();
- }
- }
-
- @Override
- public void addChild(Category category)
- {
-
- }
-
- @Override
- public List<Category> getChildren()
- {
- Session session = null;
- try
- {
- session = jcrService.openSession(JCRService.MODULE_WORKSPACE_NAME);
- Node node = session.getNodeByUUID((String) getId());
- NodeIterator it = node.getNodes();
- List<Category> list = new ArrayList<Category>();
- while (it.hasNext())
- {
- Node tmpNode = it.nextNode();
- if (tmpNode.isNodeType("ps:category"))
- {
- list.add(new CategoryImpl(jcrService, tmpNode));
- }
- }
- return list;
- }
- catch (RepositoryException e)
- {
- // FIXME
- e.printStackTrace();
- return null;
- }
- finally
- {
- session.logout();
- }
- }
-
- @Override
- public Category getParent()
- {
- Session session = null;
-
- if (getName().equals(ROOT_CATEGORY_NAME))
- {
- return null;
- }
-
- try
- {
- session = jcrService.openSession(JCRService.MODULE_WORKSPACE_NAME);
- Node node = session.getNodeByUUID((String) getId());
- Node parent = node.getParent();
- return new CategoryImpl(jcrService, parent);
- }
- catch (RepositoryException e)
- {
- // FIXME
- e.printStackTrace();
- return null;
- }
- finally
- {
- session.logout();
- }
- }
-
-
-
-}
-
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/category/impl/memory/CategoryImpl.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/category/impl/memory/CategoryImpl.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/category/impl/memory/CategoryImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -1,90 +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.category.impl.memory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.portal.common.i18n.LocalizedString;
-import org.jboss.portletswap.Category;
-import org.jboss.portletswap.category.impl.AbstractCategory;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class CategoryImpl extends AbstractCategory
-{
- public static final String ROOT_CATEGORY_NAME = "org.jboss.portletswap.RootCategoryNode";
-
- private Category parent;
-
- private LocalizedString displayName;
-
- private List<Category> children;
-
- public CategoryImpl(String name, Category parent)
- {
- setParent(parent);
- setName(name);
- if (parent != null)
- {
- parent.addChild(this);
- }
- children = new ArrayList<Category>();
- }
-
- public Category getParent()
- {
- return parent;
- }
-
- private void setParent(Category parent)
- {
- this.parent = parent;
- }
-
- public void addChild(Category category)
- {
- children.add(category);
- }
-
- public LocalizedString getDisplayName()
- {
- if (displayName != null)
- {
- return displayName;
- }
- else
- {
- return new LocalizedString((String)getName());
- }
- }
-
- public List<Category> getChildren()
- {
- return children;
- }
-
-}
-
Modified: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/directory/impl/jcr/DirectoryServiceImpl.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/directory/impl/jcr/DirectoryServiceImpl.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/directory/impl/jcr/DirectoryServiceImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -35,15 +35,15 @@
import javax.jcr.query.QueryManager;
import javax.jcr.query.QueryResult;
-import org.jboss.portletswap.Category;
import org.jboss.portletswap.DirectoryService;
-import org.jboss.portletswap.Module;
import org.jboss.portletswap.Ordering;
import org.jboss.portletswap.Type;
-import org.jboss.portletswap.category.impl.jcr.CategoryImpl;
import org.jboss.portletswap.filter.Filter;
import org.jboss.portletswap.jcr.JCRService;
-import org.jboss.portletswap.module.impl.jcr.ModuleImpl;
+import org.jboss.portletswap.model.Category;
+import org.jboss.portletswap.model.Module;
+import org.jboss.portletswap.model.impl.jcr.JCRCategoryImpl;
+import org.jboss.portletswap.model.impl.jcr.JCRModuleImpl;
/**
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
@@ -85,7 +85,7 @@
Node node = it.nextNode();
if (node.isNodeType("ps:module"))
{
- result.add(new ModuleImpl(jcrService, node));
+ result.add(new JCRModuleImpl(jcrService, node));
}
}
return result;
@@ -128,7 +128,7 @@
Node node = it.nextNode();
if (node.isNodeType("ps:module"))
{
- result.add(new ModuleImpl(jcrService, node));
+ result.add(new JCRModuleImpl(jcrService, node));
}
}
return result;
@@ -200,7 +200,7 @@
Node node = it.nextNode();
if (node.isNodeType("ps:module"))
{
- result.add(new ModuleImpl(jcrService, node));
+ result.add(new JCRModuleImpl(jcrService, node));
}
}
return result;
@@ -273,7 +273,7 @@
Node node = it.nextNode();
if (node.isNodeType("ps:category"))
{
- result.add(new CategoryImpl(jcrService, node));
+ result.add(new JCRCategoryImpl(jcrService, node));
}
}
return result;
Modified: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/directory/impl/memory/DirectoryServiceImpl.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/directory/impl/memory/DirectoryServiceImpl.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/directory/impl/memory/DirectoryServiceImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -32,14 +32,14 @@
import java.util.TreeSet;
import org.jboss.portal.common.util.Tools;
-import org.jboss.portletswap.Category;
import org.jboss.portletswap.DirectoryService;
-import org.jboss.portletswap.Module;
import org.jboss.portletswap.Ordering;
import org.jboss.portletswap.Type;
import org.jboss.portletswap.filter.CategoryFilter;
import org.jboss.portletswap.filter.Filter;
import org.jboss.portletswap.filter.TypeFilter;
+import org.jboss.portletswap.model.Category;
+import org.jboss.portletswap.model.Module;
/**
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
Modified: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/filter/CategoryFilter.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/filter/CategoryFilter.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/filter/CategoryFilter.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.portletswap.filter;
-import org.jboss.portletswap.Category;
-import org.jboss.portletswap.Module;
+import org.jboss.portletswap.model.Category;
+import org.jboss.portletswap.model.Module;
/**
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
Modified: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/filter/Filter.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/filter/Filter.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/filter/Filter.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portletswap.filter;
-import org.jboss.portletswap.Module;
+import org.jboss.portletswap.model.Module;
/**
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
Modified: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/filter/TypeFilter.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/filter/TypeFilter.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/filter/TypeFilter.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.portletswap.filter;
-import org.jboss.portletswap.Module;
import org.jboss.portletswap.Type;
+import org.jboss.portletswap.model.Module;
/**
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
Modified: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/jcr/JCRServiceImpl.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/jcr/JCRServiceImpl.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/jcr/JCRServiceImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -44,7 +44,7 @@
import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
import org.apache.jackrabbit.core.nodetype.compact.CompactNodeTypeDefReader;
import org.apache.jackrabbit.value.DateValue;
-import org.jboss.portletswap.Category;
+import org.jboss.portletswap.model.Category;
/**
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
Copied: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/Artifact.java (from rev 202, server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/Artifact.java)
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/Artifact.java (rev 0)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/Artifact.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * 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.model;
+
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portletswap.ArtifactType;
+import org.jboss.portletswap.Type;
+import org.jboss.portletswap.metadata.CompatibilityList;
+import org.jboss.portletswap.metadata.License;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface Artifact
+{
+
+ public Object getId();
+
+ public String getName();
+
+ public ArtifactType getArtifactType();
+
+ public Type getType();
+
+ public LocalizedString getDescription();
+
+ public void setDescription(LocalizedString description);
+
+ public LocalizedString getDisplayName();
+
+ public void setDisplayName(LocalizedString displayName);
+
+ public CompatibilityList getCompatibilityList();
+
+ public void setCompatibilityList(CompatibilityList compatibilityList);
+
+ public License getLicense();
+
+ public void setLicense(License license);
+
+}
+
Copied: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/Category.java (from rev 202, server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/Category.java)
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/Category.java (rev 0)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/Category.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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.model;
+
+import java.util.List;
+
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portletswap.model.impl.CategoryImpl;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface Category
+{
+
+ public static final String ROOT_CATEGORY_NAME = "org.jboss.portletswap.RootCategoryNode";
+
+ public Category getParent();
+
+ public void addChild(Category category);
+
+ public List<Category> getChildren();
+
+ public Object getId();
+
+ public String getName();
+
+ public LocalizedString getDisplayName();
+
+ public void setDisplayName(LocalizedString displayName);
+
+
+}
+
Added: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/FileArtifact.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/FileArtifact.java (rev 0)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/FileArtifact.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * 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.model;
+
+import java.io.File;
+import java.io.InputStream;
+
+import org.jboss.portletswap.model.Artifact;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface FileArtifact extends Artifact
+{
+ public InputStream getInputStream();
+
+ public File getFile();
+}
+
Copied: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/Module.java (from rev 202, server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/Module.java)
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/Module.java (rev 0)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/Module.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * 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.model;
+
+import java.util.List;
+
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.common.util.Version;
+import org.jboss.portletswap.Type;
+import org.jboss.portletswap.metadata.Author;
+import org.jboss.portletswap.model.Artifact;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface Module
+{
+
+ public void setId(Object id);
+
+ public Object getId();
+
+ public String getName();
+
+ public Type getType();
+
+ public Version getVersion();
+
+ public LocalizedString getDescription();
+
+ public List<Author> getAuthors();
+
+ public void setDescription(LocalizedString localizedString);
+
+ public List<Artifact> getArtifacts();
+
+ public void addArtifact(Artifact artifact);
+
+ public List<Category> getCategories();
+
+ public void addCategory(Category category);
+
+}
+
Added: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/ReferencedArtifact.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/ReferencedArtifact.java (rev 0)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/ReferencedArtifact.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * 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.model;
+
+import java.net.URL;
+
+import org.jboss.portletswap.model.Artifact;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface ReferencedArtifact extends Artifact
+{
+ public URL getUrl();
+}
+
Copied: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/AbstractArtifactImpl.java (from rev 202, server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/impl/AbstractArtifactImpl.java)
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/AbstractArtifactImpl.java (rev 0)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/AbstractArtifactImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -0,0 +1,136 @@
+/******************************************************************************
+ * 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.model.impl;
+
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portletswap.ArtifactType;
+import org.jboss.portletswap.Type;
+import org.jboss.portletswap.metadata.CompatibilityList;
+import org.jboss.portletswap.metadata.License;
+import org.jboss.portletswap.model.Artifact;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public abstract class AbstractArtifactImpl implements Artifact
+{
+ private Object id;
+
+ private String name;
+
+ private ArtifactType artifactType;
+
+ private Type type;
+
+ private LocalizedString description;
+
+ private LocalizedString displayName;
+
+ private CompatibilityList compatibilityList;
+
+ private License license;
+
+ public ArtifactType getArtifactType()
+ {
+ return artifactType;
+ }
+
+ public void setArtifactType(ArtifactType artifactType)
+ {
+ this.artifactType = artifactType;
+ }
+
+ public Type getType()
+ {
+ return type;
+ }
+
+ public void setType(Type type)
+ {
+ this.type = type;
+ }
+
+ public LocalizedString getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(LocalizedString description)
+ {
+ this.description = description;
+ }
+
+ public LocalizedString getDisplayName()
+ {
+ return displayName;
+ }
+
+ public void setDisplayName(LocalizedString displayName)
+ {
+ this.displayName = displayName;
+ }
+
+ public CompatibilityList getCompatibilityList()
+ {
+ return compatibilityList;
+ }
+
+ public void setCompatibilityList(CompatibilityList compatibilityList)
+ {
+ this.compatibilityList = compatibilityList;
+ }
+
+ public License getLicense()
+ {
+ return license;
+ }
+
+ public void setLicense(License license)
+ {
+ this.license = license;
+ }
+
+ public Object getId()
+ {
+ return id;
+ }
+
+ public void setId(Object id)
+ {
+ this.id = id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+
+}
+
Added: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/CategoryImpl.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/CategoryImpl.java (rev 0)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/CategoryImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -0,0 +1,122 @@
+/******************************************************************************
+ * 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.model.impl;
+
+import java.util.List;
+
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portletswap.model.Category;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class CategoryImpl implements Category
+{
+
+ private Object id;
+
+ private LocalizedString displayName;
+
+ private String name;
+
+ private List<Category> children;
+
+ private Category parent;
+
+ protected CategoryImpl(String name)
+ {
+
+ }
+
+ public CategoryImpl(String name, Category parent)
+ {
+ this.name = name;
+ this.parent = parent;
+ }
+
+ public Category getParent()
+ {
+ return parent;
+ }
+
+ protected void getParent(Category parent)
+ {
+ this.parent = parent;
+ }
+
+ public void addChild(Category category)
+ {
+ children.add(category);
+ }
+
+ public List<Category> getChildren()
+ {
+ return children;
+ }
+
+ public Object getId()
+ {
+ return id;
+ }
+
+ public void setId(Object id)
+ {
+ if (this.id == null)
+ {
+ this.id = id;
+ }
+ else
+ {
+ throw new IllegalStateException("Not allowed to change the id");
+ }
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ if (this.name == null)
+ {
+ this.name = name;
+ }
+ else
+ {
+ throw new IllegalStateException("Not allowed to change the name");
+ }
+ }
+
+ public LocalizedString getDisplayName()
+ {
+ return displayName;
+ }
+
+ public void setDisplayName(LocalizedString displayName)
+ {
+ this.displayName = displayName;
+ }
+}
+
Copied: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/FileArtifactImpl.java (from rev 203, 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/model/impl/FileArtifactImpl.java (rev 0)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/FileArtifactImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -0,0 +1,127 @@
+/******************************************************************************
+ * 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.model.impl;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.Property;
+import javax.jcr.RepositoryException;
+
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portletswap.ArtifactType;
+import org.jboss.portletswap.Type;
+import org.jboss.portletswap.jcr.JCRService;
+import org.jboss.portletswap.model.FileArtifact;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class FileArtifactImpl extends AbstractArtifactImpl implements FileArtifact
+{
+
+ private InputStream inputStream;
+
+ private File file;
+
+ public FileArtifactImpl(Type type, File file, InputStream inputStream)
+ {
+ setType(type);
+ this.inputStream = inputStream;
+ this.file = file;
+ }
+
+ public FileArtifactImpl(JCRService jcrService, Node node) throws RepositoryException
+ {
+ setName(node.getName());
+ setId(node.getUUID());
+
+ Property typeProperty = node.getProperty("ps:type");
+ setType(Type.valueOf(typeProperty.getString()));
+
+ // Description
+ NodeIterator it = node.getNodes("ps:description");
+ Map<Locale, String> values = new HashMap<Locale, String>();
+ while (it.hasNext())
+ {
+ Node tmpNode = it.nextNode();
+ Locale locale = new Locale(tmpNode.getProperty("jcr:language").getString());
+ String value = tmpNode.getProperty("ps:value").getString();
+ values.put(locale, value);
+ }
+ setDescription(new LocalizedString(values, Locale.ENGLISH));
+
+ // DisplayName
+ it = node.getNodes("ps:displayName");
+ values = new HashMap<Locale, String>();
+ while (it.hasNext())
+ {
+ Node tmpNode = it.nextNode();
+ Locale locale = new Locale(tmpNode.getProperty("jcr:language").getString());
+ String value = tmpNode.getProperty("ps:value").getString();
+ values.put(locale, value);
+ }
+ setDisplayName(new LocalizedString(values, Locale.ENGLISH));
+
+ // Compatibility List
+ // TODO
+
+ // License
+ 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();
+ }
+
+ public InputStream getInputStream()
+ {
+ return inputStream;
+ }
+
+ public File getFile()
+ {
+ return file;
+ }
+
+ public ArtifactType getArtifactType()
+ {
+ return ArtifactType.FILE_ARTIFACT_TYPE;
+ }
+
+}
+
Copied: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/LicenseImpl.java (from rev 202, server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/artifact/impl/jcr/LicenseImpl.java)
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/LicenseImpl.java (rev 0)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/LicenseImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -0,0 +1,78 @@
+/******************************************************************************
+ * 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.model.impl;
+
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+
+import org.jboss.portletswap.jcr.JCRService;
+import org.jboss.portletswap.metadata.License;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class LicenseImpl implements License
+{
+ private String id;
+
+ private String name;
+
+ private String text;
+
+ public LicenseImpl(String name, String text)
+ {
+ this.name = name;
+ this.text = text;
+ }
+
+ public LicenseImpl(JCRService jcrService, Node licenseNode) throws RepositoryException
+ {
+ id = licenseNode.getUUID();
+ name = licenseNode.getProperty("ps:name").getString();
+ text = licenseNode.getProperty("ps:text").getString();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getText()
+ {
+ return text;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+
+ }
+
+}
+
Added: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/ModuleImpl.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/ModuleImpl.java (rev 0)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/ModuleImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -0,0 +1,181 @@
+/******************************************************************************
+ * 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.model.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.common.util.Version;
+import org.jboss.portletswap.Type;
+import org.jboss.portletswap.metadata.Author;
+import org.jboss.portletswap.model.Artifact;
+import org.jboss.portletswap.model.Category;
+import org.jboss.portletswap.model.Module;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class ModuleImpl implements Module
+{
+ private List<Artifact> artifacts;
+
+ private Object id;
+
+ private String name;
+
+ private Version version;
+
+ private LocalizedString description;
+
+ private List<Author> authors;
+
+ private List<Category> categories = new ArrayList<Category>();
+
+ public ModuleImpl(String name, Version version)
+ {
+ this.version = version;
+ this.name = name;
+ this.artifacts = new ArrayList<Artifact>();
+ }
+
+ public ModuleImpl(String name)
+ {
+ this.name = name;
+ this.artifacts = new ArrayList<Artifact>();
+ }
+
+ public ModuleImpl()
+ {
+ this.artifacts = new ArrayList<Artifact>();
+ }
+
+ public Object getId()
+ {
+ return id;
+ }
+
+ public Version getVersion()
+ {
+ return version;
+ }
+
+ public Type getType()
+ {
+ Type type = null;
+ for (Artifact artifact: artifacts)
+ {
+ if (type == null)
+ {
+ type = artifact.getType();
+ }
+ else if (type != artifact.getType())
+ {
+ type = Type.MIXED;
+ }
+ }
+ return type;
+ }
+
+ public List<Artifact> getArtifacts()
+ {
+ return artifacts;
+ }
+
+ public void setId(Object id)
+ {
+ if (this.id == null)
+ {
+ this.id = id;
+ }
+ else
+ {
+ throw new IllegalStateException("Not allowed to change the id");
+ }
+ }
+
+ public void setName(String name)
+ {
+ if (this.name == null)
+ {
+ this.name = name;
+ }
+ else
+ {
+ throw new IllegalStateException("Not allowed to change the name");
+ }
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setVersion(Version version)
+ {
+ this.version = version;
+ }
+
+ public LocalizedString getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(LocalizedString description)
+ {
+ this.description = description;
+ }
+
+ public List<Author> getAuthors()
+ {
+ return authors;
+ }
+
+ public void setAuthors(List<Author> authors)
+ {
+ this.authors = authors;
+ }
+
+ public List<Category> getCategories()
+ {
+ return categories;
+ }
+
+ public void setCategories(List<Category> categories)
+ {
+ this.categories = categories;
+ }
+
+ public void addCategory(Category category)
+ {
+ categories.add(category);
+ }
+
+ public void addArtifact(Artifact artifact)
+ {
+ artifacts.add(artifact);
+ }
+
+}
+
Added: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/ReferencedArtifact.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/ReferencedArtifact.java (rev 0)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/ReferencedArtifact.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * 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.model.impl;
+
+import java.net.URL;
+
+import org.jboss.portletswap.model.Artifact;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public interface ReferencedArtifact extends Artifact
+{
+ public URL getUrl();
+}
+
Added: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/jcr/JCRCategoryImpl.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/jcr/JCRCategoryImpl.java (rev 0)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/jcr/JCRCategoryImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -0,0 +1,136 @@
+/******************************************************************************
+ * 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.model.impl.jcr;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.UnsupportedRepositoryOperationException;
+
+import org.jboss.portletswap.jcr.JCRService;
+import org.jboss.portletswap.model.Category;
+import org.jboss.portletswap.model.impl.CategoryImpl;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class JCRCategoryImpl extends CategoryImpl
+{
+
+ private JCRService jcrService;
+
+ public JCRCategoryImpl(JCRService jcrService, Node node) throws RepositoryException
+ {
+ super(node.getName());
+ this.jcrService = jcrService;
+ try
+ {
+ this.setId(node.getUUID());
+ this.setName(node.getName());
+ }
+ catch (UnsupportedRepositoryOperationException e)
+ {
+ e.printStackTrace();
+ }
+ catch (RepositoryException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void addChild(Category category)
+ {
+
+ }
+
+ @Override
+ public List<Category> getChildren()
+ {
+ Session session = null;
+ try
+ {
+ session = jcrService.openSession(JCRService.MODULE_WORKSPACE_NAME);
+ Node node = session.getNodeByUUID((String) getId());
+ NodeIterator it = node.getNodes();
+ List<Category> list = new ArrayList<Category>();
+ while (it.hasNext())
+ {
+ Node tmpNode = it.nextNode();
+ if (tmpNode.isNodeType("ps:category"))
+ {
+ list.add(new JCRCategoryImpl(jcrService, tmpNode));
+ }
+ }
+ return list;
+ }
+ catch (RepositoryException e)
+ {
+ // FIXME
+ e.printStackTrace();
+ return null;
+ }
+ finally
+ {
+ session.logout();
+ }
+ }
+
+ @Override
+ public Category getParent()
+ {
+ Session session = null;
+
+ if (getName().equals(ROOT_CATEGORY_NAME))
+ {
+ return null;
+ }
+
+ try
+ {
+ session = jcrService.openSession(JCRService.MODULE_WORKSPACE_NAME);
+ Node node = session.getNodeByUUID((String) getId());
+ Node parent = node.getParent();
+ return new JCRCategoryImpl(jcrService, parent);
+ }
+ catch (RepositoryException e)
+ {
+ // FIXME
+ e.printStackTrace();
+ return null;
+ }
+ finally
+ {
+ session.logout();
+ }
+ }
+
+
+
+}
+
Added: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/jcr/JCRModuleImpl.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/jcr/JCRModuleImpl.java (rev 0)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/model/impl/jcr/JCRModuleImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -0,0 +1,243 @@
+/******************************************************************************
+ * 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.model.impl.jcr;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.Property;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Value;
+
+import org.apache.jackrabbit.value.ReferenceValue;
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.common.util.Version;
+import org.jboss.portletswap.Type;
+import org.jboss.portletswap.jcr.JCRService;
+import org.jboss.portletswap.metadata.Author;
+import org.jboss.portletswap.model.Artifact;
+import org.jboss.portletswap.model.Category;
+import org.jboss.portletswap.model.impl.FileArtifactImpl;
+import org.jboss.portletswap.model.impl.ModuleImpl;
+
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision$
+ */
+public class JCRModuleImpl extends ModuleImpl
+{
+
+ private List<Artifact> artifacts = new ArrayList<Artifact>();
+
+ private JCRService jcrService;
+
+ public JCRModuleImpl(JCRService jcrService, Node node) throws RepositoryException
+ {
+ this.jcrService = jcrService;
+
+ setName(node.getProperty("ps:name").getString());
+ setId(node.getUUID());
+
+ Node versionNode = node.getNode("ps:version");
+ Version version = new Version(versionNode.getProperty("ps:name").getString(),
+ (int)versionNode.getProperty("ps:major").getValue().getLong(),
+ (int)versionNode.getProperty("ps:minor").getValue().getLong(),
+ (int)versionNode.getProperty("ps:patch").getValue().getLong(),
+ new Version.Qualifier(
+ Version.Qualifier.Prefix.valueOf(versionNode.getProperty("ps:prefix").getValue().getString()),
+ Version.Qualifier.Suffix.valueOf(versionNode.getProperty("ps:suffix").getValue().getString())),
+ versionNode.getProperty("ps:codename").getValue().getString());
+ setVersion(version);
+
+ NodeIterator it = node.getNodes("ps:description");
+ Map<Locale, String> values = new HashMap<Locale, String>();
+ while (it.hasNext())
+ {
+ Node tmpNode = it.nextNode();
+ Locale locale = new Locale(tmpNode.getProperty("jcr:language").getString());
+ String value = tmpNode.getProperty("ps:value").getString();
+ values.put(locale, value);
+ }
+ setDescription(new LocalizedString(values, Locale.ENGLISH));
+
+ it = node.getNodes("ps:author");
+ List<Author> authors = new ArrayList<Author>();
+ while (it.hasNext())
+ {
+ Node tmpNode = it.nextNode();
+ Author author = new Author(tmpNode.getProperty("ps:username").getString(),
+ tmpNode.getProperty("ps:firstname").getString(),
+ tmpNode.getProperty("ps:lastname").getString());
+ authors.add(author);
+ }
+ setAuthors(authors);
+
+ }
+/*
+ public JCRModuleImpl(JCRService jcrService, String name, Version version)
+ {
+ this.jcrService = jcrService;
+ setName(name);
+ setVersion(version);
+ }
+*/
+ @Override
+ public Type getType()
+ {
+ Type type = null;
+ for (Artifact artifact: artifacts)
+ {
+ if (type == null)
+ {
+ type = artifact.getType();
+ }
+ else if (type != artifact.getType())
+ {
+ type = Type.MIXED;
+ }
+ }
+ return type;
+ }
+
+ @Override
+ public List<Artifact> getArtifacts()
+ {
+ Session session = null;
+ try
+ {
+ session = jcrService.openSession(JCRService.MODULE_WORKSPACE_NAME);
+
+ Node node = session.getNodeByUUID((String) getId());
+
+ List<Artifact> result = new ArrayList<Artifact>();
+ NodeIterator it = node.getNodes();
+ while (it.hasNext())
+ {
+ Node tmpNode = it.nextNode();
+ if (tmpNode.isNodeType("ps:fileArtifact"))
+ {
+ result.add(new FileArtifactImpl(jcrService, tmpNode));
+ }
+ }
+ return result;
+ }
+ catch (RepositoryException e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ session.logout();
+ }
+ return null;
+ }
+
+ @Override
+ public void addCategory(Category category)
+ {
+ Session session = null;
+ try
+ {
+ session = jcrService.openSession(JCRService.MODULE_WORKSPACE_NAME);
+
+ Node node = session.getNodeByUUID((String) getId());
+
+ List<Value> valuesList;
+ try
+ {
+ Property property = node.getProperty("ps:categoryRef");
+ valuesList = new ArrayList<Value>(Arrays.asList(property.getValues()));
+ }
+ catch (PathNotFoundException e)
+ {
+ valuesList = new ArrayList<Value>();
+ }
+
+ valuesList.add(new ReferenceValue(session.getNodeByUUID((String)category.getId())));
+ Value[] values = valuesList.toArray(new Value[valuesList.size()]);
+
+ node.setProperty("ps:categoryRef", values);
+ session.save();
+ }
+ catch (RepositoryException e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ session.logout();
+ }
+ }
+
+ @Override
+ public List<Category> getCategories()
+ {
+ Session session = null;
+ List<Category> categories = new ArrayList<Category>();
+ try
+ {
+ session = jcrService.openSession(JCRService.MODULE_WORKSPACE_NAME);
+ Node node = session.getNodeByUUID((String) getId());
+ Property property;
+ try
+ {
+ property = node.getProperty("ps:categoryRef");
+ }
+ catch (PathNotFoundException e)
+ {
+ return categories;
+ }
+
+ Value[] values = property.getValues();
+ for (Value value: values)
+ {
+ Node tmpNode = node.getSession().getNodeByUUID(value.getString());
+ Category category = new JCRCategoryImpl(jcrService, tmpNode);
+ categories.add(category);
+ }
+ return categories;
+ }
+ catch (RepositoryException e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ finally
+ {
+ session.logout();
+ }
+ }
+
+ public void addArtifact(Artifact artifact)
+ {
+ // repositoryService.storeArtifact(this, artifact);
+ }
+}
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/module/impl/AbstractModule.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/module/impl/AbstractModule.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/module/impl/AbstractModule.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -1,173 +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.module.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.portal.common.i18n.LocalizedString;
-import org.jboss.portal.common.util.Version;
-import org.jboss.portletswap.Artifact;
-import org.jboss.portletswap.Category;
-import org.jboss.portletswap.Module;
-import org.jboss.portletswap.Type;
-import org.jboss.portletswap.metadata.Author;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public abstract class AbstractModule implements Module
-{
- private List<Artifact> artifacts;
-
- private Object id;
-
- private String name;
-
- private Version version;
-
- private LocalizedString description;
-
- private List<Author> authors;
-
- private List<Category> categories = new ArrayList<Category>();
-
- public AbstractModule(String name, Version version)
- {
- this.version = version;
- this.name = name;
- this.artifacts = new ArrayList<Artifact>();
- }
-
- public AbstractModule(String name)
- {
- this.name = name;
- this.artifacts = new ArrayList<Artifact>();
- }
-
- public AbstractModule()
- {
- this.artifacts = new ArrayList<Artifact>();
- }
-
- public Object getId()
- {
- return id;
- }
-
- public Version getVersion()
- {
- return version;
- }
-
- public Type getType()
- {
- Type type = null;
- for (Artifact artifact: artifacts)
- {
- if (type == null)
- {
- type = artifact.getType();
- }
- else if (type != artifact.getType())
- {
- type = Type.MIXED;
- }
- }
- return type;
- }
-
- public List<Artifact> getArtifacts()
- {
- return artifacts;
- }
-
- public void setId(Object id)
- {
- if (this.id == null)
- {
- this.id = id;
- }
- else
- {
- throw new IllegalStateException("Not allowed to change the id");
- }
- }
-
- public void setName(String name)
- {
- if (this.name == null)
- {
- this.name = name;
- }
- else
- {
- throw new IllegalStateException("Not allowed to change the name");
- }
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setVersion(Version version)
- {
- this.version = version;
- }
-
- public LocalizedString getDescription()
- {
- return description;
- }
-
- public void setDescription(LocalizedString description)
- {
- this.description = description;
- }
-
- public List<Author> getAuthors()
- {
- return authors;
- }
-
- public void setAuthors(List<Author> authors)
- {
- this.authors = authors;
- }
-
- public List<Category> getCategories()
- {
- return categories;
- }
-
- public void setCategories(List<Category> categories)
- {
- this.categories = categories;
- }
-
- public abstract void addCategory(Category category);
-
-}
-
Deleted: 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-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/module/impl/jcr/ModuleImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -1,250 +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.module.impl.jcr;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.Property;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.Value;
-
-import org.apache.jackrabbit.value.ReferenceValue;
-import org.jboss.portal.common.i18n.LocalizedString;
-import org.jboss.portal.common.util.Version;
-import org.jboss.portletswap.Artifact;
-import org.jboss.portletswap.Category;
-import org.jboss.portletswap.Type;
-import org.jboss.portletswap.artifact.impl.jcr.FileArtifactImpl;
-import org.jboss.portletswap.category.impl.jcr.CategoryImpl;
-import org.jboss.portletswap.jcr.JCRService;
-import org.jboss.portletswap.metadata.Author;
-import org.jboss.portletswap.module.impl.AbstractModule;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class ModuleImpl extends AbstractModule
-{
-
- private List<Artifact> artifacts = new ArrayList<Artifact>();
-
- private JCRService jcrService;
-
- public ModuleImpl(JCRService jcrService, Node node) throws RepositoryException
- {
- this.jcrService = jcrService;
-
- setName(node.getProperty("ps:name").getString());
- setId(node.getUUID());
-
- Node versionNode = node.getNode("ps:version");
- Version version = new Version(versionNode.getProperty("ps:name").getString(),
- (int)versionNode.getProperty("ps:major").getValue().getLong(),
- (int)versionNode.getProperty("ps:minor").getValue().getLong(),
- (int)versionNode.getProperty("ps:patch").getValue().getLong(),
- new Version.Qualifier(
- Version.Qualifier.Prefix.valueOf(versionNode.getProperty("ps:prefix").getValue().getString()),
- Version.Qualifier.Suffix.valueOf(versionNode.getProperty("ps:suffix").getValue().getString())),
- versionNode.getProperty("ps:codename").getValue().getString());
- setVersion(version);
-
- NodeIterator it = node.getNodes("ps:description");
- Map<Locale, String> values = new HashMap<Locale, String>();
- while (it.hasNext())
- {
- Node tmpNode = it.nextNode();
- Locale locale = new Locale(tmpNode.getProperty("jcr:language").getString());
- String value = tmpNode.getProperty("ps:value").getString();
- values.put(locale, value);
- }
- setDescription(new LocalizedString(values, Locale.ENGLISH));
-
- it = node.getNodes("ps:author");
- List<Author> authors = new ArrayList<Author>();
- while (it.hasNext())
- {
- Node tmpNode = it.nextNode();
- Author author = new Author(tmpNode.getProperty("ps:username").getString(),
- tmpNode.getProperty("ps:firstname").getString(),
- tmpNode.getProperty("ps:lastname").getString());
- authors.add(author);
- }
- setAuthors(authors);
-
- }
-
- public ModuleImpl(JCRService jcrService, String name, Version version)
- {
- this.jcrService = jcrService;
- setName(name);
- setVersion(version);
- }
-
- public ModuleImpl(String name, Version version)
- {
- setName(name);
- setVersion(version);
- }
-
- @Override
- public Type getType()
- {
- Type type = null;
- for (Artifact artifact: artifacts)
- {
- if (type == null)
- {
- type = artifact.getType();
- }
- else if (type != artifact.getType())
- {
- type = Type.MIXED;
- }
- }
- return type;
- }
-
- @Override
- public List<Artifact> getArtifacts()
- {
- Session session = null;
- try
- {
- session = jcrService.openSession(JCRService.MODULE_WORKSPACE_NAME);
-
- Node node = session.getNodeByUUID((String) getId());
-
- List<Artifact> result = new ArrayList<Artifact>();
- NodeIterator it = node.getNodes();
- while (it.hasNext())
- {
- Node tmpNode = it.nextNode();
- if (tmpNode.isNodeType("ps:fileArtifact"))
- {
- result.add(new FileArtifactImpl(jcrService, tmpNode));
- }
- }
- return result;
- }
- catch (RepositoryException e)
- {
- e.printStackTrace();
- }
- finally
- {
- session.logout();
- }
- return null;
- }
-
- @Override
- public void addCategory(Category category)
- {
- Session session = null;
- try
- {
- session = jcrService.openSession(JCRService.MODULE_WORKSPACE_NAME);
-
- Node node = session.getNodeByUUID((String) getId());
-
- List<Value> valuesList;
- try
- {
- Property property = node.getProperty("ps:categoryRef");
- valuesList = new ArrayList<Value>(Arrays.asList(property.getValues()));
- }
- catch (PathNotFoundException e)
- {
- valuesList = new ArrayList<Value>();
- }
-
- valuesList.add(new ReferenceValue(session.getNodeByUUID((String)category.getId())));
- Value[] values = valuesList.toArray(new Value[valuesList.size()]);
-
- node.setProperty("ps:categoryRef", values);
- session.save();
- }
- catch (RepositoryException e)
- {
- e.printStackTrace();
- }
- finally
- {
- session.logout();
- }
- }
-
- @Override
- public List<Category> getCategories()
- {
- Session session = null;
- List<Category> categories = new ArrayList<Category>();
- try
- {
- session = jcrService.openSession(JCRService.MODULE_WORKSPACE_NAME);
- Node node = session.getNodeByUUID((String) getId());
- Property property;
- try
- {
- property = node.getProperty("ps:categoryRef");
- }
- catch (PathNotFoundException e)
- {
- return categories;
- }
-
- Value[] values = property.getValues();
- for (Value value: values)
- {
- Node tmpNode = node.getSession().getNodeByUUID(value.getString());
- Category category = new CategoryImpl(jcrService, tmpNode);
- categories.add(category);
- }
- return categories;
- }
- catch (RepositoryException e)
- {
- e.printStackTrace();
- return null;
- }
- finally
- {
- session.logout();
- }
- }
-
- public void addArtifact(Artifact artifact)
- {
- // repositoryService.storeArtifact(this, artifact);
- }
-}
Deleted: server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/module/impl/memory/ModuleImpl.java
===================================================================
--- server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/module/impl/memory/ModuleImpl.java 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/module/impl/memory/ModuleImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -1,107 +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.module.impl.memory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.portal.common.util.Version;
-import org.jboss.portletswap.Artifact;
-import org.jboss.portletswap.Category;
-import org.jboss.portletswap.Type;
-import org.jboss.portletswap.metadata.Author;
-import org.jboss.portletswap.module.impl.AbstractModule;
-
-/**
- * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
- * @version $Revision$
- */
-public class ModuleImpl extends AbstractModule
-{
-
- private List<Artifact> artifacts;
-
- public ModuleImpl(String name, Version version)
- {
- super(name, version);
- artifacts = new ArrayList<Artifact>();
- }
-
- public Type getType()
- {
- Type type = null;
- for (Artifact artifact: artifacts)
- {
- if (type == null)
- {
- type = artifact.getType();
- }
- else if (type != artifact.getType())
- {
- type = Type.MIXED;
- }
- }
- return type;
- }
-
- public void addArtifact(Artifact artifact)
- {
- artifacts.add(artifact);
- }
-
- public List<Artifact> getArtifacts()
- {
- return artifacts;
- }
-
- public void setArtifacts(List<Artifact> artifacts)
- {
- this.artifacts = artifacts;
- }
-
- public void addCategory(Category category)
- {
- // FIXME addCategory
-
- }
-
- public List<Author> getAuthors()
- {
- // FIXME getAuthors
- return null;
- }
-
- public List<Category> getCategories()
- {
- // FIXME getCategories
- return null;
- }
-
- public List<String> getKeywords()
- {
- // FIXME getKeywords
- return null;
- }
-
-}
-
Modified: 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 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/impl/jcr/ArtifactFactory.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -25,9 +25,9 @@
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;
+import org.jboss.portletswap.model.Artifact;
+import org.jboss.portletswap.model.impl.FileArtifactImpl;
/**
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
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-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/impl/jcr/RepositoryServiceImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -37,21 +37,20 @@
import org.apache.jackrabbit.value.DateValue;
import org.jboss.portal.common.i18n.LocalizedString;
import org.jboss.portal.common.util.Version;
-import org.jboss.portletswap.Artifact;
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;
-import org.jboss.portletswap.artifact.impl.jcr.LicenseImpl;
-import org.jboss.portletswap.category.impl.AbstractCategory;
-import org.jboss.portletswap.category.impl.jcr.CategoryImpl;
import org.jboss.portletswap.jcr.JCRService;
import org.jboss.portletswap.metadata.Author;
import org.jboss.portletswap.metadata.License;
-import org.jboss.portletswap.module.impl.jcr.ModuleImpl;
+import org.jboss.portletswap.model.Artifact;
+import org.jboss.portletswap.model.Category;
+import org.jboss.portletswap.model.FileArtifact;
+import org.jboss.portletswap.model.Module;
+import org.jboss.portletswap.model.impl.FileArtifactImpl;
+import org.jboss.portletswap.model.impl.LicenseImpl;
+import org.jboss.portletswap.model.impl.jcr.JCRCategoryImpl;
+import org.jboss.portletswap.model.impl.jcr.JCRModuleImpl;
import org.jboss.portletswap.repository.NotFoundException;
import org.jboss.portletswap.repository.RepositoryException;
@@ -118,7 +117,7 @@
}
}
- public Module getModule(Object id) throws RepositoryException, NotFoundException
+ public JCRModuleImpl getModule(Object id) throws RepositoryException, NotFoundException
{
Session session = null;
try
@@ -128,7 +127,7 @@
Node node = session.getNodeByUUID((String)id);
if (node != null)
{
- return new ModuleImpl(jcrService, node);
+ return new JCRModuleImpl(jcrService, node);
}
}
catch (ItemNotFoundException e)
@@ -146,7 +145,7 @@
return null;
}
- public Module publishModule(Module module) throws RepositoryException, NotFoundException
+ public JCRModuleImpl publishModule(Module module) throws RepositoryException, NotFoundException
{
Session sessionUnpublished = null;
Session sessionPublished = null;
@@ -175,7 +174,7 @@
sessionPublished.getWorkspace().clone(sessionUnpublished.getWorkspace().getName(), node.getPath(), node.getPath(), false);
sessionPublished.save();
- return new ModuleImpl(jcrService, sessionPublished.getNodeByUUID((String) module.getId()));
+ return new JCRModuleImpl(jcrService, sessionPublished.getNodeByUUID((String) module.getId()));
}
catch (ItemNotFoundException e)
{
@@ -192,7 +191,7 @@
}
}
- public Category storeCategory(Category category) throws RepositoryException
+ public JCRCategoryImpl storeCategory(Category category) throws RepositoryException
{
Session session = null;
try
@@ -200,7 +199,7 @@
session = jcrService.openSession(JCRService.MODULE_WORKSPACE_NAME);
Node parentNode = null;
- if (category.getName() == AbstractCategory.ROOT_CATEGORY_NAME)
+ if (category.getName() == Category.ROOT_CATEGORY_NAME)
{
parentNode = session.getRootNode();
}
@@ -235,7 +234,7 @@
session.save();
- return new CategoryImpl(jcrService, node);
+ return new JCRCategoryImpl(jcrService, node);
}
catch (javax.jcr.RepositoryException e)
{
@@ -247,7 +246,7 @@
}
}
- public Module storeModule(Module module) throws RepositoryException
+ public JCRModuleImpl storeModule(Module module) throws RepositoryException
{
Session session = null;
try
@@ -310,9 +309,7 @@
session.save();
- module.setId(moduleNode.getUUID());
-
- return module;
+ return new JCRModuleImpl(jcrService, moduleNode);
}
catch (javax.jcr.RepositoryException e)
{
@@ -350,7 +347,7 @@
}
}
- public Category getCategory(Object id) throws RepositoryException, NotFoundException
+ public JCRCategoryImpl getCategory(Object id) throws RepositoryException, NotFoundException
{
try
{
@@ -359,7 +356,7 @@
Node node = session.getNodeByUUID((String)id);
if (node != null)
{
- return new CategoryImpl(jcrService, node);
+ return new JCRCategoryImpl(jcrService, node);
}
}
catch (ItemNotFoundException e)
@@ -373,7 +370,7 @@
return null;
}
- public Category getRootCategory() throws RepositoryException, NotFoundException
+ public JCRCategoryImpl getRootCategory() throws RepositoryException, NotFoundException
{
if (rootCategory == null)
{
@@ -383,7 +380,7 @@
session = jcrService.openSession(JCRService.MODULE_WORKSPACE_NAME);
Node rootNode = session.getRootNode();
- rootCategory = new CategoryImpl(jcrService, rootNode.getNode(Category.ROOT_CATEGORY_NAME));
+ rootCategory = new JCRCategoryImpl(jcrService, rootNode.getNode(Category.ROOT_CATEGORY_NAME));
}
catch (ItemNotFoundException e)
{
@@ -398,7 +395,7 @@
session.logout();
}
}
- return rootCategory;
+ return (JCRCategoryImpl)rootCategory;
}
public void deleteCategory(Category category) throws RepositoryException, NotFoundException
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-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/main/java/org/jboss/portletswap/repository/impl/memory/RepositoryServiceImpl.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -26,14 +26,14 @@
import java.util.List;
import java.util.Map;
-import org.jboss.portletswap.Artifact;
-import org.jboss.portletswap.Category;
-import org.jboss.portletswap.Module;
import org.jboss.portletswap.RepositoryService;
-import org.jboss.portletswap.category.impl.memory.CategoryImpl;
import org.jboss.portletswap.jcr.JCRServiceImpl;
import org.jboss.portletswap.metadata.License;
-import org.jboss.portletswap.module.impl.AbstractModule;
+import org.jboss.portletswap.model.Artifact;
+import org.jboss.portletswap.model.Category;
+import org.jboss.portletswap.model.Module;
+import org.jboss.portletswap.model.impl.CategoryImpl;
+import org.jboss.portletswap.model.impl.ModuleImpl;
import org.jboss.portletswap.repository.NotFoundException;
import org.jboss.portletswap.repository.RepositoryException;
@@ -69,7 +69,7 @@
public Module storeModule(Module module) throws RepositoryException
{
- ((AbstractModule)module).setId(module.getName() + module.getVersion());
+ ((ModuleImpl)module).setId(module.getName() + module.getVersion());
modules.put(module.getId(), module);
return module;
}
@@ -129,6 +129,12 @@
return null;
}
+ public Category getRootCategory() throws RepositoryException, NotFoundException
+ {
+ // FIXME getRootCategory
+ return null;
+ }
+
}
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-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/directory/impl/jcr/DirectoryServiceTestCase.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -34,12 +34,14 @@
import org.jboss.portal.common.util.Version;
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.model.Category;
+import org.jboss.portletswap.model.Module;
+import org.jboss.portletswap.model.impl.CategoryImpl;
+import org.jboss.portletswap.model.impl.ModuleImpl;
+import org.jboss.portletswap.model.impl.jcr.JCRModuleImpl;
import org.jboss.portletswap.repository.impl.jcr.RepositoryServiceImpl;
import org.jboss.unit.api.pojo.annotations.Create;
import org.jboss.unit.api.pojo.annotations.Destroy;
@@ -78,12 +80,12 @@
Version version = new Version("", 1, 0, 0, new Qualifier(Qualifier.Prefix.ALPHA), "");
- module = new ModuleImpl(jcrService, "Foo", version);
+ module = new ModuleImpl("Foo", version);
try
{
- category = new org.jboss.portletswap.category.impl.memory.CategoryImpl("Foo", repositoryService.getRootCategory());
+ category = new CategoryImpl("Foo", repositoryService.getRootCategory());
category = repositoryService.storeCategory(category);
}
catch (PortletswapException e)
@@ -181,8 +183,8 @@
@Test
public void testGetModulesForOneCategory() throws PortletswapException
{
- Module module2 = new ModuleImpl(jcrService, "Bar", module.getVersion());
- repositoryService.storeModule(module2);
+ Module module2 = new ModuleImpl("Bar", module.getVersion());
+ module2 = repositoryService.storeModule(module2);
List<Module> modules = directoryService.getModules(false);
assertEquals(2, modules.size());
modules = directoryService.getModules(false, category);
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-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/directory/impl/memory/DirectoryServiceTestCase.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -29,9 +29,9 @@
import org.jboss.portal.common.util.Version;
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.model.Module;
+import org.jboss.portletswap.model.impl.ModuleImpl;
import org.jboss.portletswap.repository.impl.memory.RepositoryServiceImpl;
import org.jboss.unit.api.pojo.annotations.Test;
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-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/repository/impl/jcr/RepositoryServiceTestCase.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -39,18 +39,21 @@
import org.jboss.portal.common.i18n.LocalizedString;
import org.jboss.portal.common.util.Version;
import org.jboss.portal.common.util.Version.Qualifier;
-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;
-import org.jboss.portletswap.artifact.impl.jcr.LicenseImpl;
import org.jboss.portletswap.jcr.JCRService;
import org.jboss.portletswap.jcr.JCRServiceImpl;
import org.jboss.portletswap.metadata.License;
-import org.jboss.portletswap.module.impl.jcr.ModuleImpl;
+import org.jboss.portletswap.model.Artifact;
+import org.jboss.portletswap.model.Category;
+import org.jboss.portletswap.model.FileArtifact;
+import org.jboss.portletswap.model.Module;
+import org.jboss.portletswap.model.impl.CategoryImpl;
+import org.jboss.portletswap.model.impl.FileArtifactImpl;
+import org.jboss.portletswap.model.impl.LicenseImpl;
+import org.jboss.portletswap.model.impl.ModuleImpl;
+import org.jboss.portletswap.model.impl.jcr.JCRModuleImpl;
+import org.jboss.portletswap.repository.NotFoundException;
import org.jboss.unit.api.pojo.annotations.Create;
import org.jboss.unit.api.pojo.annotations.Destroy;
import org.jboss.unit.api.pojo.annotations.Test;
@@ -140,7 +143,7 @@
public void testRegisterModule()
{
Version version = new Version("", 1, 0, 0, new Qualifier(Qualifier.Prefix.ALPHA), "");
- Module module = new ModuleImpl(jcrService, "Foo", version);
+ Module module = new ModuleImpl("Foo", version);
assertNull(module.getId());
try
{
@@ -163,14 +166,14 @@
}
assertNotNull(getModule);
assertEquals(id, getModule.getId());
- assertEquals(version, module.getVersion());
+ assertEquals(version.toString(), module.getVersion().toString());
}
@Test
public void testRegisterModuleWithDescription()
{
Version version = new Version("", 1, 0, 0, new Qualifier(Qualifier.Prefix.ALPHA), "");
- Module module = new ModuleImpl(jcrService, "Foo", version);
+ Module module = new ModuleImpl("Foo", version);
module.setDescription(new LocalizedString("Toto is bo"));
try
{
@@ -188,7 +191,7 @@
public void testAddCategoryToModule() throws Exception
{
Version version = new Version("", 1, 0, 0, new Qualifier(Qualifier.Prefix.ALPHA), "");
- Module module = new ModuleImpl(jcrService, "Foo", version);
+ Module module = new ModuleImpl("Foo", version);
assertNull(module.getId());
try
{
@@ -201,10 +204,10 @@
Category rootCategory = repositoryService.getRootCategory();
- Category category1 = new org.jboss.portletswap.category.impl.memory.CategoryImpl("Foo", rootCategory);
+ Category category1 = new CategoryImpl("Foo", rootCategory);
category1 = repositoryService.storeCategory(category1);
- Category category2 = new org.jboss.portletswap.category.impl.memory.CategoryImpl("Bar", rootCategory);
+ Category category2 = new CategoryImpl("Bar", rootCategory);
category2 = repositoryService.storeCategory(category2);
List<Category> categories = module.getCategories();
@@ -227,7 +230,7 @@
{
Category rootCategory = repositoryService.getRootCategory();
- Category category1 = new org.jboss.portletswap.category.impl.memory.CategoryImpl("Foo", rootCategory);
+ Category category1 = new CategoryImpl("Foo", rootCategory);
category1 = repositoryService.storeCategory(category1);
Object id = category1.getId();
assertNotNull(id);
@@ -244,12 +247,12 @@
{
Category rootCategory = repositoryService.getRootCategory();
- Category category1 = new org.jboss.portletswap.category.impl.memory.CategoryImpl("Bar", rootCategory);
+ Category category1 = new CategoryImpl("Bar", rootCategory);
category1 = repositoryService.storeCategory(category1);
Object id1 = category1.getId();
assertNotNull(id1);
- Category category2 = new org.jboss.portletswap.category.impl.memory.CategoryImpl("Foo", category1);
+ Category category2 = new CategoryImpl("Foo", category1);
category2 = repositoryService.storeCategory(category2);
Object id2 = category2.getId();
assertNotNull(id2);
@@ -271,7 +274,7 @@
public void testDeleteModule() throws Exception
{
Version version = new Version("", 1, 0, 0, new Qualifier(Qualifier.Prefix.ALPHA), "");
- Module module = new ModuleImpl(jcrService, "Test", version);
+ Module module = new ModuleImpl("Test", version);
assertNull(module.getId());
module = repositoryService.storeModule(module);
Object id = module.getId();
@@ -281,7 +284,15 @@
assertEquals(id, getModule.getId());
repositoryService.deleteModule(module);
- getModule = repositoryService.getModule(id);
+ getModule = null;
+ try
+ {
+ getModule = repositoryService.getModule(id);
+ }
+ catch (NotFoundException e)
+ {
+ // ignore
+ }
assertNull(getModule);
}
@@ -289,7 +300,7 @@
public void testPublishModule() throws Exception
{
Version version = new Version("", 1, 0, 0, new Qualifier(Qualifier.Prefix.ALPHA), "");
- Module module = new ModuleImpl(jcrService, "Test", version);
+ Module module = new ModuleImpl("Test", version);
assertNull(module.getId());
module = repositoryService.storeModule(module);
Object id = module.getId();
@@ -318,7 +329,7 @@
public void testAddArtifact() throws Exception
{
Version version = new Version("", 1, 0, 0, new Qualifier(Qualifier.Prefix.ALPHA), "");
- Module module = new ModuleImpl(jcrService, "Test", version);
+ Module module = new ModuleImpl("Test", version);
assertNull(module.getId());
Module retModule = repositoryService.storeModule(module);
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-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/test/java/org/jboss/portletswap/repository/impl/memory/RepositoryServiceTestCase.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -22,15 +22,19 @@
******************************************************************************/
package org.jboss.portletswap.repository.impl.memory;
+import static org.jboss.unit.api.Assert.*;
+
import org.jboss.portal.common.util.Version;
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.jcr.ModuleImpl;
+import org.jboss.portletswap.model.Artifact;
+import org.jboss.portletswap.model.Category;
+import org.jboss.portletswap.model.Module;
+import org.jboss.portletswap.model.impl.CategoryImpl;
+import org.jboss.portletswap.model.impl.FileArtifactImpl;
+import org.jboss.portletswap.model.impl.ModuleImpl;
import org.jboss.unit.api.pojo.annotations.Test;
/**
@@ -39,8 +43,7 @@
*/
public class RepositoryServiceTestCase
{
-
- /*
+ @Test
public void testRegister() throws PortletswapException
{
RepositoryService repositoryService = new RepositoryServiceImpl();
@@ -48,19 +51,16 @@
Module module = new ModuleImpl("Foo", version);
repositoryService.storeModule(module);
- assertEquals(1, repositoryService.getModules("Foo").size());
-
- assertNotNull(repositoryService.getModule("Foo", version));
-
- Version version2 = new Version("", 1, 0, 0, new Qualifier(Qualifier.Prefix.BETA), "");
- assertNull(repositoryService.getModule("Foo", version2));
+ assertNotNull(module.getId());
+ }
- Module module2 = new MemoryModuleImpl("Foo", version2);
- repositoryService.storeModule(module2);
-
- assertEquals(2, repositoryService.getModules("Foo").size());
-
- assertNotNull(repositoryService.getModule("Foo", version2));
+ /*
+ @Test
+ public void testAddCategory() throws PortletswapException
+ {
+ RepositoryService repositoryService = new RepositoryServiceImpl();
+ Category category1 = new CategoryImpl("category1", repositoryService.getRootCategory());
+ assertNotNull(category1.getId());
}
*/
@@ -75,17 +75,5 @@
repositoryService.storeArtifact(module, artifact);
}
- /*
- public void testAddCategory()
- {
- RepositoryService repositoryService = new RepositoryServiceImpl();
- assertNull(repositoryService.findCategory("category1"));
- assertNull(repositoryService.findCategory("category1_1"));
- Category category1 = new CategoryImpl("category1", CategoryImpl.ROOT_CATEGORY);
- assertNotNull(repositoryService.findCategory("category1"));
- new CategoryImpl("category1_1", category1);
- assertNotNull(repositoryService.findCategory("category1_1"));
- }
- */
}
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-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-service/server-lib/src/test/resources/jboss-unit.xml 2008-01-21 16:39:44 UTC (rev 204)
@@ -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
Modified: 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 2008-01-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-webapp/src/main/java/org/jboss/portletswap/servlet/ContentServlet.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -35,7 +35,7 @@
import org.jboss.logging.Logger;
import org.jboss.portletswap.RepositoryService;
-import org.jboss.portletswap.artifact.FileArtifact;
+import org.jboss.portletswap.model.FileArtifact;
import org.jboss.portletswap.repository.NotFoundException;
import org.jboss.portletswap.repository.RepositoryException;
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-21 15:29:01 UTC (rev 203)
+++ server/trunk/server-webapp/src/main/java/org/jboss/portletswap/servlet/DirectoryServlet.java 2008-01-21 16:39:44 UTC (rev 204)
@@ -26,16 +26,18 @@
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.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.metadata.DisplayNameModel;
import org.jboss.portletswap.metadata.ResultModel;
import org.jboss.portletswap.metadata.ResultModelProvider;
+import org.jboss.portletswap.model.Artifact;
+import org.jboss.portletswap.model.Category;
+import org.jboss.portletswap.model.Module;
+import org.jboss.portletswap.model.impl.CategoryImpl;
+import org.jboss.portletswap.model.impl.FileArtifactImpl;
+import org.jboss.portletswap.model.impl.ModuleImpl;
import org.jboss.portletswap.repository.impl.jcr.RepositoryServiceImpl;
import org.jboss.xb.binding.ObjectModelProvider;
import org.jboss.xb.binding.XercesXsMarshaller;
@@ -83,15 +85,15 @@
try
{
rootCategory = ((RepositoryServiceImpl)repositoryService).getRootCategory();
- category1 = new org.jboss.portletswap.category.impl.memory.CategoryImpl("foo", rootCategory);
+ category1 = new CategoryImpl("foo", rootCategory);
category1 = repositoryService.storeCategory(category1);
- category2 = new org.jboss.portletswap.category.impl.memory.CategoryImpl("bar", rootCategory);
+ category2 = new CategoryImpl("bar", rootCategory);
category2 = repositoryService.storeCategory(category2);
- category3 = new org.jboss.portletswap.category.impl.memory.CategoryImpl("child", category2);
+ category3 = new 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 module = new 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);
More information about the jboss-svn-commits
mailing list