syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1607378 [1/2] - in /syncope/trunk: ./ core/ core/src/main/java/org/apache/syncope/core/connid/ core/src/main/java/org/apache/syncope/core/init/ core/src/main/java/org/apache/syncope/core/persistence/beans/ core/src/main/java/org/apache/syn...
Date Wed, 02 Jul 2014 14:37:24 GMT
Author: ilgrosso
Date: Wed Jul  2 14:37:23 2014
New Revision: 1607378

URL: http://svn.apache.org/r1607378
Log:
[SYNCOPE-524] Implementation provided, all code updated

Added:
    syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributeDeserializer.java   (with props)
    syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributeSerializer.java   (with props)
    syncope/trunk/core/src/main/java/org/apache/syncope/core/util/GuardedStringDeserializer.java   (with props)
    syncope/trunk/core/src/main/java/org/apache/syncope/core/util/GuardedStringSerializer.java   (with props)
    syncope/trunk/core/src/main/java/org/apache/syncope/core/util/POJOHelper.java   (with props)
    syncope/trunk/core/src/main/java/org/apache/syncope/core/util/SyncTokenDeserializer.java   (with props)
Removed:
    syncope/trunk/core/src/main/java/org/apache/syncope/core/init/ContentUpgrader.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/util/GuardedStringConverter.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/util/XMLSerializer.java
Modified:
    syncope/trunk/core/pom.xml
    syncope/trunk/core/src/main/java/org/apache/syncope/core/connid/ConnObjectUtil.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/connid/PasswordGenerator.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/init/SpringContextInitializer.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/ConnInstance.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/ExternalResource.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Policy.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/PropagationTask.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/PushPolicy.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/ReportletConfInstance.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/SyncTask.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/PolicyValidator.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/PolicyEvaluator.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/ConnectorFacadeProxy.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/PolicyDataBinder.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ResourceDataBinder.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncProfile.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncUtilities.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSubjectSyncResultHandler.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncJob.java
    syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncopeResultHandler.java
    syncope/trunk/core/src/main/resources/syncopeContext.xml
    syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/PolicyTest.java
    syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
    syncope/trunk/core/src/test/resources/content.xml
    syncope/trunk/pom.xml

Modified: syncope/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/pom.xml?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/pom.xml (original)
+++ syncope/trunk/core/pom.xml Wed Jul  2 14:37:23 2014
@@ -182,11 +182,6 @@ under the License.
     </dependency>
 
     <dependency>
