portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r209305 [8/10] - in /portals/jetspeed-2/branches/MENUS_BRANCH: components/locator/src/java/org/apache/jetspeed/profiler/impl/ components/page-manager/ components/page-manager/src/java/META-INF/ components/page-manager/src/java/org/apache/je...
Date Tue, 05 Jul 2005 18:58:14 GMT
Added: portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteView.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteView.java?rev=209305&view=auto
==============================================================================
--- portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteView.java (added)
+++ portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteView.java Tue Jul  5 11:58:05 2005
@@ -0,0 +1,1201 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portalsite.view;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.jetspeed.om.folder.Folder;
+import org.apache.jetspeed.om.folder.FolderNotFoundException;
+import org.apache.jetspeed.om.folder.proxy.FolderProxy;
+import org.apache.jetspeed.om.page.Page;
+import org.apache.jetspeed.om.page.proxy.PageProxy;
+import org.apache.jetspeed.page.PageManager;
+import org.apache.jetspeed.page.document.Node;
+import org.apache.jetspeed.page.document.NodeException;
+import org.apache.jetspeed.page.document.NodeNotFoundException;
+import org.apache.jetspeed.page.document.NodeSet;
+import org.apache.jetspeed.page.document.proxy.NodeProxy;
+import org.apache.jetspeed.portalsite.Menu;
+import org.apache.jetspeed.portalsite.menu.StandardBackMenuDefinition;
+import org.apache.jetspeed.portalsite.menu.StandardNavigationsMenuDefinition;
+import org.apache.jetspeed.portalsite.menu.StandardPagesMenuDefinition;
+import org.apache.jetspeed.profiler.ProfileLocator;
+import org.apache.jetspeed.profiler.ProfileLocatorProperty;
+
+/**
+ * This class defines the logical view of site content.
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+public class SiteView
+{
+    /**
+     * PROFILING_PROPERTY_FOLDER_PREFIX - folder name prefix for profiling folders
+     */
+    public final static String PROFILING_PROPERTY_FOLDER_PREFIX = "_";
+
+    /**
+     * PROFILING_NAVIGATION_PROPERTY_FOLDER_PREFIX - folder name prefix for profiling navigating folders
+     */
+    public final static String PROFILING_NAVIGATION_PROPERTY_FOLDER_PREFIX = "__";
+
+    /**
+     * CURRENT_PAGE_PATH - expression used to match the current page
+     */
+    public final static String CURRENT_PAGE_PATH = "~";
+
+    /**
+     * ALT_CURRENT_PAGE_PATH - alternate expression used to match the current page
+     */
+    public final static String ALT_CURRENT_PAGE_PATH = "@";
+
+    /**
+     * STANDARD_*_MENU_NAME - standard menu names
+     */
+    public final static String STANDARD_BACK_MENU_NAME = "back";
+    public final static String STANDARD_PAGES_MENU_NAME = "pages";
+    public final static String STANDARD_NAVIGATIONS_MENU_NAME = "navigations";
+
+    /**
+     * CUSTOM_*_MENU_NAME - custom menu names
+     */
+    public final static String CUSTOM_PAGE_NAVIGATIONS_MENU_NAME = "page-navigations";
+
+    /**
+     * STANDARD_MENU_NAMES - set of supported standard menu names
+     */
+    private final static Set STANDARD_MENU_NAMES = new HashSet(3);
+    static
+    {
+        STANDARD_MENU_NAMES.add(STANDARD_BACK_MENU_NAME);
+        STANDARD_MENU_NAMES.add(STANDARD_PAGES_MENU_NAME);
+        STANDARD_MENU_NAMES.add(STANDARD_NAVIGATIONS_MENU_NAME);
+    }
+
+    /**
+     * STANDARD_MENU_DEFINITION_LOCATORS - list of standard menu definition locators
+     */
+    private final static List STANDARD_MENU_DEFINITION_LOCATORS = new ArrayList(4);
+    static
+    {
+        STANDARD_MENU_DEFINITION_LOCATORS.add(new SiteViewMenuDefinitionLocator(new StandardBackMenuDefinition()));
+        STANDARD_MENU_DEFINITION_LOCATORS.add(new SiteViewMenuDefinitionLocator(new StandardPagesMenuDefinition()));
+        STANDARD_MENU_DEFINITION_LOCATORS.add(new SiteViewMenuDefinitionLocator(new StandardNavigationsMenuDefinition()));
+    }
+
+    /**
+     * pageManager - PageManager component
+     */
+    private PageManager pageManager;
+
+    /**
+     * searchPaths - validated list of ordered search path objects
+     *               where paths have no trailing folder separator
+     */
+    private List searchPaths;
+
+    /**
+     * searchPathsString - search paths as string
+     */
+    private String searchPathsString;
+
+    /**
+     * rootFolderProxy - root folder proxy instance
+     */
+    private Folder rootFolderProxy;
+
+    /**
+     * SiteView - validating constructor
+     *
+     * @param pageManager PageManager component instance
+     * @param searchPaths list of search paths in string or search path
+     *                    object form
+     */
+    public SiteView(PageManager pageManager, List searchPaths)
+    {
+        this.pageManager = pageManager;
+        if ((searchPaths != null) && !searchPaths.isEmpty())
+        {
+            // validate search path format and existence
+            this.searchPaths = new ArrayList(searchPaths.size());
+            StringBuffer searchPathsStringBuffer = new StringBuffer();
+            Iterator pathsIter = searchPaths.iterator();
+            while (pathsIter.hasNext())
+            {
+                Object pathObject = pathsIter.next();
+                if (!(pathObject instanceof SiteViewSearchPath))
+                {
+                    String path = pathObject.toString().trim();
+                    if (path.length() > 0)
+                    {
+                        pathObject = new SiteViewSearchPath(ProfileLocator.PAGE_LOCATOR, path);
+                    }
+                }
+                SiteViewSearchPath searchPath = (SiteViewSearchPath)pathObject;
+                if (this.searchPaths.indexOf(searchPath) == -1)
+                {
+                    try
+                    {
+                        if (this.pageManager.getFolder(searchPath.toString()) != null)
+                        {
+                            this.searchPaths.add(searchPath);
+                            
+                            // construct search paths as string
+                            if (searchPathsStringBuffer.length() == 0)
+                            {
+                                searchPathsStringBuffer.append(searchPath);
+                            }
+                            else
+                            {
+                                searchPathsStringBuffer.append(',');
+                                searchPathsStringBuffer.append(searchPath);
+                            }
+                        }
+                    }
+                    catch (NodeException ne)
+                    {
+                    }
+                    catch (SecurityException se)
+                    {
+                    }
+                }
+            }
+
+            // if no valid paths found, assume root search path
+            // with no aggregation is to be used as default; otherwise,
+            // save search paths as string
+            if (this.searchPaths.isEmpty())
+            {
+                this.searchPaths.add(new SiteViewSearchPath(ProfileLocator.PAGE_LOCATOR, Folder.PATH_SEPARATOR));
+                this.searchPathsString = Folder.PATH_SEPARATOR;
+            }
+            else
+            {
+                this.searchPathsString = searchPathsStringBuffer.toString();
+            }
+        }
+        else
+        {
+            // root search path with no aggregation
+            this.searchPaths = new ArrayList(1);
+            this.searchPaths.add(new SiteViewSearchPath(ProfileLocator.PAGE_LOCATOR, Folder.PATH_SEPARATOR));
+            this.searchPathsString = Folder.PATH_SEPARATOR;
+        }
+    }
+
+    /**
+     * SiteView - validating constructor
+     *
+     * @param pageManager PageManager component instance
+     * @param searchPaths array of search paths
+     */
+    public SiteView(PageManager pageManager, String [] searchPaths)
+    {
+        this(pageManager, makeSearchPathList(searchPaths));
+    }
+
+    /**
+     * makeSearchPathList - construct from array
+     *
+     * @param searchPaths array of search paths
+     * @return search path list
+     */
+    private static List makeSearchPathList(String [] searchPaths)
+    {
+        if ((searchPaths != null) && (searchPaths.length > 0))
+        {
+            List searchPathsList = new ArrayList(searchPaths.length);
+            for (int i = 0; (i < searchPaths.length); i++)
+            {
+                searchPathsList.add(searchPaths[i]);
+            }
+            return searchPathsList;
+        }
+        return null;
+    }
+
+    /**
+     * SiteView - validating constructor
+     *
+     * @param pageManager PageManager component instance
+     * @param searchPaths string of comma separated search paths
+     */
+    public SiteView(PageManager pageManager, String searchPaths)
+    {
+        this(pageManager, makeSearchPathList(searchPaths));
+    }
+
+    /**
+     * makeSearchPathList - construct from string
+     *
+     * @param searchPaths string of comma separated search paths
+     * @return search path list
+     */
+    private static List makeSearchPathList(String searchPaths)
+    {
+        return ((searchPaths != null) ? makeSearchPathList(searchPaths.split(",")) : null);
+    }
+
+    /**
+     * SiteView - validating constructor
+     *
+     * @param pageManager PageManager component instance
+     * @param locator profile locator search specification
+     */
+    public SiteView(PageManager pageManager, ProfileLocator locator)
+    {
+        this(pageManager, makeSearchPathList(locator));
+    }
+    
+    /**
+     * makeSearchPathList - construct from profile locator
+     *
+     * @param locator profile locator search specification
+     * @return search path list
+     */
+    private static List makeSearchPathList(ProfileLocator locator)
+    {
+        if (locator != null)
+        {
+            // generate and return locator search paths
+            return mergeSearchPathList(ProfileLocator.PAGE_LOCATOR, locator, new ArrayList(8));
+        }
+        return null;
+    }
+
+    /**
+     * SiteView - validating constructor
+     *
+     * @param pageManager PageManager component instance
+     * @param locators map of named profile locator search specifications
+     */
+    public SiteView(PageManager pageManager, Map locators)
+    {
+        this(pageManager, makeSearchPathList(locators));
+    }
+    
+    /**
+     * makeSearchPathList - construct from profile locators
+     *
+     * @param locators map of named profile locator search specifications
+     * @return search path list
+     */
+    private static List makeSearchPathList(Map locators)
+    {
+        if ((locators != null) && !locators.isEmpty())
+        {
+            // generate locators search paths; aggregate individual
+            // profile locator search paths with the 'page' locator
+            // having priority, (all other named locators are processed
+            // subsequent to 'page' in unspecified order).
+            List searchPaths = new ArrayList(8 * locators.size());
+            ProfileLocator pageLocator = (ProfileLocator)locators.get(ProfileLocator.PAGE_LOCATOR);
+            if (pageLocator != null)
+            {
+                // add priority 'page' locator search paths
+                mergeSearchPathList(ProfileLocator.PAGE_LOCATOR, pageLocator, searchPaths);
+            }
+            if ((pageLocator == null) || (locators.size() > 1))
+            {
+                Iterator locatorNameIter = locators.keySet().iterator();
+                if (locatorNameIter.hasNext())
+                {
+                    String locatorName = (String)locatorNameIter.next();
+                    if (!locatorName.equals(ProfileLocator.PAGE_LOCATOR))
+                    {
+                        // add alternate locator search paths
+                        mergeSearchPathList(locatorName, (ProfileLocator)locators.get(locatorName), searchPaths);
+                    }
+                }
+            }
+            return searchPaths;
+        }
+        return null;
+    }
+    
+    /**
+     * mergeSearchPathList - append search paths from profile locator
+     *
+     * @param locatorName name of profile locator
+     * @param locator profile locator search specification
+     * @param searchPaths list of search paths to merge into
+     * @return search path list
+     */
+    private static List mergeSearchPathList(String locatorName, ProfileLocator locator, List searchPaths)
+    {
+        // generate profile locator search paths with locator
+        // names to be used later for node identification and
+        // grouping; note that the profile locator iterator
+        // starts returning a full set of properties and returns
+        // a shorter properties array with each iteration to
+        // create the next search criteria... depending on the
+        // validity of the property values and their cardinality,
+        // (multiple property values are returned sequentially),
+        // profiler locator iterations may be skipped to
+        // generate the proper search paths
+        List locatorSearchPaths = new ArrayList(8);
+        int addLocatorSearchPathsAt = 0;
+        Iterator locatorIter = locator.iterator();
+        while (locatorIter.hasNext())
+        {
+            // initialize path construction variables
+            String pathRoot = Folder.PATH_SEPARATOR;
+            List paths = new ArrayList(8);
+            paths.add(new StringBuffer(pathRoot));
+            int pathDepth = 0;
+            int lastPathsCount = 0;
+            String lastPropertyName = null;
+            int lastPropertyValueLength = 0;
+            boolean navigatedPathRoot = false;
+
+            // reset advance of the profile locator offset by one
+            // to accomodate automatic iteration within locator loop
+            int skipProfileLocatorIterations = -1;
+
+            // form locator properties into a complete path
+            ProfileLocatorProperty [] properties = (ProfileLocatorProperty []) locatorIter.next();
+            for (int i = 0; (i < properties.length); i++)
+            {
+                if (properties[i].isNavigation())
+                {
+                    // reset search paths to navigation root path, (reset
+                    // only navigation supported), skip null navigation values
+                    if (properties[i].getValue() != null)
+                    {
+                        // TODO: support relative navigation values
+
+                        // assume navigation value must be a root prefix
+                        // and contains proper path prefix for each subsite
+                        // path folder name
+                        pathRoot = properties[i].getValue();
+                        if (!pathRoot.startsWith(Folder.PATH_SEPARATOR))
+                        {
+                            pathRoot = Folder.PATH_SEPARATOR + pathRoot; 
+                        }
+                        if (!pathRoot.endsWith(Folder.PATH_SEPARATOR))
+                        {
+                            pathRoot += Folder.PATH_SEPARATOR; 
+                        }
+                        if (!pathRoot.equals(Folder.PATH_SEPARATOR))
+                        {
+                            int folderIndex = 1;
+                            do
+                            {
+                                if (!pathRoot.regionMatches(folderIndex, PROFILING_NAVIGATION_PROPERTY_FOLDER_PREFIX, 0, PROFILING_NAVIGATION_PROPERTY_FOLDER_PREFIX.length()))
+                                {
+                                    pathRoot = pathRoot.substring(0, folderIndex) + PROFILING_NAVIGATION_PROPERTY_FOLDER_PREFIX + pathRoot.substring(folderIndex);
+                                }
+                                folderIndex = pathRoot.indexOf(Folder.PATH_SEPARATOR, folderIndex) + 1;
+                            }
+                            while ((folderIndex != -1) && (folderIndex != pathRoot.length()));
+                        }
+                        
+                        // reset locator paths using new prefix
+                        pathDepth = 0;
+                        paths.clear();
+                        paths.add(new StringBuffer(pathRoot));
+                        lastPathsCount = 0;
+                        lastPropertyName = null;
+                        lastPropertyValueLength = 0;
+                        navigatedPathRoot = true;
+
+                        // reset advance of the the profile locator iterator
+                        skipProfileLocatorIterations = 0;
+                    }
+                    else
+                    {
+                        // make sure multiple trailing null valued properties are
+                        // ignored if more than one is present by advancing
+                        // the profile locator iterator
+                        skipProfileLocatorIterations++;
+                    }
+                }
+                else if (properties[i].isControl())
+                {
+                    // skip null control values
+                    if (properties[i].getValue() != null)
+                    {
+                        // fold control names and values to lower case
+                        String propertyName = properties[i].getName().toLowerCase();
+                        String propertyValue = properties[i].getValue().toLowerCase();
+                        
+                        // detect duplicate control names which indicates multiple
+                        // values: must duplicate locator paths for each value; different
+                        // control values are simply appended to all locator paths
+                        if (propertyName.equals(lastPropertyName))
+                        {
+                            // duplicate last locator paths set, stripping last matching
+                            // control value from each, appending new value, and adding new
+                            // valued set to collection of paths
+                            ArrayList multipleValuePaths = new ArrayList(lastPathsCount);
+                            Iterator pathsIter = paths.iterator();
+                            for (int count = 0; (pathsIter.hasNext() && (count < lastPathsCount)); count++)
+                            {
+                                StringBuffer path = (StringBuffer) pathsIter.next();
+                                StringBuffer multipleValuePath = new StringBuffer(path.toString());
+                                multipleValuePath.setLength(multipleValuePath.length() - lastPropertyValueLength - 1);
+                                multipleValuePath.append(propertyValue);
+                                multipleValuePath.append(Folder.PATH_SEPARATOR_CHAR);
+                                multipleValuePaths.add(multipleValuePath);
+                            }
+                            paths.addAll(multipleValuePaths);
+
+                            // make sure trailing multiple valued properties are
+                            // ignored by advancing the profile locator iterator
+                            // which is reset for each unique property value sets
+                            skipProfileLocatorIterations++;
+                        }
+                        else
+                        {
+                            // construct locator path folders with control properties
+                            Iterator pathsIter = paths.iterator();
+                            while (pathsIter.hasNext())
+                            {
+                                StringBuffer path = (StringBuffer) pathsIter.next();
+                                path.append(PROFILING_PROPERTY_FOLDER_PREFIX);
+                                path.append(propertyName);
+                                path.append(Folder.PATH_SEPARATOR_CHAR);
+                                path.append(propertyValue);
+                                path.append(Folder.PATH_SEPARATOR_CHAR);
+                            }
+                            
+                            // reset last locator property vars
+                            pathDepth++;
+                            lastPathsCount = paths.size();
+                            lastPropertyValueLength = propertyValue.length();
+                            lastPropertyName = propertyName;
+
+                            // reset advance of the the profile locator iterator
+                            skipProfileLocatorIterations = 0;
+                        }
+                    }
+                    else
+                    {
+                        // make sure multiple trailing null valued properties are
+                        // ignored along with the last property values if more
+                        // than one is present by advancing the profile locator
+                        // iterator
+                        skipProfileLocatorIterations++;
+                    }
+                }
+                else
+                {
+                    // make sure multiple trailing request path properties are
+                    // ignored if more than one is present by advancing the
+                    // profile locator iterator
+                    skipProfileLocatorIterations++;
+                }
+            }
+            
+            // if required, advance profile locator iterations
+            for (int skip = skipProfileLocatorIterations; ((skip > 0) && (locatorIter.hasNext())); skip--)
+            {
+                locatorIter.next();
+            }
+
+            // append any generated paths to locator search paths and
+            // append root path if at end of locator path group, (locator
+            // path roots are not returned by profiler iterator if not
+            // explicitly navigated)
+            if ((pathDepth > 0) || navigatedPathRoot)
+            {
+                locatorSearchPaths.addAll(addLocatorSearchPathsAt, paths);
+                addLocatorSearchPathsAt += paths.size();
+            }
+            if ((pathDepth == 1) && !navigatedPathRoot)
+            {
+                locatorSearchPaths.add(addLocatorSearchPathsAt++, new StringBuffer(pathRoot));
+            }
+
+            // reset locator search path ordering since navigated root
+            // paths are generated by the iterator based algorithm above
+            // right to left instead of left to right as expected
+            if ((pathDepth == 0) && navigatedPathRoot)
+            {
+                addLocatorSearchPathsAt = 0;
+            }
+            
+            // if end of locator path group and have not navigated to
+            // a new root path or there are no more locator iterations,
+            // insert the paths into the search path results
+            if (((pathDepth <= 1) && !navigatedPathRoot) || !locatorIter.hasNext())
+            {
+                // add locator paths to unique search paths preserving
+                // search order; move non-unique paths to end of search
+                // path list to favor more specific paths over common
+                // root paths, (i.e. '/' should be last)
+                Iterator locatorSearchPathsIter = locatorSearchPaths.iterator();
+                while (locatorSearchPathsIter.hasNext())
+                {
+                    SiteViewSearchPath searchPath = new SiteViewSearchPath(locatorName, locatorSearchPathsIter.next().toString());
+                    // test search path uniqueness
+                    int existsAt = searchPaths.indexOf(searchPath);
+                    if (existsAt != -1)
+                    {
+                        if (existsAt < (searchPaths.size()-1))
+                        {
+                            // push existing search path to end of paths
+                            searchPaths.add(searchPaths.remove(existsAt));
+                        }
+                    }
+                    else
+                    {
+                        // add new unique search path to end of paths
+                        searchPaths.add(searchPath);
+                    }
+                }
+
+                // clear merged locator search paths
+                locatorSearchPaths.clear();
+                addLocatorSearchPathsAt = 0;
+            }
+        }
+
+        return searchPaths;
+    }
+
+    /**
+     * SiteView - basic constructor
+     *
+     * @param pageManager PageManager component instance
+     */
+    public SiteView(PageManager pageManager)
+    {
+        this(pageManager, (List)null);
+    }
+
+    /**
+     * getPageManager - return PageManager component instance
+     *
+     * @return PageManager instance
+     */
+    public PageManager getPageManager()
+    {
+        return pageManager;
+    }
+
+    /**
+     * getSearchPaths - return ordered search paths list that
+     *                  defines this view
+     *
+     * @return search paths list
+     */
+    public List getSearchPaths()
+    {
+        return searchPaths;
+    }
+
+    /**
+     * getSearchPathsString - return search paths as string
+     *
+     * @return search paths list as comma separated string
+     */
+    public String getSearchPathsString()
+    {
+        return searchPathsString;
+    }
+
+    /**
+     * getRootFolderProxy - create and return root folder proxy instance
+     *
+     * @return root folder proxy
+     * @throws FolderNotFoundException if not found
+     * @throws SecurityException if view access not granted
+     */
+    public Folder getRootFolderProxy() throws FolderNotFoundException
+    {
+        // latently construct and return root folder proxy
+        if (rootFolderProxy == null)
+        {
+            try
+            {
+                // the folder and profile locator name of the root
+                // folder proxy in the view is the locator name of the
+                // first search path since search paths are valid
+                SiteViewSearchPath searchPath = (SiteViewSearchPath)searchPaths.get(0);
+                String path = searchPath.toString();
+                String locatorName = searchPath.getLocatorName();
+
+                // get concrete root folder from page manager
+                // and construct proxy
+                Folder rootFolder = pageManager.getFolder(path);
+                rootFolderProxy = FolderProxy.newInstance(this, locatorName, null, rootFolder);
+            }
+            catch (NodeException ne)
+            {
+                FolderNotFoundException fnfe = new FolderNotFoundException("Root folder not found");
+                fnfe.initCause(ne);
+                throw fnfe;
+            }
+        }
+        return rootFolderProxy;
+    }
+
+    /**
+     * getNodeProxy - get single folder, page, or link proxy
+     *                at relative or absolute path
+     *
+     * @param path single node path
+     * @param currentNode current folder or page for relative paths or null
+     * @param onlyVisible node required to be visible flag
+     * @return folder, page, or link node proxy
+     * @throws NodeNotFoundException if not found
+     * @throws SecurityException if view access not granted
+     */
+    public Node getNodeProxy(String path, Node currentNode, boolean onlyVisible) throws NodeNotFoundException
+    {
+        // determine current folder and page
+        String currentPath = path;
+        Folder currentFolder = null;
+        Page currentPage = null;
+        if (currentNode instanceof Page)
+        {
+            currentPage = (Page)currentNode;
+            currentFolder = (Folder)currentPage.getParent();
+        }
+        else if (currentNode instanceof Folder)
+        {
+            currentFolder = (Folder)currentNode;
+        }
+
+        // match current page path
+        if (currentPath.equals(CURRENT_PAGE_PATH) || currentPath.equals(ALT_CURRENT_PAGE_PATH))
+        {
+            // return current page if specified, (assume visible)
+            return currentPage;
+        }
+
+        // convert absolute path to a root relative search
+        // and default current folder
+        if (currentPath.startsWith(Folder.PATH_SEPARATOR))
+        {
+            currentPath = currentPath.substring(1);
+            currentFolder = null;
+        }
+        if (currentFolder == null)
+        {
+            currentFolder = getRootFolderProxy();
+        }
+
+        // search for path based on current folder 
+        while ((currentPath.length() > 0) && !currentPath.equals(Folder.PATH_SEPARATOR))
+        {
+            // parse relative sub-folder from path
+            int separatorIndex = currentPath.indexOf(Folder.PATH_SEPARATOR);
+            if (separatorIndex != -1)
+            {
+                // isolate sub-folder and continue search
+                // using remaining paths
+                String subfolder = currentPath.substring(0, separatorIndex);
+                currentPath = currentPath.substring(separatorIndex+1);
+                if (subfolder.equals(".."))
+                {
+                    // adjust current folder if parent exists
+                    if (currentFolder.getParent() != null)
+                    {
+                        currentFolder = (Folder)currentFolder.getParent();
+                    }
+                    else
+                    {
+                        throw new NodeNotFoundException("Specified path " + path + " not found.");
+                    }
+                }
+                else if (!subfolder.equals("."))
+                {
+                    // access sub-folder or return null if nonexistent
+                    // or access forbidden
+                    try
+                    {
+                        currentFolder = currentFolder.getFolder(subfolder);
+                    }
+                    catch (NodeException ne)
+                    {
+                        NodeNotFoundException nnfe = new NodeNotFoundException("Specified path " + path + " not found.");
+                        nnfe.initCause(ne);
+                        throw nnfe;
+                    }
+                }
+            }
+            else
+            {
+                // access remaining path as page, folder, or link node
+                // proxy; return null if not found or not visible and
+                // visiblity is required
+                try
+                {
+                    NodeSet children = currentFolder.getAll();
+                    if (children != null)
+                    {
+                        Node node = children.get(currentPath);
+                        if ((node != null) && (!onlyVisible || isProxyVisible(node)))
+                        {
+                            return node;
+                        }
+                    }
+                }
+                catch (NodeException ne)
+                {
+                    NodeNotFoundException nnfe = new NodeNotFoundException("Specified path " + path + " not found.");
+                    nnfe.initCause(ne);
+                    throw nnfe;
+                }
+                throw new NodeNotFoundException("Specified path " + path + " not found or visible.");
+            }
+        }
+
+        // path maps to current folder; return if visible
+        // or visibility not required
+        if (!onlyVisible || isProxyVisible(currentFolder))
+        {
+            return currentFolder;
+        }
+        throw new NodeNotFoundException("Specified path " + path + " not found or visible.");
+    }
+
+    /**
+     * getNodeProxies - get folder, page, or link proxies at
+     *                  relative or absolute path using simple path
+     *                  wildcards and character classes
+     *
+     * @param regexpPath regular expression node path
+     * @param currentNode current folder or page for relative paths or null
+     * @param onlyVisible nodes required to be visible flag
+     * @return list of folder, page, or link node proxies
+     */
+    public List getNodeProxies(String regexpPath, Node currentNode, boolean onlyVisible)
+    {
+        // determine current folder and page
+        String currentRegexpPath = regexpPath;
+        Folder currentFolder = null;
+        Page currentPage = null;
+        if (currentNode instanceof Page)
+        {
+            currentPage = (Page)currentNode;
+            currentFolder = (Folder)currentPage.getParent();
+        }
+        else if (currentNode instanceof Folder)
+        {
+            currentFolder = (Folder)currentNode;
+        }
+
+        // match current page path
+        if (currentRegexpPath.equals(CURRENT_PAGE_PATH) || currentRegexpPath.equals(ALT_CURRENT_PAGE_PATH))
+        {
+            if (currentPage != null)
+            {
+                // return current page, (assume visible)
+                List proxies = new ArrayList(1);
+                proxies.add(currentPage);
+                return proxies;
+            }
+            else
+            {
+                // current page not specified
+                return null;
+            }
+        }
+
+        // convert absolute path to a root relative search
+        // and default current folder
+        if (currentRegexpPath.startsWith(Folder.PATH_SEPARATOR))
+        {
+            currentRegexpPath = currentRegexpPath.substring(1);
+            currentFolder = null;
+        }
+        if (currentFolder == null)
+        {
+            try
+            {
+                currentFolder = getRootFolderProxy();
+            }
+            catch (NodeException ne)
+            {
+                return null;
+            }
+            catch (SecurityException se)
+            {
+                return null;
+            }
+        }
+
+        // search for path based on current folder 
+        while ((currentRegexpPath.length() > 0) && !currentRegexpPath.equals(Folder.PATH_SEPARATOR))
+        {
+            // parse relative sub-folder from path
+            int separatorIndex = currentRegexpPath.indexOf(Folder.PATH_SEPARATOR);
+            if (separatorIndex != -1)
+            {
+                // isolate sub-folder and continue search
+                // using remaining paths
+                String subfolder = currentRegexpPath.substring(0, separatorIndex);
+                currentRegexpPath = currentRegexpPath.substring(separatorIndex+1);
+                if (subfolder.equals(".."))
+                {
+                    // adjust current folder if parent exists
+                    if (currentFolder.getParent() != null)
+                    {
+                        currentFolder = (Folder)currentFolder.getParent();
+                    }
+                    else
+                    {
+                        return null;
+                    }
+                }
+                else if (!subfolder.equals("."))
+                {
+                    try
+                    {
+                        // check for regular expression pattern
+                        String subfolderPattern = pathRegexpPattern(subfolder);
+                        if (subfolderPattern != null)
+                        {
+                            // follow all matching sub-folders
+                            NodeSet subfolders = currentFolder.getFolders();
+                            if (subfolders != null)
+                            {
+                                subfolders = subfolders.inclusiveSubset(subfolderPattern);
+                                if (subfolders != null)
+                                {
+                                    // recursively process sub-folders if more than
+                                    // one match, access single sub-folder, or return
+                                    // null if nonexistent
+                                    if (subfolders.size() > 1)
+                                    {
+                                        List proxies = null;
+                                        Iterator subfoldersIter = subfolders.iterator();
+                                        while (subfoldersIter.hasNext())
+                                        {
+                                            currentFolder = (Folder)subfoldersIter.next();
+                                            List subfolderProxies = getNodeProxies(currentRegexpPath, currentFolder, onlyVisible);
+                                            if ((subfolderProxies != null) && !subfolderProxies.isEmpty())
+                                            {
+                                                if (proxies == null)
+                                                {
+                                                    proxies = new ArrayList();
+                                                }
+                                                proxies.addAll(subfolderProxies);
+                                            }
+                                        }
+                                        return proxies;
+                                    }
+                                    else if (subfolders.size() == 1)
+                                    {
+                                        currentFolder = (Folder)subfolders.iterator().next();
+                                    }
+                                    else
+                                    {
+                                        return null;
+                                    }
+                                }
+                            }
+                        }
+                        else
+                        {
+                            // access sub-folder or return null if nonexistent
+                            currentFolder = currentFolder.getFolder(subfolder);
+                        }
+                    }
+                    catch (NodeException ne)
+                    {
+                        // could not access sub-folders
+                        return null;
+                    }
+                    catch (SecurityException se)
+                    {
+                        // could not access sub-folders
+                        return null;
+                    }
+                }
+            }
+            else
+            {
+                try
+                {
+                    // get all children of current folder
+                    NodeSet children = currentFolder.getAll();
+                    if (children != null)
+                    {
+                        // check for regular expression pattern
+                        String pathPattern = pathRegexpPattern(currentRegexpPath);
+                        if (pathPattern != null)
+                        {
+                            // copy children matching remaining path pattern as
+                            // page, folder, or link proxies if visible or
+                            // visibilty not required
+                            children = children.inclusiveSubset(pathPattern);
+                            if ((children != null) && !children.isEmpty())
+                            {
+                                List proxies = null;
+                                Iterator childrenIter = children.iterator();
+                                while (childrenIter.hasNext())
+                                {
+                                    Node child = (Node)childrenIter.next(); 
+                                    if (!onlyVisible || isProxyVisible(child))
+                                    {
+                                        if (proxies == null)
+                                        {
+                                            proxies = new ArrayList(children.size());
+                                        }
+                                        proxies.add(child);
+                                    }
+                                }
+                                return proxies;
+                            }
+                        }
+                        else
+                        {
+                            // access remaining path as page, folder, or link
+                            // node proxy; return null if not found or not
+                            // visible and visiblity is required
+                            Node child = children.get(currentRegexpPath);
+                            if ((child != null) && (!onlyVisible || isProxyVisible(child)))
+                            {
+                                List proxies = new ArrayList(1);
+                                proxies.add(currentFolder);
+                                return proxies;
+                            }
+                        }
+                    }
+                    
+                }
+                catch (NodeException ne)
+                {
+                }
+                catch (SecurityException se)
+                {
+                }
+
+                // no children match or available
+                return null;
+            }
+        }
+
+        // path maps to current folder; return if visible
+        // or visibility not required
+        if (!onlyVisible || isProxyVisible(currentFolder))
+        {
+            List proxies = new ArrayList(1);
+            proxies.add(currentFolder);
+            return proxies;
+        }
+        return null;
+    }
+
+    /**
+     * pathRegexpPattern - tests for and converts simple path wildcard
+     *                     and character class regular exressions to
+     *                     perl5/standard java pattern syntax
+     *
+     * @param regexp - candidate path regular expression
+     * @return - converted pattern or null if no regular expression
+     */
+    private static String pathRegexpPattern(String regexp)
+    {
+        // convert expression to pattern
+        StringBuffer pattern = null;
+        for (int i = 0, limit = regexp.length(); (i < limit); i++)
+        {
+            char regexpChar = regexp.charAt(i);
+            switch (regexpChar)
+            {
+                case '*':
+                case '.':
+                case '?':
+                case '[':
+                    if (pattern == null)
+                    {
+                        pattern = new StringBuffer(regexp.length()*2);
+                        pattern.append(regexp.substring(0, i));
+                    }
+                    switch (regexpChar)
+                    {
+                        case '*':
+                            pattern.append(".*");
+                            break;
+                        case '.':
+                            pattern.append("\\.");
+                            break;
+                        case '?':
+                            pattern.append('.');
+                            break;
+                        case '[':
+                            pattern.append('[');
+                            break;
+                    }
+                    break;
+                default:
+                    if (pattern != null)
+                    {
+                        pattern.append(regexpChar);
+                    }
+                    break;
+            }
+        }
+
+        // return converted pattern or null if not a regular expression
+        if (pattern != null)
+            return pattern.toString();
+        return null;
+    }
+
+    /**
+     * isProxyVisible - tests for node proxy visibilty in view
+     *
+     * @param nodeProxy test node proxy
+     * @return - visible flag
+     */
+    private static boolean isProxyVisible(Node nodeProxy)
+    {
+        // pages and links are always considered visible;
+        // folders must be tested for visible child nodes
+        if (nodeProxy instanceof Folder)
+        {
+            try
+            {
+                NodeSet children = ((Folder) nodeProxy).getAll();
+                if (children != null)
+                {
+                    Iterator childrenIter = children.iterator();
+                    while (childrenIter.hasNext())
+                    {
+                        if (isProxyVisible((Node)childrenIter.next()))
+                        {
+                            return true;
+                        }
+                    }
+                }
+            }
+            catch (NodeException ne)
+            {
+            }
+            catch (SecurityException se)
+            {
+            }
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * getStandardMenuNames - get set of available standard menu names
+     *  
+     * @return menu names set
+     */
+    public Set getStandardMenuNames()
+    {
+        // return constant standard menu names
+        return STANDARD_MENU_NAMES;
+    }
+
+    /**
+     * getStandardMenuDefinitionLocators - get list of available standard
+     *                                     menu definition locators
+     *  
+     * @return menu definition locators list
+     */
+    public List getStandardMenuDefinitionLocators()
+    {
+        // return constant standard menu definition locators
+        return STANDARD_MENU_DEFINITION_LOCATORS;
+    }
+
+    /**
+     * getMenuDefinitionLocators - get list of view node proxy menu
+     *                             definition locators; implemented here
+     *                             to hide view proxy manipulation from
+     *                             more general portal site implementation
+     *
+     * @param node node proxy
+     * @return definition locator list
+     */
+    public List getMenuDefinitionLocators(Node node)
+    {
+        // access node proxy from specified node and
+        // return associated definition locators
+        NodeProxy nodeProxy = NodeProxy.getNodeProxy(node);
+        if (nodeProxy != null)
+        {
+            return nodeProxy.getMenuDefinitionLocators();
+        }
+        return null;
+    }
+
+    /**
+     * getMenuDefinitionLocator - get named view node proxy menu
+     *                            definition locator; implemented here
+     *                            to hide view proxy manipulation from
+     *                            more general portal site implementation
+     *
+     * @param node node proxy
+     * @param name menu definition name
+     * @return menu definition locator
+     */
+    public SiteViewMenuDefinitionLocator getMenuDefinitionLocator(Node node, String name)
+    {
+        // access node proxy from specified node and
+        // return associated definition locators
+        NodeProxy nodeProxy = NodeProxy.getNodeProxy(node);
+        if (nodeProxy != null)
+        {
+            return nodeProxy.getMenuDefinitionLocator(name);
+        }
+        return null;
+    }
+
+    /**
+     * getProfileLocatorName - get view node proxy profile locator name;
+     *                         implemented here to hide view proxy manipulation
+     *                         from more general portal site implementation
+     *
+     * @param node node proxy
+     * @return profile locator name
+     */
+    public String getProfileLocatorName(Node node)
+    {
+        SiteViewProxy siteViewProxy = SiteViewProxy.getSiteViewProxy(node);
+        if (siteViewProxy != null)
+        {
+            return siteViewProxy.getLocatorName();
+        }
+        return null;
+    }
+
+    /**
+     * getManagedPage - get concrete page instance from page proxy;
+     *                  implemented here to hide view proxy manipulation
+     *                  from more general portal site implementation
+     *  
+     * @param page page proxy
+     * @return managed page
+     */
+    public Page getManagedPage(Page page)
+    {
+        // access page proxy from specified page and
+        // return associated delegate managed page
+        PageProxy pageProxy = (PageProxy)NodeProxy.getNodeProxy(page);
+        if (pageProxy != null)
+        {
+            return pageProxy.getPage();
+        }
+        return null;
+    }
+}

Propchange: portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteView.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteViewMenuDefinitionLocator.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteViewMenuDefinitionLocator.java?rev=209305&view=auto
==============================================================================
--- portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteViewMenuDefinitionLocator.java (added)
+++ portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteViewMenuDefinitionLocator.java Tue Jul  5 11:58:05 2005
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portalsite.view;
+
+import org.apache.jetspeed.om.folder.MenuDefinition;
+import org.apache.jetspeed.page.document.Node;
+
+/**
+ * This class represents a menu definition locator that is
+ * comprised of the menu name, (the full definition is saved
+ * here from convenience), and concrete path of the
+ * defining folder or page.
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+public class SiteViewMenuDefinitionLocator
+{
+    /**
+     * locator - locator string defined for menu containing
+     *           menu name and concrete path of defining node
+     */
+    private String locator;
+
+    /**
+     * menuDefinition - menu definition
+     */
+    private MenuDefinition menuDefinition;
+
+    /**
+     * SiteViewMenuDefinitionLocator - custom menu definition constructor
+     *
+     * @param menuDefinition custom menu definition
+     * @param definingNode defining page or folder
+     */
+    public SiteViewMenuDefinitionLocator(MenuDefinition menuDefinition, Node definingNode)
+    {
+        this.menuDefinition = menuDefinition;
+        this.locator = definingNode.getPath() + "|" + menuDefinition.getName();
+    }
+
+    /**
+     * SiteViewMenuDefinitionLocator - standard menu definition constructor
+     *
+     * @param menuDefinition standard menu definition
+     */
+    public SiteViewMenuDefinitionLocator(MenuDefinition menuDefinition)
+    {
+        this.menuDefinition = menuDefinition;
+        this.locator = "<standard_menu_definition>|" + menuDefinition.getName();
+    }
+
+    /**
+     * toString - return locator
+     *
+     * @return search path
+     */
+    public String toString()
+    {
+        return locator;
+    }
+
+    /**
+     * equals - compare as string to locator
+     *
+     * @return equals result
+     */
+    public boolean equals(Object obj)
+    {
+        if (obj instanceof String)
+        {
+            return locator.equals((String)obj);
+        }
+        return locator.equals(obj.toString());
+    }
+
+    /**
+     * hashCode - return search path hash code
+     *
+     * @return hash code
+     */
+    public int hashCode()
+    {
+        return locator.hashCode();
+    }
+
+    /**
+     * getMenuDefinition - return menu definition
+     *
+     * @return menu definition
+     */
+    public MenuDefinition getMenuDefinition()
+    {
+        return menuDefinition;
+    }
+
+    /**
+     * getName - return name of menu definition
+     *
+     * @return menu definition name
+     */
+    public String getName()
+    {
+        return menuDefinition.getName();
+    }
+}

