You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2009/09/02 08:17:27 UTC

svn commit: r810367 - in /portals/jetspeed-2/portal/trunk/components: ./ jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/ jetspeed-spaces/

Author: taylor
Date: Wed Sep  2 06:17:27 2009
New Revision: 810367

URL: http://svn.apache.org/viewvc?rev=810367&view=rev
Log:
moving spaces into the portal component

Added:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/EnvironmentImpl.java   (with props)
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpaceImpl.java   (with props)
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpacesServiceImpl.java   (with props)
Removed:
    portals/jetspeed-2/portal/trunk/components/jetspeed-spaces/
Modified:
    portals/jetspeed-2/portal/trunk/components/pom.xml

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/EnvironmentImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/EnvironmentImpl.java?rev=810367&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/EnvironmentImpl.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/EnvironmentImpl.java Wed Sep  2 06:17:27 2009
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.spaces;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Environment object 
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id$
+ */
+public class EnvironmentImpl implements Environment
+{
+    private String name;
+    private String description;
+    private String title;
+    private String owner;
+    private List<Space> spaces = new ArrayList<Space>();
+    private String path;
+    
+    public EnvironmentImpl(String name, String path, String owner)
+    {
+        this.name = name;        
+        this.path = path;
+        this.owner = owner;
+    }
+    
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+
+    public String getTitle()
+    {
+        return title;
+    }
+
+
+    public void setDescription(String description)
+    {
+        this.description = description;
+    }
+
+    public void setTitle(String title)
+    {
+        this.title = title;
+    }
+    
+    public String getPath()
+    {
+        return path;       
+    }
+
+    public void setPath(String path)
+    {
+        this.path = path;
+    }
+    
+    public String getOwner()
+    {
+        return owner;
+    }
+
+    public void addSpace(Space space)
+    {
+        spaces.add(space);
+    }
+
+    public Dashboard getDashboard()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public List<Space> getSpaces()
+    {
+        return spaces;
+    }
+
+    public void removeSpace(Space space)
+    {
+        // TODO Auto-generated method stub
+        
+    }
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/EnvironmentImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/EnvironmentImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpaceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpaceImpl.java?rev=810367&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpaceImpl.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpaceImpl.java Wed Sep  2 06:17:27 2009
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.spaces;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Space object 
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id$
+ */
+public class SpaceImpl implements Space, Serializable
+{
+    private String name;
+    private String description;
+    private String title;
+    private String owner;
+    private List<String> templates = new ArrayList<String>();
+    private String path;
+    
+    public SpaceImpl(String name, String path, String owner)
+    {
+        this.name = name;        
+        this.path = path;
+        this.owner = owner;
+    }
+    
+    public void addTemplate(String template)
+    {
+        templates.add(template);
+    }
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public List<String> getTemplates()
+    {
+        return templates;
+    }
+
+    public String getTitle()
+    {
+        return title;
+    }
+
+    public void removeTemplate(String template)
+    {
+        templates.remove(template);
+    }
+
+    public void setDescription(String description)
+    {
+        this.description = description;
+    }
+
+    public void setTitle(String title)
+    {
+        this.title = title;
+    }
+    
+    public String getPath()
+    {
+        return path;       
+    }
+
+    public void setPath(String path)
+    {
+        this.path = path;
+    }
+    
+    public String getOwner()
+    {
+        return owner;
+    }
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpaceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpaceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpacesServiceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpacesServiceImpl.java?rev=810367&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpacesServiceImpl.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpacesServiceImpl.java Wed Sep  2 06:17:27 2009
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.spaces;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.jetspeed.locator.TemplateLocator;
+import org.apache.jetspeed.om.folder.Folder;
+import org.apache.jetspeed.om.folder.FolderNotFoundException;
+import org.apache.jetspeed.om.folder.InvalidFolderException;
+import org.apache.jetspeed.om.page.Link;
+import org.apache.jetspeed.om.page.Page;
+import org.apache.jetspeed.om.portlet.LocalizedField;
+import org.apache.jetspeed.page.PageManager;
+import org.apache.jetspeed.page.document.Node;
+import org.apache.jetspeed.page.document.NodeException;
+import org.apache.jetspeed.spaces.Space;
+import org.apache.jetspeed.spaces.SpaceImpl;
+import org.apache.jetspeed.spaces.Spaces;
+
+/**
+ * Spaces Services
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id$
+ */
+public class SpacesServiceImpl implements Spaces
+{
+    private PageManager pageManager;
+    private TemplateLocator decoratorLocator;
+    
+    public SpacesServiceImpl(PageManager pageManager, TemplateLocator decoratorLocator)
+    {
+        this.pageManager = pageManager;
+        this.decoratorLocator = decoratorLocator;
+    }
+    
+    public Space addSpace(Space space)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public List<Space> listSpaces()
+    {
+        List<Space> result = new ArrayList<Space>();
+        try
+        {
+            Space defaultSpace = new SpaceImpl("Home", "/", "admin");
+            result.add(defaultSpace);
+            Folder root = pageManager.getFolder("/");
+            Iterator spaces = root.getFolders().iterator();
+            for (int ix = 0; spaces.hasNext(); ix++)
+            {
+                Node node = (Node)spaces.next();
+                if (node.isHidden())
+                    continue;
+                Collection<LocalizedField> fields = node.getMetadata().getFields("space-owner");
+                if (fields != null)
+                {
+                    Iterator<LocalizedField> it = fields.iterator();
+                    while (it.hasNext())
+                    {
+                        LocalizedField field = it.next();
+                        Space space = new SpaceImpl(node.getName(), node.getPath(), field.getValue());
+                        space.setTitle(node.getTitle());
+                        result.add(space);
+                    }
+                }
+            }
+        }
+        catch (FolderNotFoundException e)
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        catch (InvalidFolderException e)
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        catch (NodeException e)
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }            
+        return result;
+    }
+
+    public void removeSpace(Space space)
+    {
+        // TODO Auto-generated method stub
+
+    }
+
+    public Environment addEnvironment(Environment env)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Space addPage(Space space, Page page)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Space addSpace(Environment env, Space space)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public List<Environment> listEnvironments()
+    {
+        // lets just give em the default folder / as an environment for now
+        List<Environment> env = new ArrayList<Environment>();
+        Environment ev = new EnvironmentImpl("Public", "/", "admin");
+        ev.getSpaces().clear();
+        ev.getSpaces().addAll(this.listSpaces());
+        env.add(ev);
+        return env;
+    }
+
+    public List<Link> listLinks(Space space)
+    {
+        List<Link> result = new ArrayList<Link>();
+        try
+        {
+            Folder root = pageManager.getFolder(space.getPath());
+            Iterator links = root.getLinks().iterator();
+            for (int ix = 0; links.hasNext(); ix++)
+            {
+                Node link = (Node)links.next();
+                result.add((Link)link);
+            }
+        }
+        catch (Exception e)
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        return result;        
+    }
+
+    public List<Page> listPages(Space space)
+    {
+        List<Page> result = new ArrayList<Page>();
+        try
+        {
+            Folder root = pageManager.getFolder(space.getPath());
+            Iterator pages = root.getPages().iterator();
+            for (int ix = 0; pages.hasNext(); ix++)
+            {
+                Node page = (Node)pages.next();
+                result.add((Page)page);
+            }
+        }
+        catch (Exception e)
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        return result;        
+    }
+
+    public List<Space> listSpaces(Environment env)
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void removeEnvironment(Environment env)
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void removePage(Space space, Page page)
+    {
+        // TODO Auto-generated method stub
+        
+    }
+
+    public void removeSpace(Environment env, Space space)
+    {
+        // TODO Auto-generated method stub
+        
+    }        
+
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpacesServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpacesServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/portal/trunk/components/pom.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/pom.xml?rev=810367&r1=810366&r2=810367&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/pom.xml (original)
+++ portals/jetspeed-2/portal/trunk/components/pom.xml Wed Sep  2 06:17:27 2009
@@ -53,7 +53,6 @@
         <module>jetspeed-search</module>
         <module>jetspeed-security</module>
         <module>jetspeed-serializer</module>
-        <module>jetspeed-spaces</module>
         <module>jetspeed-sso</module>
         <module>jetspeed-statistics</module>
         <module>jetspeed-utils</module>



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