-      <groupId>com.thoughtworks.xstream</groupId>
-      <artifactId>xstream</artifactId>
-    </dependency>
-
-    <dependency>
       <groupId>org.apache.velocity</groupId>
       <artifactId>velocity</artifactId>
     </dependency>

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/connid/ConnObjectUtil.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/connid/ConnObjectUtil.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/connid/ConnObjectUtil.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/connid/ConnObjectUtil.java Wed Jul  2 14:37:23 2014
@@ -165,25 +165,25 @@ public class ConnObjectUtil {
             List<PasswordPolicySpec> ppSpecs = new ArrayList<PasswordPolicySpec>();
 
             PasswordPolicy globalPP = policyDAO.getGlobalPasswordPolicy();
-            if (globalPP != null && globalPP.getSpecification() != null) {
-                ppSpecs.add(globalPP.<PasswordPolicySpec>getSpecification());
+            if (globalPP != null && globalPP.getSpecification(PasswordPolicySpec.class) != null) {
+                ppSpecs.add(globalPP.getSpecification(PasswordPolicySpec.class));
             }
 
             for (MembershipTO memb : userTO.getMemberships()) {
                 SyncopeRole role = roleDAO.find(memb.getRoleId());
                 if (role != null && role.getPasswordPolicy() != null
-                        && role.getPasswordPolicy().getSpecification() != null) {
+                        && role.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) {
 
-                    ppSpecs.add(role.getPasswordPolicy().<PasswordPolicySpec>getSpecification());
+                    ppSpecs.add(role.getPasswordPolicy().getSpecification(PasswordPolicySpec.class));
                 }
             }
 
             for (String resName : userTO.getResources()) {
                 ExternalResource resource = resourceDAO.find(resName);
                 if (resource != null && resource.getPasswordPolicy() != null
-                        && resource.getPasswordPolicy().getSpecification() != null) {
+                        && resource.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) {
 
-                    ppSpecs.add(resource.getPasswordPolicy().<PasswordPolicySpec>getSpecification());
+                    ppSpecs.add(resource.getPasswordPolicy().getSpecification(PasswordPolicySpec.class));
                 }
             }
 

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/connid/PasswordGenerator.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/connid/PasswordGenerator.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/connid/PasswordGenerator.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/connid/PasswordGenerator.java Wed Jul  2 14:37:23 2014
@@ -42,7 +42,7 @@ import org.springframework.stereotype.Co
 @Component
 public class PasswordGenerator {
 
-    private static final char[] SPECIAL_CHARS = {'!', '£', '%', '&', '(', ')', '?', '#', '$'};
+    private static final char[] SPECIAL_CHARS = { '!', '£', '%', '&', '(', ')', '?', '#', '$' };
 
     @Autowired
     private PolicyDAO policyDAO;
@@ -63,19 +63,23 @@ public class PasswordGenerator {
         List<PasswordPolicySpec> ppSpecs = new ArrayList<PasswordPolicySpec>();
 
         PasswordPolicy globalPP = policyDAO.getGlobalPasswordPolicy();
-        if (globalPP != null && globalPP.getSpecification() != null) {
-            ppSpecs.add(globalPP.<PasswordPolicySpec>getSpecification());
+        if (globalPP != null && globalPP.getSpecification(PasswordPolicySpec.class) != null) {
+            ppSpecs.add(globalPP.getSpecification(PasswordPolicySpec.class));
         }
 
         for (SyncopeRole role : user.getRoles()) {
-            if (role.getPasswordPolicy() != null && role.getPasswordPolicy().getSpecification() != null) {
-                ppSpecs.add(role.getPasswordPolicy().<PasswordPolicySpec>getSpecification());
+            if (role.getPasswordPolicy() != null
+                    && role.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) {
+
+                ppSpecs.add(role.getPasswordPolicy().getSpecification(PasswordPolicySpec.class));
             }
         }
 
         for (ExternalResource resource : user.getResources()) {
-            if (resource.getPasswordPolicy() != null && resource.getPasswordPolicy().getSpecification() != null) {
-                ppSpecs.add(resource.getPasswordPolicy().<PasswordPolicySpec>getSpecification());
+            if (resource.getPasswordPolicy() != null
+                    && resource.getPasswordPolicy().getSpecification(PasswordPolicySpec.class) != null) {
+
+                ppSpecs.add(resource.getPasswordPolicy().getSpecification(PasswordPolicySpec.class));
             }
         }
 
@@ -296,8 +300,8 @@ public class PasswordGenerator {
         if (policySpec.isNonAlphanumericRequired()
                 && !PolicyPattern.NON_ALPHANUMERIC.matcher(StringUtils.join(generatedPassword)).matches()) {
 
-            generatedPassword[firstEmptyChar(generatedPassword)] = 
-                SecureRandomUtil.generateRandomSpecialCharacter(SPECIAL_CHARS);
+            generatedPassword[firstEmptyChar(generatedPassword)] =
+                    SecureRandomUtil.generateRandomSpecialCharacter(SPECIAL_CHARS);
         }
     }
 
@@ -314,5 +318,5 @@ public class PasswordGenerator {
             }
         }
     }
-    
+
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/init/SpringContextInitializer.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/init/SpringContextInitializer.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/init/SpringContextInitializer.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/init/SpringContextInitializer.java Wed Jul  2 14:37:23 2014
@@ -33,9 +33,6 @@ import org.springframework.stereotype.Co
 public class SpringContextInitializer implements InitializingBean {
 
     @Autowired
-    private ContentUpgrader contentUpgrader;
-
-    @Autowired
     private ConnectorFactory connFactory;
 
     @Autowired
@@ -53,18 +50,8 @@ public class SpringContextInitializer im
     @Autowired
     private WorkflowAdapterLoader workflowAdapterLoader;
 
-    private boolean upgrade = false;
-
-    public void setUpgrade(final boolean upgrade) {
-        this.upgrade = upgrade;
-    }
-
     @Override
     public void afterPropertiesSet() throws Exception {
-        if (upgrade) {
-            contentUpgrader.upgrade();
-        }
-
         workflowAdapterLoader.load();
         contentLoader.load();
         connFactory.load();

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/ConnInstance.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/ConnInstance.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/ConnInstance.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/ConnInstance.java Wed Jul  2 14:37:23 2014
@@ -19,6 +19,7 @@
 package org.apache.syncope.core.persistence.beans;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
@@ -33,10 +34,11 @@ import javax.persistence.FetchType;
 import javax.persistence.Id;
 import javax.persistence.Lob;
 import javax.persistence.OneToMany;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.types.ConnConfProperty;
 import org.apache.syncope.common.types.ConnectorCapability;
 import org.apache.syncope.core.persistence.validation.entity.ConnInstanceCheck;
-import org.apache.syncope.core.util.XMLSerializer;
+import org.apache.syncope.core.util.POJOHelper;
 
 @Entity
 @ConnInstanceCheck
@@ -153,15 +155,14 @@ public class ConnInstance extends Abstra
     }
 
     public Set<ConnConfProperty> getConfiguration() {
-        Set<ConnConfProperty> result = XMLSerializer.<HashSet<ConnConfProperty>>deserialize(xmlConfiguration);
-        if (result == null) {
-            result = Collections.emptySet();
-        }
-        return result;
+        return StringUtils.isBlank(xmlConfiguration)
+                ? Collections.<ConnConfProperty>emptySet()
+                : new HashSet<ConnConfProperty>(
+                        Arrays.asList(POJOHelper.deserialize(xmlConfiguration, ConnConfProperty[].class)));
     }
 
     public void setConfiguration(final Set<ConnConfProperty> configuration) {
-        xmlConfiguration = XMLSerializer.serialize(new HashSet<ConnConfProperty>(configuration));
+        xmlConfiguration = POJOHelper.serialize(new HashSet<ConnConfProperty>(configuration));
     }
 
     public Long getId() {

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/ExternalResource.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/ExternalResource.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/ExternalResource.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/ExternalResource.java Wed Jul  2 14:37:23 2014
@@ -19,6 +19,7 @@
 package org.apache.syncope.core.persistence.beans;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
@@ -45,7 +46,7 @@ import org.apache.syncope.common.types.T
 import org.apache.syncope.core.persistence.beans.role.RMapping;
 import org.apache.syncope.core.persistence.beans.user.UMapping;
 import org.apache.syncope.core.persistence.validation.entity.ExternalResourceCheck;
-import org.apache.syncope.core.util.XMLSerializer;
+import org.apache.syncope.core.util.POJOHelper;
 import org.identityconnectors.framework.common.objects.SyncToken;
 
 /**
@@ -328,19 +329,14 @@ public class ExternalResource extends Ab
     }
 
     public Set<ConnConfProperty> getConnInstanceConfiguration() {
-        Set<ConnConfProperty> result = null;
-        if (StringUtils.isNotBlank(xmlConfiguration)) {
-            result = XMLSerializer.<HashSet<ConnConfProperty>>deserialize(xmlConfiguration);
-        }
-        if (result == null) {
-            result = Collections.emptySet();
-        }
-
-        return result;
+        return StringUtils.isBlank(xmlConfiguration)
+                ? Collections.<ConnConfProperty>emptySet()
+                : new HashSet<ConnConfProperty>(
+                        Arrays.asList(POJOHelper.deserialize(xmlConfiguration, ConnConfProperty[].class)));
     }
 
     public void setConnInstanceConfiguration(final Set<ConnConfProperty> properties) {
-        xmlConfiguration = XMLSerializer.serialize(new HashSet<ConnConfProperty>(properties));
+        xmlConfiguration = POJOHelper.serialize(new HashSet<ConnConfProperty>(properties));
     }
 
     public String getUserializedSyncToken() {
@@ -350,15 +346,11 @@ public class ExternalResource extends Ab
     public SyncToken getUsyncToken() {
         return userializedSyncToken == null
                 ? null
-                : XMLSerializer.<SyncToken>deserialize(userializedSyncToken);
-    }
-
-    public void setUserializedSyncToken(final String serializedSyncToken) {
-        this.userializedSyncToken = serializedSyncToken;
+                : POJOHelper.deserialize(userializedSyncToken, SyncToken.class);
     }
 
     public void setUsyncToken(final SyncToken syncToken) {
-        this.userializedSyncToken = XMLSerializer.serialize(syncToken);
+        this.userializedSyncToken = syncToken == null ? null : POJOHelper.serialize(syncToken);
     }
 
     public String getRserializedSyncToken() {
@@ -368,15 +360,11 @@ public class ExternalResource extends Ab
     public SyncToken getRsyncToken() {
         return rserializedSyncToken == null
                 ? null
-                : XMLSerializer.<SyncToken>deserialize(rserializedSyncToken);
-    }
-
-    public void setRserializedSyncToken(final String serializedSyncToken) {
-        this.rserializedSyncToken = serializedSyncToken;
+                : POJOHelper.deserialize(rserializedSyncToken, SyncToken.class);
     }
 
     public void setRsyncToken(final SyncToken syncToken) {
-        this.rserializedSyncToken = XMLSerializer.serialize(syncToken);
+        this.rserializedSyncToken = syncToken == null ? null : POJOHelper.serialize(syncToken);
     }
 
     public List<String> getPropagationActionsClassNames() {

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Policy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Policy.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Policy.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/Policy.java Wed Jul  2 14:37:23 2014
@@ -29,7 +29,7 @@ import javax.validation.constraints.NotN
 import org.apache.syncope.common.types.AbstractPolicySpec;
 import org.apache.syncope.common.types.PolicyType;
 import org.apache.syncope.core.persistence.validation.entity.PolicyCheck;
-import org.apache.syncope.core.util.XMLSerializer;
+import org.apache.syncope.core.util.POJOHelper;
 
 @Entity
 @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@@ -67,11 +67,12 @@ public abstract class Policy extends Abs
         return type;
     }
 
-    public <T extends AbstractPolicySpec> T getSpecification() {
-        return XMLSerializer.<T>deserialize(specification);
+    @SuppressWarnings("unchecked")
+    public <T extends AbstractPolicySpec> T getSpecification(final Class<T> reference) {
+        return POJOHelper.deserialize(specification, reference);
     }
 
     public <T extends AbstractPolicySpec> void setSpecification(final T policy) {
-        this.specification = XMLSerializer.serialize(policy);
+        this.specification = POJOHelper.serialize(policy);
     }
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/PropagationTask.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/PropagationTask.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/PropagationTask.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/PropagationTask.java Wed Jul  2 14:37:23 2014
@@ -18,18 +18,21 @@
  */
 package org.apache.syncope.core.persistence.beans;
 
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
 import java.util.Set;
-
 import javax.persistence.Entity;
 import javax.persistence.EnumType;
 import javax.persistence.Enumerated;
 import javax.persistence.Lob;
 import javax.persistence.ManyToOne;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.syncope.common.types.AttributableType;
 import org.apache.syncope.common.types.PropagationMode;
 import org.apache.syncope.common.types.ResourceOperation;
 import org.apache.syncope.core.persistence.validation.entity.PropagationTaskCheck;
-import org.apache.syncope.core.util.XMLSerializer;
+import org.apache.syncope.core.util.POJOHelper;
 import org.identityconnectors.framework.common.objects.Attribute;
 
 /**
@@ -86,7 +89,7 @@ public class PropagationTask extends Tas
         return accountId;
     }
 
-    public void setAccountId(String accountId) {
+    public void setAccountId(final String accountId) {
         this.accountId = accountId;
     }
 
@@ -94,23 +97,26 @@ public class PropagationTask extends Tas
         return oldAccountId;
     }
 
-    public void setOldAccountId(String oldAccountId) {
+    public void setOldAccountId(final String oldAccountId) {
         this.oldAccountId = oldAccountId;
     }
 
     public Set<Attribute> getAttributes() {
-        return XMLSerializer.<Set<Attribute>>deserialize(xmlAttributes);
+        return StringUtils.isBlank(xmlAttributes)
+                ? Collections.<Attribute>emptySet()
+                : new HashSet<Attribute>(
+                        Arrays.asList(POJOHelper.deserialize(xmlAttributes, Attribute[].class)));
     }
 
     public void setAttributes(final Set<Attribute> attributes) {
-        xmlAttributes = XMLSerializer.serialize(attributes);
+        xmlAttributes = POJOHelper.serialize(attributes);
     }
 
     public PropagationMode getPropagationMode() {
         return propagationMode;
     }
 
-    public void setPropagationMode(PropagationMode propagationMode) {
+    public void setPropagationMode(final PropagationMode propagationMode) {
         this.propagationMode = propagationMode;
     }
 
@@ -118,8 +124,7 @@ public class PropagationTask extends Tas
         return propagationOperation;
     }
 
-    public void setPropagationOperation(ResourceOperation propagationOperation) {
-
+    public void setPropagationOperation(final ResourceOperation propagationOperation) {
         this.propagationOperation = propagationOperation;
     }
 
@@ -127,7 +132,7 @@ public class PropagationTask extends Tas
         return resource;
     }
 
-    public void setResource(ExternalResource resource) {
+    public void setResource(final ExternalResource resource) {
         this.resource = resource;
     }
 
@@ -135,7 +140,7 @@ public class PropagationTask extends Tas
         return objectClassName;
     }
 
-    public void setObjectClassName(String objectClassName) {
+    public void setObjectClassName(final String objectClassName) {
         this.objectClassName = objectClassName;
     }
 
@@ -143,7 +148,7 @@ public class PropagationTask extends Tas
         return subjectType;
     }
 
-    public void setSubjectType(AttributableType subjectType) {
+    public void setSubjectType(final AttributableType subjectType) {
         this.subjectType = subjectType;
     }
 
@@ -151,7 +156,7 @@ public class PropagationTask extends Tas
         return subjectId;
     }
 
-    public void setSubjectId(Long subjectId) {
+    public void setSubjectId(final Long subjectId) {
         this.subjectId = subjectId;
     }
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/PushPolicy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/PushPolicy.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/PushPolicy.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/PushPolicy.java Wed Jul  2 14:37:23 2014
@@ -37,4 +37,5 @@ public class PushPolicy extends Policy {
                 ? PolicyType.GLOBAL_PUSH
                 : PolicyType.PUSH;
     }
+
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/ReportletConfInstance.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/ReportletConfInstance.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/ReportletConfInstance.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/ReportletConfInstance.java Wed Jul  2 14:37:23 2014
@@ -24,7 +24,7 @@ import javax.persistence.Lob;
 import javax.persistence.ManyToOne;
 
 import org.apache.syncope.common.report.ReportletConf;
-import org.apache.syncope.core.util.XMLSerializer;
+import org.apache.syncope.core.util.POJOHelper;
 
 @Entity
 public class ReportletConfInstance extends AbstractBaseBean {
@@ -55,12 +55,12 @@ public class ReportletConfInstance exten
     public ReportletConf getInstance() {
         return serializedInstance == null
                 ? null
-                : XMLSerializer.<ReportletConf> deserialize(serializedInstance);
+                : POJOHelper.deserialize(serializedInstance, ReportletConf.class);
     }
 
     public void setInstance(final ReportletConf instance) {
         this.serializedInstance = instance == null
                 ? null
-                : XMLSerializer.serialize(instance);
+                : POJOHelper.serialize(instance);
     }
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/SyncTask.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/SyncTask.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/SyncTask.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/beans/SyncTask.java Wed Jul  2 14:37:23 2014
@@ -28,7 +28,7 @@ import org.apache.syncope.common.to.User
 import org.apache.syncope.common.types.MatchingRule;
 import org.apache.syncope.common.types.UnmatchingRule;
 import org.apache.syncope.core.sync.impl.SyncJob;
-import org.apache.syncope.core.util.XMLSerializer;
+import org.apache.syncope.core.util.POJOHelper;
 
 @Entity
 public class SyncTask extends AbstractSyncTask {
@@ -60,21 +60,21 @@ public class SyncTask extends AbstractSy
     public UserTO getUserTemplate() {
         return userTemplate == null
                 ? new UserTO()
-                : XMLSerializer.<UserTO>deserialize(userTemplate);
+                : POJOHelper.deserialize(userTemplate, UserTO.class);
     }
 
     public void setUserTemplate(final UserTO userTemplate) {
-        this.userTemplate = XMLSerializer.serialize(userTemplate);
+        this.userTemplate = POJOHelper.serialize(userTemplate);
     }
 
     public RoleTO getRoleTemplate() {
         return userTemplate == null
                 ? new RoleTO()
-                : XMLSerializer.<RoleTO>deserialize(roleTemplate);
+                : POJOHelper.deserialize(roleTemplate, RoleTO.class);
     }
 
     public void setRoleTemplate(final RoleTO roleTemplate) {
-        this.roleTemplate = XMLSerializer.serialize(roleTemplate);
+        this.roleTemplate = POJOHelper.serialize(roleTemplate);
     }
 
     public boolean isFullReconciliation() {

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/PolicyValidator.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/PolicyValidator.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/PolicyValidator.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/persistence/validation/entity/PolicyValidator.java Wed Jul  2 14:37:23 2014
@@ -27,26 +27,23 @@ import org.apache.syncope.core.persisten
 import org.apache.syncope.core.persistence.beans.PasswordPolicy;
 import org.apache.syncope.core.persistence.beans.Policy;
 import org.apache.syncope.core.persistence.beans.SyncPolicy;
-import org.apache.syncope.core.persistence.dao.PolicyDAO;
-import org.springframework.beans.factory.annotation.Autowired;
 
 public class PolicyValidator extends AbstractValidator<PolicyCheck, Policy> {
 
-    @Autowired
-    private PolicyDAO policyDAO;
-
     @Override
     public boolean isValid(final Policy object, final ConstraintValidatorContext context) {
         context.disableDefaultConstraintViolation();
 
-        if (object.getSpecification() != null
-                && ((object instanceof PasswordPolicy && !(object.getSpecification() instanceof PasswordPolicySpec))
-                || ((object instanceof AccountPolicy && !(object.getSpecification() instanceof AccountPolicySpec)))
-                || ((object instanceof SyncPolicy && !(object.getSpecification() instanceof SyncPolicySpec))))) {
-
-            context.buildConstraintViolationWithTemplate(
-                    getTemplate(EntityViolationType.valueOf("Invalid" + object.getClass().getSimpleName()),
-                            "Invalid policy specification")).addPropertyNode("specification").
+        if (((object instanceof PasswordPolicy
+                && !(object.getSpecification(PasswordPolicySpec.class) instanceof PasswordPolicySpec))
+                || ((object instanceof AccountPolicy
+                && !(object.getSpecification(AccountPolicySpec.class) instanceof AccountPolicySpec)))
+                || ((object instanceof SyncPolicy
+                && !(object.getSpecification(SyncPolicySpec.class) instanceof SyncPolicySpec))))) {
+
+            context.buildConstraintViolationWithTemplate(getTemplate(
+                    EntityViolationType.valueOf("Invalid" + object.getClass().getSimpleName()),
+                    "Invalid policy specification")).addPropertyNode("specification").
                     addConstraintViolation();
 
             return false;

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/PolicyEvaluator.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/PolicyEvaluator.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/PolicyEvaluator.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/policy/PolicyEvaluator.java Wed Jul  2 14:37:23 2014
@@ -49,7 +49,7 @@ public class PolicyEvaluator {
         switch (policy.getType()) {
             case PASSWORD:
             case GLOBAL_PASSWORD:
-                final PasswordPolicySpec ppSpec = policy.getSpecification();
+                final PasswordPolicySpec ppSpec = policy.getSpecification(PasswordPolicySpec.class);
                 final PasswordPolicySpec evaluatedPPSpec = new PasswordPolicySpec();
 
                 BeanUtils.copyProperties(ppSpec, evaluatedPPSpec, new String[]{"schemasNotPermitted"});
@@ -80,7 +80,7 @@ public class PolicyEvaluator {
                 break;
             case ACCOUNT:
             case GLOBAL_ACCOUNT:
-                final AccountPolicySpec spec = policy.getSpecification();
+                final AccountPolicySpec spec = policy.getSpecification(AccountPolicySpec.class);
                 final AccountPolicySpec accountPolicy = new AccountPolicySpec();
 
                 BeanUtils.copyProperties(spec, accountPolicy, new String[]{"schemasNotPermitted"});

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/ConnectorFacadeProxy.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/ConnectorFacadeProxy.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/ConnectorFacadeProxy.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/propagation/impl/ConnectorFacadeProxy.java Wed Jul  2 14:37:23 2014
@@ -517,7 +517,6 @@ public class ConnectorFacadeProxy implem
 
         if (activeConnInstance.getCapabilities().contains(ConnectorCapability.SEARCH)) {
             connector.search(objectClass, filter, handler, options);
-
         } else {
             LOG.info("Search was attempted, although the connector only has these capabilities: {}. No action.",
                     activeConnInstance.getCapabilities());

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/PolicyDataBinder.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/PolicyDataBinder.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/PolicyDataBinder.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/PolicyDataBinder.java Wed Jul  2 14:37:23 2014
@@ -86,35 +86,22 @@ public class PolicyDataBinder {
         switch (policy.getType()) {
             case GLOBAL_PASSWORD:
             case PASSWORD:
-                if (!(policy.getSpecification() instanceof PasswordPolicySpec)) {
-                    throw new ClassCastException("Expected " + PasswordPolicySpec.class.getName()
-                            + ", found " + policy.getSpecification().getClass().getName());
-                }
                 policyTO = (T) new PasswordPolicyTO(isGlobal);
-                ((PasswordPolicyTO) policyTO).setSpecification((PasswordPolicySpec) policy.getSpecification());
+                ((PasswordPolicyTO) policyTO).setSpecification(policy.getSpecification(PasswordPolicySpec.class));
                 break;
 
             case GLOBAL_ACCOUNT:
             case ACCOUNT:
-                if (!(policy.getSpecification() instanceof AccountPolicySpec)) {
-                    throw new ClassCastException("Expected " + AccountPolicySpec.class.getName()
-                            + ", found " + policy.getSpecification().getClass().getName());
-                }
                 policyTO = (T) new AccountPolicyTO(isGlobal);
-                ((AccountPolicyTO) policyTO).setSpecification((AccountPolicySpec) policy.getSpecification());
+                ((AccountPolicyTO) policyTO).setSpecification(policy.getSpecification(AccountPolicySpec.class));
                 ((AccountPolicyTO) policyTO).getResources().addAll(((AccountPolicy) policy).getResourceNames());
                 break;
 
             case GLOBAL_SYNC:
             case SYNC:
             default:
-                if (!(policy.getSpecification() instanceof SyncPolicySpec)) {
-                    throw new ClassCastException("Expected " + SyncPolicySpec.class.getName()
-                            + ", found " + policy.getSpecification().getClass().getName());
-
-                }
                 policyTO = (T) new SyncPolicyTO(isGlobal);
-                ((SyncPolicyTO) policyTO).setSpecification((SyncPolicySpec) policy.getSpecification());
+                ((SyncPolicyTO) policyTO).setSpecification(policy.getSpecification(SyncPolicySpec.class));
         }
 
         policyTO.setId(policy.getId());

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ResourceDataBinder.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ResourceDataBinder.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ResourceDataBinder.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ResourceDataBinder.java Wed Jul  2 14:37:23 2014
@@ -135,10 +135,10 @@ public class ResourceDataBinder {
         resource.setConnInstanceConfiguration(new HashSet<ConnConfProperty>(resourceTO.getConnConfProperties()));
 
         if (resourceTO.getUsyncToken() == null) {
-            resource.setUserializedSyncToken(null);
+            resource.setUsyncToken(null);
         }
         if (resourceTO.getRsyncToken() == null) {
-            resource.setRserializedSyncToken(null);
+            resource.setRsyncToken(null);
         }
 
         resource.getPropagationActionsClassNames().clear();

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/UserDataBinder.java Wed Jul  2 14:37:23 2014
@@ -202,8 +202,8 @@ public class UserDataBinder extends Abst
 
         int passwordHistorySize = 0;
         PasswordPolicy policy = policyDAO.getGlobalPasswordPolicy();
-        if (policy != null && policy.getSpecification() != null) {
-            passwordHistorySize = policy.<PasswordPolicySpec>getSpecification().getHistoryLength();
+        if (policy != null && policy.getSpecification(PasswordPolicySpec.class) != null) {
+            passwordHistorySize = policy.getSpecification(PasswordPolicySpec.class).getHistoryLength();
         }
 
         try {

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncProfile.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncProfile.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncProfile.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncProfile.java Wed Jul  2 14:37:23 2014
@@ -29,7 +29,9 @@ public class SyncProfile<T extends Abstr
     /**
      * Syncing connector.
      */
-    private Connector connector;
+    private final Connector connector;
+
+    private final T syncTask;
 
     private Collection<SyncResult> results;
 
@@ -39,8 +41,6 @@ public class SyncProfile<T extends Abstr
 
     private List<A> actions;
 
-    private T syncTask;
-
     public SyncProfile(final Connector connector, final T syncTask) {
         this.connector = connector;
         this.syncTask = syncTask;
@@ -50,6 +50,10 @@ public class SyncProfile<T extends Abstr
         return connector;
     }
 
+    public T getSyncTask() {
+        return syncTask;
+    }
+
     public Collection<SyncResult> getResults() {
         return results;
     }
@@ -78,12 +82,7 @@ public class SyncProfile<T extends Abstr
         return actions;
     }
 
-    public void setActions(
-            List<A> actions) {
+    public void setActions(final List<A> actions) {
         this.actions = actions;
     }
-
-    public T getSyncTask() {
-        return syncTask;
-    }
 }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncUtilities.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncUtilities.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncUtilities.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncUtilities.java Wed Jul  2 14:37:23 2014
@@ -116,7 +116,7 @@ public class SyncUtilities {
 
         final List<ConnectorObject> found = connector.search(oclass,
                 new EqualsFilter(new Name(name)), connector.getOperationOptions(
-                attrUtil.getMappingItems(resource, MappingPurpose.SYNCHRONIZATION)));
+                        attrUtil.getMappingItems(resource, MappingPurpose.SYNCHRONIZATION)));
 
         if (found.isEmpty()) {
             LOG.debug("No {} found on {} with __NAME__ {}", oclass, resource, name);
@@ -267,8 +267,8 @@ public class SyncUtilities {
             SearchCond nodeCond;
             // users: just id or username can be selected to be used
             // roles: just id or name can be selected to be used
-            if ("id".equalsIgnoreCase(schema) || "username".equalsIgnoreCase(schema)
-                    || "name".equalsIgnoreCase(schema)) {
+            if ("id".equalsIgnoreCase(schema)
+                    || "username".equalsIgnoreCase(schema) || "name".equalsIgnoreCase(schema)) {
 
                 SubjectCond cond = new SubjectCond();
                 cond.setSchema(schema);
@@ -298,6 +298,7 @@ public class SyncUtilities {
      *
      * @param uid for finding by account id
      * @param connObj for finding by attribute value
+     * @param resource external resource
      * @param attrUtil attributable util
      * @return list of matching users / roles
      */
@@ -311,10 +312,10 @@ public class SyncUtilities {
         if (resource.getSyncPolicy() == null) {
             SyncPolicy globalSP = policyDAO.getGlobalSyncPolicy();
             if (globalSP != null) {
-                syncPolicySpec = globalSP.<SyncPolicySpec>getSpecification();
+                syncPolicySpec = globalSP.getSpecification(SyncPolicySpec.class);
             }
         } else {
-            syncPolicySpec = resource.getSyncPolicy().<SyncPolicySpec>getSpecification();
+            syncPolicySpec = resource.getSyncPolicy().getSpecification(SyncPolicySpec.class);
         }
 
         SyncCorrelationRule syncRule = null;

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSubjectSyncResultHandler.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSubjectSyncResultHandler.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSubjectSyncResultHandler.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSubjectSyncResultHandler.java Wed Jul  2 14:37:23 2014
@@ -61,36 +61,24 @@ public abstract class AbstractSubjectSyn
 
     protected abstract AttributableUtil getAttributableUtil();
 
-    protected abstract String getName(
-            final AbstractSubjectTO subjectTO);
+    protected abstract String getName(AbstractSubjectTO subjectTO);
 
-    protected abstract AbstractSubjectTO getSubjectTO(
-            final long id);
+    protected abstract AbstractSubjectTO getSubjectTO(long id);
 
-    protected abstract AbstractSubjectMod getSubjectMod(
-            final AbstractSubjectTO subjectTO, final SyncDelta delta);
+    protected abstract AbstractSubjectMod getSubjectMod(AbstractSubjectTO subjectTO, SyncDelta delta);
 
-    protected abstract AbstractSubjectTO create(
-            final AbstractSubjectTO subjectTO,
-            final SyncDelta _delta,
-            final SyncResult result);
+    protected abstract AbstractSubjectTO create(AbstractSubjectTO subjectTO, SyncDelta _delta, SyncResult result);
 
-    protected abstract AbstractSubjectTO link(
-            final AbstractSubjectTO before,
-            final SyncResult result,
-            final boolean unlink)
+    protected abstract AbstractSubjectTO link(AbstractSubjectTO before, SyncResult result, boolean unlink)
             throws Exception;
 
-    protected abstract AbstractSubjectTO update(
-            final AbstractSubjectTO before,
-            final AbstractSubjectMod subjectMod,
-            final SyncDelta delta,
-            final SyncResult result)
+    protected abstract AbstractSubjectTO update(AbstractSubjectTO before, AbstractSubjectMod subjectMod,
+            SyncDelta delta, SyncResult result)
             throws Exception;
 
-    protected abstract void deprovision(final Long id, final boolean unlink) throws Exception;
+    protected abstract void deprovision(Long id, boolean unlink) throws Exception;
 
-    protected abstract void delete(final Long id);
+    protected abstract void delete(Long id);
 
     @Override
     public boolean handle(final SyncDelta delta) {

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncJob.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncJob.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncJob.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncJob.java Wed Jul  2 14:37:23 2014
@@ -319,7 +319,7 @@ public abstract class AbstractSyncJob<T 
             } catch (Exception e) {
                 final String msg = String.
                         format("Connector instance bean for resource %s and connInstance %s not found",
-                        syncTask.getResource(), syncTask.getResource().getConnector());
+                                syncTask.getResource(), syncTask.getResource().getConnector());
 
                 throw new JobExecutionException(msg, e);
             }
@@ -378,13 +378,13 @@ public abstract class AbstractSyncJob<T 
                     ? policyDAO.getGlobalSyncPolicy()
                     : syncTask.getResource().getSyncPolicy();
 
-            syncPolicySpec = syncPolicy == null ? null : (SyncPolicySpec) syncPolicy.getSpecification();
+            syncPolicySpec = syncPolicy == null ? null : syncPolicy.getSpecification(SyncPolicySpec.class);
         } else if (syncTask instanceof PushTask) {
             final PushPolicy pushPolicy = syncTask.getResource().getPushPolicy() == null
                     ? policyDAO.getGlobalPushPolicy()
                     : syncTask.getResource().getPushPolicy();
 
-            syncPolicySpec = pushPolicy == null ? null : (SyncPolicySpec) pushPolicy.getSpecification();
+            syncPolicySpec = pushPolicy == null ? null : pushPolicy.getSpecification(SyncPolicySpec.class);
         } else {
             syncPolicySpec = null;
         }

Modified: syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncopeResultHandler.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncopeResultHandler.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncopeResultHandler.java (original)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/impl/AbstractSyncopeResultHandler.java Wed Jul  2 14:37:23 2014
@@ -76,7 +76,7 @@ public abstract class AbstractSyncopeRes
      */
     @Autowired
     protected PropagationManager propagationManager;
-    
+
     /**
      * task executor.
      */
@@ -100,8 +100,7 @@ public abstract class AbstractSyncopeRes
      */
     protected SyncProfile<T, A> profile;
 
-    public void setProfile(
-            SyncProfile<T, A> profile) {
+    public void setProfile(final SyncProfile<T, A> profile) {
         this.profile = profile;
     }
 

Added: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributeDeserializer.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributeDeserializer.java?rev=1607378&view=auto
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributeDeserializer.java (added)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributeDeserializer.java Wed Jul  2 14:37:23 2014
@@ -0,0 +1,84 @@
+/*
+ * 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.syncope.core.util;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import org.apache.commons.lang3.StringUtils;
+import org.identityconnectors.common.Base64;
+import org.identityconnectors.common.security.GuardedString;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.AttributeBuilder;
+import org.identityconnectors.framework.common.objects.Name;
+import org.identityconnectors.framework.common.objects.Uid;
+
+class AttributeDeserializer extends JsonDeserializer<Attribute> {
+
+    @Override
+    public Attribute deserialize(final JsonParser jp, final DeserializationContext ctx)
+            throws IOException, JsonProcessingException {
+
+        ObjectNode tree = jp.readValueAsTree();
+
+        String name = tree.get("name").asText();
+
+        List<Object> values = new ArrayList<Object>();
+        for (Iterator<JsonNode> itor = tree.get("value").iterator(); itor.hasNext();) {
+            JsonNode node = itor.next();
+            if (node.isNull()) {
+                values.add(null);
+            } else if (node.isObject()) {
+                values.add(((ObjectNode) node).traverse(jp.getCodec()).readValueAs(GuardedString.class));
+            } else if (node.isBoolean()) {
+                values.add(node.asBoolean());
+            } else if (node.isDouble()) {
+                values.add(node.asDouble());
+            } else if (node.isLong()) {
+                values.add(node.asLong());
+            } else if (node.isInt()) {
+                values.add(node.asInt());
+            } else {
+                String text = node.asText();
+                if (text.startsWith(AttributeSerializer.BYTE_ARRAY_PREFIX)
+                        && text.endsWith(AttributeSerializer.BYTE_ARRAY_SUFFIX)) {
+
+                    values.add(Base64.decode(StringUtils.substringBetween(
+                            text, AttributeSerializer.BYTE_ARRAY_PREFIX, AttributeSerializer.BYTE_ARRAY_SUFFIX)));
+                } else {
+                    values.add(text);
+                }
+            }
+        }
+
+        return Uid.NAME.equals(name)
+                ? new Uid(values.isEmpty() || values.get(0) == null ? null : values.get(0).toString())
+                : Name.NAME.equals(name)
+                ? new Name(values.isEmpty() || values.get(0) == null ? null : values.get(0).toString())
+                : AttributeBuilder.build(name, values);
+    }
+
+}

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributeDeserializer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributeDeserializer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributeDeserializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributeSerializer.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributeSerializer.java?rev=1607378&view=auto
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributeSerializer.java (added)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributeSerializer.java Wed Jul  2 14:37:23 2014
@@ -0,0 +1,78 @@
+/*
+ * 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.syncope.core.util;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import java.io.IOException;
+import org.identityconnectors.common.Base64;
+import org.identityconnectors.common.security.GuardedString;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+class AttributeSerializer extends JsonSerializer<Attribute> {
+
+    private static final Logger LOG = LoggerFactory.getLogger(AttributeSerializer.class);
+
+    public static final String BYTE_ARRAY_PREFIX = "<binary>";
+
+    public static final String BYTE_ARRAY_SUFFIX = "</binary>";
+
+    @Override
+    public void serialize(final Attribute source, final JsonGenerator jgen, final SerializerProvider sp)
+            throws IOException, JsonProcessingException {
+
+        jgen.writeStartObject();
+
+        jgen.writeStringField("name", source.getName());
+
+        jgen.writeFieldName("value");
+        if (source.getValue() == null) {
+            jgen.writeNull();
+        } else {
+            jgen.writeStartArray();
+            for (Object value : source.getValue()) {
+                if (value == null) {
+                    jgen.writeNull();
+                } else if (value instanceof GuardedString) {
+                    jgen.writeObject(value);
+                } else if (value instanceof Integer) {
+                    jgen.writeNumber((Integer) value);
+                } else if (value instanceof Long) {
+                    jgen.writeNumber((Long) value);
+                } else if (value instanceof Double) {
+                    jgen.writeNumber((Double) value);
+                } else if (value instanceof Boolean) {
+                    jgen.writeBoolean((Boolean) value);
+                } else if (value instanceof byte[]) {
+                    jgen.writeString(BYTE_ARRAY_PREFIX + Base64.encode((byte[]) value) + BYTE_ARRAY_SUFFIX);
+                } else {
+                    jgen.writeString(value.toString());
+                }
+            }
+            jgen.writeEndArray();
+        }
+
+        jgen.writeEndObject();
+    }
+
+}

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributeSerializer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributeSerializer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/AttributeSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/GuardedStringDeserializer.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/GuardedStringDeserializer.java?rev=1607378&view=auto
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/util/GuardedStringDeserializer.java (added)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/util/GuardedStringDeserializer.java Wed Jul  2 14:37:23 2014
@@ -0,0 +1,94 @@
+/*
+ * 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.syncope.core.util;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import org.identityconnectors.common.Base64;
+import org.identityconnectors.common.security.EncryptorFactory;
+import org.identityconnectors.common.security.GuardedString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+class GuardedStringDeserializer extends JsonDeserializer<GuardedString> {
+
+    private static final Logger LOG = LoggerFactory.getLogger(GuardedStringDeserializer.class);
+
+    @Override
+    public GuardedString deserialize(final JsonParser jp, final DeserializationContext ctx)
+            throws IOException, JsonProcessingException {
+
+        ObjectNode tree = jp.readValueAsTree();
+
+        boolean readOnly = false;
+        if (tree.has("readOnly")) {
+            readOnly = tree.get("readOnly").asBoolean();
+        }
+        boolean disposed = false;
+        if (tree.has("disposed")) {
+            disposed = tree.get("disposed").asBoolean();
+        }
+        byte[] encryptedBytes = null;
+        if (tree.has("encryptedBytes")) {
+            encryptedBytes = Base64.decode(tree.get("encryptedBytes").asText());
+        }
+        String base64SHA1Hash = null;
+        if (tree.has("base64SHA1Hash")) {
+            base64SHA1Hash = tree.get("base64SHA1Hash").asText();
+        }
+
+        final byte[] clearBytes = EncryptorFactory.getInstance().getDefaultEncryptor().decrypt(encryptedBytes);
+
+        GuardedString dest = new GuardedString(new String(clearBytes).toCharArray());
+
+        try {
+            Field field = GuardedString.class.getDeclaredField("_readOnly");
+            field.setAccessible(true);
+            field.setBoolean(dest, readOnly);
+        } catch (Exception e) {
+            LOG.error("Could not set field value to {}", readOnly, e);
+        }
+
+        try {
+            Field field = GuardedString.class.getDeclaredField("_disposed");
+            field.setAccessible(true);
+            field.setBoolean(dest, disposed);
+        } catch (Exception e) {
+            LOG.error("Could not set field value to {}", disposed, e);
+        }
+
+        if (base64SHA1Hash != null) {
+            try {
+                Field field = GuardedString.class.getDeclaredField("_base64SHA1Hash");
+                field.setAccessible(true);
+                field.set(dest, base64SHA1Hash);
+            } catch (Exception e) {
+                LOG.error("Could not set field value to {}", base64SHA1Hash, e);
+            }
+        }
+
+        return dest;
+    }
+
+}

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/GuardedStringDeserializer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/GuardedStringDeserializer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/GuardedStringDeserializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/GuardedStringSerializer.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/GuardedStringSerializer.java?rev=1607378&view=auto
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/util/GuardedStringSerializer.java (added)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/util/GuardedStringSerializer.java Wed Jul  2 14:37:23 2014
@@ -0,0 +1,90 @@
+/*
+ * 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.syncope.core.util;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import org.identityconnectors.common.Base64;
+import org.identityconnectors.common.security.EncryptorFactory;
+import org.identityconnectors.common.security.GuardedString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+class GuardedStringSerializer extends JsonSerializer<GuardedString> {
+
+    private static final Logger LOG = LoggerFactory.getLogger(GuardedStringSerializer.class);
+
+    @Override
+    public void serialize(final GuardedString source, final JsonGenerator jgen, final SerializerProvider sp)
+            throws IOException, JsonProcessingException {
+
+        jgen.writeStartObject();
+
+        boolean readOnly = false;
+        try {
+            Field field = GuardedString.class.getDeclaredField("_readOnly");
+            field.setAccessible(true);
+            readOnly = field.getBoolean(source);
+        } catch (Exception e) {
+            LOG.error("Could not get field value", e);
+        }
+        jgen.writeBooleanField("readOnly", readOnly);
+
+        boolean disposed = false;
+        try {
+            Field field = GuardedString.class.getDeclaredField("_disposed");
+            field.setAccessible(true);
+            disposed = field.getBoolean(source);
+        } catch (Exception e) {
+            LOG.error("Could not get field value", e);
+        }
+        jgen.writeBooleanField("disposed", disposed);
+
+        final StringBuilder cleartext = new StringBuilder();
+        ((GuardedString) source).access(new GuardedString.Accessor() {
+
+            @Override
+            public void access(final char[] clearChars) {
+                cleartext.append(clearChars);
+            }
+        });
+        final byte[] encryptedBytes =
+                EncryptorFactory.getInstance().getDefaultEncryptor().encrypt(cleartext.toString().getBytes());
+        jgen.writeStringField("encryptedBytes", Base64.encode(encryptedBytes));
+
+        String base64SHA1Hash = null;
+        try {
+            Field field = GuardedString.class.getDeclaredField("_base64SHA1Hash");
+            field.setAccessible(true);
+            base64SHA1Hash = field.get(source).toString();
+        } catch (Exception e) {
+            LOG.error("Could not get field value", e);
+        }
+        if (base64SHA1Hash != null) {
+            jgen.writeStringField("base64SHA1Hash", base64SHA1Hash);
+        }
+
+        jgen.writeEndObject();
+    }
+
+}

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/GuardedStringSerializer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/GuardedStringSerializer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/GuardedStringSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/POJOHelper.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/POJOHelper.java?rev=1607378&view=auto
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/util/POJOHelper.java (added)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/util/POJOHelper.java Wed Jul  2 14:37:23 2014
@@ -0,0 +1,77 @@
+/*
+ * 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.syncope.core.util;
+
+import com.fasterxml.jackson.core.Version;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import org.identityconnectors.common.security.GuardedString;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.identityconnectors.framework.common.objects.SyncToken;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Helper class for serialization and deserialization of configuration objects (POJOs) in JSON.
+ */
+public final class POJOHelper {
+
+    private static final Logger LOG = LoggerFactory.getLogger(POJOHelper.class);
+
+    private static final ObjectMapper MAPPER;
+
+    static {
+        SimpleModule pojoModule = new SimpleModule("POJOModule", new Version(1, 0, 0, null, null, null));
+        pojoModule.addSerializer(GuardedString.class, new GuardedStringSerializer());
+        pojoModule.addSerializer(Attribute.class, new AttributeSerializer());
+        pojoModule.addDeserializer(GuardedString.class, new GuardedStringDeserializer());
+        pojoModule.addDeserializer(Attribute.class, new AttributeDeserializer());
+        pojoModule.addDeserializer(SyncToken.class, new SyncTokenDeserializer());
+
+        MAPPER = new ObjectMapper();
+        MAPPER.registerModule(pojoModule);
+    }
+
+    public static String serialize(final Object object) {
+        String result = null;
+
+        try {
+            result = MAPPER.writeValueAsString(object);
+        } catch (Exception e) {
+            LOG.error("During serialization", e);
+        }
+
+        return result;
+    }
+
+    public static <T extends Object> T deserialize(final String serialized, final Class<T> reference) {
+        T result = null;
+
+        try {
+            result = MAPPER.readValue(serialized, reference);
+        } catch (Exception e) {
+            LOG.error("During deserialization", e);
+        }
+
+        return result;
+    }
+
+    private POJOHelper() {
+    }
+}

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/POJOHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/POJOHelper.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/POJOHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/SyncTokenDeserializer.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/SyncTokenDeserializer.java?rev=1607378&view=auto
==============================================================================
--- syncope/trunk/core/src/main/java/org/apache/syncope/core/util/SyncTokenDeserializer.java (added)
+++ syncope/trunk/core/src/main/java/org/apache/syncope/core/util/SyncTokenDeserializer.java Wed Jul  2 14:37:23 2014
@@ -0,0 +1,57 @@
+/*
+ * 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.syncope.core.util;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import java.io.IOException;
+import org.identityconnectors.framework.common.objects.SyncToken;
+
+class SyncTokenDeserializer extends JsonDeserializer<SyncToken> {
+
+    @Override
+    public SyncToken deserialize(final JsonParser jp, final DeserializationContext ctx)
+            throws IOException, JsonProcessingException {
+
+        ObjectNode tree = jp.readValueAsTree();
+
+        Object value = null;
+        if (tree.has("value")) {
+            JsonNode node = tree.get("value");
+            value = node.isNull()
+                    ? null
+                    : node.isBoolean()
+                    ? node.asBoolean()
+                    : node.isDouble()
+                    ? node.asDouble()
+                    : node.isLong()
+                    ? node.asLong()
+                    : node.isInt()
+                    ? node.asInt()
+                    : node.asText();
+        }
+
+        return new SyncToken(value);
+    }
+
+}

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/SyncTokenDeserializer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/SyncTokenDeserializer.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: syncope/trunk/core/src/main/java/org/apache/syncope/core/util/SyncTokenDeserializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: syncope/trunk/core/src/main/resources/syncopeContext.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/main/resources/syncopeContext.xml?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/main/resources/syncopeContext.xml (original)
+++ syncope/trunk/core/src/main/resources/syncopeContext.xml Wed Jul  2 14:37:23 2014
@@ -109,8 +109,6 @@ under the License.
 
   <task:annotation-driven executor="connectorExecutor"/>
   <task:executor id="connectorExecutor" pool-size="10"/>
-
-  <bean id="xStream" class="com.thoughtworks.xstream.XStream"/>
   
   <bean id="virAttrCache" class="org.apache.syncope.core.util.VirAttrCache" scope="singleton">
     <constructor-arg value="60"/>

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/PolicyTest.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/PolicyTest.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/PolicyTest.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/persistence/dao/PolicyTest.java Wed Jul  2 14:37:23 2014
@@ -69,7 +69,7 @@ public class PolicyTest extends Abstract
 
         assertEquals(PolicyType.GLOBAL_PASSWORD, policy.getType());
 
-        assertEquals("invalid policy values", 8, ((PasswordPolicySpec) policy.getSpecification()).getMinLength());
+        assertEquals("invalid policy values", 8, (policy.getSpecification(PasswordPolicySpec.class)).getMinLength());
     }
 
     @Test(expected = InvalidEntityException.class)
@@ -116,8 +116,8 @@ public class PolicyTest extends Abstract
 
         assertNotNull(policy);
         assertEquals(PolicyType.SYNC, policy.getType());
-        assertEquals(syncURuleName, ((SyncPolicySpec) policy.getSpecification()).getUserJavaRule());
-        assertEquals(syncRRuleName, ((SyncPolicySpec) policy.getSpecification()).getRoleJavaRule());
+        assertEquals(syncURuleName, (policy.getSpecification(SyncPolicySpec.class)).getUserJavaRule());
+        assertEquals(syncRRuleName, (policy.getSpecification(SyncPolicySpec.class)).getRoleJavaRule());
     }
 
     @Test
@@ -134,8 +134,8 @@ public class PolicyTest extends Abstract
 
         assertNotNull(policy);
         assertEquals(PolicyType.GLOBAL_PASSWORD, policy.getType());
-        assertEquals(((PasswordPolicySpec) policy.getSpecification()).getMaxLength(), 8);
-        assertEquals(((PasswordPolicySpec) policy.getSpecification()).getMinLength(), 6);
+        assertEquals((policy.getSpecification(PasswordPolicySpec.class)).getMaxLength(), 8);
+        assertEquals((policy.getSpecification(PasswordPolicySpec.class)).getMinLength(), 6);
     }
 
     @Test

Modified: syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java?rev=1607378&r1=1607377&r2=1607378&view=diff
==============================================================================
--- syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java (original)
+++ syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java Wed Jul  2 14:37:23 2014
@@ -2358,7 +2358,7 @@ public class UserTestITCase extends Abst
         assertEquals(1, user.getResources().size());
 
         // 4. Check that the LDAP resource has the correct password
-        ConnObjectTO connObject = 
+        ConnObjectTO connObject =
                 resourceService.getConnectorObject(RESOURCE_NAME_LDAP, SubjectType.USER, user.getId());
 
         assertNotNull(getLdapRemoteObject(



Mime
View raw message