Propchange: portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteViewMenuDefinitionLocator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteViewProxy.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteViewProxy.java?rev=209305&view=auto
==============================================================================
--- portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteViewProxy.java (added)
+++ portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteViewProxy.java Tue Jul  5 11:58:05 2005
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portalsite.view;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+/**
+ * This class is the base class for all site content
+ * proxy implementations.
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+public abstract class SiteViewProxy
+{
+    /**
+     * view - site view this proxy is part of
+     */
+    private SiteView view;
+
+    /**
+     * locatorName - name of profile locator name associated
+     *               with the derived delegate of this proxy
+     *               in the site view
+     */
+    private String locatorName;
+
+    /**
+     * SiteViewProxy - constructor
+     *
+     * @param view site view owner of this proxy
+     * @param locatorName profile locator name associated with
+     *                    the derived delegate of this proxy in
+     *                    the site view
+     */
+    protected SiteViewProxy(SiteView view, String locatorName)
+    {
+        this.view = view;
+        this.locatorName = locatorName;
+    }
+
+    /**
+     * getView - return site view for this proxy
+     *
+     * @return site view
+     */
+    public SiteView getView()
+    {
+        return view;
+    }
+
+    /**
+     * getLocatorName - return profile locator name associated
+     *                  with the derived delegate of this proxy in
+     *                  the site view
+     *
+     * @return profile locator name
+     */
+    public String getLocatorName()
+    {
+        return locatorName;
+    }
+
+    /**
+     * reflectMethod - trap method reflection exceptions utility function
+     *
+     * @param methodClass class or interface
+     * @param methodName method name
+     * @param methodArgs array of type, class, or interface parameter types
+     */
+    protected static Method reflectMethod(Class methodClass, String methodName, Class [] methodArgs)
+    {
+        // trap reflection exceptions
+        try
+        {
+            return methodClass.getMethod(methodName, methodArgs);
+        }
+        catch (NoSuchMethodException nsme)
+        {
+            RuntimeException rte = new RuntimeException("SiteViewProxy.reflectMethod(): unexpected reflection exception for: " + methodClass.getName() + "." + methodName);
+            rte.initCause(nsme);
+            throw rte;
+        }
+    }
+
+    /**
+     * getSiteViewProxy - utility method to access SiteViewProxy handler
+     *                    from a proxy instance
+     *
+     * @param proxy proxy instance
+     * @return site view invocation handler instance
+     */
+    public static SiteViewProxy getSiteViewProxy(Object proxy)
+    {
+        if ((proxy != null) && Proxy.isProxyClass(proxy.getClass()))
+        {
+            Object proxyHandler = Proxy.getInvocationHandler(proxy);
+            if (proxyHandler instanceof SiteViewProxy)
+            {
+                return (SiteViewProxy)proxyHandler;
+            }
+        }
+        return null;
+    }
+}

