You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by wo...@apache.org on 2008/09/15 11:34:23 UTC

svn commit: r695393 - in /portals/jetspeed-2/portal/branches/security-refactoring/components: jetspeed-security/src/main/java/org/apache/jetspeed/serializer/ jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/ jetspeed-serializer/src/main...

Author: woonsan
Date: Mon Sep 15 02:34:23 2008
New Revision: 695393

URL: http://svn.apache.org/viewvc?rev=695393&view=rev
Log:
Flattening the Principal API.
Implemented basic generic principal importing in the serializer component.
Associations and permissions should be refined more.

Added:
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipal.java   (with props)
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipals.java   (with props)
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSecurityAttributes.java   (with props)
Modified:
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElements.java
    portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java?rev=695393&r1=695392&r2=695393&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java Mon Sep 15 02:34:23 2008
@@ -31,6 +31,9 @@
 import org.apache.jetspeed.security.GroupManager;
 import org.apache.jetspeed.security.JetspeedPermission;
 import org.apache.jetspeed.security.JetspeedPrincipal;
+import org.apache.jetspeed.security.JetspeedPrincipalManager;
+import org.apache.jetspeed.security.JetspeedPrincipalManagerProvider;
+import org.apache.jetspeed.security.JetspeedPrincipalType;
 import org.apache.jetspeed.security.PasswordCredential;
 import org.apache.jetspeed.security.PermissionManager;
 import org.apache.jetspeed.security.Role;
@@ -46,6 +49,7 @@
 import org.apache.jetspeed.serializer.objects.JSNVPElements;
 import org.apache.jetspeed.serializer.objects.JSPermission;
 import org.apache.jetspeed.serializer.objects.JSPermissions;
+import org.apache.jetspeed.serializer.objects.JSPrincipal;
 import org.apache.jetspeed.serializer.objects.JSRole;
 import org.apache.jetspeed.serializer.objects.JSSnapshot;
 import org.apache.jetspeed.serializer.objects.JSUser;
@@ -67,28 +71,64 @@
 
     private static class ImportRefs
     {
+        private HashMap<String, HashMap<String, Principal>> principalMapByType = new HashMap<String, HashMap<String, Principal>>();
         private HashMap<String, Principal> roleMap = new HashMap<String, Principal>();
         private HashMap<String, Principal> groupMap = new HashMap<String, Principal>();
         private HashMap<String, Principal> userMap = new HashMap<String, Principal>();
         private HashMap<String, JSPermission> permissionMap = new HashMap<String, JSPermission>();
+        
+        public ImportRefs()
+        {
+            principalMapByType.put(JetspeedPrincipalType.USER_TYPE_NAME, userMap);
+            principalMapByType.put(JetspeedPrincipalType.GROUP_TYPE_NAME, userMap);
+            principalMapByType.put(JetspeedPrincipalType.ROLE_TYPE_NAME, userMap);
+        }
+        
+        public HashMap<String, Principal> getPrincipalMap(String principalTypeName)
+        {
+            if (principalMapByType.containsKey(principalTypeName))
+            {
+                return principalMapByType.get(principalTypeName);
+            }
+            else
+            {
+                return principalMapByType.put(principalTypeName, new HashMap<String, Principal>());
+            }
+        }
     }
+    
     private static class ExportRefs
     {
+        private HashMap<String, HashMap<String, JSPrincipal>> principalMapByType = new HashMap<String, HashMap<String, JSPrincipal>>();
         private HashMap<String, JSRole> roleMap = new HashMap<String, JSRole>();
         private HashMap<String, JSGroup> groupMap = new HashMap<String, JSGroup>();
         private HashMap<String, JSUser> userMap = new HashMap<String, JSUser>();
         private HashMap<String, JSPermission> permissionMap = new HashMap<String, JSPermission>();
+        
+        public HashMap<String, JSPrincipal> getPrincipalMap(String principalTypeName)
+        {
+            if (principalMapByType.containsKey(principalTypeName))
+            {
+                return principalMapByType.get(principalTypeName);
+            }
+            else
+            {
+                return principalMapByType.put(principalTypeName, new HashMap<String, JSPrincipal>());
+            }
+        }
     }
 
