You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by gi...@apache.org on 2015/01/08 11:18:36 UTC

[1/3] syncope git commit: Fixed useless warnings

Repository: syncope
Updated Branches:
  refs/heads/master a8f98d25b -> 0edb2a245


Fixed useless warnings


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

Branch: refs/heads/master
Commit: 061a601de29266c6439e2fb83902dbffb689df51
Parents: a90a48a
Author: giacomolm <gi...@hotmail.it>
Authored: Wed Jan 7 10:03:43 2015 +0100
Committer: giacomolm <gi...@hotmail.it>
Committed: Wed Jan 7 10:03:43 2015 +0100

----------------------------------------------------------------------
 .../org/apache/syncope/common/services/RouteService.java     | 8 +-------
 .../org/apache/syncope/console/pages/RouteModalPage.java     | 2 +-
 2 files changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/061a601d/common/src/main/java/org/apache/syncope/common/services/RouteService.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/syncope/common/services/RouteService.java b/common/src/main/java/org/apache/syncope/common/services/RouteService.java
index 6e3090f..27e21e1 100644
--- a/common/src/main/java/org/apache/syncope/common/services/RouteService.java
+++ b/common/src/main/java/org/apache/syncope/common/services/RouteService.java
@@ -29,9 +29,6 @@ import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import org.apache.cxf.jaxrs.model.wadl.Description;
-import org.apache.cxf.jaxrs.model.wadl.Descriptions;
-import org.apache.cxf.jaxrs.model.wadl.DocTarget;
 import org.apache.syncope.common.to.RouteTO;
 import org.apache.syncope.common.types.SubjectType;
 