Propchange: portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteViewProxy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteViewSearchPath.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteViewSearchPath.java?rev=209305&view=auto
==============================================================================
--- portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteViewSearchPath.java (added)
+++ portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteViewSearchPath.java Tue Jul  5 11:58:05 2005
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portalsite.view;
+
+import org.apache.jetspeed.om.folder.Folder;
+
+/**
+ * This class represents a search path along with a profile
+ * locator name used to construct the logical site view. The
+ * profiler locator name is uses to identify and group
+ * located nodes within the view.
+ * 
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+public class SiteViewSearchPath
+{
+    /**
+     * locatorName - profile locator name
+     */
+    private String locatorName;
+
+    /**
+     * searchPath - search path
+     */
+    private String searchPath;
+
+    /**
+     * SiteViewSearchPath - validating constructor that strips any trailing
+     *                      folder separator from search path
+     *
+     * @param locatorName profile locator name
+     * @param searchPath search path
+     */
+    public SiteViewSearchPath(String locatorName, String searchPath)
+    {
+        this.locatorName = locatorName;
+        if (searchPath.endsWith(Folder.PATH_SEPARATOR) && !searchPath.equals(Folder.PATH_SEPARATOR))
+        {
+            this.searchPath = searchPath.substring(0, searchPath.length()-1);
+        }
+        else
+        {
+            this.searchPath = searchPath;
+        }
+    }
+
+    /**
+     * toString - return search path
+     *
+     * @return search path
+     */
+    public String toString()
+    {
+        return searchPath;
+    }
+
+    /**
+     * equals - compare as string to search path
+     *
+     * @return equals result
+     */
+    public boolean equals(Object obj)
+    {
+        if (obj instanceof String)
+        {
+            return searchPath.equals((String)obj);
+        }
+        return searchPath.equals(obj.toString());
+    }
+
+    /**
+     * hashCode - return search path hash code
+     *
+     * @return hash code
+     */
+    public int hashCode()
+    {
+        return searchPath.hashCode();
+    }
+
+    /**
+     * getLocatorName - return profile locator name
+     *
+     * @return profile locator name
+     */
+    public String getLocatorName()
+    {
+        return locatorName;
+    }
+}

