portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r725977 [23/48] - in /portals/jetspeed-2/portal/trunk: ./ app-servers/security/jboss/src/java/META-INF/jboss-secsvc/ app-servers/security/jboss/src/java/org/apache/jetspeed/appservers/security/jboss/ applications/jetspeed/src/main/javascrip...
Date Fri, 12 Dec 2008 12:07:04 GMT
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestConstraintsAction.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestConstraintsAction.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestConstraintsAction.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestConstraintsAction.java Fri Dec 12 04:06:29 2008
@@ -1,379 +1,379 @@
-/*
+/*
  * 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.layout;
-
-import java.io.File;
-import java.security.PrivilegedAction;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.security.auth.Subject;
-
-import org.apache.jetspeed.components.ComponentManager;
-import org.apache.jetspeed.components.SpringComponentManager;
-import org.apache.jetspeed.components.factorybeans.ServletConfigFactoryBean;
-import org.apache.jetspeed.layout.impl.LayoutValve;
-import org.apache.jetspeed.mocks.ResourceLocatingServletContext;
-import org.apache.jetspeed.om.common.SecurityConstraint;
-import org.apache.jetspeed.om.page.PageSecurity;
-import org.apache.jetspeed.om.page.SecurityConstraintsDef;
-import org.apache.jetspeed.page.PageManager;
-import org.apache.jetspeed.pipeline.PipelineException;
-import org.apache.jetspeed.request.JetspeedRequestContext;
-import org.apache.jetspeed.request.RequestContext;
-import org.apache.jetspeed.request.RequestContextComponent;
-import org.apache.jetspeed.security.JSSubject;
-import org.apache.jetspeed.security.JetspeedPrincipal;
-import org.apache.jetspeed.security.JetspeedPrincipalType;
-import org.apache.jetspeed.security.Role;
-import org.apache.jetspeed.security.SecurityAttributeType;
-import org.apache.jetspeed.security.SecurityAttributeTypes;
-import org.apache.jetspeed.security.User;
-import org.apache.jetspeed.security.impl.TransientJetspeedPrincipal;
-import org.apache.jetspeed.test.JetspeedTestCase;
-import org.jmock.Mock;
-
-import com.mockrunner.mock.web.MockHttpServletRequest;
-import com.mockrunner.mock.web.MockHttpServletResponse;
-import com.mockrunner.mock.web.MockHttpSession;
-import com.mockrunner.mock.web.MockServletConfig;
-import com.mockrunner.mock.web.MockServletContext;
-
-/**
- * Test Security Constraints Manipulation
- *  
- * @author <a>David Sean Taylor </a>
- * @version $Id: $
- */
-public class TestConstraintsAction extends JetspeedTestCase
-{
-
-    private ComponentManager cm;
-
-    private LayoutValve valve;
-    
-    private PageManager pageManager;
-
-    public static void main(String[] args)
-    {
-        junit.swingui.TestRunner.run(TestConstraintsAction.class);
-    }
-
-    /**
-     * Setup the request context
-     */
-    protected void setUp() throws Exception
-    {
-        super.setUp();
-
-        MockServletConfig servletConfig = new MockServletConfig();        
-        ResourceLocatingServletContext servletContent = new ResourceLocatingServletContext(new File(getBaseDir()));        
-        servletConfig.setServletContext(servletContent);
-        ServletConfigFactoryBean.setServletConfig(servletConfig);
-        
-        // Load the Spring configs
-        String[] bootConfigs = null;
-        String[] appConfigs =
-        { //"src/webapp/WEB-INF/assembly/layout-api.xml",
-                "src/test/assembly/test-layout-constraints-api.xml",
-                "src/test/assembly/page-manager.xml",
-                "src/test/assembly/cache-test.xml"};
-        
-                
-        cm = new SpringComponentManager(null, bootConfigs, appConfigs, servletContent, getBaseDir());
-        cm.start();
-        valve = (LayoutValve) cm.getComponent("layoutValve");
-        pageManager = (PageManager) cm.getComponent("pageManager");
-    }
-
-    protected void tearDown() throws Exception
-    {
-        cm.stop();
-        super.tearDown();
-    }
-
-    public void testUpdate()
-    throws Exception
-    {
-        String method = "update-def";
-        String defName = "users";
-        String xml =
-            "<security-constraints-def name=\"" + 
-                  defName + 
-                  "\"><security-constraint><roles>user, manager</roles><permissions>view,edit</permissions></security-constraint></security-constraints-def>";
-        runTest(xml, defName, method);
-        PageSecurity pageSecurity = pageManager.getPageSecurity();
-        SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(defName);
-        assertNotNull("definition " + defName + " not found ", def);
-        assertNotNull("first constraint for " + defName + " not found ", def);
-        List constraints = def.getSecurityConstraints();
-        assertFalse("constraint list is empty.", constraints.isEmpty());
-        SecurityConstraint constraint =  (SecurityConstraint) constraints.get(0);
-        assertEquals("update failed for constraints " + constraint.getPermissions().toString(), constraint.getPermissions().toString(), "[view, edit]");
-    }
-
-    public void testAdd()
-    throws Exception
-    {
-        String method = "add-def";
-        String defName = "newone";
-        String xml =
-            "<security-constraints-def name=\"" + 
-                  defName + 
-                  "\"><security-constraint><roles>user, manager</roles><permissions>view,edit</permissions></security-constraint></security-constraints-def>";
-        runTest(xml, defName, method);
-        PageSecurity pageSecurity = pageManager.getPageSecurity();
-        SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(defName);
-        assertNotNull("definition " + defName + " not found ", def);
-        SecurityConstraint constraint =  (SecurityConstraint)def.getSecurityConstraints().get(0);
-        assertNotNull("first constraint for " + defName + " not found ", def);
-        assertEquals("update failed for constraints " + constraint.getPermissions().toString(), constraint.getPermissions().toString(), "[view, edit]");
-    }
-    
-    public void testAdds()
-    throws Exception
-    {
-        String method = "update-def";        
-        String defName = "users";
-        String xml =
-            "<security-constraints-def name=\"" + 
-                  defName + 
-                  "\"><security-constraint><roles>user, manager,anon</roles><permissions>view,edit,help</permissions></security-constraint>" +
-                  "<security-constraint><groups>accounting,finance</groups><permissions>view,edit,help</permissions></security-constraint>" +
-                  "<security-constraint><users>tomcat</users><permissions>view</permissions></security-constraint>" +
-                  "<security-constraint><users>manager,admin</users><permissions>view,help</permissions></security-constraint>" +
-                  "</security-constraints-def>";
-                  
-        runTest(xml, defName, method);
-        PageSecurity pageSecurity = pageManager.getPageSecurity();
-        SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(defName);
-        assertNotNull("definition " + defName + " not found ", def);
-        SecurityConstraint constraint =  (SecurityConstraint)def.getSecurityConstraints().get(0);
-        assertNotNull("first constraint for " + defName + " not found ", constraint);
-        assertEquals("update failed for constraints " + constraint.getPermissions().toString(), constraint.getPermissions().toString(), "[view, edit, help]");
-        assertEquals("update failed for constraints " + constraint.getRoles().toString(), constraint.getRoles().toString(), "[user, manager, anon]");
-        
-        SecurityConstraint constraint2 =  (SecurityConstraint)def.getSecurityConstraints().get(1);
-        assertNotNull("second constraint for " + defName + " not found ", constraint2);
-        assertEquals("add failed for constraints " + constraint2.getPermissions().toString(), constraint2.getPermissions().toString(), "[view, edit, help]");
-        assertEquals("add failed for constraints " + constraint2.getGroups().toString(), constraint2.getGroups().toString(), "[accounting, finance]");
-
-        SecurityConstraint constraint3 =  (SecurityConstraint)def.getSecurityConstraints().get(2);
-        assertNotNull("third constraint for " + defName + " not found ", constraint3);
-        assertEquals("add failed for constraints " + constraint3.getPermissions().toString(), constraint3.getPermissions().toString(), "[view]");
-        assertEquals("add failed for constraints " + constraint3.getUsers().toString(), constraint3.getUsers().toString(), "[tomcat]");
-
-        SecurityConstraint constraint4 =  (SecurityConstraint)def.getSecurityConstraints().get(3);
-        assertNotNull("fourth constraint for " + defName + " not found ", constraint4);
-        assertEquals("add failed for constraints " + constraint4.getPermissions().toString(), constraint4.getPermissions().toString(), "[view, help]");
-        assertEquals("add failed for constraints " + constraint4.getUsers().toString(), constraint4.getUsers().toString(), "[manager, admin]");
-        
-    }
-
-    public void testDeletes()
-    throws Exception
-    {
-        String method = "update-def";        
-        String defName = "delete3";
-        String xml =
-            "<security-constraints-def name=\"" + 
-                  defName + 
-                  "\"><security-constraint><users>*</users><permissions>view</permissions></security-constraint></security-constraints-def>";
-        runTest(xml, defName, method);
-        PageSecurity pageSecurity = pageManager.getPageSecurity();
-        SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(defName);
-        assertNotNull("definition " + defName + " not found ", def);
-        SecurityConstraint constraint =  (SecurityConstraint)def.getSecurityConstraints().get(0);
-        assertNotNull("first constraint for " + defName + " not found ", def);
-        assertEquals("delete merge failed for constraints " + constraint.getPermissions().toString(), constraint.getPermissions().toString(), "[view]");
-        assertEquals("delete merge failed for constraints " + constraint.getUsers().toString(), constraint.getUsers().toString(), "[*]");        
-        assertTrue("constrainst size should be 1 ", def.getSecurityConstraints().size() == 1);        
-    }
-
-    public void testDeleteDef()
-    throws Exception
-    {
-        String method = "remove-def";        
-        String defName = "deleteme";
-        String xml = "";
-        runTest(xml, defName, method);
-        PageSecurity pageSecurity = pageManager.getPageSecurity();
-        SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(defName);
-        assertNull("definition " + defName + " should be deleted ", def);
-    }
-
-    public void testAddGlobal()
-    throws Exception
-    {
-        String method = "add-global";        
-        String defName = "manager";
-        String xml = "";
-        runTest(xml, defName, method);
-        PageSecurity pageSecurity = pageManager.getPageSecurity();
-        List globals = pageSecurity.getGlobalSecurityConstraintsRefs();
-        assertTrue("should have found new global " + defName,  globals.contains(defName));
-        assertTrue("should have found old global " + defName,  globals.contains("admin"));
-    }
-
-    public void testDeleteGlobal()
-    throws Exception
-    {
-        PageSecurity pageSecurity = pageManager.getPageSecurity();        
-        String method = "add-global";        
-        String defName = "public-edit";
-        String xml = "";        
-        runTest(xml, defName, method);
-        List globals = pageSecurity.getGlobalSecurityConstraintsRefs();
-        assertTrue("should have found new global " + defName,  globals.contains(defName));
-        method = "remove-global";        
-        runTest(xml, defName, method);
-        globals = pageSecurity.getGlobalSecurityConstraintsRefs();
-        assertFalse("should have not found new global " + defName,  globals.contains(defName));
-    }
-    
-    public void runTest(String xml, String defName, String method)
-    throws Exception
-    {
-        RequestContextComponent rcc = (RequestContextComponent) new Mock(RequestContextComponent.class).proxy();
-        
-        MockServletConfig config = new MockServletConfig();
-        MockServletContext context = new MockServletContext();
-        MockHttpSession session = new MockHttpSession();
-        session.setupServletContext(context);
-        MockHttpServletRequest request = new MockHttpServletRequest();
-        request.setupAddParameter("action", "constraints");
-        request.setupAddParameter("method", method);
-        request.setupAddParameter("xml", xml);
-        request.setupAddParameter("name", defName);
-        request.setSession(session);
-        MockHttpServletResponse response = new MockHttpServletResponse();
-
-        final RequestContext rc = 
-            new JetspeedRequestContext(rcc, request, response, config, null);
-        
-        Set principals = new HashSet();
-        principals.add(new TestUser("admin"));
-        principals.add(new TestRole("admin"));
-        Subject subject = new Subject(true, principals, new HashSet(), new HashSet());
-        
-        JSSubject.doAsPrivileged(subject, new PrivilegedAction()
-                {
-                    public Object run() 
-                    {
-                         try
-                        {
-                             valve.invoke(rc, null);                 
-                            return null;
-                        }
-                        catch (PipelineException e)
-                        {
-                            return e;
-                        }                    
-                    }
-                }, null);
-     
-        
-    }
-    
-    static class AbstractTestPrincipal extends TransientJetspeedPrincipal
-    {
-        private static final SecurityAttributeTypes attributeTypes = new SecurityAttributeTypes()
-        {
-
-            public Map<String, SecurityAttributeType> getAttributeTypeMap()
-            {
-                return Collections.emptyMap();
-            }
-
-            public Map<String, SecurityAttributeType> getAttributeTypeMap(String category)
-            {
-                return Collections.emptyMap();
-            }
-
-            public boolean isExtendable()
-            {
-                return false;
-            }
-
-            public boolean isReadOnly()
-            {
-                return true;
-            }
-        };
-        
-        private JetspeedPrincipalType type;
-        
-        private static final long serialVersionUID = 1L;
-        
-
-        public AbstractTestPrincipal(final String type, String name)
-        {
-            super(type, name);
-            this.type = new JetspeedPrincipalType()
-            {               
-                public SecurityAttributeTypes getAttributeTypes()
-                {
-                    return attributeTypes;
-                }
-
-                public String getClassName()
-                {
-                    return null;
-                }
-
-                public String getName()
-                {
-                    return type;
-                }
-
-                public Class<JetspeedPrincipal> getPrincipalClass()
-                {
-                    return null;
-                }
-            };
-        }
-
-        @Override
-        public synchronized JetspeedPrincipalType getType()
-        {
-            return type;
-        }
-    }
-    
-    static class TestUser extends AbstractTestPrincipal implements User
-    {
-        private static final long serialVersionUID = 1L;
-
-        public TestUser(String name)
-        {
-            super(JetspeedPrincipalType.USER, name);
-        }
-    }
-
-    static class TestRole extends AbstractTestPrincipal implements Role
-    {
-        private static final long serialVersionUID = 1L;
-
-        public TestRole(String name)
-        {
-            super(JetspeedPrincipalType.ROLE, name);
-        }
-    }
-}
+ * 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.layout;
+
+import java.io.File;
+import java.security.PrivilegedAction;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.security.auth.Subject;
+
+import org.apache.jetspeed.components.ComponentManager;
+import org.apache.jetspeed.components.SpringComponentManager;
+import org.apache.jetspeed.components.factorybeans.ServletConfigFactoryBean;
+import org.apache.jetspeed.layout.impl.LayoutValve;
+import org.apache.jetspeed.mocks.ResourceLocatingServletContext;
+import org.apache.jetspeed.om.common.SecurityConstraint;
+import org.apache.jetspeed.om.page.PageSecurity;
+import org.apache.jetspeed.om.page.SecurityConstraintsDef;
+import org.apache.jetspeed.page.PageManager;
+import org.apache.jetspeed.pipeline.PipelineException;
+import org.apache.jetspeed.request.JetspeedRequestContext;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.request.RequestContextComponent;
+import org.apache.jetspeed.security.JSSubject;
+import org.apache.jetspeed.security.JetspeedPrincipal;
+import org.apache.jetspeed.security.JetspeedPrincipalType;
+import org.apache.jetspeed.security.Role;
+import org.apache.jetspeed.security.SecurityAttributeType;
+import org.apache.jetspeed.security.SecurityAttributeTypes;
+import org.apache.jetspeed.security.User;
+import org.apache.jetspeed.security.impl.TransientJetspeedPrincipal;
+import org.apache.jetspeed.test.JetspeedTestCase;
+import org.jmock.Mock;
+
+import com.mockrunner.mock.web.MockHttpServletRequest;
+import com.mockrunner.mock.web.MockHttpServletResponse;
+import com.mockrunner.mock.web.MockHttpSession;
+import com.mockrunner.mock.web.MockServletConfig;
+import com.mockrunner.mock.web.MockServletContext;
+
+/**
+ * Test Security Constraints Manipulation
+ *  
+ * @author <a>David Sean Taylor </a>
+ * @version $Id: $
+ */
+public class TestConstraintsAction extends JetspeedTestCase
+{
+
+    private ComponentManager cm;
+
+    private LayoutValve valve;
+    
+    private PageManager pageManager;
+
+    public static void main(String[] args)
+    {
+        junit.swingui.TestRunner.run(TestConstraintsAction.class);
+    }
+
+    /**
+     * Setup the request context
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+
+        MockServletConfig servletConfig = new MockServletConfig();        
+        ResourceLocatingServletContext servletContent = new ResourceLocatingServletContext(new File(getBaseDir()));        
+        servletConfig.setServletContext(servletContent);
+        ServletConfigFactoryBean.setServletConfig(servletConfig);
+        
+        // Load the Spring configs
+        String[] bootConfigs = null;
+        String[] appConfigs =
+        { //"src/webapp/WEB-INF/assembly/layout-api.xml",
+                "src/test/assembly/test-layout-constraints-api.xml",
+                "src/test/assembly/page-manager.xml",
+                "src/test/assembly/cache-test.xml"};
+        
+                
+        cm = new SpringComponentManager(null, bootConfigs, appConfigs, servletContent, getBaseDir());
+        cm.start();
+        valve = (LayoutValve) cm.getComponent("layoutValve");
+        pageManager = (PageManager) cm.getComponent("pageManager");
+    }
+
+    protected void tearDown() throws Exception
+    {
+        cm.stop();
+        super.tearDown();
+    }
+
+    public void testUpdate()
+    throws Exception
+    {
+        String method = "update-def";
+        String defName = "users";
+        String xml =
+            "<security-constraints-def name=\"" + 
+                  defName + 
+                  "\"><security-constraint><roles>user, manager</roles><permissions>view,edit</permissions></security-constraint></security-constraints-def>";
+        runTest(xml, defName, method);
+        PageSecurity pageSecurity = pageManager.getPageSecurity();
+        SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(defName);
+        assertNotNull("definition " + defName + " not found ", def);
+        assertNotNull("first constraint for " + defName + " not found ", def);
+        List constraints = def.getSecurityConstraints();
+        assertFalse("constraint list is empty.", constraints.isEmpty());
+        SecurityConstraint constraint =  (SecurityConstraint) constraints.get(0);
+        assertEquals("update failed for constraints " + constraint.getPermissions().toString(), constraint.getPermissions().toString(), "[view, edit]");
+    }
+
+    public void testAdd()
+    throws Exception
+    {
+        String method = "add-def";
+        String defName = "newone";
+        String xml =
+            "<security-constraints-def name=\"" + 
+                  defName + 
+                  "\"><security-constraint><roles>user, manager</roles><permissions>view,edit</permissions></security-constraint></security-constraints-def>";
+        runTest(xml, defName, method);
+        PageSecurity pageSecurity = pageManager.getPageSecurity();
+        SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(defName);
+        assertNotNull("definition " + defName + " not found ", def);
+        SecurityConstraint constraint =  (SecurityConstraint)def.getSecurityConstraints().get(0);
+        assertNotNull("first constraint for " + defName + " not found ", def);
+        assertEquals("update failed for constraints " + constraint.getPermissions().toString(), constraint.getPermissions().toString(), "[view, edit]");
+    }
+    
+    public void testAdds()
+    throws Exception
+    {
+        String method = "update-def";        
+        String defName = "users";
+        String xml =
+            "<security-constraints-def name=\"" + 
+                  defName + 
+                  "\"><security-constraint><roles>user, manager,anon</roles><permissions>view,edit,help</permissions></security-constraint>" +
+                  "<security-constraint><groups>accounting,finance</groups><permissions>view,edit,help</permissions></security-constraint>" +
+                  "<security-constraint><users>tomcat</users><permissions>view</permissions></security-constraint>" +
+                  "<security-constraint><users>manager,admin</users><permissions>view,help</permissions></security-constraint>" +
+                  "</security-constraints-def>";
+                  
+        runTest(xml, defName, method);
+        PageSecurity pageSecurity = pageManager.getPageSecurity();
+        SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(defName);
+        assertNotNull("definition " + defName + " not found ", def);
+        SecurityConstraint constraint =  (SecurityConstraint)def.getSecurityConstraints().get(0);
+        assertNotNull("first constraint for " + defName + " not found ", constraint);
+        assertEquals("update failed for constraints " + constraint.getPermissions().toString(), constraint.getPermissions().toString(), "[view, edit, help]");
+        assertEquals("update failed for constraints " + constraint.getRoles().toString(), constraint.getRoles().toString(), "[user, manager, anon]");
+        
+        SecurityConstraint constraint2 =  (SecurityConstraint)def.getSecurityConstraints().get(1);
+        assertNotNull("second constraint for " + defName + " not found ", constraint2);
+        assertEquals("add failed for constraints " + constraint2.getPermissions().toString(), constraint2.getPermissions().toString(), "[view, edit, help]");
+        assertEquals("add failed for constraints " + constraint2.getGroups().toString(), constraint2.getGroups().toString(), "[accounting, finance]");
+
+        SecurityConstraint constraint3 =  (SecurityConstraint)def.getSecurityConstraints().get(2);
+        assertNotNull("third constraint for " + defName + " not found ", constraint3);
+        assertEquals("add failed for constraints " + constraint3.getPermissions().toString(), constraint3.getPermissions().toString(), "[view]");
+        assertEquals("add failed for constraints " + constraint3.getUsers().toString(), constraint3.getUsers().toString(), "[tomcat]");
+
+        SecurityConstraint constraint4 =  (SecurityConstraint)def.getSecurityConstraints().get(3);
+        assertNotNull("fourth constraint for " + defName + " not found ", constraint4);
+        assertEquals("add failed for constraints " + constraint4.getPermissions().toString(), constraint4.getPermissions().toString(), "[view, help]");
+        assertEquals("add failed for constraints " + constraint4.getUsers().toString(), constraint4.getUsers().toString(), "[manager, admin]");
+        
+    }
+
+    public void testDeletes()
+    throws Exception
+    {
+        String method = "update-def";        
+        String defName = "delete3";
+        String xml =
+            "<security-constraints-def name=\"" + 
+                  defName + 
+                  "\"><security-constraint><users>*</users><permissions>view</permissions></security-constraint></security-constraints-def>";
+        runTest(xml, defName, method);
+        PageSecurity pageSecurity = pageManager.getPageSecurity();
+        SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(defName);
+        assertNotNull("definition " + defName + " not found ", def);
+        SecurityConstraint constraint =  (SecurityConstraint)def.getSecurityConstraints().get(0);
+        assertNotNull("first constraint for " + defName + " not found ", def);
+        assertEquals("delete merge failed for constraints " + constraint.getPermissions().toString(), constraint.getPermissions().toString(), "[view]");
+        assertEquals("delete merge failed for constraints " + constraint.getUsers().toString(), constraint.getUsers().toString(), "[*]");        
+        assertTrue("constrainst size should be 1 ", def.getSecurityConstraints().size() == 1);        
+    }
+
+    public void testDeleteDef()
+    throws Exception
+    {
+        String method = "remove-def";        
+        String defName = "deleteme";
+        String xml = "";
+        runTest(xml, defName, method);
+        PageSecurity pageSecurity = pageManager.getPageSecurity();
+        SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(defName);
+        assertNull("definition " + defName + " should be deleted ", def);
+    }
+
+    public void testAddGlobal()
+    throws Exception
+    {
+        String method = "add-global";        
+        String defName = "manager";
+        String xml = "";
+        runTest(xml, defName, method);
+        PageSecurity pageSecurity = pageManager.getPageSecurity();
+        List globals = pageSecurity.getGlobalSecurityConstraintsRefs();
+        assertTrue("should have found new global " + defName,  globals.contains(defName));
+        assertTrue("should have found old global " + defName,  globals.contains("admin"));
+    }
+
+    public void testDeleteGlobal()
+    throws Exception
+    {
+        PageSecurity pageSecurity = pageManager.getPageSecurity();        
+        String method = "add-global";        
+        String defName = "public-edit";
+        String xml = "";        
+        runTest(xml, defName, method);
+        List globals = pageSecurity.getGlobalSecurityConstraintsRefs();
+        assertTrue("should have found new global " + defName,  globals.contains(defName));
+        method = "remove-global";        
+        runTest(xml, defName, method);
+        globals = pageSecurity.getGlobalSecurityConstraintsRefs();
+        assertFalse("should have not found new global " + defName,  globals.contains(defName));
+    }
+    
+    public void runTest(String xml, String defName, String method)
+    throws Exception
+    {
+        RequestContextComponent rcc = (RequestContextComponent) new Mock(RequestContextComponent.class).proxy();
+        
+        MockServletConfig config = new MockServletConfig();
+        MockServletContext context = new MockServletContext();
+        MockHttpSession session = new MockHttpSession();
+        session.setupServletContext(context);
+        MockHttpServletRequest request = new MockHttpServletRequest();
+        request.setupAddParameter("action", "constraints");
+        request.setupAddParameter("method", method);
+        request.setupAddParameter("xml", xml);
+        request.setupAddParameter("name", defName);
+        request.setSession(session);
+        MockHttpServletResponse response = new MockHttpServletResponse();
+
+        final RequestContext rc = 
+            new JetspeedRequestContext(rcc, request, response, config, null);
+        
+        Set principals = new HashSet();
+        principals.add(new TestUser("admin"));
+        principals.add(new TestRole("admin"));
+        Subject subject = new Subject(true, principals, new HashSet(), new HashSet());
+        
+        JSSubject.doAsPrivileged(subject, new PrivilegedAction()
+                {
+                    public Object run() 
+                    {
+                         try
+                        {
+                             valve.invoke(rc, null);                 
+                            return null;
+                        }
+                        catch (PipelineException e)
+                        {
+                            return e;
+                        }                    
+                    }
+                }, null);
+     
+        
+    }
+    
+    static class AbstractTestPrincipal extends TransientJetspeedPrincipal
+    {
+        private static final SecurityAttributeTypes attributeTypes = new SecurityAttributeTypes()
+        {
+
+            public Map<String, SecurityAttributeType> getAttributeTypeMap()
+            {
+                return Collections.emptyMap();
+            }
+
+            public Map<String, SecurityAttributeType> getAttributeTypeMap(String category)
+            {
+                return Collections.emptyMap();
+            }
+
+            public boolean isExtendable()
+            {
+                return false;
+            }
+
+            public boolean isReadOnly()
+            {
+                return true;
+            }
+        };
+        
+        private JetspeedPrincipalType type;
+        
+        private static final long serialVersionUID = 1L;
+        
+
+        public AbstractTestPrincipal(final String type, String name)
+        {
+            super(type, name);
+            this.type = new JetspeedPrincipalType()
+            {               
+                public SecurityAttributeTypes getAttributeTypes()
+                {
+                    return attributeTypes;
+                }
+
+                public String getClassName()
+                {
+                    return null;
+                }
+
+                public String getName()
+                {
+                    return type;
+                }
+
+                public Class<JetspeedPrincipal> getPrincipalClass()
+                {
+                    return null;
+                }
+            };
+        }
+
+        @Override
+        public synchronized JetspeedPrincipalType getType()
+        {
+            return type;
+        }
+    }
+    
+    static class TestUser extends AbstractTestPrincipal implements User
+    {
+        private static final long serialVersionUID = 1L;
+
+        public TestUser(String name)
+        {
+            super(JetspeedPrincipalType.USER, name);
+        }
+    }
+
+    static class TestRole extends AbstractTestPrincipal implements Role
+    {
+        private static final long serialVersionUID = 1L;
+
+        public TestRole(String name)
+        {
+            super(JetspeedPrincipalType.ROLE, name);
+        }
+    }
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestConstraintsAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestLayout.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/layout/TestPortletPlacement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/MockUserInfoManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/MockUserInfoManager.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/MockUserInfoManager.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/MockUserInfoManager.java Fri Dec 12 04:06:29 2008
@@ -4,46 +4,46 @@
  * 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.userinfo;
-
-import java.util.HashMap;
-import java.util.Map;
+ * 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.userinfo;
+
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.portlet.PortletRequest;
-
-import org.apache.jetspeed.request.RequestContext;
+
+import org.apache.jetspeed.request.RequestContext;
 import org.apache.pluto.PortletContainerException;
 import org.apache.pluto.PortletWindow;
-
-
-public class MockUserInfoManager implements UserInfoManager
-{
-    private Map<String, String> fake = new HashMap<String, String>();
-    
-    public MockUserInfoManager()
-    {}
-    
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.userinfo.UserInfoManager#getUserInfoMap(org.apache.pluto.om.common.ObjectID, org.apache.jetspeed.request.RequestContext)
-     */
-    public Map<String, String> getUserInfoMap(String appName, RequestContext context)
-    {
-        return fake;
+
+
+public class MockUserInfoManager implements UserInfoManager
+{
+    private Map<String, String> fake = new HashMap<String, String>();
+    
+    public MockUserInfoManager()
+    {}
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.userinfo.UserInfoManager#getUserInfoMap(org.apache.pluto.om.common.ObjectID, org.apache.jetspeed.request.RequestContext)
+     */
+    public Map<String, String> getUserInfoMap(String appName, RequestContext context)
+    {
+        return fake;
     }
 
     public Map<String, String> getUserInfo(PortletRequest request, PortletWindow window) throws PortletContainerException
     {
         return fake;
-    }
+    }
     
 }
\ No newline at end of file

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/java/org/apache/jetspeed/userinfo/MockUserInfoManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/resources/rc2.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/test/resources/rc3.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portlet-factory/src/main/java/org/apache/jetspeed/factory/JetspeedPortletProxyInstance.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portlet-factory/src/main/java/org/apache/jetspeed/factory/JetspeedPortletProxyInstance.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portlet-factory/src/main/java/org/apache/jetspeed/factory/JetspeedPortletProxyInstance.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portlet-factory/src/main/java/org/apache/jetspeed/factory/JetspeedPortletProxyInstance.java Fri Dec 12 04:06:29 2008
@@ -1,36 +1,36 @@
-/*
- * 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.factory;
-
-import javax.portlet.Portlet;
-
-import org.apache.jetspeed.portlet.PortletObjectProxy;
-
-/**
- * JetspeedPortletProxyInstance
- * 
- * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
- * @version $Id: JetspeedPortletProxyInstance.java 516448 2007-03-09 16:25:47Z ate $
- *
- */
-public class JetspeedPortletProxyInstance extends JetspeedPortletInstance
-{
-    public JetspeedPortletProxyInstance(String portletName, Portlet portlet, boolean autoSwitchEditDefaultsModeToEditMode, boolean autoSwitchConfigMode, String customConfigModePortletUniqueName)
-    {
-        super(portletName, (Portlet) PortletObjectProxy.createProxy(portlet, autoSwitchEditDefaultsModeToEditMode, autoSwitchConfigMode, customConfigModePortletUniqueName));
-    }
-}
+/*
+ * 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.factory;
+
+import javax.portlet.Portlet;
+
+import org.apache.jetspeed.portlet.PortletObjectProxy;
+
+/**
+ * JetspeedPortletProxyInstance
+ * 
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id: JetspeedPortletProxyInstance.java 516448 2007-03-09 16:25:47Z ate $
+ *
+ */
+public class JetspeedPortletProxyInstance extends JetspeedPortletInstance
+{
+    public JetspeedPortletProxyInstance(String portletName, Portlet portlet, boolean autoSwitchEditDefaultsModeToEditMode, boolean autoSwitchConfigMode, String customConfigModePortletUniqueName)
+    {
+        super(portletName, (Portlet) PortletObjectProxy.createProxy(portlet, autoSwitchEditDefaultsModeToEditMode, autoSwitchConfigMode, customConfigModePortletUniqueName));
+    }
+}

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

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

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/DomainCriterionResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/HostnameCriterionResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/IPCriterionResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/ProfileResolversImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/ProfileResolversImpl.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/ProfileResolversImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/ProfileResolversImpl.java Fri Dec 12 04:06:29 2008
@@ -1,52 +1,52 @@
-/*
+/*
  * 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.profiler.rules.impl;
-
-import java.io.Serializable;
-import java.util.Map;
-
-import org.apache.jetspeed.profiler.rules.ProfileResolvers;
-import org.apache.jetspeed.profiler.rules.RuleCriterionResolver;
-
-/**
- * Profile Resolvers 
- *
- * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
- * @version $Id: $
- */
-public class ProfileResolversImpl implements ProfileResolvers, Serializable
-{
-    private Map resolvers;
-    
-    public ProfileResolversImpl(Map resolvers)
-    {
-        this.resolvers = resolvers;
-    }
-    
-    public RuleCriterionResolver get(String resolverName)
-    {
-        return (RuleCriterionResolver)resolvers.get(resolverName);
-    }
-    
-    /**
-     * return the map of resolver
-     */
-    public Map getResolvers()
-    {
-    	return resolvers;
-    }
-}
+ * 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.profiler.rules.impl;
+
+import java.io.Serializable;
+import java.util.Map;
+
+import org.apache.jetspeed.profiler.rules.ProfileResolvers;
+import org.apache.jetspeed.profiler.rules.RuleCriterionResolver;
+
+/**
+ * Profile Resolvers 
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public class ProfileResolversImpl implements ProfileResolvers, Serializable
+{
+    private Map resolvers;
+    
+    public ProfileResolversImpl(Map resolvers)
+    {
+        this.resolvers = resolvers;
+    }
+    
+    public RuleCriterionResolver get(String resolverName)
+    {
+        return (RuleCriterionResolver)resolvers.get(resolverName);
+    }
+    
+    /**
+     * return the map of resolver
+     */
+    public Map getResolvers()
+    {
+    	return resolvers;
+    }
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/ProfileResolversImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/RoleComboCriterionResolver.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/RoleComboCriterionResolver.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/RoleComboCriterionResolver.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/RoleComboCriterionResolver.java Fri Dec 12 04:06:29 2008
@@ -1,74 +1,74 @@
-/*
+/*
  * 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.profiler.rules.impl;
-
-import javax.security.auth.Subject;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.jetspeed.profiler.rules.RuleCriterion;
-import org.apache.jetspeed.profiler.rules.RuleCriterionResolver;
-import org.apache.jetspeed.request.RequestContext;
-import org.apache.jetspeed.security.Role;
-
-/**
- * Role combo resolver 
- * Combines all roles into one string
- * Example: roles = a,b,c
- * RoleCombo = a-b-c
- *
- * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
- * @version $Id: RoleCriterionResolver.java 187756 2004-10-15 22:58:43Z ate $
- */
-public class RoleComboCriterionResolver
-    extends StandardResolver
-    implements RuleCriterionResolver
-{
-    protected final static Log log = LogFactory.getLog(UserCriterionResolver.class);
-    
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#resolve(org.apache.jetspeed.request.RequestContext, org.apache.jetspeed.profiler.rules.RuleCriterion)
-     */    
-    public String resolve(RequestContext context, RuleCriterion criterion)
-    {
-        String value = super.resolve(context, criterion);
-        if (value != null)
-        {
-            return value;
-        }
-            
-        Subject subject = context.getSubject();
-        if (subject == null)
-        {
-            String msg = "Invalid (null) Subject in request pipeline";
-            log.error(msg);
-            return null;
-        }
-            
-        return combinePrincipals(context, criterion, subject, Role.class);
-     }
-    
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#isControl()
-     */
-    public boolean isControl(RuleCriterion criterion)
-    {
-        return true;
-    }
-    
-    
-}
+ * 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.profiler.rules.impl;
+
+import javax.security.auth.Subject;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jetspeed.profiler.rules.RuleCriterion;
+import org.apache.jetspeed.profiler.rules.RuleCriterionResolver;
+import org.apache.jetspeed.request.RequestContext;
+import org.apache.jetspeed.security.Role;
+
+/**
+ * Role combo resolver 
+ * Combines all roles into one string
+ * Example: roles = a,b,c
+ * RoleCombo = a-b-c
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: RoleCriterionResolver.java 187756 2004-10-15 22:58:43Z ate $
+ */
+public class RoleComboCriterionResolver
+    extends StandardResolver
+    implements RuleCriterionResolver
+{
+    protected final static Log log = LogFactory.getLog(UserCriterionResolver.class);
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#resolve(org.apache.jetspeed.request.RequestContext, org.apache.jetspeed.profiler.rules.RuleCriterion)
+     */    
+    public String resolve(RequestContext context, RuleCriterion criterion)
+    {
+        String value = super.resolve(context, criterion);
+        if (value != null)
+        {
+            return value;
+        }
+            
+        Subject subject = context.getSubject();
+        if (subject == null)
+        {
+            String msg = "Invalid (null) Subject in request pipeline";
+            log.error(msg);
+            return null;
+        }
+            
+        return combinePrincipals(context, criterion, subject, Role.class);
+     }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#isControl()
+     */
+    public boolean isControl(RuleCriterion criterion)
+    {
+        return true;
+    }
+    
+    
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/RoleComboCriterionResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/SessionResolver.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/SessionResolver.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/SessionResolver.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/SessionResolver.java Fri Dec 12 04:06:29 2008
@@ -1,44 +1,44 @@
-/*
+/*
  * 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.profiler.rules.impl;
-
-import org.apache.jetspeed.profiler.rules.RuleCriterion;
-import org.apache.jetspeed.profiler.rules.RuleCriterionResolver;
-import org.apache.jetspeed.request.RequestContext;
-
-/**
- * SessionResolver
- *
- * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
- * @version $Id: $
- */
-public class SessionResolver extends StandardResolver implements RuleCriterionResolver
-{
-    /* (non-Javadoc)
-     * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#resolve(org.apache.jetspeed.request.RequestContext, org.apache.jetspeed.profiler.rules.RuleCriterion)
-     */
-    public String resolve(RequestContext context, RuleCriterion criterion)
-    {
-        String value = (String)context.getSessionAttribute(criterion.getName());
-        if (value == null)
-        {
-            value = criterion.getValue();
-        }
-        return value;            
-    }
-
-}
+ * 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.profiler.rules.impl;
+
+import org.apache.jetspeed.profiler.rules.RuleCriterion;
+import org.apache.jetspeed.profiler.rules.RuleCriterionResolver;
+import org.apache.jetspeed.request.RequestContext;
+
+/**
+ * SessionResolver
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: $
+ */
+public class SessionResolver extends StandardResolver implements RuleCriterionResolver
+{
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.profiler.rules.RuleCriterionResolver#resolve(org.apache.jetspeed.request.RequestContext, org.apache.jetspeed.profiler.rules.RuleCriterion)
+     */
+    public String resolve(RequestContext context, RuleCriterion criterion)
+    {
+        String value = (String)context.getSessionAttribute(criterion.getName());
+        if (value == null)
+        {
+            value = criterion.getValue();
+        }
+        return value;            
+    }
+
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/profiler/rules/impl/SessionResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/dao/InitablePersistenceBrokerDaoSupport.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/dao/InitablePersistenceBrokerDaoSupport.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/dao/InitablePersistenceBrokerDaoSupport.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/dao/InitablePersistenceBrokerDaoSupport.java Fri Dec 12 04:06:29 2008
@@ -1,73 +1,73 @@
-/*
+/*
  * 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.components.dao;
-
-import java.net.URL;
-
-import org.apache.ojb.broker.metadata.DescriptorRepository;
-import org.apache.ojb.broker.metadata.MetadataManager;
-import org.apache.ojb.broker.metadata.RepositoryPersistor;
-import org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport;
-
-/**
- * <p>
- * InitablePersistenceBrokerDaoSupport
- * </p>
- * <p>
- *
- * </p>
- * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
- * @version $Id: InitablePersistenceBrokerDaoSupport.java 224631 2005-07-24 17:03:46Z taylor $
- *
- */
-public class InitablePersistenceBrokerDaoSupport extends PersistenceBrokerDaoSupport
-{
-
-    protected String repositoryPath;
-    /**
-     * 
-     */
-    public InitablePersistenceBrokerDaoSupport(String repositoryPath)
-    {
-        super();
-        this.repositoryPath = repositoryPath;
-        
-    }
-    
-    
-    /**
-     * 
-     * <p>
-     * init
-     * </p>
-     * Loads the correct repository descriptor for InitablePersistenceBrokerDaoSupport
-     *
-     * @see org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport
-     * @throws Exception
-     */
-    public void init() throws Exception
-    {
-        MetadataManager metaManager = MetadataManager.getInstance();
-        RepositoryPersistor persistor = new RepositoryPersistor();
-        URL descriptorUrl = getClass().getClassLoader().getResource(repositoryPath);
-
-        logger.info("Merging OJB respository "+descriptorUrl+" for DAO class "+getClass().getName());
-        DescriptorRepository repo = persistor.readDescriptorRepository(descriptorUrl.openStream());
-        metaManager.mergeDescriptorRepository(repo);
-    }
-
-}
+ * 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.components.dao;
+
+import java.net.URL;
+
+import org.apache.ojb.broker.metadata.DescriptorRepository;
+import org.apache.ojb.broker.metadata.MetadataManager;
+import org.apache.ojb.broker.metadata.RepositoryPersistor;
+import org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport;
+
+/**
+ * <p>
+ * InitablePersistenceBrokerDaoSupport
+ * </p>
+ * <p>
+ *
+ * </p>
+ * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
+ * @version $Id: InitablePersistenceBrokerDaoSupport.java 224631 2005-07-24 17:03:46Z taylor $
+ *
+ */
+public class InitablePersistenceBrokerDaoSupport extends PersistenceBrokerDaoSupport
+{
+
+    protected String repositoryPath;
+    /**
+     * 
+     */
+    public InitablePersistenceBrokerDaoSupport(String repositoryPath)
+    {
+        super();
+        this.repositoryPath = repositoryPath;
+        
+    }
+    
+    
+    /**
+     * 
+     * <p>
+     * init
+     * </p>
+     * Loads the correct repository descriptor for InitablePersistenceBrokerDaoSupport
+     *
+     * @see org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport
+     * @throws Exception
+     */
+    public void init() throws Exception
+    {
+        MetadataManager metaManager = MetadataManager.getInstance();
+        RepositoryPersistor persistor = new RepositoryPersistor();
+        URL descriptorUrl = getClass().getClassLoader().getResource(repositoryPath);
+
+        logger.info("Merging OJB respository "+descriptorUrl+" for DAO class "+getClass().getName());
+        DescriptorRepository repo = persistor.readDescriptorRepository(descriptorUrl.openStream());
+        metaManager.mergeDescriptorRepository(repo);
+    }
+
+}

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

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

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/SpringJNDIStarter.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/SpringJNDIStarter.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/SpringJNDIStarter.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/jndi/SpringJNDIStarter.java Fri Dec 12 04:06:29 2008
@@ -1,167 +1,167 @@
-/*
+/*
  * 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.components.jndi;
-
-/**
- * <p>
- * Helper class to establish a jndi based datasource for commandline and maven based applications
- *  
- * </p>
- * 
- * 
- * @
- * @author <a href="mailto:hajo@bluesunrise.com">Hajo Birthelmer</a>
- * @version $ $
- *
- */
-
-
-import java.util.Map;
-
-import org.apache.commons.pool.impl.GenericObjectPool;
-import org.apache.jetspeed.components.SpringComponentManager;
-import org.apache.jetspeed.components.datasource.BoundDBCPDatasourceComponent;
-import org.apache.jetspeed.components.jndi.JNDIComponent;
-import org.apache.jetspeed.components.jndi.TyrexJNDIComponent;
-
-public class SpringJNDIStarter
-{
-
-	   public static final String JNDI_DS_NAME = "jetspeed";
-		public static final String DATASOURCE_DRIVER = "org.apache.jetspeed.database.driver".intern();
-		public static final String DATASOURCE_URL = "org.apache.jetspeed.database.url".intern();
-		public static final String DATASOURCE_USERNAME = "org.apache.jetspeed.database.user".intern();
-		public static final String DATASOURCE_PASSWORD = "org.apache.jetspeed.database.password".intern();
-
-
-		
-		
-		private final Map context;
-	   
-	    protected BoundDBCPDatasourceComponent datasourceComponent;
-	    protected JNDIComponent jndi;
-	    String appRoot = null; 
-	    String[] bootConfig = null;
-        String[] appConfig = null;
-        SpringComponentManager scm = null;
-	
-        
-   /**
-    * 
-    * Create an instance with a given context  and the usual SpringComponent arguments 
-    * @param context
-    * @param appRoot root directory of the application
-    * @param bootConfig (string-)list of files to process on boot
-    * @param appConfig (string-)list of files to process as configuration 
-    */
-        public SpringJNDIStarter(Map context,String appRoot, String[] bootConfig, String[] appConfig)
-	    {
-	    	this.context = context;
-	    	this.appRoot = appRoot;
-	    	this.bootConfig = bootConfig;
-	    	this.appConfig = appConfig;
-	    }
-
-/**
- * The main startup routine.
- * Establishes a JNDI connection based on the following System parameters:
- * <p> org.apache.jetspeed.database.url
- * <p> org.apache.jetspeed.database.driver
- * <p> org.apache.jetspeed.database.user
- * <p> org.apache.jetspeed.database.password
- * @throws Exception
- */
-    public void setUp() throws Exception
-    {
-    	setupJNDI();
-         scm = new SpringComponentManager(null, bootConfig, appConfig,  appRoot, true );
-        }
-
-    public void tearDown() throws Exception
-    {
-    	try
-    	{
-    		datasourceComponent.stop();
-    	}
-    	catch (Exception e)
-    	{
-    		System.out.println("datasourceComponent stop failed with " + e.getLocalizedMessage());
-    		e.printStackTrace();
-    	}
-    	try
-    	{
-    		scm.stop();
-    	}
-    	catch (Exception e)
-    	{
-    		System.out.println("SpringComponentManager stop failed with " + e.getLocalizedMessage());
-    		e.printStackTrace();
-    	}
-    	
-    	try
-    	{
-    		jndi.unbindFromCurrentThread();
-		}
-		catch (Exception e)
-		{
-			System.out.println("JNDI  unbindFromCurrentThread failed with " + e.getLocalizedMessage());
-			e.printStackTrace();
-		}
-    }
-    
-    String getProperty(String name)
-    {
-    	String s = null;
-    	try
-    	{
-    		if (context != null)
-    			s = (String) context.get(name);
-    	}
-    	catch (Exception e)
-    	{
-    		e.printStackTrace();
-    	}
-    	if (s == null)
-    		s = System.getProperty(name);
-    	return s;
-    }
-    
-    
-    public void setupJNDI() throws Exception
-    {
-        jndi = new TyrexJNDIComponent();
-        String url = getProperty("org.apache.jetspeed.database.url");
-        String driver = getProperty("org.apache.jetspeed.database.driver");
-        String user = getProperty("org.apache.jetspeed.database.user");
-        String password = getProperty("org.apache.jetspeed.database.password");
-        datasourceComponent = new BoundDBCPDatasourceComponent(user, password, driver, url, 20, 5000,
-                GenericObjectPool.WHEN_EXHAUSTED_GROW, true, JNDI_DS_NAME, jndi);
-        datasourceComponent.start();
-    }
-
-	public SpringComponentManager getComponentManager()
-	{
-		return scm;
-	}
-
-    public Map getContext()
-    {
-        return context;
-    }
-    
-    
+ * 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.components.jndi;
+
+/**
+ * <p>
+ * Helper class to establish a jndi based datasource for commandline and maven based applications
+ *  
+ * </p>
+ * 
+ * 
+ * @
+ * @author <a href="mailto:hajo@bluesunrise.com">Hajo Birthelmer</a>
+ * @version $ $
+ *
+ */
+
+
+import java.util.Map;
+
+import org.apache.commons.pool.impl.GenericObjectPool;
+import org.apache.jetspeed.components.SpringComponentManager;
+import org.apache.jetspeed.components.datasource.BoundDBCPDatasourceComponent;
+import org.apache.jetspeed.components.jndi.JNDIComponent;
+import org.apache.jetspeed.components.jndi.TyrexJNDIComponent;
+
+public class SpringJNDIStarter
+{
+
+	   public static final String JNDI_DS_NAME = "jetspeed";
+		public static final String DATASOURCE_DRIVER = "org.apache.jetspeed.database.driver".intern();
+		public static final String DATASOURCE_URL = "org.apache.jetspeed.database.url".intern();
+		public static final String DATASOURCE_USERNAME = "org.apache.jetspeed.database.user".intern();
+		public static final String DATASOURCE_PASSWORD = "org.apache.jetspeed.database.password".intern();
+
+
+		
+		
+		private final Map context;
+	   
+	    protected BoundDBCPDatasourceComponent datasourceComponent;
+	    protected JNDIComponent jndi;
+	    String appRoot = null; 
+	    String[] bootConfig = null;
+        String[] appConfig = null;
+        SpringComponentManager scm = null;
+	
+        
+   /**
+    * 
+    * Create an instance with a given context  and the usual SpringComponent arguments 
+    * @param context
+    * @param appRoot root directory of the application
+    * @param bootConfig (string-)list of files to process on boot
+    * @param appConfig (string-)list of files to process as configuration 
+    */
+        public SpringJNDIStarter(Map context,String appRoot, String[] bootConfig, String[] appConfig)
+	    {
+	    	this.context = context;
+	    	this.appRoot = appRoot;
+	    	this.bootConfig = bootConfig;
+	    	this.appConfig = appConfig;
+	    }
+
+/**
+ * The main startup routine.
+ * Establishes a JNDI connection based on the following System parameters:
+ * <p> org.apache.jetspeed.database.url
+ * <p> org.apache.jetspeed.database.driver
+ * <p> org.apache.jetspeed.database.user
+ * <p> org.apache.jetspeed.database.password
+ * @throws Exception
+ */
+    public void setUp() throws Exception
+    {
+    	setupJNDI();
+         scm = new SpringComponentManager(null, bootConfig, appConfig,  appRoot, true );
+        }
+
+    public void tearDown() throws Exception
+    {
+    	try
+    	{
+    		datasourceComponent.stop();
+    	}
+    	catch (Exception e)
+    	{
+    		System.out.println("datasourceComponent stop failed with " + e.getLocalizedMessage());
+    		e.printStackTrace();
+    	}
+    	try
+    	{
+    		scm.stop();
+    	}
+    	catch (Exception e)
+    	{
+    		System.out.println("SpringComponentManager stop failed with " + e.getLocalizedMessage());
+    		e.printStackTrace();
+    	}
+    	
+    	try
+    	{
+    		jndi.unbindFromCurrentThread();
+		}
+		catch (Exception e)
+		{
+			System.out.println("JNDI  unbindFromCurrentThread failed with " + e.getLocalizedMessage());
+			e.printStackTrace();
+		}
+    }
+    
+    String getProperty(String name)
+    {
+    	String s = null;
+    	try
+    	{
+    		if (context != null)
+    			s = (String) context.get(name);
+    	}
+    	catch (Exception e)
+    	{
+    		e.printStackTrace();
+    	}
+    	if (s == null)
+    		s = System.getProperty(name);
+    	return s;
+    }
+    
+    
+    public void setupJNDI() throws Exception
+    {
+        jndi = new TyrexJNDIComponent();
+        String url = getProperty("org.apache.jetspeed.database.url");
+        String driver = getProperty("org.apache.jetspeed.database.driver");
+        String user = getProperty("org.apache.jetspeed.database.user");
+        String password = getProperty("org.apache.jetspeed.database.password");
+        datasourceComponent = new BoundDBCPDatasourceComponent(user, password, driver, url, 20, 5000,
+                GenericObjectPool.WHEN_EXHAUSTED_GROW, true, JNDI_DS_NAME, jndi);
+        datasourceComponent.start();
+    }
+
+	public SpringComponentManager getComponentManager()
+	{
+		return scm;
+	}
+
+    public Map getContext()
+    {
+        return context;
+    }
+    
+    
 }
\ No newline at end of file

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

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/rdbms/ojb/DatabasePlatformConfigurator.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/rdbms/ojb/DatabasePlatformConfigurator.java?rev=725977&r1=725976&r2=725977&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/rdbms/ojb/DatabasePlatformConfigurator.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/rdbms/ojb/DatabasePlatformConfigurator.java Fri Dec 12 04:06:29 2008
@@ -1,163 +1,163 @@
-/*
+/*
  * 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.components.rdbms.ojb;
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.SQLException;
-
-import javax.sql.DataSource;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ojb.broker.PBKey;
-import org.apache.ojb.broker.accesslayer.LookupException;
-import org.apache.ojb.broker.metadata.ConnectionRepository;
-import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
-import org.apache.ojb.broker.metadata.JdbcMetadataUtils;
-import org.apache.ojb.broker.metadata.MetadataManager;
-
-/**
- * Dynamically configures Database Platform for OJB by looking at the connection string
- * and figuring out the OJB platform using an OJB metadata utility
- * Its important to get this right otherwise you will be sending the wrong (most likely HSQL)
- * flavor of SQL statements to the backend database.
- * 
- * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
- * @version $Id: $
- *          
- */
-public class DatabasePlatformConfigurator
-{
-    private static final Log log = LogFactory.getLog(DatabasePlatformConfigurator.class);
-    
-    private DataSource ds;
-    private String jcdAlias;
-    
-    public DatabasePlatformConfigurator(DataSource ds, String jndiName)
-    {
-        this.ds = ds;
-        this.jcdAlias = jndiName;
-    }
-    
-    public void init()
-    throws Exception
-    {
-        ConnectionRepository cr = MetadataManager.getInstance().connectionRepository();
-        JdbcConnectionDescriptor jcd = cr.getDescriptor(new PBKey(jcdAlias));
-        if (jcd == null)
-        {
-            jcd = new JdbcConnectionDescriptor();
-            jcd.setJcdAlias(jcdAlias);
-            cr.addDescriptor(jcd);
-        }
-        
-        JdbcMetadataUtils jdbcMetadataUtils = new JdbcMetadataUtils ();
-        jdbcMetadataUtils.fillJCDFromDataSource(jcd, ds, null, null);
-        String platform = jcd.getDbms();
-        if (JdbcMetadataUtils.PLATFORM_ORACLE.equals(platform)) 
-        {
-            // Postprocess to find Oracle version.
-                platform = updateOraclePlatform (jcd, ds, platform);
-        }
-        // if platform has explicitly been set, the value takes precedence
-        if (platform != null) 
-        {
-            if (!platform.equals(jcd.getDbms())) 
-            {
-                log.warn ("Automatically derived RDBMS platform \"" + jcd.getDbms()
-                          + "\" differs from explicitly set platform \"" + platform + "\""); 
-            }
-            jcd.setDbms(platform);
-        } 
-        else 
-        {
-            platform = jcd.getDbms();
-        }
-        System.out.println("##### platform = " + platform);
-    }
- 
-    /**
-     * @param jcd
-     * @throws LookupException
-     * @throws IllegalAccessException
-     * @throws InstantiationException
-     * throws SQLException
-     */
-    private String updateOraclePlatform(JdbcConnectionDescriptor jcd, DataSource ds, String platform)
-        throws LookupException, IllegalAccessException, InstantiationException, SQLException 
-    {
-        Connection con = null;
-        try 
-        {
-            con = ds.getConnection();
-            DatabaseMetaData metaData = con.getMetaData();
-            int rdbmsVersion = 0;
-            try 
-            {
-                // getDatabaseMajorVersion exists since 1.4, so it may
-                // not be defined for the driver used.
-                rdbmsVersion = metaData.getDatabaseMajorVersion();
-            } 
-            catch (Throwable t) 
-            {
-                String dbVersion = metaData.getDatabaseProductVersion();
-                String relKey = "Release";
-                String major = dbVersion;
-                int startPos = dbVersion.indexOf(relKey);
-                if (startPos < 0)
-                {
-                    log.warn ("Cannot determine Oracle version, no \"Release\" in procuct version: \"" + dbVersion + "\"");
-                    return platform;
-                }
-                startPos += relKey.length();
-                int dotPos = dbVersion.indexOf('.', startPos);
-                if (dotPos > 0) {
-                    major = dbVersion.substring(startPos, dotPos).trim();
-                }
-                try
-                {
-                    rdbmsVersion = Integer.parseInt(major);
-                }
-                catch (NumberFormatException e)
-                {
-                    log.warn ("Cannot determine Oracle version, product version \"" + dbVersion + "\" not layed out as \"... Release N.M.....\"");
-                    return platform;
-                }
-                if (log.isDebugEnabled())
-                {
-                    log.debug ("Extracted Oracle major version " + rdbmsVersion + " from product version \"" + dbVersion + "\"");
-                }
-            }
-            if (rdbmsVersion >= 9) 
-            {
-                jcd.setDbms(JdbcMetadataUtils.PLATFORM_ORACLE9I);
-                return JdbcMetadataUtils.PLATFORM_ORACLE9I;
-            }
-        }
-        finally
-        {
-            if (con != null) 
-            {
-                con.close ();
-            }
-        }
-        return platform;
-    }
-    
-    
+ * 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.components.rdbms.ojb;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+
+import javax.sql.DataSource;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ojb.broker.PBKey;
+import org.apache.ojb.broker.accesslayer.LookupException;
+import org.apache.ojb.broker.metadata.ConnectionRepository;
+import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
+import org.apache.ojb.broker.metadata.JdbcMetadataUtils;
+import org.apache.ojb.broker.metadata.MetadataManager;
+
+/**
+ * Dynamically configures Database Platform for OJB by looking at the connection string
+ * and figuring out the OJB platform using an OJB metadata utility
+ * Its important to get this right otherwise you will be sending the wrong (most likely HSQL)
+ * flavor of SQL statements to the backend database.
+ * 
+ * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
+ * @version $Id: $
+ *          
+ */
+public class DatabasePlatformConfigurator
+{
+    private static final Log log = LogFactory.getLog(DatabasePlatformConfigurator.class);
+    
+    private DataSource ds;
+    private String jcdAlias;
+    
+    public DatabasePlatformConfigurator(DataSource ds, String jndiName)
+    {
+        this.ds = ds;
+        this.jcdAlias = jndiName;
+    }
+    
+    public void init()
+    throws Exception
+    {
+        ConnectionRepository cr = MetadataManager.getInstance().connectionRepository();
+        JdbcConnectionDescriptor jcd = cr.getDescriptor(new PBKey(jcdAlias));
+        if (jcd == null)
+        {
+            jcd = new JdbcConnectionDescriptor();
+            jcd.setJcdAlias(jcdAlias);
+            cr.addDescriptor(jcd);
+        }
+        
+        JdbcMetadataUtils jdbcMetadataUtils = new JdbcMetadataUtils ();
+        jdbcMetadataUtils.fillJCDFromDataSource(jcd, ds, null, null);
+        String platform = jcd.getDbms();
+        if (JdbcMetadataUtils.PLATFORM_ORACLE.equals(platform)) 
+        {
+            // Postprocess to find Oracle version.
+                platform = updateOraclePlatform (jcd, ds, platform);
+        }
+        // if platform has explicitly been set, the value takes precedence
+        if (platform != null) 
+        {
+            if (!platform.equals(jcd.getDbms())) 
+            {
+                log.warn ("Automatically derived RDBMS platform \"" + jcd.getDbms()
+                          + "\" differs from explicitly set platform \"" + platform + "\""); 
+            }
+            jcd.setDbms(platform);
+        } 
+        else 
+        {
+            platform = jcd.getDbms();
+        }
+        System.out.println("##### platform = " + platform);
+    }
+ 
+    /**
+     * @param jcd
+     * @throws LookupException
+     * @throws IllegalAccessException
+     * @throws InstantiationException
+     * throws SQLException
+     */
+    private String updateOraclePlatform(JdbcConnectionDescriptor jcd, DataSource ds, String platform)
+        throws LookupException, IllegalAccessException, InstantiationException, SQLException 
+    {
+        Connection con = null;
+        try 
+        {
+            con = ds.getConnection();
+            DatabaseMetaData metaData = con.getMetaData();
+            int rdbmsVersion = 0;
+            try 
+            {
+                // getDatabaseMajorVersion exists since 1.4, so it may
+                // not be defined for the driver used.
+                rdbmsVersion = metaData.getDatabaseMajorVersion();
+            } 
+            catch (Throwable t) 
+            {
+                String dbVersion = metaData.getDatabaseProductVersion();
+                String relKey = "Release";
+                String major = dbVersion;
+                int startPos = dbVersion.indexOf(relKey);
+                if (startPos < 0)
+                {
+                    log.warn ("Cannot determine Oracle version, no \"Release\" in procuct version: \"" + dbVersion + "\"");
+                    return platform;
+                }
+                startPos += relKey.length();
+                int dotPos = dbVersion.indexOf('.', startPos);
+                if (dotPos > 0) {
+                    major = dbVersion.substring(startPos, dotPos).trim();
+                }
+                try
+                {
+                    rdbmsVersion = Integer.parseInt(major);
+                }
+                catch (NumberFormatException e)
+                {
+                    log.warn ("Cannot determine Oracle version, product version \"" + dbVersion + "\" not layed out as \"... Release N.M.....\"");
+                    return platform;
+                }
+                if (log.isDebugEnabled())
+                {
+                    log.debug ("Extracted Oracle major version " + rdbmsVersion + " from product version \"" + dbVersion + "\"");
+                }
+            }
+            if (rdbmsVersion >= 9) 
+            {
+                jcd.setDbms(JdbcMetadataUtils.PLATFORM_ORACLE9I);
+                return JdbcMetadataUtils.PLATFORM_ORACLE9I;
+            }
+        }
+        finally
+        {
+            if (con != null) 
+            {
+                con.close ();
+            }
+        }
+        return platform;
+    }
+    
+    
 }
\ No newline at end of file

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

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/fast_preferences.xml
------------------------------------------------------------------------------
    svn:eol-style = native

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

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
------------------------------------------------------------------------------
    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