@@ -47,10 +44,7 @@ public interface RouteService extends JAXRSService {
      * @see org.apache.syncope.common.types.RESTHeaders#CAMEL_USER_PROVISIONING_MANAGER
      * @see org.apache.syncope.common.types.RESTHeaders#CAMEL_ROLE_PROVISIONING_MANAGER
      *
-     * @Descriptions({
-     * @Description(target = DocTarget.RESPONSE,
-     * value = "Contains special syncope HTTP header indicating if Camel is the default provisioning manager")
-     * }) */
+     */
     @OPTIONS
     Response getOptions(@NotNull @PathParam("kind") SubjectType kind);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/061a601d/console/src/main/java/org/apache/syncope/console/pages/RouteModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/RouteModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/RouteModalPage.java
index bba8aa4..8cc02e6 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/RouteModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/RouteModalPage.java
@@ -44,7 +44,7 @@ public class RouteModalPage extends BaseModalPage{
      public RouteModalPage(final PageReference pageRef, final ModalWindow window,
             final RouteTO routeTO, final boolean createFlag){
          
-        Form routeForm = new Form("routeDefForm");            
+        Form<RouteTO> routeForm = new Form<RouteTO>("routeDefForm");            
         
         final TextArea<String> routeDefArea = new TextArea<String>("routeContent", new PropertyModel<String>(routeTO, "routeContent"));       
         //routeDefArea.setOutputMarkupId(true);      


[2/3] syncope git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/syncope

Posted by gi...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/syncope


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

Branch: refs/heads/master
Commit: 184b89f8d84095f51b5d48292fbd70350a3a8ec1
Parents: 061a601 a8f98d2
Author: giacomolm <gi...@hotmail.it>
Authored: Thu Jan 8 10:53:51 2015 +0100
Committer: giacomolm <gi...@hotmail.it>
Committed: Thu Jan 8 10:53:51 2015 +0100

----------------------------------------------------------------------
 .../org/apache/syncope/common/to/RouteTO.java   |  15 ++-
 .../DefaultRoleProvisioningManager.java         |  30 +++---
 .../DefaultUserProvisioningManager.java         | 102 +++++++------------
 .../core/provisioning/ProvisioningManager.java  |  12 +--
 .../provisioning/RoleProvisioningManager.java   |  34 ++++---
 .../provisioning/UserProvisioningManager.java   |  52 +++++-----
 .../camel/CamelRoleProvisioningManager.java     |   2 +-
 .../camel/CamelUserProvisioningManager.java     |   2 +-
 .../core/sync/impl/RoleSyncResultHandler.java   |   2 +-
 .../core/sync/impl/UserSyncResultHandler.java   |   2 +-
 pom.xml                                         |   2 +-
 11 files changed, 114 insertions(+), 141 deletions(-)
----------------------------------------------------------------------



[3/3] syncope git commit: [SYNCOPE-627] Separating route management

Posted by gi...@apache.org.
[SYNCOPE-627] Separating route management


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

Branch: refs/heads/master
Commit: 0edb2a245fbd06f06f841e4fc0b0df34d132d892
Parents: 184b89f
Author: giacomolm <gi...@hotmail.it>
Authored: Thu Jan 8 11:17:49 2015 +0100
Committer: giacomolm <gi...@hotmail.it>
Committed: Thu Jan 8 11:17:49 2015 +0100

----------------------------------------------------------------------
 .../syncope/common/services/RouteService.java   | 23 +++++--
 .../syncope/console/pages/Configuration.java    |  8 ++-
 .../syncope/console/rest/RouteRestClient.java   |  8 +--
 .../syncope/core/init/CamelRouteLoader.java     | 64 ++++++++++----------
 .../core/persistence/beans/CamelRoute.java      | 18 +++++-
 .../syncope/core/persistence/dao/RouteDAO.java  |  9 ++-
 .../core/persistence/dao/impl/RouteDAOImpl.java | 21 ++++++-
 .../camel/CamelUserProvisioningManager.java     |  5 +-
 .../provisioning/camel/SyncopeCamelContext.java | 12 ++--
 .../core/rest/controller/RouteController.java   | 16 ++++-
 .../syncope/core/services/RouteServiceImpl.java | 22 +++++--
 core/src/main/resources/userRoute.xml           | 60 ++++++++++++++++--
 12 files changed, 194 insertions(+), 72 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/0edb2a24/common/src/main/java/org/apache/syncope/common/services/RouteService.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/syncope/common/services/RouteService.java b/common/src/main/java/org/apache/syncope/common/services/RouteService.java
index 27e21e1..2082fc5 100644
--- a/common/src/main/java/org/apache/syncope/common/services/RouteService.java
+++ b/common/src/main/java/org/apache/syncope/common/services/RouteService.java
@@ -32,13 +32,13 @@ import javax.ws.rs.core.Response;
 import org.apache.syncope.common.to.RouteTO;
 import org.apache.syncope.common.types.SubjectType;
 
-@Path("routes/{kind}")
+@Path("routes/{subject}")
 public interface RouteService extends JAXRSService {
 
     /**
      * Checks whether Camel is choosed as default provisioning engine.
      *
-     * @param kind user or role
+     * @param subject user or role
      * @return <tt>Response</tt> contains special syncope HTTP header indicating if Camel is enabled for
      * users / roles provisioning
      * @see org.apache.syncope.common.types.RESTHeaders#CAMEL_USER_PROVISIONING_MANAGER
@@ -46,20 +46,31 @@ public interface RouteService extends JAXRSService {
      *
      */
     @OPTIONS
-    Response getOptions(@NotNull @PathParam("kind") SubjectType kind);
+    Response getOptions(@NotNull @PathParam("subject") SubjectType subject);
 
     @GET
     @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-    List<RouteTO> getRoutes(@NotNull @PathParam("kind") SubjectType kind);
+    List<RouteTO> getRoutes(@NotNull @PathParam("subject") SubjectType subject);
 
     @GET
     @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
     @Path("{id}")
-    public RouteTO getRoute(@NotNull @PathParam("kind") SubjectType kind, @PathParam("id") Long Id);
+    public RouteTO getRoute(@NotNull @PathParam("subject") SubjectType subject, @PathParam("id") Long Id);
+    
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Path("{id}")
+    public RouteTO getRoute(@PathParam("id") Long Id);
 
     @PUT
     @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
     @Path("{id}")
-    void importRoute(@NotNull @PathParam("kind") SubjectType kind,@PathParam("id") Long id, RouteTO route);
+    void importRoute(@NotNull @PathParam("subject") SubjectType subject,@PathParam("id") Long id, RouteTO route);
+    
+    @PUT
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Path("{id}")
+    void importRoute(@PathParam("id") Long id, RouteTO route);
+
 
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0edb2a24/console/src/main/java/org/apache/syncope/console/pages/Configuration.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/Configuration.java b/console/src/main/java/org/apache/syncope/console/pages/Configuration.java
index 05316dd..0f97ff5 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/Configuration.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/Configuration.java
@@ -37,6 +37,7 @@ import org.apache.syncope.common.to.SecurityQuestionTO;
 import org.apache.syncope.console.commons.AttrLayoutType;
 import org.apache.syncope.common.types.LoggerLevel;
 import org.apache.syncope.common.types.PolicyType;
+import org.apache.syncope.common.types.SubjectType;
 import org.apache.syncope.console.commons.Constants;
 import org.apache.syncope.console.commons.HttpResourceStream;
 import org.apache.syncope.console.commons.PreferenceManager;
@@ -52,7 +53,6 @@ import org.apache.syncope.console.wicket.extensions.markup.html.repeater.data.ta
 import org.apache.syncope.console.wicket.markup.html.form.ActionLink;
 import org.apache.syncope.console.wicket.markup.html.form.ActionLinksPanel;
 import org.apache.syncope.console.wicket.markup.html.link.VeilPopupSettings;
-import org.apache.wicket.Component;
 import org.apache.wicket.Page;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
@@ -860,7 +860,8 @@ public class Configuration extends BasePage {
 
         @Override
         public Iterator<? extends RouteTO> iterator(long first, long count) {
-            List<RouteTO> list =  routeRestClient.readRoutes();
+            List<RouteTO> list =  routeRestClient.readRoutes(SubjectType.USER);
+            list.addAll(routeRestClient.readRoutes(SubjectType.ROLE));
 
             Collections.sort(list, comparator);
 
@@ -869,7 +870,8 @@ public class Configuration extends BasePage {
 
         @Override
         public long size() {
-            return routeRestClient.readRoutes().size();
+            return (routeRestClient.readRoutes(SubjectType.USER).size() + 
+                    routeRestClient.readRoutes(SubjectType.ROLE).size());
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/0edb2a24/console/src/main/java/org/apache/syncope/console/rest/RouteRestClient.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/rest/RouteRestClient.java b/console/src/main/java/org/apache/syncope/console/rest/RouteRestClient.java
index dcfb8c3..422b4ee 100644
--- a/console/src/main/java/org/apache/syncope/console/rest/RouteRestClient.java
+++ b/console/src/main/java/org/apache/syncope/console/rest/RouteRestClient.java
@@ -33,18 +33,18 @@ public class RouteRestClient extends BaseRestClient{
     
     protected static final Logger LOG = LoggerFactory.getLogger(RouteRestClient.class);
     
-    public List<RouteTO> readRoutes(){
-        return getService(RouteService.class).getRoutes(SubjectType.USER);
+    public List<RouteTO> readRoutes(final SubjectType subject){
+        return getService(RouteService.class).getRoutes(subject);
     }
     
     public RouteTO readRoute(Long id){
-        return getService(RouteService.class).getRoute(SubjectType.USER, id);
+        return getService(RouteService.class).getRoute(id);
     }
     
     public void updateRoute(Long id, String definition){
         RouteTO routeTO = readRoute(id);        
         routeTO.setRouteContent(definition);     
-        getService(RouteService.class).importRoute(SubjectType.USER, routeTO.getId(), routeTO);
+        getService(RouteService.class).importRoute(routeTO.getId(), routeTO);
     }
     
     public boolean isCamelEnabledForUsers() {

http://git-wip-us.apache.org/repos/asf/syncope/blob/0edb2a24/core/src/main/java/org/apache/syncope/core/init/CamelRouteLoader.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/init/CamelRouteLoader.java b/core/src/main/java/org/apache/syncope/core/init/CamelRouteLoader.java
index 5f63e0d..a293da4 100644
--- a/core/src/main/java/org/apache/syncope/core/init/CamelRouteLoader.java
+++ b/core/src/main/java/org/apache/syncope/core/init/CamelRouteLoader.java
@@ -21,7 +21,6 @@ package org.apache.syncope.core.init;
 import java.io.File;
 import java.io.StringWriter;
 import java.net.URL;
-import javax.sql.DataSource;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.OutputKeys;
@@ -30,13 +29,13 @@ import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
+import org.apache.syncope.common.types.SubjectType;
 import org.apache.syncope.core.persistence.beans.CamelRoute;
 import org.apache.syncope.core.persistence.dao.RouteDAO;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.dao.DataAccessException;
-import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 import org.w3c.dom.Document;
@@ -51,45 +50,46 @@ public class CamelRouteLoader {
 
     @Autowired
     private RouteDAO routeDAO;
-
-    @Autowired
-    private DataSource dataSource;
+    
+    private int size = 0;
 
     @Transactional
     public void load() {
+        loadRoutes("/userRoute.xml", SubjectType.USER);
+        loadRoutes("/roleRoute.xml", SubjectType.ROLE);
+    }
+    
+    public void loadRoutes(String path, SubjectType subject) {
 
-        //if(routeDAO.findAll().isEmpty()){
-        URL url = getClass().getResource("/camelRoute.xml");
-
-        File file = new File(url.getPath());
-        String query = "INSERT INTO CamelRoute(ID, NAME, ROUTECONTENT) VALUES (?, ?, ?)";
-        try {
-
-            DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-            Document doc = dBuilder.parse(file);
-            doc.getDocumentElement().normalize();
+        if(routeDAO.findAll(subject).isEmpty()){
+            URL url = getClass().getResource(path);
 
-            JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
+            File file = new File(url.getPath());
+            
+            try {
 
-            NodeList listOfRoutes = doc.getElementsByTagName("route");
-            for (int s = 0; s < listOfRoutes.getLength(); s++) {
-                //getting the route node element
-                Node routeEl = listOfRoutes.item(s);
-                //crate an instance of CamelRoute Entity
-                CamelRoute route = new CamelRoute();
-                route.setName(((Element) routeEl).getAttribute("id"));
-                route.setRouteContent(nodeToString(listOfRoutes.item(s)));
+                DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+                Document doc = dBuilder.parse(file);
+                doc.getDocumentElement().normalize();
 
-                jdbcTemplate.update(query, new Object[] { s + 1, ((Element) routeEl).getAttribute("id"), nodeToString(
-                    listOfRoutes.item(s)) });
-                LOG.info("Route Registration Successed");
+                NodeList listOfRoutes = doc.getElementsByTagName("route");
+                for (int s = 0; s < listOfRoutes.getLength(); s++) {
+                    //getting the route node element
+                    Node routeEl = listOfRoutes.item(s);
+                    //crate an instance of CamelRoute Entity
+                    CamelRoute route = new CamelRoute();
+                    route.setSubject(subject);
+                    route.setName(((Element) routeEl).getAttribute("id"));
+                    route.setRouteContent(nodeToString(listOfRoutes.item(s)));                    
+                    routeDAO.save(route);
+                    LOG.info("Route with id {} Registration Successed", ((Element) routeEl).getAttribute("id"));
+                }
+            } catch (DataAccessException e) {
+                LOG.error("While trying to store queries {}", e);
+            } catch (Exception e) {
+                LOG.error("Route Registration failed {}", e.getMessage());
             }
-        } catch (DataAccessException e) {
-            LOG.error("While trying to perform {}", query, e);
-        } catch (Exception e) {
-            LOG.error("Route Registration failed {}", e.getMessage());
         }
-        //}
     }
 
     private String nodeToString(Node node) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/0edb2a24/core/src/main/java/org/apache/syncope/core/persistence/beans/CamelRoute.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/persistence/beans/CamelRoute.java b/core/src/main/java/org/apache/syncope/core/persistence/beans/CamelRoute.java
index 33fff55..fc8c8d2 100644
--- a/core/src/main/java/org/apache/syncope/core/persistence/beans/CamelRoute.java
+++ b/core/src/main/java/org/apache/syncope/core/persistence/beans/CamelRoute.java
@@ -24,6 +24,10 @@ import javax.persistence.Id;
 import javax.persistence.Lob;
 import javax.persistence.GenerationType;
 import javax.persistence.Column;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.validation.constraints.NotNull;
+import org.apache.syncope.common.types.SubjectType;
 
 @Entity
 public class CamelRoute {
@@ -34,6 +38,10 @@ public class CamelRoute {
     private Long id;
 
     private String name;
+    
+    @NotNull
+    @Enumerated(EnumType.STRING)
+    private SubjectType subject;
 
     @Lob
     private String routeContent;
@@ -41,7 +49,7 @@ public class CamelRoute {
     public Long getId() {
         return id;
     }
-
+    
     public void setName(String name) {
         this.name = name;
     }
@@ -49,6 +57,14 @@ public class CamelRoute {
     public String getName() {
         return name;
     }
+        
+    public SubjectType getSubject() {
+        return subject;
+    }
+
+    public void setSubject(SubjectType subject) {
+        this.subject = subject;
+    }
 
     public String getRouteContent() {
         return routeContent;

http://git-wip-us.apache.org/repos/asf/syncope/blob/0edb2a24/core/src/main/java/org/apache/syncope/core/persistence/dao/RouteDAO.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/persistence/dao/RouteDAO.java b/core/src/main/java/org/apache/syncope/core/persistence/dao/RouteDAO.java
index aa7f4f6..eb95fef 100644
--- a/core/src/main/java/org/apache/syncope/core/persistence/dao/RouteDAO.java
+++ b/core/src/main/java/org/apache/syncope/core/persistence/dao/RouteDAO.java
@@ -19,16 +19,21 @@
 package org.apache.syncope.core.persistence.dao;
 
 import java.util.List;
+import org.apache.syncope.common.types.SubjectType;
 import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
 import org.apache.syncope.core.persistence.beans.CamelRoute;
 
 public interface RouteDAO {
 
     CamelRoute find(Long id);
-
+    
+    CamelRoute find(Long id, SubjectType subject);
+    
     List<CamelRoute> findAll();
 
+    List<CamelRoute> findAll(SubjectType subject);
+
     CamelRoute save(CamelRoute route) throws InvalidEntityException;
 
-    void delete(Long id);
+    void delete(Long id, SubjectType subject);
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0edb2a24/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/RouteDAOImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/RouteDAOImpl.java b/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/RouteDAOImpl.java
index 7d30a01..2a1527a 100644
--- a/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/RouteDAOImpl.java
+++ b/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/RouteDAOImpl.java
@@ -20,6 +20,7 @@ package org.apache.syncope.core.persistence.dao.impl;
 
 import java.util.List;
 import javax.persistence.TypedQuery;
+import org.apache.syncope.common.types.SubjectType;
 import org.apache.syncope.core.persistence.beans.CamelRoute;
 import org.apache.syncope.core.persistence.dao.RouteDAO;
 import org.apache.syncope.core.persistence.validation.entity.InvalidEntityException;
@@ -33,12 +34,26 @@ public class RouteDAOImpl extends AbstractDAOImpl implements RouteDAO {
     public CamelRoute find(final Long id) {
         return entityManager.find(CamelRoute.class, id);
     }
+    
+    @Override
+    public CamelRoute find(final Long id, final SubjectType subject) {
+        return find(id);
+    }
 
     @Transactional(readOnly = true)
     @Override
     public List<CamelRoute> findAll() {
         TypedQuery<CamelRoute> query = entityManager.createQuery("SELECT e FROM " + CamelRoute.class.getSimpleName()
-                + " e", CamelRoute.class);
+                + " e ", CamelRoute.class);
+        return query.getResultList();
+    }
+    
+    @Transactional(readOnly = true)
+    @Override
+    public List<CamelRoute> findAll(final SubjectType subject) {
+        TypedQuery<CamelRoute> query = entityManager.createQuery("SELECT e FROM " + CamelRoute.class.getSimpleName()
+                + " e WHERE e.subject = :subject", CamelRoute.class);
+        query.setParameter("subject",subject);
         return query.getResultList();
     }
 
@@ -48,8 +63,8 @@ public class RouteDAOImpl extends AbstractDAOImpl implements RouteDAO {
     }
 
     @Override
-    public void delete(Long id) {
-        CamelRoute route = find(id);
+    public void delete(Long id, final SubjectType subject) {
+        CamelRoute route = find(id, subject);
         if (route != null) {
             entityManager.remove(route);
         }

http://git-wip-us.apache.org/repos/asf/syncope/blob/0edb2a24/core/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java b/core/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java
index 9ad7396..137ae80 100644
--- a/core/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java
+++ b/core/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java
@@ -43,6 +43,7 @@ import org.apache.syncope.common.mod.StatusMod;
 import org.apache.syncope.common.mod.UserMod;
 import org.apache.syncope.common.to.PropagationStatus;
 import org.apache.syncope.common.to.UserTO;
+import org.apache.syncope.common.types.SubjectType;
 import org.apache.syncope.core.persistence.beans.CamelRoute;
 import org.apache.syncope.core.persistence.beans.user.SyncopeUser;
 import org.apache.syncope.core.persistence.dao.RouteDAO;
@@ -103,8 +104,8 @@ public class CamelUserProvisioningManager implements UserProvisioningManager {
         return contextFactory.getContext(routeDAO);
     }
 
-    protected List<CamelRoute> getRoutes() {
-        return routeDAO.findAll();
+    protected List<CamelRoute> getRoutes(SubjectType subject) {
+        return routeDAO.findAll(subject);
     }
 
     public void changeRoute(String routePath) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/0edb2a24/core/src/main/java/org/apache/syncope/core/provisioning/camel/SyncopeCamelContext.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/provisioning/camel/SyncopeCamelContext.java b/core/src/main/java/org/apache/syncope/core/provisioning/camel/SyncopeCamelContext.java
index 2873735..1a59a70 100644
--- a/core/src/main/java/org/apache/syncope/core/provisioning/camel/SyncopeCamelContext.java
+++ b/core/src/main/java/org/apache/syncope/core/provisioning/camel/SyncopeCamelContext.java
@@ -24,17 +24,15 @@ import java.net.URLDecoder;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import java.util.logging.Level;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
-import org.apache.camel.CamelContext;
 import org.apache.camel.model.Constants;
 import org.apache.camel.model.RouteDefinition;
-import org.apache.camel.model.RoutesDefinition;
 import org.apache.camel.spring.SpringCamelContext;
+import org.apache.syncope.common.types.SubjectType;
 import org.apache.syncope.core.persistence.beans.CamelRoute;
 import org.apache.syncope.core.persistence.dao.RouteDAO;
 import org.apache.syncope.core.util.ApplicationContextProvider;
@@ -61,7 +59,9 @@ public class SyncopeCamelContext {
         }
         if (camelContext.getRouteDefinitions().isEmpty()) {
 
-            List<CamelRoute> crl = routeDAO.findAll();
+            List<CamelRoute> crl = new ArrayList<CamelRoute>();
+            crl.addAll(routeDAO.findAll(SubjectType.USER));
+            crl.addAll(routeDAO.findAll(SubjectType.ROLE));
             LOG.info("{} route(s) are going to be loaded ", crl.size());
             loadContext(routeDAO, crl);
 
@@ -101,7 +101,9 @@ public class SyncopeCamelContext {
 
     public void reloadContext(RouteDAO routeDAO) {
 
-        List<CamelRoute> crl = routeDAO.findAll();
+        List<CamelRoute> crl = new ArrayList<CamelRoute>();
+        crl.addAll(routeDAO.findAll(SubjectType.USER));
+        crl.addAll(routeDAO.findAll(SubjectType.ROLE));
         if (camelContext == null) {
             getContext(routeDAO);
         } else {

http://git-wip-us.apache.org/repos/asf/syncope/blob/0edb2a24/core/src/main/java/org/apache/syncope/core/rest/controller/RouteController.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/rest/controller/RouteController.java b/core/src/main/java/org/apache/syncope/core/rest/controller/RouteController.java
index f905f2c..404e101 100644
--- a/core/src/main/java/org/apache/syncope/core/rest/controller/RouteController.java
+++ b/core/src/main/java/org/apache/syncope/core/rest/controller/RouteController.java
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import org.apache.syncope.common.to.RouteTO;
+import org.apache.syncope.common.types.SubjectType;
 import org.apache.syncope.core.persistence.beans.CamelRoute;
 import org.apache.syncope.core.persistence.dao.NotFoundException;
 import org.apache.syncope.core.persistence.dao.RouteDAO;
@@ -50,9 +51,9 @@ public class RouteController extends AbstractTransactionalController<RouteTO> {
 
     @PreAuthorize("hasRole('ROUTE_LIST')")
     @Transactional(readOnly = true)
-    public List<RouteTO> listRoutes() {
+    public List<RouteTO> listRoutes(final SubjectType subject) {
         List<RouteTO> routes = new ArrayList<RouteTO>();
-        Iterator it = routeDao.findAll().iterator();
+        Iterator it = routeDao.findAll(subject).iterator();
         while (it.hasNext()) {
             routes.add(binder.getRouteTO((CamelRoute) it.next()));
         }
@@ -69,6 +70,17 @@ public class RouteController extends AbstractTransactionalController<RouteTO> {
 
         return binder.getRouteTO(route);
     }
+    
+    @PreAuthorize("hasRole('ROUTE_READ')")
+    @Transactional(readOnly = true)
+    public RouteTO readRoute(Long id, SubjectType subject) {
+        CamelRoute route = routeDao.find(id, subject);
+        if (route == null) {
+            throw new NotFoundException("Route with id=" + id);
+        }
+
+        return binder.getRouteTO(route);
+    }
 
     @PreAuthorize("hasRole('ROUTE_UPDATE')")
     public void updateRoute(RouteTO routeTO) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/0edb2a24/core/src/main/java/org/apache/syncope/core/services/RouteServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/services/RouteServiceImpl.java b/core/src/main/java/org/apache/syncope/core/services/RouteServiceImpl.java
index 29359f8..71f94ac 100644
--- a/core/src/main/java/org/apache/syncope/core/services/RouteServiceImpl.java
+++ b/core/src/main/java/org/apache/syncope/core/services/RouteServiceImpl.java
@@ -36,10 +36,10 @@ import org.springframework.stereotype.Service;
 public class RouteServiceImpl extends AbstractServiceImpl implements RouteService {
     
     @Override
-    public Response getOptions(final SubjectType kind) {
+    public Response getOptions(final SubjectType subject) {
         String key;
         String value;
-        if (kind == SubjectType.USER) {
+        if (subject == SubjectType.USER) {
             key = RESTHeaders.CAMEL_USER_PROVISIONING_MANAGER;
             value = Boolean.toString(CamelDetector.isCamelEnabledForUsers());
         } else {
@@ -57,19 +57,29 @@ public class RouteServiceImpl extends AbstractServiceImpl implements RouteServic
     private RouteController controller;
 
     @Override
-    public List<RouteTO> getRoutes(SubjectType kind) {
+    public List<RouteTO> getRoutes(SubjectType subject) {
 
-        return controller.listRoutes();
+        return controller.listRoutes(subject);
     }
 
     @Override
-    public RouteTO getRoute(SubjectType kind, Long id) {
+    public RouteTO getRoute(Long id) {
 
         return controller.readRoute(id);
     }
+    
+    @Override
+    public RouteTO getRoute(SubjectType subject, Long Id) {
+        return controller.readRoute(Id, subject);
+    }
+
+    @Override
+    public void importRoute(Long id, RouteTO route) {
+        controller.updateRoute(route);
+    }
 
     @Override
-    public void importRoute(SubjectType kind,Long id, RouteTO route) {
+    public void importRoute(SubjectType kind, Long id, RouteTO route) {
         controller.updateRoute(route);
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/0edb2a24/core/src/main/resources/userRoute.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/userRoute.xml b/core/src/main/resources/userRoute.xml
index 763996d..6c5a394 100644
--- a/core/src/main/resources/userRoute.xml
+++ b/core/src/main/resources/userRoute.xml
@@ -29,14 +29,23 @@ under the License.
       main operations consist in user workflow creation and its propagation.         
   -->
   <routeContext id="defaultUserRoutes" xmlns="http://camel.apache.org/schema/spring">  	
+    <!--
+        CREATE USER
+        This is the entry point of the route and is involved in accepting
+        the UserTO. When it arrives, the user workflow is created. If the
+        creation is successfull, the result is sent to propagation, otherwise
+        if an exception was raised, the exception has to be returned to the
+        caller. The property actual allows to store the received UserTO in
+        order to use it later.
+    -->
+        
     <route id="createUser">
       <from uri="direct:createUser"/>
       <setProperty propertyName="actual">
         <simple>${body}</simple>
       </setProperty>
       <doTry>
-        <bean ref="uwfAdapter" 
-              method="create(${body},${property.disablePwdPolicyCheck},
+        <bean ref="uwfAdapter" method="create(${body},${property.disablePwdPolicyCheck},
                                  ${property.enabled},${property.storePassword})"/>
         <process ref="defaultUserCreatePropagation" />
         <to uri="direct:createPort"/>
@@ -101,7 +110,7 @@ under the License.
     <route id="syncUserStatus">
       <from uri="direct:syncUserStatus"/>
       <process ref="userStatusOnSync" />
-      <process ref="defaultUserUpdateSyncPropagation" />
+      <process ref="defaultUserUpdateInSyncPropagation" />
       <to uri="direct:updateSyncPort"/>
     </route>
     <!--
@@ -240,9 +249,11 @@ under the License.
       <process ref="defaultUserDeprovisionPropagation" />
       <to uri="direct:deprovisionPort"/>              
     </route>
-
-
-
+    
+    <!--
+        SUSPEND USER AFTER POLICY VIOLATION
+    -->
+        
     <route id="suspendUserWF">
       <from uri="direct:suspendUserWF"/>
       <doTry>
@@ -258,6 +269,43 @@ under the License.
         </doCatch>
       </doTry>  
     </route>
+        
+    <!--
+        REQUEST PASSWORD RESET ROUTE
+    -->
+        
+    <route id="requestPwdReset">
+      <from uri="direct:requestPwdReset"/>
+      <doTry>
+        <bean ref="uwfAdapter" method="requestPasswordReset(${body})"/>
+        <to uri="direct:requestPwdResetPort"/>
+        <doCatch>        
+          <exception>java.lang.RuntimeException</exception>
+          <handled>
+            <constant>false</constant>
+          </handled>
+          <to uri="direct:requestPwdResetPort"/>
+        </doCatch>
+      </doTry>  
+    </route>
+    <!--
+        CONFIRM PASSWORD RESET
+    -->
+    <route id="confirmPwdReset">
+      <from uri="direct:confirmPwdReset"/>
+      <doTry>
+        <bean ref="uwfAdapter" method="confirmPasswordReset(${property.userId},${property.token},${property.password})"/>
+        <process ref="defaultUserConfirmPwdResetPropagation" />
+        <to uri="direct:confirmPwdResetPort"/>
+        <doCatch>        
+          <exception>java.lang.RuntimeException</exception>
+          <handled>
+            <constant>false</constant>
+          </handled>
+          <to uri="direct:confirmPwdResetPort"/>
+        </doCatch>
+      </doTry>
+    </route>
 
   </routeContext>
 </beans>