syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject svn commit: r1401252 [2/2] - in /incubator/syncope/trunk: client/src/main/java/org/apache/syncope/client/to/ client/src/main/java/org/apache/syncope/types/ console/src/main/java/org/apache/syncope/console/pages/ console/src/main/java/org/apache/syncope...
Date Tue, 23 Oct 2012 11:27:56 GMT
Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java?rev=1401252&r1=1401251&r2=1401252&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java
(original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java
Tue Oct 23 11:27:55 2012
@@ -19,11 +19,6 @@
 package org.apache.syncope.core.rest.data;
 
 import java.util.Map;
-import org.identityconnectors.framework.api.ConfigurationProperties;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.stereotype.Component;
 import org.apache.syncope.client.to.ConnInstanceTO;
 import org.apache.syncope.client.validation.SyncopeClientCompositeErrorException;
 import org.apache.syncope.client.validation.SyncopeClientException;
@@ -34,7 +29,12 @@ import org.apache.syncope.core.util.NotF
 import org.apache.syncope.types.ConnConfPropSchema;
 import org.apache.syncope.types.ConnConfProperty;
 import org.apache.syncope.types.SyncopeClientExceptionType;
+import org.identityconnectors.framework.api.ConfigurationProperties;
 import org.identityconnectors.framework.impl.api.ConfigurationPropertyImpl;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Component;
 
 @Component
 public class ConnInstanceDataBinder {
@@ -50,8 +50,7 @@ public class ConnInstanceDataBinder {
     public ConnInstance getConnInstance(final ConnInstanceTO connInstanceTO)
             throws SyncopeClientCompositeErrorException {
 
-        SyncopeClientCompositeErrorException compositeErrorException = new SyncopeClientCompositeErrorException(
-                HttpStatus.BAD_REQUEST);
+        SyncopeClientCompositeErrorException scee = new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
 
         SyncopeClientException requiredValuesMissing = new SyncopeClientException(
                 SyncopeClientExceptionType.RequiredValuesMissing);
@@ -80,11 +79,11 @@ public class ConnInstanceDataBinder {
         // in the composing exceptions
 
         if (!requiredValuesMissing.isEmpty()) {
-            compositeErrorException.addException(requiredValuesMissing);
+            scee.addException(requiredValuesMissing);
         }
 
-        if (compositeErrorException.hasExceptions()) {
-            throw compositeErrorException;
+        if (scee.hasExceptions()) {
+            throw scee;
         }
 
         return connectorInstance;

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ResourceDataBinder.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ResourceDataBinder.java?rev=1401252&r1=1401251&r2=1401252&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ResourceDataBinder.java
(original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/ResourceDataBinder.java
Tue Oct 23 11:27:55 2012
@@ -25,6 +25,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import org.apache.commons.lang.SerializationUtils;
 import org.apache.syncope.client.to.ResourceTO;
 import org.apache.syncope.client.to.SchemaMappingTO;
 import org.apache.syncope.client.validation.SyncopeClientCompositeErrorException;
@@ -130,6 +131,8 @@ public class ResourceDataBinder {
             resource.setSerializedSyncToken(null);
         }
 
+        resource.setActionsClassName(resourceTO.getActionsClassName());
+
         return resource;
     }
 
@@ -193,10 +196,13 @@ public class ResourceDataBinder {
         resourceTO.setConnectorConfigurationProperties(resource.getConfiguration());
         resourceTO.setSyncToken(resource.getSerializedSyncToken());
 
+        resourceTO.setActionsClassName(resource.getActionsClassName());
+
         return resourceTO;
     }
 
-    private Set<SchemaMapping> getSchemaMappings(ExternalResource resource, List<SchemaMappingTO>
mappings) {
+    private Set<SchemaMapping> getSchemaMappings(final ExternalResource resource,
+            final List<SchemaMappingTO> mappings) {
 
         if (mappings == null) {
             return null;
@@ -215,11 +221,10 @@ public class ResourceDataBinder {
         return schemaMappings;
     }
 
-    private SchemaMapping getSchemaMapping(ExternalResource resource, SchemaMappingTO mappingTO)
+    private SchemaMapping getSchemaMapping(final ExternalResource resource, final SchemaMappingTO
mappingTO)
             throws SyncopeClientCompositeErrorException {
 
-        SyncopeClientCompositeErrorException compositeErrorException = new SyncopeClientCompositeErrorException(
-                HttpStatus.BAD_REQUEST);
+        SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
 
         SyncopeClientException requiredValuesMissing = new SyncopeClientException(
                 SyncopeClientExceptionType.RequiredValuesMissing);
@@ -253,7 +258,7 @@ public class ResourceDataBinder {
         // Throw composite exception if there is at least one element set
         // in the composing exceptions
         if (!requiredValuesMissing.isEmpty()) {
-            compositeErrorException.addException(requiredValuesMissing);
+            scce.addException(requiredValuesMissing);
         }
 
         // no mandatory condition implies mandatory condition false
@@ -266,11 +271,11 @@ public class ResourceDataBinder {
 
             invalidMandatoryCondition.addElement(mappingTO.getMandatoryCondition());
 
-            compositeErrorException.addException(invalidMandatoryCondition);
+            scce.addException(invalidMandatoryCondition);
         }
 
-        if (compositeErrorException.hasExceptions()) {
-            throw compositeErrorException;
+        if (scce.hasExceptions()) {
+            throw scce;
         }
 
         SchemaMapping mapping = new SchemaMapping();
@@ -282,8 +287,7 @@ public class ResourceDataBinder {
         return mapping;
     }
 
-    public List<SchemaMappingTO> getSchemaMappingTOs(Collection<SchemaMapping>
mappings) {
-
+    public List<SchemaMappingTO> getSchemaMappingTOs(final Collection<SchemaMapping>
mappings) {
         if (mappings == null) {
             LOG.error("No mapping provided.");
 
@@ -302,7 +306,7 @@ public class ResourceDataBinder {
         return schemaMappingTOs;
     }
 
-    public SchemaMappingTO getSchemaMappingTO(SchemaMapping schemaMapping) {
+    public SchemaMappingTO getSchemaMappingTO(final SchemaMapping schemaMapping) {
         if (schemaMapping == null) {
             LOG.error("Provided null mapping");
 
@@ -320,33 +324,25 @@ public class ResourceDataBinder {
         return schemaMappingTO;
     }
 
-    public ConnInstance getConnInstance(ExternalResource resource)
-            throws NotFoundException {
-
-        final ConnInstance connInstanceClone =
-                (ConnInstance) org.apache.commons.lang.SerializationUtils.clone(resource.getConnector());
+    public ConnInstance getConnInstance(final ExternalResource resource) {
+        final ConnInstance connInstanceClone = (ConnInstance) SerializationUtils.clone(resource.getConnector());
 
         return getConnInstance(connInstanceClone, resource.getConfiguration());
     }
 
     public ConnInstance getConnInstance(final ResourceTO resourceTO)
             throws NotFoundException {
-        ConnInstance connInstance = connInstanceDAO.find(resourceTO.getConnectorId());
-
-        final ConnInstance connInstanceClone =
-                (ConnInstance) org.apache.commons.lang.SerializationUtils.clone(connInstance);
 
+        ConnInstance connInstance = connInstanceDAO.find(resourceTO.getConnectorId());
         if (connInstance == null) {
             throw new NotFoundException("Connector '" + resourceTO.getConnectorId() + "'");
         }
 
+        final ConnInstance connInstanceClone = (ConnInstance) SerializationUtils.clone(connInstance);
         return getConnInstance(connInstanceClone, resourceTO.getConnConfProperties());
     }
 
-    private ConnInstance getConnInstance(
-            final ConnInstance connInstance, final Set<ConnConfProperty> overridden)
-            throws NotFoundException {
-
+    private ConnInstance getConnInstance(final ConnInstance connInstance, final Set<ConnConfProperty>
overridden) {
         final Set<ConnConfProperty> configuration = new HashSet<ConnConfProperty>();
         final Map<String, ConnConfProperty> overridable = new HashMap<String, ConnConfProperty>();
 

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/DefaultSyncActions.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/DefaultSyncActions.java?rev=1401252&r1=1401251&r2=1401252&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/DefaultSyncActions.java
(original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/DefaultSyncActions.java
Tue Oct 23 11:27:55 2012
@@ -27,8 +27,6 @@ import org.quartz.JobExecutionException;
 
 /**
  * Default (empty) implementation of SyncActions.
- *
- * @see SyncActions
  */
 public class DefaultSyncActions implements SyncActions {
 

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncJob.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncJob.java?rev=1401252&r1=1401251&r2=1401252&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncJob.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/sync/SyncJob.java Tue
Oct 23 11:27:55 2012
@@ -216,7 +216,6 @@ public class SyncJob extends AbstractTas
         if (!(task instanceof SyncTask)) {
             throw new JobExecutionException("Task " + taskId + " isn't a SyncTask");
         }
-
         final SyncTask syncTask = (SyncTask) this.task;
 
         ConnectorFacadeProxy connector;
@@ -230,7 +229,6 @@ public class SyncJob extends AbstractTas
         }
 
         final SchemaMapping accountIdMap = SchemaMappingUtil.getAccountIdMapping(syncTask.getResource().getMappings());
-
         if (accountIdMap == null) {
             throw new JobExecutionException("Invalid account id mapping for resource " +
syncTask.getResource());
         }
@@ -239,8 +237,6 @@ public class SyncJob extends AbstractTas
 
         final List<SyncResult> results = new ArrayList<SyncResult>();
 
-        actions.beforeAll(syncTask);
-
         final SyncPolicy syncPolicy = syncTask.getResource().getSyncPolicy();
         final ConflictResolutionAction resAct = syncPolicy == null || syncPolicy.getSpecification()
== null
                 ? ConflictResolutionAction.IGNORE
@@ -257,6 +253,7 @@ public class SyncJob extends AbstractTas
         handler.setResults(results);
         handler.setSyncTask(syncTask);
 
+        actions.beforeAll(syncTask);
         try {
             if (syncTask.isFullReconciliation()) {
                 connector.getAllObjects(ObjectClass.ACCOUNT, handler,
@@ -278,7 +275,6 @@ public class SyncJob extends AbstractTas
         } catch (Exception e) {
             throw new JobExecutionException("While syncing on connector", e);
         }
-
         actions.afterAll(syncTask, results);
 
         final String result = createReport(results, syncTask.getResource().getSyncTraceLevel(),
dryRun);

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ApplicationContextProvider.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ApplicationContextProvider.java?rev=1401252&r1=1401251&r2=1401252&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ApplicationContextProvider.java
(original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ApplicationContextProvider.java
Tue Oct 23 11:27:55 2012
@@ -18,6 +18,7 @@
  */
 package org.apache.syncope.core.util;
 
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
 import org.springframework.context.ConfigurableApplicationContext;
@@ -30,6 +31,10 @@ public class ApplicationContextProvider 
         return ctx;
     }
 
+    public static DefaultListableBeanFactory getBeanFactory() {
+        return (DefaultListableBeanFactory) ctx.getBeanFactory();
+    }
+
     /**
      * Wiring the ApplicationContext into a static method.
      *

Modified: incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ConnObjectUtil.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ConnObjectUtil.java?rev=1401252&r1=1401251&r2=1401252&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ConnObjectUtil.java
(original)
+++ incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/util/ConnObjectUtil.java
Tue Oct 23 11:27:55 2012
@@ -295,8 +295,6 @@ public class ConnObjectUtil {
         for (ExternalResource resource : owner.getResources()) {
             LOG.debug("Retrieve remote object from '{}'", resource.getName());
             try {
-                final ConnectorFacadeProxy connector = connInstanceLoader.getConnector(resource);
-
                 final SchemaMappingUtil.SchemaMappingsWrapper mappings = new SchemaMappingUtil.SchemaMappingsWrapper(
                         resource.getMappings());
 
@@ -319,8 +317,9 @@ public class ConnObjectUtil {
                         final OperationOptionsBuilder oob = new OperationOptionsBuilder();
                         oob.setAttributesToGet(extAttrNames);
 
-                        final ConnectorObject connectorObject = connector.getObject(ObjectClass.ACCOUNT,
new Uid(
-                                accountId), oob.build());
+                        final ConnectorFacadeProxy connector = connInstanceLoader.getConnector(resource);
+                        final ConnectorObject connectorObject =
+                                connector.getObject(ObjectClass.ACCOUNT, new Uid(accountId),
oob.build());
 
                         if (connectorObject != null) {
                             remoteObjects.put(mappings, connectorObject);
@@ -362,7 +361,6 @@ public class ConnObjectUtil {
     }
 
     private void fillFromTemplate(final AbstractAttributableTO attributableTO, final AbstractAttributableTO
template) {
-
         Map<String, AttributeTO> currentAttrMap = attributableTO.getAttributeMap();
         for (AttributeTO attrTO : template.getAttributes()) {
             if (!currentAttrMap.containsKey(attrTO.getSchema())) {
@@ -386,7 +384,6 @@ public class ConnObjectUtil {
     }
 
     private AttributeTO evaluateAttrTemplate(final AbstractAttributableTO attributableTO,
final AttributeTO template) {
-
         AttributeTO result = new AttributeTO();
         result.setSchema(template.getSchema());
 

Modified: incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ResourceTestITCase.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ResourceTestITCase.java?rev=1401252&r1=1401251&r2=1401252&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ResourceTestITCase.java
(original)
+++ incubator/syncope/trunk/core/src/test/java/org/apache/syncope/core/rest/ResourceTestITCase.java
Tue Oct 23 11:27:55 2012
@@ -40,6 +40,14 @@ import org.apache.syncope.types.SyncopeC
 
 public class ResourceTestITCase extends AbstractTest {
 
+    @Test
+    public void getPropagationActionsClasses() {
+        Set<String> actions = restTemplate.getForObject(
+                BASE_URL + "resource/propagationActionsClasses.json", Set.class);
+        assertNotNull(actions);
+        assertFalse(actions.isEmpty());
+    }
+
     @Test(expected = SyncopeClientCompositeErrorException.class)
     public void createExistingResource() {
         final String resourceName = "ws-target-resource-1";
@@ -316,7 +324,7 @@ public class ResourceTestITCase extends 
     public void deleteWithException() {
         try {
             restTemplate.getForObject(
-                BASE_URL + "resource/delete/{resourceName}.json", ResourceTO.class, "resourcenotfound");
+                    BASE_URL + "resource/delete/{resourceName}.json", ResourceTO.class, "resourcenotfound");
         } catch (HttpStatusCodeException e) {
             assertEquals(HttpStatus.NOT_FOUND, e.getStatusCode());
         }
@@ -342,9 +350,9 @@ public class ResourceTestITCase extends 
     public void delete() {
         final String resourceName = "ws-target-resource-delete";
 
-        ResourceTO deletedResource = 
-                restTemplate.getForObject(BASE_URL + "resource/delete/{resourceName}.json",
ResourceTO.class, 
-                        resourceName);
+        ResourceTO deletedResource =
+                restTemplate.getForObject(BASE_URL + "resource/delete/{resourceName}.json",
ResourceTO.class,
+                resourceName);
         assertNotNull(deletedResource);
 
         try {



Mime
View raw message