Propchange: portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/java/org/apache/jetspeed/portalsite/view/SiteViewSearchPath.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/test/META-INF/test-spring.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/test/META-INF/test-spring.xml?rev=209305&view=auto
==============================================================================
--- portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/test/META-INF/test-spring.xml (added)
+++ portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/test/META-INF/test-spring.xml Tue Jul  5 11:58:05 2005
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<!--
+Copyright 2005 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<!-- Portal Site Test Spring Configuration-->
+<beans>
+  
+  <!-- IDGenerator -->
+  <bean id="IdGenerator" 
+  	   class="org.apache.jetspeed.idgenerator.JetspeedIdGenerator" init-method="start" destroy-method="stop" >
+  	   <!-- ID Start value -->
+  	   <constructor-arg index="0"><value>65536</value></constructor-arg>
+  	   <!-- ID Prefix -->
+  	   <constructor-arg index="1"><value>P-</value></constructor-arg>
+  	   <!-- ID Suffix -->
+  	   <constructor-arg index="2"><value></value></constructor-arg>
+  </bean>
+  
+  <!-- PageFileCache -->
+  <bean id="PageFileCache" 
+  	   class="org.apache.jetspeed.cache.file.FileCache" 
+  	   init-method="startFileScanner"
+  	   destroy-method="stopFileScanner">
+  	   <!-- Scan rate for changes in cached files on the file system -->
+  	   <constructor-arg index="0"><value>10</value></constructor-arg>
+  	   <!-- Cache size -->
+  	   <constructor-arg index="1"><value>100</value></constructor-arg>  	   
+  </bean>
+    
+  <!-- DocumentHandlerFactory -->
+  <bean id="PsmlDocumentHandler"      
+       class="org.apache.jetspeed.page.document.CastorFileSystemDocumentHandler" >         
+       <constructor-arg index="0"><value>/META-INF/page-mapping.xml</value></constructor-arg>
+       <constructor-arg index="1"><value>.psml</value></constructor-arg>
+       <constructor-arg index="2" ><value>org.apache.jetspeed.om.page.Page</value></constructor-arg>       
+       <constructor-arg index="3" ><value>target/testdata/pages</value></constructor-arg>
+       <constructor-arg index="4" ><ref bean="PageFileCache"/></constructor-arg>
+  </bean>
+  
+  <bean id="LinkDocumentHandler"       
+       class="org.apache.jetspeed.page.document.CastorFileSystemDocumentHandler" >         
+       <constructor-arg index="0"><value>/META-INF/page-mapping.xml</value></constructor-arg>
+       <constructor-arg index="1"><value>.link</value></constructor-arg>
+       <constructor-arg index="2" ><value>org.apache.jetspeed.om.page.Link</value></constructor-arg>       
+       <constructor-arg index="3" ><value>target/testdata/pages</value></constructor-arg>
+       <constructor-arg index="4" ><ref bean="PageFileCache"/></constructor-arg>
+  </bean>
+  
+  <bean id="FolderMetaDataDocumentHandler"         
+       class="org.apache.jetspeed.page.document.CastorFileSystemDocumentHandler" >         
+       <constructor-arg index="0"><value>/META-INF/page-mapping.xml</value></constructor-arg>
+       <constructor-arg index="1"><value>folder.metadata</value></constructor-arg>
+       <constructor-arg index="2" ><value>org.apache.jetspeed.om.folder.FolderMetaData</value></constructor-arg>       
+       <constructor-arg index="3" ><value>target/testdata/pages</value></constructor-arg>
+       <constructor-arg index="4" ><ref bean="PageFileCache"/></constructor-arg>
+  </bean>
+  
+  <bean id="PageSecurityDocumentHandler"       
+       class="org.apache.jetspeed.page.document.CastorFileSystemDocumentHandler" >         
+       <constructor-arg index="0"><value>/META-INF/page-mapping.xml</value></constructor-arg>
+       <constructor-arg index="1"><value>page.security</value></constructor-arg>
+       <constructor-arg index="2" ><value>org.apache.jetspeed.om.page.PageSecurity</value></constructor-arg>       
+       <constructor-arg index="3" ><value>target/testdata/pages</value></constructor-arg>
+       <constructor-arg index="4" ><ref bean="PageFileCache"/></constructor-arg>
+  </bean>
+  
+  <bean id="DocumentHandlerFactory"        
+       class="org.apache.jetspeed.page.document.DocumentHandlerFactoryImpl" >      
+        <constructor-arg>
+        <map>
+          <entry key=".psml">
+            <ref bean="PsmlDocumentHandler" />
+          </entry>
+          <entry key=".link">
+            <ref bean="LinkDocumentHandler" />
+          </entry>  
+          <entry key="folder.metadata">
+            <ref bean="FolderMetaDataDocumentHandler" />
+          </entry>        
+          <entry key="page.security">
+            <ref bean="PageSecurityDocumentHandler" />
+          </entry>        
+        </map>
+       </constructor-arg>
+  </bean>
+  
+  <!-- FolderHandler -->
+  <bean id="FolderHandler"         
+       class="org.apache.jetspeed.page.document.FileSystemFolderHandler" >         
+       <constructor-arg index="0"><value>target/testdata/pages</value></constructor-arg>
+       <constructor-arg index="1"><ref bean="DocumentHandlerFactory"/></constructor-arg>
+       <constructor-arg index="2"><ref bean="PageFileCache"/></constructor-arg>        
+  </bean>
+
+  <!-- PageManager -->
+  <bean id="org.apache.jetspeed.page.PageManager" 
+       name="pageManager"
+       class="org.apache.jetspeed.page.impl.CastorXmlPageManager">         
+       <constructor-arg index="0"><ref bean="IdGenerator"/></constructor-arg>
+       <constructor-arg index="1"><ref bean="DocumentHandlerFactory"/></constructor-arg>
+       <constructor-arg index="2"><ref bean="FolderHandler"/></constructor-arg>
+       <constructor-arg index="3"><ref bean="PageFileCache"/></constructor-arg>        
+       <!-- permissions security enabled flag, default=false -->
+       <constructor-arg index="4"><value>false</value></constructor-arg>
+       <!-- constraints security enabled flag, default=true -->
+       <constructor-arg index="5"><value>false</value></constructor-arg>
+  </bean>
+    
+  <!-- PortalSite -->
+  <bean id="org.apache.jetspeed.portalsite.PortalSite" 
+       name="portalSite"
+       class="org.apache.jetspeed.portalsite.impl.PortalSiteImpl">         
+       <constructor-arg index="0"><ref bean="pageManager"/></constructor-arg>
+  </bean>
+    
+</beans>

Propchange: portals/jetspeed-2/branches/MENUS_BRANCH/components/portal-site/src/test/META-INF/test-spring.xml
------------------------------------------------------------------------------
    svn:eol-style = native



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


Mime
View raw message