You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2015/02/13 12:44:16 UTC

[12/51] [partial] syncope git commit: [SYNCOPE-620] Re-organization completed

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java
new file mode 100644
index 0000000..1ab407d
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/CollectionWrapper.java
@@ -0,0 +1,80 @@
+/*
+ * 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.common.rest.api;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import org.apache.syncope.common.lib.to.LoggerTO;
+import org.apache.syncope.common.lib.types.AuditLoggerName;
+import org.apache.syncope.common.lib.types.LoggerLevel;
+import org.apache.syncope.common.lib.wrap.AbstractWrappable;
+
+public final class CollectionWrapper {
+
+    private CollectionWrapper() {
+        // empty constructor for static utility class
+    }
+
+    public static <E, T extends AbstractWrappable<E>> List<T> wrap(final E element, final Class<T> reference) {
+        return Collections.singletonList(AbstractWrappable.getInstance(reference, element));
+    }
+
+    public static <E, T extends AbstractWrappable<E>> List<T> wrap(
+            final Collection<E> collection, final Class<T> reference) {
+
+        List<T> response = new ArrayList<T>();
+        for (E element : collection) {
+            response.add(AbstractWrappable.getInstance(reference, element));
+        }
+        return response;
+    }
+
+    public static <T extends AbstractWrappable<String>> List<String> unwrap(final Collection<T> collection) {
+        List<String> response = new ArrayList<String>();
+        for (T item : collection) {
+            response.add(item.getElement());
+        }
+        return response;
+    }
+
+    public static List<AuditLoggerName> wrapLogger(final Collection<LoggerTO> logger) {
+        List<AuditLoggerName> respons = new ArrayList<AuditLoggerName>();
+        for (LoggerTO l : logger) {
+            try {
+                respons.add(AuditLoggerName.fromLoggerName(l.getKey()));
+            } catch (Exception ignore) {
+                // ignore
+            }
+        }
+        return respons;
+    }
+
+    public static List<LoggerTO> unwrapLogger(final Collection<AuditLoggerName> auditNames) {
+        List<LoggerTO> respons = new ArrayList<LoggerTO>();
+        for (AuditLoggerName l : auditNames) {
+            LoggerTO loggerTO = new LoggerTO();
+            loggerTO.setKey(l.toLoggerName());
+            loggerTO.setLevel(LoggerLevel.DEBUG);
+            respons.add(loggerTO);
+        }
+        return respons;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/Preference.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/Preference.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/Preference.java
new file mode 100644
index 0000000..5cda9cf
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/Preference.java
@@ -0,0 +1,59 @@
+/*
+ * 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.common.rest.api;
+
+/**
+ * Preferences available to be specified during requests.
+ *
+ * @see RESTHeaders#PREFER
+ * @see RESTHeaders#PREFERENCE_APPLIED
+ */
+public enum Preference {
+
+    NONE(""),
+    RETURN_CONTENT("return-content"),
+    RETURN_NO_CONTENT("return-no-content");
+
+    private String literal;
+
+    private Preference(final String literal) {
+        this.literal = literal;
+    }
+
+    @Override
+    public String toString() {
+        return literal;
+    }
+
+    public static Preference fromString(final String literal) {
+        Preference result = null;
+
+        for (Preference preference : values()) {
+            if (preference.toString().equalsIgnoreCase(literal)) {
+                result = preference;
+            }
+        }
+
+        if (result == null) {
+            result = NONE;
+        }
+
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
new file mode 100644
index 0000000..93ea67e
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/RESTHeaders.java
@@ -0,0 +1,79 @@
+/*
+ * 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.common.rest.api;
+
+/**
+ * Custom HTTP headers in use with REST services.
+ */
+public final class RESTHeaders {
+
+    /**
+     * UserId option key.
+     */
+    public static final String USER_ID = "Syncope.UserId";
+
+    /**
+     * Username option key.
+     */
+    public static final String USERNAME = "Syncope.Username";
+
+    /**
+     * HTTP header key for object ID assigned to an object after its creation.
+     */
+    public static final String RESOURCE_ID = "Syncope.Id";
+
+    /**
+     * Declares the type of exception being raised.
+     *
+     * @see org.apache.syncope.common.lib.types.ClientExceptionType
+     */
+    public static final String ERROR_CODE = "X-Application-Error-Code";
+
+    /**
+     * Declares additional information for the exception being raised.
+     */
+    public static final String ERROR_INFO = "X-Application-Error-Info";
+
+    /**
+     * Mediatype for PNG images, not defined in <tt>javax.ws.rs.core.MediaType</tt>.
+     *
+     * @see javax.ws.rs.core.MediaType
+     */
+    public static final String MEDIATYPE_IMAGE_PNG = "image/png";
+
+    /**
+     * Allows the client to specify a preference for the result to be returned from the server.
+     * <a href="http://msdn.microsoft.com/en-us/library/hh537533.aspx">More information</a>.
+     *
+     * @see Preference
+     */
+    public static final String PREFER = "Prefer";
+
+    /**
+     * Allowd the server to inform the client about the fact that a specified preference was applied.
+     * <a href="http://msdn.microsoft.com/en-us/library/hh554623.aspx">More information</a>.
+     *
+     * @see Preference
+     */
+    public static final String PREFERENCE_APPLIED = "Preference-Applied";
+
+    private RESTHeaders() {
+        // Empty constructor for static utility class.
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java
new file mode 100644
index 0000000..3fa5f8a
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConfigurationService.java
@@ -0,0 +1,89 @@
+/*
+ * 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.common.rest.api.service;
+
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+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.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.ConfTO;
+
+/**
+ * REST operations for configuration.
+ */
+@Path("configurations")
+public interface ConfigurationService extends JAXRSService {
+
+    /**
+     * Exports internal storage content as downloadable XML file.
+     *
+     * @return internal storage content as downloadable XML file
+     */
+    @GET
+    @Path("stream")
+    Response export();
+
+    /**
+     * Returns all configuration parameters.
+     *
+     * @return all configuration parameters
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    ConfTO list();
+
+    /**
+     * Returns configuration parameter with matching key.
+     *
+     * @param key identifier of configuration to be read
+     * @return configuration parameter with matching key
+     */
+    @GET
+    @Path("{key}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    AttrTO read(@NotNull @PathParam("key") String key);
+
+    /**
+     * Creates / updates the configuration parameter with the given key.
+     *
+     * @param key parameter key
+     * @param value parameter value
+     */
+    @PUT
+    @Path("{key}")
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    void set(@NotNull @PathParam("key") String key, @NotNull AttrTO value);
+
+    /**
+     * Deletes the configuration parameter with matching key.
+     *
+     * @param key configuration parameter key
+     */
+    @DELETE
+    @Path("{key}")
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    void delete(@NotNull @PathParam("key") String key);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
new file mode 100644
index 0000000..91d982e
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
@@ -0,0 +1,201 @@
+/*
+ * 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.common.rest.api.service;
+
+import java.util.List;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+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.lib.to.BulkAction;
+import org.apache.syncope.common.lib.to.BulkActionResult;
+import org.apache.syncope.common.lib.to.ConnBundleTO;
+import org.apache.syncope.common.lib.to.ConnIdObjectClassTO;
+import org.apache.syncope.common.lib.to.ConnInstanceTO;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.types.ConnConfProperty;
+
+/**
+ * REST operations for connector bundles and instances.
+ */
+@Path("connectors")
+public interface ConnectorService extends JAXRSService {
+
+    /**
+     * Returns available connector bundles with property keys in selected language.
+     *
+     * @param lang language to select property keys; default language is English
+     * @return available connector bundles with property keys in selected language
+     */
+    @GET
+    @Path("bundles")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    List<ConnBundleTO> getBundles(@QueryParam("lang") String lang);
+
+    /**
+     * Returns configuration for given connector instance.
+     *
+     * @param connInstanceKey connector instance id to read configuration from
+     * @return configuration for given connector instance
+     */
+    @GET
+    @Path("{connInstanceKey}/configuration")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    List<ConnConfProperty> getConfigurationProperties(@NotNull @PathParam("connInstanceKey") Long connInstanceKey);
+
+    /**
+     * Returns schema names for connector bundle matching the given connector instance id.
+     *
+     * @param connInstanceKey connector instance id to be used for schema lookup
+     * @param connInstanceTO connector instance object to provide special configuration properties
+     * @param includeSpecial if set to true, special schema names (like '__PASSWORD__') will be included;
+     * default is false
+     * @return schema names for connector bundle matching the given connector instance id
+     */
+    @POST
+    @Path("{connInstanceKey}/schemaNames")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    List<PlainSchemaTO> getSchemaNames(@NotNull @PathParam("connInstanceKey") Long connInstanceKey,
+            @NotNull ConnInstanceTO connInstanceTO,
+            @QueryParam("includeSpecial") @DefaultValue("false") boolean includeSpecial);
+
+    /**
+     * Returns supported object classes for connector bundle matching the given connector instance id.
+     *
+     * @param connInstanceKey connector instance id to be used for schema lookup
+     * @param connInstanceTO connector instance object to provide special configuration properties
+     * @return supported object classes for connector bundle matching the given connector instance id
+     */
+    @POST
+    @Path("{connInstanceKey}/supportedObjectClasses")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    List<ConnIdObjectClassTO> getSupportedObjectClasses(
+            @NotNull @PathParam("connInstanceKey") Long connInstanceKey,
+            @NotNull ConnInstanceTO connInstanceTO);
+
+    /**
+     * Returns connector instance with matching id.
+     *
+     * @param connInstanceKey connector instance id to be read
+     * @return connector instance with matching id
+     */
+    @GET
+    @Path("{connInstanceKey}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    ConnInstanceTO read(@NotNull @PathParam("connInstanceKey") Long connInstanceKey);
+
+    /**
+     * Returns connector instance for matching resource.
+     *
+     * @param resourceName resource name to be used for connector lookup
+     * @return connector instance for matching resource
+     */
+    @GET
+    @Path("byResource/{resourceName}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    ConnInstanceTO readByResource(@NotNull @PathParam("resourceName") String resourceName);
+
+    /**
+     * Returns a list of all connector instances with property keys in the matching language.
+     *
+     * @param lang language to select property keys, null for default (English).
+     * An ISO 639 alpha-2 or alpha-3 language code, or a language subtag up to 8 characters in length.
+     * @return list of all connector instances with property keys in the matching language
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    List<ConnInstanceTO> list(@QueryParam("lang") String lang);
+
+    /**
+     * Creates a new connector instance.
+     *
+     * @param connInstanceTO connector instance to be created
+     * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created connector instance
+     */
+    @Descriptions({
+        @Description(target = DocTarget.RESPONSE,
+                value = "Featuring <tt>Location</tt> header of created connector instance")
+    })
+    @POST
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    Response create(@NotNull ConnInstanceTO connInstanceTO);
+
+    /**
+     * Updates the connector instance matching the provided id.
+     *
+     * @param connInstanceKey connector instance id to be updated
+     * @param connInstanceTO connector instance to be stored
+     */
+    @PUT
+    @Path("{connInstanceKey}")
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    void update(@NotNull @PathParam("connInstanceKey") Long connInstanceKey, @NotNull ConnInstanceTO connInstanceTO);
+
+    /**
+     * Deletes the connector instance matching the provided id.
+     *
+     * @param connInstanceKey connector instance id to be deleted
+     */
+    @DELETE
+    @Path("{connInstanceKey}")
+    void delete(@NotNull @PathParam("connInstanceKey") Long connInstanceKey);
+
+    /**
+     * @param connInstanceTO connector instance to be used for connection check
+     * @return true if connection could be established
+     */
+    @POST
+    @Path("check")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    boolean check(@NotNull ConnInstanceTO connInstanceTO);
+
+    /**
+     * Reload all connector bundles and instances.
+     */
+    @POST
+    @Path("reload")
+    void reload();
+
+    /**
+     * Executes the provided bulk action.
+     *
+     * @param bulkAction list of connector instance ids against which the bulk action will be performed.
+     * @return Bulk action result
+     */
+    @POST
+    @Path("bulk")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    BulkActionResult bulk(@NotNull BulkAction bulkAction);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/EntitlementService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/EntitlementService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/EntitlementService.java
new file mode 100644
index 0000000..44ad900
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/EntitlementService.java
@@ -0,0 +1,53 @@
+/*
+ * 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.common.rest.api.service;
+
+import java.util.List;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import org.apache.syncope.common.lib.wrap.EntitlementTO;
+
+/**
+ * REST operations for entitlements.
+ */
+@Path("entitlements")
+public interface EntitlementService extends JAXRSService {
+
+    /**
+     * Returns a list of all known entitlements.
+     *
+     * @return list of all known entitlements
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    List<EntitlementTO> getAllEntitlements();
+
+    /**
+     * Returns a list of entitlements assigned to user making the current request.
+     *
+     * @return list of entitlements assigned to user making the current request
+     */
+    @GET
+    @Path("own")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    List<EntitlementTO> getOwnEntitlements();
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java
new file mode 100644
index 0000000..7108b49
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/JAXRSService.java
@@ -0,0 +1,39 @@
+/*
+ * 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.common.rest.api.service;
+
+public interface JAXRSService {
+
+    final String PARAM_FIQL = "fiql";
+
+    final String PARAM_PAGE = "page";
+
+    final String DEFAULT_PARAM_PAGE = "1";
+
+    final int DEFAULT_PARAM_PAGE_VALUE = Integer.valueOf(DEFAULT_PARAM_PAGE);
+
+    final String PARAM_SIZE = "size";
+
+    final String DEFAULT_PARAM_SIZE = "25";
+
+    final int DEFAULT_PARAM_SIZE_VALUE = Integer.valueOf(DEFAULT_PARAM_SIZE);
+
+    final String PARAM_ORDERBY = "orderby";
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
new file mode 100644
index 0000000..6ab40e7
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/LoggerService.java
@@ -0,0 +1,98 @@
+/*
+ * 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.common.rest.api.service;
+
+import java.util.List;
+import javax.validation.constraints.NotNull;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import org.apache.syncope.common.lib.to.EventCategoryTO;
+import org.apache.syncope.common.lib.to.LoggerTO;
+import org.apache.syncope.common.lib.types.LoggerType;
+
+/**
+ * REST operations for logging and auditing.
+ */
+@Path("logger")
+public interface LoggerService extends JAXRSService {
+
+    /**
+     * Returns a list of all managed events in audit.
+     *
+     * @return list of all managed events in audit
+     */
+    @GET
+    @Path("events")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    List<EventCategoryTO> events();
+
+    /**
+     * Returns logger with matching type and name.
+     *
+     * @param type LoggerType to be selected.
+     * @param name Logger name to be read
+     * @return logger with matching type and name
+     */
+    @GET
+    @Path("{type}/{name}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    LoggerTO read(@NotNull @PathParam("type") LoggerType type, @NotNull @PathParam("name") final String name);
+
+    /**
+     * Returns a list of loggers with matching type.
+     *
+     * @param type LoggerType to be selected
+     * @return list of loggers with matching type
+     */
+    @GET
+    @Path("{type}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    List<LoggerTO> list(@NotNull @PathParam("type") LoggerType type);
+
+    /**
+     * Creates or updates (if existing) the logger with matching name.
+     *
+     * @param type LoggerType to be selected
+     * @param name Logger name to be updated
+     * @param logger Logger to be created or updated
+     */
+    @PUT
+    @Path("{type}/{name}")
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    void update(@NotNull @PathParam("type") LoggerType type, @NotNull @PathParam("name") String name,
+            @NotNull LoggerTO logger);
+
+    /**
+     * Deletes the logger with matching name.
+     *
+     * @param type LoggerType to be selected
+     * @param name Logger name to be deleted
+     */
+    @DELETE
+    @Path("{type}/{name}")
+    void delete(@NotNull @PathParam("type") LoggerType type, @NotNull @PathParam("name") String name);
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java
new file mode 100644
index 0000000..a210014
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/NotificationService.java
@@ -0,0 +1,97 @@
+/*
+ * 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.common.rest.api.service;
+
+import java.util.List;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+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.lib.to.NotificationTO;
+
+/**
+ * REST operations for notifications.
+ */
+@Path("notifications")
+public interface NotificationService extends JAXRSService {
+
+    /**
+     * Returns notification with matching id.
+     *
+     * @param notificationKey key of notification to be read
+     * @return notification with matching key
+     */
+    @GET
+    @Path("{notificationKey}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    NotificationTO read(@NotNull @PathParam("notificationKey") Long notificationKey);
+
+    /**
+     * Returns a list of all notifications.
+     *
+     * @return list of all notifications.
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    List<NotificationTO> list();
+
+    /**
+     * Creates a new notification.
+     *
+     * @param notificationTO Creates a new notification.
+     * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created notification
+     */
+    @Descriptions({
+        @Description(target = DocTarget.RESPONSE,
+                value = "Featuring <tt>Location</tt> header of created notification")
+    })
+    @POST
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    Response create(@NotNull NotificationTO notificationTO);
+
+    /**
+     * Updates the notification matching the given key.
+     *
+     * @param notificationKey key of notification to be updated
+     * @param notificationTO notification to be stored
+     */
+    @PUT
+    @Path("{notificationKey}")
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    void update(@NotNull @PathParam("notificationKey") Long notificationKey, @NotNull NotificationTO notificationTO);
+
+    /**
+     * Deletes the notification matching the given key.
+     *
+     * @param notificationKey key for notification to be deleted
+     */
+    @DELETE
+    @Path("{notificationKey}")
+    void delete(@NotNull @PathParam("notificationKey") Long notificationKey);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
new file mode 100644
index 0000000..c2a4e6a
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/PolicyService.java
@@ -0,0 +1,117 @@
+/*
+ * 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.common.rest.api.service;
+
+import java.util.List;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.MatrixParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+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.lib.to.AbstractPolicyTO;
+import org.apache.syncope.common.lib.types.PolicyType;
+
+/**
+ * REST operations for policies.
+ */
+@Path("policies")
+public interface PolicyService extends JAXRSService {
+
+    /**
+     * Returns the policy matching the given key.
+     *
+     * @param policyKey key of requested policy
+     * @param <T> response type (extending PolicyTO)
+     * @return policy with matching id
+     */
+    @GET
+    @Path("{policyKey}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    <T extends AbstractPolicyTO> T read(@NotNull @PathParam("policyKey") Long policyKey);
+
+    /**
+     * Returns the global policy for the given type.
+     *
+     * @param type PolicyType to read global policy from
+     * @param <T> response type (extending PolicyTO)
+     * @return global policy for matching type
+     */
+    @GET
+    @Path("global")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    <T extends AbstractPolicyTO> T readGlobal(@NotNull @MatrixParam("type") PolicyType type);
+
+    /**
+     * Returns a list of policies of the matching type.
+     *
+     * @param type Type selector for requested policies
+     * @param <T> response type (extending PolicyTO)
+     * @return list of policies with matching type
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    <T extends AbstractPolicyTO> List<T> list(@NotNull @MatrixParam("type") PolicyType type);
+
+    /**
+     * Create a new policy.
+     *
+     * @param policyTO Policy to be created (needs to match type)
+     * @param <T> response type (extending PolicyTO)
+     * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created policy
+     */
+    @Descriptions({
+        @Description(target = DocTarget.RESPONSE, value = "Featuring <tt>Location</tt> header of created policy")
+    })
+    @POST
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    <T extends AbstractPolicyTO> Response create(@NotNull T policyTO);
+
+    /**
+     * Updates policy matching the given key.
+     *
+     * @param policyKey key of policy to be updated
+     * @param policyTO Policy to replace existing policy
+     * @param <T> response type (extending PolicyTO)
+     */
+    @PUT
+    @Path("{policyKey}")
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    <T extends AbstractPolicyTO> void update(@NotNull @PathParam("policyKey") Long policyKey, @NotNull T policyTO);
+
+    /**
+     * Delete policy matching the given key.
+     *
+     * @param policyKey key of policy to be deleted
+     * @param <T> response type (extending PolicyTO)
+     */
+    @DELETE
+    @Path("{policyKey}")
+    <T extends AbstractPolicyTO> void delete(@NotNull @PathParam("policyKey") Long policyKey);
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java
new file mode 100644
index 0000000..1e9f943
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ReportService.java
@@ -0,0 +1,195 @@
+/*
+ * 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.common.rest.api.service;
+
+import java.util.List;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+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.lib.to.PagedResult;
+import org.apache.syncope.common.lib.to.ReportExecTO;
+import org.apache.syncope.common.lib.to.ReportTO;
+import org.apache.syncope.common.lib.types.ReportExecExportFormat;
+import org.apache.syncope.common.lib.wrap.ReportletConfClass;
+
+/**
+ * REST operations for reports.
+ */
+@Path("reports")
+public interface ReportService extends JAXRSService {
+
+    /**
+     * Returns a list of available classes for reportlet configuration.
+     *
+     * @return list of available classes for reportlet configuration
+     */
+    @GET
+    @Path("reportletConfClasses")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    List<ReportletConfClass> getReportletConfClasses();
+
+    /**
+     * Returns report with matching key.
+     *
+     * @param reportKey key of report to be read
+     * @return report with matching key
+     */
+    @GET
+    @Path("{reportKey}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    ReportTO read(@NotNull @PathParam("reportKey") Long reportKey);
+
+    /**
+     * Returns report execution with matching key.
+     *
+     * @param executionKey report execution id to be selected
+     * @return report execution with matching key
+     */
+    @GET
+    @Path("executions/{executionKey}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    ReportExecTO readExecution(@NotNull @PathParam("executionKey") Long executionKey);
+
+    /**
+     * Returns a paged list of all existing reports.
+     *
+     * @return paged list of all existing reports
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    PagedResult<ReportTO> list();
+
+    /**
+     * Returns a paged list of all existing reports.
+     *
+     * @param orderBy list of ordering clauses, separated by comma
+     * @return paged list of all existing reports
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    PagedResult<ReportTO> list(@QueryParam(PARAM_ORDERBY) String orderBy);
+
+    /**
+     * Returns a paged list of all existing reports matching page/size conditions.
+     *
+     * @param page selected page in relation to size
+     * @param size number of entries per page
+     * @return paged list of existing reports matching page/size conditions
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    PagedResult<ReportTO> list(
+            @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
+            @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size);
+
+    /**
+     * Returns a paged list of all existing reports matching page/size conditions.
+     *
+     * @param page selected page in relation to size
+     * @param size number of entries per page
+     * @param orderBy list of ordering clauses, separated by comma
+     * @return paged list of existing reports matching page/size conditions
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    PagedResult<ReportTO> list(
+            @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
+            @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size,
+            @QueryParam(PARAM_ORDERBY) String orderBy);
+
+    /**
+     * Creates a new report.
+     *
+     * @param reportTO report to be created
+     * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created report
+     */
+    @Descriptions({
+        @Description(target = DocTarget.RESPONSE, value = "Featuring <tt>Location</tt> header of created report")
+    })
+    @POST
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    Response create(@NotNull ReportTO reportTO);
+
+    /**
+     * Updates report with matching key.
+     *
+     * @param reportKey id for report to be updated
+     * @param reportTO report to be stored
+     */
+    @PUT
+    @Path("{reportKey}")
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    void update(@NotNull @PathParam("reportKey") Long reportKey, ReportTO reportTO);
+
+    /**
+     * Deletes report with matching key.
+     *
+     * @param reportKey Deletes report with matching key
+     */
+    @DELETE
+    @Path("{reportKey}")
+    void delete(@NotNull @PathParam("reportKey") Long reportKey);
+
+    /**
+     * Deletes report execution with matching key.
+     *
+     * @param executionKey key of execution report to be deleted
+     */
+    @DELETE
+    @Path("executions/{executionKey}")
+    void deleteExecution(@NotNull @PathParam("executionKey") Long executionKey);
+
+    /**
+     * Executes the report with matching key.
+     *
+     * @param reportKey key of report to be executed
+     * @return report execution result
+     */
+    @POST
+    @Path("{reportKey}/execute")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    ReportExecTO execute(@NotNull @PathParam("reportKey") Long reportKey);
+
+    /**
+     * Exports the report execution with matching key in the requested format.
+     *
+     * @param executionKey key of execution report to be selected
+     * @param fmt file-format selection
+     * @return a stream for content download
+     */
+    @GET
+    @Path("executions/{executionKey}/stream")
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    Response exportExecutionResult(@NotNull @PathParam("executionKey") Long executionKey,
+            @QueryParam("format") ReportExecExportFormat fmt);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
new file mode 100644
index 0000000..9199d37
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
@@ -0,0 +1,162 @@
+/*
+ * 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.common.rest.api.service;
+
+import java.util.List;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+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.lib.to.BulkAction;
+import org.apache.syncope.common.lib.to.BulkActionResult;
+import org.apache.syncope.common.lib.to.ConnObjectTO;
+import org.apache.syncope.common.lib.to.ResourceTO;
+import org.apache.syncope.common.lib.types.ResourceDeassociationActionType;
+import org.apache.syncope.common.lib.types.SubjectType;
+import org.apache.syncope.common.lib.wrap.SubjectKey;
+
+/**
+ * REST operations for external resources.
+ */
+@Path("resources")
+public interface ResourceService extends JAXRSService {
+
+    /**
+     * Returns connector object from the external resource, for the given type and key.
+     *
+     * @param resourceKey Name of resource to read connector object from
+     * @param type user / role
+     * @param key user key / role key
+     * @return connector object from the external resource, for the given type and key
+     */
+    @GET
+    @Path("{resourceKey}/{type}/{key}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    ConnObjectTO getConnectorObject(@NotNull @PathParam("resourceKey") String resourceKey,
+            @NotNull @PathParam("type") SubjectType type, @NotNull @PathParam("key") Long key);
+
+    /**
+     * Returns the resource with matching name.
+     *
+     * @param resourceKey Name of resource to be read
+     * @return resource with matching name
+     */
+    @GET
+    @Path("{resourceKey}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    ResourceTO read(@NotNull @PathParam("resourceKey") String resourceKey);
+
+    /**
+     * Returns a list of all resources.
+     *
+     * @return list of all resources
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    List<ResourceTO> list();
+
+    /**
+     * Creates a new resource.
+     *
+     * @param resourceTO Resource to be created
+     * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created resource
+     */
+    @Descriptions({
+        @Description(target = DocTarget.RESPONSE,
+                value = "Featuring <tt>Location</tt> header of created resource")
+    })
+    @POST
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    Response create(@NotNull ResourceTO resourceTO);
+
+    /**
+     * Updates the resource matching the given name.
+     *
+     * @param resourceKey name of resource to be updated
+     * @param resourceTO resource to be stored
+     */
+    @PUT
+    @Path("{resourceKey}")
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    void update(@NotNull @PathParam("resourceKey") String resourceKey, @NotNull ResourceTO resourceTO);
+
+    /**
+     * Deletes the resource matching the given name.
+     *
+     * @param resourceKey name of resource to be deleted
+     */
+    @DELETE
+    @Path("{resourceKey}")
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    void delete(@NotNull @PathParam("resourceKey") String resourceKey);
+
+    /**
+     * Checks wether the connection to resource could be established.
+     *
+     * @param resourceTO resource to be checked
+     * @return true if connection to resource could be established
+     */
+    @POST
+    @Path("check")
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    boolean check(@NotNull ResourceTO resourceTO);
+
+    /**
+     * De-associate users or roles (depending on the provided subject type) from the given resource.
+     *
+     * @param resourceKey name of resource
+     * @param subjectType subject type (user or role)
+     * @param type resource de-association action type
+     * @param subjectKeys users or roles against which the bulk action will be performed
+     * @return <tt>Response</tt> object featuring {@link BulkActionResult} as <tt>Entity</tt>
+     */
+    @Descriptions({
+        @Description(target = DocTarget.RESPONSE,
+                value = "Featuring <tt>BulkActionResult</tt> as <tt>Entity</tt>")
+    })
+    @POST
+    @Path("{resourceKey}/bulkDeassociation/{subjType}/{type}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    BulkActionResult bulkDeassociation(@NotNull @PathParam("resourceKey") String resourceKey,
+            @NotNull @PathParam("subjType") SubjectType subjectType,
+            @NotNull @PathParam("type") ResourceDeassociationActionType type, @NotNull List<SubjectKey> subjectKeys);
+
+    /**
+     * Executes the provided bulk action.
+     *
+     * @param bulkAction list of resource names against which the bulk action will be performed
+     * @return Bulk action result
+     */
+    @POST
+    @Path("bulk")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    BulkActionResult bulk(@NotNull BulkAction bulkAction);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
new file mode 100644
index 0000000..5d1b737
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/RoleService.java
@@ -0,0 +1,312 @@
+/*
+ * 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.common.rest.api.service;
+
+import java.util.List;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+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.lib.mod.RoleMod;
+import org.apache.syncope.common.lib.to.BulkAction;
+import org.apache.syncope.common.lib.to.BulkActionResult;
+import org.apache.syncope.common.lib.to.PagedResult;
+import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.types.ResourceAssociationActionType;
+import org.apache.syncope.common.lib.types.ResourceDeassociationActionType;
+import org.apache.syncope.common.lib.wrap.ResourceName;
+
+/**
+ * REST operations for roles.
+ */
+@Path("roles")
+public interface RoleService extends JAXRSService {
+
+    /**
+     * Returns children roles of given role.
+     *
+     * @param roleKey key of role to get children from
+     * @return children roles of given role
+     */
+    @GET
+    @Path("{roleKey}/children")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    List<RoleTO> children(@NotNull @PathParam("roleKey") Long roleKey);
+
+    /**
+     * Returns parent role of the given role (or null if no parent exists).
+     *
+     * @param roleKey key of role to get parent role from
+     * @return parent role of the given role (or null if no parent exists)
+     */
+    @GET
+    @Path("{roleKey}/parent")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    RoleTO parent(@NotNull @PathParam("roleKey") Long roleKey);
+
+    /**
+     * Reads the role matching the provided roleKey.
+     *
+     * @param roleKey key of role to be read
+     * @return role with matching id
+     */
+    @GET
+    @Path("{roleKey}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    RoleTO read(@NotNull @PathParam("roleKey") Long roleKey);
+
+    /**
+     * This method is similar to {@link #read(Long)}, but uses different authentication handling to ensure that a user
+     * can read his own roles.
+     *
+     * @param roleKey key of role to be read
+     * @return role with matching id
+     */
+    @Descriptions({
+        @Description(target = DocTarget.METHOD,
+                value = "This method is similar to <tt>read()</tt>, but uses different authentication handling to "
+                + "ensure that a user can read his own roles.")
+    })
+    @GET
+    @Path("{roleKey}/own")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    RoleTO readSelf(@NotNull @PathParam("roleKey") Long roleKey);
+
+    /**
+     * Returns a paged list of existing roles.
+     *
+     * @return paged list of all existing roles
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    PagedResult<RoleTO> list();
+
+    /**
+     * Returns a paged list of existing roles.
+     *
+     * @param orderBy list of ordering clauses, separated by comma
+     * @return paged list of all existing roles
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    PagedResult<RoleTO> list(@QueryParam(PARAM_ORDERBY) String orderBy);
+
+    /**
+     * Returns a paged list of existing roles matching page/size conditions.
+     *
+     * @param page result page number
+     * @param size number of entries per page
+     * @return paged list of existing roles matching page/size conditions
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    PagedResult<RoleTO> list(
+            @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
+            @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size);
+
+    /**
+     * Returns a paged list of existing roles matching page/size conditions.
+     *
+     * @param page result page number
+     * @param size number of entries per page
+     * @param orderBy list of ordering clauses, separated by comma
+     * @return paged list of existing roles matching page/size conditions
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    PagedResult<RoleTO> list(
+            @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
+            @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size,
+            @QueryParam(PARAM_ORDERBY) String orderBy);
+
+    /**
+     * Returns a paged list of roles matching the provided FIQL search condition.
+     *
+     * @param fiql FIQL search expression
+     * @return paged list of roles matching the provided FIQL search condition
+     */
+    @GET
+    @Path("search")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    PagedResult<RoleTO> search(@NotNull @QueryParam(PARAM_FIQL) String fiql);
+
+    /**
+     * Returns a paged list of roles matching the provided FIQL search condition.
+     *
+     * @param fiql FIQL search expression
+     * @param orderBy list of ordering clauses, separated by comma
+     * @return paged list of roles matching the provided FIQL search condition
+     */
+    @GET
+    @Path("search")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    PagedResult<RoleTO> search(
+            @NotNull @QueryParam(PARAM_FIQL) String fiql, @QueryParam(PARAM_ORDERBY) String orderBy);
+
+    /**
+     * Returns a paged list of roles matching the provided FIQL search condition.
+     *
+     * @param fiql FIQL search expression
+     * @param page result page number
+     * @param size number of entries per page
+     * @return paged list of roles matching the provided FIQL search condition
+     */
+    @GET
+    @Path("search")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    PagedResult<RoleTO> search(@QueryParam(PARAM_FIQL) String fiql,
+            @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
+            @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size);
+
+    /**
+     * Returns a paged list of roles matching the provided FIQL search condition.
+     *
+     * @param fiql FIQL search expression
+     * @param page result page number
+     * @param size number of entries per page
+     * @param orderBy list of ordering clauses, separated by comma
+     * @return paged list of roles matching the provided FIQL search condition
+     */
+    @GET
+    @Path("search")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    PagedResult<RoleTO> search(@QueryParam(PARAM_FIQL) String fiql,
+            @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
+            @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size,
+            @QueryParam(PARAM_ORDERBY) String orderBy);
+
+    /**
+     * Creates a new role.
+     *
+     * @param roleTO role to be created
+     * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created role as well as the role itself
+     * enriched with propagation status information - {@link RoleTO} as <tt>Entity</tt>
+     */
+    @Descriptions({
+        @Description(target = DocTarget.RESPONSE,
+                value = "Featuring <tt>Location</tt> header of created role as well as the "
+                + "role itself enriched with propagation status information - <tt>RoleTO</tt> as <tt>Entity</tt>")
+    })
+    @POST
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    Response create(@NotNull RoleTO roleTO);
+
+    /**
+     * Updates role matching the provided roleKey.
+     *
+     * @param roleKey key of role to be updated
+     * @param roleMod modification to be applied to role matching the provided roleKey
+     * @return <tt>Response</tt> object featuring the updated role enriched with propagation status information
+     * - {@link RoleTO} as <tt>Entity</tt>
+     */
+    @Descriptions({
+        @Description(target = DocTarget.RESPONSE,
+                value = "Featuring the updated role enriched with propagation status information - "
+                + "<tt>RoleTO</tt> as <tt>Entity</tt>")
+    })
+    @POST
+    @Path("{roleKey}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    Response update(@NotNull @PathParam("roleKey") Long roleKey, @NotNull RoleMod roleMod);
+
+    /**
+     * Deletes role matching provided roleKey.
+     *
+     * @param roleKey key of role to be deleted
+     * @return <tt>Response</tt> object featuring the deleted role enriched with propagation status information
+     * - {@link RoleTO} as <tt>Entity</tt>
+     */
+    @Descriptions({
+        @Description(target = DocTarget.RESPONSE,
+                value = "Featuring the deleted role enriched with propagation status information - "
+                + "<tt>RoleTO</tt> as <tt>Entity</tt>")
+    })
+    @DELETE
+    @Path("{roleKey}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    Response delete(@NotNull @PathParam("roleKey") Long roleKey);
+
+    /**
+     * Executes resource-related operations on given role.
+     *
+     * @param roleKey role id.
+     * @param type resource association action type
+     * @param resourceNames external resources to be used for propagation-related operations
+     * @return <tt>Response</tt> object featuring
+     * {@link BulkActionResult} as <tt>Entity</tt>
+     */
+    @Descriptions({
+        @Description(target = DocTarget.RESPONSE,
+                value = "Featuring <tt>BulkActionResult</tt> as <tt>Entity</tt>")
+    })
+    @POST
+    @Path("{roleKey}/deassociate/{type}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    Response bulkDeassociation(@NotNull @PathParam("roleKey") Long roleKey,
+            @NotNull @PathParam("type") ResourceDeassociationActionType type,
+            @NotNull List<ResourceName> resourceNames);
+
+    /**
+     * Executes resource-related operations on given role.
+     *
+     * @param roleKey role id.
+     * @param type resource association action type
+     * @param resourceNames external resources to be used for propagation-related operations
+     * @return <tt>Response</tt> object featuring {@link BulkActionResult} as <tt>Entity</tt>
+     */
+    @Descriptions({
+        @Description(target = DocTarget.RESPONSE,
+                value = "Featuring <tt>BulkActionResult</tt> as <tt>Entity</tt>")
+    })
+    @POST
+    @Path("{roleKey}/associate/{type}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    Response bulkAssociation(@NotNull @PathParam("roleKey") Long roleKey,
+            @NotNull @PathParam("type") ResourceAssociationActionType type,
+            @NotNull List<ResourceName> resourceNames);
+
+    /**
+     * Executes the provided bulk action.
+     *
+     * @param bulkAction list of role ids against which the bulk action will be performed.
+     * @return Bulk action result
+     */
+    @POST
+    @Path("bulk")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    BulkActionResult bulk(@NotNull BulkAction bulkAction);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
new file mode 100644
index 0000000..d3f850b
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SchemaService.java
@@ -0,0 +1,119 @@
+/*
+ * 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.common.rest.api.service;
+
+import java.util.List;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+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.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.SchemaType;
+
+/**
+ * REST operations for attribute schemas.
+ */
+@Path("schemas/{kind}/{type}")
+public interface SchemaService extends JAXRSService {
+
+    /**
+     * Returns schema matching the given kind, type and name.
+     *
+     * @param <T> actual SchemaTO
+     * @param attrType kind for schemas to be read
+     * @param schemaType type for schemas to be read
+     * @param schemaKey name of schema to be read
+     * @return schema matching the given kind, type and name
+     */
+    @GET
+    @Path("{key}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    <T extends AbstractSchemaTO> T read(@NotNull @PathParam("kind") AttributableType attrType,
+            @NotNull @PathParam("type") SchemaType schemaType, @NotNull @PathParam("key") String schemaKey);
+
+    /**
+     * Returns a list of schemas with matching kind and type.
+     *
+     * @param <T> actual SchemaTO
+     * @param attrType kind for schemas to be listed
+     * @param schemaType type for schemas to be listed
+     * @return list of schemas with matching kind and type
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    <T extends AbstractSchemaTO> List<T> list(
+            @NotNull @PathParam("kind") AttributableType attrType, @NotNull @PathParam("type") SchemaType schemaType);
+
+    /**
+     * Creates a new schema.
+     *
+     * @param <T> actual SchemaTO
+     * @param attrType kind for schema to be created
+     * @param schemaType type for schema to be created
+     * @param schemaTO schema to be created
+     * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created schema
+     */
+    @Descriptions({
+        @Description(target = DocTarget.RESPONSE, value = "Featuring <tt>Location</tt> header of created schema")
+    })
+    @POST
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    <T extends AbstractSchemaTO> Response create(@NotNull @PathParam("kind") AttributableType attrType,
+            @NotNull @PathParam("type") SchemaType schemaType, @NotNull T schemaTO);
+
+    /**
+     * Updates the schema matching the given kind, type and name.
+     *
+     * @param <T> actual SchemaTO
+     * @param attrType kind for schemas to be updated
+     * @param schemaType type for schemas to be updated
+     * @param schemaKey name of schema to be updated
+     * @param schemaTO updated schema to be stored
+     */
+    @PUT
+    @Path("{key}")
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    <T extends AbstractSchemaTO> void update(@NotNull @PathParam("kind") AttributableType attrType,
+            @NotNull @PathParam("type") SchemaType schemaType,
+            @NotNull @PathParam("key") String schemaKey, @NotNull T schemaTO);
+
+    /**
+     * Deletes the schema matching the given kind, type and name.
+     *
+     * @param attrType kind for schema to be deleted
+     * @param schemaType type for schema to be deleted
+     * @param schemaKey name of schema to be deleted
+     */
+    @DELETE
+    @Path("{key}")
+    void delete(@NotNull @PathParam("kind") AttributableType attrType,
+            @NotNull @PathParam("type") SchemaType schemaType,
+            @NotNull @PathParam("key") String schemaKey);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java
new file mode 100644
index 0000000..12a73cf
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SecurityQuestionService.java
@@ -0,0 +1,110 @@
+/*
+ * 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.common.rest.api.service;
+
+import java.util.List;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+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.lib.to.SecurityQuestionTO;
+
+/**
+ * REST operations for configuration.
+ */
+@Path("securityQuestions")
+public interface SecurityQuestionService extends JAXRSService {
+
+    /**
+     * Returns a list of all security questions.
+     *
+     * @return list of all security questions
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    List<SecurityQuestionTO> list();
+
+    /**
+     * Returns security question with matching id.
+     *
+     * @param securityQuestionId security question id to be read
+     * @return security question with matching id
+     */
+    @GET
+    @Path("{securityQuestionId}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    SecurityQuestionTO read(@NotNull @PathParam("securityQuestionId") Long securityQuestionId);
+
+    /**
+     * Creates a new security question.
+     *
+     * @param securityQuestionTO security question to be created
+     * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created security question
+     */
+    @Descriptions({
+        @Description(target = DocTarget.RESPONSE,
+                value = "Featuring <tt>Location</tt> header of created security question")
+    })
+    @POST
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    Response create(@NotNull SecurityQuestionTO securityQuestionTO);
+
+    /**
+     * Updates the security question matching the provided id.
+     *
+     * @param securityQuestionId security question id to be updated
+     * @param securityQuestionTO security question to be stored
+     */
+    @PUT
+    @Path("{securityQuestionId}")
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    void update(@NotNull @PathParam("securityQuestionId") Long securityQuestionId,
+            @NotNull SecurityQuestionTO securityQuestionTO);
+
+    /**
+     * Deletes the security question matching the provided id.
+     *
+     * @param securityQuestionId security question id to be deleted
+     */
+    @DELETE
+    @Path("{securityQuestionId}")
+    void delete(@NotNull @PathParam("securityQuestionId") Long securityQuestionId);
+
+    /**
+     * Ask for security question configured for the user matching the given username, if any.
+     *
+     * @param username username for which the security question is requested
+     * @return security question, if configured for the user matching the given username
+     */
+    @GET
+    @Path("byUser/{username}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    SecurityQuestionTO readByUser(@NotNull @PathParam("username") String username);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SyncopeService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SyncopeService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SyncopeService.java
new file mode 100644
index 0000000..cdd6dbc
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/SyncopeService.java
@@ -0,0 +1,33 @@
+/*
+ * 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.common.rest.api.service;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import org.apache.syncope.common.lib.to.SyncopeTO;
+
+@Path("")
+public interface SyncopeService extends JAXRSService {
+
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    SyncopeTO info();
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
new file mode 100644
index 0000000..24c9b0e
--- /dev/null
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/TaskService.java
@@ -0,0 +1,211 @@
+/*
+ * 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.common.rest.api.service;
+
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.MatrixParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+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.lib.to.AbstractTaskTO;
+import org.apache.syncope.common.lib.to.BulkAction;
+import org.apache.syncope.common.lib.to.BulkActionResult;
+import org.apache.syncope.common.lib.to.PagedResult;
+import org.apache.syncope.common.lib.to.ReportExecTO;
+import org.apache.syncope.common.lib.to.SchedTaskTO;
+import org.apache.syncope.common.lib.to.TaskExecTO;
+import org.apache.syncope.common.lib.types.TaskType;
+
+/**
+ * REST operations for tasks.
+ */
+@Path("tasks")
+public interface TaskService extends JAXRSService {
+
+    /**
+     * Returns the task matching the given key.
+     *
+     * @param taskKey key of task to be read
+     * @param <T> type of taskTO
+     * @return task with matching id
+     */
+    @GET
+    @Path("{taskKey}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    <T extends AbstractTaskTO> T read(@NotNull @PathParam("taskKey") Long taskKey);
+
+    /**
+     * Returns the task execution with the given id.
+     *
+     * @param executionKey key of task execution to be read
+     * @return task execution with matching Id
+     */
+    @GET
+    @Path("executions/{executionKey}")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    TaskExecTO readExecution(@NotNull @PathParam("executionKey") Long executionKey);
+
+    /**
+     * Returns a list of tasks with matching type.
+     *
+     * @param taskType type of tasks to be listed
+     * @param <T> type of taskTO
+     * @return list of tasks with matching type
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    <T extends AbstractTaskTO> PagedResult<T> list(@NotNull @MatrixParam("type") TaskType taskType);
+
+    /**
+     * Returns a list of tasks with matching type.
+     *
+     * @param taskType type of tasks to be listed
+     * @param orderBy list of ordering clauses, separated by comma
+     * @param <T> type of taskTO
+     * @return list of tasks with matching type
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    <T extends AbstractTaskTO> PagedResult<T> list(@NotNull @MatrixParam("type") TaskType taskType,
+            @QueryParam(PARAM_ORDERBY) String orderBy);
+
+    /**
+     * Returns a paged list of existing tasks matching type and page/size conditions.
+     *
+     * @param taskType type of tasks to be listed
+     * @param page page number of tasks in relation to page size
+     * @param size number of tasks listed per page
+     * @param orderBy list of ordering clauses, separated by comma
+     * @param <T> type of taskTO
+     * @return paged list of existing tasks matching type and page/size conditions
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    <T extends AbstractTaskTO> PagedResult<T> list(@NotNull @MatrixParam("type") TaskType taskType,
+            @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
+            @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size,
+            @QueryParam(PARAM_ORDERBY) String orderBy);
+
+    /**
+     * Returns a paged list of existing tasks matching type and page/size conditions.
+     *
+     * @param taskType type of tasks to be listed
+     * @param page page number of tasks in relation to page size
+     * @param size number of tasks listed per page
+     * @param <T> type of taskTO
+     * @return paged list of existing tasks matching type and page/size conditions
+     */
+    @GET
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    <T extends AbstractTaskTO> PagedResult<T> list(@MatrixParam("type") TaskType taskType,
+            @NotNull @Min(1) @QueryParam(PARAM_PAGE) @DefaultValue(DEFAULT_PARAM_PAGE) Integer page,
+            @NotNull @Min(1) @QueryParam(PARAM_SIZE) @DefaultValue(DEFAULT_PARAM_SIZE) Integer size);
+
+    /**
+     * Creates a new task.
+     *
+     * @param taskTO task to be created
+     * @param <T> type of taskTO
+     * @return <tt>Response</tt> object featuring <tt>Location</tt> header of created task
+     */
+    @Descriptions({
+        @Description(target = DocTarget.RESPONSE, value = "Featuring <tt>Location</tt> header of created task")
+    })
+    @POST
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    <T extends SchedTaskTO> Response create(@NotNull T taskTO);
+
+    /**
+     * Updates the task matching the provided key.
+     *
+     * @param taskKey key of task to be updated
+     * @param taskTO updated task to be stored
+     */
+    @PUT
+    @Path("{taskKey}")
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    void update(@NotNull @PathParam("taskKey") Long taskKey, @NotNull AbstractTaskTO taskTO);
+
+    /**
+     * Deletes the task matching the provided key.
+     *
+     * @param taskKey key of task to be deleted
+     */
+    @DELETE
+    @Path("{taskKey}")
+    void delete(@NotNull @PathParam("taskKey") Long taskKey);
+
+    /**
+     * Deletes the task execution matching the provided key.
+     *
+     * @param executionKey key of task execution to be deleted
+     */
+    @DELETE
+    @Path("executions/{executionKey}")
+    void deleteExecution(@NotNull @PathParam("executionKey") Long executionKey);
+
+    /**
+     * Executes the task matching the given id.
+     *
+     * @param taskKey key of task to be executed
+     * @param dryRun if true, task will only be simulated
+     * @return execution report for the task matching the given id
+     */
+    @POST
+    @Path("{taskKey}/execute")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    TaskExecTO execute(@NotNull @PathParam("taskKey") Long taskKey,
+            @QueryParam("dryRun") @DefaultValue("false") boolean dryRun);
+
+    /**
+     * Reports task execution result.
+     *
+     * @param executionKey key of task execution being reported
+     * @param reportExec execution being reported
+     */
+    @POST
+    @Path("executions/{executionKey}/report")
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    void report(@NotNull @PathParam("executionKey") Long executionKey, @NotNull ReportExecTO reportExec);
+
+    /**
+     * Executes the provided bulk action.
+     *
+     * @param bulkAction list of task ids against which the bulk action will be performed.
+     * @return Bulk action result
+     */
+    @POST
+    @Path("bulk")
+    @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
+    BulkActionResult bulk(@NotNull BulkAction bulkAction);
+}