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/12 10:14:40 UTC

[35/54] [abbrv] [partial] syncope git commit: [SYNCOPE-620] Renaming 'server' after 'core', to provide continuity with older releases (especially for archetype)

http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSubject.java
----------------------------------------------------------------------
diff --git a/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSubject.java b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSubject.java
new file mode 100644
index 0000000..194e57b
--- /dev/null
+++ b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractSubject.java
@@ -0,0 +1,64 @@
+/*
+ * 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.core.persistence.jpa.entity;
+
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.syncope.core.persistence.api.entity.DerAttr;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.PlainAttr;
+import org.apache.syncope.core.persistence.api.entity.Subject;
+import org.apache.syncope.core.persistence.api.entity.VirAttr;
+
+public abstract class AbstractSubject<P extends PlainAttr, D extends DerAttr, V extends VirAttr>
+        extends AbstractAttributable<P, D, V> implements Subject<P, D, V> {
+
+    private static final long serialVersionUID = -6876467491398928855L;
+
+    protected abstract Set<? extends ExternalResource> internalGetResources();
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public boolean addResource(final ExternalResource resource) {
+        return ((Set<ExternalResource>) internalGetResources()).add(resource);
+    }
+
+    @Override
+    public boolean removeResource(final ExternalResource resource) {
+        return internalGetResources().remove(resource);
+    }
+
+    @Override
+    public Set<? extends ExternalResource> getResources() {
+        return internalGetResources();
+    }
+
+    @Override
+    public Set<String> getResourceNames() {
+        Set<? extends ExternalResource> ownResources = getResources();
+
+        Set<String> result = new HashSet<>(ownResources.size());
+        for (ExternalResource resource : ownResources) {
+            result.add(resource.getKey());
+        }
+
+        return result;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractVirAttr.java
----------------------------------------------------------------------
diff --git a/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractVirAttr.java b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractVirAttr.java
new file mode 100644
index 0000000..7097c8d
--- /dev/null
+++ b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractVirAttr.java
@@ -0,0 +1,62 @@
+/*
+ * 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.core.persistence.jpa.entity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+import javax.persistence.Transient;
+import org.apache.syncope.core.persistence.api.entity.VirAttr;
+
+@MappedSuperclass
+public abstract class AbstractVirAttr extends AbstractEntity<Long> implements VirAttr {
+
+    private static final long serialVersionUID = 5023204776925954907L;
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    protected Long id;
+
+    @Transient
+    protected List<String> values = new ArrayList<>();
+
+    @Override
+    public Long getKey() {
+        return id;
+    }
+
+    @Override
+    public List<String> getValues() {
+        return values;
+    }
+
+    @Override
+    public boolean addValue(final String value) {
+        return !values.contains(value) && values.add(value);
+    }
+
+    @Override
+    public boolean removeValue(final String value) {
+        return values.remove(value);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractVirAttrTemplate.java
----------------------------------------------------------------------
diff --git a/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractVirAttrTemplate.java b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractVirAttrTemplate.java
new file mode 100644
index 0000000..94b34dc
--- /dev/null
+++ b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractVirAttrTemplate.java
@@ -0,0 +1,41 @@
+/*
+ * 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.core.persistence.jpa.entity;
+
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+import org.apache.syncope.core.persistence.api.entity.VirSchema;
+
+@MappedSuperclass
+public abstract class AbstractVirAttrTemplate<V extends VirSchema> extends AbstractAttrTemplate<V> {
+
+    private static final long serialVersionUID = -943169893494860655L;
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    protected Long id;
+
+    @Override
+    public Long getKey() {
+        return id;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractVirSchema.java
----------------------------------------------------------------------
diff --git a/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractVirSchema.java b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractVirSchema.java
new file mode 100644
index 0000000..9541a2e
--- /dev/null
+++ b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AbstractVirSchema.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.core.persistence.jpa.entity;
+
+import javax.persistence.Basic;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import org.apache.syncope.common.lib.types.AttrSchemaType;
+import org.apache.syncope.core.persistence.api.entity.VirSchema;
+import org.apache.syncope.core.persistence.jpa.validation.entity.SchemaNameCheck;
+
+@MappedSuperclass
+@SchemaNameCheck
+public abstract class AbstractVirSchema extends AbstractEntity<String> implements VirSchema {
+
+    private static final long serialVersionUID = 3274006935328590141L;
+
+    @Id
+    private String name;
+
+    @Basic
+    @Min(0)
+    @Max(1)
+    private Integer readonly;
+
+    public AbstractVirSchema() {
+        super();
+
+        readonly = getBooleanAsInteger(false);
+    }
+
+    @Override
+    public String getKey() {
+        return name;
+    }
+
+    @Override
+    public void setKey(final String key) {
+        this.name = key;
+    }
+
+    @Override
+    public AttrSchemaType getType() {
+        return AttrSchemaType.String;
+    }
+
+    @Override
+    public String getMandatoryCondition() {
+        return Boolean.FALSE.toString().toLowerCase();
+    }
+
+    @Override
+    public boolean isMultivalue() {
+        return Boolean.TRUE;
+    }
+
+    @Override
+    public boolean isUniqueConstraint() {
+        return Boolean.FALSE;
+    }
+
+    @Override
+    public boolean isReadonly() {
+        return isBooleanAsInteger(readonly);
+    }
+
+    @Override
+    public void setReadonly(final boolean readonly) {
+        this.readonly = getBooleanAsInteger(readonly);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AnnotatedEntityListener.java
----------------------------------------------------------------------
diff --git a/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AnnotatedEntityListener.java b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AnnotatedEntityListener.java
new file mode 100644
index 0000000..a86cbf4
--- /dev/null
+++ b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/AnnotatedEntityListener.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.core.persistence.jpa.entity;
+
+import java.util.Date;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import org.apache.syncope.core.persistence.api.entity.AnnotatedEntity;
+import org.apache.syncope.core.misc.security.AuthContextUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AnnotatedEntityListener {
+
+    /**
+     * Logger.
+     */
+    private static final Logger LOG = LoggerFactory.getLogger(AnnotatedEntityListener.class);
+
+    @PrePersist
+    @PreUpdate
+    public void setSysInfo(final AnnotatedEntity<?> entity) {
+        final String username = AuthContextUtil.getAuthenticatedUsername();
+        LOG.debug("Set system properties for '{}'", entity);
+
+        final Date now = new Date();
+
+        if (entity.getCreationDate() == null) {
+            LOG.debug("Set creation date '{}' and creator '{}' for '{}'", now, username, entity);
+            entity.setCreationDate(now);
+            entity.setCreator(username);
+        }
+
+        LOG.debug("Set last change date '{}' and modifier '{}' for '{}'", now, username, entity);
+        entity.setLastModifier(username);
+        entity.setLastChangeDate(now);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAccountPolicy.java
----------------------------------------------------------------------
diff --git a/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAccountPolicy.java b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAccountPolicy.java
new file mode 100644
index 0000000..726110a
--- /dev/null
+++ b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAccountPolicy.java
@@ -0,0 +1,90 @@
+/*
+ * 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.core.persistence.jpa.entity;
+
+import java.util.HashSet;
+import java.util.Set;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.validation.Valid;
+import org.apache.syncope.common.lib.types.PolicyType;
+import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+
+@Entity
+@DiscriminatorValue("AccountPolicy")
+public class JPAAccountPolicy extends JPAPolicy implements AccountPolicy {
+
+    private static final long serialVersionUID = -2767606675667839060L;
+
+    /**
+     * Resources for alternative user authentication: if empty, only internal storage will be used.
+     */
+    @ManyToMany(fetch = FetchType.EAGER)
+    @JoinTable(joinColumns =
+            @JoinColumn(name = "account_policy_id"),
+            inverseJoinColumns =
+            @JoinColumn(name = "resource_name"))
+    @Valid
+    private Set<JPAExternalResource> resources;
+
+    public JPAAccountPolicy() {
+        this(false);
+        this.resources = new HashSet<>();
+    }
+
+    public JPAAccountPolicy(final boolean global) {
+        super();
+
+        this.type = global
+                ? PolicyType.GLOBAL_ACCOUNT
+                : PolicyType.ACCOUNT;
+    }
+
+    @Override
+    public boolean addResource(final ExternalResource resource) {
+        checkType(resource, JPAExternalResource.class);
+        return resources.add((JPAExternalResource) resource);
+    }
+
+    @Override
+    public boolean removeResource(final ExternalResource resource) {
+        checkType(resource, JPAExternalResource.class);
+        return resources.remove((JPAExternalResource) resource);
+    }
+
+    @Override
+    public Set<? extends ExternalResource> getResources() {
+        return resources;
+    }
+
+    @Override
+    public Set<String> getResourceNames() {
+        Set<String> result = new HashSet<>(resources.size());
+        for (ExternalResource resource : resources) {
+            result.add(resource.getKey());
+        }
+
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java
----------------------------------------------------------------------
diff --git a/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java
new file mode 100644
index 0000000..4ca357d
--- /dev/null
+++ b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAttributableUtil.java
@@ -0,0 +1,879 @@
+/*
+ * 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.core.persistence.jpa.entity;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.apache.syncope.common.lib.to.AbstractAttributableTO;
+import org.apache.syncope.common.lib.to.AbstractSubjectTO;
+import org.apache.syncope.common.lib.to.ConfTO;
+import org.apache.syncope.common.lib.to.MembershipTO;
+import org.apache.syncope.common.lib.to.RoleTO;
+import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.IntMappingType;
+import org.apache.syncope.common.lib.types.MappingPurpose;
+import org.apache.syncope.core.persistence.api.entity.AttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.Attributable;
+import org.apache.syncope.core.persistence.api.entity.AttributableUtil;
+import org.apache.syncope.core.persistence.api.entity.DerAttr;
+import org.apache.syncope.core.persistence.api.entity.DerSchema;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.MappingItem;
+import org.apache.syncope.core.persistence.api.entity.PlainAttr;
+import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+import org.apache.syncope.core.persistence.api.entity.VirAttr;
+import org.apache.syncope.core.persistence.api.entity.VirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPAConf;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerAttr;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttr;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMembership;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerAttr;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirAttr;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARole;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerAttr;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUVirAttr;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
+import org.apache.syncope.core.misc.spring.BeanUtils;
+import org.identityconnectors.framework.common.objects.Uid;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class JPAAttributableUtil implements AttributableUtil {
+
+    /**
+     * Logger.
+     */
+    private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(AttributableUtil.class);
+
+    private final AttributableType type;
+
+    protected JPAAttributableUtil(final AttributableType type) {
+        this.type = type;
+    }
+
+    @Override
+    public AttributableType getType() {
+        return type;
+    }
+
+    @Override
+    public <T extends Attributable<?, ?, ?>> Class<T> attributableClass() {
+        Class result;
+
+        switch (type) {
+            case ROLE:
+                result = JPARole.class;
+                break;
+
+            case MEMBERSHIP:
+                result = JPAMembership.class;
+                break;
+
+            case CONFIGURATION:
+                result = JPAConf.class;
+                break;
+
+            case USER:
+            default:
+                result = JPAUser.class;
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends PlainSchema> Class<T> plainSchemaClass() {
+        Class result;
+
+        switch (type) {
+            case ROLE:
+                result = JPARPlainSchema.class;
+                break;
+
+            case MEMBERSHIP:
+                result = JPAMPlainSchema.class;
+                break;
+
+            case CONFIGURATION:
+                result = JPACPlainSchema.class;
+                break;
+
+            case USER:
+            default:
+                result = JPAUPlainSchema.class;
+                break;
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends PlainSchema> T newPlainSchema() {
+        T result = null;
+
+        switch (type) {
+            case USER:
+                result = (T) new JPAUPlainSchema();
+                break;
+
+            case ROLE:
+                result = (T) new JPARPlainSchema();
+                break;
+
+            case MEMBERSHIP:
+                result = (T) new JPAMPlainSchema();
+                break;
+
+            case CONFIGURATION:
+                result = (T) new JPACPlainSchema();
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends PlainAttr> Class<T> plainAttrClass() {
+        Class result = null;
+
+        switch (type) {
+            case ROLE:
+                result = JPARPlainAttr.class;
+                break;
+
+            case MEMBERSHIP:
+                result = JPAMPlainAttr.class;
+                break;
+
+            case CONFIGURATION:
+                result = JPACPlainAttr.class;
+                break;
+
+            case USER:
+            default:
+                result = JPAUPlainAttr.class;
+                break;
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends PlainAttr> T newPlainAttr() {
+        T result = null;
+
+        switch (type) {
+            case USER:
+                result = (T) new JPAUPlainAttr();
+                break;
+
+            case ROLE:
+                result = (T) new JPARPlainAttr();
+                break;
+
+            case MEMBERSHIP:
+                result = (T) new JPAMPlainAttr();
+                break;
+
+            case CONFIGURATION:
+                result = (T) new JPACPlainAttr();
+
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends PlainAttrValue> Class<T> plainAttrValueClass() {
+        Class result;
+
+        switch (type) {
+            case ROLE:
+                result = JPARPlainAttrValue.class;
+                break;
+
+            case MEMBERSHIP:
+                result = JPAMPlainAttrValue.class;
+                break;
+
+            case CONFIGURATION:
+                result = JPACPlainAttrValue.class;
+                break;
+
+            case USER:
+            default:
+                result = JPAUPlainAttrValue.class;
+                break;
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends PlainAttrValue> T newPlainAttrValue() {
+        T result = null;
+
+        switch (type) {
+            case USER:
+                result = (T) new JPAUPlainAttrValue();
+                break;
+
+            case ROLE:
+                result = (T) new JPARPlainAttrValue();
+                break;
+
+            case MEMBERSHIP:
+                result = (T) new JPAMPlainAttrValue();
+                break;
+
+            case CONFIGURATION:
+                result = (T) new JPACPlainAttrValue();
+                break;
+
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends PlainAttrValue> Class<T> plainAttrUniqueValueClass() {
+        Class result;
+
+        switch (type) {
+            case ROLE:
+                result = JPARPlainAttrUniqueValue.class;
+                break;
+
+            case MEMBERSHIP:
+                result = JPAMPlainAttrUniqueValue.class;
+                break;
+
+            case CONFIGURATION:
+                result = JPACPlainAttrUniqueValue.class;
+                break;
+
+            case USER:
+            default:
+                result = JPAUPlainAttrUniqueValue.class;
+                break;
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends PlainAttrValue> T newPlainAttrUniqueValue() {
+        T result = null;
+
+        switch (type) {
+            case USER:
+                result = (T) new JPAUPlainAttrUniqueValue();
+                break;
+
+            case ROLE:
+                result = (T) new JPARPlainAttrUniqueValue();
+                break;
+
+            case MEMBERSHIP:
+                result = (T) new JPAMPlainAttrUniqueValue();
+                break;
+
+            case CONFIGURATION:
+                result = (T) new JPACPlainAttrUniqueValue();
+                break;
+
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends AttrTemplate<PlainSchema>> Class<T> plainAttrTemplateClass() {
+        Class result;
+
+        switch (type) {
+            case ROLE:
+                result = JPARPlainAttrTemplate.class;
+                break;
+
+            case MEMBERSHIP:
+                result = JPAMPlainAttrTemplate.class;
+                break;
+
+            case USER:
+            case CONFIGURATION:
+            default:
+                result = null;
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends DerSchema> Class<T> derSchemaClass() {
+        Class result;
+
+        switch (type) {
+            case USER:
+                result = JPAUDerSchema.class;
+                break;
+
+            case ROLE:
+                result = JPARDerSchema.class;
+                break;
+
+            case MEMBERSHIP:
+                result = JPAMDerSchema.class;
+                break;
+
+            case CONFIGURATION:
+            default:
+                result = null;
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends DerSchema> T newDerSchema() {
+        T result = null;
+
+        switch (type) {
+            case USER:
+                result = (T) new JPAUDerSchema();
+                break;
+
+            case ROLE:
+                result = (T) new JPARDerSchema();
+                break;
+
+            case MEMBERSHIP:
+                result = (T) new JPAMDerSchema();
+                break;
+
+            case CONFIGURATION:
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends DerAttr> Class<T> derAttrClass() {
+        Class result = null;
+
+        switch (type) {
+            case USER:
+                result = JPAUDerAttr.class;
+                break;
+
+            case ROLE:
+                result = JPARDerAttr.class;
+                break;
+
+            case MEMBERSHIP:
+                result = JPAMDerAttr.class;
+                break;
+
+            case CONFIGURATION:
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends DerAttr> T newDerAttr() {
+        T result = null;
+
+        switch (type) {
+            case USER:
+                result = (T) new JPAUDerAttr();
+                break;
+
+            case ROLE:
+                result = (T) new JPARDerAttr();
+                break;
+
+            case MEMBERSHIP:
+                result = (T) new JPAMDerAttr();
+                break;
+
+            case CONFIGURATION:
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends AttrTemplate<DerSchema>> Class<T> derAttrTemplateClass() {
+        Class result = null;
+
+        switch (type) {
+            case USER:
+                break;
+
+            case ROLE:
+                result = JPARDerAttrTemplate.class;
+                break;
+
+            case MEMBERSHIP:
+                result = JPAMDerAttrTemplate.class;
+                break;
+
+            case CONFIGURATION:
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends VirSchema> Class<T> virSchemaClass() {
+        Class result = null;
+
+        switch (type) {
+            case USER:
+                result = JPAUVirSchema.class;
+                break;
+
+            case ROLE:
+                result = JPARVirSchema.class;
+                break;
+
+            case MEMBERSHIP:
+                result = JPAMVirSchema.class;
+                break;
+
+            case CONFIGURATION:
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends VirSchema> T newVirSchema() {
+        T result = null;
+
+        switch (type) {
+            case USER:
+                result = (T) new JPAUVirSchema();
+                break;
+
+            case ROLE:
+                result = (T) new JPARVirSchema();
+                break;
+
+            case MEMBERSHIP:
+                result = (T) new JPAMVirSchema();
+                break;
+
+            case CONFIGURATION:
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends VirAttr> Class<T> virAttrClass() {
+        Class result = null;
+
+        switch (type) {
+            case USER:
+                result = JPAUVirAttr.class;
+                break;
+
+            case ROLE:
+                result = JPARVirAttr.class;
+                break;
+
+            case MEMBERSHIP:
+                result = JPAMVirAttr.class;
+                break;
+
+            case CONFIGURATION:
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends VirAttr> T newVirAttr() {
+        T result = null;
+
+        switch (type) {
+            case USER:
+                result = (T) new JPAUVirAttr();
+                break;
+
+            case ROLE:
+                result = (T) new JPARVirAttr();
+                break;
+
+            case MEMBERSHIP:
+                result = (T) new JPAMVirAttr();
+                break;
+
+            case CONFIGURATION:
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends AttrTemplate<VirSchema>> Class<T> virAttrTemplateClass() {
+        Class result = null;
+
+        switch (type) {
+            case USER:
+                break;
+
+            case ROLE:
+                result = JPARVirAttrTemplate.class;
+                break;
+
+            case MEMBERSHIP:
+                result = JPAMVirAttrTemplate.class;
+                break;
+
+            case CONFIGURATION:
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends MappingItem> T getAccountIdItem(final ExternalResource resource) {
+        T result = null;
+
+        if (resource != null) {
+            switch (type) {
+                case ROLE:
+                    if (resource.getRmapping() != null) {
+                        result = (T) resource.getRmapping().getAccountIdItem();
+                    }
+                    break;
+
+                case MEMBERSHIP:
+                case USER:
+                    if (resource.getUmapping() != null) {
+                        result = (T) resource.getUmapping().getAccountIdItem();
+                    }
+                    break;
+
+                default:
+            }
+        }
+
+        return result;
+    }
+
+    @Override
+    public String getAccountLink(final ExternalResource resource) {
+        String result = null;
+
+        if (resource != null) {
+            switch (type) {
+                case USER:
+                    if (resource.getUmapping() != null) {
+                        result = resource.getUmapping().getAccountLink();
+                    }
+                    break;
+
+                case ROLE:
+                    if (resource.getRmapping() != null) {
+                        result = resource.getRmapping().getAccountLink();
+                    }
+                    break;
+
+                case MEMBERSHIP:
+                case CONFIGURATION:
+                default:
+            }
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends MappingItem> List<T> getMappingItems(
+            final ExternalResource resource, final MappingPurpose purpose) {
+
+        List<T> items = Collections.<T>emptyList();
+
+        if (resource != null) {
+            switch (type) {
+                case ROLE:
+                    if (resource.getRmapping() != null) {
+                        items = (List<T>) resource.getRmapping().getItems();
+                    }
+                    break;
+
+                case MEMBERSHIP:
+                case USER:
+                    if (resource.getUmapping() != null) {
+                        items = (List<T>) resource.getUmapping().getItems();
+                    }
+                    break;
+
+                default:
+            }
+        }
+
+        final List<T> result = new ArrayList<>();
+
+        switch (purpose) {
+            case SYNCHRONIZATION:
+                for (T item : items) {
+                    if (MappingPurpose.PROPAGATION != item.getPurpose()
+                            && MappingPurpose.NONE != item.getPurpose()) {
+
+                        result.add(item);
+                    }
+                }
+                break;
+
+            case PROPAGATION:
+                for (T item : items) {
+                    if (MappingPurpose.SYNCHRONIZATION != item.getPurpose()
+                            && MappingPurpose.NONE != item.getPurpose()) {
+
+                        result.add(item);
+                    }
+                }
+                break;
+
+            case BOTH:
+                for (T item : items) {
+                    if (MappingPurpose.NONE != item.getPurpose()) {
+                        result.add(item);
+                    }
+                }
+                break;
+
+            case NONE:
+                for (T item : items) {
+                    if (MappingPurpose.NONE == item.getPurpose()) {
+                        result.add(item);
+                    }
+                }
+                break;
+            default:
+                LOG.error("You requested not existing purpose {}", purpose);
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends MappingItem> List<T> getUidToMappingItems(
+            final ExternalResource resource, final MappingPurpose purpose) {
+
+        List<T> items = getMappingItems(resource, purpose);
+
+        MappingItem uidItem = type == AttributableType.USER ? new JPAUMappingItem() : new JPARMappingItem();
+        BeanUtils.copyProperties(getAccountIdItem(resource), uidItem);
+        uidItem.setExtAttrName(Uid.NAME);
+        uidItem.setAccountid(false);
+        items.add((T) uidItem);
+
+        return items;
+    }
+
+    @Override
+    public IntMappingType intMappingType() {
+        IntMappingType result = null;
+
+        switch (type) {
+            case ROLE:
+                result = IntMappingType.RolePlainSchema;
+                break;
+
+            case MEMBERSHIP:
+                result = IntMappingType.MembershipPlainSchema;
+                break;
+
+            case USER:
+                result = IntMappingType.UserPlainSchema;
+                break;
+
+            case CONFIGURATION:
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public IntMappingType derIntMappingType() {
+        IntMappingType result = null;
+
+        switch (type) {
+            case ROLE:
+                result = IntMappingType.RoleDerivedSchema;
+                break;
+
+            case MEMBERSHIP:
+                result = IntMappingType.MembershipDerivedSchema;
+                break;
+
+            case USER:
+                result = IntMappingType.UserDerivedSchema;
+                break;
+
+            case CONFIGURATION:
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public IntMappingType virIntMappingType() {
+        IntMappingType result = null;
+
+        switch (type) {
+            case ROLE:
+                result = IntMappingType.RoleVirtualSchema;
+                break;
+
+            case MEMBERSHIP:
+                result = IntMappingType.MembershipVirtualSchema;
+                break;
+
+            case USER:
+                result = IntMappingType.UserVirtualSchema;
+                break;
+
+            case CONFIGURATION:
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends MappingItem> Class<T> mappingItemClass() {
+        Class result = null;
+
+        switch (type) {
+            case USER:
+                result = JPAUMappingItem.class;
+                break;
+
+            case ROLE:
+                result = JPARMappingItem.class;
+                break;
+
+            case MEMBERSHIP:
+                result = AbstractMappingItem.class;
+                break;
+
+            case CONFIGURATION:
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends AbstractAttributableTO> T newAttributableTO() {
+        T result = null;
+
+        switch (type) {
+            case USER:
+                result = (T) new UserTO();
+                break;
+            case ROLE:
+                result = (T) new RoleTO();
+                break;
+            case MEMBERSHIP:
+                result = (T) new MembershipTO();
+                break;
+            case CONFIGURATION:
+                result = (T) new ConfTO();
+                break;
+            default:
+        }
+
+        return result;
+    }
+
+    @Override
+    public <T extends AbstractSubjectTO> T newSubjectTO() {
+        T result = null;
+
+        switch (type) {
+            case USER:
+                result = (T) new UserTO();
+                break;
+            case ROLE:
+                result = (T) new RoleTO();
+                break;
+            case MEMBERSHIP:
+            case CONFIGURATION:
+            default:
+                break;
+        }
+
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java
----------------------------------------------------------------------
diff --git a/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java
new file mode 100644
index 0000000..048ea6a
--- /dev/null
+++ b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnInstance.java
@@ -0,0 +1,268 @@
+/*
+ * 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.core.persistence.jpa.entity;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import javax.persistence.CascadeType;
+import javax.persistence.CollectionTable;
+import javax.persistence.Column;
+import javax.persistence.ElementCollection;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.Lob;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.types.ConnConfProperty;
+import org.apache.syncope.common.lib.types.ConnectorCapability;
+import org.apache.syncope.core.persistence.api.entity.ConnInstance;
+import org.apache.syncope.core.persistence.api.entity.ConnPoolConf;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+import org.apache.syncope.core.persistence.jpa.validation.entity.ConnInstanceCheck;
+import org.apache.syncope.core.misc.serialization.POJOHelper;
+
+@Entity
+@Table(name = JPAConnInstance.TABLE)
+@ConnInstanceCheck
+public class JPAConnInstance extends AbstractEntity<Long> implements ConnInstance {
+
+    private static final long serialVersionUID = -2294708794497208872L;
+
+    public static final String TABLE = "ConnInstance";
+
+    private static final int DEFAULT_TIMEOUT = 10;
+
+    @Id
+    private Long id;
+
+    /**
+     * URI identifying the local / remote ConnId location where the related connector bundle is found.
+     */
+    @Column(nullable = false)
+    private String location;
+
+    /**
+     * Connector bundle class name.
+     * Within a given location, the triple
+     * (ConnectorBundle-Name, ConnectorBundle-Version, ConnectorBundle-Version) must be unique.
+     */
+    @Column(nullable = false)
+    private String connectorName;
+
+    /**
+     * Qualified name for the connector bundle.
+     * Within a given location, the triple
+     * (ConnectorBundle-Name, ConnectorBundle-Version, ConnectorBundle-Version) must be unique.
+     */
+    @Column(nullable = false)
+    private String bundleName;
+
+    /**
+     * Version of the bundle.
+     * Within a given location, the triple
+     * (ConnectorBundle-Name, ConnectorBundle-Version, ConnectorBundle-Version) must be unique.
+     */
+    @Column(nullable = false)
+    private String version;
+
+    /**
+     * The set of capabilities supported by this connector instance.
+     */
+    @ElementCollection(fetch = FetchType.EAGER)
+    @Enumerated(EnumType.STRING)
+    @Column(name = "capabilities")
+    @CollectionTable(name = "ConnInstance_capabilities",
+            joinColumns =
+            @JoinColumn(name = "ConnInstance_id", referencedColumnName = "id"))
+    private Set<ConnectorCapability> capabilities;
+
+    /**
+     * The main configuration for the connector instance. This is directly implemented by the Configuration bean class
+     * which contains annotated ConfigurationProperties.
+     *
+     * @see org.identityconnectors.framework.api.ConfigurationProperty
+     */
+    @Lob
+    private String jsonConf;
+
+    @Column(unique = true)
+    private String displayName;
+
+    /**
+     * External resources associated to the connector.
+     */
+    @OneToMany(cascade = { CascadeType.ALL }, mappedBy = "connector")
+    private List<JPAExternalResource> resources;
+
+    /**
+     * Connector request timeout. It is not applied in case of sync, full reconciliation and search.
+     * DEFAULT_TIMEOUT is the default value to be used in case of unspecified timeout.
+     */
+    private Integer connRequestTimeout = DEFAULT_TIMEOUT;
+
+    private JPAConnPoolConf poolConf;
+
+    public JPAConnInstance() {
+        super();
+
+        capabilities = new HashSet<>();
+        resources = new ArrayList<>();
+    }
+
+    @Override
+    public Long getKey() {
+        return id;
+    }
+
+    @Override
+    public String getLocation() {
+        return location;
+    }
+
+    @Override
+    public void setLocation(final String location) {
+        this.location = location;
+    }
+
+    @Override
+    public String getConnectorName() {
+        return connectorName;
+    }
+
+    @Override
+    public void setConnectorName(final String connectorName) {
+        this.connectorName = connectorName;
+    }
+
+    @Override
+    public String getBundleName() {
+        return bundleName;
+    }
+
+    @Override
+    public void setBundleName(final String bundleName) {
+        this.bundleName = bundleName;
+    }
+
+    @Override
+    public String getVersion() {
+        return version;
+    }
+
+    @Override
+    public void setVersion(final String version) {
+        this.version = version;
+    }
+
+    @Override
+    public Set<ConnConfProperty> getConfiguration() {
+        Set<ConnConfProperty> configuration = Collections.<ConnConfProperty>emptySet();
+        if (!StringUtils.isBlank(jsonConf)) {
+            ConnConfProperty[] deserialized = POJOHelper.deserialize(jsonConf, ConnConfProperty[].class);
+            if (ArrayUtils.isNotEmpty(deserialized)) {
+                configuration = new HashSet<>(Arrays.asList(deserialized));
+            }
+        }
+
+        return configuration;
+    }
+
+    @Override
+    public void setConfiguration(final Set<ConnConfProperty> configuration) {
+        jsonConf = POJOHelper.serialize(new HashSet<>(configuration));
+    }
+
+    @Override
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    @Override
+    public void setDisplayName(final String displayName) {
+        this.displayName = displayName;
+    }
+
+    @Override
+    public List<? extends ExternalResource> getResources() {
+        return this.resources;
+    }
+
+    @Override
+    public boolean addResource(final ExternalResource resource) {
+        checkType(resource, JPAExternalResource.class);
+        return this.resources.contains((JPAExternalResource) resource)
+                || this.resources.add((JPAExternalResource) resource);
+    }
+
+    @Override
+    public boolean removeResource(final ExternalResource resource) {
+        checkType(resource, JPAExternalResource.class);
+        return this.resources.remove((JPAExternalResource) resource);
+    }
+
+    @Override
+    public boolean addCapability(final ConnectorCapability capabitily) {
+        return capabilities.add(capabitily);
+    }
+
+    @Override
+    public boolean removeCapability(final ConnectorCapability capabitily) {
+        return capabilities.remove(capabitily);
+    }
+
+    @Override
+    public Set<ConnectorCapability> getCapabilities() {
+        return capabilities;
+    }
+
+    @Override
+    public Integer getConnRequestTimeout() {
+        // DEFAULT_TIMEOUT will be returned in case of null timeout:
+        // * instances created by the content loader 
+        // * or with a timeout nullified explicitely
+        return connRequestTimeout == null ? DEFAULT_TIMEOUT : connRequestTimeout;
+    }
+
+    @Override
+    public void setConnRequestTimeout(final Integer timeout) {
+        this.connRequestTimeout = timeout;
+    }
+
+    @Override
+    public ConnPoolConf getPoolConf() {
+        return poolConf;
+    }
+
+    @Override
+    public void setPoolConf(final ConnPoolConf poolConf) {
+        checkType(poolConf, JPAConnPoolConf.class);
+        this.poolConf = (JPAConnPoolConf) poolConf;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnPoolConf.java
----------------------------------------------------------------------
diff --git a/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnPoolConf.java b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnPoolConf.java
new file mode 100644
index 0000000..2d40dd4
--- /dev/null
+++ b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAConnPoolConf.java
@@ -0,0 +1,107 @@
+/*
+ * 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.core.persistence.jpa.entity;
+
+import java.io.Serializable;
+import javax.persistence.Embeddable;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.syncope.core.persistence.api.entity.ConnPoolConf;
+
+@Embeddable
+public class JPAConnPoolConf implements ConnPoolConf, Serializable {
+
+    private static final long serialVersionUID = -34259572059178970L;
+
+    private Integer maxObjects;
+
+    private Integer minIdle;
+
+    private Integer maxIdle;
+
+    private Long maxWait;
+
+    private Long minEvictableIdleTimeMillis;
+
+    @Override
+    public Integer getMaxObjects() {
+        return maxObjects;
+    }
+
+    @Override
+    public void setMaxObjects(final Integer maxObjects) {
+        this.maxObjects = maxObjects;
+    }
+
+    @Override
+    public Integer getMinIdle() {
+        return minIdle;
+    }
+
+    @Override
+    public void setMinIdle(final Integer minIdle) {
+        this.minIdle = minIdle;
+    }
+
+    @Override
+    public Integer getMaxIdle() {
+        return maxIdle;
+    }
+
+    @Override
+    public void setMaxIdle(final Integer maxIdle) {
+        this.maxIdle = maxIdle;
+    }
+
+    @Override
+    public Long getMaxWait() {
+        return maxWait;
+    }
+
+    @Override
+    public void setMaxWait(final Long maxWait) {
+        this.maxWait = maxWait;
+    }
+
+    @Override
+    public Long getMinEvictableIdleTimeMillis() {
+        return minEvictableIdleTimeMillis;
+    }
+
+    @Override
+    public void setMinEvictableIdleTimeMillis(final Long minEvictableIdleTimeMillis) {
+        this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        return EqualsBuilder.reflectionEquals(this, obj);
+    }
+
+    @Override
+    public int hashCode() {
+        return HashCodeBuilder.reflectionHashCode(this);
+    }
+
+    @Override
+    public String toString() {
+        return ToStringBuilder.reflectionToString(this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntitlement.java
----------------------------------------------------------------------
diff --git a/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntitlement.java b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntitlement.java
new file mode 100644
index 0000000..0ff7e05
--- /dev/null
+++ b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntitlement.java
@@ -0,0 +1,62 @@
+/*
+ * 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.core.persistence.jpa.entity;
+
+import javax.persistence.Cacheable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import org.apache.syncope.core.persistence.api.entity.Entitlement;
+
+@Entity
+@Table(name = JPAEntitlement.TABLE)
+@Cacheable
+public class JPAEntitlement extends AbstractEntity<String> implements Entitlement {
+
+    private static final long serialVersionUID = 8044745999246422483L;
+
+    public static final String TABLE = "Entitlement";
+
+    @Id
+    private String name;
+
+    @Column(nullable = true)
+    private String description;
+
+    @Override
+    public String getKey() {
+        return name;
+    }
+
+    @Override
+    public void setKey(final String key) {
+        this.name = key;
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    @Override
+    public void setDescription(final String description) {
+        this.description = description;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
----------------------------------------------------------------------
diff --git a/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
new file mode 100644
index 0000000..202a605
--- /dev/null
+++ b/syncope620/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
@@ -0,0 +1,290 @@
+/*
+ * 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.core.persistence.jpa.entity;
+
+import org.apache.syncope.core.persistence.api.entity.AccountPolicy;
+import org.apache.syncope.core.persistence.api.entity.ConnInstance;
+import org.apache.syncope.core.persistence.api.entity.ConnPoolConf;
+import org.apache.syncope.core.persistence.api.entity.Entitlement;
+import org.apache.syncope.core.persistence.api.entity.Entity;
+import org.apache.syncope.core.persistence.api.entity.EntityFactory;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.Logger;
+import org.apache.syncope.core.persistence.api.entity.Notification;
+import org.apache.syncope.core.persistence.api.entity.PasswordPolicy;
+import org.apache.syncope.core.persistence.api.entity.Policy;
+import org.apache.syncope.core.persistence.api.entity.PushPolicy;
+import org.apache.syncope.core.persistence.api.entity.Report;
+import org.apache.syncope.core.persistence.api.entity.ReportExec;
+import org.apache.syncope.core.persistence.api.entity.ReportletConfInstance;
+import org.apache.syncope.core.persistence.api.entity.SyncPolicy;
+import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.conf.CPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.conf.Conf;
+import org.apache.syncope.core.persistence.api.entity.membership.MDerAttr;
+import org.apache.syncope.core.persistence.api.entity.membership.MDerAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.membership.MDerSchema;
+import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.api.entity.membership.MPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.membership.MPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.membership.MVirAttr;
+import org.apache.syncope.core.persistence.api.entity.membership.MVirAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.membership.MVirSchema;
+import org.apache.syncope.core.persistence.api.entity.membership.Membership;
+import org.apache.syncope.core.persistence.api.entity.role.RDerAttr;
+import org.apache.syncope.core.persistence.api.entity.role.RDerAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.role.RDerSchema;
+import org.apache.syncope.core.persistence.api.entity.role.RMapping;
+import org.apache.syncope.core.persistence.api.entity.role.RMappingItem;
+import org.apache.syncope.core.persistence.api.entity.role.RPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.api.entity.role.RPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.role.RPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.role.RVirAttr;
+import org.apache.syncope.core.persistence.api.entity.role.RVirAttrTemplate;
+import org.apache.syncope.core.persistence.api.entity.role.RVirSchema;
+import org.apache.syncope.core.persistence.api.entity.role.Role;
+import org.apache.syncope.core.persistence.api.entity.task.NotificationTask;
+import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
+import org.apache.syncope.core.persistence.api.entity.task.PushTask;
+import org.apache.syncope.core.persistence.api.entity.task.SchedTask;
+import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
+import org.apache.syncope.core.persistence.api.entity.task.TaskExec;
+import org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion;
+import org.apache.syncope.core.persistence.api.entity.user.UDerAttr;
+import org.apache.syncope.core.persistence.api.entity.user.UDerSchema;
+import org.apache.syncope.core.persistence.api.entity.user.UMapping;
+import org.apache.syncope.core.persistence.api.entity.user.UMappingItem;
+import org.apache.syncope.core.persistence.api.entity.user.UPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrValue;
+import org.apache.syncope.core.persistence.api.entity.user.UPlainSchema;
+import org.apache.syncope.core.persistence.api.entity.user.UVirAttr;
+import org.apache.syncope.core.persistence.api.entity.user.UVirSchema;
+import org.apache.syncope.core.persistence.api.entity.user.User;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPACPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.conf.JPAConf;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerAttr;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttr;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.membership.JPAMembership;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerAttr;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARMapping;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirAttr;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirAttrTemplate;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.role.JPARole;
+import org.apache.syncope.core.persistence.jpa.entity.task.JPANotificationTask;
+import org.apache.syncope.core.persistence.jpa.entity.task.JPAPropagationTask;
+import org.apache.syncope.core.persistence.jpa.entity.task.JPAPushTask;
+import org.apache.syncope.core.persistence.jpa.entity.task.JPASchedTask;
+import org.apache.syncope.core.persistence.jpa.entity.task.JPASyncTask;
+import org.apache.syncope.core.persistence.jpa.entity.task.JPATaskExec;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerAttr;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUDerSchema;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUMapping;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUMappingItem;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttr;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrUniqueValue;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainAttrValue;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUPlainSchema;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUVirAttr;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUVirSchema;
+import org.apache.syncope.core.persistence.jpa.entity.user.JPAUser;
+import org.springframework.stereotype.Component;
+
+@Component
+public class JPAEntityFactory implements EntityFactory {
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public <KEY, T extends Entity<KEY>> T newEntity(final Class<T> reference) {
+        T result;
+
+        if (reference.equals(User.class)) {
+            result = (T) new JPAUser();
+        } else if (reference.equals(Role.class)) {
+            result = (T) new JPARole();
+        } else if (reference.equals(Membership.class)) {
+            result = (T) new JPAMembership();
+        } else if (reference.equals(Conf.class)) {
+            result = (T) new JPAConf();
+        } else if (reference.equals(Notification.class)) {
+            result = (T) new JPANotification();
+        } else if (reference.equals(Entitlement.class)) {
+            result = (T) new JPAEntitlement();
+        } else if (reference.equals(ExternalResource.class)) {
+            result = (T) new JPAExternalResource();
+        } else if (reference.equals(ConnInstance.class)) {
+            result = (T) new JPAConnInstance();
+        } else if (reference.equals(UPlainSchema.class)) {
+            result = (T) new JPAUPlainSchema();
+        } else if (reference.equals(UPlainAttr.class)) {
+            result = (T) new JPAUPlainAttr();
+        } else if (reference.equals(UPlainAttrValue.class)) {
+            result = (T) new JPAUPlainAttrValue();
+        } else if (reference.equals(UPlainAttrUniqueValue.class)) {
+            result = (T) new JPAUPlainAttrUniqueValue();
+        } else if (reference.equals(UDerSchema.class)) {
+            result = (T) new JPAUDerSchema();
+        } else if (reference.equals(UDerAttr.class)) {
+            result = (T) new JPAUDerAttr();
+        } else if (reference.equals(UVirSchema.class)) {
+            result = (T) new JPAUVirSchema();
+        } else if (reference.equals(UVirAttr.class)) {
+            result = (T) new JPAUVirAttr();
+        } else if (reference.equals(UMapping.class)) {
+            result = (T) new JPAUMapping();
+        } else if (reference.equals(UMappingItem.class)) {
+            result = (T) new JPAUMappingItem();
+        } else if (reference.equals(RPlainSchema.class)) {
+            result = (T) new JPARPlainSchema();
+        } else if (reference.equals(RPlainAttr.class)) {
+            result = (T) new JPARPlainAttr();
+        } else if (reference.equals(RPlainAttrValue.class)) {
+            result = (T) new JPARPlainAttrValue();
+        } else if (reference.equals(RPlainAttrUniqueValue.class)) {
+            result = (T) new JPARPlainAttrUniqueValue();
+        } else if (reference.equals(RPlainAttrTemplate.class)) {
+            result = (T) new JPARPlainAttrTemplate();
+        } else if (reference.equals(RDerAttrTemplate.class)) {
+            result = (T) new JPARDerAttrTemplate();
+        } else if (reference.equals(RVirAttrTemplate.class)) {
+            result = (T) new JPARVirAttrTemplate();
+        } else if (reference.equals(RDerSchema.class)) {
+            result = (T) new JPARDerSchema();
+        } else if (reference.equals(RDerAttr.class)) {
+            result = (T) new JPARDerAttr();
+        } else if (reference.equals(RVirSchema.class)) {
+            result = (T) new JPARVirSchema();
+        } else if (reference.equals(RVirAttr.class)) {
+            result = (T) new JPARVirAttr();
+        } else if (reference.equals(RMapping.class)) {
+            result = (T) new JPARMapping();
+        } else if (reference.equals(RMappingItem.class)) {
+            result = (T) new JPARMappingItem();
+        } else if (reference.equals(MPlainSchema.class)) {
+            result = (T) new JPAMPlainSchema();
+        } else if (reference.equals(MPlainAttr.class)) {
+            result = (T) new JPAMPlainAttr();
+        } else if (reference.equals(MPlainAttrValue.class)) {
+            result = (T) new JPAMPlainAttrValue();
+        } else if (reference.equals(MPlainAttrUniqueValue.class)) {
+            result = (T) new JPAMPlainAttrUniqueValue();
+        } else if (reference.equals(MDerSchema.class)) {
+            result = (T) new JPAMDerSchema();
+        } else if (reference.equals(MDerAttr.class)) {
+            result = (T) new JPAMDerAttr();
+        } else if (reference.equals(MVirSchema.class)) {
+            result = (T) new JPAMVirSchema();
+        } else if (reference.equals(MVirAttr.class)) {
+            result = (T) new JPAMVirAttr();
+        } else if (reference.equals(MPlainAttrTemplate.class)) {
+            result = (T) new JPAMPlainAttrTemplate();
+        } else if (reference.equals(MDerAttrTemplate.class)) {
+            result = (T) new JPAMDerAttrTemplate();
+        } else if (reference.equals(MVirAttrTemplate.class)) {
+            result = (T) new JPAMVirAttrTemplate();
+        } else if (reference.equals(CPlainSchema.class)) {
+            result = (T) new JPACPlainSchema();
+        } else if (reference.equals(CPlainAttr.class)) {
+            result = (T) new JPACPlainAttr();
+        } else if (reference.equals(CPlainAttrValue.class)) {
+            result = (T) new JPACPlainAttrValue();
+        } else if (reference.equals(CPlainAttrUniqueValue.class)) {
+            result = (T) new JPACPlainAttrUniqueValue();
+        } else if (reference.equals(Report.class)) {
+            result = (T) new JPAReport();
+        } else if (reference.equals(ReportExec.class)) {
+            result = (T) new JPAReportExec();
+        } else if (reference.equals(ReportletConfInstance.class)) {
+            result = (T) new JPAReportletConfInstance();
+        } else if (reference.equals(NotificationTask.class)) {
+            result = (T) new JPANotificationTask();
+        } else if (reference.equals(PropagationTask.class)) {
+            result = (T) new JPAPropagationTask();
+        } else if (reference.equals(PushTask.class)) {
+            result = (T) new JPAPushTask();
+        } else if (reference.equals(SyncTask.class)) {
+            result = (T) new JPASyncTask();
+        } else if (reference.equals(SchedTask.class)) {
+            result = (T) new JPASchedTask();
+        } else if (reference.equals(TaskExec.class)) {
+            result = (T) new JPATaskExec();
+        } else if (reference.equals(SecurityQuestion.class)) {
+            result = (T) new JPASecurityQuestion();
+        } else if (reference.equals(Logger.class)) {
+            result = (T) new JPALogger();
+        } else {
+            throw new IllegalArgumentException("Could not find a JPA implementation of " + reference.getName());
+        }
+
+        return result;
+    }
+
+    @SuppressWarnings("unchecked")
+    @Override
+    public <T extends Policy> T newPolicy(final Class<T> reference, final boolean global) {
+        T result;
+
+        if (reference.equals(AccountPolicy.class)) {
+            result = (T) new JPAAccountPolicy(global);
+        } else if (reference.equals(PasswordPolicy.class)) {
+            result = (T) new JPAPasswordPolicy(global);
+        } else if (reference.equals(PushPolicy.class)) {
+            result = (T) new JPAPushPolicy(global);
+        } else if (reference.equals(SyncPolicy.class)) {
+            result = (T) new JPASyncPolicy(global);
+        } else {
+            throw new IllegalArgumentException("Could not find a JPA implementation of " + reference.getName());
+        }
+
+        return result;
+    }
+
+    @Override
+    public ConnPoolConf newConnPoolConf() {
+        return new JPAConnPoolConf();
+    }
+
+}