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/10/25 00:10:24 UTC
svn commit: r707763 - in /portals/jetspeed-2/portal/trunk/components:
jetspeed-security/src/main/java/org/apache/jetspeed/serializer/
jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/
jetspeed-serializer/src/main/java/org/apache/jetspee...
Author: woonsan
Date: Fri Oct 24 15:10:24 2008
New Revision: 707763
URL: http://svn.apache.org/viewvc?rev=707763&view=rev
Log:
Fixed the serializer components.
Added:
portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipalAssociation.java (with props)
portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipalAssociations.java (with props)
Modified:
portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java
portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java
portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPermission.java
portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipal.java
portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java?rev=707763&r1=707762&r2=707763&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/serializer/JetspeedSecuritySerializer.java Fri Oct 24 15:10:24 2008
@@ -31,17 +31,19 @@
import org.apache.jetspeed.security.GroupManager;
import org.apache.jetspeed.security.JetspeedPermission;
import org.apache.jetspeed.security.JetspeedPrincipal;
+import org.apache.jetspeed.security.JetspeedPrincipalAssociationType;
+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;
import org.apache.jetspeed.security.RoleManager;
+import org.apache.jetspeed.security.SecurityAttribute;
+import org.apache.jetspeed.security.SecurityAttributes;
import org.apache.jetspeed.security.SecurityException;
import org.apache.jetspeed.security.User;
import org.apache.jetspeed.security.UserManager;
-import org.apache.jetspeed.security.SecurityAttribute;
-import org.apache.jetspeed.security.SecurityAttributes;
import org.apache.jetspeed.security.spi.impl.SynchronizationStateAccess;
import org.apache.jetspeed.serializer.objects.JSGroup;
import org.apache.jetspeed.serializer.objects.JSNVPElement;
@@ -49,6 +51,7 @@
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.JSPrincipalAssociation;
import org.apache.jetspeed.serializer.objects.JSRole;
import org.apache.jetspeed.serializer.objects.JSSecurityAttributes;
import org.apache.jetspeed.serializer.objects.JSSnapshot;
@@ -142,9 +145,10 @@
{
try
{
- log.info("collecting users/roles/groups");
+ log.info("collecting principals and principal associations");
ExportRefs refs = new ExportRefs();
exportJetspeedPrincipals(refs, snapshot, settings, log);
+ exportJetspeedPrincipalAssociations(refs, snapshot, settings, log);
if (isSettingSet(settings, JetspeedSerializer.KEY_PROCESS_PERMISSIONS))
{
@@ -163,12 +167,14 @@
{
if (isSettingSet(settings, JetspeedSerializer.KEY_PROCESS_USERS))
{
- log.info("creating users/roles/groups and permissions");
+ log.info("creating principals and permissions");
try
{
SynchronizationStateAccess.setSynchronizing(Boolean.TRUE);
ImportRefs refs = new ImportRefs();
recreateJetspeedPrincipals(refs, snapshot, settings, log);
+ recreateJetspeedPrincipalAssociations(refs, snapshot, settings, log);
+
if (isSettingSet(settings, JetspeedSerializer.KEY_PROCESS_PERMISSIONS))
{
log.info("creating permissions");
@@ -481,27 +487,26 @@
+ e.getLocalizedMessage());
}
- // TODO: private, public credential??
-// // credentials
-// Subject subject = userManager.getSubject(user);
-// List<Credential> listTemp = jsuser.getPrivateCredentials();
-// if ((listTemp != null) && (listTemp.size() > 0))
-// {
-// Iterator<Credential> _itTemp = listTemp.iterator();
-// while (_itTemp.hasNext())
-// {
-// subject.getPrivateCredentials().add(_itTemp.next());
-// }
-// }
-// listTemp = jsuser.getPublicCredentials();
-// if ((listTemp != null) && (listTemp.size() > 0))
-// {
-// Iterator<Credential> _itTemp = listTemp.iterator();
-// while (_itTemp.hasNext())
-// {
-// subject.getPublicCredentials().add(_itTemp.next());
-// }
-// }
+ // credentials
+ Subject subject = userManager.getSubject(user);
+ List<Credential> listTemp = jsuser.getPrivateCredentials();
+ if ((listTemp != null) && (listTemp.size() > 0))
+ {
+ Iterator<Credential> _itTemp = listTemp.iterator();
+ while (_itTemp.hasNext())
+ {
+ subject.getPrivateCredentials().add(_itTemp.next());
+ }
+ }
+ listTemp = jsuser.getPublicCredentials();
+ if ((listTemp != null) && (listTemp.size() > 0))
+ {
+ Iterator<Credential> _itTemp = listTemp.iterator();
+ while (_itTemp.hasNext())
+ {
+ subject.getPublicCredentials().add(_itTemp.next());
+ }
+ }
JSSecurityAttributes attributes = jsuser.getInfoAttributes();
if (attributes != null)
@@ -537,6 +542,38 @@
log.debug("recreateUsers - done");
}
+ private void recreateJetspeedPrincipalAssociations(ImportRefs refs, JSSnapshot snapshot, Map settings, Log log)
+ throws SerializerException
+ {
+ log.debug("recreateJetspeedPrincipalAssociations");
+
+ Map<String, JetspeedPrincipalType> principalTypes = this.principalManagerProvider.getPrincipalTypeMap();
+ JetspeedPrincipalManager principalManager = null;
+ JetspeedPrincipalManager fromPrincipalManager = null;
+ JetspeedPrincipal from = null;
+ JetspeedPrincipal to = null;
+
+ try
+ {
+ for (JSPrincipalAssociation jsAssoc : snapshot.getPrincipalAssociations())
+ {
+ principalManager = this.principalManagerProvider.getManager(principalTypes.get(jsAssoc.getToType()));
+ to = principalManager.getPrincipal(jsAssoc.getToName());
+ fromPrincipalManager = this.principalManagerProvider.getManager(principalTypes.get(jsAssoc.getFromType()));
+ from = fromPrincipalManager.getPrincipal(jsAssoc.getFromName());
+ principalManager.addAssociation(from, to, jsAssoc.getName());
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(new String[] { "User",
+ e.getMessage() }));
+ }
+
+ log.debug("recreateJetspeedPrincipalAssociations - done");
+ }
+
/**
* recreates all permissions from the current snapshot
*
@@ -746,12 +783,52 @@
}
}
+ private void exportJetspeedPrincipalAssociations(ExportRefs refs, JSSnapshot snapshot, Map settings, Log log) throws SecurityException, SerializerException
+ {
+ Map<String, JetspeedPrincipalType> principalTypes = this.principalManagerProvider.getPrincipalTypeMap();
+ Map<String, JetspeedPrincipalType> copiedPrincipalTypes = new HashMap<String, JetspeedPrincipalType>(principalTypes);
+ JetspeedPrincipalManager principalManager = null;
+ JetspeedPrincipalManager otherPrincipalManager = null;
+
+ for (String principalTypeName : principalTypes.keySet())
+ {
+ principalManager = this.principalManagerProvider.getManager(this.principalManagerProvider.getPrincipalType(principalTypeName));
+
+ for (JetspeedPrincipal principal : principalManager.getPrincipals(""))
+ {
+ for (JetspeedPrincipalAssociationType assocType : principalManager.getAssociationTypes())
+ {
+ for (String otherPrincipalTypeName : copiedPrincipalTypes.keySet())
+ {
+ otherPrincipalManager = this.principalManagerProvider.getManager(this.principalManagerProvider.getPrincipalType(otherPrincipalTypeName));
+
+ for (JetspeedPrincipal toPrincipal : otherPrincipalManager.getAssociatedFrom(principal.getName(), principal.getType(), assocType.getAssociationName()))
+ {
+ JSPrincipalAssociation jsAssoc = createJSPrincipalAssociation(assocType, principal, toPrincipal);
+ snapshot.addPrincipalAssociation(jsAssoc);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private JSPrincipalAssociation createJSPrincipalAssociation(JetspeedPrincipalAssociationType assocType, JetspeedPrincipal from, JetspeedPrincipal to)
+ {
+ JSPrincipalAssociation jsAssoc = new JSPrincipalAssociation();
+ jsAssoc.setName(assocType.getAssociationName());
+ jsAssoc.setFromType(from.getType().getName());
+ jsAssoc.setFromName(from.getName());
+ jsAssoc.setToType(to.getType().getName());
+ jsAssoc.setToName(to.getName());
+ return jsAssoc;
+ }
+
/**
* extract all permissions from the current environment
*
* @throws SerializerException
*/
- // TODO: uncomment and fix after permission refactoring
private void exportPermissions(ExportRefs refs, JSSnapshot snapshot, Map settings, Log log) throws SerializerException, SecurityException
{
for (JetspeedPermission perm : pm.getPermissions())
@@ -765,9 +842,9 @@
for (JetspeedPrincipal principal : pm.getPrincipals(perm))
{
- JetspeedPrincipalType principalType = principal.getType();
+ String principalTypeName = principal.getType().getName();
- if (JetspeedPrincipalType.ROLE.equals(principalType))
+ if (JetspeedPrincipalType.ROLE.equals(principalTypeName))
{
JSPrincipal _tempRole = (JSPrincipal) this.getObjectBehindPath(refs.roleMap, principal.getName());
@@ -776,7 +853,7 @@
_js.addRole(_tempRole);
}
}
- else if (JetspeedPrincipalType.GROUP.equals(principalType))
+ else if (JetspeedPrincipalType.GROUP.equals(principalTypeName))
{
JSPrincipal _tempGroup = (JSPrincipal) this.getObjectBehindPath(refs.groupMap, principal.getName());
@@ -785,7 +862,7 @@
_js.addGroup(_tempGroup);
}
}
- else if (JetspeedPrincipalType.USER.equals(principalType))
+ else if (JetspeedPrincipalType.USER.equals(principalTypeName))
{
JSPrincipal _tempUser = (JSPrincipal) this.getObjectBehindPath(refs.userMap, principal.getName());
@@ -795,6 +872,8 @@
}
}
}
+
+ snapshot.getPermissions().add(_js);
}
catch (Exception e)
{
@@ -837,7 +916,39 @@
return base.replaceFirst(excess, "").trim();
}
- private JSPrincipal createJSPrincipal(JetspeedPrincipal principal)
+ /**
+ * Add the credentials to the JSUser object.
+ * <p>
+ * If the credential provided is a PasswordCredential, userid and password
+ * are extracted and set explcitely
+ *
+ * @param isPublic
+ * public or private credential
+ * @param newUser
+ * the JS user object reference
+ * @param credential
+ * the credential object
+ */
+
+ private void addJSPrincipalCredentials(boolean isPublic, JSPrincipal newPrincipal, Credential credential)
+ {
+ if (credential == null)
+ return;
+ if (credential instanceof PasswordCredential)
+ {
+ PasswordCredential pw = (PasswordCredential) credential;
+ char [] pwdChars = (pw.getPassword() != null ? pw.getPassword().toCharArray() : null);
+ newPrincipal.setCredential(pw.getUserName(), pwdChars, pw.getExpirationDate(), pw.isEnabled(),
+ pw.isExpired(), pw.isUpdateRequired());
+ return;
+ }
+ else if (isPublic)
+ newPrincipal.addPublicCredential(credential);
+ else
+ newPrincipal.addPrivateCredential(credential);
+ }
+
+ private JSPrincipal createJSPrincipal(JetspeedPrincipal principal) throws SecurityException
{
JSPrincipal _jsPrincipal = new JSPrincipal();
_jsPrincipal.setPrincipal(principal);
@@ -847,7 +958,32 @@
_jsPrincipal.setEnabled(principal.isEnabled());
_jsPrincipal.setReadonly(principal.isReadOnly());
_jsPrincipal.setRemovable(principal.isRemovable());
+
+ if (JetspeedPrincipalType.USER.equals(principal.getType()))
+ {
+ Credential credential = userManager.getPasswordCredential((User) principal);
+ Subject subject = userManager.getSubject((User) principal);
+
+ if (credential != null)
+ {
+ addJSPrincipalCredentials(true, _jsPrincipal, credential);
+ }
+
+ for (Object o : subject.getPublicCredentials())
+ {
+ credential = (Credential)o;
+ addJSPrincipalCredentials(true, _jsPrincipal, credential);
+ }
+
+ for (Object o : subject.getPrivateCredentials())
+ {
+ credential = (Credential)o;
+ addJSPrincipalCredentials(false, _jsPrincipal, credential);
+ }
+ }
+
_jsPrincipal.setSecurityAttributes(principal.getSecurityAttributes().getAttributeMap());
+
return _jsPrincipal;
}
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java?rev=707763&r1=707762&r2=707763&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/JetspeedSerializerImpl.java Fri Oct 24 15:10:24 2008
@@ -52,6 +52,8 @@
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.JSPrincipalAssociation;
+import org.apache.jetspeed.serializer.objects.JSPrincipalAssociations;
import org.apache.jetspeed.serializer.objects.JSPrincipalRule;
import org.apache.jetspeed.serializer.objects.JSPrincipalRules;
import org.apache.jetspeed.serializer.objects.JSPrincipals;
@@ -177,6 +179,8 @@
protected void setupAliases(XMLBinding binding)
{
binding.setAlias(JSPrincipals.class, "Principals");
+ binding.setAlias(JSPrincipalAssociations.class, "PrincipalAssociations");
+ binding.setAlias(JSPrincipalAssociation.class, "PrincipalAssociation");
binding.setAlias(JSRole.class, "Role");
binding.setAlias(JSRoles.class, "Roles");
binding.setAlias(JSGroup.class, "Group");
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPermission.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPermission.java?rev=707763&r1=707762&r2=707763&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPermission.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPermission.java Fri Oct 24 15:10:24 2008
@@ -16,9 +16,8 @@
*/
package org.apache.jetspeed.serializer.objects;
-import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
+import java.util.ArrayList;
import javolution.xml.XMLFormat;
import javolution.xml.stream.XMLStreamException;
@@ -75,49 +74,24 @@
{
}
- private String append(JSRole rule)
- {
- return rule.getName();
- }
-
- private String append(JSGroup group)
- {
- return group.getName();
- }
-
- private String append(JSUser user)
- {
- return user.getName();
- }
-
- private String append(Object s)
- {
- if (s instanceof JSRole)
- return append((JSRole) s);
- if (s instanceof JSGroup)
- return append((JSGroup) s);
- if (s instanceof JSUser)
- return append((JSUser) s);
-
- return s.toString();
- }
-
private String putTokens(List<JSPrincipal> _list)
{
if ((_list == null) || (_list.size() == 0))
return "";
+
boolean _start = true;
- Iterator _it = _list.iterator();
StringBuffer _sb = new StringBuffer();
- while (_it.hasNext())
+
+ for (JSPrincipal jsPrincipal : _list)
{
if (!_start)
_sb.append(',');
else
_start = false;
- _sb.append(append(_it.next()));
+ _sb.append(jsPrincipal.getName());
}
+
return _sb.toString();
}
@@ -150,7 +124,7 @@
* @param groups
* The groups to set.
*/
- public void setGroups(ArrayList groups)
+ public void setGroups(List<JSPrincipal> groups)
{
this.groups = groups;
}
@@ -218,7 +192,7 @@
* @param users
* The users to set.
*/
- public void setUsers(ArrayList users)
+ public void setUsers(List<JSPrincipal> users)
{
this.users = users;
}
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipal.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipal.java?rev=707763&r1=707762&r2=707763&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipal.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipal.java Fri Oct 24 15:10:24 2008
@@ -18,6 +18,7 @@
import java.security.Principal;
import java.sql.Date;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -331,4 +332,52 @@
{
this.rules = rules;
}
+
+ /**
+ * @return Returns the privateCredentials.
+ */
+ public List<Credential> getPrivateCredentials()
+ {
+ return privateCredentials;
+ }
+
+ /**
+ * @param privateCredentials
+ * The privateCredentials to set.
+ */
+ public void setPrivateCredentials(List<Credential> privateCredentials)
+ {
+ this.privateCredentials = privateCredentials;
+ }
+
+ /**
+ * @return Returns the publicCredentials.
+ */
+ public List<Credential> getPublicCredentials()
+ {
+ return publicCredentials;
+ }
+
+ /**
+ * @param publicCredentials
+ * The publicCredentials to set.
+ */
+ public void setPublicCredentials(List<Credential> publicCredentials)
+ {
+ this.publicCredentials = publicCredentials;
+ }
+
+ public void addPublicCredential(Credential o)
+ {
+ if (publicCredentials == null)
+ publicCredentials = new ArrayList<Credential>();
+ publicCredentials.add(o);
+ }
+
+ public void addPrivateCredential(Credential o)
+ {
+ if (privateCredentials == null)
+ privateCredentials = new ArrayList<Credential>();
+ privateCredentials.add(o);
+ }
}
\ No newline at end of file
Added: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipalAssociation.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipalAssociation.java?rev=707763&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipalAssociation.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipalAssociation.java Fri Oct 24 15:10:24 2008
@@ -0,0 +1,125 @@
+/*
+ * 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 javolution.xml.XMLFormat;
+import javolution.xml.stream.XMLStreamException;
+
+public class JSPrincipalAssociation
+{
+ private static final long serialVersionUID = -7954617309602239376L;
+
+ private String name;
+ private String fromName;
+ private String fromType;
+ private String toName;
+ private String toType;
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return this.name;
+ }
+
+ public void setFromName(String fromName)
+ {
+ this.fromName = fromName;
+ }
+
+ public String getFromName()
+ {
+ return this.fromName;
+ }
+
+ public void setFromType(String fromType)
+ {
+ this.fromType = fromType;
+ }
+
+ public String getFromType()
+ {
+ return this.fromType;
+ }
+
+ public void setToName(String toName)
+ {
+ this.toName = toName;
+ }
+
+ public String getToName()
+ {
+ return this.toName;
+ }
+
+ public void setToType(String toType)
+ {
+ this.toType = toType;
+ }
+
+ public String getToType()
+ {
+ return this.toType;
+ }
+
+ /***************************************************************************
+ * SERIALIZER
+ */
+ private static final XMLFormat XML = new XMLFormat(JSPrincipalAssociation.class)
+ {
+
+ public void write(Object o, OutputElement xml)
+ throws XMLStreamException
+ {
+ try
+ {
+ JSPrincipalAssociation g = (JSPrincipalAssociation) o;
+ xml.setAttribute("name", g.getName());
+ xml.setAttribute("fromName", g.getFromName());
+ xml.setAttribute("fromType", g.getFromType());
+ xml.setAttribute("toName", g.getToName());
+ xml.setAttribute("toType", g.getToType());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void read(InputElement xml, Object o)
+ {
+ try
+ {
+ JSPrincipalAssociation g = (JSPrincipalAssociation) o;
+ g.setName(xml.getAttribute("name").toString());
+ g.setFromName(xml.getAttribute("fromName", ""));
+ g.setFromType(xml.getAttribute("fromType", ""));
+ g.setToName(xml.getAttribute("toName", ""));
+ g.setToType(xml.getAttribute("toType", ""));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ };
+
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipalAssociation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipalAssociation.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipalAssociations.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipalAssociations.java?rev=707763&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipalAssociations.java (added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipalAssociations.java Fri Oct 24 15:10:24 2008
@@ -0,0 +1,25 @@
+/*
+ * 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;
+
+
+public class JSPrincipalAssociations extends ArrayList<JSPrincipalAssociation>
+{
+ private static final long serialVersionUID = -7954617309602239376L;
+}
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipalAssociations.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSPrincipalAssociations.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java?rev=707763&r1=707762&r2=707763&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-serializer/src/main/java/org/apache/jetspeed/serializer/objects/JSSnapshot.java Fri Oct 24 15:10:24 2008
@@ -61,6 +61,8 @@
private JSPrincipals users;
private JSUsers oldUsers;
+
+ private JSPrincipalAssociations principalAssociations;
private JSPermissions permissions;
@@ -95,6 +97,7 @@
oldGroups = new JSGroups();
users = new JSPrincipals(JetspeedPrincipalType.USER);
oldUsers = new JSUsers();
+ principalAssociations = new JSPrincipalAssociations();
permissions = new JSPermissions();
rules = new JSProfilingRules();
applications = new JSApplications();
@@ -290,6 +293,21 @@
{
return oldUsers;
}
+
+ public void setPrincipalAssociations(JSPrincipalAssociations principalAssociations)
+ {
+ this.principalAssociations = principalAssociations;
+ }
+
+ public JSPrincipalAssociations getPrincipalAssociations()
+ {
+ return this.principalAssociations;
+ }
+
+ public void addPrincipalAssociation(JSPrincipalAssociation jsPrincipalAssociation)
+ {
+ this.principalAssociations.add(jsPrincipalAssociation);
+ }
/**
* @return Returns the encryption.
@@ -530,6 +548,10 @@
{
xml.add(g.getUsers());
}
+ if ( !g.getPrincipalAssociations().isEmpty() )
+ {
+ xml.add(g.getPrincipalAssociations());
+ }
if ( !g.getPermissions().isEmpty() )
{
xml.add(g.getPermissions());
@@ -616,6 +638,8 @@
g.users = jsps;
}
}
+ else if (o1 instanceof JSPrincipalAssociations)
+ g.principalAssociations = (JSPrincipalAssociations) o1;
else if (o1 instanceof JSPermissions)
g.permissions = (JSPermissions) o1;
else if (o1 instanceof JSProfilingRules)
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org