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 2016/03/09 12:52:47 UTC
[11/17] syncope git commit: Further refactoring as per SYNCOPE-620
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncCorrelationRule.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncCorrelationRule.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncCorrelationRule.java
deleted file mode 100644
index 52dfdb4..0000000
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncCorrelationRule.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.provisioning.api.sync;
-
-import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
-import org.identityconnectors.framework.common.objects.ConnectorObject;
-
-/**
- * Interface for correlation rule to be evaluated during SyncJob execution.
- */
-public interface SyncCorrelationRule {
-
- /**
- * Return a search condition.
- *
- * @param connObj connector object.
- * @return search condition.
- */
- SearchCond getSearchCond(ConnectorObject connObj);
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncopePushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncopePushResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncopePushResultHandler.java
deleted file mode 100644
index e77af9a..0000000
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncopePushResultHandler.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.provisioning.api.sync;
-
-import org.apache.syncope.core.persistence.api.entity.task.PushTask;
-
-public interface SyncopePushResultHandler extends SyncopeResultHandler<PushTask, PushActions> {
-
- boolean handle(long anyKey);
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncopeResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncopeResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncopeResultHandler.java
deleted file mode 100644
index 86e7cf0..0000000
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncopeResultHandler.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.provisioning.api.sync;
-
-import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
-
-public interface SyncopeResultHandler<T extends ProvisioningTask, A extends ProvisioningActions> {
-
- ProvisioningProfile<T, A> getProfile();
-
- void setProfile(ProvisioningProfile<T, A> profile);
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncopeSyncResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncopeSyncResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncopeSyncResultHandler.java
deleted file mode 100644
index 9eb8dc0..0000000
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/SyncopeSyncResultHandler.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.provisioning.api.sync;
-
-import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
-import org.identityconnectors.framework.common.objects.SyncDelta;
-import org.identityconnectors.framework.common.objects.SyncResultsHandler;
-
-public interface SyncopeSyncResultHandler extends SyncopeResultHandler<SyncTask, SyncActions>, SyncResultsHandler {
-
- @Override
- boolean handle(SyncDelta delta);
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/UserPushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/UserPushResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/UserPushResultHandler.java
deleted file mode 100644
index 6f0a3fc..0000000
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/UserPushResultHandler.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.provisioning.api.sync;
-
-public interface UserPushResultHandler extends SyncopePushResultHandler {
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/UserSyncResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/UserSyncResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/UserSyncResultHandler.java
deleted file mode 100644
index 9db1269..0000000
--- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/sync/UserSyncResultHandler.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.provisioning.api.sync;
-
-public interface UserSyncResultHandler extends SyncopeSyncResultHandler {
-
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/AnyObjectPushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/AnyObjectPushResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/AnyObjectPushResultHandler.java
new file mode 100644
index 0000000..4198b53
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/AnyObjectPushResultHandler.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.
+ */
+package org.apache.syncope.core.provisioning.api.syncpull;
+
+public interface AnyObjectPushResultHandler extends SyncopePushResultHandler {
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/AnyObjectSyncResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/AnyObjectSyncResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/AnyObjectSyncResultHandler.java
new file mode 100644
index 0000000..dba6377
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/AnyObjectSyncResultHandler.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.
+ */
+package org.apache.syncope.core.provisioning.api.syncpull;
+
+public interface AnyObjectSyncResultHandler extends SyncopeSyncResultHandler {
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/GroupPushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/GroupPushResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/GroupPushResultHandler.java
new file mode 100644
index 0000000..457c78e
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/GroupPushResultHandler.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.
+ */
+package org.apache.syncope.core.provisioning.api.syncpull;
+
+public interface GroupPushResultHandler extends SyncopePushResultHandler {
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/GroupSyncResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/GroupSyncResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/GroupSyncResultHandler.java
new file mode 100644
index 0000000..19c8b8f
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/GroupSyncResultHandler.java
@@ -0,0 +1,26 @@
+/*
+ * 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.provisioning.api.syncpull;
+
+import java.util.Map;
+
+public interface GroupSyncResultHandler extends SyncopeSyncResultHandler {
+
+ Map<Long, String> getGroupOwnerMap();
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/IgnoreProvisionException.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/IgnoreProvisionException.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/IgnoreProvisionException.java
new file mode 100644
index 0000000..cdd885a
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/IgnoreProvisionException.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.core.provisioning.api.syncpull;
+
+/**
+ * Raised by {@link SyncActions} or {@link PushActions} methods when the given any object is to be ignored for
+ * synchronization / push.
+ */
+public class IgnoreProvisionException extends RuntimeException {
+
+ private static final long serialVersionUID = -8803817097998786364L;
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/ProvisioningActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/ProvisioningActions.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/ProvisioningActions.java
new file mode 100644
index 0000000..7479c96
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/ProvisioningActions.java
@@ -0,0 +1,40 @@
+/*
+ * 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.provisioning.api.syncpull;
+
+import org.quartz.JobExecutionException;
+
+public interface ProvisioningActions {
+
+ /**
+ * Action to be executed before to start the synchronization task execution.
+ *
+ * @param profile sync profile
+ * @throws JobExecutionException in case of generic failure
+ */
+ void beforeAll(final ProvisioningProfile<?, ?> profile) throws JobExecutionException;
+
+ /**
+ * Action to be executed after the synchronization task completion.
+ *
+ * @param profile sync profile
+ * @throws JobExecutionException in case of generic failure
+ */
+ void afterAll(final ProvisioningProfile<?, ?> profile) throws JobExecutionException;
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/ProvisioningProfile.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/ProvisioningProfile.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/ProvisioningProfile.java
new file mode 100644
index 0000000..08ab034
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/ProvisioningProfile.java
@@ -0,0 +1,81 @@
+/*
+ * 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.provisioning.api.syncpull;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.apache.syncope.common.lib.types.ConflictResolutionAction;
+import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
+import org.apache.syncope.core.provisioning.api.Connector;
+
+public class ProvisioningProfile<T extends ProvisioningTask, A extends ProvisioningActions> {
+
+ /**
+ * Syncing connector.
+ */
+ private final Connector connector;
+
+ private final T task;
+
+ private final List<ProvisioningReport> results = new ArrayList<>();
+
+ private boolean dryRun;
+
+ private ConflictResolutionAction resAct;
+
+ private final List<A> actions = new ArrayList<>();
+
+ public ProvisioningProfile(final Connector connector, final T task) {
+ this.connector = connector;
+ this.task = task;
+ }
+
+ public Connector getConnector() {
+ return connector;
+ }
+
+ public T getTask() {
+ return task;
+ }
+
+ public Collection<ProvisioningReport> getResults() {
+ return results;
+ }
+
+ public boolean isDryRun() {
+ return dryRun;
+ }
+
+ public void setDryRun(final boolean dryRun) {
+ this.dryRun = dryRun;
+ }
+
+ public ConflictResolutionAction getResAct() {
+ return resAct;
+ }
+
+ public void setResAct(final ConflictResolutionAction resAct) {
+ this.resAct = resAct;
+ }
+
+ public List<A> getActions() {
+ return actions;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/ProvisioningReport.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/ProvisioningReport.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/ProvisioningReport.java
new file mode 100644
index 0000000..1e82796d
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/ProvisioningReport.java
@@ -0,0 +1,140 @@
+/*
+ * 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.provisioning.api.syncpull;
+
+import java.util.Collection;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.syncope.common.lib.types.ResourceOperation;
+import org.apache.syncope.common.lib.types.TraceLevel;
+
+public class ProvisioningReport {
+
+ public enum Status {
+
+ SUCCESS,
+ IGNORE,
+ FAILURE
+
+ }
+
+ private String message;
+
+ private Status status;
+
+ private String anyType;
+
+ private ResourceOperation operation;
+
+ private Long key;
+
+ private String name;
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(final String message) {
+ this.message = message;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public Long getKey() {
+ return key;
+ }
+
+ public void setKey(final Long key) {
+ this.key = key;
+ }
+
+ public Status getStatus() {
+ return status;
+ }
+
+ public void setStatus(final Status status) {
+ this.status = status;
+ }
+
+ public String getAnyType() {
+ return anyType;
+ }
+
+ public void setAnyType(final String anyType) {
+ this.anyType = anyType;
+ }
+
+ public ResourceOperation getOperation() {
+ return operation;
+ }
+
+ public void setOperation(final ResourceOperation operation) {
+ this.operation = operation;
+ }
+
+ @Override
+ public String toString() {
+ return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
+ }
+
+ /**
+ * Human readable report string, using the given trace level.
+ *
+ * @param level trace level
+ * @return String for certain levels, null for level NONE
+ */
+ public String getReportString(final TraceLevel level) {
+ if (level == TraceLevel.SUMMARY) {
+ // No per entry log in this case.
+ return null;
+ } else if (level == TraceLevel.FAILURES && status == Status.FAILURE) {
+ // only report failures
+ return String.format("Failed %s (id/name): %d/%s with message: %s", operation, key, name, message);
+ } else {
+ // All
+ return String.format("%s %s (id/name): %d/%s %s", operation, status, key, name,
+ StringUtils.isBlank(message)
+ ? ""
+ : "with message: " + message);
+ }
+ }
+
+ /**
+ * Helper method to invoke logging per synchronization result for the given trace level.
+ *
+ * @param results synchronization result
+ * @param level trace level
+ * @return report as string
+ */
+ public static String produceReport(final Collection<ProvisioningReport> results, final TraceLevel level) {
+ StringBuilder sb = new StringBuilder();
+ for (ProvisioningReport result : results) {
+ sb.append(result.getReportString(level)).append('\n');
+ }
+ return sb.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/PushActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/PushActions.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/PushActions.java
new file mode 100644
index 0000000..75e5a5f
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/PushActions.java
@@ -0,0 +1,163 @@
+/*
+ * 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.provisioning.api.syncpull;
+
+import org.apache.syncope.core.persistence.api.entity.Any;
+import org.quartz.JobExecutionException;
+
+/**
+ * Interface for actions to be performed during push.
+ * All methods can throw {@link IgnoreProvisionException} to make the current any ignored by the push process.
+ */
+public interface PushActions extends ProvisioningActions {
+
+ /**
+ * Action to be executed before to assign (link & provision) a synchronized any object to the resource.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the push being executed.
+ * @param any any object to be created.
+ * @return any.
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends Any<?>> A beforeAssign(
+ ProvisioningProfile<?, ?> profile,
+ A any) throws JobExecutionException;
+
+ /**
+ * Action to be executed before to provision a synchronized any object to the resource.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the push being executed.
+ * @param any any object to be created.
+ * @return any.
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends Any<?>> A beforeProvision(
+ ProvisioningProfile<?, ?> profile,
+ A any) throws JobExecutionException;
+
+ /**
+ * Action to be executed before to update a synchronized any object on the resource.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the push being executed.
+ * @param any any object to be updated.
+ * @return any.
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends Any<?>> A beforeUpdate(
+ ProvisioningProfile<?, ?> profile,
+ A any) throws JobExecutionException;
+
+ /**
+ * Action to be executed before to link a synchronized any object to the resource.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the push being executed.
+ * @param any any object to be created.
+ * @return any.
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends Any<?>> A beforeLink(
+ ProvisioningProfile<?, ?> profile,
+ A any) throws JobExecutionException;
+
+ /**
+ * Action to be executed before to unlink a synchronized any object from the resource.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the push being executed.
+ * @param any any object to be created.
+ * @return any.
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends Any<?>> A beforeUnlink(
+ ProvisioningProfile<?, ?> profile,
+ A any) throws JobExecutionException;
+
+ /**
+ * Action to be executed before to unassign a synchronized any object from the resource.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the push being executed.
+ * @param any any object to be created.
+ * @return any.
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends Any<?>> A beforeUnassign(
+ ProvisioningProfile<?, ?> profile,
+ A any) throws JobExecutionException;
+
+ /**
+ * Action to be executed before to unassign a synchronized any object from the resource.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the push being executed.
+ * @param any any object to be created.
+ * @return any.
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends Any<?>> A beforeDeprovision(
+ ProvisioningProfile<?, ?> profile,
+ A any) throws JobExecutionException;
+
+ /**
+ * Action to be executed before delete a synchronized any object locally and from the resource.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the push being executed.
+ * @param any any object to be created.
+ * @return any.
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends Any<?>> A beforeDelete(
+ ProvisioningProfile<?, ?> profile,
+ A any) throws JobExecutionException;
+
+ /**
+ * Action to be executed after any object push goes on error.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the push being executed.
+ * @param any synchronized any object.
+ * @param result operation result.
+ * @param error error being reported
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends Any<?>> void onError(
+ ProvisioningProfile<?, ?> profile,
+ A any,
+ ProvisioningReport result,
+ Exception error) throws JobExecutionException;
+
+ /**
+ * Action to be executed after each local any object push.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the push being executed.
+ * @param any synchronized any object.
+ * @param result operation result.
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends Any<?>> void after(
+ ProvisioningProfile<?, ?> profile,
+ A any,
+ ProvisioningReport result) throws JobExecutionException;
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/ReconciliationFilterBuilder.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/ReconciliationFilterBuilder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/ReconciliationFilterBuilder.java
new file mode 100644
index 0000000..cc073ce
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/ReconciliationFilterBuilder.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.core.provisioning.api.syncpull;
+
+import org.identityconnectors.framework.common.objects.filter.Filter;
+
+/**
+ * Interface to be implemented for performing filtered reconciliation of a
+ * {@link org.apache.syncope.core.persistence.api.entity.task.SyncTask}.
+ */
+public interface ReconciliationFilterBuilder {
+
+ Filter build();
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncActions.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncActions.java
new file mode 100644
index 0000000..ae072b7
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncActions.java
@@ -0,0 +1,203 @@
+/*
+ * 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.provisioning.api.syncpull;
+
+import org.apache.syncope.common.lib.patch.AnyPatch;
+import org.apache.syncope.common.lib.to.AnyTO;
+import org.identityconnectors.framework.common.objects.SyncDelta;
+import org.quartz.JobExecutionException;
+
+/**
+ * Interface for actions to be performed during synchronization.
+ * All methods can throw {@link IgnoreProvisionException} to make the current any object ignored by the synchronization
+ * process.
+ */
+public interface SyncActions extends ProvisioningActions {
+
+ /**
+ * Action to be executed before to create a synchronized user / group locally.
+ * User/group is created locally upon synchronization in case of the un-matching rule
+ * {@link org.apache.syncope.common.lib.types.UnmatchingRule#PROVISION} (default un-matching rule) is applied.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the synchronization being executed.
+ * @param delta retrieved synchronization information
+ * @param any any object
+ * @return synchronization information used for user status evaluation and to be passed to the 'after' method.
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends AnyTO> SyncDelta beforeProvision(
+ ProvisioningProfile<?, ?> profile,
+ SyncDelta delta,
+ A any) throws JobExecutionException;
+
+ /**
+ * Action to be executed before creating (and linking to the resource) a synchronized user / group locally.
+ * User/group is created locally and linked to the synchronized resource upon synchronization in case of the
+ * un-matching rule {@link org.apache.syncope.common.lib.types.UnmatchingRule#ASSIGN} is applied.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the synchronization being executed.
+ * @param delta retrieved synchronization information
+ * @param any any object
+ * @return synchronization information used for user status evaluation and to be passed to the 'after' method.
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends AnyTO> SyncDelta beforeAssign(
+ ProvisioningProfile<?, ?> profile,
+ SyncDelta delta,
+ A any) throws JobExecutionException;
+
+ /**
+ * Action to be executed before unlinking resource from the synchronized user / group and de-provisioning.
+ * User/group is unlinked and de-provisioned from the synchronized resource upon synchronization in case of the
+ * matching rule {@link org.apache.syncope.common.lib.types.MatchingRule#UNASSIGN} is applied.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the synchronization being executed.
+ * @param delta retrieved synchronization information
+ * @param any any object
+ * @return synchronization information used for user status evaluation and to be passed to the 'after' method.
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends AnyTO> SyncDelta beforeUnassign(
+ ProvisioningProfile<?, ?> profile,
+ SyncDelta delta,
+ A any) throws JobExecutionException;
+
+ /**
+ * Action to be executed before de-provisioning action only.
+ * User/group is de-provisioned (without unlinking) from the synchronized resource upon synchronization in case of
+ * the matching rule {@link org.apache.syncope.common.lib.types.MatchingRule#DEPROVISION} is applied.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the synchronization being executed.
+ * @param delta retrieved synchronization information
+ * @param any any object
+ * @return synchronization information used for user status evaluation and to be passed to the 'after' method.
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends AnyTO> SyncDelta beforeDeprovision(
+ ProvisioningProfile<?, ?> profile,
+ SyncDelta delta,
+ A any) throws JobExecutionException;
+
+ /**
+ * Action to be executed before unlinking resource from the synchronized user / group.
+ * User/group is unlinked (without de-provisioning) from the synchronized resource upon synchronization in case of
+ * the matching rule {@link org.apache.syncope.common.lib.types.MatchingRule#UNLINK} is applied.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the synchronization being executed.
+ * @param delta retrieved synchronization information
+ * @param any any object
+ * @return synchronization information used for user status evaluation and to be passed to the 'after' method.
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends AnyTO> SyncDelta beforeUnlink(
+ ProvisioningProfile<?, ?> profile,
+ SyncDelta delta,
+ A any) throws JobExecutionException;
+
+ /**
+ * Action to be executed before linking resource to the synchronized user / group.
+ * User/group is linked (without updating) to the synchronized resource upon synchronization in case of
+ * the matching rule {@link org.apache.syncope.common.lib.types.MatchingRule#LINK} is applied.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the synchronization being executed.
+ * @param delta retrieved synchronization information
+ * @param any any object
+ * @return synchronization information used for user status evaluation and to be passed to the 'after' method.
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends AnyTO> SyncDelta beforeLink(
+ ProvisioningProfile<?, ?> profile,
+ SyncDelta delta,
+ A any) throws JobExecutionException;
+
+ /**
+ * Action to be executed before to update a synchronized user / group locally.
+ * User/group is updated upon synchronization in case of the matching rule
+ * {@link org.apache.syncope.common.lib.types.MatchingRule#UPDATE} (default matching rule) is applied.
+ *
+ * @param <M> concrete any object
+ * @param <P> any object modifications
+ * @param profile profile of the synchronization being executed.
+ * @param delta retrieved synchronization information
+ * @param any any object
+ * @param anyPatch modification
+ * @return synchronization information used for logging and to be passed to the 'after' method.
+ * @throws JobExecutionException in case of generic failure.
+ */
+ <M extends AnyTO, P extends AnyPatch> SyncDelta beforeUpdate(
+ ProvisioningProfile<?, ?> profile,
+ SyncDelta delta,
+ M any,
+ P anyPatch)
+ throws JobExecutionException;
+
+ /**
+ * Action to be executed before to delete a synchronized user / group locally.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the synchronization being executed.
+ * @param delta retrieved synchronization information
+ * @param any any object to be deleted
+ * @return synchronization information used for logging and to be passed to the 'after' method.
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends AnyTO> SyncDelta beforeDelete(
+ ProvisioningProfile<?, ?> profile,
+ SyncDelta delta,
+ A any) throws JobExecutionException;
+
+ /**
+ * Action to be executed when user / group synchronization goes on error.
+ *
+ * @param profile profile of the synchronization being executed.
+ * @param delta retrieved synchronization information (may be modified by
+ * 'beforeProvision/beforeUpdate/beforeDelete')
+ * @param result global synchronization results at the current synchronization step
+ * @param error error being reported
+ * @throws JobExecutionException in case of generic failure
+ */
+ void onError(
+ ProvisioningProfile<?, ?> profile,
+ SyncDelta delta,
+ ProvisioningReport result,
+ Exception error) throws JobExecutionException;
+
+ /**
+ * Action to be executed after each local user / group synchronization.
+ *
+ * @param <A> concrete any object
+ * @param profile profile of the synchronization being executed.
+ * @param delta retrieved synchronization information (may be modified by beforeProvision / beforeUpdate /
+ * beforeDelete)
+ * @param any any object
+ * @param result global synchronization results at the current synchronization step
+ * @throws JobExecutionException in case of generic failure
+ */
+ <A extends AnyTO> void after(
+ ProvisioningProfile<?, ?> profile,
+ SyncDelta delta,
+ A any,
+ ProvisioningReport result) throws JobExecutionException;
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncCorrelationRule.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncCorrelationRule.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncCorrelationRule.java
new file mode 100644
index 0000000..dff841a
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncCorrelationRule.java
@@ -0,0 +1,36 @@
+/*
+ * 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.provisioning.api.syncpull;
+
+import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
+import org.identityconnectors.framework.common.objects.ConnectorObject;
+
+/**
+ * Interface for correlation rule to be evaluated during SyncJob execution.
+ */
+public interface SyncCorrelationRule {
+
+ /**
+ * Return a search condition.
+ *
+ * @param connObj connector object.
+ * @return search condition.
+ */
+ SearchCond getSearchCond(ConnectorObject connObj);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncopePushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncopePushResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncopePushResultHandler.java
new file mode 100644
index 0000000..deb6e9b
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncopePushResultHandler.java
@@ -0,0 +1,26 @@
+/*
+ * 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.provisioning.api.syncpull;
+
+import org.apache.syncope.core.persistence.api.entity.task.PushTask;
+
+public interface SyncopePushResultHandler extends SyncopeResultHandler<PushTask, PushActions> {
+
+ boolean handle(long anyKey);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncopeResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncopeResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncopeResultHandler.java
new file mode 100644
index 0000000..c078ef2
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncopeResultHandler.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.core.provisioning.api.syncpull;
+
+import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
+
+public interface SyncopeResultHandler<T extends ProvisioningTask, A extends ProvisioningActions> {
+
+ ProvisioningProfile<T, A> getProfile();
+
+ void setProfile(ProvisioningProfile<T, A> profile);
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncopeSyncResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncopeSyncResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncopeSyncResultHandler.java
new file mode 100644
index 0000000..5c293830
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/SyncopeSyncResultHandler.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.core.provisioning.api.syncpull;
+
+import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
+import org.identityconnectors.framework.common.objects.SyncDelta;
+import org.identityconnectors.framework.common.objects.SyncResultsHandler;
+
+public interface SyncopeSyncResultHandler extends SyncopeResultHandler<SyncTask, SyncActions>, SyncResultsHandler {
+
+ @Override
+ boolean handle(SyncDelta delta);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/UserPushResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/UserPushResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/UserPushResultHandler.java
new file mode 100644
index 0000000..8a0459a
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/UserPushResultHandler.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.
+ */
+package org.apache.syncope.core.provisioning.api.syncpull;
+
+public interface UserPushResultHandler extends SyncopePushResultHandler {
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/UserSyncResultHandler.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/UserSyncResultHandler.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/UserSyncResultHandler.java
new file mode 100644
index 0000000..7f9c827
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/syncpull/UserSyncResultHandler.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.
+ */
+package org.apache.syncope.core.provisioning.api.syncpull;
+
+public interface UserSyncResultHandler extends SyncopeSyncResultHandler {
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/ConnPoolConfUtils.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/ConnPoolConfUtils.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/ConnPoolConfUtils.java
new file mode 100644
index 0000000..07f929a
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/ConnPoolConfUtils.java
@@ -0,0 +1,69 @@
+/*
+ * 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.provisioning.api.utils;
+
+import org.apache.syncope.common.lib.to.ConnPoolConfTO;
+import org.apache.syncope.core.persistence.api.entity.ConnPoolConf;
+import org.identityconnectors.common.pooling.ObjectPoolConfiguration;
+
+public final class ConnPoolConfUtils {
+
+ public static ConnPoolConf getConnPoolConf(final ConnPoolConfTO cpcto, final ConnPoolConf cpc) {
+ ObjectPoolConfiguration opc = new ObjectPoolConfiguration();
+
+ cpc.setMaxIdle(cpcto.getMaxIdle() == null ? opc.getMaxIdle() : cpcto.getMaxIdle());
+ cpc.setMaxObjects(cpcto.getMaxObjects() == null ? opc.getMaxObjects() : cpcto.getMaxObjects());
+ cpc.setMaxWait(cpcto.getMaxWait() == null ? opc.getMaxWait() : cpcto.getMaxWait());
+ cpc.setMinEvictableIdleTimeMillis(cpcto.getMinEvictableIdleTimeMillis() == null
+ ? opc.getMinEvictableIdleTimeMillis() : cpcto.getMinEvictableIdleTimeMillis());
+ cpc.setMinIdle(cpcto.getMinIdle() == null ? opc.getMinIdle() : cpcto.getMinIdle());
+
+ return cpc;
+ }
+
+ public static ObjectPoolConfiguration getObjectPoolConfiguration(final ConnPoolConf cpc) {
+ ObjectPoolConfiguration opc = new ObjectPoolConfiguration();
+ updateObjectPoolConfiguration(opc, cpc);
+ return opc;
+ }
+
+ public static void updateObjectPoolConfiguration(
+ final ObjectPoolConfiguration opc, final ConnPoolConf cpc) {
+
+ if (cpc.getMaxIdle() != null) {
+ opc.setMaxIdle(cpc.getMaxIdle());
+ }
+ if (cpc.getMaxObjects() != null) {
+ opc.setMaxObjects(cpc.getMaxObjects());
+ }
+ if (cpc.getMaxWait() != null) {
+ opc.setMaxWait(cpc.getMaxWait());
+ }
+ if (cpc.getMinEvictableIdleTimeMillis() != null) {
+ opc.setMinEvictableIdleTimeMillis(cpc.getMinEvictableIdleTimeMillis());
+ }
+ if (cpc.getMinIdle() != null) {
+ opc.setMinIdle(cpc.getMinIdle());
+ }
+ }
+
+ private ConnPoolConfUtils() {
+ // empty constructor for static utility class
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/EntityUtils.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/EntityUtils.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/EntityUtils.java
new file mode 100644
index 0000000..a744372
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/EntityUtils.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.provisioning.api.utils;
+
+import org.apache.commons.collections4.Transformer;
+import org.apache.syncope.core.persistence.api.entity.Entity;
+
+public final class EntityUtils {
+
+ public static <KEY, E extends Entity<KEY>> Transformer<E, KEY> keyTransformer() {
+ return new Transformer<E, KEY>() {
+
+ @Override
+ public KEY transform(final E input) {
+ return input.getKey();
+ }
+ };
+ }
+
+ /**
+ * Private default constructor, for static-only classes.
+ */
+ private EntityUtils() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/ExceptionUtils2.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/ExceptionUtils2.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/ExceptionUtils2.java
new file mode 100644
index 0000000..4045207
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/ExceptionUtils2.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.core.provisioning.api.utils;
+
+import org.apache.commons.lang3.exception.ExceptionUtils;
+
+public final class ExceptionUtils2 {
+
+ /**
+ * Uses commons lang's ExceptionUtils to provide a representation of the full stack trace of the given throwable.
+ *
+ * @param t throwable to build stack trace from
+ * @return a string representation of full stack trace of the given throwable
+ */
+ public static String getFullStackTrace(final Throwable t) {
+ StringBuilder result = new StringBuilder();
+
+ for (Throwable throwable : ExceptionUtils.getThrowableList(t)) {
+ result.append(ExceptionUtils.getMessage(throwable)).append('\n').
+ append(ExceptionUtils.getStackTrace(throwable)).append("\n\n");
+ }
+
+ return result.toString();
+ }
+
+ /**
+ * Private default constructor, for static-only classes.
+ */
+ private ExceptionUtils2() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/FormatUtils.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/FormatUtils.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/FormatUtils.java
new file mode 100644
index 0000000..e1c7ce5
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/FormatUtils.java
@@ -0,0 +1,121 @@
+/*
+ * 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.provisioning.api.utils;
+
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import org.apache.commons.lang3.time.DateUtils;
+import org.apache.syncope.common.lib.SyncopeConstants;
+
+/**
+ * Utility class for parsing / formatting date and numbers.
+ */
+public final class FormatUtils {
+
+ private static final ThreadLocal<SimpleDateFormat> DATE_FORMAT = new ThreadLocal<SimpleDateFormat>() {
+
+ @Override
+ protected SimpleDateFormat initialValue() {
+ SimpleDateFormat sdf = new SimpleDateFormat();
+ sdf.applyPattern(SyncopeConstants.DEFAULT_DATE_PATTERN);
+ return sdf;
+ }
+ };
+
+ private static final ThreadLocal<DecimalFormat> DECIMAL_FORMAT = new ThreadLocal<DecimalFormat>() {
+
+ @Override
+ protected DecimalFormat initialValue() {
+ DecimalFormat df = new DecimalFormat();
+ df.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ENGLISH));
+ return df;
+ }
+ };
+
+ public static String format(final Date date) {
+ return format(date, true);
+ }
+
+ public static String format(final Date date, final boolean lenient) {
+ return format(date, lenient, null);
+ }
+
+ public static String format(final Date date, final boolean lenient, final String conversionPattern) {
+ SimpleDateFormat sdf = DATE_FORMAT.get();
+ if (conversionPattern != null) {
+ sdf.applyPattern(conversionPattern);
+ }
+ sdf.setLenient(lenient);
+ return sdf.format(date);
+ }
+
+ public static String format(final long number) {
+ return format(number, null);
+ }
+
+ public static String format(final long number, final String conversionPattern) {
+ DecimalFormat df = DECIMAL_FORMAT.get();
+ if (conversionPattern != null) {
+ df.applyPattern(conversionPattern);
+ }
+ return df.format(number);
+ }
+
+ public static String format(final double number) {
+ return format(number, null);
+ }
+
+ public static String format(final double number, final String conversionPattern) {
+ DecimalFormat df = DECIMAL_FORMAT.get();
+ if (conversionPattern != null) {
+ df.applyPattern(conversionPattern);
+ }
+ return df.format(number);
+ }
+
+ public static Date parseDate(final String source) throws ParseException {
+ return DateUtils.parseDate(source, SyncopeConstants.DATE_PATTERNS);
+ }
+
+ public static Date parseDate(final String source, final String conversionPattern) throws ParseException {
+ SimpleDateFormat sdf = DATE_FORMAT.get();
+ sdf.applyPattern(conversionPattern);
+ sdf.setLenient(false);
+ return sdf.parse(source);
+ }
+
+ public static Number parseNumber(final String source, final String conversionPattern) throws ParseException {
+ DecimalFormat df = DECIMAL_FORMAT.get();
+ df.applyPattern(conversionPattern);
+ return df.parse(source);
+ }
+
+ public static void clear() {
+ DATE_FORMAT.remove();
+ DECIMAL_FORMAT.remove();
+ }
+
+ private FormatUtils() {
+ // private empty constructor
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/RealmUtils.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/RealmUtils.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/RealmUtils.java
new file mode 100644
index 0000000..47703b0
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/RealmUtils.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.core.provisioning.api.utils;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+public final class RealmUtils {
+
+ public static String getGroupOwnerRealm(final String realmPath, final Long groupKey) {
+ return realmPath + "@" + groupKey;
+ }
+
+ public static boolean normalizingAddTo(final Set<String> realms, final String newRealm) {
+ boolean dontAdd = false;
+ Set<String> toRemove = new HashSet<>();
+ for (String realm : realms) {
+ if (newRealm.startsWith(realm)) {
+ dontAdd = true;
+ } else if (realm.startsWith(newRealm)) {
+ toRemove.add(realm);
+ }
+ }
+
+ realms.removeAll(toRemove);
+ if (!dontAdd) {
+ realms.add(newRealm);
+ }
+ return !dontAdd;
+ }
+
+ public static Set<String> normalize(final Collection<String> realms) {
+ Set<String> normalized = new HashSet<>();
+ if (realms != null) {
+ for (String realm : realms) {
+ normalizingAddTo(normalized, realm);
+ }
+ }
+
+ return normalized;
+ }
+
+ private RealmUtils() {
+ // empty constructor for static utility class
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/URIUtils.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/URIUtils.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/URIUtils.java
new file mode 100644
index 0000000..143a14c
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/URIUtils.java
@@ -0,0 +1,61 @@
+/*
+ * 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.provisioning.api.utils;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+public final class URIUtils {
+
+ private URIUtils() {
+ // empty constructor for static utility class
+ }
+
+ /**
+ * Build a valid URI out of the given location.
+ * Only "file", "connid" and "connids" schemes are allowed.
+ * For "file", invalid characters are handled via intermediate transformation into URL.
+ *
+ * @param location the candidate location for URI
+ * @return valid URI for the given location
+ * @throws MalformedURLException if the intermediate URL is not valid
+ * @throws URISyntaxException if the given location does not correspond to a valid URI
+ */
+ public static URI buildForConnId(final String location) throws MalformedURLException, URISyntaxException {
+ final String candidate = location.trim();
+
+ if (!candidate.startsWith("file:")
+ && !candidate.startsWith("connid:") && !candidate.startsWith("connids:")) {
+
+ throw new IllegalArgumentException(candidate + " is not a valid URI for file or connid(s) schemes");
+ }
+
+ URI uri;
+ if (candidate.startsWith("file:")) {
+ uri = new File(new URL(candidate).getFile()).getAbsoluteFile().toURI();
+ } else {
+ uri = new URI(candidate);
+ }
+
+ return uri;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/AccountPolicyException.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/AccountPolicyException.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/AccountPolicyException.java
new file mode 100644
index 0000000..22be516
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/AccountPolicyException.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.core.provisioning.api.utils.policy;
+
+public class AccountPolicyException extends PolicyException {
+
+ private static final long serialVersionUID = 2779416455067691813L;
+
+ public AccountPolicyException() {
+ super();
+ }
+
+ public AccountPolicyException(final String message) {
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/InvalidPasswordRuleConf.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/InvalidPasswordRuleConf.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/InvalidPasswordRuleConf.java
new file mode 100644
index 0000000..9b79189
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/InvalidPasswordRuleConf.java
@@ -0,0 +1,37 @@
+/*
+ * 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.provisioning.api.utils.policy;
+
+/**
+ * Raise when the merge of two or more PasswordRuleconf instances led to an inconsistent condition.
+ *
+ * @see org.apache.syncope.common.lib.policy.PasswordRuleConf
+ */
+public class InvalidPasswordRuleConf extends Exception {
+
+ private static final long serialVersionUID = 4810651743226663580L;
+
+ public InvalidPasswordRuleConf(final String msg) {
+ super(msg);
+ }
+
+ public InvalidPasswordRuleConf(final String msg, final Exception e) {
+ super(msg, e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/PasswordPolicyException.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/PasswordPolicyException.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/PasswordPolicyException.java
new file mode 100644
index 0000000..2a49a20
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/PasswordPolicyException.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.core.provisioning.api.utils.policy;
+
+public class PasswordPolicyException extends PolicyException {
+
+ private static final long serialVersionUID = 8072104484395278469L;
+
+ public PasswordPolicyException() {
+ super();
+ }
+
+ public PasswordPolicyException(final String message) {
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/PolicyException.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/PolicyException.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/PolicyException.java
new file mode 100644
index 0000000..f11d202
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/PolicyException.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.core.provisioning.api.utils.policy;
+
+public class PolicyException extends RuntimeException {
+
+ private static final long serialVersionUID = -6082115004491662910L;
+
+ public PolicyException() {
+ super();
+ }
+
+ public PolicyException(final String message) {
+ super(message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/PolicyPattern.java
----------------------------------------------------------------------
diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/PolicyPattern.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/PolicyPattern.java
new file mode 100644
index 0000000..a853f0e
--- /dev/null
+++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/utils/policy/PolicyPattern.java
@@ -0,0 +1,50 @@
+/*
+ * 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.provisioning.api.utils.policy;
+
+import java.util.regex.Pattern;
+
+public final class PolicyPattern {
+
+ public static final Pattern DIGIT = Pattern.compile(".*\\d+.*");
+
+ public static final Pattern ALPHA_LOWERCASE = Pattern.compile(".*[a-z]+.*");
+
+ public static final Pattern ALPHA_UPPERCASE = Pattern.compile(".*[A-Z]+.*");
+
+ public static final Pattern FIRST_DIGIT = Pattern.compile("\\d.*");
+
+ public static final Pattern LAST_DIGIT = Pattern.compile(".*\\d");
+
+ public static final Pattern ALPHANUMERIC = Pattern.compile(".*\\w.*");
+
+ public static final Pattern FIRST_ALPHANUMERIC = Pattern.compile("\\w.*");
+
+ public static final Pattern LAST_ALPHANUMERIC = Pattern.compile(".*\\w");
+
+ public static final Pattern NON_ALPHANUMERIC = Pattern.compile(".*\\W.*");
+
+ public static final Pattern FIRST_NON_ALPHANUMERIC = Pattern.compile("\\W.*");
+
+ public static final Pattern LAST_NON_ALPHANUMERIC = Pattern.compile(".*\\W");
+
+ private PolicyPattern() {
+ // private constructor for static utility class
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/28569df5/core/provisioning-java/pom.xml
----------------------------------------------------------------------
diff --git a/core/provisioning-java/pom.xml b/core/provisioning-java/pom.xml
index ee6bfc6..7956dad 100644
--- a/core/provisioning-java/pom.xml
+++ b/core/provisioning-java/pom.xml
@@ -45,6 +45,11 @@ under the License.
</dependency>
<dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-jexl3</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
@@ -61,7 +66,7 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.syncope.core</groupId>
- <artifactId>syncope-core-misc</artifactId>
+ <artifactId>syncope-core-spring</artifactId>
<version>${project.version}</version>
</dependency>