+    protected JetspeedPrincipalManagerProvider principalManagerProvider;
     protected GroupManager groupManager;
     protected RoleManager roleManager;
     protected UserManager userManager;
     protected CredentialPasswordEncoder cpe;
     protected PermissionManager pm;
 
-    public JetspeedSecuritySerializer(GroupManager groupManager, RoleManager roleManager, UserManager userManager,
+    public JetspeedSecuritySerializer(JetspeedPrincipalManagerProvider principalManagerProvider, GroupManager groupManager, RoleManager roleManager, UserManager userManager,
             CredentialPasswordEncoder cpe, PermissionManager pm)
     {
+        this.principalManagerProvider = principalManagerProvider;
         this.groupManager = groupManager;
         this.roleManager = roleManager;
         this.userManager = userManager;
@@ -104,12 +144,14 @@
             {
                 log.info("collecting users/roles/groups");
                 ExportRefs refs = new ExportRefs();
+                // TODO: exporting can be dangerous this time..
+                //exportJetspeedPrincipals(refs, snapshot, settings, log);
                 exportRolesGroupsUsers(refs, snapshot, settings, log);
                 if (isSettingSet(settings, JetspeedSerializer.KEY_PROCESS_PERMISSIONS))
                 {
                     log.info("collecting permissions");
                     // TODO: uncomment and fix after permission refactoring
-//                    exportPermissions(refs, snapshot, settings, log);
+                    //exportPermissions(refs, snapshot, settings, log);
                 }
             }
             catch (SecurityException se)
@@ -125,6 +167,7 @@
         {
             log.info("creating users/roles/groups and permissions");
             ImportRefs refs = new ImportRefs();
+            recreateJetspeedPrincipals(refs, snapshot, settings, log);
             recreateRolesGroupsUsers(refs, snapshot, settings, log);
             if (isSettingSet(settings, JetspeedSerializer.KEY_PROCESS_PERMISSIONS))
             {
@@ -170,6 +213,78 @@
     }
 
     /**
+     * import the Jetspeed principals to the current environment
+     * TODO: how about associations?
+     * 
+     * @throws SerializerException
+     */
+    private void recreateJetspeedPrincipals(ImportRefs refs, JSSnapshot snapshot, Map settings, Log log)
+            throws SerializerException
+    {
+        log.debug("recreateJetspeedPrincipals");
+        
+        Map<String, JetspeedPrincipalType> principalTypeMap = principalManagerProvider.getPrincipalTypeMap();
+        
+        for (JSPrincipal jsPrincipal : snapshot.getJetspeedPrincipals())
+        {
+            try
+            {
+                JetspeedPrincipalType type = principalTypeMap.get(jsPrincipal.getType());
+                JetspeedPrincipalManager principalManager = principalManagerProvider.getManager(type);
+                
+                String name = jsPrincipal.getName();
+                
+                if (!principalManager.principalExists(name))
+                {
+                    JetspeedPrincipal principal = principalManager.newPrincipal(name, jsPrincipal.isMapped());
+                    principal.setEnabled(jsPrincipal.isEnabled());
+                    principalManager.addPrincipal(principal, null);
+                    
+                    boolean updated = false;
+                    
+                    SecurityAttributes secAttrs = principal.getSecurityAttributes();
+                    
+                    for (JSNVPElement elem : jsPrincipal.getSecurityAttributes().getValues())
+                    {
+                        secAttrs.getAttribute(elem.getKey(), true).setStringValue(elem.getValue());
+                        updated = true;
+                    }
+                    
+                    Map<String, SecurityAttributeType> secAttrTypeMap = secAttrs.getSecurityAttributeTypes().getAttributeTypeMap();
+                    
+                    for (JSNVPElement elem : jsPrincipal.getInfoAttributes().getValues())
+                    {
+                        if (secAttrTypeMap.containsKey(elem.getKey()))
+                        {
+                            secAttrs.getAttribute(elem.getKey(), true).setStringValue(elem.getValue());
+                        }
+                        else
+                        {
+                            secAttrs.addNewInfoAttribute(elem.getKey(), SecurityAttributeType.DataType.STRING).setStringValue(elem.getValue());
+                        }
+                        
+                        updated = true;
+                    }
+                    
+                    if (updated)
+                    {
+                        principalManager.updatePrincipal(principal);
+                    }
+                    
+                    refs.getPrincipalMap(type.getName()).put(name, principal);
+                }
+            }
+            catch (Exception e)
+            {
+                throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(new String[] { "JetspeedPrincipal",
+                        e.getMessage() }));
+            }
+        }
+        
+        log.debug("recreateJetspeedPrincipals - done");
+    }
+    
+    /**
      * import the groups, roles and finally the users to the current environment
      * 
      * @throws SerializerException
@@ -483,7 +598,41 @@
         return new String(savedPassword);
     }
 
- 
+    /**
+     * Collect all the principals from the current environment.
+     * 
+     * @throws SerializerException
+     * @throws SecurityException 
+     */
+    private void exportJetspeedPrincipals(ExportRefs refs, JSSnapshot snapshot, Map settings, Log log)
+            throws SerializerException, SecurityException
+    {
+        /** set the security provider info in the snapshot file */
+        snapshot.setEncryption(getEncryptionString());
+        
+        Map<String, JetspeedPrincipalType> principalTypeMap = principalManagerProvider.getPrincipalTypeMap();
+        
+        for (Map.Entry<String, JetspeedPrincipalType> entry : principalTypeMap.entrySet())
+        {
+            JetspeedPrincipalType principalType = entry.getValue();
+            JetspeedPrincipalManager jpm = principalManagerProvider.getManager(principalType);
+            List<? extends JetspeedPrincipal> principals = jpm.getPrincipals("");
+            
+            for (JetspeedPrincipal principal : principals)
+            {
+                Map<String, JSPrincipal> refMap = refs.getPrincipalMap(principal.getType().getName());
+                JSPrincipal _tmpPrincipal = refMap.get(principal.getName());
+                
+                if (_tmpPrincipal == null)
+                {
+                    _tmpPrincipal = createJSPrincipal(principal);
+                    refs.getPrincipalMap(principal.getType().getName()).put(_tmpPrincipal.getName(), _tmpPrincipal);
+                    snapshot.getJetspeedPrincipals().add(_tmpPrincipal);
+                }
+            }
+        }
+    }
+    
     /**
      * Collect all the roles, groups and users from the current environment.
      * Include the current SecurityProvider to understand, whether the password
@@ -647,6 +796,20 @@
     {
         return base.replaceFirst(excess, "").trim();
     }
+    
+    private JSPrincipal createJSPrincipal(JetspeedPrincipal principal)
+    {
+        JSPrincipal _jsPrincipal = new JSPrincipal();
+        _jsPrincipal.setType(principal.getType().getName());
+        _jsPrincipal.setName(principal.getName());
+        _jsPrincipal.setMapped(principal.isMapped());
+        _jsPrincipal.setEnabled(principal.isEnabled());
+        _jsPrincipal.setReadonly(principal.isReadOnly());
+        _jsPrincipal.setRemovable(principal.isRemovable());
+        _jsPrincipal.setSecurityAttributes(principal.getSecurityAttributes().getAttributeMap(SecurityAttribute.JETSPEED_CATEGORY));
+        _jsPrincipal.setInfoAttributes(principal.getSecurityAttributes().getInfoAttributeMap());
+        return _jsPrincipal;
+    }
 
     /**
      * create a serializable wrapper for role

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java?rev=695393&r1=695392&r2=695393&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java Mon Sep 15 02:34:23 2008
@@ -51,14 +51,17 @@
 import org.apache.jetspeed.serializer.objects.JSPermissions;
 import org.apache.jetspeed.serializer.objects.JSPortlet;
 import org.apache.jetspeed.serializer.objects.JSPortlets;
+import org.apache.jetspeed.serializer.objects.JSPrincipal;
 import org.apache.jetspeed.serializer.objects.JSPrincipalRule;
 import org.apache.jetspeed.serializer.objects.JSPrincipalRules;
+import org.apache.jetspeed.serializer.objects.JSPrincipals;
 import org.apache.jetspeed.serializer.objects.JSProfilingRule;
 import org.apache.jetspeed.serializer.objects.JSProfilingRules;
 import org.apache.jetspeed.serializer.objects.JSRole;
 import org.apache.jetspeed.serializer.objects.JSRoles;
 import org.apache.jetspeed.serializer.objects.JSRuleCriterion;
 import org.apache.jetspeed.serializer.objects.JSRuleCriterions;
+import org.apache.jetspeed.serializer.objects.JSSecurityAttributes;
 import org.apache.jetspeed.serializer.objects.JSSnapshot;
 import org.apache.jetspeed.serializer.objects.JSUser;
 import org.apache.jetspeed.serializer.objects.JSUserAttributes;
@@ -173,6 +176,10 @@
 
     protected void setupAliases(XMLBinding binding)
     {
+        binding.setAlias(JSPrincipal.class, "Principal");
+        binding.setAlias(JSPrincipals.class, "Principals");
+        binding.setAlias(JSSecurityAttributes.class, "SecurityAttributes");
+        binding.setAlias(JSSecurityAttributes.class, "InfoAttributes");
         binding.setAlias(JSRole.class, "Role");
         binding.setAlias(JSRoles.class, "Roles");
         binding.setAlias(JSGroup.class, "Group");

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElements.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElements.java?rev=695393&r1=695392&r2=695393&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElements.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSNVPElements.java Mon Sep 15 02:34:23 2008
@@ -33,6 +33,7 @@
 public class JSNVPElements
 {
     private List<JSNVPElement> values = new ArrayList<JSNVPElement>();
+    private String itemElementName = "preference";
 
     public int size()
     {
@@ -43,6 +44,11 @@
     {
     }
     
+    public JSNVPElements(String itemElementName)
+    {
+        this();
+        this.itemElementName = itemElementName;
+    }
  
     public List<JSNVPElement> getValues()
 	{
@@ -53,6 +59,11 @@
     {
     	values.add(element);
     }
+    
+    public String getItemElementName()
+    {
+        return this.itemElementName;
+    }
 
     /***************************************************************************
      * SERIALIZER
@@ -68,7 +79,7 @@
                 JSNVPElements g = (JSNVPElements) o;
                 for (JSNVPElement element : g.values)
                 {
-                    xml.add(element,"preference", JSNVPElement.class);
+                    xml.add(element, g.getItemElementName(), JSNVPElement.class);
                 }
             } catch (Exception e)
             {
@@ -84,7 +95,7 @@
                 JSNVPElements g = (JSNVPElements) o;
                 while (xml.hasNext())
 				{
-					JSNVPElement elem = (JSNVPElement)xml.get("preference",JSNVPElement.class);
+					JSNVPElement elem = (JSNVPElement)xml.get(g.getItemElementName(), JSNVPElement.class);
 					g.add(elem);
 				}
             } catch (Exception e)

Added: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipal.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipal.java?rev=695393&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipal.java (added)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipal.java Mon Sep 15 02:34:23 2008
@@ -0,0 +1,210 @@
+/*
+ * 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.serializer.objects;
+
+import java.util.Map;
+
+import javolution.xml.*;
+import javolution.xml.stream.XMLStreamException;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.jetspeed.security.SecurityAttribute;
+
+/**
+ * Jetspeed Serialized (JS) JetspeedPrincipal
+ * 
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+public class JSPrincipal
+{
+    private String type;
+    private String name;
+    private boolean mapped;
+    private boolean enabled;
+    private boolean readonly;
+    private boolean removable;
+    private JSSecurityAttributes secAttrs = null;
+    private JSSecurityAttributes infoAttrs = null;
+    
+    public JSPrincipal()
+    {
+    }
+
+    /***************************************************************************
+     * SERIALIZER
+     */
+    private static final XMLFormat XML = new XMLFormat(JSPrincipal.class)
+    {
+        public void write(Object o, OutputElement xml) throws XMLStreamException
+        {
+            try
+            {
+                JSPrincipal p = (JSPrincipal) o;
+                xml.addText(p.getName());
+            } 
+            catch (Exception e)
+            {
+                e.printStackTrace();
+            }
+        }
+        
+        public void read(InputElement xml, Object o)
+        {
+            try
+            {
+                JSPrincipal p = (JSPrincipal) o;
+                p.setName(StringEscapeUtils.unescapeHtml(xml.getText().toString()));
+                p.mapped = Boolean.getBoolean(StringEscapeUtils.unescapeHtml(xml.getAttribute("mapped", "false")));
+                p.enabled = Boolean.getBoolean(StringEscapeUtils.unescapeHtml(xml.getAttribute("enabled", "false")));
+                p.readonly = Boolean.getBoolean(StringEscapeUtils.unescapeHtml(xml.getAttribute("readonly", "false")));
+                p.removable = Boolean.getBoolean(StringEscapeUtils.unescapeHtml(xml.getAttribute("removable", "false")));
+                
+                Object o1 = null;
+                while (xml.hasNext())
+                {
+                    o1 = xml.getNext(); // mime
+                    
+                    if (o1 instanceof JSSecurityAttributes)
+                    {
+                        p.secAttrs  = (JSSecurityAttributes) o1;
+                    }
+                }
+            } 
+            catch (Exception e)
+            {
+                e.printStackTrace();
+            }
+        }
+    };
+    
+    /**
+     * @return Returns the type.
+     */
+    public String getType()
+    {
+        return type;
+    }
+
+    /**
+     * @param name The type to set.
+     */
+    public void setType(String type)
+    {
+        this.type = type;
+    }
+
+    /**
+     * @return Returns the name.
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+    /**
+     * @param name The name to set.
+     */
+    public void setName(String name)
+    {
+        this.name = name;
+    }
+
+    public boolean isEnabled()
+    {
+        return enabled;
+    }
+
+    public void setEnabled(boolean enabled)
+    {
+        this.enabled = enabled;
+    }
+
+    public boolean isMapped()
+    {
+        return mapped;
+    }
+
+    public void setMapped(boolean mapped)
+    {
+        this.mapped = mapped;
+    }
+
+    public boolean isReadonly()
+    {
+        return readonly;
+    }
+
+    public void setReadonly(boolean readonly)
+    {
+        this.readonly = readonly;
+    }
+
+    public boolean isRemovable()
+    {
+        return removable;
+    }
+
+    public void setRemovable(boolean removable)
+    {
+        this.removable = removable;
+    }
+    
+    public JSSecurityAttributes getSecurityAttributes()
+    {
+        return this.secAttrs;
+    }
+    
+    public void setSecurityAttributes(JSSecurityAttributes secAttrs)
+    {
+        this.secAttrs = secAttrs;
+    }
+    
+    public void setSecurityAttributes(Map<String, SecurityAttribute> sa)
+    {
+        this.secAttrs = new JSSecurityAttributes();
+        
+        for (Map.Entry<String, SecurityAttribute> e : sa.entrySet())
+        {
+            SecurityAttribute attrib = e.getValue();
+            JSNVPElement element = new JSNVPElement(attrib.getName(), attrib.getStringValue());
+            this.secAttrs.add(element);
+        }
+    }
+
+    public JSSecurityAttributes getInfoAttributes()
+    {
+        return this.infoAttrs;
+    }
+    
+    public void setInfoAttributes(JSSecurityAttributes infoAttrs)
+    {
+        this.infoAttrs = infoAttrs;
+    }
+    
+    public void setInfoAttributes(Map<String, SecurityAttribute> sa)
+    {
+        this.infoAttrs = new JSSecurityAttributes(); 
+        
+        for (Map.Entry<String, SecurityAttribute> e : sa.entrySet())
+        {
+            SecurityAttribute attrib = e.getValue();
+            JSNVPElement element = new JSNVPElement(attrib.getName(), attrib.getStringValue());
+            this.infoAttrs.add(element);
+        }
+    }
+}

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipal.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipal.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipals.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipals.java?rev=695393&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipals.java (added)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipals.java Mon Sep 15 02:34:23 2008
@@ -0,0 +1,31 @@
+/*
+ * 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.serializer.objects;
+
+import java.util.ArrayList;
+
+
+/**
+ * Simple wrapper class for XML serialization
+ * 
+ * @author <a href="mailto:woonsan@apache.org">Woonsan Ko</a>
+ * @version $Id$
+ */
+public class JSPrincipals extends ArrayList<JSPrincipal>
+{
+    private static final long serialVersionUID = -5698435742048612881L;
+}
\ No newline at end of file

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipals.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipals.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSecurityAttributes.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSecurityAttributes.java?rev=695393&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSecurityAttributes.java (added)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSecurityAttributes.java Mon Sep 15 02:34:23 2008
@@ -0,0 +1,27 @@
+/*
+ * 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.serializer.objects;
+
+
+public class JSSecurityAttributes extends JSNVPElements
+{
+    public JSSecurityAttributes()
+    {
+        super("SecurityAttribute");
+    }
+}

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSecurityAttributes.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSecurityAttributes.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java?rev=695393&r1=695392&r2=695393&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java Mon Sep 15 02:34:23 2008
@@ -48,6 +48,8 @@
     private JSClients clients;
 
     private JSCapabilities capabilities;
+    
+    private JSPrincipals jsPrincipals;
 
     private JSRoles roles;
 
@@ -82,6 +84,7 @@
         mediaTypes = new JSMediaTypes();
         clients = new JSClients();
         capabilities = new JSCapabilities();
+        jsPrincipals = new JSPrincipals();
         roles = new JSRoles();
         groups = new JSGroups();
         users = new JSUsers();
@@ -196,6 +199,22 @@
     {
         this.savedVersion = savedVersion;
     }
+    
+    /**
+     * @return Returns the Jetspeed principals.
+     */
+    public JSPrincipals getJetspeedPrincipals()
+    {
+        return jsPrincipals;
+    }
+    
+    /**
+     * @param jsPrincipals The Jetspeed principals to set.
+     */
+    public void setJetspeedPrincipals(JSPrincipals jsPrincipals)
+    {
+        this.jsPrincipals = jsPrincipals;
+    }
 
     /**
      * @return Returns the groups.
@@ -454,6 +473,10 @@
                 {
                     xml.add(g.getClients());
                 }
+                if ( !g.getJetspeedPrincipals().isEmpty() )
+                {
+                    xml.add(g.getJetspeedPrincipals());
+                }
                 if ( !g.getRoles().isEmpty() )
                 {
                     xml.add(g.getRoles());
@@ -528,6 +551,8 @@
                         g.clients = (JSClients) o1;
                     else if (o1 instanceof JSCapabilities)
                         g.capabilities = (JSCapabilities) o1;
+                    else if (o1 instanceof JSPrincipals)
+                        g.jsPrincipals = (JSPrincipals) o1;
                     else if (o1 instanceof JSRoles)
                         g.roles = (JSRoles) o1;
                     else if (o1 instanceof JSGroups)



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