syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdisabat...@apache.org
Subject syncope git commit: [SYNCOPE-1083] Normalizing ConnInstance location
Date Wed, 17 May 2017 10:08:05 GMT
Repository: syncope
Updated Branches:
  refs/heads/1_2_X 8d309e2a6 -> fdff25174


[SYNCOPE-1083] Normalizing ConnInstance location


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/fdff2517
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/fdff2517
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/fdff2517

Branch: refs/heads/1_2_X
Commit: fdff25174e76ee52f7e22d41ab33c1a41f7e2bd0
Parents: 8d309e2
Author: Marco Di Sabatino Di Diodoro <marco.disabatino@tirasa.net>
Authored: Wed May 17 12:00:57 2017 +0200
Committer: Marco Di Sabatino Di Diodoro <marco.disabatino@tirasa.net>
Committed: Wed May 17 12:06:58 2017 +0200

----------------------------------------------------------------------
 .../propagation/impl/ConnectorFacadeProxy.java   |  2 +-
 .../core/rest/data/ConnInstanceDataBinder.java   | 19 +++++++++++++------
 .../syncope/core/util/ConnIdBundleManager.java   |  5 +++--
 3 files changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/fdff2517/core/src/main/java/org/apache/syncope/core/propagation/impl/ConnectorFacadeProxy.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/propagation/impl/ConnectorFacadeProxy.java
b/core/src/main/java/org/apache/syncope/core/propagation/impl/ConnectorFacadeProxy.java
index fb3c872..6cf63d0 100644
--- a/core/src/main/java/org/apache/syncope/core/propagation/impl/ConnectorFacadeProxy.java
+++ b/core/src/main/java/org/apache/syncope/core/propagation/impl/ConnectorFacadeProxy.java
@@ -99,7 +99,7 @@ public class ConnectorFacadeProxy implements Connector {
         ConnIdBundleManager connIdBundleManager =
                 ApplicationContextProvider.getApplicationContext().getBean(ConnIdBundleManager.class);
         ConnectorInfo info = connIdBundleManager.getConnectorInfo(connInstance.getLocation(),
-                connInstance.getBundleName(), connInstance.getVersion(), connInstance.getConnectorName());
+                connInstance.getBundleName(), connInstance.getVersion(), connInstance.getConnectorName()).getRight();
 
         // create default configuration
         APIConfiguration apiConfig = info.createDefaultAPIConfiguration();

http://git-wip-us.apache.org/repos/asf/syncope/blob/fdff2517/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java
b/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java
index 50bcf03..c91d197 100644
--- a/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java
+++ b/core/src/main/java/org/apache/syncope/core/rest/data/ConnInstanceDataBinder.java
@@ -18,11 +18,13 @@
  */
 package org.apache.syncope.core.rest.data;
 
+import java.net.URI;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+import org.apache.commons.lang3.tuple.Pair;
 import org.apache.syncope.common.to.ConnInstanceTO;
 import org.apache.syncope.common.to.ConnPoolConfTO;
 import org.apache.syncope.common.types.ConnConfPropSchema;
@@ -34,8 +36,10 @@ import org.apache.syncope.core.connid.ConnPoolConfUtil;
 import org.apache.syncope.core.persistence.beans.ConnInstance;
 import org.apache.syncope.core.persistence.dao.ConnInstanceDAO;
 import org.apache.syncope.core.util.ConnIdBundleManager;
+import org.apache.syncope.core.util.URIUtil;
 import org.identityconnectors.framework.api.ConfigurationProperties;
 import org.identityconnectors.framework.api.ConfigurationProperty;
+import org.identityconnectors.framework.api.ConnectorInfo;
 import org.identityconnectors.framework.impl.api.ConfigurationPropertyImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -43,7 +47,7 @@ import org.springframework.stereotype.Component;
 @Component
 public class ConnInstanceDataBinder {
 
-    private static final String[] IGNORE_PROPERTIES = { "id", "poolConf" };
+    private static final String[] IGNORE_PROPERTIES = { "id", "poolConf", "location" };
 
     @Autowired
     private ConnIdBundleManager connIdBundleManager;
@@ -203,15 +207,18 @@ public class ConnInstanceDataBinder {
 
     public ConnInstanceTO getConnInstanceTO(final ConnInstance connInstance) {
         ConnInstanceTO connInstanceTO = new ConnInstanceTO();
-        connInstanceTO.setId(connInstance.getId() == null ? 0L : connInstance.getId().longValue());
+        connInstanceTO.setId(connInstance.getId() == null ? 0L : connInstance.getId());
 
-        // retrieve the ConfigurationProperties
-        ConfigurationProperties properties = connIdBundleManager.getConfigurationProperties(
+        Pair<URI, ConnectorInfo> info =
                 connIdBundleManager.getConnectorInfo(connInstance.getLocation(),
-                        connInstance.getBundleName(), connInstance.getVersion(), connInstance.getConnectorName()));
+                        connInstance.getBundleName(), connInstance.getVersion(), connInstance.getConnectorName());
+        
+        // retrieve the ConfigurationProperties
+        ConfigurationProperties properties = connIdBundleManager.getConfigurationProperties(info.getRight());
 
         BeanUtils.copyProperties(connInstance, connInstanceTO, IGNORE_PROPERTIES);
-
+        connInstanceTO.setLocation(info.getLeft().toASCIIString());
+        
         final Map<String, ConnConfProperty> connInstanceToConfMap = connInstanceTO.getConfigurationMap();
 
         for (String propName : properties.getPropertyNames()) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/fdff2517/core/src/main/java/org/apache/syncope/core/util/ConnIdBundleManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/util/ConnIdBundleManager.java b/core/src/main/java/org/apache/syncope/core/util/ConnIdBundleManager.java
index 4790982..bb941cc 100644
--- a/core/src/main/java/org/apache/syncope/core/util/ConnIdBundleManager.java
+++ b/core/src/main/java/org/apache/syncope/core/util/ConnIdBundleManager.java
@@ -32,6 +32,7 @@ import java.util.Map;
 import javax.net.ssl.TrustManager;
 import javax.net.ssl.X509TrustManager;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
 import org.apache.syncope.core.persistence.dao.NotFoundException;
 import org.identityconnectors.common.IOUtil;
 import org.identityconnectors.common.security.GuardedString;
@@ -213,7 +214,7 @@ public class ConnIdBundleManager {
         return connInfoManagers;
     }
 
-    public ConnectorInfo getConnectorInfo(
+    public Pair<URI, ConnectorInfo> getConnectorInfo(
             final String location, final String bundleName, final String bundleVersion, final
String connectorName) {
 
         // check ConnIdLocation
@@ -242,7 +243,7 @@ public class ConnIdBundleManager {
             throw new NotFoundException("Connector Info for location " + location + " and
key " + key);
         }
 
-        return info;
+        return Pair.of(uriLocation, info);
     }
 
     public Map<String, List<ConnectorInfo>> getConnectorInfos() {


Mime
View raw message