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/16 09:06:38 UTC

[13/59] [abbrv] [partial] syncope git commit: [SYNCOPE-620] Re-organization completed

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/PasswordPolicySpec.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PasswordPolicySpec.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PasswordPolicySpec.java
new file mode 100644
index 0000000..448fceb
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PasswordPolicySpec.java
@@ -0,0 +1,367 @@
+/*
+ * 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.lib.types;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.annotation.SchemaList;
+
+@XmlType
+public class PasswordPolicySpec implements PolicySpec {
+
+    private static final long serialVersionUID = -7988778083915548547L;
+
+    /**
+     * History length.
+     */
+    private int historyLength;
+
+    /**
+     * Minimum length.
+     */
+    private int maxLength;
+
+    /**
+     * Maximum length.
+     */
+    private int minLength;
+
+    /**
+     * Substrings not permitted.
+     */
+    private List<String> wordsNotPermitted;
+
+    /**
+     * User attribute values not permitted.
+     */
+    @SchemaList
+    private List<String> schemasNotPermitted;
+
+    /**
+     * Specify if one or more non alphanumeric characters are required.
+     */
+    private boolean nonAlphanumericRequired;
+
+    /**
+     * Specify if one or more alphanumeric characters are required.
+     */
+    private boolean alphanumericRequired;
+
+    /**
+     * Specify if one or more digits are required.
+     */
+    private boolean digitRequired;
+
+    /**
+     * Specify if one or more lowercase alphabetic characters are required.
+     */
+    private boolean lowercaseRequired;
+
+    /**
+     * Specify if one or more uppercase alphabetic characters are required.
+     */
+    private boolean uppercaseRequired;
+
+    /**
+     * Specify if must start with a digit.
+     */
+    private boolean mustStartWithDigit;
+
+    /**
+     * Specify if mustn't start with a digit.
+     */
+    private boolean mustntStartWithDigit;
+
+    /**
+     * Specify if must end with a digit.
+     */
+    private boolean mustEndWithDigit;
+
+    /**
+     * Specify if mustn't end with a digit.
+     */
+    private boolean mustntEndWithDigit;
+
+    /**
+     * Specify if must start with a non alphanumeric character.
+     */
+    private boolean mustStartWithNonAlpha;
+
+    /**
+     * Specify if must start with a alphanumeric character.
+     */
+    private boolean mustStartWithAlpha;
+
+    /**
+     * Specify if mustn't start with a non alphanumeric character.
+     */
+    private boolean mustntStartWithNonAlpha;
+
+    /**
+     * Specify if mustn't start with a alphanumeric character.
+     */
+    private boolean mustntStartWithAlpha;
+
+    /**
+     * Specify if must end with a non alphanumeric character.
+     */
+    private boolean mustEndWithNonAlpha;
+
+    /**
+     * Specify if must end with a alphanumeric character.
+     */
+    private boolean mustEndWithAlpha;
+
+    /**
+     * Specify if mustn't end with a non alphanumeric character.
+     */
+    private boolean mustntEndWithNonAlpha;
+
+    /**
+     * Specify if mustn't end with a alphanumeric character.
+     */
+    private boolean mustntEndWithAlpha;
+
+    /**
+     * Specify if password shall not be stored internally.
+     */
+    private boolean allowNullPassword;
+
+    /**
+     * Substrings not permitted as prefix.
+     */
+    private List<String> prefixesNotPermitted;
+
+    /**
+     * Substrings not permitted as suffix.
+     */
+    private List<String> suffixesNotPermitted;
+
+    public boolean isDigitRequired() {
+        return digitRequired;
+    }
+
+    public void setDigitRequired(final boolean digitRequired) {
+        this.digitRequired = digitRequired;
+    }
+
+    public boolean isLowercaseRequired() {
+        return lowercaseRequired;
+    }
+
+    public void setLowercaseRequired(final boolean lowercaseRequired) {
+        this.lowercaseRequired = lowercaseRequired;
+    }
+
+    public int getMaxLength() {
+        return maxLength;
+    }
+
+    public void setMaxLength(final int maxLength) {
+        this.maxLength = maxLength;
+    }
+
+    public int getMinLength() {
+        return minLength;
+    }
+
+    public void setMinLength(final int minLength) {
+        this.minLength = minLength;
+    }
+
+    public boolean isMustEndWithDigit() {
+        return mustEndWithDigit;
+    }
+
+    public void setMustEndWithDigit(final boolean mustEndWithDigit) {
+        this.mustEndWithDigit = mustEndWithDigit;
+    }
+
+    public boolean isMustEndWithNonAlpha() {
+        return mustEndWithNonAlpha;
+    }
+
+    public void setMustEndWithNonAlpha(final boolean mustEndWithNonAlpha) {
+        this.mustEndWithNonAlpha = mustEndWithNonAlpha;
+    }
+
+    public boolean isMustStartWithDigit() {
+        return mustStartWithDigit;
+    }
+
+    public void setMustStartWithDigit(final boolean mustStartWithDigit) {
+        this.mustStartWithDigit = mustStartWithDigit;
+    }
+
+    public boolean isMustStartWithNonAlpha() {
+        return mustStartWithNonAlpha;
+    }
+
+    public void setMustStartWithNonAlpha(final boolean mustStartWithNonAlpha) {
+        this.mustStartWithNonAlpha = mustStartWithNonAlpha;
+    }
+
+    public boolean isMustntEndWithDigit() {
+        return mustntEndWithDigit;
+    }
+
+    public void setMustntEndWithDigit(final boolean mustntEndWithDigit) {
+        this.mustntEndWithDigit = mustntEndWithDigit;
+    }
+
+    public boolean isMustntEndWithNonAlpha() {
+        return mustntEndWithNonAlpha;
+    }
+
+    public void setMustntEndWithNonAlpha(final boolean mustntEndWithNonAlpha) {
+        this.mustntEndWithNonAlpha = mustntEndWithNonAlpha;
+    }
+
+    public boolean isMustntStartWithDigit() {
+        return mustntStartWithDigit;
+    }
+
+    public void setMustntStartWithDigit(final boolean mustntStartWithDigit) {
+        this.mustntStartWithDigit = mustntStartWithDigit;
+    }
+
+    public boolean isMustntStartWithNonAlpha() {
+        return mustntStartWithNonAlpha;
+    }
+
+    public void setMustntStartWithNonAlpha(final boolean mustntStartWithNonAlpha) {
+        this.mustntStartWithNonAlpha = mustntStartWithNonAlpha;
+    }
+
+    public boolean isNonAlphanumericRequired() {
+        return nonAlphanumericRequired;
+    }
+
+    public void setNonAlphanumericRequired(final boolean nonAlphanumericRequired) {
+        this.nonAlphanumericRequired = nonAlphanumericRequired;
+    }
+
+    @XmlElementWrapper(name = "prefixesNotPermitted")
+    @XmlElement(name = "prefix")
+    @JsonProperty("prefixesNotPermitted")
+    public List<String> getPrefixesNotPermitted() {
+        if (prefixesNotPermitted == null) {
+            prefixesNotPermitted = new ArrayList<String>();
+        }
+        return prefixesNotPermitted;
+    }
+
+    @XmlElementWrapper(name = "schemasNotPermitted")
+    @XmlElement(name = "schema")
+    @JsonProperty("schemasNotPermitted")
+    public List<String> getSchemasNotPermitted() {
+        if (schemasNotPermitted == null) {
+            schemasNotPermitted = new ArrayList<String>();
+        }
+        return schemasNotPermitted;
+    }
+
+    @XmlElementWrapper(name = "suffixesNotPermitted")
+    @XmlElement(name = "suffix")
+    @JsonProperty("suffixesNotPermitted")
+    public List<String> getSuffixesNotPermitted() {
+        if (suffixesNotPermitted == null) {
+            suffixesNotPermitted = new ArrayList<String>();
+        }
+        return suffixesNotPermitted;
+    }
+
+    public boolean isUppercaseRequired() {
+        return uppercaseRequired;
+    }
+
+    public void setUppercaseRequired(final boolean uppercaseRequired) {
+        this.uppercaseRequired = uppercaseRequired;
+    }
+
+    @XmlElementWrapper(name = "wordsNotPermitted")
+    @XmlElement(name = "word")
+    @JsonProperty("wordsNotPermitted")
+    public List<String> getWordsNotPermitted() {
+        if (wordsNotPermitted == null) {
+            wordsNotPermitted = new ArrayList<String>();
+        }
+        return wordsNotPermitted;
+    }
+
+    public boolean isAlphanumericRequired() {
+        return alphanumericRequired;
+    }
+
+    public void setAlphanumericRequired(final boolean alphanumericRequired) {
+        this.alphanumericRequired = alphanumericRequired;
+    }
+
+    public boolean isMustEndWithAlpha() {
+        return mustEndWithAlpha;
+    }
+
+    public void setMustEndWithAlpha(final boolean mustEndWithAlpha) {
+        this.mustEndWithAlpha = mustEndWithAlpha;
+    }
+
+    public boolean isMustStartWithAlpha() {
+        return mustStartWithAlpha;
+    }
+
+    public void setMustStartWithAlpha(final boolean mustStartWithAlpha) {
+        this.mustStartWithAlpha = mustStartWithAlpha;
+    }
+
+    public boolean isMustntEndWithAlpha() {
+        return mustntEndWithAlpha;
+    }
+
+    public void setMustntEndWithAlpha(final boolean mustntEndWithAlpha) {
+        this.mustntEndWithAlpha = mustntEndWithAlpha;
+    }
+
+    public boolean isMustntStartWithAlpha() {
+        return mustntStartWithAlpha;
+    }
+
+    public void setMustntStartWithAlpha(final boolean mustntStartWithAlpha) {
+        this.mustntStartWithAlpha = mustntStartWithAlpha;
+    }
+
+    public int getHistoryLength() {
+        return historyLength;
+    }
+
+    public void setHistoryLength(final int historyLength) {
+        this.historyLength = historyLength;
+    }
+
+    public boolean isAllowNullPassword() {
+        return allowNullPassword;
+    }
+
+    public void setAllowNullPassword(final boolean allowNullPassword) {
+        this.allowNullPassword = allowNullPassword;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/PolicySpec.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PolicySpec.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PolicySpec.java
new file mode 100644
index 0000000..7de0e48
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PolicySpec.java
@@ -0,0 +1,25 @@
+/*
+ * 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.lib.types;
+
+import java.io.Serializable;
+
+public interface PolicySpec extends Serializable {
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/PolicyType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PolicyType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PolicyType.java
new file mode 100644
index 0000000..0b498d6
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PolicyType.java
@@ -0,0 +1,65 @@
+/*
+ * 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.lib.types;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
+public enum PolicyType {
+
+    /**
+     * Account policy like:
+     * password expire time, change password at first access, ...
+     */
+    ACCOUNT("Account Policy"),
+    GLOBAL_ACCOUNT("Account Global Policy"),
+    /**
+     * Password policy regarding password syntax.
+     */
+    PASSWORD("Password Policy"),
+    GLOBAL_PASSWORD("Password Global Policy"),
+    /**
+     * SYNC policy regarding account conflicts resolution.
+     */
+    SYNC("Synchronization Policy"),
+    GLOBAL_SYNC("Synchronization Global Policy"),
+    /**
+     * PUSH policy regarding account conflicts resolution.
+     */
+    PUSH("Push Policy"),
+    GLOBAL_PUSH("Push Global Policy");
+
+    private String description;
+
+    PolicyType(final String description) {
+        this.description = description;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public boolean isGlobal() {
+        return name().startsWith("GLOBAL");
+    }
+
+    public static PolicyType fromString(final String value) {
+        return PolicyType.valueOf(value.toUpperCase());
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/PropagationByResource.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PropagationByResource.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PropagationByResource.java
new file mode 100644
index 0000000..f89f27e
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PropagationByResource.java
@@ -0,0 +1,364 @@
+/*
+ * 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.lib.types;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Utility class for encapsulating operations to be performed on various resources.
+ */
+public class PropagationByResource implements Serializable {
+
+    private static final long serialVersionUID = -5699740428104336636L;
+
+    /**
+     * Resources for creation.
+     */
+    private final Set<String> toBeCreated;
+
+    /**
+     * Resources for update.
+     */
+    private final Set<String> toBeUpdated;
+
+    /**
+     * Resources for deletion.
+     */
+    private final Set<String> toBeDeleted;
+
+    /**
+     * Mapping target resource names to old account ids (when applicable).
+     */
+    private final Map<String, String> oldAccountIds;
+
+    /**
+     * Default constructor.
+     */
+    public PropagationByResource() {
+        toBeCreated = new HashSet<>();
+        toBeUpdated = new HashSet<>();
+        toBeDeleted = new HashSet<>();
+
+        oldAccountIds = new HashMap<>();
+    }
+
+    /**
+     * Avoid potential conflicts by not doing create or update on any resource for which a delete is requested, and by
+     * not doing any create on any resource for which an update is requested.
+     */
+    public final void purge() {
+        toBeCreated.removeAll(toBeDeleted);
+        toBeCreated.removeAll(toBeUpdated);
+
+        toBeUpdated.removeAll(toBeDeleted);
+    }
+
+    /**
+     * Add an element.
+     *
+     * @param type resource operation type
+     * @param resourceName target resource
+     * @return whether the operation was successful or not
+     */
+    public final boolean add(final ResourceOperation type, final String resourceName) {
+        Set<String> set;
+        switch (type) {
+            case CREATE:
+                set = toBeCreated;
+                break;
+
+            case UPDATE:
+                set = toBeUpdated;
+                break;
+
+            case DELETE:
+            default:
+                set = toBeDeleted;
+                break;
+        }
+
+        return set.add(resourceName);
+    }
+
+    /**
+     * Add some elements.
+     *
+     * @param type resource operation type
+     * @param resourceNames target resources
+     * @return whether the operation was successful or not
+     */
+    public boolean addAll(final ResourceOperation type, final Collection<String> resourceNames) {
+        Set<String> set;
+        switch (type) {
+            case CREATE:
+                set = toBeCreated;
+                break;
+
+            case UPDATE:
+                set = toBeUpdated;
+                break;
+
+            case DELETE:
+            default:
+                set = toBeDeleted;
+                break;
+        }
+
+        return set.addAll(resourceNames);
+    }
+
+    /**
+     * Remove an element.
+     *
+     * @param type resource operation type
+     * @param resourceName target resource
+     * @return whether the operation was successful or not
+     */
+    public final boolean remove(final ResourceOperation type, final String resourceName) {
+        boolean result = false;
+
+        switch (type) {
+            case CREATE:
+                result = toBeCreated.remove(resourceName);
+                break;
+
+            case UPDATE:
+                result = toBeUpdated.remove(resourceName);
+                break;
+
+            case DELETE:
+                result = toBeDeleted.remove(resourceName);
+                break;
+
+            default:
+        }
+
+        return result;
+    }
+
+    /**
+     * Remove some elements.
+     *
+     * @param type resource operation type
+     * @param resourceNames target resources
+     * @return whether the operation was successful or not
+     */
+    public boolean removeAll(final ResourceOperation type, final Set<String> resourceNames) {
+        Set<String> set;
+        switch (type) {
+            case CREATE:
+                set = toBeCreated;
+                break;
+
+            case UPDATE:
+                set = toBeUpdated;
+                break;
+
+            case DELETE:
+            default:
+                set = toBeDeleted;
+                break;
+        }
+
+        return set.removeAll(resourceNames);
+    }
+
+    /**
+     * Removes only the resource names in the underlying resource name sets that are contained in the specified
+     * collection.
+     *
+     * @param resourceNames collection containing resource names to be retained in the underlying resource name sets
+     * @return <tt>true</tt> if the underlying resource name sets changed as a result of the call
+     * @see Collection#removeAll(java.util.Collection)
+     */
+    public boolean removeAll(final Collection<String> resourceNames) {
+        return toBeCreated.removeAll(resourceNames)
+                | toBeUpdated.removeAll(resourceNames)
+                | toBeDeleted.removeAll(resourceNames);
+    }
+
+    /**
+     * Retains only the resource names in the underlying resource name sets that are contained in the specified
+     * collection.
+     *
+     * @param resourceNames collection containing resource names to be retained in the underlying resource name sets
+     * @return <tt>true</tt> if the underlying resource name sets changed as a result of the call
+     * @see Collection#retainAll(java.util.Collection)
+     */
+    public boolean retainAll(final Collection<String> resourceNames) {
+        return toBeCreated.retainAll(resourceNames)
+                | toBeUpdated.retainAll(resourceNames)
+                | toBeDeleted.retainAll(resourceNames);
+    }
+
+    public boolean contains(final ResourceOperation type, final String resourceName) {
+        boolean result = false;
+
+        switch (type) {
+            case CREATE:
+                result = toBeCreated.contains(resourceName);
+                break;
+
+            case UPDATE:
+                result = toBeUpdated.contains(resourceName);
+                break;
+
+            case DELETE:
+                result = toBeDeleted.contains(resourceName);
+                break;
+
+            default:
+        }
+
+        return result;
+    }
+
+    /**
+     * Get resources for a given resource operation type.
+     *
+     * @param type resource operation type
+     * @return resource matching the given type
+     */
+    public final Set<String> get(final ResourceOperation type) {
+        Set<String> result = Collections.<String>emptySet();
+
+        switch (type) {
+            case CREATE:
+                result = toBeCreated;
+                break;
+
+            case UPDATE:
+                result = toBeUpdated;
+                break;
+
+            case DELETE:
+                result = toBeDeleted;
+                break;
+
+            default:
+        }
+
+        return result;
+    }
+
+    /**
+     * Set resources for a given resource operation type.
+     *
+     * @param type resource operation type
+     * @param resourceNames to be set
+     */
+    public final void set(final ResourceOperation type, final Set<String> resourceNames) {
+
+        switch (type) {
+            case CREATE:
+                toBeCreated.clear();
+                toBeCreated.addAll(resourceNames);
+                break;
+
+            case UPDATE:
+                toBeUpdated.clear();
+                toBeUpdated.addAll(resourceNames);
+                break;
+
+            case DELETE:
+                toBeDeleted.clear();
+                toBeDeleted.addAll(resourceNames);
+                break;
+
+            default:
+        }
+    }
+
+    /**
+     * Merge another resource operation instance into this instance.
+     *
+     * @param propByRes to be merged
+     */
+    public final void merge(final PropagationByResource propByRes) {
+        if (propByRes != null) {
+            toBeCreated.addAll(propByRes.get(ResourceOperation.CREATE));
+            toBeUpdated.addAll(propByRes.get(ResourceOperation.UPDATE));
+            toBeDeleted.addAll(propByRes.get(ResourceOperation.DELETE));
+            oldAccountIds.putAll(propByRes.getOldAccountIds());
+        }
+    }
+
+    /**
+     * Removes all of the operations.
+     */
+    public void clear() {
+        toBeCreated.clear();
+        toBeUpdated.clear();
+        toBeDeleted.clear();
+    }
+
+    /**
+     * Whether no operations are present.
+     *
+     * @return true if no operations (create / update / delete) and no old account ids are present
+     */
+    public final boolean isEmpty() {
+        return toBeCreated.isEmpty() && toBeUpdated.isEmpty() && toBeDeleted.isEmpty() && oldAccountIds.isEmpty();
+    }
+
+    /**
+     * Fetch all old account ids.
+     *
+     * @return old account ids; can be empty
+     */
+    public Map<String, String> getOldAccountIds() {
+        return oldAccountIds;
+    }
+
+    /**
+     * Fetch old account id for given resource name.
+     *
+     * @param resourceName resource name
+     * @return old account id; can be null
+     */
+    public String getOldAccountId(final String resourceName) {
+        return oldAccountIds.get(resourceName);
+    }
+
+    /**
+     * Add old account id for a given resource name.
+     *
+     * @param resourceName resourceName resource name
+     * @param oldAccountId old account id
+     */
+    public void addOldAccountId(final String resourceName, final String oldAccountId) {
+        if (resourceName != null && oldAccountId != null) {
+            oldAccountIds.put(resourceName, oldAccountId);
+        }
+    }
+
+    @Override
+    public String toString() {
+        return "To be Created: " + toBeCreated + ";\n"
+                + "To be Updated: " + toBeUpdated + ";\n"
+                + "To be Deleted: " + toBeDeleted + ";\n"
+                + "Old account Ids: " + oldAccountIds;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/PropagationMode.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PropagationMode.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PropagationMode.java
new file mode 100644
index 0000000..8b10bc8
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PropagationMode.java
@@ -0,0 +1,29 @@
+/*
+ * 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.lib.types;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
+public enum PropagationMode {
+
+    ONE_PHASE,
+    TWO_PHASES
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/PropagationTaskExecStatus.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/PropagationTaskExecStatus.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PropagationTaskExecStatus.java
new file mode 100644
index 0000000..448b3a9
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/PropagationTaskExecStatus.java
@@ -0,0 +1,47 @@
+/*
+ * 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.lib.types;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+/**
+ * Status of a propagation task execution.
+ *
+ * CREATED -&gt; SUBMITTED or UBSUBMITTED (depending on the external resource to
+ * return success or failure).
+ * SUBMITTED -&gt; SUCCESS or FAILURE (depending on the external resource to
+ * report success or failure).
+ */
+@XmlEnum
+public enum PropagationTaskExecStatus {
+
+    CREATED,
+    SUBMITTED,
+    UNSUBMITTED,
+    SUCCESS,
+    FAILURE;
+
+    public boolean isSuccessful() {
+        return this == SUCCESS || this == SUBMITTED;
+    }
+
+    public static PropagationTaskExecStatus fromString(final String value) {
+        return PropagationTaskExecStatus.valueOf(value.toUpperCase());
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/ReportExecExportFormat.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ReportExecExportFormat.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ReportExecExportFormat.java
new file mode 100644
index 0000000..fdac43d
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ReportExecExportFormat.java
@@ -0,0 +1,32 @@
+/*
+ * 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.lib.types;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
+public enum ReportExecExportFormat {
+
+    XML,
+    HTML,
+    PDF,
+    RTF,
+    CSV
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/ReportExecStatus.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ReportExecStatus.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ReportExecStatus.java
new file mode 100644
index 0000000..2fe42ed
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ReportExecStatus.java
@@ -0,0 +1,34 @@
+/*
+ * 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.lib.types;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
+public enum ReportExecStatus {
+
+    STARTED,
+    RUNNING,
+    SUCCESS,
+    FAILURE;
+
+    public static ReportExecStatus fromString(final String value) {
+        return ReportExecStatus.valueOf(value.toUpperCase());
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceAssociationActionType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceAssociationActionType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceAssociationActionType.java
new file mode 100644
index 0000000..7693ca3
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceAssociationActionType.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.lib.types;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
+public enum ResourceAssociationActionType {
+
+    /**
+     * Add association between user/role on Syncope and external resource(s) without any propagation.
+     */
+    LINK,
+    /**
+     * Add user/role into external resource(s).
+     */
+    PROVISION,
+    /**
+     * Assign (link + provision) external resource(s) with user/role.
+     */
+    ASSIGN
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceDeassociationActionType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceDeassociationActionType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceDeassociationActionType.java
new file mode 100644
index 0000000..c88f453
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceDeassociationActionType.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.lib.types;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
+public enum ResourceDeassociationActionType {
+
+    /**
+     * Remove association between user/role on Syncope and external resource(s) without any propagation.
+     */
+    UNLINK,
+    /**
+     * Remove user/role from external resource(s).
+     */
+    DEPROVISION,
+    /**
+     * Unassign (unlink + de-provision) external resource(s) from user/role.
+     */
+    UNASSIGN
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceOperation.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceOperation.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceOperation.java
new file mode 100644
index 0000000..b399b17
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ResourceOperation.java
@@ -0,0 +1,31 @@
+/*
+ * 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.lib.types;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
+public enum ResourceOperation {
+
+    CREATE,
+    UPDATE,
+    DELETE,
+    NONE
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/SchemaType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/SchemaType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SchemaType.java
new file mode 100644
index 0000000..673666d
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SchemaType.java
@@ -0,0 +1,68 @@
+/*
+ * 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.lib.types;
+
+import javax.xml.bind.annotation.XmlEnum;
+import org.apache.syncope.common.lib.to.AbstractSchemaTO;
+import org.apache.syncope.common.lib.to.DerSchemaTO;
+import org.apache.syncope.common.lib.to.PlainSchemaTO;
+import org.apache.syncope.common.lib.to.VirSchemaTO;
+
+@XmlEnum
+public enum SchemaType {
+
+    /**
+     * Standard schema for normal attributes to be stored within syncope.
+     */
+    PLAIN(PlainSchemaTO.class),
+    /**
+     * Derived schema calculated based on other attributes.
+     */
+    DERIVED(DerSchemaTO.class),
+    /**
+     * Virtual schema for attributes fetched from remote resources only.
+     */
+    VIRTUAL(VirSchemaTO.class);
+
+    private final Class<? extends AbstractSchemaTO> toClass;
+
+    SchemaType(final Class<? extends AbstractSchemaTO> toClass) {
+        this.toClass = toClass;
+    }
+
+    public Class<? extends AbstractSchemaTO> getToClass() {
+        return toClass;
+    }
+
+    public static SchemaType fromToClass(final Class<? extends AbstractSchemaTO> toClass) {
+        SchemaType schemaType = null;
+
+        if (PlainSchemaTO.class.equals(toClass)) {
+            schemaType = SchemaType.PLAIN;
+        } else if (DerSchemaTO.class.equals(toClass)) {
+            schemaType = SchemaType.DERIVED;
+        } else if (VirSchemaTO.class.equals(toClass)) {
+            schemaType = SchemaType.VIRTUAL;
+        } else {
+            throw new IllegalArgumentException("Unexpected class: " + toClass.getName());
+        }
+
+        return schemaType;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/SubjectType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/SubjectType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SubjectType.java
new file mode 100644
index 0000000..0acd314
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SubjectType.java
@@ -0,0 +1,34 @@
+/*
+ * 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.lib.types;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
+public enum SubjectType {
+
+    USER,
+    ROLE;
+
+    public AttributableType asAttributableType() {
+        return this == USER
+                ? AttributableType.USER
+                : AttributableType.ROLE;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.java
new file mode 100644
index 0000000..e0040de
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/SyncPolicySpec.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.lib.types;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.syncope.common.lib.annotation.ClassList;
+import org.apache.syncope.common.lib.annotation.SchemaList;
+
+@XmlType
+public class SyncPolicySpec implements PolicySpec {
+
+    private static final long serialVersionUID = -3144027171719498127L;
+
+    /**
+     * User attributes and fields for matching during synchronization.
+     */
+    @SchemaList(extended = true)
+    private final List<String> uAltSearchSchemas = new ArrayList<String>();
+
+    @ClassList
+    private String userJavaRule;
+
+    /**
+     * Role attributes and fields for matching during synchronization.
+     */
+    @SchemaList(extended = true)
+    private final List<String> rAltSearchSchemas = new ArrayList<String>();
+
+    @ClassList
+    private String roleJavaRule;
+
+    /**
+     * Conflict resolution action.
+     */
+    private ConflictResolutionAction conflictResolutionAction;
+
+    public ConflictResolutionAction getConflictResolutionAction() {
+        return conflictResolutionAction == null
+                ? ConflictResolutionAction.IGNORE
+                : conflictResolutionAction;
+    }
+
+    public void setConflictResolutionAction(final ConflictResolutionAction conflictResolutionAction) {
+        this.conflictResolutionAction = conflictResolutionAction;
+    }
+
+    @XmlElementWrapper(name = "userAltSearchSchemas")
+    @XmlElement(name = "userAltSearchSchema")
+    @JsonProperty("userAltSearchSchemas")
+    public List<String> getuAltSearchSchemas() {
+        return uAltSearchSchemas;
+    }
+
+    @XmlElementWrapper(name = "roleAltSearchSchemas")
+    @XmlElement(name = "roleAltSearchSchema")
+    @JsonProperty("roleAltSearchSchemas")
+    public List<String> getrAltSearchSchemas() {
+        return rAltSearchSchemas;
+    }
+
+    public String getRoleJavaRule() {
+        return roleJavaRule;
+    }
+
+    public void setRoleJavaRule(final String roleJavaRule) {
+        this.roleJavaRule = roleJavaRule;
+    }
+
+    public String getUserJavaRule() {
+        return userJavaRule;
+    }
+
+    public void setUserJavaRule(final String userJavaRule) {
+        this.userJavaRule = userJavaRule;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/TaskType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/TaskType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/TaskType.java
new file mode 100644
index 0000000..a20d0a7
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/TaskType.java
@@ -0,0 +1,54 @@
+/*
+ * 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.lib.types;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
+public enum TaskType {
+
+    PROPAGATION("propagation"),
+    NOTIFICATION("notification"),
+    SCHEDULED("sched"),
+    SYNCHRONIZATION("sync"),
+    PUSH("push");
+
+    private String name;
+
+    private TaskType(final String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String toString() {
+        return name;
+    }
+
+    public static TaskType fromString(final String name) {
+        if (name != null) {
+            for (TaskType t : TaskType.values()) {
+                if (t.name.equalsIgnoreCase(name)) {
+                    return t;
+                }
+            }
+        }
+
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/TraceLevel.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/TraceLevel.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/TraceLevel.java
new file mode 100644
index 0000000..e8232b8
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/TraceLevel.java
@@ -0,0 +1,43 @@
+/*
+ * 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.lib.types;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
+public enum TraceLevel {
+
+    /**
+     * No details at all.
+     */
+    NONE,
+    /**
+     * Only failed entries.
+     */
+    FAILURES,
+    /**
+     * Only an overall summary.
+     */
+    SUMMARY,
+    /**
+     * All available information, including per-entry information.
+     */
+    ALL
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/UnmatchingRule.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/UnmatchingRule.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/UnmatchingRule.java
new file mode 100644
index 0000000..f579128
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/UnmatchingRule.java
@@ -0,0 +1,47 @@
+/*
+ * 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.lib.types;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+/**
+ * Sync/Push task un-matching rule.
+ */
+@XmlEnum
+public enum UnmatchingRule {
+
+    /**
+     * Do not perform any action.
+     */
+    IGNORE,
+    /**
+     * Link the resource and create entity.
+     */
+    ASSIGN,
+    /**
+     * Create entity without linking the resource.
+     */
+    PROVISION,
+    /**
+     * Just unlink resource without performing any (de-)provisioning operation.
+     * In case of sync task UNLINK and IGNORE will coincide.
+     */
+    UNLINK
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowFormPropertyType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowFormPropertyType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowFormPropertyType.java
new file mode 100644
index 0000000..ec2db4a
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowFormPropertyType.java
@@ -0,0 +1,32 @@
+/*
+ * 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.lib.types;
+
+import javax.xml.bind.annotation.XmlEnum;
+
+@XmlEnum
+public enum WorkflowFormPropertyType {
+
+    String,
+    Long,
+    Enum,
+    Date,
+    Boolean
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowTasks.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowTasks.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowTasks.java
new file mode 100644
index 0000000..8c487f8
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/WorkflowTasks.java
@@ -0,0 +1,47 @@
+/*
+ * 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.lib.types;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class WorkflowTasks {
+
+    private List<String> tasks;
+
+    public WorkflowTasks() {
+        this.tasks = new ArrayList<String>();
+    }
+
+    public WorkflowTasks(final Collection<String> tasks) {
+        this();
+        this.tasks.addAll(tasks);
+    }
+
+    public List<String> getTasks() {
+        return tasks;
+    }
+
+    public void setTasks(final List<String> tasks) {
+        this.tasks = tasks;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/types/package-info.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/package-info.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/package-info.java
new file mode 100644
index 0000000..80cb87f
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+@XmlSchema(namespace = SyncopeConstants.NAMESPACE)
+package org.apache.syncope.common.lib.types;
+
+import javax.xml.bind.annotation.XmlSchema;
+import org.apache.syncope.common.lib.SyncopeConstants;

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/AbstractWrappable.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/AbstractWrappable.java b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/AbstractWrappable.java
new file mode 100644
index 0000000..7ba0afa
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/AbstractWrappable.java
@@ -0,0 +1,46 @@
+/*
+ * 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.lib.wrap;
+
+import org.apache.syncope.common.lib.AbstractBaseBean;
+
+public abstract class AbstractWrappable<E> extends AbstractBaseBean {
+
+    private static final long serialVersionUID = 1712808704911635170L;
+
+    private E element;
+
+    public static <E, T extends AbstractWrappable<E>> T getInstance(final Class<T> reference, final E element) {
+        try {
+            T instance = reference.newInstance();
+            instance.setElement(element);
+            return instance;
+        } catch (Exception e) {
+            throw new IllegalArgumentException("Could not instantiate " + reference.getName(), e);
+        }
+    }
+
+    public E getElement() {
+        return element;
+    }
+
+    public void setElement(final E element) {
+        this.element = element;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/EntitlementTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/EntitlementTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/EntitlementTO.java
new file mode 100644
index 0000000..62530eb
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/EntitlementTO.java
@@ -0,0 +1,30 @@
+/*
+ * 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.lib.wrap;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "entitlement")
+@XmlType
+public class EntitlementTO extends AbstractWrappable<String> {
+
+    private static final long serialVersionUID = 7133614577172038452L;
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/ReportletConfClass.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/ReportletConfClass.java b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/ReportletConfClass.java
new file mode 100644
index 0000000..24ba188
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/ReportletConfClass.java
@@ -0,0 +1,30 @@
+/*
+ * 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.lib.wrap;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "reportletConfClass")
+@XmlType
+public class ReportletConfClass extends AbstractWrappable<String> {
+
+    private static final long serialVersionUID = 1343357929074360450L;
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/ResourceName.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/ResourceName.java b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/ResourceName.java
new file mode 100644
index 0000000..42b77ca
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/ResourceName.java
@@ -0,0 +1,30 @@
+/*
+ * 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.lib.wrap;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "resourceName")
+@XmlType
+public class ResourceName extends AbstractWrappable<String> {
+
+    private static final long serialVersionUID = -175720097924079573L;
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/SubjectKey.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/SubjectKey.java b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/SubjectKey.java
new file mode 100644
index 0000000..930cf35
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/SubjectKey.java
@@ -0,0 +1,25 @@
+/*
+ * 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.lib.wrap;
+
+public class SubjectKey extends AbstractWrappable<Long> {
+
+    private static final long serialVersionUID = -8664228651057889297L;
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/package-info.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/package-info.java b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/package-info.java
new file mode 100644
index 0000000..397cb66
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/wrap/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+@XmlSchema(namespace = SyncopeConstants.NAMESPACE)
+package org.apache.syncope.common.lib.wrap;
+
+import javax.xml.bind.annotation.XmlSchema;
+import org.apache.syncope.common.lib.SyncopeConstants;

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/lib/src/test/java/org/apache/syncope/common/lib/JSONTest.java
----------------------------------------------------------------------
diff --git a/common/lib/src/test/java/org/apache/syncope/common/lib/JSONTest.java b/common/lib/src/test/java/org/apache/syncope/common/lib/JSONTest.java
new file mode 100644
index 0000000..008c226
--- /dev/null
+++ b/common/lib/src/test/java/org/apache/syncope/common/lib/JSONTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.lib;
+
+import static org.junit.Assert.assertEquals;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.io.StringWriter;
+import org.apache.syncope.common.lib.report.UserReportletConf;
+import org.apache.syncope.common.lib.to.ReportTO;
+import org.apache.syncope.common.lib.to.WorkflowFormPropertyTO;
+import org.junit.Test;
+
+public class JSONTest {
+
+    @Test
+    public void map() throws IOException {
+        WorkflowFormPropertyTO prop = new WorkflowFormPropertyTO();
+        prop.getEnumValues().put("key1", "value1");
+        prop.getEnumValues().put("key2", "value2");
+
+        ObjectMapper mapper = new ObjectMapper();
+
+        StringWriter writer = new StringWriter();
+        mapper.writeValue(writer, prop);
+
+        WorkflowFormPropertyTO unserializedProp = mapper.readValue(writer.toString(), WorkflowFormPropertyTO.class);
+        assertEquals(prop, unserializedProp);
+    }
+
+    @Test
+    public void reportletConfImplementations() throws IOException {
+        ReportTO report = new ReportTO();
+        report.setName("testReportForCreate");
+        report.getReportletConfs().add(new UserReportletConf("first"));
+        report.getReportletConfs().add(new UserReportletConf("second"));
+
+        ObjectMapper mapper = new ObjectMapper();
+
+        StringWriter writer = new StringWriter();
+        mapper.writeValue(writer, report);
+
+        ReportTO actual = mapper.readValue(writer.toString(), ReportTO.class);
+        assertEquals(report, actual);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/pom.xml
----------------------------------------------------------------------
diff --git a/common/pom.xml b/common/pom.xml
index de1f31e..a137eb5 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -31,288 +31,11 @@ under the License.
   <description>Apache Syncope Common</description>
   <groupId>org.apache.syncope</groupId>
   <artifactId>syncope-common</artifactId>
-  <packaging>bundle</packaging>
+  <packaging>pom</packaging>
 
-  <distributionManagement>
-    <site>
-      <id>syncope.website</id>
-      <name>Apache Syncope website</name>
-      <url>${site.deploymentBaseUrl}/${project.artifactId}</url>
-    </site>
-  </distributionManagement>
+  <modules>
+    <module>lib</module>
+    <module>rest-api</module>
+  </modules>
 
-  <dependencies>
-    <dependency>
-      <groupId>javax.validation</groupId>
-      <artifactId>validation-api</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>javax.ws.rs</groupId>
-      <artifactId>javax.ws.rs-api</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.cxf</groupId>
-      <artifactId>cxf-rt-frontend-jaxrs</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.cxf</groupId>
-      <artifactId>cxf-rt-rs-extension-search</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.cxf</groupId>
-      <artifactId>cxf-rt-rs-service-description</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-lang3</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-beans</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>com.fasterxml.jackson.core</groupId>
-      <artifactId>jackson-databind</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>org.apache.logging.log4j</groupId>
-      <artifactId>log4j-api</artifactId>
-    </dependency>
-
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
-  <build>
-    <plugins>
-      <!-- Generating javadoc JAR artifact for usage with CXF's WADL generator (for core) -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-javadoc-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>attach-javadocs</id>
-            <goals>
-              <goal>jar</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Bundle-Name>${project.name}</Bundle-Name>
-            <Bundle-SymbolicName>org.apache.syncope.common</Bundle-SymbolicName>
-            <Bundle-Version>${project.version}</Bundle-Version>
-            <Export-Package>
-              org.apache.syncope.common*;version=${project.version};-split-package:=merge-first
-            </Export-Package>
-            <Import-Package>
-              org.apache.commons.lang3;version="[3.1,3.2)",
-              com.fasterxml.jackson.annotation;version="[2.2.2,2.3)",
-              org.springframework*;version="[3,4)",
-              org.apache.logging.log4j*;resolution:=optional,
-              org.slf4j;resolution:=optional,
-              *
-            </Import-Package>
-          </instructions>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-pmd-plugin</artifactId>
-      </plugin>
-    </plugins>
-
-    <resources>
-      <resource>
-        <directory>..</directory>
-        <targetPath>META-INF</targetPath>
-        <includes>
-          <include>LICENSE</include>
-          <include>NOTICE</include>
-        </includes>
-      </resource>
-    </resources>
-  </build>
-
-  <profiles>
-    <profile>
-      <id>offline-doc</id>
-
-      <build>
-        <defaultGoal>clean verify</defaultGoal>
-
-        <plugins>
-          <!-- 1. Generate offline WADL -->
-          <plugin>
-            <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-java2wadl-plugin</artifactId>
-            <inherited>true</inherited>
-            <executions>
-              <execution>
-                <id>parsejavadoc</id>
-                <phase>generate-resources</phase>
-                <goals>
-                  <goal>parsejavadoc</goal>
-                </goals>
-              </execution>
-              <execution>
-                <id>process-classes</id>
-                <phase>process-classes</phase>
-                <goals>
-                  <goal>java2wadl</goal>
-                </goals>
-                <configuration>
-                  <applicationTitle>Apache Syncope ${project.version}</applicationTitle>
-                  <namespacePrefix>syncope</namespacePrefix>
-                  <addResourceAndMethodIds>true</addResourceAndMethodIds>
-                  <linkAnyMediaTypeToXmlSchema>true</linkAnyMediaTypeToXmlSchema>
-                  <classResourceNames />
-                  <basePackages>org.apache.syncope.common.services</basePackages>
-                  <docProvider>org.apache.cxf.maven_plugin.javatowadl.ResourceMapJavaDocProvider</docProvider>
-                  <attachWadl>true</attachWadl>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-          <!-- 2. Transform WADL into 2 HTML pages -->
-          <plugin>
-            <groupId>org.codehaus.mojo</groupId>
-            <artifactId>xml-maven-plugin</artifactId>
-            <inherited>true</inherited>
-            <executions>
-              <execution>
-                <phase>prepare-package</phase>
-                <goals>
-                  <goal>transform</goal>
-                </goals>
-              </execution>
-            </executions>
-            <configuration>
-              <transformationSets>
-                <transformationSet>
-                  <dir>${project.build.directory}/generated/wadl/</dir>
-                  <includes>
-                    <include>application.wadl</include>
-                  </includes>
-                  <outputDir>${project.build.directory}/generated/wadl</outputDir>
-                  <stylesheet>${basedir}/../core/src/main/resources/wadl2html/index.xsl</stylesheet>
-                  <parameters>
-                    <parameter>
-                      <name>contextPath</name>
-                      <value>/restdocs/${project.version}</value>
-                    </parameter>
-                  </parameters>
-                  <outputProperties>
-                    <outputProperty>
-                      <name>indent</name>
-                      <value>yes</value>
-                    </outputProperty>
-                  </outputProperties>
-                  <fileMappers>
-                    <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.RegExpFileMapper">
-                      <pattern>^.*$</pattern>
-                      <replacement>index.html</replacement>
-                    </fileMapper>
-                  </fileMappers>
-                </transformationSet>
-                <transformationSet>
-                  <dir>${project.build.directory}/generated/wadl/</dir>
-                  <includes>
-                    <include>application.wadl</include>
-                  </includes>
-                  <outputDir>${project.build.directory}/generated/wadl</outputDir>
-                  <stylesheet>${basedir}/../core/src/main/resources/wadl2html/schema.xsl</stylesheet>
-                  <parameters>
-                    <parameter>
-                      <name>contextPath</name>
-                      <value>/restdocs/${project.version}</value>
-                    </parameter>
-                    <parameter>
-                      <name>schema-position</name>
-                      <value>1</value>
-                    </parameter>
-                    <parameter>
-                      <name>schema-prefix</name>
-                      <value>syncope1</value>
-                    </parameter>
-                  </parameters>
-                  <outputProperties>
-                    <outputProperty>
-                      <name>indent</name>
-                      <value>yes</value>
-                    </outputProperty>
-                  </outputProperties>
-                  <fileMappers>
-                    <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.RegExpFileMapper">
-                      <pattern>^.*$</pattern>
-                      <replacement>schema_1_syncope1.html</replacement>
-                    </fileMapper>
-                  </fileMappers>
-                </transformationSet>
-              </transformationSets>
-            </configuration>
-          </plugin>
-          <!-- 3. Replace CSS and JS local includes with hosted -->
-          <plugin>
-            <groupId>com.google.code.maven-replacer-plugin</groupId>
-            <artifactId>replacer</artifactId>
-            <inherited>true</inherited>
-            <executions>
-              <execution>
-                <phase>package</phase>
-                <goals>
-                  <goal>replace</goal>
-                </goals>
-              </execution>
-            </executions>
-            <configuration>
-              <regex>false</regex>
-              <includes>
-                <include>${project.build.directory}/generated/wadl/*.html</include>
-              </includes>
-              <replacements>
-                <replacement>
-                  <token>/restdocs/${project.version}/webjars/highlightjs/$/styles/default.min.css</token>
-                  <value>http://yandex.st/highlightjs/${highlightjs.version}/styles/default.min.css</value>
-                </replacement>
-                <replacement>
-                  <token>/restdocs/${project.version}/webjars/highlightjs/$/highlight.min.js</token>
-                  <value>http://yandex.st/highlightjs/${highlightjs.version}/highlight.min.js"</value>
-                </replacement>
-                <replacement>
-                  <token>/restdocs/${project.version}/webjars/jquery-ui/$/themes/base/minified/jquery-ui.min.css</token>
-                  <value>http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/base/minified/jquery-ui.min.css</value>
-                </replacement>
-                <replacement>
-                  <token>/restdocs/${project.version}/webjars/jquery-ui/$/ui/minified/jquery-ui.min.js</token>
-                  <value>http://ajax.googleapis.com/ajax/libs/jqueryui/${jquery-ui.version}/jquery-ui.min.js</value>
-                </replacement>
-                <replacement>
-                  <token>/restdocs/${project.version}/webjars/jquery/$/jquery.min.js</token>
-                  <value>http://ajax.googleapis.com/ajax/libs/jquery/${jquery.version}/jquery.min.js</value>
-                </replacement>
-              </replacements>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-  </profiles>
 </project>

http://git-wip-us.apache.org/repos/asf/syncope/blob/2d194636/common/rest-api/pom.xml
----------------------------------------------------------------------
diff --git a/common/rest-api/pom.xml b/common/rest-api/pom.xml
new file mode 100644
index 0000000..f4409c5
--- /dev/null
+++ b/common/rest-api/pom.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.syncope</groupId>
+    <artifactId>syncope-common</artifactId>
+    <version>2.0.0-SNAPSHOT</version>
+  </parent>
+
+  <name>Apache Syncope Common REST API</name>
+  <description>Apache Syncope Common REST API</description>
+  <groupId>org.apache.syncope.common</groupId>
+  <artifactId>syncope-common-rest-api</artifactId>
+  <packaging>jar</packaging>
+  
+  <properties>
+    <rootpom.basedir>${basedir}/../..</rootpom.basedir>
+  </properties>
+  
+  <dependencies>
+    <dependency>
+      <groupId>javax.validation</groupId>
+      <artifactId>validation-api</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>javax.ws.rs</groupId>
+      <artifactId>javax.ws.rs-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-rs-extension-search</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-rt-rs-service-description</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.syncope.common</groupId>
+      <artifactId>syncope-common-lib</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <plugins>
+      <!-- Generating javadoc JAR artifact for usage with CXF's WADL generator (for core) -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <inherited>true</inherited>
+        <executions>
+          <execution>
+            <id>attach-javadocs</id>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-pmd-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+</project>