xlawrence    2005/05/30 14:25:39 CEST

  Modified files:
    core/src/java/org/jahia/services/usermanager 
                                                 UserProperties.java 
                                                 UserProperty.java 
  Log:
  Made classes Serializable to prevent NotSerializableException at startup
  
  Revision  Changes    Path
  1.2       +27 -23    
jahia/core/src/java/org/jahia/services/usermanager/UserProperties.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/services/usermanager/UserProperties.java.diff?r1=1.1&r2=1.2&f=h
  1.2       +14 -15    
jahia/core/src/java/org/jahia/services/usermanager/UserProperty.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/services/usermanager/UserProperty.java.diff?r1=1.1&r2=1.2&f=h
  
  
  
  Index: UserProperties.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/services/usermanager/UserProperties.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UserProperties.java       24 Mar 2005 16:28:13 -0000      1.1
  +++ UserProperties.java       30 May 2005 12:25:39 -0000      1.2
  @@ -6,19 +6,21 @@
   import java.util.Iterator;
   import java.util.Enumeration;
   
  +import java.io.Serializable;
  +
   /**
    * This class stores user properties, which are different from regular
    * java.util.Properties because they can also store information about 
read-only
    * state as well as the original provider of the properties.
  + *
    * @author Serge Huber
    */
  -public class UserProperties {
  -
  +public class UserProperties implements Serializable {
  +    
       private Map properties = new HashMap();
  -
  -    public UserProperties () {
  -    }
  -
  +    
  +    public UserProperties() {}
  +    
       /**
        * Copy constructor. All properties copied from will be marked as 
read-write
        * Be very careful when using this method or you will loose readOnly 
tagging
  @@ -30,11 +32,12 @@
           Enumeration sourceNameEnum = properties.propertyNames();
           while (sourceNameEnum.hasMoreElements()) {
               String curSourceName = (String) sourceNameEnum.nextElement();
  -            UserProperty curUserProperty = new UserProperty(curSourceName, 
properties.getProperty(curSourceName), readOnly);
  +            UserProperty curUserProperty = new UserProperty(curSourceName, 
  +                    properties.getProperty(curSourceName), readOnly);
               this.properties.put(curSourceName, curUserProperty);
           }
       }
  -
  +    
       protected UserProperties(UserProperties copy) {
           Iterator entryIter = copy.properties.entrySet().iterator();
           while (entryIter.hasNext()) {
  @@ -43,28 +46,28 @@
               properties.put(curUserProperty.getName(), 
curUserProperty.clone());
           }
       }
  -
  +    
       public Object clone() {
           UserProperties clonedProps = new UserProperties(this);
           return clonedProps;
       }
  -
  +    
       public void putAll(UserProperties ups) {
           properties.putAll(ups.properties);
       }
  -
  +    
       public UserProperty getUserProperty(String name) {
           return (UserProperty) properties.get(name);
       }
  -
  +    
       public void setUserProperty(String name, UserProperty value) {
           properties.put(name, value);
       }
  -
  +    
       public UserProperty removeUserProperty(String name) {
           return (UserProperty) properties.remove(name);
       }
  -
  +    
       /**
        * Tests if a property is read-only.
        * Warning : this method also returns false if the property doesn't 
exist !
  @@ -78,11 +81,11 @@
           }
           return userProperty.isReadOnly();
       }
  -
  +    
       public Iterator propertyNameIterator() {
           return properties.keySet().iterator();
       }
  -
  +    
       public Properties getProperties() {
           Properties propertiesCopy = new Properties();
           Iterator entryIter = properties.entrySet().iterator();
  @@ -93,7 +96,7 @@
           }
           return propertiesCopy;
       }
  -
  +    
       public String getProperty(String name) {
           UserProperty userProperty = (UserProperty) properties.get(name);
           if (userProperty == null) {
  @@ -101,13 +104,14 @@
           }
           return userProperty.getValue();
       }
  -
  +    
       public void setProperty(String name, String value)
  -        throws UserPropertyReadOnlyException {
  +    throws UserPropertyReadOnlyException {
           UserProperty userProperty = (UserProperty) properties.get(name);
           if (userProperty != null) {
               if (userProperty.isReadOnly()) {
  -                throw new UserPropertyReadOnlyException(userProperty, 
"Property " + name + " is readonly");
  +                throw new UserPropertyReadOnlyException(userProperty, 
  +                        "Property " + name + " is readonly");
               }
               userProperty.setValue(value);
           } else {
  @@ -115,14 +119,14 @@
           }
           properties.put(name, userProperty);
       }
  -
  +    
       public String removeProperty(String name)
  -        throws UserPropertyReadOnlyException {
  +    throws UserPropertyReadOnlyException {
           UserProperty userProperty = (UserProperty) properties.get(name);
           if (userProperty != null) {
               if (userProperty.isReadOnly()) {
                   throw new UserPropertyReadOnlyException(userProperty,
  -                    "Property " + name + " is readonly");
  +                        "Property " + name + " is readonly");
               } else {
                   return userProperty.getValue();
               }
  
  
  
  Index: UserProperty.java
  ===================================================================
  RCS file: 
/home/cvs/repository/jahia/core/src/java/org/jahia/services/usermanager/UserProperty.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UserProperty.java 24 Mar 2005 16:28:13 -0000      1.1
  +++ UserProperty.java 30 May 2005 12:25:39 -0000      1.2
  @@ -1,42 +1,41 @@
   package org.jahia.services.usermanager;
   
  -public class UserProperty {
  +import java.io.Serializable;
  +
  +public class UserProperty implements Serializable {
       private String name;
       private String value;
       private boolean readOnly;
  -    public UserProperty () {
  -    }
  -
  +    
       public UserProperty(String name, String value, boolean readOnly) {
           this.name = name;
           this.value = value;
           this.readOnly = readOnly;
       }
  -
  +    
       protected UserProperty(UserProperty copy) {
           this.name = copy.name;
           this.value = copy.value;
           this.readOnly = copy.readOnly;
       }
  -
  +    
       public Object clone() {
           return new UserProperty(this);
       }
  -
  -    public void setValue (String value) {
  +    
  +    public void setValue(String value) {
           this.value = value;
       }
  -
  -    public String getName () {
  +    
  +    public String getName() {
           return name;
       }
  -
  -    public String getValue () {
  +    
  +    public String getValue() {
           return value;
       }
  -
  -    public boolean isReadOnly () {
  +    
  +    public boolean isReadOnly() {
           return readOnly;
       }
  -
   }
  

Reply via email to