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/10/19 16:37:02 UTC

[1/8] syncope git commit: Upgrading surefire, failsafe and checkstyle plugins

Repository: syncope
Updated Branches:
  refs/heads/1_2_X fb577531b -> 56f159808
  refs/heads/master 1c459bff5 -> 4e0783e1c


Upgrading surefire, failsafe and checkstyle plugins


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

Branch: refs/heads/1_2_X
Commit: 503097da8cddb197db8f54378f3721c46f32fb3f
Parents: 03c9bc2
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Oct 19 15:00:42 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Oct 19 15:00:42 2015 +0200

----------------------------------------------------------------------
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/503097da/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e4b3787..4ef0802 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1082,7 +1082,7 @@ under the License.
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
-          <version>2.18.1</version>
+          <version>2.19</version>
           <configuration>
             <redirectTestOutputToFile>true</redirectTestOutputToFile>
             <encoding>utf-8</encoding>
@@ -1106,7 +1106,7 @@ under the License.
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-failsafe-plugin</artifactId>
-          <version>2.18.1</version>
+          <version>2.19</version>
           <configuration>
             <redirectTestOutputToFile>true</redirectTestOutputToFile>
             <encoding>utf-8</encoding>
@@ -1204,7 +1204,7 @@ under the License.
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-checkstyle-plugin</artifactId>
-          <version>2.15</version>
+          <version>2.17</version>
           <dependencies>
             <dependency>
               <groupId>org.apache.syncope</groupId>


[7/8] syncope git commit: Upgrading surefire, failsafe and checkstyle plugins

Posted by il...@apache.org.
Upgrading surefire, failsafe and checkstyle plugins


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

Branch: refs/heads/master
Commit: 4e0783e1c331a763313b3cd4b82de8fc8b791e97
Parents: 1c459bf 503097d
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Oct 19 16:36:06 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Oct 19 16:36:06 2015 +0200

----------------------------------------------------------------------
 .../syncope/client/cli/commands/ConfigurationCommand.java    | 2 +-
 .../apache/syncope/client/cli/commands/DomainCommand.java    | 2 +-
 .../org/apache/syncope/client/cli/commands/HelpCommand.java  | 2 +-
 .../org/apache/syncope/client/cli/commands/InfoCommand.java  | 2 +-
 .../apache/syncope/client/cli/commands/LoggerCommand.java    | 2 +-
 .../syncope/client/cli/commands/NotificationCommand.java     | 2 +-
 .../apache/syncope/client/cli/commands/PolicyCommand.java    | 2 +-
 .../apache/syncope/client/cli/commands/ReportCommand.java    | 2 +-
 .../apache/syncope/client/cli/commands/SchemaCommand.java    | 2 +-
 .../org/apache/syncope/client/cli/commands/TaskCommand.java  | 2 +-
 .../syncope/client/cli/commands/install/InstallCommand.java  | 2 +-
 .../console/commons/SortableAnyProviderComparator.java       | 2 +-
 .../apache/syncope/client/console/commons/status/Status.java | 2 +-
 .../java/org/apache/syncope/client/console/pages/Login.java  | 4 ++--
 .../syncope/client/console/pages/ProvisioningModalPage.java  | 2 +-
 .../apache/syncope/client/console/pages/StatusModalPage.java | 2 +-
 .../syncope/client/console/panels/ResourceSecurityPanel.java | 2 +-
 .../org/apache/syncope/client/console/topology/Topology.java | 2 +-
 .../syncope/client/console/topology/WebSocketBehavior.java   | 4 ++--
 .../client/console/wicket/markup/html/form/ActionLink.java   | 2 +-
 .../console/wizards/provision/ProvisionWizardBuilder.java    | 6 +++---
 .../apache/syncope/client/lib/SyncopeClientFactoryBean.java  | 2 +-
 .../org/apache/syncope/common/lib/types/AnyTypeKind.java     | 2 +-
 .../apache/syncope/common/lib/types/ClientExceptionType.java | 2 +-
 .../org/apache/syncope/common/lib/types/IntMappingType.java  | 2 +-
 .../java/org/apache/syncope/common/lib/types/TaskType.java   | 2 +-
 .../java/org/apache/syncope/common/rest/api/Preference.java  | 2 +-
 .../java/org/apache/syncope/core/logic/AbstractAnyLogic.java | 2 +-
 .../org/apache/syncope/core/logic/init/LoggerLoader.java     | 2 +-
 .../syncope/core/misc/jexl/ClassFreeUberspectImpl.java       | 2 +-
 .../syncope/core/persistence/api/ImplementationLookup.java   | 2 +-
 .../core/persistence/jpa/content/ContentLoaderHandler.java   | 2 +-
 .../core/persistence/jpa/content/MultiParentNode.java        | 2 +-
 .../syncope/core/persistence/jpa/dao/SearchSupport.java      | 2 +-
 .../syncope/client/console/panels/CamelRoutePanel.java       | 2 +-
 .../java/org/apache/syncope/installer/enums/Containers.java  | 2 +-
 .../main/java/org/apache/syncope/installer/enums/DBs.java    | 2 +-
 pom.xml                                                      | 8 ++++----
 38 files changed, 45 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/ConfigurationCommand.java
----------------------------------------------------------------------
diff --cc client/cli/src/main/java/org/apache/syncope/client/cli/commands/ConfigurationCommand.java
index ee225d7,0000000..8a6c7b5
mode 100644,000000..100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/ConfigurationCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/ConfigurationCommand.java
@@@ -1,319 -1,0 +1,319 @@@
 +/*
 + * 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.client.cli.commands;
 +
 +import java.io.FileNotFoundException;
 +import java.io.IOException;
 +import java.io.SequenceInputStream;
 +import java.util.ArrayList;
 +import java.util.List;
 +import javax.xml.parsers.ParserConfigurationException;
 +import javax.xml.transform.TransformerConfigurationException;
 +import javax.xml.transform.TransformerException;
 +import javax.xml.ws.WebServiceException;
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.syncope.client.cli.Command;
 +import org.apache.syncope.client.cli.Input;
 +import org.apache.syncope.client.cli.SyncopeServices;
 +import org.apache.syncope.client.cli.messages.Messages;
 +import org.apache.syncope.client.cli.util.XMLUtils;
 +import org.apache.syncope.common.lib.SyncopeClientException;
 +import org.apache.syncope.common.lib.to.AttrTO;
 +import org.apache.syncope.common.lib.to.ConfTO;
 +import org.apache.syncope.common.rest.api.service.ConfigurationService;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +import org.xml.sax.SAXException;
 +
 +@Command(name = "configuration")
 +public class ConfigurationCommand extends AbstractCommand {
 +
 +    private static final Logger LOG = LoggerFactory.getLogger(ConfigurationCommand.class);
 +
 +    private static final String EXPORT_FILE_NAME = "/content.xml";
 +
 +    private static final String HELP_MESSAGE = "Usage: configuration [options]\n"
 +            + "  Options:\n"
 +            + "    --help \n"
 +            + "    --list \n"
 +            + "    --read \n"
 +            + "       Syntax: --read {CONF-NAME} {CONF-NAME} [...] \n"
 +            + "    --update \n"
 +            + "       Syntax: --update {CONF-NAME}={CONF-VALUE} {CONF-NAME}={CONF-VALUE} [...]\n"
 +            + "    --create \n"
 +            + "       Syntax: --create {CONF-NAME}={CONF-VALUE} {CONF-NAME}={CONF-VALUE} [...]\n"
 +            + "    --delete \n"
 +            + "       Syntax: --delete {CONF-NAME} {CONF-NAME} [...]\n"
 +            + "    --export \n"
 +            + "       Syntax: --export {WHERE-DIR}";
 +
 +    @Override
 +    public void execute(final Input input) {
 +        LOG.debug("Logger service successfully created");
 +        LOG.debug("Option: {}", input.getOption());
 +        LOG.debug("Parameters:");
 +        for (final String parameter : input.getParameters()) {
 +            LOG.debug("   > " + parameter);
 +        }
 +
 +        final String[] parameters = input.getParameters();
 +
 +        if (StringUtils.isBlank(input.getOption())) {
 +            input.setOption(Options.HELP.getOptionName());
 +        }
 +
 +        final ConfigurationService configurationService = SyncopeServices.get(ConfigurationService.class);
 +        switch (Options.fromName(input.getOption())) {
 +            case LIST:
 +                try {
 +                    final ConfTO confTO = configurationService.list();
 +                    System.out.println("\n - Configuration key: " + confTO.getKey());
 +                    System.out.println("");
 +                    System.out.println("Plain attributes");
 +                    for (final AttrTO attrTO : confTO.getPlainAttrMap().values()) {
 +                        System.out.println(" - Conf key: " + attrTO.getSchema());
 +                        System.out.println("    - value(s): " + attrTO.getValues());
 +                        System.out.println("    - readonly: " + attrTO.isReadonly());
 +                    }
 +                    System.out.println("");
 +                    System.out.println("Derived attributes");
 +                    for (final AttrTO attrTO : confTO.getDerAttrMap().values()) {
 +                        System.out.println(" - Conf key: " + attrTO.getSchema());
 +                        System.out.println("    - value(s): " + attrTO.getValues());
 +                        System.out.println("    - readonly: " + attrTO.isReadonly());
 +                    }
 +                    System.out.println("");
 +                    System.out.println("Virtual attributes");
 +                    for (final AttrTO attrTO : confTO.getVirAttrMap().values()) {
 +                        System.out.println(" - Conf key: " + attrTO.getSchema());
 +                        System.out.println("    - value(s): " + attrTO.getValues());
 +                        System.out.println("    - readonly: " + attrTO.isReadonly());
 +                    }
 +                    System.out.println("");
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case READ:
 +                final String readErrorMessage = "configuration --read {CONF-NAME} {CONF-NAME} [...]";
 +                if (parameters.length >= 1) {
 +                    AttrTO attrTO;
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            attrTO = configurationService.get(parameter);
 +                            System.out.println("\n - Conf key: " + attrTO.getSchema());
 +                            System.out.println("    - value(s): " + attrTO.getValues());
 +                            System.out.println("    - readonly: " + attrTO.isReadonly());
 +                            System.out.println("");
 +                        } catch (final SyncopeClientException | WebServiceException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Logger", parameter);
 +                            } else {
 +                                Messages.printMessage(ex.getMessage());
 +                            }
 +                            break;
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(readErrorMessage);
 +                }
 +                break;
 +            case UPDATE:
 +                final String updateErrorMessage
 +                        = "configuration --update {CONF-NAME}={CONF-VALUE} {CONF-NAME}={CONF-VALUE} [...]";
 +                if (parameters.length >= 1) {
 +                    Input.PairParameter pairParameter = null;
 +                    AttrTO attrTO;
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            pairParameter = input.toPairParameter(parameter);
 +                            attrTO = configurationService.get(pairParameter.getKey());
 +                            attrTO.getValues().clear();
 +                            attrTO.getValues().add(pairParameter.getValue());
 +                            configurationService.set(attrTO);
 +                            System.out.println("\n - Conf key " + attrTO.getSchema() + " updated. New value is:");
 +                            System.out.println("    - value(s): " + attrTO.getValues());
 +                            System.out.println("    - readonly: " + attrTO.isReadonly());
 +                            System.out.println("");
 +                        } catch (final IllegalArgumentException ex) {
 +                            Messages.printMessage(ex.getMessage(), updateErrorMessage);
 +                            break;
 +                        } catch (final SyncopeClientException | WebServiceException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Configuration", pairParameter.getKey());
 +                            } else if (ex.getMessage().startsWith("InvalidValues")) {
 +                                Messages.printMessage(
 +                                        pairParameter.getValue() + " is not a valid value for "
 +                                        + pairParameter.getKey());
 +                            } else {
 +                                Messages.printMessage(ex.getMessage());
 +                            }
 +                            break;
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(updateErrorMessage);
 +                }
 +                break;
 +            case CREATE:
 +                final String createErrorMessage
 +                        = "configuration --create {CONF-NAME}={CONF-VALUE} {CONF-NAME}={CONF-VALUE} [...]";
 +                if (parameters.length >= 1) {
 +                    Input.PairParameter pairParameter = null;
 +                    AttrTO attrTO;
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            pairParameter = input.toPairParameter(parameter);
 +                            attrTO = new AttrTO();
 +                            attrTO.setSchema(pairParameter.getKey());
 +                            attrTO.getValues().add(pairParameter.getValue());
 +                            configurationService.set(attrTO);
 +                            System.out.println("\n - Conf key " + attrTO.getSchema() + " created. Value is:");
 +                            System.out.println("    - value(s): " + attrTO.getValues());
 +                            System.out.println("    - readonly: " + attrTO.isReadonly());
 +                            System.out.println("");
 +                        } catch (final IllegalArgumentException ex) {
 +                            Messages.printMessage(ex.getMessage(), createErrorMessage);
 +                            break;
 +                        } catch (final SyncopeClientException | WebServiceException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Configuration", pairParameter.getKey());
 +                                System.out.println("Create it before.");
 +                            } else {
 +                                Messages.printMessage(ex.getMessage());
 +                            }
 +                            break;
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(createErrorMessage);
 +                }
 +                break;
 +            case DELETE:
 +                final String deleteErrorMessage = "configuration --delete {CONF-NAME} {CONF-NAME} [...]";
 +                if (parameters.length >= 1) {
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            configurationService.delete(parameter);
 +                            Messages.printDeletedMessage("Configuration", parameter);
 +                        } catch (final SyncopeClientException | WebServiceException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Configuration", parameter);
 +                            } else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
 +                                Messages.printMessage("You cannot delete configuration", parameter);
 +                            } else {
 +                                Messages.printMessage(ex.getMessage());
 +                            }
 +                            break;
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(deleteErrorMessage);
 +                }
 +                break;
 +            case EXPORT:
 +                final String exportErrorMessage = "configuration --export {WHERE-DIR}";
 +                if (parameters.length == 1) {
 +                    try {
 +                        XMLUtils.createXMLFile((SequenceInputStream) configurationService.export().getEntity(),
 +                                parameters[0] + EXPORT_FILE_NAME);
 +                        System.out.println(" - " + parameters[0] + EXPORT_FILE_NAME + " successfully created");
 +                    } catch (final IOException ex) {
 +                        Messages.printMessage(ex.getMessage());
 +                    } catch (ParserConfigurationException | SAXException | TransformerConfigurationException ex) {
 +                        LOG.error("Error creating content.xml file in {} directory", parameters[0], ex);
 +                        Messages.printMessage(
 +                                "Error creating " + parameters[0] + EXPORT_FILE_NAME + " " + ex.getMessage());
 +                        break;
 +                    } catch (final TransformerException ex) {
 +                        LOG.error("Error creating content.xml file in {} directory", parameters[0], ex);
 +                        if (ex.getCause() instanceof FileNotFoundException) {
 +                            Messages.printMessage("Permission denied on " + parameters[0]);
 +                        } else {
 +                            Messages.printMessage(
 +                                    "Error creating " + parameters[0] + EXPORT_FILE_NAME + " " + ex.getMessage());
 +                        }
 +                        break;
 +                    } catch (final SyncopeClientException ex) {
 +                        LOG.error("Error calling configuration service", ex);
 +                        Messages.printMessage("Error calling configuration service " + ex.getMessage());
 +                        break;
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(exportErrorMessage);
 +                }
 +                break;
 +            case HELP:
 +                System.out.println(HELP_MESSAGE);
 +                break;
 +            default:
 +                Messages.printDefaultMessage(input.getOption(), HELP_MESSAGE);
 +                break;
 +        }
 +    }
 +
 +    @Override
 +    public String getHelpMessage() {
 +        return HELP_MESSAGE;
 +    }
 +
 +    private enum Options {
 +
 +        HELP("--help"),
 +        LIST("--list"),
 +        READ("--read"),
 +        UPDATE("--update"),
 +        CREATE("--create"),
 +        DELETE("--delete"),
 +        EXPORT("--export");
 +
 +        private final String optionName;
 +
-         private Options(final String optionName) {
++        Options(final String optionName) {
 +            this.optionName = optionName;
 +        }
 +
 +        public String getOptionName() {
 +            return optionName;
 +        }
 +
 +        public boolean equalsOptionName(final String otherName) {
 +            return (otherName == null) ? false : optionName.equals(otherName);
 +        }
 +
 +        public static Options fromName(final String name) {
 +            Options optionToReturn = HELP;
 +            for (final Options option : Options.values()) {
 +                if (option.equalsOptionName(name)) {
 +                    optionToReturn = option;
 +                }
 +            }
 +            return optionToReturn;
 +        }
 +
 +        public static List<String> toList() {
 +            final List<String> options = new ArrayList<>();
 +            for (final Options value : values()) {
 +                options.add(value.getOptionName());
 +            }
 +            return options;
 +        }
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/DomainCommand.java
----------------------------------------------------------------------
diff --cc client/cli/src/main/java/org/apache/syncope/client/cli/commands/DomainCommand.java
index a2a0977,0000000..3060ee1
mode 100644,000000..100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/DomainCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/DomainCommand.java
@@@ -1,164 -1,0 +1,164 @@@
 +/*
 + * 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.client.cli.commands;
 +
 +import java.util.ArrayList;
 +import java.util.List;
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.syncope.client.cli.Command;
 +import org.apache.syncope.client.cli.Input;
 +import org.apache.syncope.client.cli.SyncopeServices;
 +import org.apache.syncope.client.cli.messages.Messages;
 +import org.apache.syncope.common.lib.SyncopeClientException;
 +import org.apache.syncope.common.lib.to.DomainTO;
 +import org.apache.syncope.common.rest.api.service.DomainService;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
 +@Command(name = "domain")
 +public class DomainCommand extends AbstractCommand {
 +
 +    private static final Logger LOG = LoggerFactory.getLogger(LoggerCommand.class);
 +
 +    private static final String HELP_MESSAGE = "Usage: domain [options]\n"
 +            + "  Options:\n"
 +            + "    --help \n"
 +            + "    --list \n"
 +            + "    --read \n"
 +            + "       Syntax: --read {DOMAIN-KEY} {DOMAIN-KEY} [...]\n"
 +            + "    --delete \n"
 +            + "       Syntax: --delete {DOMAIN-KEY} {DOMAIN-KEY} [...]\n";
 +
 +    @Override
 +    public void execute(final Input input) {
 +        LOG.debug("Option: {}", input.getOption());
 +        LOG.debug("Parameters:");
 +        for (final String parameter : input.getParameters()) {
 +            LOG.debug("   > " + parameter);
 +        }
 +
 +        final String[] parameters = input.getParameters();
 +
 +        if (StringUtils.isBlank(input.getOption())) {
 +            input.setOption(Options.HELP.getOptionName());
 +        }
 +
 +        final DomainService domainService = SyncopeServices.get(DomainService.class);
 +        switch (Options.fromName(input.getOption())) {
 +            case LIST:
 +                try {
 +                    for (final DomainTO domainTO : domainService.list()) {
 +                        Messages.printMessage("Domain key: " + domainTO.getKey());
 +                    }
 +                } catch (final SyncopeClientException ex) {
 +                    Messages.printMessage("Error: " + ex.getMessage());
 +                }
 +                break;
 +            case READ:
 +                final String readErrorMessage = "domain --read {DOMAIN-KEY} {DOMAIN-KEY} [...]";
 +                if (parameters.length >= 1) {
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            final DomainTO domainTO = domainService.read(parameter);
 +                            Messages.printMessage("Domain key: " + domainTO.getKey());
 +                        } catch (final SyncopeClientException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Domain", parameter);
 +                            } else {
 +                                Messages.printMessage(ex.getMessage());
 +                            }
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(readErrorMessage);
 +                }
 +                break;
 +            case DELETE:
 +                final String deleteErrorMessage = "domain --delete {DOMAIN-KEY} {DOMAIN-KEY} [...]";
 +                if (parameters.length >= 1) {
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            domainService.delete(parameter);
 +                            Messages.printDeletedMessage("Domain", parameter);
 +                        } catch (final SyncopeClientException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Domain", parameter);
 +                            } else {
 +                                Messages.printMessage(ex.getMessage());
 +                            }
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(deleteErrorMessage);
 +                }
 +                break;
 +            case HELP:
 +                System.out.println(HELP_MESSAGE);
 +                break;
 +            default:
 +                Messages.printDefaultMessage(input.getOption(), HELP_MESSAGE);
 +        }
 +
 +    }
 +
 +    @Override
 +    public String getHelpMessage() {
 +        return HELP_MESSAGE;
 +    }
 +
 +    private enum Options {
 +
 +        HELP("--help"),
 +        LIST("--list"),
 +        READ("--read"),
 +        DELETE("--delete");
 +
 +        private final String optionName;
 +
-         private Options(final String optionName) {
++        Options(final String optionName) {
 +            this.optionName = optionName;
 +        }
 +
 +        public String getOptionName() {
 +            return optionName;
 +        }
 +
 +        public boolean equalsOptionName(final String otherName) {
 +            return (otherName == null) ? false : optionName.equals(otherName);
 +        }
 +
 +        public static Options fromName(final String name) {
 +            Options optionToReturn = HELP;
 +            for (final Options option : Options.values()) {
 +                if (option.equalsOptionName(name)) {
 +                    optionToReturn = option;
 +                }
 +            }
 +            return optionToReturn;
 +        }
 +
 +        public static List<String> toList() {
 +            final List<String> options = new ArrayList<>();
 +            for (final Options value : values()) {
 +                options.add(value.getOptionName());
 +            }
 +            return options;
 +        }
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/HelpCommand.java
----------------------------------------------------------------------
diff --cc client/cli/src/main/java/org/apache/syncope/client/cli/commands/HelpCommand.java
index 85b7d73,0000000..027491a
mode 100644,000000..100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/HelpCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/HelpCommand.java
@@@ -1,113 -1,0 +1,113 @@@
 +/*
 + * 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.client.cli.commands;
 +
 +import java.util.ArrayList;
 +import java.util.List;
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.syncope.client.cli.Command;
 +import org.apache.syncope.client.cli.Input;
 +import org.apache.syncope.client.cli.messages.Messages;
 +import org.apache.syncope.client.cli.util.CommandUtils;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
 +@Command(name = "help")
 +public class HelpCommand extends AbstractCommand {
 +
 +    private static final Logger LOG = LoggerFactory.getLogger(HelpCommand.class);
 +
 +    @Override
 +    public void execute(final Input input) {
 +        LOG.debug("Option: {}", input.getOption());
 +        LOG.debug("Parameters:");
 +        for (final String parameter : input.getParameters()) {
 +            LOG.debug("   > " + parameter);
 +        }
 +
 +        if (StringUtils.isBlank(input.getOption())) {
 +            input.setOption(Options.HELP.getOptionName());
 +        }
 +
 +        switch (Options.fromName(input.getOption())) {
 +            case HELP:
 +                final StringBuilder generalHelpBuilder = new StringBuilder("General help\n");
 +                try {
 +                    for (final AbstractCommand command : CommandUtils.commands()) {
 +                        generalHelpBuilder.append("Command: ")
 +                                .append(command.getClass().getAnnotation(Command.class).name())
 +                                .append("\n")
 +                                .append(command.getHelpMessage())
 +                                .append("\n")
 +                                .append(" \n");
 +                    }
 +                    System.out.println(generalHelpBuilder.toString());
 +                } catch (final IllegalAccessException | IllegalArgumentException | InstantiationException e) {
 +                    Messages.printMessage(e.getMessage());
 +                }
 +                break;
 +            default:
 +                Messages.printDefaultMessage(input.getOption(), helpMessage("info", Options.toList()));
 +                break;
 +        }
 +    }
 +
 +    @Override
 +    public String getHelpMessage() {
 +        return helpMessage("help", Options.toList());
 +    }
 +
 +    private enum Options {
 +
 +        HELP("--print");
 +
 +        private final String optionName;
 +
-         private Options(final String optionName) {
++        Options(final String optionName) {
 +            this.optionName = optionName;
 +        }
 +
 +        public String getOptionName() {
 +            return optionName;
 +        }
 +
 +        public boolean equalsOptionName(final String otherName) {
 +            return (otherName == null) ? false : optionName.equals(otherName);
 +        }
 +
 +        public static Options fromName(final String name) {
 +            Options optionToReturn = HELP;
 +            for (final Options option : Options.values()) {
 +                if (option.equalsOptionName(name)) {
 +                    optionToReturn = option;
 +                }
 +            }
 +            return optionToReturn;
 +        }
 +
 +        public static List<String> toList() {
 +            final List<String> options = new ArrayList<>();
 +            for (final Options value : values()) {
 +                options.add(value.getOptionName());
 +            }
 +            return options;
 +        }
 +    }
 +
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/InfoCommand.java
----------------------------------------------------------------------
diff --cc client/cli/src/main/java/org/apache/syncope/client/cli/commands/InfoCommand.java
index 07bb952,0000000..2ab4c29
mode 100644,000000..100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/InfoCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/InfoCommand.java
@@@ -1,338 -1,0 +1,338 @@@
 +/*
 + * 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.client.cli.commands;
 +
 +import java.util.ArrayList;
 +import java.util.List;
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.syncope.client.cli.Command;
 +import org.apache.syncope.client.cli.Input;
 +import org.apache.syncope.client.cli.SyncopeServices;
 +import org.apache.syncope.client.cli.messages.Messages;
 +import org.apache.syncope.common.lib.to.SyncopeTO;
 +import org.apache.syncope.common.rest.api.service.SyncopeService;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
 +@Command(name = "info")
 +public class InfoCommand extends AbstractCommand {
 +
 +    private static final Logger LOG = LoggerFactory.getLogger(InfoCommand.class);
 +
 +    @Override
 +    public void execute(final Input input) {
 +        LOG.debug("Option: {}", input.getOption());
 +        LOG.debug("Parameters:");
 +        for (final String parameter : input.getParameters()) {
 +            LOG.debug("   > " + parameter);
 +        }
 +
 +        if (StringUtils.isBlank(input.getOption())) {
 +            input.setOption(Options.HELP.getOptionName());
 +        }
 +
 +        final SyncopeService syncopeService = SyncopeServices.get(SyncopeService.class);
 +        final SyncopeTO syncopeTO = syncopeService.info();
 +        switch (Options.fromName(input.getOption())) {
 +            case VERSION:
 +                try {
 +                    Messages.printMessage("Syncope version: " + syncopeTO.getVersion());
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case PWD_RESET_ALLOWED:
 +                try {
 +                    Messages.printMessage("Password reset allowed: " + syncopeTO.isPwdResetAllowed());
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case PWD_RESET_WITH_SECURITY_QUESTION:
 +                try {
 +                    Messages.printMessage("Password reset requiring security question: "
 +                            + syncopeTO.isPwdResetRequiringSecurityQuestions());
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case SELF_REG_ALLOWED:
 +                try {
 +                    Messages.printMessage("Self registration allowed: " + syncopeTO.isSelfRegAllowed());
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case PROVISIONING_MANAGER:
 +                try {
 +                    Messages.printMessage(
 +                            "Any object provisioning manager class: " + syncopeTO.getAnyObjectProvisioningManager(),
 +                            "User       provisioning manager class: " + syncopeTO.getUserProvisioningManager(),
 +                            "Group      provisioning manager class: " + syncopeTO.getGroupProvisioningManager());
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case WORKFLOW_ADAPTER:
 +                try {
 +                    Messages.printMessage(
 +                            "Any object workflow adapter class: " + syncopeTO.getAnyObjectWorkflowAdapter(),
 +                            "User       workflow adapter class: " + syncopeTO.getUserWorkflowAdapter(),
 +                            "Group      workflow adapter class: " + syncopeTO.getGroupWorkflowAdapter());
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case ACCOUNT_RULES:
 +                try {
 +                    for (final String accountRule : syncopeTO.getAccountRules()) {
 +                        Messages.printMessage("Account rule: " + accountRule);
 +                    }
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case CONNID_LOCATION:
 +                try {
 +                    for (final String location : syncopeTO.getConnIdLocations()) {
 +                        Messages.printMessage("ConnId location: " + location);
 +                    }
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case LOGIC_ACTIONS:
 +                try {
 +                    for (final String logic : syncopeTO.getLogicActions()) {
 +                        Messages.printMessage("Logic action: " + logic);
 +                    }
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case MAIL_TEMPLATES:
 +                try {
 +                    for (final String template : syncopeTO.getMailTemplates()) {
 +                        Messages.printMessage("Mail template: " + template);
 +                    }
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case MAPPING_ITEM_TRANSFORMERS:
 +                try {
 +                    for (final String tranformer : syncopeTO.getMappingItemTransformers()) {
 +                        Messages.printMessage("Mapping item tranformer: " + tranformer);
 +                    }
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case PASSWORD_RULES:
 +                try {
 +                    for (final String rules : syncopeTO.getPasswordRules()) {
 +                        Messages.printMessage("Password rule: " + rules);
 +                    }
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case PROPAGATION_ACTIONS:
 +                try {
 +                    for (final String action : syncopeTO.getPropagationActions()) {
 +                        Messages.printMessage("Propagation action: " + action);
 +                    }
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case PUSH_ACTIONS:
 +                try {
 +                    for (final String action : syncopeTO.getPushActions()) {
 +                        Messages.printMessage("Push action: " + action);
 +                    }
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case PUSH_CORRELATION_ACTIONS:
 +                try {
 +                    for (final String rule : syncopeTO.getPushCorrelationRules()) {
 +                        Messages.printMessage("Push correlation rule: " + rule);
 +                    }
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case REPORTLETS:
 +                try {
 +                    for (final String reportlet : syncopeTO.getReportlets()) {
 +                        Messages.printMessage("Reportlet: " + reportlet);
 +                    }
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case SYNC_ACTIONS:
 +                try {
 +                    for (final String action : syncopeTO.getSyncActions()) {
 +                        Messages.printMessage("Sync action: " + action);
 +                    }
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case SYNC_CORRELATION_RULES:
 +                try {
 +                    for (final String rule : syncopeTO.getSyncCorrelationRules()) {
 +                        Messages.printMessage("Sync correlation rule: " + rule);
 +                    }
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case TASK_JOBS:
 +                try {
 +                    for (final String job : syncopeTO.getTaskJobs()) {
 +                        Messages.printMessage("Task job: " + job);
 +                    }
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case VALIDATORS:
 +                try {
 +                    for (final String validator : syncopeTO.getValidators()) {
 +                        Messages.printMessage("Validator: " + validator);
 +                    }
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case PASSWORD_GENERATOR:
 +                try {
 +                    Messages.printMessage(
 +                            "Password generator class: " + syncopeTO.getPasswordGenerator());
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case VIR_ATTR_CACHE:
 +                try {
 +                    Messages.printMessage(
 +                            "Virtual attribute cache class: " + syncopeTO.getVirAttrCache());
 +                } catch (final Exception ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                    break;
 +                }
 +                break;
 +            case HELP:
 +                System.out.println(helpMessage("info", Options.toList()));
 +                break;
 +            default:
 +                Messages.printDefaultMessage(input.getOption(), helpMessage("info", Options.toList()));
 +                break;
 +        }
 +    }
 +
 +    @Override
 +    public String getHelpMessage() {
 +        return helpMessage("info", Options.toList());
 +    }
 +
 +    private enum Options {
 +
 +        VERSION("--version"),
 +        PWD_RESET_ALLOWED("--pwd-reset-allowed"),
 +        PWD_RESET_WITH_SECURITY_QUESTION("--pwd-reset-with-question"),
 +        SELF_REG_ALLOWED("--self-reg-allowed"),
 +        PROVISIONING_MANAGER("--provisioning-manager-classes"),
 +        WORKFLOW_ADAPTER("--workflow-adapter-classes"),
 +        ACCOUNT_RULES("--account-rules-classes"),
 +        CONNID_LOCATION("--connid-locations"),
 +        LOGIC_ACTIONS("--logic-actions"),
 +        MAIL_TEMPLATES("--mail-templates"),
 +        MAPPING_ITEM_TRANSFORMERS("--mapping-item-transformers"),
 +        PASSWORD_RULES("--password-rules"),
 +        PROPAGATION_ACTIONS("--propagation-actions"),
 +        PUSH_ACTIONS("--push-actions"),
 +        PUSH_CORRELATION_ACTIONS("--push-correlation-actions"),
 +        REPORTLETS("--reportlets"),
 +        SYNC_ACTIONS("--sync-actions"),
 +        SYNC_CORRELATION_RULES("--sync-correlation-rules"),
 +        TASK_JOBS("--task-jobs"),
 +        VALIDATORS("--validators"),
 +        PASSWORD_GENERATOR("--password-generator"),
 +        VIR_ATTR_CACHE("--vir-attr-cache"),
 +        HELP("--help");
 +
 +        private final String optionName;
 +
-         private Options(final String optionName) {
++        Options(final String optionName) {
 +            this.optionName = optionName;
 +        }
 +
 +        public String getOptionName() {
 +            return optionName;
 +        }
 +
 +        public boolean equalsOptionName(final String otherName) {
 +            return (otherName == null) ? false : optionName.equals(otherName);
 +        }
 +
 +        public static Options fromName(final String name) {
 +            Options optionToReturn = HELP;
 +            for (final Options option : Options.values()) {
 +                if (option.equalsOptionName(name)) {
 +                    optionToReturn = option;
 +                }
 +            }
 +            return optionToReturn;
 +        }
 +
 +        public static List<String> toList() {
 +            final List<String> options = new ArrayList<>();
 +            for (final Options value : values()) {
 +                options.add(value.getOptionName());
 +            }
 +            return options;
 +        }
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/LoggerCommand.java
----------------------------------------------------------------------
diff --cc client/cli/src/main/java/org/apache/syncope/client/cli/commands/LoggerCommand.java
index 6c11c6f,0000000..360c16b
mode 100644,000000..100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/LoggerCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/LoggerCommand.java
@@@ -1,267 -1,0 +1,267 @@@
 +/*
 + * 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.client.cli.commands;
 +
 +import java.util.ArrayList;
 +import java.util.List;
 +import javax.xml.ws.WebServiceException;
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.syncope.client.cli.Command;
 +import org.apache.syncope.client.cli.Input;
 +import org.apache.syncope.client.cli.SyncopeServices;
 +import org.apache.syncope.client.cli.messages.Messages;
 +import org.apache.syncope.common.lib.SyncopeClientException;
 +import org.apache.syncope.common.lib.to.LoggerTO;
 +import org.apache.syncope.common.lib.types.LoggerLevel;
 +import org.apache.syncope.common.lib.types.LoggerType;
 +import org.apache.syncope.common.rest.api.service.LoggerService;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
 +@Command(name = "logger")
 +public class LoggerCommand extends AbstractCommand {
 +
 +    private static final Logger LOG = LoggerFactory.getLogger(LoggerCommand.class);
 +
 +    private static final String HELP_MESSAGE = "Usage: logger [options]\n"
 +            + "  Options:\n"
 +            + "    --help \n"
 +            + "    --list \n"
 +            + "    --read \n"
 +            + "       Syntax: --read {LOG-NAME} {LOG-NAME} [...]\n"
 +            + "    --update \n"
 +            + "       Syntax: --update {LOG-NAME}={LOG-LEVEL} {LOG-NAME}={LOG-LEVEL} [...]\n"
 +            + "    --update-all \n"
 +            + "       Syntax: --update-all {LOG-LEVEL} \n"
 +            + "    --create \n"
 +            + "       Syntax: --create {LOG-NAME}={LOG-LEVEL} {LOG-NAME}={LOG-LEVEL} [...]\n"
 +            + "    --delete \n"
 +            + "       Syntax: --delete {LOG-NAME} {LOG-NAME} [...]";
 +
 +    @Override
 +    public void execute(final Input input) {
 +        LOG.debug("Option: {}", input.getOption());
 +        LOG.debug("Parameters:");
 +        for (final String parameter : input.getParameters()) {
 +            LOG.debug("   > " + parameter);
 +        }
 +
 +        final String[] parameters = input.getParameters();
 +
 +        if (StringUtils.isBlank(input.getOption())) {
 +            input.setOption(Options.HELP.getOptionName());
 +        }
 +
 +        final LoggerService loggerService = SyncopeServices.get(LoggerService.class);
 +        switch (Options.fromName(input.getOption())) {
 +            case LIST:
 +                try {
 +                    for (final LoggerTO loggerTO : loggerService.list(LoggerType.LOG)) {
 +                        System.out.println(" - " + loggerTO.getKey() + " -> " + loggerTO.getLevel());
 +                        System.out.println("");
 +                    }
 +                } catch (final SyncopeClientException ex) {
 +                    Messages.printMessage("Error: " + ex.getMessage());
 +                }
 +                break;
 +            case READ:
 +                final String readErrorMessage = "logger --read {LOG-NAME} {LOG-NAME} [...]";
 +                if (parameters.length >= 1) {
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            final LoggerTO loggerTO = loggerService.read(LoggerType.LOG, parameter);
 +                            System.out.println("\n - Logger");
 +                            System.out.println("   - key: " + loggerTO.getKey());
 +                            System.out.println("   - level: " + loggerTO.getLevel());
 +                            System.out.println("");
 +                        } catch (final SyncopeClientException | WebServiceException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Logger", parameter);
 +                            } else {
 +                                Messages.printMessage("Error: " + ex.getMessage());
 +                            }
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(readErrorMessage);
 +                }
 +                break;
 +            case UPDATE:
 +                final String updateErrorMessage = "logger --update {LOG-NAME}={LOG-LEVEL} {LOG-NAME}={LOG-LEVEL} [...]";
 +
 +                if (parameters.length >= 1) {
 +                    Input.PairParameter pairParameter;
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            pairParameter = input.toPairParameter(parameter);
 +                            final LoggerTO loggerTO = loggerService.read(LoggerType.LOG, pairParameter.getKey());
 +                            loggerTO.setLevel(LoggerLevel.valueOf(pairParameter.getValue()));
 +                            loggerService.update(LoggerType.LOG, loggerTO);
 +                            System.out.
 +                                    println("\n - Logger " + loggerTO.getKey() + " updated");
 +                            System.out.println("   - new level: " + loggerTO.getLevel());
 +                            System.out.println("");
 +                        } catch (final WebServiceException | SyncopeClientException | IllegalArgumentException ex) {
 +                            if (ex.getMessage().startsWith("No enum constant org.apache.syncope.common.lib.types.")) {
 +                                Messages.printTypeNotValidMessage(
 +                                        "logger level", input.firstParameter(), fromEnumToArray(LoggerLevel.class));
 +                            } else if ("Parameter syntax error!".equalsIgnoreCase(ex.getMessage())) {
 +                                Messages.printMessage(ex.getMessage(), updateErrorMessage);
 +                            } else if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Logger", parameter);
 +                            } else {
 +                                Messages.printMessage(ex.getMessage(), updateErrorMessage);
 +                            }
 +                            break;
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(updateErrorMessage);
 +                }
 +                break;
 +            case UPDATE_ALL:
 +                final String updateAllErrorMessage = "logger --update-all {LOG-LEVEL}";
 +
 +                if (parameters.length == 1) {
 +                    for (final LoggerTO loggerTO : loggerService.list(LoggerType.LOG)) {
 +                        try {
 +                            loggerTO.setLevel(LoggerLevel.valueOf(parameters[0]));
 +                            loggerService.update(LoggerType.LOG, loggerTO);
 +                            System.out.
 +                                    println("\n - Logger " + loggerTO.getKey() + " updated");
 +                            System.out.println("   - new level: " + loggerTO.getLevel());
 +                            System.out.println("");
 +                        } catch (final WebServiceException | SyncopeClientException | IllegalArgumentException ex) {
 +                            if (ex.getMessage().startsWith("No enum constant org.apache.syncope.common.lib.types.")) {
 +                                Messages.printTypeNotValidMessage(
 +                                        "logger level", input.firstParameter(), fromEnumToArray(LoggerLevel.class));
 +                            } else {
 +                                Messages.printMessage(ex.getMessage(), updateAllErrorMessage);
 +                            }
 +                            break;
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(updateAllErrorMessage);
 +                }
 +                break;
 +            case CREATE:
 +                final String createErrorMessage = "logger --create {LOG-NAME}={LOG-LEVEL} {LOG-NAME}={LOG-LEVEL} [...]";
 +
 +                if (parameters.length >= 1) {
 +                    Input.PairParameter pairParameter;
 +                    LoggerTO loggerTO;
 +                    for (final String parameter : parameters) {
 +                        loggerTO = new LoggerTO();
 +                        try {
 +                            pairParameter = input.toPairParameter(parameter);
 +                            loggerTO.setKey(pairParameter.getKey());
 +                            loggerTO.setLevel(LoggerLevel.valueOf(pairParameter.getValue()));
 +                            loggerService.update(LoggerType.LOG, loggerTO);
 +                            System.out.
 +                                    println("\n - Logger " + loggerTO.getKey() + " updated");
 +                            System.out.println("   - level: " + loggerTO.getLevel());
 +                            System.out.println("");
 +                        } catch (final WebServiceException | SyncopeClientException | IllegalArgumentException ex) {
 +                            Messages.printTypeNotValidMessage(
 +                                    "logger level", input.firstParameter(), fromEnumToArray(LoggerLevel.class));
 +                            break;
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(createErrorMessage);
 +                }
 +                break;
 +            case DELETE:
 +                final String deleteErrorMessage = "logger --delete {LOG-NAME} {LOG-NAME} [...]";
 +
 +                if (parameters.length >= 1) {
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            loggerService.delete(LoggerType.LOG, parameter);
 +                            Messages.printDeletedMessage("Logger", parameter);
 +                        } catch (final WebServiceException | SyncopeClientException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Logger", parameter);
 +                            } else {
 +                                Messages.printMessage(ex.getMessage());
 +                            }
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(deleteErrorMessage);
 +                }
 +                break;
 +            case HELP:
 +                System.out.println(HELP_MESSAGE);
 +                break;
 +            default:
 +                Messages.printDefaultMessage(input.getOption(), HELP_MESSAGE);
 +        }
 +    }
 +
 +    @Override
 +    public String getHelpMessage() {
 +        return HELP_MESSAGE;
 +    }
 +
 +    private enum Options {
 +
 +        HELP("--help"),
 +        LIST("--list"),
 +        READ("--read"),
 +        UPDATE("--update"),
 +        UPDATE_ALL("--update-all"),
 +        CREATE("--create"),
 +        DELETE("--delete");
 +
 +        private final String optionName;
 +
-         private Options(final String optionName) {
++        Options(final String optionName) {
 +            this.optionName = optionName;
 +        }
 +
 +        public String getOptionName() {
 +            return optionName;
 +        }
 +
 +        public boolean equalsOptionName(final String otherName) {
 +            return (otherName == null) ? false : optionName.equals(otherName);
 +        }
 +
 +        public static Options fromName(final String name) {
 +            Options optionToReturn = HELP;
 +            for (final Options option : Options.values()) {
 +                if (option.equalsOptionName(name)) {
 +                    optionToReturn = option;
 +                }
 +            }
 +            return optionToReturn;
 +        }
 +
 +        public static List<String> toList() {
 +            final List<String> options = new ArrayList<>();
 +            for (final Options value : values()) {
 +                options.add(value.getOptionName());
 +            }
 +            return options;
 +        }
 +    }
 +
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/NotificationCommand.java
----------------------------------------------------------------------
diff --cc client/cli/src/main/java/org/apache/syncope/client/cli/commands/NotificationCommand.java
index 194ee11,0000000..28ae8c5
mode 100644,000000..100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/NotificationCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/NotificationCommand.java
@@@ -1,169 -1,0 +1,169 @@@
 +/*
 + * 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.client.cli.commands;
 +
 +import java.util.ArrayList;
 +import java.util.List;
 +import javax.xml.ws.WebServiceException;
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.syncope.client.cli.Command;
 +import org.apache.syncope.client.cli.Input;
 +import org.apache.syncope.client.cli.SyncopeServices;
 +import org.apache.syncope.client.cli.messages.Messages;
 +import org.apache.syncope.common.lib.SyncopeClientException;
 +import org.apache.syncope.common.lib.to.NotificationTO;
 +import org.apache.syncope.common.rest.api.service.NotificationService;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
 +@Command(name = "notification")
 +public class NotificationCommand extends AbstractCommand {
 +
 +    private static final Logger LOG = LoggerFactory.getLogger(NotificationCommand.class);
 +
 +    private static final String HELP_MESSAGE = "Usage: notification [options]\n"
 +            + "  Options:\n"
 +            + "    --help \n"
 +            + "    --list \n"
 +            + "    --read \n"
 +            + "       Syntax: --read {NOTIFICATION-ID} \n"
 +            + "    --delete \n"
 +            + "       Syntax: --delete {NOTIFICATION-ID}";
 +
 +    @Override
 +    public void execute(final Input input) {
 +        LOG.debug("Option: {}", input.getOption());
 +        LOG.debug("Parameters:");
 +        for (final String parameter : input.getParameters()) {
 +            LOG.debug("   > " + parameter);
 +        }
 +
 +        final String[] parameters = input.getParameters();
 +
 +        if (StringUtils.isBlank(input.getOption())) {
 +            input.setOption(Options.HELP.getOptionName());
 +        }
 +
 +        final NotificationService notificationService = SyncopeServices.get(NotificationService.class);
 +        switch (Options.fromName(input.getOption())) {
 +            case LIST:
 +                try {
 +                    for (final NotificationTO notificationTO : notificationService.list()) {
 +                        System.out.println(notificationTO);
 +                    }
 +                } catch (final SyncopeClientException ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                }
 +                break;
 +            case READ:
 +                final String readErrorMessage = "notification --read {NOTIFICATION-ID} {NOTIFICATION-ID} [...]";
 +                if (parameters.length >= 1) {
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            System.out.println(notificationService.read(Long.valueOf(parameter)));
 +                        } catch (final NumberFormatException ex) {
 +                            Messages.printIdNotNumberDeletedMessage("notification", parameter);
 +                        } catch (final WebServiceException | SyncopeClientException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Notification", parameter);
 +                            } else {
 +                                Messages.printMessage(ex.getMessage());
 +                            }
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(readErrorMessage);
 +                }
 +                break;
 +            case DELETE:
 +                final String deleteErrorMessage = "notification --delete {NOTIFICATION-ID} {NOTIFICATION-ID} [...]";
 +
 +                if (parameters.length >= 1) {
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            notificationService.delete(Long.valueOf(parameter));
 +                            Messages.printDeletedMessage("Notification", parameter);
 +                        } catch (final WebServiceException | SyncopeClientException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Notification", parameter);
 +                            } else {
 +                                Messages.printMessage(ex.getMessage());
 +                            }
 +                        } catch (final NumberFormatException ex) {
 +                            Messages.printIdNotNumberDeletedMessage("notification", parameter);
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(deleteErrorMessage);
 +                }
 +                break;
 +            case HELP:
 +                System.out.println(HELP_MESSAGE);
 +                break;
 +            default:
 +                Messages.printDefaultMessage(input.getOption(), HELP_MESSAGE);
 +        }
 +    }
 +
 +    @Override
 +    public String getHelpMessage() {
 +        return HELP_MESSAGE;
 +    }
 +
 +    private enum Options {
 +
 +        HELP("--help"),
 +        LIST("--list"),
 +        READ("--read"),
 +        DELETE("--delete");
 +
 +        private final String optionName;
 +
-         private Options(final String optionName) {
++        Options(final String optionName) {
 +            this.optionName = optionName;
 +        }
 +
 +        public String getOptionName() {
 +            return optionName;
 +        }
 +
 +        public boolean equalsOptionName(final String otherName) {
 +            return (otherName == null) ? false : optionName.equals(otherName);
 +        }
 +
 +        public static Options fromName(final String name) {
 +            Options optionToReturn = HELP;
 +            for (final Options option : Options.values()) {
 +                if (option.equalsOptionName(name)) {
 +                    optionToReturn = option;
 +                }
 +            }
 +            return optionToReturn;
 +        }
 +
 +        public static List<String> toList() {
 +            final List<String> options = new ArrayList<>();
 +            for (final Options value : values()) {
 +                options.add(value.getOptionName());
 +            }
 +            return options;
 +        }
 +    }
 +
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/PolicyCommand.java
----------------------------------------------------------------------
diff --cc client/cli/src/main/java/org/apache/syncope/client/cli/commands/PolicyCommand.java
index a69be18,0000000..a5017cf
mode 100644,000000..100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/PolicyCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/PolicyCommand.java
@@@ -1,186 -1,0 +1,186 @@@
 +/*
 + * 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.client.cli.commands;
 +
 +import java.util.ArrayList;
 +import java.util.List;
 +import javax.xml.ws.WebServiceException;
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.syncope.client.cli.Command;
 +import org.apache.syncope.client.cli.Input;
 +import org.apache.syncope.client.cli.SyncopeServices;
 +import org.apache.syncope.client.cli.messages.Messages;
 +import org.apache.syncope.common.lib.SyncopeClientException;
 +import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
 +import org.apache.syncope.common.lib.types.PolicyType;
 +import org.apache.syncope.common.rest.api.service.PolicyService;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
 +@Command(name = "policy")
 +public class PolicyCommand extends AbstractCommand {
 +
 +    private static final Logger LOG = LoggerFactory.getLogger(PolicyCommand.class);
 +
 +    private static final String HELP_MESSAGE = "Usage: policy [options]\n"
 +            + "  Options:\n"
 +            + "    --help \n"
 +            + "    --list-policy \n"
 +            + "       Syntax: --list-policy {POLICY-TYPE} \n"
 +            + "          Policy type: ACCOUNT / PASSWORD / SYNC / PUSH\n"
 +            + "    --read \n"
 +            + "       Syntax: --read {POLICY-ID} {POLICY-ID} [...]\n"
 +            + "    --delete \n"
 +            + "       Syntax: --delete {POLICY-ID} {POLICY-ID} [...]";
 +
 +    @Override
 +    public void execute(final Input input) {
 +        LOG.debug("Option: {}", input.getOption());
 +        LOG.debug("Parameters:");
 +        for (final String parameter : input.getParameters()) {
 +            LOG.debug("   > " + parameter);
 +        }
 +
 +        final String[] parameters = input.getParameters();
 +
 +        if (StringUtils.isBlank(input.getOption())) {
 +            input.setOption(Options.HELP.getOptionName());
 +        }
 +
 +        final PolicyService policyService = SyncopeServices.get(PolicyService.class);
 +        switch (Options.fromName(input.getOption())) {
 +            case LIST_POLICY:
 +                final String listPolicyErrorMessage = "policy --list-policy {POLICY-TYPE}\n"
 +                        + "   Policy type: ACCOUNT / PASSWORD / SYNC / PUSH";
 +
 +                if (parameters.length == 1) {
 +                    try {
 +                        for (final AbstractPolicyTO policyTO : policyService.list(PolicyType.valueOf(parameters[0]))) {
 +                            System.out.println(policyTO);
 +                        }
 +                    } catch (final SyncopeClientException ex) {
 +                        Messages.printMessage(ex.getMessage());
 +                    } catch (final IllegalArgumentException ex) {
 +                        Messages.printTypeNotValidMessage(
 +                                "policy", input.firstParameter(), fromEnumToArray(PolicyType.class));
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(listPolicyErrorMessage);
 +                }
 +                break;
 +            case READ:
 +                final String readErrorMessage = "policy --read {POLICY-ID} {POLICY-ID} [...]";
 +
 +                if (parameters.length >= 1) {
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            System.out.println(policyService.read(Long.valueOf(parameter)));
 +                        } catch (final NumberFormatException ex) {
 +                            Messages.printIdNotNumberDeletedMessage("policy", parameter);
 +                        } catch (final WebServiceException | SyncopeClientException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Policy", parameter);
 +                            } else {
 +                                Messages.printMessage(ex.getMessage());
 +                            }
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(readErrorMessage);
 +                }
 +                break;
 +            case DELETE:
 +                final String deleteErrorMessage = "policy --delete {POLICY-ID} {POLICY-ID} [...]";
 +
 +                if (parameters.length >= 1) {
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            policyService.delete(Long.valueOf(parameter));
 +                            Messages.printDeletedMessage("Policy", parameter);
 +                        } catch (final WebServiceException | SyncopeClientException ex) {
 +                            System.out.println("Error:");
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Policy", parameter);
 +                            } else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
 +                                Messages.printMessage("You cannot delete policy " + parameter);
 +                            } else {
 +                                Messages.printMessage(ex.getMessage());
 +                            }
 +                        } catch (final NumberFormatException ex) {
 +                            Messages.printIdNotNumberDeletedMessage("policy", parameter);
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(deleteErrorMessage);
 +                }
 +                break;
 +            case HELP:
 +                System.out.println(HELP_MESSAGE);
 +                break;
 +            default:
 +                Messages.printDefaultMessage(input.getOption(), HELP_MESSAGE);
 +        }
 +    }
 +
 +    @Override
 +    public String getHelpMessage() {
 +        return HELP_MESSAGE;
 +    }
 +
 +    private enum Options {
 +
 +        HELP("--help"),
 +        LIST_POLICY("--list-policy"),
 +        READ("--read"),
 +        DELETE("--delete");
 +
 +        private final String optionName;
 +
-         private Options(final String optionName) {
++        Options(final String optionName) {
 +            this.optionName = optionName;
 +        }
 +
 +        public String getOptionName() {
 +            return optionName;
 +        }
 +
 +        public boolean equalsOptionName(final String otherName) {
 +            return (otherName == null) ? false : optionName.equals(otherName);
 +        }
 +
 +        public static Options fromName(final String name) {
 +            Options optionToReturn = HELP;
 +            for (final Options option : Options.values()) {
 +                if (option.equalsOptionName(name)) {
 +                    optionToReturn = option;
 +                }
 +            }
 +            return optionToReturn;
 +        }
 +
 +        public static List<String> toList() {
 +            final List<String> options = new ArrayList<>();
 +            for (final Options value : values()) {
 +                options.add(value.getOptionName());
 +            }
 +            return options;
 +        }
 +    }
 +
 +}


[8/8] syncope git commit: Merge branch '1_2_X' of https://git-wip-us.apache.org/repos/asf/syncope into 1_2_X

Posted by il...@apache.org.
Merge branch '1_2_X' of https://git-wip-us.apache.org/repos/asf/syncope into 1_2_X


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

Branch: refs/heads/1_2_X
Commit: 56f159808c863507792752e9fd637d345d481dc1
Parents: 503097d fb57753
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Oct 19 16:36:33 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Oct 19 16:36:33 2015 +0200

----------------------------------------------------------------------
 .../core/persistence/dao/impl/SubjectSearchDAOImpl.java  | 11 ++++++++---
 .../apache/syncope/core/services/RoleServiceImpl.java    | 11 ++++++++---
 .../org/apache/syncope/core/rest/SearchTestITCase.java   |  9 +++++++++
 3 files changed, 25 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



[3/8] syncope git commit: Upgrading surefire, failsafe and checkstyle plugins

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java
----------------------------------------------------------------------
diff --cc core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java
index c4c1928,0000000..13acaab
mode 100644,000000..100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java
@@@ -1,113 -1,0 +1,113 @@@
 +/*
 + * 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.logic.init;
 +
 +import java.sql.Connection;
 +import java.sql.SQLException;
 +import java.util.Map;
 +import javax.sql.DataSource;
 +import org.apache.logging.log4j.Level;
 +import org.apache.logging.log4j.LogManager;
 +import org.apache.logging.log4j.core.Appender;
 +import org.apache.logging.log4j.core.LoggerContext;
 +import org.apache.logging.log4j.core.appender.db.jdbc.ColumnConfig;
 +import org.apache.logging.log4j.core.appender.db.jdbc.ConnectionSource;
 +import org.apache.logging.log4j.core.appender.db.jdbc.JdbcAppender;
 +import org.apache.logging.log4j.core.config.LoggerConfig;
 +import org.apache.syncope.core.misc.AuditManager;
 +import org.apache.syncope.core.misc.security.AuthContextUtils;
 +import org.apache.syncope.core.persistence.api.DomainsHolder;
 +import org.apache.syncope.core.persistence.api.SyncopeLoader;
 +import org.springframework.beans.factory.annotation.Autowired;
 +import org.springframework.jdbc.datasource.DataSourceUtils;
 +import org.springframework.stereotype.Component;
 +
 +@Component
 +public class LoggerLoader implements SyncopeLoader {
 +
 +    @Autowired
 +    private DomainsHolder domainsHolder;
 +
 +    @Autowired
 +    private LoggerAccessor loggerAccessor;
 +
 +    @Override
 +    public Integer getPriority() {
 +        return 300;
 +    }
 +
 +    @Override
 +    public void load() {
 +        final LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
 +
 +        // Audit table and DataSource for each configured domain
 +        ColumnConfig[] columns = {
 +            ColumnConfig.createColumnConfig(ctx.getConfiguration(), "EVENT_DATE", null, null, "true", null, null),
 +            ColumnConfig.createColumnConfig(ctx.getConfiguration(), "LOGGER_LEVEL", "%level", null, null, null, null),
 +            ColumnConfig.createColumnConfig(ctx.getConfiguration(), "LOGGER", "%logger", null, null, null, null),
 +            ColumnConfig.createColumnConfig(ctx.getConfiguration(), "MESSAGE", "%message", null, null, null, null),
 +            ColumnConfig.createColumnConfig(ctx.getConfiguration(), "THROWABLE", "%ex{full}", null, null, null, null)
 +        };
 +        for (Map.Entry<String, DataSource> entry : domainsHolder.getDomains().entrySet()) {
 +            Appender appender = ctx.getConfiguration().getAppender("audit_for_" + entry.getKey());
 +            if (appender == null) {
 +                appender = JdbcAppender.createAppender(
 +                        "audit_for_" + entry.getKey(),
 +                        "false",
 +                        null,
 +                        new DataSourceConnectionSource(entry.getValue()),
 +                        "0",
 +                        "SYNCOPEAUDIT",
 +                        columns);
 +                appender.start();
 +                ctx.getConfiguration().addAppender(appender);
 +            }
 +
 +            LoggerConfig logConf = new LoggerConfig(AuditManager.getDomainAuditLoggerName(entry.getKey()), null, false);
 +            logConf.addAppender(appender, Level.DEBUG, null);
 +            ctx.getConfiguration().addLogger(AuditManager.getDomainAuditLoggerName(entry.getKey()), logConf);
 +
 +            AuthContextUtils.execWithAuthContext(entry.getKey(), new AuthContextUtils.Executable<Void>() {
 +
 +                @Override
 +                public Void exec() {
 +                    loggerAccessor.synchronizeLog4J(ctx);
 +                    return null;
 +                }
 +            });
 +        }
 +
 +        ctx.updateLoggers();
 +    }
 +
 +    private static class DataSourceConnectionSource implements ConnectionSource {
 +
 +        private final DataSource dataSource;
 +
-         public DataSourceConnectionSource(final DataSource dataSource) {
++        DataSourceConnectionSource(final DataSource dataSource) {
 +            this.dataSource = dataSource;
 +        }
 +
 +        @Override
 +        public Connection getConnection() throws SQLException {
 +            return DataSourceUtils.getConnection(dataSource);
 +        }
 +
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/ClassFreeUberspectImpl.java
----------------------------------------------------------------------
diff --cc core/misc/src/main/java/org/apache/syncope/core/misc/jexl/ClassFreeUberspectImpl.java
index 662cb15,0000000..62e3dba
mode 100644,000000..100644
--- a/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/ClassFreeUberspectImpl.java
+++ b/core/misc/src/main/java/org/apache/syncope/core/misc/jexl/ClassFreeUberspectImpl.java
@@@ -1,43 -1,0 +1,43 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *   http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing,
 + * software distributed under the License is distributed on an
 + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 + * KIND, either express or implied.  See the License for the
 + * specific language governing permissions and limitations
 + * under the License.
 + */
 +package org.apache.syncope.core.misc.jexl;
 +
 +import org.apache.commons.jexl2.JexlInfo;
 +import org.apache.commons.jexl2.introspection.JexlMethod;
 +import org.apache.commons.jexl2.introspection.JexlPropertyGet;
 +import org.apache.commons.jexl2.introspection.UberspectImpl;
 +import org.apache.commons.logging.Log;
 +
 +class ClassFreeUberspectImpl extends UberspectImpl {
 +
-     public ClassFreeUberspectImpl(final Log runtimeLogger) {
++    ClassFreeUberspectImpl(final Log runtimeLogger) {
 +        super(runtimeLogger);
 +    }
 +
 +    @Override
 +    public JexlPropertyGet getPropertyGet(final Object obj, final Object identifier, final JexlInfo info) {
 +        return "class".equals(identifier) ? null : super.getPropertyGet(obj, identifier, info);
 +    }
 +
 +    @Override
 +    public JexlMethod getMethod(final Object obj, final String method, final Object[] args, final JexlInfo info) {
 +        return "getClass".equals(method) ? null : super.getMethod(obj, method, args, info);
 +    }
 +
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/ImplementationLookup.java
----------------------------------------------------------------------
diff --cc core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/ImplementationLookup.java
index fd349a9,0000000..fa8847f
mode 100644,000000..100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/ImplementationLookup.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/ImplementationLookup.java
@@@ -1,55 -1,0 +1,55 @@@
 +/*
 + * 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.api;
 +
 +import java.util.Set;
 +import org.apache.syncope.common.lib.policy.AccountRuleConf;
 +import org.apache.syncope.common.lib.policy.PasswordRuleConf;
 +import org.apache.syncope.common.lib.report.ReportletConf;
 +import org.apache.syncope.core.persistence.api.dao.AccountRule;
 +import org.apache.syncope.core.persistence.api.dao.PasswordRule;
 +import org.apache.syncope.core.persistence.api.dao.Reportlet;
 +
 +public interface ImplementationLookup extends SyncopeLoader {
 +
-     public enum Type {
++    enum Type {
 +
 +        REPORTLET,
 +        ACCOUNT_RULE,
 +        PASSWORD_RULE,
 +        MAPPING_ITEM_TRANSFORMER,
 +        TASKJOBDELEGATE,
 +        LOGIC_ACTIONS,
 +        PROPAGATION_ACTIONS,
 +        SYNC_ACTIONS,
 +        PUSH_ACTIONS,
 +        SYNC_CORRELATION_RULE,
 +        PUSH_CORRELATION_RULE,
 +        VALIDATOR
 +
 +    }
 +
 +    Set<String> getClassNames(Type type);
 +
 +    Class<? extends Reportlet> getReportletClass(Class<? extends ReportletConf> reportletConfClass);
 +
 +    Class<? extends AccountRule> getAccountRuleClass(Class<? extends AccountRuleConf> accountRuleConfClass);
 +
 +    Class<? extends PasswordRule> getPasswordRuleClass(Class<? extends PasswordRuleConf> passwordRuleConfClass);
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/ContentLoaderHandler.java
----------------------------------------------------------------------
diff --cc core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/ContentLoaderHandler.java
index ddeb0e2,0000000..edd430e
mode 100644,000000..100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/ContentLoaderHandler.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/ContentLoaderHandler.java
@@@ -1,199 -1,0 +1,199 @@@
 +/*
 + * 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.content;
 +
 +import java.sql.ResultSet;
 +import java.sql.SQLException;
 +import java.sql.Types;
 +import java.text.ParseException;
 +import java.util.HashMap;
 +import java.util.Map;
 +import javax.sql.DataSource;
 +import org.apache.commons.codec.DecoderException;
 +import org.apache.commons.codec.binary.Hex;
 +import org.apache.syncope.core.misc.DataFormat;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +import org.springframework.dao.DataAccessException;
 +import org.springframework.jdbc.core.JdbcTemplate;
 +import org.springframework.jdbc.core.ResultSetExtractor;
 +import org.xml.sax.Attributes;
 +import org.xml.sax.SAXException;
 +import org.xml.sax.helpers.DefaultHandler;
 +
 +/**
 + * SAX handler for generating SQL INSERT statements out of given XML file.
 + */
 +class ContentLoaderHandler extends DefaultHandler {
 +
 +    private static final Logger LOG = LoggerFactory.getLogger(ContentLoaderHandler.class);
 +
 +    private final DataSource dataSource;
 +
 +    private final String rootElement;
 +
-     public ContentLoaderHandler(final DataSource dataSource, final String rootElement) {
++    ContentLoaderHandler(final DataSource dataSource, final String rootElement) {
 +        this.dataSource = dataSource;
 +        this.rootElement = rootElement;
 +    }
 +
 +    private Object[] getParameters(final String tableName, final Attributes attrs) {
 +        JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
 +
 +        Map<String, Integer> colTypes = jdbcTemplate.query("SELECT * FROM " + tableName + " WHERE 0=1",
 +                new ResultSetExtractor<Map<String, Integer>>() {
 +
 +                    @Override
 +                    public Map<String, Integer> extractData(final ResultSet rs) throws SQLException {
 +                        Map<String, Integer> colTypes = new HashMap<>();
 +                        for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
 +                            colTypes.put(
 +                                    rs.getMetaData().getColumnName(i).toUpperCase(),
 +                                    rs.getMetaData().getColumnType(i));
 +                        }
 +                        return colTypes;
 +                    }
 +                });
 +
 +        Object[] parameters = new Object[attrs.getLength()];
 +        for (int i = 0; i < attrs.getLength(); i++) {
 +            Integer colType = colTypes.get(attrs.getQName(i).toUpperCase());
 +            if (colType == null) {
 +                LOG.warn("No column type found for {}", attrs.getQName(i).toUpperCase());
 +                colType = Types.VARCHAR;
 +            }
 +
 +            switch (colType) {
 +                case Types.INTEGER:
 +                case Types.TINYINT:
 +                case Types.SMALLINT:
 +                    try {
 +                        parameters[i] = Integer.valueOf(attrs.getValue(i));
 +                    } catch (NumberFormatException e) {
 +                        LOG.error("Unparsable Integer '{}'", attrs.getValue(i));
 +                        parameters[i] = attrs.getValue(i);
 +                    }
 +                    break;
 +
 +                case Types.NUMERIC:
 +                case Types.DECIMAL:
 +                case Types.BIGINT:
 +                    try {
 +                        parameters[i] = Long.valueOf(attrs.getValue(i));
 +                    } catch (NumberFormatException e) {
 +                        LOG.error("Unparsable Long '{}'", attrs.getValue(i));
 +                        parameters[i] = attrs.getValue(i);
 +                    }
 +                    break;
 +
 +                case Types.DOUBLE:
 +                    try {
 +                        parameters[i] = Double.valueOf(attrs.getValue(i));
 +                    } catch (NumberFormatException e) {
 +                        LOG.error("Unparsable Double '{}'", attrs.getValue(i));
 +                        parameters[i] = attrs.getValue(i);
 +                    }
 +                    break;
 +
 +                case Types.REAL:
 +                case Types.FLOAT:
 +                    try {
 +                        parameters[i] = Float.valueOf(attrs.getValue(i));
 +                    } catch (NumberFormatException e) {
 +                        LOG.error("Unparsable Float '{}'", attrs.getValue(i));
 +                        parameters[i] = attrs.getValue(i);
 +                    }
 +                    break;
 +
 +                case Types.DATE:
 +                case Types.TIME:
 +                case Types.TIMESTAMP:
 +                    try {
 +                        parameters[i] = DataFormat.parseDate(attrs.getValue(i));
 +                    } catch (ParseException e) {
 +                        LOG.error("Unparsable Date '{}'", attrs.getValue(i));
 +                        parameters[i] = attrs.getValue(i);
 +                    }
 +                    break;
 +
 +                case Types.BIT:
 +                case Types.BOOLEAN:
 +                    parameters[i] = "1".equals(attrs.getValue(i)) ? Boolean.TRUE : Boolean.FALSE;
 +                    break;
 +
 +                case Types.BINARY:
 +                case Types.VARBINARY:
 +                case Types.LONGVARBINARY:
 +                    try {
 +                        parameters[i] = Hex.decodeHex(attrs.getValue(i).toCharArray());
 +                    } catch (DecoderException | IllegalArgumentException e) {
 +                        parameters[i] = attrs.getValue(i);
 +                    }
 +                    break;
 +
 +                case Types.BLOB:
 +                    try {
 +                        parameters[i] = Hex.decodeHex(attrs.getValue(i).toCharArray());
 +                    } catch (DecoderException | IllegalArgumentException e) {
 +                        LOG.warn("Error decoding hex string to specify a blob parameter", e);
 +                        parameters[i] = attrs.getValue(i);
 +                    } catch (Exception e) {
 +                        LOG.warn("Error creating a new blob parameter", e);
 +                    }
 +                    break;
 +
 +                default:
 +                    parameters[i] = attrs.getValue(i);
 +            }
 +        }
 +
 +        return parameters;
 +    }
 +
 +    @Override
 +    public void startElement(final String uri, final String localName, final String qName, final Attributes atts)
 +            throws SAXException {
 +
 +        // skip root element
 +        if (rootElement.equals(qName)) {
 +            return;
 +        }
 +
 +        StringBuilder query = new StringBuilder("INSERT INTO ").append(qName).append('(');
 +
 +        StringBuilder values = new StringBuilder();
 +
 +        for (int i = 0; i < atts.getLength(); i++) {
 +            query.append(atts.getQName(i));
 +            values.append('?');
 +            if (i < atts.getLength() - 1) {
 +                query.append(',');
 +                values.append(',');
 +            }
 +        }
 +        query.append(") VALUES (").append(values).append(')');
 +
 +        JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
 +        try {
 +            jdbcTemplate.update(query.toString(), getParameters(qName, atts));
 +        } catch (DataAccessException e) {
 +            LOG.error("While trying to perform {}", query, e);
 +        }
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/MultiParentNode.java
----------------------------------------------------------------------
diff --cc core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/MultiParentNode.java
index 98529e8,0000000..88a14e1
mode 100644,000000..100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/MultiParentNode.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/content/MultiParentNode.java
@@@ -1,106 -1,0 +1,106 @@@
 +/*
 + * 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.content;
 +
 +import java.util.HashSet;
 +import java.util.Set;
 +import org.apache.commons.lang3.builder.EqualsBuilder;
 +import org.apache.commons.lang3.builder.HashCodeBuilder;
 +
 +class MultiParentNode<T> {
 +
 +    private final T object;
 +
 +    private Set<MultiParentNode<T>> children;
 +
 +    private int level = 0;
 +
 +    private boolean exploited = false;
 +
-     public MultiParentNode(final T object) {
++    MultiParentNode(final T object) {
 +        this.object = object;
 +        children = new HashSet<>();
 +    }
 +
 +    public int getLevel() {
 +        return level;
 +    }
 +
 +    public void setLevel(final int level) {
 +        this.level = level;
 +    }
 +
 +    boolean isExploited() {
 +        return exploited;
 +    }
 +
 +    void setExploited(final boolean exploited) {
 +        this.exploited = exploited;
 +    }
 +
 +    public T getObject() {
 +        return object;
 +    }
 +
 +    public boolean isParent(final MultiParentNode<T> child) {
 +        return children.contains(child);
 +    }
 +
 +    public boolean isChild(final MultiParentNode<T> parent) {
 +        return parent.isParent(this);
 +    }
 +
 +    public Set<MultiParentNode<T>> getChildren() {
 +        return children;
 +    }
 +
 +    public void addParent(final MultiParentNode<T> parent) {
 +        if (parent != null) {
 +            parent.children.add(this);
 +        }
 +    }
 +
 +    public void removeParent(final MultiParentNode<T> parent) {
 +        if (parent != null) {
 +            parent.children.remove(this);
 +        }
 +    }
 +
 +    public void addChild(final MultiParentNode<T> child) {
 +        if (child != null) {
 +            children.add(child);
 +        }
 +    }
 +
 +    public void removeChild(final MultiParentNode<T> child) {
 +        if (child != null) {
 +            children.remove(child);
 +        }
 +    }
 +
 +    @Override
 +    public boolean equals(final Object obj) {
 +        return EqualsBuilder.reflectionEquals(this, obj);
 +    }
 +
 +    @Override
 +    public int hashCode() {
 +        return HashCodeBuilder.reflectionHashCode(this);
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/SearchSupport.java
----------------------------------------------------------------------
diff --cc core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/SearchSupport.java
index e87a22e,0000000..4c8297a
mode 100644,000000..100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/SearchSupport.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/SearchSupport.java
@@@ -1,155 -1,0 +1,155 @@@
 +/*
 + * 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.dao;
 +
 +import org.apache.commons.lang3.builder.EqualsBuilder;
 +import org.apache.commons.lang3.builder.HashCodeBuilder;
 +import org.apache.syncope.common.lib.types.AnyTypeKind;
 +import org.apache.syncope.common.lib.types.AttrSchemaType;
 +
 +class SearchSupport {
 +
 +    static class SearchView {
 +
 +        protected String alias;
 +
 +        protected String name;
 +
 +        protected SearchView(final String alias, final String name) {
 +            this.alias = alias;
 +            this.name = name;
 +        }
 +
 +        @Override
 +        public boolean equals(final Object obj) {
 +            return EqualsBuilder.reflectionEquals(this, obj);
 +        }
 +
 +        @Override
 +        public int hashCode() {
 +            return HashCodeBuilder.reflectionHashCode(this);
 +        }
 +    }
 +
 +    private final AnyTypeKind anyTypeKind;
 +
-     public SearchSupport(final AnyTypeKind anyTypeKind) {
++    SearchSupport(final AnyTypeKind anyTypeKind) {
 +        this.anyTypeKind = anyTypeKind;
 +    }
 +
 +    public String fieldName(final AttrSchemaType attrSchemaType) {
 +        String result;
 +
 +        switch (attrSchemaType) {
 +            case Boolean:
 +                result = "booleanvalue";
 +                break;
 +
 +            case Date:
 +                result = "datevalue";
 +                break;
 +
 +            case Double:
 +                result = "doublevalue";
 +                break;
 +
 +            case Long:
 +                result = "longvalue";
 +                break;
 +
 +            case String:
 +            case Enum:
 +                result = "stringvalue";
 +                break;
 +
 +            default:
 +                result = null;
 +        }
 +
 +        return result;
 +    }
 +
 +    public SearchView field() {
 +        String result = "";
 +
 +        switch (anyTypeKind) {
 +            case ANY_OBJECT:
 +                result = "anyObject_search";
 +                break;
 +
 +            case GROUP:
 +                result = "group_search";
 +                break;
 +
 +            case USER:
 +            default:
 +                result = "user_search";
 +                break;
 +        }
 +
 +        return new SearchView("sv", result);
 +    }
 +
 +    public SearchView attr() {
 +        return new SearchView("sva", field().name + "_attr");
 +    }
 +
 +    public SearchView relationship() {
 +        String kind = anyTypeKind == AnyTypeKind.USER ? "u" : "a";
 +        return new SearchView("sv" + kind + "m", field().name + "_" + kind + "relationship");
 +    }
 +
 +    public SearchView membership() {
 +        String kind = anyTypeKind == AnyTypeKind.USER ? "u" : "a";
 +        return new SearchView("sv" + kind + "m", field().name + "_" + kind + "membership");
 +    }
 +
 +    public SearchView dyngroupmembership() {
 +        String kind = anyTypeKind == AnyTypeKind.USER ? "u" : "a";
 +        return new SearchView("sv" + kind + "dgm", field().name + "_" + kind + "dyngmemb");
 +    }
 +
 +    public SearchView role() {
 +        return new SearchView("svr", field().name + "_role");
 +    }
 +
 +    public SearchView dynrolemembership() {
 +        return new SearchView("svdr", field().name + "_dynrmemb");
 +    }
 +
 +    public SearchView nullAttr() {
 +        return new SearchView("svna", field().name + "_null_attr");
 +    }
 +
 +    public SearchView resource() {
 +        return new SearchView("svr", field().name + "_resource");
 +    }
 +
 +    public SearchView groupResource() {
 +        return new SearchView("svrr", field().name + "_group_res");
 +    }
 +
 +    public SearchView uniqueAttr() {
 +        return new SearchView("svua", field().name + "_unique_attr");
 +    }
 +
 +    public SearchView entitlements() {
 +        return new SearchView("sve", field().name + "_entitlements");
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutePanel.java
----------------------------------------------------------------------
diff --cc ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutePanel.java
index 005e23f,0000000..d68a8e9
mode 100644,000000..100644
--- a/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutePanel.java
+++ b/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/panels/CamelRoutePanel.java
@@@ -1,178 -1,0 +1,178 @@@
 +/*
 + * 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.client.console.panels;
 +
 +import java.util.ArrayList;
 +import java.util.Collections;
 +import java.util.Iterator;
 +import java.util.List;
 +import org.apache.syncope.client.console.annotations.ExtensionPanel;
 +import org.apache.syncope.client.console.commons.SortableDataProviderComparator;
 +import org.apache.syncope.client.console.rest.CamelRouteRestClient;
 +import org.apache.syncope.common.lib.to.CamelRouteTO;
 +import org.apache.syncope.common.lib.types.AnyTypeKind;
 +import org.apache.syncope.common.lib.types.Entitlement;
 +import org.apache.wicket.PageReference;
 +import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
 +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 +import org.apache.wicket.extensions.ajax.markup.html.repeater.data.table.AjaxFallbackDefaultDataTable;
 +import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
 +import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder;
 +import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
 +import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
 +import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
 +import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
 +import org.apache.wicket.markup.html.WebMarkupContainer;
 +import org.apache.wicket.markup.repeater.Item;
 +import org.apache.wicket.model.AbstractReadOnlyModel;
 +import org.apache.wicket.model.IModel;
 +import org.apache.wicket.model.ResourceModel;
 +import org.apache.wicket.spring.injection.annot.SpringBean;
 +
 +@ExtensionPanel("Camel routes")
 +public class CamelRoutePanel extends AbstractExtensionPanel {
 +
 +    private static final long serialVersionUID = 1965360932245590233L;
 +
 +    private static final int CAMELROUTE_WIN_HEIGHT = 480;
 +
 +    private static final int CAMELROUTE_WIN_WIDTH = 800;
 +
 +    @SpringBean
 +    private CamelRouteRestClient restClient;
 +
 +    private ModalWindow editCamelRouteWin;
 +
 +    public CamelRoutePanel(final String id, final PageReference pageref) {
 +        super(id, pageref);
 +
 +        editCamelRouteWin = new ModalWindow("editCamelRouteWin");
 +        editCamelRouteWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
 +        editCamelRouteWin.setInitialHeight(CAMELROUTE_WIN_HEIGHT);
 +        editCamelRouteWin.setInitialWidth(CAMELROUTE_WIN_WIDTH);
 +        editCamelRouteWin.setCookieName("editCamelRouteWin-modal");
 +        add(editCamelRouteWin);
 +
 +        List<IColumn<CamelRouteTO, String>> routeCols = new ArrayList<>();
 +        routeCols.add(new PropertyColumn<CamelRouteTO, String>(new ResourceModel("key"), "key", "key"));
 +        routeCols.add(new AbstractColumn<CamelRouteTO, String>(new ResourceModel("actions", "")) {
 +
 +            private static final long serialVersionUID = 2054811145491901166L;
 +
 +            @Override
 +            public String getCssClass() {
 +                return "action";
 +            }
 +
 +            @Override
 +            public void populateItem(final Item<ICellPopulator<CamelRouteTO>> cellItem, final String componentId,
 +                    final IModel<CamelRouteTO> model) {
 +
 +                // Uncomment with something similar once SYNCOPE-156 is completed
 +                /* final ActionLinksPanel panel = new
 +                 * ActionLinksPanel(componentId, model, pageref);
 +                 *
 +                 * panel.add(new ActionLink() {
 +                 *
 +                 * private static final long serialVersionUID = -3722207913631435501L;
 +                 *
 +                 * @Override
 +                 * public void onClick(final AjaxRequestTarget target) {
 +                 *
 +                 * editCamelRouteWin.setPageCreator(new ModalWindow.PageCreator() {
 +                 *
 +                 * private static final long serialVersionUID = -7834632442532690940L;
 +                 *
 +                 * @Override
 +                 * public Page createPage() {
 +                 * return new CamelRouteModalPage(pageref, editCamelRouteWin,
 +                 * restClient.read(model.getObject().getKey()), false);
 +                 * }
 +                 *
 +                 * });
 +                 *
 +                 * editCamelRouteWin.show(target);
 +                 * }
 +                 * }, ActionLink.ActionType.EDIT, "CamelRoutes");
 +                 *
 +                 * cellItem.add(panel); */
 +            }
 +        });
 +
 +        final AjaxFallbackDefaultDataTable<CamelRouteTO, String> routeTable =
 +                new AjaxFallbackDefaultDataTable<>("camelRouteTable", routeCols, new CamelRouteProvider(), 50);
 +
 +        WebMarkupContainer routeContainer = new WebMarkupContainer("camelRoutesContainer");
 +        routeContainer.add(routeTable);
 +        routeContainer.setOutputMarkupId(true);
 +        MetaDataRoleAuthorizationStrategy.authorize(routeContainer, ENABLE, Entitlement.ROUTE_LIST);
 +        add(routeContainer);
 +    }
 +
 +    private class CamelRouteProvider extends SortableDataProvider<CamelRouteTO, String> {
 +
 +        private static final long serialVersionUID = -2917236020432105949L;
 +
 +        private final SortableDataProviderComparator<CamelRouteTO> comparator;
 +
-         public CamelRouteProvider() {
++       CamelRouteProvider() {
 +            setSort("key", SortOrder.ASCENDING);
 +            comparator = new SortableDataProviderComparator<>(this);
 +        }
 +
 +        @Override
 +        public Iterator<? extends CamelRouteTO> iterator(final long first, final long count) {
 +            List<CamelRouteTO> list = new ArrayList<>();
 +            if (restClient.isCamelEnabledFor(AnyTypeKind.USER)) {
 +                list.addAll(restClient.list(AnyTypeKind.USER));
 +            }
 +            if (restClient.isCamelEnabledFor(AnyTypeKind.GROUP)) {
 +                list.addAll(restClient.list(AnyTypeKind.GROUP));
 +            }
 +
 +            Collections.sort(list, comparator);
 +
 +            return list.subList((int) first, (int) first + (int) count).iterator();
 +        }
 +
 +        @Override
 +        public long size() {
 +            return (restClient.isCamelEnabledFor(AnyTypeKind.USER)
 +                    ? restClient.list(AnyTypeKind.USER).size()
 +                    : 0)
 +                    + (restClient.isCamelEnabledFor(AnyTypeKind.GROUP)
 +                            ? restClient.list(AnyTypeKind.GROUP).size()
 +                            : 0);
 +        }
 +
 +        @Override
 +        public IModel<CamelRouteTO> model(final CamelRouteTO route) {
 +            return new AbstractReadOnlyModel<CamelRouteTO>() {
 +
 +                private static final long serialVersionUID = 774694801558497248L;
 +
 +                @Override
 +                public CamelRouteTO getObject() {
 +                    return route;
 +                }
 +            };
 +        }
 +    }
 +
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/installer/src/main/java/org/apache/syncope/installer/enums/Containers.java
----------------------------------------------------------------------
diff --cc installer/src/main/java/org/apache/syncope/installer/enums/Containers.java
index ac8e036,ac8e036..f79de47
--- a/installer/src/main/java/org/apache/syncope/installer/enums/Containers.java
+++ b/installer/src/main/java/org/apache/syncope/installer/enums/Containers.java
@@@ -24,7 -24,7 +24,7 @@@ public enum Containers 
      JBOSS("jboss"),
      GLASSFISH("glassfish");
  
--    private Containers(final String name) {
++    Containers(final String name) {
          this.name = name;
      }
  

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/installer/src/main/java/org/apache/syncope/installer/enums/DBs.java
----------------------------------------------------------------------
diff --cc installer/src/main/java/org/apache/syncope/installer/enums/DBs.java
index 085b98f,9fcc92e..3e15b8c
--- a/installer/src/main/java/org/apache/syncope/installer/enums/DBs.java
+++ b/installer/src/main/java/org/apache/syncope/installer/enums/DBs.java
@@@ -26,7 -26,7 +26,7 @@@ public enum DBs 
      SQLSERVER("sqlserver"),
      ORACLE("oracle");
  
--    private DBs(final String name) {
++    DBs(final String name) {
          this.name = name;
      }
  

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/pom.xml
----------------------------------------------------------------------
diff --cc pom.xml
index 50e3522,4ef0802..78179bf
--- a/pom.xml
+++ b/pom.xml
@@@ -1140,7 -1067,65 +1140,7 @@@ under the License
            <artifactId>openjpa-maven-plugin</artifactId>
            <version>${openjpa.version}</version>
          </plugin>
-         
 -        <plugin>
 -          <groupId>org.codehaus.mojo</groupId>
 -          <artifactId>xml-maven-plugin</artifactId>
 -          <version>1.0</version>
 -          <dependencies>
 -            <dependency>
 -              <groupId>xalan</groupId>
 -              <artifactId>xalan</artifactId>
 -              <version>2.7.1</version>
 -            </dependency>
 -          </dependencies>
 -        </plugin>
 -        <plugin>
 -          <groupId>org.apache.maven.plugins</groupId>
 -          <artifactId>maven-surefire-plugin</artifactId>
 -          <version>2.19</version>
 -          <configuration>
 -            <redirectTestOutputToFile>true</redirectTestOutputToFile>
 -            <encoding>utf-8</encoding>
 -            <runOrder>alphabetical</runOrder>
 -            <argLine>-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m</argLine>
 -          </configuration>
 -        </plugin>
 -        <plugin>
 -          <groupId>org.apache.maven.plugins</groupId>
 -          <artifactId>maven-war-plugin</artifactId>
 -          <version>2.6</version>
 -          <configuration>
 -            <attachClasses>true</attachClasses>
 -          </configuration>
 -        </plugin>
 -        <plugin>
 -          <groupId>org.codehaus.mojo</groupId>
 -          <artifactId>selenium-maven-plugin</artifactId>
 -          <version>2.3</version>
 -        </plugin>
 -        <plugin>
 -          <groupId>org.apache.maven.plugins</groupId>
 -          <artifactId>maven-failsafe-plugin</artifactId>
 -          <version>2.19</version>
 -          <configuration>
 -            <redirectTestOutputToFile>true</redirectTestOutputToFile>
 -            <encoding>utf-8</encoding>
 -            <runOrder>alphabetical</runOrder>
 -          </configuration>
 -          <executions>
 -            <execution>
 -              <goals>
 -                <goal>integration-test</goal>
 -                <goal>verify</goal>
 -              </goals>
 -            </execution>
 -          </executions>
 -        </plugin>
 -        <plugin>
 -          <groupId>org.apache.maven.plugins</groupId>
 -          <artifactId>maven-antrun-plugin</artifactId>
 -          <version>1.8</version>
 -        </plugin>
++
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
@@@ -1231,43 -1179,42 +1231,43 @@@
              </container>
            </configuration>
          </plugin>
 +        
          <plugin>
 -          <groupId>org.codehaus.mojo</groupId>
 -          <artifactId>build-helper-maven-plugin</artifactId>
 -          <version>1.9</version>
 -        </plugin>
 -        <plugin>
 -          <groupId>org.zeroturnaround</groupId>
 -          <artifactId>jrebel-maven-plugin</artifactId>
 -          <version>1.1.5</version>
 +          <groupId>org.apache.maven.plugins</groupId>
 +          <artifactId>maven-surefire-plugin</artifactId>
-           <version>2.18.1</version>
++          <version>2.19</version>
 +          <configuration>
 +            <redirectTestOutputToFile>true</redirectTestOutputToFile>
 +            <encoding>utf-8</encoding>
 +            <runOrder>alphabetical</runOrder>
 +            <argLine>-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m -Xss256k</argLine>
 +          </configuration>
          </plugin>
          <plugin>
 -          <groupId>org.apache.felix</groupId>
 -          <artifactId>maven-bundle-plugin</artifactId>
 -          <version>2.5.0</version>
 +          <groupId>org.apache.maven.plugins</groupId>
 +          <artifactId>maven-failsafe-plugin</artifactId>
-           <version>2.18.1</version>
++          <version>2.19</version>
            <configuration>
 -            <supportedProjectTypes>
 -              <supportedProjectType>jar</supportedProjectType>
 -              <supportedProjectType>war</supportedProjectType>
 -              <supportedProjectType>bundle</supportedProjectType>
 -            </supportedProjectTypes>
 +            <redirectTestOutputToFile>true</redirectTestOutputToFile>
 +            <encoding>utf-8</encoding>
 +            <runOrder>alphabetical</runOrder>
            </configuration>
 +          <executions>
 +            <execution>
 +              <goals>
 +                <goal>integration-test</goal>
 +                <goal>verify</goal>
 +              </goals>
 +            </execution>
 +          </executions>
          </plugin>
 +        
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
-           <version>2.16</version>
+           <version>2.17</version>
 -          <dependencies>
 -            <dependency>
 -              <groupId>org.apache.syncope</groupId>
 -              <artifactId>syncope-build-tools</artifactId>
 -              <version>${project.version}</version>
 -              <classifier>classes</classifier>
 -            </dependency>
 -          </dependencies>
            <configuration>
 -            <configLocation>org/apache/syncope/checkstyle.xml</configLocation>
 +            <configLocation>${rootpom.basedir}/src/main/resources/org/apache/syncope/checkstyle.xml</configLocation>
              <targetJdk>${targetJdk}</targetJdk>
            </configuration>
          </plugin>


[5/8] syncope git commit: Upgrading surefire, failsafe and checkstyle plugins

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallCommand.java
----------------------------------------------------------------------
diff --cc client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallCommand.java
index e049a28,0000000..7bcfc10
mode 100644,000000..100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallCommand.java
@@@ -1,303 -1,0 +1,303 @@@
 +/*
 + * 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.client.cli.commands.install;
 +
 +import java.io.FileNotFoundException;
 +import java.io.UnsupportedEncodingException;
 +import java.net.ConnectException;
 +import java.net.UnknownHostException;
 +import java.util.Scanner;
 +import javax.ws.rs.ProcessingException;
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.syncope.client.cli.Command;
 +import org.apache.syncope.client.cli.Input;
 +import org.apache.syncope.client.cli.SyncopeServices;
 +import org.apache.syncope.client.cli.commands.AbstractCommand;
 +import org.apache.syncope.client.cli.commands.LoggerCommand;
 +import org.apache.syncope.client.cli.util.FileSystemUtils;
 +import org.apache.syncope.client.cli.util.JasyptUtils;
 +import org.apache.syncope.common.rest.api.service.SyncopeService;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
 +@Command(name = "install")
 +public class InstallCommand extends AbstractCommand {
 +
 +    private static final Logger LOG = LoggerFactory.getLogger(LoggerCommand.class);
 +
 +    private static final String HELP_MESSAGE = "Usage: install [options]\n"
 +            + "  Options:\n"
 +            + "    --help \n"
 +            + "    --setup";
 +
 +    private String syncopeAdminUser;
 +
 +    private String syncopeAdminPassword;
 +
 +    private String syncopeServerSchema;
 +
 +    private String syncopeServerHostname = "localhost";
 +
 +    private String syncopeServerPort = "8080";
 +
 +    private String syncopeServerRestContext = "/syncope/rest/";
 +
 +    @Override
 +    public void execute(final Input input) {
 +        LOG.debug("Option: {}", input.getOption());
 +        LOG.debug("Parameters:");
 +        for (final String parameter : input.getParameters()) {
 +            LOG.debug("   > " + parameter);
 +        }
 +
 +        if (StringUtils.isBlank(input.getOption())) {
 +            input.setOption(Options.HELP.getOptionName());
 +        }
 +
 +        switch (Options.fromName(input.getOption())) {
 +            case INSTALL:
 +                final Scanner scanIn = new Scanner(System.in);
 +
 +                System.out.println("");
 +                System.out.println("###############################################");
 +                System.out.println("#                                             #");
 +                System.out.println("# Welcome to Syncope CLI installation process #");
 +                System.out.println("#                                             #");
 +                System.out.println("###############################################");
 +                System.out.println("");
 +
 +                System.out.println("Path to config files of Syncope CLI client will be: "
 +                        + InstallConfigFileTemplate.DIR_PATH);
 +
 +                if (!FileSystemUtils.canWrite(InstallConfigFileTemplate.DIR_PATH)) {
 +                    System.out.println("Permission denied on " + InstallConfigFileTemplate.DIR_PATH);
 +                    break;
 +                }
 +                System.out.println("- File system permission checked");
 +                System.out.println("");
 +
 +                System.out.println("Syncope server schema [http/https]:");
 +                String syncopeServerSchemaFromSystemIn = scanIn.nextLine();
 +                boolean schemaFounded = false;
 +                while (!schemaFounded) {
 +                    if (("http".equalsIgnoreCase(syncopeServerSchemaFromSystemIn))
 +                            || ("https".equalsIgnoreCase(syncopeServerSchemaFromSystemIn))) {
 +                        syncopeServerSchema = syncopeServerSchemaFromSystemIn;
 +                        schemaFounded = true;
 +                    } else {
 +                        System.out.println("Please use one of below values:");
 +                        System.out.println("   - http");
 +                        System.out.println("   - https");
 +                        syncopeServerSchemaFromSystemIn = scanIn.nextLine();
 +                    }
 +                }
 +
 +                System.out.println("Syncope server hostname [e.g. " + syncopeServerHostname + "]:");
 +                String syncopeServerHostnameFromSystemIn = scanIn.nextLine();
 +                boolean syncopeServerHostnameFounded = false;
 +                while (!syncopeServerHostnameFounded) {
 +                    if (StringUtils.isNotBlank(syncopeServerHostnameFromSystemIn)) {
 +                        syncopeServerHostname = syncopeServerHostnameFromSystemIn;
 +                        syncopeServerHostnameFounded = true;
 +                    } else {
 +                        System.out.println("Syncope server hostname [e.g. " + syncopeServerHostname + "]:");
 +                        syncopeServerHostnameFromSystemIn = scanIn.nextLine();
 +                    }
 +                }
 +
 +                System.out.println("Syncope server port [e.g. " + syncopeServerPort + "]:");
 +                String syncopeServerPortFromSystemIn = scanIn.nextLine();
 +                boolean syncopeServerPortFounded = false;
 +                while (!syncopeServerPortFounded) {
 +                    if (StringUtils.isNotBlank(syncopeServerPortFromSystemIn)) {
 +                        syncopeServerPort = syncopeServerPortFromSystemIn;
 +                        syncopeServerPortFounded = true;
 +                    } else if (!StringUtils.isNumeric(syncopeServerPortFromSystemIn)) {
 +                        System.out.println(syncopeServerPortFromSystemIn + " is not a numeric string, try again");
 +                        syncopeServerPortFromSystemIn = scanIn.nextLine();
 +                    } else {
 +                        System.out.println("Syncope server port [e.g. " + syncopeServerPort + "]:");
 +                        syncopeServerPortFromSystemIn = scanIn.nextLine();
 +                    }
 +                }
 +
 +                System.out.println("Syncope server rest context [e.g. " + syncopeServerRestContext + "]:");
 +                String syncopeServerRestContextFromSystemIn = scanIn.nextLine();
 +                boolean syncopeServerRestContextFounded = false;
 +                while (!syncopeServerRestContextFounded) {
 +                    if (StringUtils.isNotBlank(syncopeServerRestContextFromSystemIn)) {
 +                        syncopeServerRestContext = syncopeServerRestContextFromSystemIn;
 +                        syncopeServerRestContextFounded = true;
 +                    } else {
 +                        System.out.println("Syncope server port [e.g. " + syncopeServerRestContext + "]:");
 +                        syncopeServerRestContextFromSystemIn = scanIn.nextLine();
 +                    }
 +                }
 +
 +                System.out.println("Syncope admin user:");
 +                String syncopeAdminUserFromSystemIn = scanIn.nextLine();
 +                boolean syncopeAdminUserFounded = false;
 +                while (!syncopeAdminUserFounded) {
 +                    if (StringUtils.isNotBlank(syncopeAdminUserFromSystemIn)) {
 +                        syncopeAdminUser = syncopeAdminUserFromSystemIn;
 +                        syncopeAdminUserFounded = true;
 +                    } else {
 +                        System.out.println("Syncope admin user:");
 +                        syncopeAdminUserFromSystemIn = scanIn.nextLine();
 +                    }
 +                }
 +
 +                System.out.println("Syncope admin password:");
 +                String syncopeAdminPasswordFromSystemIn = scanIn.nextLine();
 +                boolean syncopeAdminPasswordFounded = false;
 +                while (!syncopeAdminPasswordFounded) {
 +                    if (StringUtils.isNotBlank(syncopeAdminPasswordFromSystemIn)) {
 +                        syncopeAdminPassword = syncopeAdminPasswordFromSystemIn;
 +                        syncopeAdminPasswordFounded = true;
 +                    } else {
 +                        System.out.println("Syncope admin user:");
 +                        syncopeAdminPasswordFromSystemIn = scanIn.nextLine();
 +                    }
 +                }
 +
 +                scanIn.close();
 +
 +                final JasyptUtils jasyptUtils = JasyptUtils.getJasyptUtils();
 +
 +                try {
 +                    FileSystemUtils.createNewDirectory(InstallConfigFileTemplate.DIR_PATH);
 +                    final String contentCliPropertiesFile = InstallConfigFileTemplate.createFile(
 +                            syncopeServerSchema,
 +                            syncopeServerHostname,
 +                            syncopeServerPort,
 +                            syncopeServerRestContext,
 +                            syncopeAdminUser,
 +                            jasyptUtils.encrypt(syncopeAdminPassword));
 +                    FileSystemUtils.createFileWith(InstallConfigFileTemplate.FILE_PATH, contentCliPropertiesFile);
 +
 +                } catch (final FileNotFoundException | UnsupportedEncodingException ex) {
 +                    System.out.println(ex.getMessage());
 +                }
 +
 +                try {
 +                    final SyncopeService syncopeService = SyncopeServices.get(SyncopeService.class);
 +                    System.out.println("Provided parameters checked on Syncope core version: "
 +                            + syncopeService.info().getVersion());
 +                    System.out.println("");
 +                    System.out.println("###############################################");
 +                    System.out.println("#                                             #");
 +                    System.out.println("#           Installation successful           #");
 +                    System.out.println("#     now you can use Syncope CLI client      #");
 +                    System.out.println("#                                             #");
 +                    System.out.println("###############################################");
 +                    System.out.println("");
 +                } catch (final ProcessingException ex) {
 +                    if (ex.getCause() instanceof UnknownHostException) {
 +                        final String unknownHost = ex.getCause().getMessage().split(":")[3];
 +                        System.out.println("");
 +                        System.out.println("Provided host:" + unknownHost);
 +                        System.out.println("");
 +                        System.out.println("###############################################");
 +                        System.out.println("#                                             #");
 +                        System.out.println("#            Provided unknown host!           #");
 +                        System.out.println("#        START AGAIN the installation!        #");
 +                        System.out.println("#                                             #");
 +                        System.out.println("###############################################");
 +                        System.out.println("");
 +                    } else if (ex.getCause() instanceof ConnectException) {
 +                        System.out.println("");
 +                        System.out.println("Provided address :" + SyncopeServices.getAddress());
 +                        System.out.println("");
 +                        System.out.println("###############################################");
 +                        System.out.println("#                                             #");
 +                        System.out.println("#       Provided address is unreachable!      #");
 +                        System.out.println("#         Check it and if it is wrong         #");
 +                        System.out.println("#        START AGAIN the installation!        #");
 +                        System.out.println("#                                             #");
 +                        System.out.println("###############################################");
 +                        System.out.println("");
 +                    }
 +                } catch (final Exception e) {
 +                    if (e.getMessage().contains("not authenticated")) {
 +                        System.out.println("");
 +                        System.out.println("###############################################");
 +                        System.out.println("#                                             #");
 +                        System.out.println("#   Username or password provided are wrong   #");
 +                        System.out.println("#        START AGAIN the installation!        #");
 +                        System.out.println("#                                             #");
 +                        System.out.println("###############################################");
 +                        System.out.println("");
 +                    } else {
 +                        System.out.println("");
 +                        System.out.println("###############################################");
 +                        System.out.println("#                                             #");
 +                        System.out.println("#                Something wrong              #");
 +                        System.out.println("#        START AGAIN the installation!        #");
 +                        System.out.println("#                                             #");
 +                        System.out.println("###############################################");
 +                        System.out.println("");
 +                    }
 +                }
 +                break;
 +            case HELP:
 +                System.out.println(HELP_MESSAGE);
 +                break;
 +            default:
 +                System.out.println(input.getOption() + " is not a valid option.");
 +                System.out.println("");
 +                System.out.println(HELP_MESSAGE);
 +        }
 +    }
 +
 +    @Override
 +    public String getHelpMessage() {
 +        return HELP_MESSAGE;
 +    }
 +
 +    private enum Options {
 +
 +        HELP("--help"),
 +        INSTALL("--setup");
 +
 +        private final String optionName;
 +
-         private Options(final String optionName) {
++        Options(final String optionName) {
 +            this.optionName = optionName;
 +        }
 +
 +        public String getOptionName() {
 +            return optionName;
 +        }
 +
 +        public boolean equalsOptionName(final String otherName) {
 +            return (otherName == null) ? false : optionName.equals(otherName);
 +        }
 +
 +        public static Options fromName(final String name) {
 +            Options optionToReturn = HELP;
 +            for (final Options option : Options.values()) {
 +                if (option.equalsOptionName(name)) {
 +                    optionToReturn = option;
 +                }
 +            }
 +            return optionToReturn;
 +        }
 +    }
 +
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/console/src/main/java/org/apache/syncope/client/console/commons/SortableAnyProviderComparator.java
----------------------------------------------------------------------
diff --cc client/console/src/main/java/org/apache/syncope/client/console/commons/SortableAnyProviderComparator.java
index 99cfaf0,0000000..68ea374
mode 100644,000000..100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/SortableAnyProviderComparator.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/SortableAnyProviderComparator.java
@@@ -1,122 -1,0 +1,122 @@@
 +/*
 + * 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.client.console.commons;
 +
 +import java.util.Arrays;
 +import java.util.HashSet;
 +import java.util.List;
 +import java.util.Map;
 +import java.util.Set;
 +import org.apache.syncope.common.lib.to.AnyTO;
 +import org.apache.syncope.common.lib.to.AttrTO;
 +import org.apache.syncope.common.lib.types.SchemaType;
 +import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
 +import org.apache.wicket.model.AbstractReadOnlyModel;
 +
 +public class SortableAnyProviderComparator extends SortableDataProviderComparator<AnyTO> {
 +
 +    private static final long serialVersionUID = 1775967163571699258L;
 +
 +    private static final Set<String> INLINE_PROPS = new HashSet<>(Arrays.asList(
 +            new String[] { "key", "status", "token", "username" }));
 +
 +    public SortableAnyProviderComparator(final SortableDataProvider<AnyTO, String> provider) {
 +        super(provider);
 +    }
 +
 +    @Override
 +    public int compare(final AnyTO any1, final AnyTO any2) {
 +        if (INLINE_PROPS.contains(provider.getSort().getProperty())) {
 +            return super.compare(any1, any2);
 +        }
 +
 +        return super.compare(new AttrModel(any1), new AttrModel(any2));
 +    }
 +
 +    @SuppressWarnings("rawtypes")
 +    private class AttrModel extends AbstractReadOnlyModel<Comparable> {
 +
 +        private static final long serialVersionUID = -7856686374020091808L;
 +
 +        private final Map<String, AttrTO> attrs;
 +
 +        private final Map<String, AttrTO> derAttrs;
 +
 +        private final Map<String, AttrTO> virAttrs;
 +
-         public AttrModel(final AnyTO anyTO) {
++        AttrModel(final AnyTO anyTO) {
 +            super();
 +
 +            this.attrs = anyTO.getPlainAttrMap();
 +            this.derAttrs = anyTO.getDerAttrMap();
 +            this.virAttrs = anyTO.getVirAttrMap();
 +        }
 +
 +        /**
 +         * @see UserAttrColumn constructor
 +         */
 +        @Override
 +        public Comparable getObject() {
 +            int hashPos = provider.getSort().getProperty().indexOf('#');
 +
 +            SchemaType schemaType = null;
 +            final String schema;
 +            if (hashPos == -1) {
 +                schema = provider.getSort().getProperty();
 +            } else {
 +                String[] splitted = provider.getSort().getProperty().split("#");
 +                try {
 +                    schemaType = SchemaType.valueOf(splitted[0]);
 +                } catch (IllegalArgumentException e) {
 +                    // this should never happen
 +                }
 +                schema = provider.getSort().getProperty().substring(hashPos + 1);
 +            }
 +
 +            final AttrTO attr;
 +            if (schemaType == null) {
 +                attr = this.attrs.get(schema);
 +            } else {
 +                switch (schemaType) {
 +                    case PLAIN:
 +                    default:
 +                        attr = this.attrs.get(schema);
 +                        break;
 +
 +                    case DERIVED:
 +                        attr = this.derAttrs.get(schema);
 +                        break;
 +
 +                    case VIRTUAL:
 +                        attr = this.virAttrs.get(schema);
 +                        break;
 +                }
 +            }
 +
 +            Comparable result = null;
 +
 +            List<String> values = attr == null ? null : attr.getValues();
 +            if (values != null && !values.isEmpty()) {
 +                result = values.iterator().next();
 +            }
 +
 +            return result;
 +        }
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/console/src/main/java/org/apache/syncope/client/console/commons/status/Status.java
----------------------------------------------------------------------
diff --cc client/console/src/main/java/org/apache/syncope/client/console/commons/status/Status.java
index 7198c2c,0000000..56b6992
mode 100644,000000..100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/status/Status.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/status/Status.java
@@@ -1,45 -1,0 +1,45 @@@
 +/*
 + * 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.client.console.commons.status;
 +
 +public enum Status {
 +
 +    NOT_YET_SUBMITTED(""),
 +    CREATED("created"),
 +    ACTIVE("active"),
 +    SUSPENDED("inactive"),
 +    UNDEFINED("undefined"),
 +    OBJECT_NOT_FOUND("objectnotfound");
 +
 +    public boolean isActive() {
 +        return this == ACTIVE;
 +    }
 +
-     private Status(final String name) {
++    Status(final String name) {
 +        this.name = name;
 +    }
 +
 +    private final String name;
 +
 +    @Override
 +    public String toString() {
 +        return name;
 +    }
 +
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/console/src/main/java/org/apache/syncope/client/console/pages/Login.java
----------------------------------------------------------------------
diff --cc client/console/src/main/java/org/apache/syncope/client/console/pages/Login.java
index 23fb25f,0000000..99cd6d3
mode 100644,000000..100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/Login.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/Login.java
@@@ -1,210 -1,0 +1,210 @@@
 +/*
 + * 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.client.console.pages;
 +
 +import java.security.AccessControlException;
 +import java.util.Locale;
 +import org.apache.syncope.client.console.SyncopeConsoleApplication;
 +import org.apache.syncope.client.console.SyncopeConsoleSession;
 +import org.apache.syncope.client.console.commons.Constants;
 +import org.apache.syncope.client.console.panels.NotificationPanel;
 +import org.apache.syncope.common.lib.SyncopeConstants;
 +import org.apache.wicket.ajax.AjaxRequestTarget;
 +import org.apache.wicket.ajax.markup.html.form.AjaxButton;
 +import org.apache.wicket.authentication.IAuthenticationStrategy;
 +import org.apache.wicket.authroles.authentication.AuthenticatedWebSession;
 +import org.apache.wicket.markup.html.WebPage;
 +import org.apache.wicket.markup.html.form.ChoiceRenderer;
 +import org.apache.wicket.markup.html.form.DropDownChoice;
 +import org.apache.wicket.markup.html.form.Form;
 +import org.apache.wicket.markup.html.form.PasswordTextField;
 +import org.apache.wicket.markup.html.form.StatelessForm;
 +import org.apache.wicket.markup.html.form.TextField;
 +import org.apache.wicket.model.IModel;
 +import org.apache.wicket.model.Model;
 +import org.apache.wicket.request.mapper.parameter.PageParameters;
 +import org.apache.wicket.spring.injection.annot.SpringBean;
 +
 +public class Login extends WebPage {
 +
 +    private static final long serialVersionUID = 5889157642852559004L;
 +
 +    @SpringBean(name = "anonymousUser")
 +    private String anonymousUser;
 +
 +    private final NotificationPanel feedbackPanel;
 +
 +    private final StatelessForm<Void> form;
 +
 +    private final TextField<String> usernameField;
 +
 +    private final TextField<String> passwordField;
 +
 +    private final DropDownChoice<Locale> languageSelect;
 +
 +    private final DropDownChoice<String> domainSelect;
 +
 +    public Login(final PageParameters parameters) {
 +        super(parameters);
 +        setStatelessHint(true);
 +
 +        feedbackPanel = new NotificationPanel(Constants.FEEDBACK);
 +        add(feedbackPanel);
 +
 +        form = new StatelessForm<>("login");
 +
 +        usernameField = new TextField<>("username", new Model<String>());
 +        usernameField.setMarkupId("username");
 +        form.add(usernameField);
 +
 +        passwordField = new PasswordTextField("password", new Model<String>());
 +        passwordField.setMarkupId("password");
 +        form.add(passwordField);
 +
 +        languageSelect = new LocaleDropDown("language");
 +        form.add(languageSelect);
 +
 +        domainSelect = new DomainDropDown("domain");
 +        if (SyncopeConsoleSession.get().getDomains().size() == 1) {
 +            domainSelect.setOutputMarkupPlaceholderTag(true);
 +        }
 +        form.add(domainSelect);
 +
 +        AjaxButton submitButton = new AjaxButton("submit", new Model<>(getString("submit"))) {
 +
 +            private static final long serialVersionUID = 429178684321093953L;
 +
 +            @Override
 +            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
 +                if (anonymousUser.equals(usernameField.getRawInput())) {
 +                    throw new AccessControlException("Illegal username");
 +                }
 +
 +                IAuthenticationStrategy strategy = getApplication().getSecuritySettings().getAuthenticationStrategy();
 +
 +                if (AuthenticatedWebSession.get().signIn(usernameField.getRawInput(), passwordField.getRawInput())) {
 +                    // If login has been called because the user was not yet logged in, than continue to the
 +                    // original destination, otherwise to the Home page
 +                    continueToOriginalDestination();
 +                    setResponsePage(getApplication().getHomePage());
 +                } else {
 +                    error(getString("login-error"));
 +                    feedbackPanel.refresh(target);
 +                }
 +                strategy.remove();
 +            }
 +        };
 +        submitButton.setDefaultFormProcessing(false);
 +        form.add(submitButton);
 +        form.setDefaultButton(submitButton);
 +
 +        add(form);
 +    }
 +
 +    /**
 +     * Inner class which implements (custom) Locale DropDownChoice component.
 +     */
 +    private class LocaleDropDown extends DropDownChoice<Locale> {
 +
 +        private static final long serialVersionUID = 2349382679992357202L;
 +
 +        private class LocaleRenderer extends ChoiceRenderer<Locale> {
 +
 +            private static final long serialVersionUID = -3657529581555164741L;
 +
 +            @Override
 +            public String getDisplayValue(final Locale locale) {
 +                return locale.getDisplayName(getLocale());
 +            }
 +        }
 +
-         public LocaleDropDown(final String id) {
++        LocaleDropDown(final String id) {
 +            super(id, SyncopeConsoleApplication.SUPPORTED_LOCALES);
 +
 +            setChoiceRenderer(new LocaleRenderer());
 +            setModel(new IModel<Locale>() {
 +
 +                private static final long serialVersionUID = -6985170095629312963L;
 +
 +                @Override
 +                public Locale getObject() {
 +                    return getSession().getLocale();
 +                }
 +
 +                @Override
 +                public void setObject(final Locale object) {
 +                    getSession().setLocale(object);
 +                }
 +
 +                @Override
 +                public void detach() {
 +                    // Empty.
 +                }
 +            });
 +
 +            // set default value to English
 +            getModel().setObject(Locale.ENGLISH);
 +        }
 +
 +        @Override
 +        protected boolean wantOnSelectionChangedNotifications() {
 +            return true;
 +        }
 +    }
 +
 +    /**
 +     * Inner class which implements (custom) Domain DropDownChoice component.
 +     */
 +    private class DomainDropDown extends DropDownChoice<String> {
 +
 +        private static final long serialVersionUID = -7401167913360133325L;
 +
-         public DomainDropDown(final String id) {
++        DomainDropDown(final String id) {
 +            super(id, SyncopeConsoleSession.get().getDomains());
 +
 +            setModel(new IModel<String>() {
 +
 +                private static final long serialVersionUID = -1124206668056084806L;
 +
 +                @Override
 +                public String getObject() {
 +                    return SyncopeConsoleSession.get().getDomain();
 +                }
 +
 +                @Override
 +                public void setObject(final String object) {
 +                    SyncopeConsoleSession.get().setDomain(object);
 +                }
 +
 +                @Override
 +                public void detach() {
 +                    // Empty.
 +                }
 +            });
 +
 +            // set default value to Master Domain
 +            getModel().setObject(SyncopeConstants.MASTER_DOMAIN);
 +        }
 +
 +        @Override
 +        protected boolean wantOnSelectionChangedNotifications() {
 +            return true;
 +        }
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
----------------------------------------------------------------------
diff --cc client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
index b631210,0000000..c66d650
mode 100644,000000..100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/ProvisioningModalPage.java
@@@ -1,252 -1,0 +1,252 @@@
 +/*
 + * 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.client.console.pages;
 +
 +import java.io.Serializable;
 +import java.util.ArrayList;
 +import java.util.Collections;
 +import java.util.LinkedHashMap;
 +import java.util.List;
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.syncope.client.console.commons.Constants;
 +import org.apache.syncope.client.console.commons.status.AbstractStatusBeanProvider;
 +import org.apache.syncope.client.console.commons.status.ConnObjectWrapper;
 +import org.apache.syncope.client.console.commons.status.StatusBean;
 +import org.apache.syncope.client.console.commons.status.StatusUtils;
 +import org.apache.syncope.client.console.panels.ActionDataTablePanel;
 +import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
 +import org.apache.syncope.client.lib.SyncopeClient;
 +import org.apache.syncope.common.lib.to.AnyTO;
 +import org.apache.syncope.common.lib.to.BulkActionResult;
 +import org.apache.syncope.common.lib.to.ResourceTO;
 +import org.apache.syncope.common.lib.types.AnyTypeKind;
 +import org.apache.syncope.common.lib.types.ResourceDeassociationAction;
 +import org.apache.syncope.common.lib.wrap.AbstractWrappable;
 +import org.apache.syncope.common.lib.wrap.AnyKey;
 +import org.apache.wicket.PageReference;
 +import org.apache.wicket.ajax.AjaxRequestTarget;
 +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 +import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
 +import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
 +import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
 +import org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider;
 +import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
 +import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
 +import org.apache.wicket.markup.html.basic.Label;
 +import org.apache.wicket.markup.repeater.Item;
 +import org.apache.wicket.model.IModel;
 +import org.apache.wicket.model.StringResourceModel;
 +
 +public class ProvisioningModalPage<T extends AnyTO> extends AbstractStatusModalPage {
 +
 +    private static final long serialVersionUID = -4285220460543213901L;
 +
 +    private static final int ROWS_PER_PAGE = 10;
 +
 +    private final ResourceTO resourceTO;
 +
 +    private final AnyTypeKind anyTypeKind;
 +
 +    private final PageReference pageRef;
 +
 +    private final ModalWindow window;
 +
 +    private final StatusUtils statusUtils;
 +
 +    private final String realm = "/";
 +
 +    public ProvisioningModalPage(
 +            final PageReference pageRef,
 +            final ModalWindow window,
 +            final ResourceTO resourceTO,
 +            final AnyTypeKind anyTypeKind) {
 +
 +        super();
 +
 +        this.pageRef = pageRef;
 +        this.window = window;
 +        this.resourceTO = resourceTO;
 +        this.anyTypeKind = anyTypeKind;
 +
 +        statusUtils = new StatusUtils(anyTypeKind == AnyTypeKind.USER ? userRestClient : groupRestClient);
 +
 +        add(new Label("displayName", StringUtils.EMPTY));
 +
 +        final List<IColumn<StatusBean, String>> columns = new ArrayList<>();
 +        columns.add(new PropertyColumn<StatusBean, String>(
 +                new StringResourceModel("key", this).setDefaultValue("Attributable key"),
 +                "attributableKey", "attributableKey"));
 +        columns.add(new PropertyColumn<StatusBean, String>(
 +                new StringResourceModel("name", this).setDefaultValue("Attributable name"),
 +                "attributableName", "attributableName"));
 +        columns.add(new PropertyColumn<StatusBean, String>(
 +                new StringResourceModel("resourceName", this).setDefaultValue("Resource name"),
 +                "resourceName", "resourceName"));
 +        columns.add(new PropertyColumn<StatusBean, String>(
 +                new StringResourceModel("connObjectLink", this).setDefaultValue("ConnObjectLink"),
 +                "connObjectLink", "connObjectLink"));
 +        columns.add(new AbstractColumn<StatusBean, String>(
 +                new StringResourceModel("status", this).setDefaultValue(StringUtils.EMPTY)) {
 +
 +                    private static final long serialVersionUID = -3503023501954863131L;
 +
 +                    @Override
 +                    public String getCssClass() {
 +                        return "action";
 +                    }
 +
 +                    @Override
 +                    public void populateItem(
 +                            final Item<ICellPopulator<StatusBean>> cellItem,
 +                            final String componentId,
 +                            final IModel<StatusBean> model) {
 +                                cellItem.
 +                                add(statusUtils.getStatusImagePanel(componentId, model.getObject().getStatus()));
 +                            }
 +                });
 +
 +        final ActionDataTablePanel<StatusBean, String> table = new ActionDataTablePanel<>(
 +                "resourceDatatable",
 +                columns,
 +                (ISortableDataProvider<StatusBean, String>) new StatusBeanProvider(),
 +                ROWS_PER_PAGE,
 +                pageRef);
 +
 +        final String pageId = "Resources";
 +
 +        table.addAction(new ActionLink<Serializable>() {
 +
 +            private static final long serialVersionUID = -3722207913631435501L;
 +
 +            @Override
 +            public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
 +                try {
 +                    bulkAssociationAction(target, ResourceDeassociationAction.UNLINK, table, columns);
 +                } catch (Exception e) {
 +                    LOG.error("Error unlinkink resources", e);
 +                    error(getString(Constants.ERROR) + ": " + e.getMessage());
 +                    feedbackPanel.refresh(target);
 +                }
 +            }
 +        }, ActionLink.ActionType.UNLINK, pageId);
 +
 +        table.addAction(new ActionLink<Serializable>() {
 +
 +            private static final long serialVersionUID = -3722207913631435501L;
 +
 +            @Override
 +            public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
 +                try {
 +                    bulkAssociationAction(target, ResourceDeassociationAction.DEPROVISION, table, columns);
 +                } catch (Exception e) {
 +                    LOG.error("Error de-provisioning user", e);
 +                    error(getString(Constants.ERROR) + ": " + e.getMessage());
 +                    feedbackPanel.refresh(target);
 +                }
 +            }
 +        }, ActionLink.ActionType.DEPROVISION, pageId);
 +
 +        table.addAction(new ActionLink<Serializable>() {
 +
 +            private static final long serialVersionUID = -3722207913631435501L;
 +
 +            @Override
 +            public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
 +                try {
 +                    bulkAssociationAction(target, ResourceDeassociationAction.UNASSIGN, table, columns);
 +                } catch (Exception e) {
 +                    LOG.error("Error unassigning resources", e);
 +                    error(getString(Constants.ERROR) + ": " + e.getMessage());
 +                    feedbackPanel.refresh(target);
 +                }
 +            }
 +        }, ActionLink.ActionType.UNASSIGN, pageId);
 +
 +        table.addCancelButton(window);
 +
 +        add(table);
 +    }
 +
 +    private class StatusBeanProvider extends AbstractStatusBeanProvider {
 +
 +        private static final long serialVersionUID = 4287357360778016173L;
 +
-         public StatusBeanProvider() {
++        StatusBeanProvider() {
 +            super("accountLink");
 +        }
 +
 +        @SuppressWarnings("unchecked")
 +        @Override
 +        public List<StatusBean> getStatusBeans() {
 +            final String fiql = SyncopeClient.getUserSearchConditionBuilder().hasResources(resourceTO.getKey()).query();
 +
 +            final List<T> subjects = new ArrayList<>();
 +            if (anyTypeKind == AnyTypeKind.USER) {
 +                subjects.addAll((List<T>) userRestClient.search(
 +                        realm, fiql, 1, ROWS_PER_PAGE, new SortParam<>("key", true), AnyTypeKind.USER.toString()));
 +            } else {
 +                subjects.addAll((List<T>) groupRestClient.search(
 +                        realm, fiql, 1, ROWS_PER_PAGE, new SortParam<>("key", true), AnyTypeKind.GROUP.toString()));
 +            }
 +
 +            final List<ConnObjectWrapper> connObjects = statusUtils.getConnectorObjects(
 +                    (List<AnyTO>) subjects, Collections.<String>singleton(resourceTO.getKey()));
 +
 +            final List<StatusBean> statusBeans = new ArrayList<>(connObjects.size() + 1);
 +            final LinkedHashMap<String, StatusBean> initialStatusBeanMap = new LinkedHashMap<>(connObjects.size());
 +
 +            for (ConnObjectWrapper entry : connObjects) {
 +                StatusBean statusBean = statusUtils.getStatusBean(entry.getAny(),
 +                        entry.getResourceName(),
 +                        entry.getConnObjectTO(),
 +                        anyTypeKind == AnyTypeKind.GROUP);
 +
 +                initialStatusBeanMap.put(entry.getResourceName(), statusBean);
 +                statusBeans.add(statusBean);
 +            }
 +
 +            return statusBeans;
 +        }
 +    }
 +
 +    private void bulkAssociationAction(
 +            final AjaxRequestTarget target,
 +            final ResourceDeassociationAction type,
 +            final ActionDataTablePanel<StatusBean, String> table,
 +            final List<IColumn<StatusBean, String>> columns) {
 +
 +        final List<StatusBean> beans = new ArrayList<>(table.getModelObject());
 +        List<AnyKey> subjectKeys = new ArrayList<>();
 +        for (StatusBean bean : beans) {
 +            LOG.debug("Selected bean {}", bean);
 +            subjectKeys.add(AbstractWrappable.getInstance(AnyKey.class, bean.getAnyKey()));
 +        }
 +
 +        if (beans.isEmpty()) {
 +            window.close(target);
 +        } else {
 +            final BulkActionResult res = resourceRestClient.bulkAssociationAction(
 +                    resourceTO.getKey(), anyTypeKind.name(), type, subjectKeys);
 +
 +            ((BasePage) pageRef.getPage()).setModalResult(true);
 +
 +            setResponsePage(new BulkActionResultModalPage<>(window, beans, columns, res, "anyKey"));
 +        }
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/console/src/main/java/org/apache/syncope/client/console/pages/StatusModalPage.java
----------------------------------------------------------------------
diff --cc client/console/src/main/java/org/apache/syncope/client/console/pages/StatusModalPage.java
index 1357cad,0000000..238f13d
mode 100644,000000..100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/pages/StatusModalPage.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/pages/StatusModalPage.java
@@@ -1,642 -1,0 +1,642 @@@
 +/*
 + * 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.client.console.pages;
 +
 +import java.io.Serializable;
 +import java.util.ArrayList;
 +import java.util.Collection;
 +import java.util.Collections;
 +import java.util.List;
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.syncope.client.console.commons.Constants;
 +import org.apache.syncope.client.console.commons.status.AbstractStatusBeanProvider;
 +import org.apache.syncope.client.console.commons.status.ConnObjectWrapper;
 +import org.apache.syncope.client.console.commons.status.Status;
 +import org.apache.syncope.client.console.commons.status.StatusBean;
 +import org.apache.syncope.client.console.commons.status.StatusUtils;
 +import org.apache.syncope.client.console.panels.ActionDataTablePanel;
 +import org.apache.syncope.client.console.wicket.ajax.markup.html.ClearIndicatingAjaxButton;
 +import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
 +import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
 +import org.apache.syncope.common.lib.to.AnyTO;
 +import org.apache.syncope.common.lib.to.BulkActionResult;
 +import org.apache.syncope.common.lib.to.ResourceTO;
 +import org.apache.syncope.common.lib.to.GroupTO;
 +import org.apache.syncope.common.lib.to.UserTO;
 +import org.apache.syncope.common.lib.types.ResourceAssociationAction;
 +import org.apache.wicket.PageReference;
 +import org.apache.wicket.ajax.AjaxRequestTarget;
 +import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
 +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 +import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
 +import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
 +import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
 +import org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider;
 +import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
 +import org.apache.wicket.markup.ComponentTag;
 +import org.apache.wicket.markup.html.WebMarkupContainer;
 +import org.apache.wicket.markup.html.basic.Label;
 +import org.apache.wicket.markup.html.form.Form;
 +import org.apache.wicket.markup.html.form.PasswordTextField;
 +import org.apache.wicket.markup.html.panel.Fragment;
 +import org.apache.wicket.markup.repeater.Item;
 +import org.apache.wicket.model.IModel;
 +import org.apache.wicket.model.Model;
 +import org.apache.wicket.model.ResourceModel;
 +import org.apache.wicket.model.StringResourceModel;
 +
 +public class StatusModalPage<T extends AnyTO> extends AbstractStatusModalPage {
 +
 +    private static final long serialVersionUID = -9148734710505211261L;
 +
 +    private final AnyTO anyTO;
 +
 +    private int rowsPerPage = 10;
 +
 +    private final StatusUtils statusUtils;
 +
 +    private final boolean statusOnly;
 +
 +    // --------------------------------
 +    // password management fields ..
 +    // --------------------------------
 +    private final ClearIndicatingAjaxButton cancel;
 +
 +    private final WebMarkupContainer pwdMgt;
 +
 +    private final Form<?> pwdMgtForm;
 +
 +    private final AjaxCheckBoxPanel changepwd;
 +
 +    private final PasswordTextField password;
 +
 +    private final PasswordTextField confirm;
 +    // --------------------------------
 +
 +    private final PageReference pageRef;
 +
 +    private final ModalWindow window;
 +
 +    private final ActionDataTablePanel<StatusBean, String> table;
 +
 +    private final List<IColumn<StatusBean, String>> columns;
 +
 +    public StatusModalPage(
 +            final PageReference pageRef,
 +            final ModalWindow window,
 +            final AnyTO attributableTO) {
 +
 +        this(pageRef, window, attributableTO, false);
 +    }
 +
 +    public StatusModalPage(
 +            final PageReference pageRef,
 +            final ModalWindow window,
 +            final AnyTO anyTO,
 +            final boolean statusOnly) {
 +
 +        super();
 +
 +        this.pageRef = pageRef;
 +        this.window = window;
 +        this.statusOnly = statusOnly;
 +        this.anyTO = anyTO;
 +
 +        statusUtils = new StatusUtils(anyTO instanceof UserTO ? userRestClient : groupRestClient);
 +
 +        add(new Label("displayName", anyTO.getKey() + " "
 +                + (anyTO instanceof UserTO ? ((UserTO) anyTO).getUsername() : ((GroupTO) anyTO).getName())));
 +
 +        columns = new ArrayList<>();
 +        columns.add(new AbstractColumn<StatusBean, String>(
 +                new StringResourceModel("resourceName", this, null), "resourceName") {
 +
 +                    private static final long serialVersionUID = 2054811145491901166L;
 +
 +                    @Override
 +                    public void populateItem(
 +                            final Item<ICellPopulator<StatusBean>> cellItem,
 +                            final String componentId,
 +                            final IModel<StatusBean> model) {
 +
 +                                cellItem.add(new Label(componentId, model.getObject().getResourceName()) {
 +
 +                                    private static final long serialVersionUID = 8432079838783825801L;
 +
 +                                    @Override
 +                                    protected void onComponentTag(final ComponentTag tag) {
 +                                        if (model.getObject().isLinked()) {
 +                                            super.onComponentTag(tag);
 +                                        } else {
 +                                            tag.put("style", "color: #DDDDDD");
 +                                        }
 +                                    }
 +                                });
 +                            }
 +                });
 +
 +        columns.add(new PropertyColumn<StatusBean, String>(
 +                new StringResourceModel("accountLink", this, null), "accountLink", "accountLink"));
 +
 +        columns.add(new AbstractColumn<StatusBean, String>(
 +                new StringResourceModel("status", this, null)) {
 +
 +                    private static final long serialVersionUID = -3503023501954863131L;
 +
 +                    @Override
 +                    public String getCssClass() {
 +                        return "action";
 +                    }
 +
 +                    @Override
 +                    public void populateItem(
 +                            final Item<ICellPopulator<StatusBean>> cellItem,
 +                            final String componentId,
 +                            final IModel<StatusBean> model) {
 +
 +                                if (model.getObject().isLinked()) {
 +                                    cellItem.add(statusUtils.getStatusImagePanel(componentId, model.getObject().
 +                                                    getStatus()));
 +                                } else {
 +                                    cellItem.add(new Label(componentId, ""));
 +                                }
 +                            }
 +                });
 +
 +        table = new ActionDataTablePanel<StatusBean, String>(
 +                "resourceDatatable",
 +                columns,
 +                (ISortableDataProvider<StatusBean, String>) new AttributableStatusProvider(),
 +                rowsPerPage,
 +                pageRef) {
 +
 +                    private static final long serialVersionUID = 6510391461033818316L;
 +
 +                    @Override
 +                    public boolean isElementEnabled(final StatusBean element) {
 +                        return !statusOnly || element.getStatus() != Status.OBJECT_NOT_FOUND;
 +                    }
 +                };
 +        table.setOutputMarkupId(true);
 +
 +        final String pageId = anyTO instanceof GroupTO ? "Groups" : "Users";
 +
 +        final Fragment pwdMgtFragment = new Fragment("pwdMgtFields", "pwdMgtFragment", this);
 +        addOrReplace(pwdMgtFragment);
 +
 +        pwdMgt = new WebMarkupContainer("pwdMgt");
 +        pwdMgtFragment.add(pwdMgt.setOutputMarkupId(true));
 +
 +        pwdMgtForm = new Form("pwdMgtForm");
 +        pwdMgtForm.setVisible(false).setEnabled(false);
 +        pwdMgt.add(pwdMgtForm);
 +
 +        password = new PasswordTextField("password", new Model<String>());
 +        pwdMgtForm.add(password.setRequired(false).setEnabled(false));
 +
 +        confirm = new PasswordTextField("confirm", new Model<String>());
 +        pwdMgtForm.add(confirm.setRequired(false).setEnabled(false));
 +
 +        changepwd = new AjaxCheckBoxPanel("changepwd", "changepwd", new Model<Boolean>(false));
 +        pwdMgtForm.add(changepwd.setModelObject(false));
 +        pwdMgtForm.add(new Label("changePwdLabel", new ResourceModel("changePwdLabel", "Password propagation")));
 +
 +        changepwd.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
 +
 +            private static final long serialVersionUID = -1107858522700306810L;
 +
 +            @Override
 +            protected void onUpdate(final AjaxRequestTarget target) {
 +                password.setEnabled(changepwd.getModelObject());
 +                confirm.setEnabled(changepwd.getModelObject());
 +                target.add(pwdMgt);
 +            }
 +        });
 +
 +        cancel = new ClearIndicatingAjaxButton("cancel", new ResourceModel("cancel"), pageRef) {
 +
 +            private static final long serialVersionUID = -2341391430136818026L;
 +
 +            @Override
 +            protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
 +                // ignore
 +                window.close(target);
 +            }
 +        }.feedbackPanelAutomaticReload(false);
 +
 +        pwdMgtForm.add(cancel);
 +
 +        final ClearIndicatingAjaxButton goon =
 +                new ClearIndicatingAjaxButton("continue", new ResourceModel("continue"), pageRef) {
 +
 +                    private static final long serialVersionUID = -2341391430136818027L;
 +
 +                    @Override
 +                    protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
 +                        // none
 +                    }
 +                };
 +
 +        pwdMgtForm.add(goon);
 +
 +        if (statusOnly) {
 +            table.addAction(new ActionLink<Serializable>() {
 +
 +                private static final long serialVersionUID = -3722207913631435501L;
 +
 +                @Override
 +                public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
 +                    try {
 +                        userRestClient.reactivate(
 +                                anyTO.getETagValue(),
 +                                anyTO.getKey(),
 +                                new ArrayList<>(table.getModelObject()));
 +
 +                        ((BasePage) pageRef.getPage()).setModalResult(true);
 +
 +                        window.close(target);
 +                    } catch (Exception e) {
 +                        LOG.error("Error enabling resources", e);
 +                        error(getString(Constants.ERROR) + ": " + e.getMessage());
 +                        feedbackPanel.refresh(target);
 +                    }
 +                }
 +            }, ActionLink.ActionType.REACTIVATE, pageId);
 +
 +            table.addAction(new ActionLink<Serializable>() {
 +
 +                private static final long serialVersionUID = -3722207913631435501L;
 +
 +                @Override
 +                public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
 +                    try {
 +                        userRestClient.suspend(
 +                                anyTO.getETagValue(),
 +                                anyTO.getKey(),
 +                                new ArrayList<>(table.getModelObject()));
 +
 +                        if (pageRef.getPage() instanceof BasePage) {
 +                            ((BasePage) pageRef.getPage()).setModalResult(true);
 +                        }
 +
 +                        window.close(target);
 +                    } catch (Exception e) {
 +                        LOG.error("Error disabling resources", e);
 +                        error(getString(Constants.ERROR) + ": " + e.getMessage());
 +                        feedbackPanel.refresh(target);
 +                    }
 +                }
 +            }, ActionLink.ActionType.SUSPEND, pageId);
 +        } else {
 +            table.addAction(new ActionLink<Serializable>() {
 +
 +                private static final long serialVersionUID = -3722207913631435501L;
 +
 +                @Override
 +                public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
 +                    try {
 +                        if (anyTO instanceof UserTO) {
 +                            userRestClient.unlink(
 +                                    anyTO.getETagValue(),
 +                                    anyTO.getKey(),
 +                                    new ArrayList<>(table.getModelObject()));
 +                        } else {
 +                            groupRestClient.unlink(
 +                                    anyTO.getETagValue(),
 +                                    anyTO.getKey(),
 +                                    new ArrayList<>(table.getModelObject()));
 +                        }
 +
 +                        ((BasePage) pageRef.getPage()).setModalResult(true);
 +                        window.close(target);
 +                    } catch (Exception e) {
 +                        LOG.error("Error unlinking resources", e);
 +                        error(getString(Constants.ERROR) + ": " + e.getMessage());
 +                        feedbackPanel.refresh(target);
 +                    }
 +                }
 +            }, ActionLink.ActionType.UNLINK, pageId);
 +
 +            table.addAction(new ActionLink<Serializable>() {
 +
 +                private static final long serialVersionUID = -3722207913631435501L;
 +
 +                @Override
 +                public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
 +                    try {
 +                        if (anyTO instanceof UserTO) {
 +                            userRestClient.link(
 +                                    anyTO.getETagValue(),
 +                                    anyTO.getKey(),
 +                                    new ArrayList<>(table.getModelObject()));
 +                        } else {
 +                            groupRestClient.link(
 +                                    anyTO.getETagValue(),
 +                                    anyTO.getKey(),
 +                                    new ArrayList<>(table.getModelObject()));
 +                        }
 +
 +                        ((BasePage) pageRef.getPage()).setModalResult(true);
 +                        window.close(target);
 +                    } catch (Exception e) {
 +                        LOG.error("Error linking resources", e);
 +                        error(getString(Constants.ERROR) + ": " + e.getMessage());
 +                        feedbackPanel.refresh(target);
 +                    }
 +                }
 +            }, ActionLink.ActionType.LINK, pageId);
 +
 +            table.addAction(new ActionLink<Serializable>() {
 +
 +                private static final long serialVersionUID = -3722207913631435501L;
 +
 +                @Override
 +                public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
 +                    try {
 +                        BulkActionResult bulkActionResult;
 +                        if (anyTO instanceof UserTO) {
 +                            bulkActionResult = userRestClient.deprovision(
 +                                    anyTO.getETagValue(),
 +                                    anyTO.getKey(),
 +                                    new ArrayList<>(table.getModelObject()));
 +                        } else {
 +                            bulkActionResult = groupRestClient.deprovision(
 +                                    anyTO.getETagValue(),
 +                                    anyTO.getKey(),
 +                                    new ArrayList<>(table.getModelObject()));
 +                        }
 +
 +                        ((BasePage) pageRef.getPage()).setModalResult(true);
 +                        loadBulkActionResultPage(table.getModelObject(), bulkActionResult);
 +                    } catch (Exception e) {
 +                        LOG.error("Error de-provisioning user", e);
 +                        error(getString(Constants.ERROR) + ": " + e.getMessage());
 +                        feedbackPanel.refresh(target);
 +                    }
 +                }
 +            }, ActionLink.ActionType.DEPROVISION, pageId);
 +
 +            table.addAction(new ActionLink<Serializable>() {
 +
 +                private static final long serialVersionUID = -3722207913631435501L;
 +
 +                @Override
 +                public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
 +
 +                    if (anyTO instanceof UserTO) {
 +                        StatusModalPage.this.passwordManagement(
 +                                target, ResourceAssociationAction.PROVISION, table.getModelObject());
 +                    } else {
 +                        try {
 +                            final BulkActionResult bulkActionResult = groupRestClient.provision(
 +                                    anyTO.getETagValue(),
 +                                    anyTO.getKey(),
 +                                    new ArrayList<>(table.getModelObject()));
 +
 +                            ((BasePage) pageRef.getPage()).setModalResult(true);
 +                            loadBulkActionResultPage(table.getModelObject(), bulkActionResult);
 +                        } catch (Exception e) {
 +                            LOG.error("Error provisioning user", e);
 +                            error(getString(Constants.ERROR) + ": " + e.getMessage());
 +                            feedbackPanel.refresh(target);
 +                        }
 +                    }
 +                }
 +            }.feedbackPanelAutomaticReload(!(anyTO instanceof UserTO)), ActionLink.ActionType.PROVISION, pageId);
 +
 +            table.addAction(new ActionLink<Serializable>() {
 +
 +                private static final long serialVersionUID = -3722207913631435501L;
 +
 +                @Override
 +                public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
 +                    try {
 +                        final BulkActionResult bulkActionResult;
 +                        if (anyTO instanceof UserTO) {
 +                            bulkActionResult = userRestClient.unassign(
 +                                    anyTO.getETagValue(),
 +                                    anyTO.getKey(),
 +                                    new ArrayList<>(table.getModelObject()));
 +                        } else {
 +                            bulkActionResult = groupRestClient.unassign(
 +                                    anyTO.getETagValue(),
 +                                    anyTO.getKey(),
 +                                    new ArrayList<>(table.getModelObject()));
 +                        }
 +
 +                        ((BasePage) pageRef.getPage()).setModalResult(true);
 +                        loadBulkActionResultPage(table.getModelObject(), bulkActionResult);
 +                    } catch (Exception e) {
 +                        LOG.error("Error unassigning resources", e);
 +                        error(getString(Constants.ERROR) + ": " + e.getMessage());
 +                        feedbackPanel.refresh(target);
 +                    }
 +                }
 +            }, ActionLink.ActionType.UNASSIGN, pageId);
 +
 +            table.addAction(new ActionLink<Serializable>() {
 +
 +                private static final long serialVersionUID = -3722207913631435501L;
 +
 +                @Override
 +                public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
 +                    if (anyTO instanceof UserTO) {
 +                        StatusModalPage.this.passwordManagement(
 +                                target, ResourceAssociationAction.ASSIGN, table.getModelObject());
 +                    } else {
 +                        try {
 +                            final BulkActionResult bulkActionResult = groupRestClient.assign(
 +                                    anyTO.getETagValue(),
 +                                    anyTO.getKey(),
 +                                    new ArrayList<>(table.getModelObject()));
 +
 +                            ((BasePage) pageRef.getPage()).setModalResult(true);
 +                            loadBulkActionResultPage(table.getModelObject(), bulkActionResult);
 +                        } catch (Exception e) {
 +                            LOG.error("Error assigning resources", e);
 +                            error(getString(Constants.ERROR) + ": " + e.getMessage());
 +                            feedbackPanel.refresh(target);
 +                        }
 +                    }
 +                }
 +            }.feedbackPanelAutomaticReload(!(anyTO instanceof UserTO)), ActionLink.ActionType.ASSIGN, pageId);
 +        }
 +
 +        table.addCancelButton(window);
 +        add(table);
 +    }
 +
 +    private class AttributableStatusProvider extends AbstractStatusBeanProvider {
 +
 +        private static final long serialVersionUID = 4586969457669796621L;
 +
-         public AttributableStatusProvider() {
++        AttributableStatusProvider() {
 +            super(statusOnly ? "resourceName" : "accountLink");
 +        }
 +
 +        @SuppressWarnings("unchecked")
 +        @Override
 +        public List<StatusBean> getStatusBeans() {
 +            final List<String> resources = new ArrayList<>();
 +            for (ResourceTO resourceTO : resourceRestClient.getAll()) {
 +                resources.add(resourceTO.getKey());
 +            }
 +
 +            final List<ConnObjectWrapper> connObjects = statusUtils.getConnectorObjects(anyTO);
 +
 +            final List<StatusBean> statusBeans = new ArrayList<StatusBean>(connObjects.size() + 1);
 +
 +            for (ConnObjectWrapper entry : connObjects) {
 +                final StatusBean statusBean = statusUtils.getStatusBean(anyTO,
 +                        entry.getResourceName(),
 +                        entry.getConnObjectTO(),
 +                        anyTO instanceof GroupTO);
 +
 +                statusBeans.add(statusBean);
 +                resources.remove(entry.getResourceName());
 +            }
 +
 +            if (statusOnly) {
 +                final StatusBean syncope = new StatusBean(anyTO, "Syncope");
 +
 +                syncope.setConnObjectLink(((UserTO) anyTO).getUsername());
 +
 +                Status syncopeStatus = Status.UNDEFINED;
 +                if (((UserTO) anyTO).getStatus() != null) {
 +                    try {
 +                        syncopeStatus = Status.valueOf(((UserTO) anyTO).getStatus().toUpperCase());
 +                    } catch (IllegalArgumentException e) {
 +                        LOG.warn("Unexpected status found: {}", ((UserTO) anyTO).getStatus(), e);
 +                    }
 +                }
 +                syncope.setStatus(syncopeStatus);
 +
 +                statusBeans.add(syncope);
 +            } else {
 +                for (String resource : resources) {
 +                    final StatusBean statusBean = statusUtils.getStatusBean(anyTO,
 +                            resource,
 +                            null,
 +                            anyTO instanceof GroupTO);
 +
 +                    statusBean.setLinked(false);
 +                    statusBeans.add(statusBean);
 +                }
 +            }
 +
 +            return statusBeans;
 +        }
 +    }
 +
 +    private void passwordManagement(
 +            final AjaxRequestTarget target,
 +            final ResourceAssociationAction type,
 +            final Collection<StatusBean> selection) {
 +
 +        final ClearIndicatingAjaxButton goon =
 +                new ClearIndicatingAjaxButton("continue", new ResourceModel("continue", "Continue"), pageRef) {
 +
 +                    private static final long serialVersionUID = -2341391430136818027L;
 +
 +                    @Override
 +                    protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
 +                        try {
 +                            if (StringUtils.isNotBlank(password.getModelObject())
 +                            && !password.getModelObject().equals(confirm.getModelObject())) {
 +                                throw new Exception(getString("passwordMismatch"));
 +                            }
 +
 +                            final BulkActionResult bulkActionResult;
 +                            switch (type) {
 +//                                case ASSIGN:
 +//                                    bulkActionResult = userRestClient.assign(
 +//                                            anyTO.getETagValue(),
 +//                                            anyTO.getKey(),
 +//                                            new ArrayList<>(selection),
 +//                                            changepwd.getModelObject(),
 +//                                            password.getModelObject());
 +//                                    break;
 +//                                case PROVISION:
 +//                                    bulkActionResult = userRestClient.provision(
 +//                                            anyTO.getETagValue(),
 +//                                            anyTO.getKey(),
 +//                                            new ArrayList<>(selection),
 +//                                            changepwd.getModelObject(),
 +//                                            password.getModelObject());
 +//                                    break;
 +                                default:
 +                                    bulkActionResult = null;
 +                                // ignore
 +                            }
 +
 +                            ((BasePage) pageRef.getPage()).setModalResult(true);
 +
 +                            if (bulkActionResult != null) {
 +                                loadBulkActionResultPage(selection, bulkActionResult);
 +                            } else {
 +
 +                                target.add(((BasePage) pageRef.getPage()).getFeedbackPanel());
 +                                window.close(target);
 +                            }
 +                        } catch (Exception e) {
 +                            LOG.error("Error provisioning resources", e);
 +                            error(getString(Constants.ERROR) + ": " + e.getMessage());
 +                            feedbackPanel.refresh(target);
 +                        }
 +                    }
 +                }.feedbackPanelAutomaticReload(false);
 +
 +        pwdMgtForm.addOrReplace(goon);
 +
 +        table.setVisible(false);
 +        pwdMgtForm.setVisible(true).setEnabled(true);
 +
 +        target.add(table);
 +        target.add(pwdMgt);
 +    }
 +
 +    private void loadBulkActionResultPage(
 +            final Collection<StatusBean> selection, final BulkActionResult bulkActionResult) {
 +        final List<String> resources = new ArrayList<String>(selection.size());
 +        for (StatusBean statusBean : selection) {
 +            resources.add(statusBean.getResourceName());
 +        }
 +
 +        final List<ConnObjectWrapper> connObjects =
 +                statusUtils.getConnectorObjects(Collections.singletonList(anyTO), resources);
 +
 +        final List<StatusBean> statusBeans = new ArrayList<StatusBean>(connObjects.size());
 +
 +        for (ConnObjectWrapper entry : connObjects) {
 +            final StatusBean statusBean = statusUtils.getStatusBean(anyTO,
 +                    entry.getResourceName(),
 +                    entry.getConnObjectTO(),
 +                    anyTO instanceof GroupTO);
 +
 +            statusBeans.add(statusBean);
 +        }
 +
 +        setResponsePage(new BulkActionResultModalPage<StatusBean, String>(
 +                window,
 +                statusBeans,
 +                columns,
 +                bulkActionResult,
 +                "resourceName"));
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceSecurityPanel.java
----------------------------------------------------------------------
diff --cc client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceSecurityPanel.java
index a0a1ddc,0000000..89b856a
mode 100644,000000..100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceSecurityPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/ResourceSecurityPanel.java
@@@ -1,186 -1,0 +1,186 @@@
 +/*
 + * 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.client.console.panels;
 +
 +import java.util.ArrayList;
 +import java.util.HashMap;
 +import java.util.Map;
 +import org.apache.syncope.client.console.rest.PolicyRestClient;
 +import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
 +import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
 +import org.apache.syncope.common.lib.to.ResourceTO;
 +import org.apache.syncope.common.lib.types.PolicyType;
 +import org.apache.wicket.markup.html.WebMarkupContainer;
 +import org.apache.wicket.markup.html.form.ChoiceRenderer;
 +import org.apache.wicket.markup.html.form.DropDownChoice;
 +import org.apache.wicket.markup.html.panel.Panel;
 +import org.apache.wicket.model.IModel;
 +import org.apache.wicket.model.LoadableDetachableModel;
 +import org.apache.wicket.model.PropertyModel;
 +import org.apache.wicket.model.ResourceModel;
 +import org.apache.wicket.spring.injection.annot.SpringBean;
 +
 +public class ResourceSecurityPanel extends Panel {
 +
 +    private static final long serialVersionUID = -7982691107029848579L;
 +
 +    @SpringBean
 +    private PolicyRestClient policyRestClient;
 +
 +    private IModel<Map<Long, String>> passwordPolicies = null;
 +
 +    private IModel<Map<Long, String>> accountPolicies = null;
 +
 +    private IModel<Map<Long, String>> syncPolicies = null;
 +
 +    public ResourceSecurityPanel(final String id, final ResourceTO resourceTO) {
 +
 +        super(id);
 +
 +        setOutputMarkupId(true);
 +
 +        passwordPolicies = new LoadableDetachableModel<Map<Long, String>>() {
 +
 +            private static final long serialVersionUID = 5275935387613157437L;
 +
 +            @Override
 +            protected Map<Long, String> load() {
 +                Map<Long, String> res = new HashMap<>();
 +                for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.PASSWORD)) {
 +                    res.put(policyTO.getKey(), policyTO.getDescription());
 +                }
 +                return res;
 +            }
 +        };
 +
 +        accountPolicies = new LoadableDetachableModel<Map<Long, String>>() {
 +
 +            private static final long serialVersionUID = -2012833443695917883L;
 +
 +            @Override
 +            protected Map<Long, String> load() {
 +                Map<Long, String> res = new HashMap<>();
 +                for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.ACCOUNT)) {
 +                    res.put(policyTO.getKey(), policyTO.getDescription());
 +                }
 +                return res;
 +            }
 +        };
 +
 +        syncPolicies = new LoadableDetachableModel<Map<Long, String>>() {
 +
 +            private static final long serialVersionUID = -2012833443695917883L;
 +
 +            @Override
 +            protected Map<Long, String> load() {
 +                Map<Long, String> res = new HashMap<>();
 +                for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.SYNC)) {
 +                    res.put(policyTO.getKey(), policyTO.getDescription());
 +                }
 +                return res;
 +            }
 +        };
 +
 +        final WebMarkupContainer securityContainer = new WebMarkupContainer("security");
 +
 +        securityContainer.setOutputMarkupId(true);
 +        add(securityContainer);
 +
 +        // -------------------------------
 +        // Password policy specification
 +        // -------------------------------
 +        final AjaxDropDownChoicePanel<Long> passwordPolicy = new AjaxDropDownChoicePanel<Long>("passwordPolicy",
 +                new ResourceModel("passwordPolicy", "passwordPolicy").getObject(), new PropertyModel<Long>(resourceTO,
 +                        "passwordPolicy"));
 +
 +        passwordPolicy.setChoiceRenderer(new PolicyRenderer(PolicyType.PASSWORD));
 +
 +        passwordPolicy.setChoices(new ArrayList<>(passwordPolicies.getObject().keySet()));
 +
 +        ((DropDownChoice<?>) passwordPolicy.getField()).setNullValid(true);
 +
 +        securityContainer.add(passwordPolicy);
 +        // -------------------------------
 +
 +        // -------------------------------
 +        // Account policy specification
 +        // -------------------------------
 +        final AjaxDropDownChoicePanel<Long> accountPolicy = new AjaxDropDownChoicePanel<Long>("accountPolicy",
 +                new ResourceModel("accountPolicy", "accountPolicy").getObject(), new PropertyModel<Long>(resourceTO,
 +                        "accountPolicy"));
 +
 +        accountPolicy.setChoiceRenderer(new PolicyRenderer(PolicyType.ACCOUNT));
 +
 +        accountPolicy.setChoices(new ArrayList<Long>(accountPolicies.getObject().keySet()));
 +
 +        ((DropDownChoice<?>) accountPolicy.getField()).setNullValid(true);
 +
 +        securityContainer.add(accountPolicy);
 +        // -------------------------------
 +
 +        // -------------------------------
 +        // Sync policy specification
 +        // -------------------------------
 +        final AjaxDropDownChoicePanel<Long> syncPolicy = new AjaxDropDownChoicePanel<Long>("syncPolicy",
 +                new ResourceModel("syncPolicy", "syncPolicy").getObject(), new PropertyModel<Long>(resourceTO,
 +                        "syncPolicy"));
 +
 +        syncPolicy.setChoiceRenderer(new PolicyRenderer(PolicyType.SYNC));
 +
 +        syncPolicy.setChoices(new ArrayList<Long>(syncPolicies.getObject().keySet()));
 +
 +        ((DropDownChoice<?>) syncPolicy.getField()).setNullValid(true);
 +
 +        securityContainer.add(syncPolicy);
 +        // -------------------------------
 +    }
 +
 +    private class PolicyRenderer extends ChoiceRenderer<Long> {
 +
 +        private static final long serialVersionUID = 8060500161321947000L;
 +
 +        private PolicyType type;
 +
-         public PolicyRenderer(final PolicyType type) {
++        PolicyRenderer(final PolicyType type) {
 +            super();
 +            this.type = type;
 +        }
 +
 +        @Override
 +        public Object getDisplayValue(final Long object) {
 +            switch (type) {
 +                case ACCOUNT:
 +                    return accountPolicies.getObject().get(object);
 +                case PASSWORD:
 +                    return passwordPolicies.getObject().get(object);
 +                case SYNC:
 +                    return syncPolicies.getObject().get(object);
 +                default:
 +                    return "";
 +            }
 +        }
 +
 +        @Override
 +        public String getIdValue(final Long object, final int index) {
 +            return String.valueOf(object != null
 +                    ? object
 +                    : 0L);
 +        }
 +    };
 +}


[4/8] syncope git commit: Upgrading surefire, failsafe and checkstyle plugins

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java
----------------------------------------------------------------------
diff --cc client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java
index 409a16b,0000000..24cd09d
mode 100644,000000..100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/topology/Topology.java
@@@ -1,570 -1,0 +1,570 @@@
 +/*
 + * 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.client.console.topology;
 +
 +import java.io.Serializable;
 +import java.net.URI;
 +import java.util.ArrayList;
 +import java.util.HashMap;
 +import java.util.List;
 +import java.util.Locale;
 +import java.util.Map;
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.commons.lang3.tuple.Pair;
 +import org.apache.cxf.jaxrs.client.WebClient;
 +import org.apache.syncope.client.console.SyncopeConsoleSession;
 +import org.apache.syncope.client.console.pages.BasePage;
 +import org.apache.syncope.client.console.panels.AbstractResourceModal.CreateEvent;
 +import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink;
 +import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel;
 +import org.apache.syncope.common.lib.to.ConnInstanceTO;
 +import org.apache.syncope.common.lib.to.ResourceTO;
 +import org.apache.syncope.common.lib.types.Entitlement;
 +import org.apache.syncope.common.rest.api.service.SyncopeService;
 +import org.apache.wicket.Component;
 +import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
 +import org.apache.wicket.ajax.AjaxRequestTarget;
 +import org.apache.wicket.ajax.IAjaxIndicatorAware;
 +import org.apache.wicket.behavior.Behavior;
 +import org.apache.wicket.event.IEvent;
 +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 +import org.apache.wicket.markup.head.IHeaderResponse;
 +import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
 +import org.apache.wicket.markup.html.WebMarkupContainer;
 +import org.apache.wicket.markup.html.list.ListItem;
 +import org.apache.wicket.markup.html.list.ListView;
 +import org.apache.wicket.model.LoadableDetachableModel;
 +import org.apache.wicket.util.time.Duration;
 +
 +public class Topology extends BasePage {
 +
 +    private static final long serialVersionUID = -1100228004207271272L;
 +
 +    public static final String CONNECTOR_SERVER_LOCATION_PREFIX = "connid://";
 +
 +    public static final String ROOT_NAME = "Syncope";
 +
 +    private final int origX = 3100;
 +
 +    private final int origY = 2800;
 +
 +    private static final int RESOURCE_MODAL_WIN_HEIGHT = 700;
 +
 +    private static final int RESOURCE_MODAL_WIN_WIDTH = 1000;
 +
 +    private final ModalWindow modal;
 +
 +    private final WebMarkupContainer newlyCreatedContainer;
 +
 +    private final ListView<TopologyNode> newlyCreated;
 +
 +    private final LoadableDetachableModel<List<ResourceTO>> resModel = new LoadableDetachableModel<List<ResourceTO>>() {
 +
 +        private static final long serialVersionUID = 5275935387613157431L;
 +
 +        @Override
 +        protected List<ResourceTO> load() {
 +            final List<ResourceTO> result = resourceRestClient.getAll();
 +            return result;
 +        }
 +    };
 +
 +    private final LoadableDetachableModel<Map<String, List<ConnInstanceTO>>> connModel
 +            = new LoadableDetachableModel<Map<String, List<ConnInstanceTO>>>() {
 +
 +                private static final long serialVersionUID = 5275935387613157432L;
 +
 +                @Override
 +                protected Map<String, List<ConnInstanceTO>> load() {
 +                    final Map<String, List<ConnInstanceTO>> res = new HashMap<>();
 +
 +                    for (ConnInstanceTO conn : connectorRestClient.getAllConnectors()) {
 +                        final List<ConnInstanceTO> conns;
 +                        if (res.containsKey(conn.getLocation())) {
 +                            conns = res.get(conn.getLocation());
 +                        } else {
 +                            conns = new ArrayList<>();
 +                            res.put(conn.getLocation(), conns);
 +                        }
 +                        conns.add(conn);
 +                    }
 +
 +                    return res;
 +                }
 +            };
 +
 +    private final LoadableDetachableModel<Pair<List<URI>, List<URI>>> csModel
 +            = new LoadableDetachableModel<Pair<List<URI>, List<URI>>>() {
 +
 +                private static final long serialVersionUID = 5275935387613157433L;
 +
 +                @Override
 +                protected Pair<List<URI>, List<URI>> load() {
 +                    final List<URI> connectorServers = new ArrayList<>();
 +                    final List<URI> filePaths = new ArrayList<>();
 +
 +                    for (String location : SyncopeConsoleSession.get().getSyncopeTO().getConnIdLocations()) {
 +                        if (location.startsWith(CONNECTOR_SERVER_LOCATION_PREFIX)) {
 +                            connectorServers.add(URI.create(location));
 +                        } else {
 +                            filePaths.add(URI.create(location));
 +                        }
 +                    }
 +
 +                    return Pair.of(connectorServers, filePaths);
 +                }
 +            };
 +
 +    protected enum SupportedOperation {
 +
 +        CHECK_RESOURCE,
 +        CHECK_CONNECTOR,
 +        ADD_ENDPOINT;
 +
 +    }
 +
 +    public Topology() {
 +        modal = new ModalWindow("modal");
 +        add(modal);
 +
 +        modal.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
 +        modal.setInitialHeight(RESOURCE_MODAL_WIN_HEIGHT);
 +        modal.setInitialWidth(RESOURCE_MODAL_WIN_WIDTH);
 +        modal.setCookieName("resource-modal");
 +
 +        add(new WebSocketBehavior());
 +
 +        // -----------------------------------------
 +        // Add Zoom panel
 +        // -----------------------------------------
 +        final ActionLinksPanel.Builder<Serializable> zoomActionPanel = ActionLinksPanel.builder(getPageReference());
 +        zoomActionPanel.setDisableIndicator(true);
 +
 +        zoomActionPanel.add(new ActionLink<Serializable>() {
 +
 +            private static final long serialVersionUID = -3722207913631435501L;
 +
 +            @Override
 +            public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
 +                target.appendJavaScript("zoomIn($('#drawing')[0]);");
 +            }
 +        }, ActionLink.ActionType.ZOOM_IN, Entitlement.RESOURCE_LIST).add(new ActionLink<Serializable>() {
 +
 +            private static final long serialVersionUID = -3722207913631435501L;
 +
 +            @Override
 +            public void onClick(final AjaxRequestTarget target, final Serializable ignore) {
 +                target.appendJavaScript("zoomOut($('#drawing')[0]);");
 +            }
 +        }, ActionLink.ActionType.ZOOM_OUT, Entitlement.RESOURCE_LIST);
 +
 +        add(zoomActionPanel.build("zoom"));
 +        // -----------------------------------------
 +
 +        // -----------------------------------------
 +        // Add Syncope (root topologynode)
 +        // -----------------------------------------
 +        final TopologyNode syncopeTopologyNode = new TopologyNode(ROOT_NAME, ROOT_NAME, TopologyNode.Kind.SYNCOPE);
 +        syncopeTopologyNode.setX(origX);
 +        syncopeTopologyNode.setY(origY);
 +
 +        final URI uri = WebClient.client(SyncopeConsoleSession.get().getService(SyncopeService.class)).getBaseURI();
 +        syncopeTopologyNode.setHost(uri.getHost());
 +        syncopeTopologyNode.setPort(uri.getPort());
 +
 +        add(topologyNodePanel("syncope", syncopeTopologyNode));
 +
 +        final Map<Serializable, Map<Serializable, TopologyNode>> connections = new HashMap<>();
 +        final Map<Serializable, TopologyNode> syncopeConnections = new HashMap<>();
 +        connections.put(syncopeTopologyNode.getKey(), syncopeConnections);
 +
 +        // required to retrieve parent positions
 +        final Map<String, TopologyNode> servers = new HashMap<>();
 +        final Map<Long, TopologyNode> connectors = new HashMap<>();
 +        // -----------------------------------------
 +
 +        // -----------------------------------------
 +        // Add Connector Servers
 +        // -----------------------------------------
 +        final ListView<URI> connectorServers = new ListView<URI>("connectorServers", csModel.getObject().getLeft()) {
 +
 +            private static final long serialVersionUID = 6978621871488360380L;
 +
 +            private final int size = csModel.getObject().getLeft().size() + 1;
 +
 +            @Override
 +            protected void populateItem(final ListItem<URI> item) {
 +                int kx = size >= 4 ? 800 : (200 * size);
 +
 +                int x = (int) Math.round(origX + kx * Math.cos(Math.PI + Math.PI * (item.getIndex() + 1) / size));
 +                int y = (int) Math.round(origY + 100 * Math.sin(Math.PI + Math.PI * (item.getIndex() + 1) / size));
 +
 +                final URI location = item.getModelObject();
 +                final String url = location.toASCIIString();
 +
 +                final TopologyNode topologynode = new TopologyNode(url, url, TopologyNode.Kind.CONNECTOR_SERVER);
 +
 +                topologynode.setHost(location.getHost());
 +                topologynode.setPort(location.getPort());
 +                topologynode.setX(x);
 +                topologynode.setY(y);
 +
 +                servers.put(String.class.cast(topologynode.getKey()), topologynode);
 +
 +                item.add(topologyNodePanel("cs", topologynode));
 +
 +                syncopeConnections.put(url, topologynode);
 +                connections.put(url, new HashMap<Serializable, TopologyNode>());
 +            }
 +        };
 +
 +        connectorServers.setOutputMarkupId(true);
 +        add(connectorServers);
 +        // -----------------------------------------
 +
 +        // -----------------------------------------
 +        // Add File Paths
 +        // -----------------------------------------
 +        final ListView<URI> filePaths = new ListView<URI>("filePaths", csModel.getObject().getRight()) {
 +
 +            private static final long serialVersionUID = 6978621871488360380L;
 +
 +            private final int size = csModel.getObject().getRight().size() + 1;
 +
 +            @Override
 +            protected void populateItem(final ListItem<URI> item) {
 +                int kx = size >= 4 ? 800 : (200 * size);
 +
 +                int x = (int) Math.round(origX + kx * Math.cos(Math.PI * (item.getIndex() + 1) / size));
 +                int y = (int) Math.round(origY + 100 * Math.sin(Math.PI * (item.getIndex() + 1) / size));
 +
 +                final URI location = item.getModelObject();
 +                final String url = location.toASCIIString();
 +
 +                final TopologyNode topologynode = new TopologyNode(url, url, TopologyNode.Kind.FS_PATH);
 +
 +                topologynode.setHost(location.getHost());
 +                topologynode.setPort(location.getPort());
 +                topologynode.setX(x);
 +                topologynode.setY(y);
 +
 +                servers.put(String.class.cast(topologynode.getKey()), topologynode);
 +
 +                item.add(topologyNodePanel("fp", topologynode));
 +
 +                syncopeConnections.put(url, topologynode);
 +                connections.put(url, new HashMap<Serializable, TopologyNode>());
 +            }
 +        };
 +
 +        filePaths.setOutputMarkupId(true);
 +        add(filePaths);
 +        // -----------------------------------------
 +
 +        // -----------------------------------------
 +        // Add Connector Intances
 +        // -----------------------------------------
 +        final List<List<ConnInstanceTO>> allConns = new ArrayList<>(connModel.getObject().values());
 +
 +        final ListView<List<ConnInstanceTO>> conns = new ListView<List<ConnInstanceTO>>("conns", allConns) {
 +
 +            private static final long serialVersionUID = 697862187148836036L;
 +
 +            @Override
 +            protected void populateItem(final ListItem<List<ConnInstanceTO>> item) {
 +
 +                final int size = item.getModelObject().size() + 1;
 +
 +                final ListView<ConnInstanceTO> conns = new ListView<ConnInstanceTO>("conns", item.getModelObject()) {
 +
 +                    private static final long serialVersionUID = 6978621871488360381L;
 +
 +                    @Override
 +                    protected void populateItem(final ListItem<ConnInstanceTO> item) {
 +                        final ConnInstanceTO conn = item.getModelObject();
 +
 +                        final TopologyNode topologynode = new TopologyNode(
 +                                Long.valueOf(conn.getKey()), conn.getDisplayName(), TopologyNode.Kind.CONNECTOR);
 +
 +                        // Define the parent note
 +                        final TopologyNode parent = servers.get(conn.getLocation());
 +
 +                        // Set the position
 +                        int kx = size >= 6 ? 800 : (130 * size);
 +
 +                        final double hpos;
 +                        if (conn.getLocation().startsWith(CONNECTOR_SERVER_LOCATION_PREFIX)) {
 +                            hpos = Math.PI;
 +                        } else {
 +                            hpos = 0.0;
 +                        }
 +
 +                        int x = (int) Math.round((parent == null ? origX : parent.getX())
 +                                + kx * Math.cos(hpos + Math.PI * (item.getIndex() + 1) / size));
 +                        int y = (int) Math.round((parent == null ? origY : parent.getY())
 +                                + 100 * Math.sin(hpos + Math.PI * (item.getIndex() + 1) / size));
 +
 +                        topologynode.setConnectionDisplayName(conn.getBundleName());
 +                        topologynode.setX(x);
 +                        topologynode.setY(y);
 +
 +                        connectors.put(Long.class.cast(topologynode.getKey()), topologynode);
 +                        item.add(topologyNodePanel("conn", topologynode));
 +
 +                        // Update connections
 +                        final Map<Serializable, TopologyNode> remoteConnections;
 +
 +                        if (connections.containsKey(conn.getLocation())) {
 +                            remoteConnections = connections.get(conn.getLocation());
 +                        } else {
 +                            remoteConnections = new HashMap<>();
 +                            connections.put(conn.getLocation(), remoteConnections);
 +                        }
 +                        remoteConnections.put(conn.getKey(), topologynode);
 +                    }
 +                };
 +
 +                conns.setOutputMarkupId(true);
 +                item.add(conns);
 +            }
 +        };
 +
 +        conns.setOutputMarkupId(true);
 +        add(conns);
 +        // -----------------------------------------
 +
 +        // -----------------------------------------
 +        // Add Resources
 +        // -----------------------------------------
 +        final List<Long> connToBeProcessed = new ArrayList<>();
 +        for (ResourceTO resourceTO : resModel.getObject()) {
 +            final TopologyNode topologynode = new TopologyNode(
 +                    resourceTO.getKey(), resourceTO.getKey(), TopologyNode.Kind.RESOURCE);
 +
 +            final Map<Serializable, TopologyNode> remoteConnections;
 +
 +            if (connections.containsKey(resourceTO.getConnector())) {
 +                remoteConnections = connections.get(resourceTO.getConnector());
 +            } else {
 +                remoteConnections = new HashMap<>();
 +                connections.put(resourceTO.getConnector(), remoteConnections);
 +            }
 +
 +            remoteConnections.put(topologynode.getKey(), topologynode);
 +
 +            if (!connToBeProcessed.contains(resourceTO.getConnector())) {
 +                connToBeProcessed.add(resourceTO.getConnector());
 +            }
 +        }
 +
 +        final ListView<Long> resources = new ListView<Long>("resources", connToBeProcessed) {
 +
 +            private static final long serialVersionUID = 697862187148836038L;
 +
 +            @Override
 +            protected void populateItem(final ListItem<Long> item) {
 +                final Long connectorId = item.getModelObject();
 +
 +                final ListView<TopologyNode> innerListView = new ListView<TopologyNode>("resources",
 +                        new ArrayList<>(connections.get(connectorId).values())) {
 +
 +                            private static final long serialVersionUID = 1L;
 +
 +                            private final int size = getModelObject().size() + 1;
 +
 +                            @Override
 +                            protected void populateItem(final ListItem<TopologyNode> item) {
 +                                final TopologyNode topologynode = item.getModelObject();
 +                                final TopologyNode parent = connectors.get(connectorId);
 +
 +                                // Set position
 +                                int kx = size >= 16 ? 800 : (48 * size);
 +                                int ky = size < 4 ? 100 : size < 6 ? 350 : 750;
 +
 +                                final double hpos;
 +                                if (parent == null || parent.getY() < syncopeTopologyNode.getY()) {
 +                                    hpos = Math.PI;
 +                                } else {
 +                                    hpos = 0.0;
 +                                }
 +
 +                                int x = (int) Math.round((parent == null ? origX : parent.getX())
 +                                        + kx * Math.cos(hpos + Math.PI * (item.getIndex() + 1) / size));
 +                                int y = (int) Math.round((parent == null ? origY : parent.getY())
 +                                        + ky * Math.sin(hpos + Math.PI * (item.getIndex() + 1) / size));
 +
 +                                topologynode.setX(x);
 +                                topologynode.setY(y);
 +
 +                                item.add(topologyNodePanel("res", topologynode));
 +                            }
 +                        };
 +
 +                innerListView.setOutputMarkupId(true);
 +                item.add(innerListView);
 +            }
 +        };
 +
 +        resources.setOutputMarkupId(true);
 +        add(resources);
 +        // -----------------------------------------
 +
 +        // -----------------------------------------
 +        // Create connections
 +        // -----------------------------------------
 +        final WebMarkupContainer jsPlace = new WebMarkupContainerNoVeil("jsPlace");
 +        jsPlace.setOutputMarkupId(true);
 +        add(jsPlace);
 +
 +        jsPlace.add(new Behavior() {
 +
 +            private static final long serialVersionUID = 2661717818979056044L;
 +
 +            @Override
 +            public void renderHead(final Component component, final IHeaderResponse response) {
 +                final StringBuilder jsPlumbConf = new StringBuilder();
 +                jsPlumbConf.append(String.format(Locale.US, "activate(%.2f);", 0.68f));
 +
 +                for (String str : createConnections(connections)) {
 +                    jsPlumbConf.append(str);
 +                }
 +
 +                response.render(OnDomReadyHeaderItem.forScript(jsPlumbConf.toString()));
 +            }
 +        });
 +
 +        jsPlace.add(new AbstractAjaxTimerBehavior(Duration.seconds(2)) {
 +
 +            private static final long serialVersionUID = 1L;
 +
 +            @Override
 +            protected void onTimer(final AjaxRequestTarget target) {
 +                target.appendJavaScript("checkConnection()");
 +
 +                if (getUpdateInterval().seconds() < 5.0) {
 +                    setUpdateInterval(Duration.seconds(5));
 +                } else if (getUpdateInterval().seconds() < 10.0) {
 +                    setUpdateInterval(Duration.seconds(10));
 +                } else if (getUpdateInterval().seconds() < 15.0) {
 +                    setUpdateInterval(Duration.seconds(15));
 +                } else if (getUpdateInterval().seconds() < 20.0) {
 +                    setUpdateInterval(Duration.seconds(20));
 +                } else if (getUpdateInterval().seconds() < 30.0) {
 +                    setUpdateInterval(Duration.seconds(30));
 +                } else if (getUpdateInterval().seconds() < 60.0) {
 +                    setUpdateInterval(Duration.seconds(60));
 +                }
 +            }
 +        });
 +        // -----------------------------------------
 +
 +        newlyCreatedContainer = new WebMarkupContainer("newlyCreatedContainer");
 +        newlyCreatedContainer.setOutputMarkupId(true);
 +        add(newlyCreatedContainer);
 +
 +        newlyCreated = new ListView<TopologyNode>("newlyCreated", new ArrayList<TopologyNode>()) {
 +
 +            private static final long serialVersionUID = 1L;
 +
 +            @Override
 +            protected void populateItem(final ListItem<TopologyNode> item) {
 +                item.add(topologyNodePanel("el", item.getModelObject()));
 +            }
 +        };
 +        newlyCreated.setOutputMarkupId(true);
 +        newlyCreated.setReuseItems(true);
 +
 +        newlyCreatedContainer.add(newlyCreated);
 +    }
 +
 +    private List<String> createConnections(final Map<Serializable, Map<Serializable, TopologyNode>> targets) {
 +        List<String> list = new ArrayList<>();
 +
 +        for (Map.Entry<Serializable, Map<Serializable, TopologyNode>> source : targets.entrySet()) {
 +            for (Map.Entry<Serializable, TopologyNode> target : source.getValue().entrySet()) {
 +                list.add(String.format("connect('%s','%s','%s');",
 +                        source.getKey(),
 +                        target.getKey(),
 +                        target.getValue().getKind()));
 +            }
 +        }
 +        return list;
 +    }
 +
 +    private TopologyNodePanel topologyNodePanel(final String id, final TopologyNode node) {
 +
 +        final TopologyNodePanel panel = new TopologyNodePanel(id, node, getPageReference(), modal);
 +        panel.setMarkupId(String.valueOf(node.getKey()));
 +        panel.setOutputMarkupId(true);
 +
 +        panel.add(new Behavior() {
 +
 +            private static final long serialVersionUID = 1L;
 +
 +            @Override
 +            public void renderHead(final Component component, final IHeaderResponse response) {
 +                response.render(OnDomReadyHeaderItem.forScript(String.format("setPosition('%s', %d, %d)",
 +                        node.getKey(), node.getX(), node.getY())));
 +            }
 +        });
 +
 +        return panel;
 +    }
 +
 +    @Override
 +    @SuppressWarnings("unchecked")
 +    public void onEvent(final IEvent<?> event) {
 +        super.onEvent(event);
 +
 +        if (event.getPayload() instanceof CreateEvent) {
 +            final CreateEvent resourceCreateEvent = CreateEvent.class.cast(event.getPayload());
 +
 +            final TopologyNode node = new TopologyNode(
 +                    resourceCreateEvent.getKey(),
 +                    resourceCreateEvent.getDisplayName(),
 +                    resourceCreateEvent.getKind());
 +
 +            newlyCreated.getModelObject().add(node);
 +            resourceCreateEvent.getTarget().add(newlyCreatedContainer);
 +
 +            resourceCreateEvent.getTarget().appendJavaScript(String.format(
 +                    "window.Wicket.WebSocket.send('"
 +                    + "{\"kind\":\"%s\",\"target\":\"%s\",\"source\":\"%s\",\"scope\":\"%s\"}"
 +                    + "');",
 +                    SupportedOperation.ADD_ENDPOINT,
 +                    resourceCreateEvent.getKey(),
 +                    resourceCreateEvent.getParent(),
 +                    resourceCreateEvent.getKind()));
 +        }
 +    }
 +
 +    private static class WebMarkupContainerNoVeil extends WebMarkupContainer implements IAjaxIndicatorAware {
 +
 +        private static final long serialVersionUID = 1L;
 +
-         public WebMarkupContainerNoVeil(final String id) {
++        WebMarkupContainerNoVeil(final String id) {
 +            super(id);
 +        }
 +
 +        @Override
 +        public String getAjaxIndicatorMarkupId() {
 +            return StringUtils.EMPTY;
 +        }
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/console/src/main/java/org/apache/syncope/client/console/topology/WebSocketBehavior.java
----------------------------------------------------------------------
diff --cc client/console/src/main/java/org/apache/syncope/client/console/topology/WebSocketBehavior.java
index 1b847f9,0000000..8e3267d
mode 100644,000000..100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/topology/WebSocketBehavior.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/topology/WebSocketBehavior.java
@@@ -1,208 -1,0 +1,208 @@@
 +/*
 + * 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.client.console.topology;
 +
 +import com.fasterxml.jackson.databind.JsonNode;
 +import com.fasterxml.jackson.databind.ObjectMapper;
 +import java.io.IOException;
 +import java.util.HashMap;
 +import java.util.HashSet;
 +import java.util.Map;
 +import java.util.Set;
 +import java.util.concurrent.ExecutorService;
 +import java.util.concurrent.Executors;
 +import org.apache.syncope.client.console.rest.ConnectorRestClient;
 +import org.apache.syncope.client.console.rest.ResourceRestClient;
 +import org.apache.syncope.common.lib.to.ConnInstanceTO;
 +import org.apache.syncope.common.lib.to.ResourceTO;
 +import org.apache.wicket.Application;
 +import org.apache.wicket.Session;
 +import org.apache.wicket.ThreadContext;
 +import org.apache.wicket.protocol.ws.api.WebSocketRequestHandler;
 +import org.apache.wicket.protocol.ws.api.message.TextMessage;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
 +public class WebSocketBehavior extends org.apache.wicket.protocol.ws.api.WebSocketBehavior {
 +
 +    protected static final Logger LOG = LoggerFactory.getLogger(WebSocketBehavior.class);
 +
 +    private static final long serialVersionUID = -1653665542635275551L;
 +
 +    private final Map<String, String> resources = new HashMap<>();
 +
 +    private final Set<String> runningResCheck = new HashSet<>();
 +
 +    private final Map<Long, String> connectors = new HashMap<>();
 +
 +    private final Set<Long> runningConnCheck = new HashSet<>();
 +
 +    private final ConnectorRestClient connectorRestClient = new ConnectorRestClient();
 +
 +    private final ResourceRestClient resourceRestClient = new ResourceRestClient();
 +
 +    @Override
 +    protected void onMessage(final WebSocketRequestHandler handler, final TextMessage message) {
 +        try {
 +            final ObjectMapper mapper = new ObjectMapper();
 +            final JsonNode obj = mapper.readTree(message.getText());
 +
 +            final ExecutorService executorService = Executors.newFixedThreadPool(1);
 +
 +            switch (Topology.SupportedOperation.valueOf(obj.get("kind").asText())) {
 +                case CHECK_CONNECTOR:
 +                    final Long ckey = obj.get("target").asLong();
 +
 +                    if (connectors.containsKey(ckey)) {
 +                        handler.push(connectors.get(ckey));
 +                    } else {
 +                        handler.push(String.format(
 +                                "{ \"status\": \"%s\", \"target\": \"%s\"}", TopologyNode.Status.UNKNOWN, ckey));
 +                    }
 +
 +                    synchronized (runningConnCheck) {
 +                        if (runningConnCheck.contains(ckey)) {
 +                            LOG.debug("Running connection check for connector {}", ckey);
 +                        } else {
 +                            runningConnCheck.add(ckey);
 +                        }
 +                    }
 +
 +                    executorService.execute(new ConnCheck(ckey));
 +
 +                    break;
 +                case CHECK_RESOURCE:
 +                    final String rkey = obj.get("target").asText();
 +
 +                    if (resources.containsKey(rkey)) {
 +                        handler.push(resources.get(rkey));
 +                    } else {
 +                        handler.push(String.format(
 +                                "{ \"status\": \"%s\", \"target\": \"%s\"}", TopologyNode.Status.UNKNOWN, rkey));
 +                    }
 +
 +                    synchronized (runningResCheck) {
 +                        if (runningResCheck.contains(rkey)) {
 +                            LOG.debug("Running connection check for resource {}", rkey);
 +                        } else {
 +                            runningResCheck.add(rkey);
 +                        }
 +                    }
 +
 +                    executorService.execute(new ResCheck(rkey));
 +
 +                    break;
 +                case ADD_ENDPOINT:
 +                    handler.appendJavaScript(String.format("addEndpoint('%s', '%s', '%s');",
 +                            obj.get("source").asText(),
 +                            obj.get("target").asText(),
 +                            obj.get("scope").asText()));
 +                    break;
 +                default:
 +            }
 +
 +            executorService.shutdown();
 +
 +        } catch (IOException e) {
 +            LOG.error("Eror managing websocket message", e);
 +        }
 +    }
 +
 +    class ConnCheck implements Runnable {
 +
 +        private final Long key;
 +
 +        private final Application application;
 +
 +        private final Session session;
 +
-         public ConnCheck(final Long key) {
++        ConnCheck(final Long key) {
 +            this.key = key;
 +            this.application = Application.get();
 +            this.session = Session.exists() ? Session.get() : null;
 +        }
 +
 +        @Override
 +        public void run() {
 +            try {
 +                ThreadContext.setApplication(application);
 +                ThreadContext.setSession(session);
 +
 +                String res;
 +                try {
 +                    final ConnInstanceTO connector = connectorRestClient.read(key);
 +                    res = String.format("{ \"status\": \"%s\", \"target\": \"%s\"}",
 +                            connectorRestClient.check(connector)
 +                                    ? TopologyNode.Status.REACHABLE : TopologyNode.Status.UNREACHABLE, key);
 +                } catch (Exception e) {
 +                    LOG.warn("Error checking connection for {}", key, e);
 +                    res = String.format("{ \"status\": \"%s\", \"target\": \"%s\"}", TopologyNode.Status.FAILURE, key);
 +                }
 +
 +                synchronized (runningConnCheck) {
 +                    connectors.put(key, res);
 +                    runningConnCheck.remove(key);
 +                }
 +            } finally {
 +                ThreadContext.detach();
 +            }
 +        }
 +    }
 +
 +    class ResCheck implements Runnable {
 +
 +        private final String key;
 +
 +        private final Application application;
 +
 +        private final Session session;
 +
-         public ResCheck(final String key) {
++        ResCheck(final String key) {
 +            this.key = key;
 +            this.application = Application.get();
 +            this.session = Session.exists() ? Session.get() : null;
 +        }
 +
 +        @Override
 +        public void run() {
 +            try {
 +                ThreadContext.setApplication(application);
 +                ThreadContext.setSession(session);
 +
 +                String res;
 +                try {
 +                    final ResourceTO resource = resourceRestClient.read(key);
 +                    res = String.format("{ \"status\": \"%s\", \"target\": \"%s\"}",
 +                            connectorRestClient.check(resource)
 +                                    ? TopologyNode.Status.REACHABLE : TopologyNode.Status.UNREACHABLE, key);
 +                } catch (Exception e) {
 +                    LOG.warn("Error checking connection for {}", key, e);
 +                    res = String.format("{ \"status\": \"%s\", \"target\": \"%s\"}", TopologyNode.Status.FAILURE, key);
 +                }
 +
 +                synchronized (runningResCheck) {
 +                    resources.put(key, res);
 +                    runningResCheck.remove(key);
 +                }
 +            } finally {
 +                ThreadContext.detach();
 +            }
 +        }
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLink.java
----------------------------------------------------------------------
diff --cc client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLink.java
index ec405a2,0000000..1c6731f
mode 100644,000000..100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLink.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLink.java
@@@ -1,102 -1,0 +1,102 @@@
 +/*
 + * 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.client.console.wicket.markup.html.form;
 +
 +import java.io.Serializable;
 +import org.apache.wicket.ajax.AjaxRequestTarget;
 +
 +public abstract class ActionLink<T> implements Serializable {
 +
 +    private static final long serialVersionUID = 7031329706998320639L;
 +
 +    private boolean reloadFeedbackPanel = true;
 +
 +    private T modelObject;
 +
 +    public ActionLink() {
 +    }
 +
 +    public ActionLink(final T modelObject) {
 +        this.modelObject = modelObject;
 +    }
 +
 +    public enum ActionType {
 +
 +        MAPPING("update"),
 +        ACCOUNT_LINK("update"),
 +        RESET_TIME("update"),
 +        CLONE("create"),
 +        CREATE("create"),
 +        EDIT("read"),
 +        USER_TEMPLATE("read"),
 +        GROUP_TEMPLATE("read"),
 +        RESET("update"),
 +        ENABLE("update"),
 +        SEARCH("read"),
 +        DELETE("delete"),
 +        EXECUTE("execute"),
 +        DRYRUN("execute"),
 +        CLAIM("claim"),
 +        SELECT("read"),
 +        EXPORT("read"),
 +        SUSPEND("update"),
 +        REACTIVATE("update"),
 +        RELOAD("reload"),
 +        CHANGE_VIEW("changeView"),
 +        UNLINK("update"),
 +        LINK("update"),
 +        UNASSIGN("update"),
 +        ASSIGN("update"),
 +        DEPROVISION("update"),
 +        PROVISION("update"),
 +        MANAGE_RESOURCES("update"),
 +        MANAGE_USERS("update"),
 +        MANAGE_GROUPS("update"),
 +        ZOOM_IN("zoomin"),
 +        ZOOM_OUT("zoomout");
 +
 +        private final String actionId;
 +
-         private ActionType(final String actionId) {
++        ActionType(final String actionId) {
 +            this.actionId = actionId;
 +        }
 +
 +        public String getActionId() {
 +            return actionId;
 +        }
 +    }
 +
 +    public T getModelObject() {
 +        return modelObject;
 +    }
 +
 +    public abstract void onClick(final AjaxRequestTarget target, final T modelObject);
 +
 +    public void postClick() {
 +    }
 +
 +    public boolean feedbackPanelAutomaticReload() {
 +        return reloadFeedbackPanel;
 +    }
 +
 +    public ActionLink<T> feedbackPanelAutomaticReload(final boolean reloadFeedbackPanel) {
 +        this.reloadFeedbackPanel = reloadFeedbackPanel;
 +        return this;
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/console/src/main/java/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder.java
----------------------------------------------------------------------
diff --cc client/console/src/main/java/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder.java
index 30a7bbc,0000000..161df03
mode 100644,000000..100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/provision/ProvisionWizardBuilder.java
@@@ -1,222 -1,0 +1,222 @@@
 +/*
 + * Copyright 2015 The Apache Software Foundation.
 + *
 + * Licensed 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.client.console.wizards.provision;
 +
 +import java.io.Serializable;
 +import java.util.ArrayList;
 +import java.util.List;
 +import org.apache.commons.collections4.CollectionUtils;
 +import org.apache.commons.collections4.Predicate;
 +import org.apache.commons.collections4.Transformer;
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.syncope.client.console.commons.Constants;
 +import org.apache.syncope.client.console.panels.ResourceMappingPanel;
 +import org.apache.syncope.client.console.rest.AnyTypeRestClient;
 +import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel;
 +import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
 +import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel;
 +import org.apache.syncope.client.console.wizards.AjaxWizardBuilder;
 +import org.apache.syncope.common.lib.to.AnyTypeTO;
 +import org.apache.syncope.common.lib.to.ProvisionTO;
 +import org.apache.syncope.common.lib.to.ResourceTO;
 +import org.apache.wicket.PageReference;
 +import org.apache.wicket.ajax.AjaxRequestTarget;
 +import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
 +import org.apache.wicket.extensions.wizard.WizardModel;
 +import org.apache.wicket.extensions.wizard.WizardStep;
 +import org.apache.wicket.markup.html.WebMarkupContainer;
 +import org.apache.wicket.markup.html.form.TextField;
 +import org.apache.wicket.model.LoadableDetachableModel;
 +import org.apache.wicket.model.Model;
 +import org.apache.wicket.model.PropertyModel;
 +import org.apache.wicket.model.ResourceModel;
 +import org.apache.wicket.model.StringResourceModel;
 +
 +public class ProvisionWizardBuilder extends AjaxWizardBuilder<ProvisionTO> implements Serializable {
 +
 +    private static final long serialVersionUID = 1L;
 +
 +    private final ResourceTO resourceTO;
 +
 +    private final LoadableDetachableModel<List<String>> anyTypes = new LoadableDetachableModel<List<String>>() {
 +
 +        private static final long serialVersionUID = 1L;
 +
 +        @Override
 +        protected List<String> load() {
 +            final List<String> currentlyAdded = new ArrayList<>();
 +
 +            CollectionUtils.collect(resourceTO.getProvisions(), new Transformer<ProvisionTO, String>() {
 +
 +                @Override
 +                public String transform(final ProvisionTO provisionTO) {
 +                    return provisionTO.getAnyType();
 +                }
 +            }, currentlyAdded);
 +
 +            final List<String> res = new ArrayList<>();
 +
 +            CollectionUtils.filter(
 +                    CollectionUtils.collect(new AnyTypeRestClient().getAll(), new Transformer<AnyTypeTO, String>() {
 +
 +                        @Override
 +                        public String transform(final AnyTypeTO anyTypeTO) {
 +                            return anyTypeTO.getKey();
 +                        }
 +                    }, res), new Predicate<String>() {
 +
 +                        @Override
 +                        public boolean evaluate(final String key) {
 +                            return !currentlyAdded.contains(key);
 +                        }
 +                    });
 +
 +            return res;
 +        }
 +    };
 +
 +    /**
 +     * The object type specification step.
 +     */
 +    private final class ObjectType extends WizardStep {
 +
 +        private static final long serialVersionUID = 1L;
 +
 +        /**
 +         * Construct.
 +         */
-         public ObjectType(final ProvisionTO item) {
++        ObjectType(final ProvisionTO item) {
 +            super(new ResourceModel("type.title", StringUtils.EMPTY),
 +                    new ResourceModel("type.summary", StringUtils.EMPTY), new Model<ProvisionTO>(item));
 +
 +            add(new AjaxDropDownChoicePanel<String>("type", "type", new PropertyModel<String>(item, "anyType"), false).
 +                    setChoices(anyTypes).
 +                    setStyleSheet("form-control").
 +                    setRequired(true));
 +
 +            add(new TextField<String>(
 +                    "class", new PropertyModel<String>(item, "objectClass")).setRequired(true));
 +        }
 +    }
 +
 +    /**
 +     * Mapping definition step.
 +     */
 +    private final class Mapping extends WizardStep {
 +
 +        private static final long serialVersionUID = 1L;
 +
 +        /**
 +         * Construct.
 +         */
-         public Mapping(final ProvisionTO item) {
++        Mapping(final ProvisionTO item) {
 +            setTitleModel(new ResourceModel("mapping.title", "Mapping"));
 +            setSummaryModel(new StringResourceModel("mapping.summary", this, new Model<ProvisionTO>(item)));
 +
 +            add(new ResourceMappingPanel("mapping", resourceTO, item));
 +        }
 +    }
 +
 +    /**
 +     * AccountLink specification step.
 +     */
 +    private final class ConnObjectLink extends WizardStep {
 +
 +        private static final long serialVersionUID = 1L;
 +
 +        /**
 +         * Construct.
 +         */
-         public ConnObjectLink(final ProvisionTO item) {
++        ConnObjectLink(final ProvisionTO item) {
 +            super(new ResourceModel("link.title", StringUtils.EMPTY),
 +                    new ResourceModel("link.summary", StringUtils.EMPTY));
 +
 +            final WebMarkupContainer connObjectLinkContainer = new WebMarkupContainer("connObjectLinkContainer");
 +            connObjectLinkContainer.setOutputMarkupId(true);
 +            add(connObjectLinkContainer);
 +
 +            boolean connObjectLinkEnabled = false;
 +            if (StringUtils.isNotBlank(item.getMapping().getConnObjectLink())) {
 +                connObjectLinkEnabled = true;
 +            }
 +
 +            final AjaxCheckBoxPanel connObjectLinkCheckbox = new AjaxCheckBoxPanel(
 +                    "connObjectLinkCheckbox",
 +                    new ResourceModel("connObjectLinkCheckbox", "connObjectLinkCheckbox").getObject(),
 +                    new Model<>(connObjectLinkEnabled),
 +                    false);
 +            connObjectLinkCheckbox.setEnabled(true);
 +
 +            connObjectLinkContainer.add(connObjectLinkCheckbox);
 +
 +            final AjaxTextFieldPanel connObjectLink = new AjaxTextFieldPanel(
 +                    "connObjectLink",
 +                    new ResourceModel("connObjectLink", "connObjectLink").getObject(),
 +                    new PropertyModel<String>(item.getMapping(), "connObjectLink"),
 +                    false);
 +            connObjectLink.setEnabled(connObjectLinkEnabled);
 +            connObjectLinkContainer.add(connObjectLink);
 +
 +            connObjectLinkCheckbox.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
 +
 +                private static final long serialVersionUID = -1107858522700306810L;
 +
 +                @Override
 +                protected void onUpdate(final AjaxRequestTarget target) {
 +                    if (connObjectLinkCheckbox.getModelObject()) {
 +                        connObjectLink.setEnabled(Boolean.TRUE);
 +                        connObjectLink.setModelObject("");
 +                    } else {
 +                        connObjectLink.setEnabled(Boolean.FALSE);
 +                        connObjectLink.setModelObject("");
 +                    }
 +
 +                    target.add(connObjectLink);
 +                }
 +            });
 +        }
 +    }
 +
 +    /**
 +     * Construct.
 +     *
 +     * @param id The component id
 +     * @param resourceTO external resource to be updated.
 +     * @param pageRef Caller page reference.
 +     */
 +    public ProvisionWizardBuilder(final String id, final ResourceTO resourceTO, final PageReference pageRef) {
 +        super(id, new ProvisionTO(), pageRef);
 +        this.resourceTO = resourceTO;
 +    }
 +
 +    @Override
 +    protected WizardModel buildModelSteps(final ProvisionTO modelObject, final WizardModel wizardModel) {
 +        wizardModel.add(new ObjectType(modelObject));
 +        wizardModel.add(new Mapping(modelObject));
 +        wizardModel.add(new ConnObjectLink(modelObject));
 +        return wizardModel;
 +    }
 +
 +    @Override
 +    protected void onCancelInternal() {
 +        // d nothing
 +    }
 +
 +    @Override
 +    protected void onApplyInternal() {
 +        // do nothing
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java
----------------------------------------------------------------------
diff --cc client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java
index 46dc302,0000000..724da5a
mode 100644,000000..100644
--- a/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java
+++ b/client/lib/src/main/java/org/apache/syncope/client/lib/SyncopeClientFactoryBean.java
@@@ -1,254 -1,0 +1,254 @@@
 +/*
 + * 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.client.lib;
 +
 +import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
 +import java.util.ArrayList;
 +import java.util.Collections;
 +import java.util.HashMap;
 +import java.util.List;
 +import java.util.Map;
 +import javax.ws.rs.core.MediaType;
 +import javax.xml.bind.Marshaller;
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.cxf.feature.Feature;
 +import org.apache.cxf.feature.LoggingFeature;
 +import org.apache.cxf.jaxrs.provider.JAXBElementProvider;
 +import org.apache.cxf.staxutils.DocumentDepthProperties;
 +import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
 +import org.apache.syncope.common.rest.api.RESTHeaders;
 +
 +/**
 + * Factory bean for creating instances of {@link SyncopeClient}.
 + * Supports Spring-bean configuration and override via subclassing (see protected methods).
 + */
 +public class SyncopeClientFactoryBean {
 +
 +    public enum ContentType {
 +
 +        JSON(MediaType.APPLICATION_JSON_TYPE),
 +        XML(MediaType.APPLICATION_XML_TYPE);
 +
 +        private final MediaType mediaType;
 +
-         private ContentType(final MediaType mediaType) {
++        ContentType(final MediaType mediaType) {
 +            this.mediaType = mediaType;
 +        }
 +
 +        public MediaType getMediaType() {
 +            return mediaType;
 +        }
 +
 +        public static ContentType fromString(final String value) {
 +            return StringUtils.isNotBlank(value) && value.equalsIgnoreCase(XML.getMediaType().toString())
 +                    ? XML
 +                    : JSON;
 +        }
 +    }
 +
 +    private JacksonJaxbJsonProvider jsonProvider;
 +
 +    private JAXBElementProvider<?> jaxbProvider;
 +
 +    private RestClientExceptionMapper exceptionMapper;
 +
 +    private String address;
 +
 +    private ContentType contentType;
 +
 +    private String domain;
 +
 +    private boolean useCompression;
 +
 +    private RestClientFactoryBean restClientFactoryBean;
 +
 +    protected JacksonJaxbJsonProvider defaultJsonProvider() {
 +        return new JacksonJaxbJsonProvider();
 +    }
 +
 +    @SuppressWarnings({ "rawtypes" })
 +    protected JAXBElementProvider<?> defaultJAXBProvider() {
 +        JAXBElementProvider<?> defaultJAXBProvider = new JAXBElementProvider();
 +
 +        DocumentDepthProperties depthProperties = new DocumentDepthProperties();
 +        depthProperties.setInnerElementCountThreshold(500);
 +        defaultJAXBProvider.setDepthProperties(depthProperties);
 +
 +        Map<String, Object> marshallerProperties = new HashMap<>();
 +        marshallerProperties.put(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
 +        defaultJAXBProvider.setMarshallerProperties(marshallerProperties);
 +
 +        Map<String, String> collectionWrapperMap = new HashMap<>();
 +        collectionWrapperMap.put(AbstractPolicyTO.class.getName(), "policies");
 +        defaultJAXBProvider.setCollectionWrapperMap(collectionWrapperMap);
 +
 +        return defaultJAXBProvider;
 +    }
 +
 +    protected RestClientExceptionMapper defaultExceptionMapper() {
 +        return new RestClientExceptionMapper();
 +    }
 +
 +    protected RestClientFactoryBean defaultRestClientFactoryBean() {
 +        RestClientFactoryBean defaultRestClientFactoryBean = new RestClientFactoryBean();
 +
 +        if (StringUtils.isBlank(address)) {
 +            throw new IllegalArgumentException("Property 'address' is missing");
 +        }
 +        defaultRestClientFactoryBean.setAddress(address);
 +
 +        if (StringUtils.isNotBlank(domain)) {
 +            defaultRestClientFactoryBean.setHeaders(Collections.singletonMap(RESTHeaders.DOMAIN, domain));
 +        }
 +
 +        defaultRestClientFactoryBean.setThreadSafe(true);
 +        defaultRestClientFactoryBean.setInheritHeaders(true);
 +
 +        List<Feature> features = new ArrayList<>();
 +        features.add(new LoggingFeature());
 +        defaultRestClientFactoryBean.setFeatures(features);
 +
 +        List<Object> providers = new ArrayList<>(3);
 +        providers.add(getJaxbProvider());
 +        providers.add(getJsonProvider());
 +        providers.add(getExceptionMapper());
 +        defaultRestClientFactoryBean.setProviders(providers);
 +
 +        return defaultRestClientFactoryBean;
 +    }
 +
 +    public JacksonJaxbJsonProvider getJsonProvider() {
 +        return jsonProvider == null
 +                ? defaultJsonProvider()
 +                : jsonProvider;
 +    }
 +
 +    public void setJsonProvider(final JacksonJaxbJsonProvider jsonProvider) {
 +        this.jsonProvider = jsonProvider;
 +    }
 +
 +    public JAXBElementProvider<?> getJaxbProvider() {
 +        return jaxbProvider == null
 +                ? defaultJAXBProvider()
 +                : jaxbProvider;
 +    }
 +
 +    public SyncopeClientFactoryBean setJaxbProvider(final JAXBElementProvider<?> jaxbProvider) {
 +        this.jaxbProvider = jaxbProvider;
 +        return this;
 +    }
 +
 +    public RestClientExceptionMapper getExceptionMapper() {
 +        return exceptionMapper == null
 +                ? defaultExceptionMapper()
 +                : exceptionMapper;
 +    }
 +
 +    public SyncopeClientFactoryBean setExceptionMapper(final RestClientExceptionMapper exceptionMapper) {
 +        this.exceptionMapper = exceptionMapper;
 +        return this;
 +    }
 +
 +    public String getAddress() {
 +        return address;
 +    }
 +
 +    public SyncopeClientFactoryBean setAddress(final String address) {
 +        this.address = address;
 +        return this;
 +    }
 +
 +    public ContentType getContentType() {
 +        return contentType == null
 +                ? ContentType.JSON
 +                : contentType;
 +    }
 +
 +    public SyncopeClientFactoryBean setContentType(final ContentType contentType) {
 +        this.contentType = contentType;
 +        return this;
 +    }
 +
 +    public SyncopeClientFactoryBean setContentType(final String contentType) {
 +        this.contentType = ContentType.fromString(contentType);
 +        return this;
 +    }
 +
 +    public String getDomain() {
 +        return domain;
 +    }
 +
 +    public SyncopeClientFactoryBean setDomain(final String domain) {
 +        this.domain = domain;
 +        return this;
 +    }
 +
 +    /**
 +     * Sets the given service instance for transparent gzip <tt>Content-Encoding</tt> handling.
 +     *
 +     * @param useCompression whether transparent gzip <tt>Content-Encoding</tt> handling is to be enabled
 +     * @return the current instance
 +     */
 +    public SyncopeClientFactoryBean setUseCompression(final boolean useCompression) {
 +        this.useCompression = useCompression;
 +        return this;
 +    }
 +
 +    public boolean isUseCompression() {
 +        return useCompression;
 +    }
 +
 +    public RestClientFactoryBean getRestClientFactoryBean() {
 +        return restClientFactoryBean == null
 +                ? defaultRestClientFactoryBean()
 +                : restClientFactoryBean;
 +    }
 +
 +    public SyncopeClientFactoryBean setRestClientFactoryBean(final RestClientFactoryBean restClientFactoryBean) {
 +        this.restClientFactoryBean = restClientFactoryBean;
 +        return this;
 +    }
 +
 +    /**
 +     * Builds client instance with no authentication, for user self-registration and related queries (schema,
 +     * resources, ...).
 +     *
 +     * @return client instance with no authentication
 +     */
 +    public SyncopeClient create() {
 +        return create(null, null);
 +    }
 +
 +    /**
 +     * Builds client instance with the given credentials.
 +     *
 +     * @param username username
 +     * @param password password
 +     * @return client instance with the given credentials
 +     */
 +    public SyncopeClient create(final String username, final String password) {
 +        return new SyncopeClient(
 +                getContentType().getMediaType(),
 +                getRestClientFactoryBean(),
 +                getExceptionMapper(),
 +                username,
 +                password,
 +                useCompression);
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/common/lib/src/main/java/org/apache/syncope/common/lib/types/AnyTypeKind.java
----------------------------------------------------------------------
diff --cc common/lib/src/main/java/org/apache/syncope/common/lib/types/AnyTypeKind.java
index ee35e28,0000000..136d798
mode 100644,000000..100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/AnyTypeKind.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/AnyTypeKind.java
@@@ -1,44 -1,0 +1,44 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *   http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing,
 + * software distributed under the License is distributed on an
 + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 + * KIND, either express or implied.  See the License for the
 + * specific language governing permissions and limitations
 + * under the License.
 + */
 +package org.apache.syncope.common.lib.types;
 +
 +import javax.xml.bind.annotation.XmlEnum;
 +import org.apache.syncope.common.lib.to.AnyObjectTO;
 +import org.apache.syncope.common.lib.to.AnyTO;
 +import org.apache.syncope.common.lib.to.GroupTO;
 +import org.apache.syncope.common.lib.to.UserTO;
 +
 +@XmlEnum
 +public enum AnyTypeKind {
 +
 +    USER(UserTO.class),
 +    GROUP(GroupTO.class),
 +    ANY_OBJECT(AnyObjectTO.class);
 +
 +    private final Class<? extends AnyTO> toClass;
 +
-     private AnyTypeKind(final Class<? extends AnyTO> toClass) {
++    AnyTypeKind(final Class<? extends AnyTO> toClass) {
 +        this.toClass = toClass;
 +    }
 +
 +    public Class<? extends AnyTO> getToClass() {
 +        return toClass;
 +    }
 +
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
----------------------------------------------------------------------
diff --cc common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
index 0c19403,0000000..e4a0f10
mode 100644,000000..100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ClientExceptionType.java
@@@ -1,103 -1,0 +1,103 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *   http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing,
 + * software distributed under the License is distributed on an
 + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 + * KIND, either express or implied.  See the License for the
 + * specific language governing permissions and limitations
 + * under the License.
 + */
 +package org.apache.syncope.common.lib.types;
 +
 +import javax.ws.rs.core.Response;
 +
 +public enum ClientExceptionType {
 +
 +    AssociatedResources(Response.Status.BAD_REQUEST),
 +    Composite(Response.Status.BAD_REQUEST),
 +    ConcurrentModification(Response.Status.PRECONDITION_FAILED),
 +    ConnectorException(Response.Status.BAD_REQUEST),
 +    DataIntegrityViolation(Response.Status.CONFLICT),
 +    EntityExists(Response.Status.CONFLICT),
 +    GenericPersistence(Response.Status.BAD_REQUEST),
 +    InvalidSecurityAnswer(Response.Status.BAD_REQUEST),
 +    InvalidEntity(Response.Status.BAD_REQUEST),
 +    InvalidLogger(Response.Status.BAD_REQUEST),
 +    InvalidConnInstance(Response.Status.BAD_REQUEST),
 +    InvalidConnIdConf(Response.Status.BAD_REQUEST),
 +    InvalidPolicy(Response.Status.BAD_REQUEST),
 +    InvalidConf(Response.Status.BAD_REQUEST),
 +    InvalidPath(Response.Status.BAD_REQUEST),
 +    InvalidProvision(Response.Status.BAD_REQUEST),
 +    InvalidReport(Response.Status.BAD_REQUEST),
 +    InvalidReportExec(Response.Status.BAD_REQUEST),
 +    InvalidRelationshipType(Response.Status.BAD_REQUEST),
 +    InvalidAnyType(Response.Status.BAD_REQUEST),
 +    InvalidAnyObject(Response.Status.BAD_REQUEST),
 +    InvalidGroup(Response.Status.BAD_REQUEST),
 +    InvalidSchemaDefinition(Response.Status.BAD_REQUEST),
 +    InvalidSearchExpression(Response.Status.BAD_REQUEST),
 +    InvalidPageOrSize(Response.Status.BAD_REQUEST),
 +    InvalidPropagationTaskExecReport(Response.Status.BAD_REQUEST),
 +    InvalidPlainSchema(Response.Status.BAD_REQUEST),
 +    InvalidDerSchema(Response.Status.BAD_REQUEST),
 +    InvalidVirSchema(Response.Status.BAD_REQUEST),
 +    InvalidMapping(Response.Status.BAD_REQUEST),
 +    InvalidRealm(Response.Status.BAD_REQUEST),
 +    InvalidUser(Response.Status.BAD_REQUEST),
 +    InvalidExternalResource(Response.Status.BAD_REQUEST),
 +    InvalidNotification(Response.Status.BAD_REQUEST),
 +    InvalidPropagationTask(Response.Status.BAD_REQUEST),
 +    InvalidSchedTask(Response.Status.BAD_REQUEST),
 +    InvalidSyncTask(Response.Status.BAD_REQUEST),
 +    InvalidValues(Response.Status.BAD_REQUEST),
 +    NotFound(Response.Status.NOT_FOUND),
 +    RejectedUserCreate(Response.Status.BAD_REQUEST),
 +    RequiredValuesMissing(Response.Status.BAD_REQUEST),
 +    RESTValidation(Response.Status.BAD_REQUEST),
 +    GroupOwnership(Response.Status.BAD_REQUEST),
 +    Scheduling(Response.Status.BAD_REQUEST),
 +    DelegatedAdministration(Response.Status.FORBIDDEN),
 +    UnallowedSchemas(Response.Status.BAD_REQUEST),
 +    Unknown(Response.Status.BAD_REQUEST),
 +    Workflow(Response.Status.BAD_REQUEST);
 +
 +    private final Response.Status responseStatus;
 +
-     private ClientExceptionType(final Response.Status responseStatus) {
++    ClientExceptionType(final Response.Status responseStatus) {
 +        this.responseStatus = responseStatus;
 +    }
 +
 +    public static ClientExceptionType fromHeaderValue(final String exceptionTypeHeaderValue) {
 +        ClientExceptionType result = null;
 +        for (ClientExceptionType type : values()) {
 +            if (exceptionTypeHeaderValue.equals(type.name())) {
 +                result = type;
 +            }
 +        }
 +
 +        if (result == null) {
 +            throw new IllegalArgumentException("Unexpected header value: " + exceptionTypeHeaderValue);
 +        }
 +
 +        return result;
 +    }
 +
 +    public String getInfoHeaderValue(final String value) {
 +        return name() + ":" + value;
 +    }
 +
 +    public Response.Status getResponseStatus() {
 +        return responseStatus;
 +    }
 +
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java
----------------------------------------------------------------------
diff --cc common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java
index 4588a36,0000000..eccb89d
mode 100644,000000..100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/IntMappingType.java
@@@ -1,201 -1,0 +1,201 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *   http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing,
 + * software distributed under the License is distributed on an
 + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 + * KIND, either express or implied.  See the License for the
 + * specific language governing permissions and limitations
 + * under the License.
 + */
 +package org.apache.syncope.common.lib.types;
 +
 +import java.util.Collection;
 +import java.util.EnumSet;
 +import java.util.HashSet;
 +import java.util.Set;
 +
 +import javax.xml.bind.annotation.XmlEnum;
 +
 +/**
 + * Internal attribute mapping type.
 + */
 +@XmlEnum
 +public enum IntMappingType {
 +
 +    // Unfortunately enum type cannot be extended ...
 +    // -------------------------
 +    // User attribute types (the same in UserMappingType)
 +    // -------------------------
 +    UserPlainSchema(AnyTypeKind.USER),
 +    UserDerivedSchema(AnyTypeKind.USER),
 +    UserVirtualSchema(AnyTypeKind.USER),
 +    UserKey(AnyTypeKind.USER),
 +    Username(AnyTypeKind.USER),
 +    Password(AnyTypeKind.USER),
 +    // -------------------------
 +    // Group attribute types (the same in GroupMappingType)
 +    // -------------------------
 +    GroupPlainSchema(AnyTypeKind.GROUP),
 +    GroupDerivedSchema(AnyTypeKind.GROUP),
 +    GroupVirtualSchema(AnyTypeKind.GROUP),
 +    GroupKey(AnyTypeKind.GROUP),
 +    GroupName(AnyTypeKind.GROUP),
 +    GroupOwnerSchema(AnyTypeKind.GROUP),
 +    // -------------------------
 +    // Any attribute types (the same in AnyMappingType)
 +    // -------------------------
 +    AnyObjectPlainSchema(AnyTypeKind.ANY_OBJECT),
 +    AnyObjectDerivedSchema(AnyTypeKind.ANY_OBJECT),
 +    AnyObjectVirtualSchema(AnyTypeKind.ANY_OBJECT),
 +    AnyObjectKey(AnyTypeKind.ANY_OBJECT);
 +
 +    private final AnyTypeKind anyTypeKind;
 +
-     private IntMappingType(final AnyTypeKind anyTypeKind) {
++    IntMappingType(final AnyTypeKind anyTypeKind) {
 +        this.anyTypeKind = anyTypeKind;
 +    }
 +
 +    public AnyTypeKind getAnyTypeKind() {
 +        return anyTypeKind;
 +    }
 +
 +    /**
 +     * Get attribute types for a certain any object type.
 +     *
 +     * @param anyTypeKind any object type
 +     * @param toBeFiltered types to be filtered from the result.
 +     * @return set of attribute types.
 +     */
 +    public static Set<IntMappingType> getAttributeTypes(
 +            final AnyTypeKind anyTypeKind, final Collection<IntMappingType> toBeFiltered) {
 +
 +        final Set<IntMappingType> res = getAttributeTypes(anyTypeKind);
 +        res.removeAll(toBeFiltered);
 +
 +        return res;
 +    }
 +
 +    /**
 +     * Get attribute types for a certain any object type.
 +     *
 +     * @param anyTypeKind any object type
 +     * @return set of attribute types.
 +     */
 +    public static Set<IntMappingType> getAttributeTypes(final AnyTypeKind anyTypeKind) {
 +        EnumSet<?> enumset;
 +
 +        switch (anyTypeKind) {
 +            case GROUP:
 +                enumset = EnumSet.allOf(GroupMappingType.class);
 +                break;
 +
 +            case ANY_OBJECT:
 +                enumset = EnumSet.allOf(AnyMappingType.class);
 +                break;
 +
 +            case USER:
 +            default:
 +                enumset = EnumSet.allOf(UserMappingType.class);
 +                break;
 +        }
 +
 +        final Set<IntMappingType> result = new HashSet<>(enumset.size());
 +        for (Object obj : enumset) {
 +            result.add(IntMappingType.valueOf(obj.toString()));
 +        }
 +
 +        return result;
 +    }
 +
 +    public static Set<IntMappingType> getEmbedded() {
 +        return EnumSet.of(IntMappingType.UserKey, IntMappingType.Username, IntMappingType.Password,
 +                IntMappingType.GroupKey, IntMappingType.GroupName, IntMappingType.GroupOwnerSchema,
 +                IntMappingType.AnyObjectKey);
 +    }
 +
 +    /**
 +     * Check if attribute type belongs to the specified any object type set.
 +     *
 +     * @param anyTypeKind any object type.
 +     * @param type attribute type.
 +     * @return true if attribute type belongs to the specified any object type set.
 +     */
 +    public static boolean contains(final AnyTypeKind anyTypeKind, final String type) {
 +        switch (anyTypeKind) {
 +            case GROUP:
 +                for (GroupMappingType c : GroupMappingType.values()) {
 +                    if (c.name().equals(type)) {
 +                        return true;
 +                    }
 +                }
 +                break;
 +
 +            case ANY_OBJECT:
 +                for (AnyMappingType c : AnyMappingType.values()) {
 +                    if (c.name().equals(type)) {
 +                        return true;
 +                    }
 +                }
 +                break;
 +
 +            case USER:
 +            default:
 +                for (UserMappingType c : UserMappingType.values()) {
 +                    if (c.name().equals(type)) {
 +                        return true;
 +                    }
 +                }
 +                break;
 +        }
 +        return false;
 +    }
 +
 +    /**
 +     * User attribute types.
 +     */
 +    private enum UserMappingType {
 +
 +        UserPlainSchema,
 +        UserDerivedSchema,
 +        UserVirtualSchema,
 +        UserKey,
 +        Username,
 +        Password;
 +
 +    }
 +
 +    /**
 +     * Group attribute types.
 +     */
 +    private enum GroupMappingType {
 +
 +        GroupPlainSchema,
 +        GroupDerivedSchema,
 +        GroupVirtualSchema,
 +        GroupKey,
 +        GroupName,
 +        GroupOwnerSchema;
 +
 +    }
 +
 +    /**
 +     * Any attribute types.
 +     */
 +    private enum AnyMappingType {
 +
 +        AnyObjectPlainSchema,
 +        AnyObjectDerivedSchema,
 +        AnyObjectVirtualSchema,
 +        AnyObjectKey;
 +
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/common/lib/src/main/java/org/apache/syncope/common/lib/types/TaskType.java
----------------------------------------------------------------------
diff --cc common/lib/src/main/java/org/apache/syncope/common/lib/types/TaskType.java
index a60a5af,0000000..ce1b5cd
mode 100644,000000..100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/TaskType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/TaskType.java
@@@ -1,54 -1,0 +1,54 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *   http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing,
 + * software distributed under the License is distributed on an
 + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 + * KIND, either express or implied.  See the License for the
 + * specific language governing permissions and limitations
 + * under the License.
 + */
 +package org.apache.syncope.common.lib.types;
 +
 +import javax.xml.bind.annotation.XmlEnum;
 +
 +@XmlEnum
 +public enum TaskType {
 +
 +    PROPAGATION("propagation"),
 +    NOTIFICATION("notification"),
 +    SCHEDULED("sched"),
 +    SYNCHRONIZATION("sync"),
 +    PUSH("push");
 +
 +    private final String name;
 +
-     private TaskType(final String name) {
++    TaskType(final String name) {
 +        this.name = name;
 +    }
 +
 +    @Override
 +    public String toString() {
 +        return name;
 +    }
 +
 +    public static TaskType fromString(final String name) {
 +        if (name != null) {
 +            for (TaskType t : TaskType.values()) {
 +                if (t.name.equalsIgnoreCase(name)) {
 +                    return t;
 +                }
 +            }
 +        }
 +
 +        return null;
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/Preference.java
----------------------------------------------------------------------
diff --cc common/rest-api/src/main/java/org/apache/syncope/common/rest/api/Preference.java
index a448c03,0000000..8d21e54
mode 100644,000000..100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/Preference.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/Preference.java
@@@ -1,59 -1,0 +1,59 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *   http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing,
 + * software distributed under the License is distributed on an
 + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 + * KIND, either express or implied.  See the License for the
 + * specific language governing permissions and limitations
 + * under the License.
 + */
 +package org.apache.syncope.common.rest.api;
 +
 +/**
 + * Preferences available to be specified during requests.
 + *
 + * @see RESTHeaders#PREFER
 + * @see RESTHeaders#PREFERENCE_APPLIED
 + */
 +public enum Preference {
 +
 +    NONE(""),
 +    RETURN_CONTENT("return-content"),
 +    RETURN_NO_CONTENT("return-no-content");
 +
 +    private final String literal;
 +
-     private Preference(final String literal) {
++    Preference(final String literal) {
 +        this.literal = literal;
 +    }
 +
 +    @Override
 +    public String toString() {
 +        return literal;
 +    }
 +
 +    public static Preference fromString(final String literal) {
 +        Preference result = null;
 +
 +        for (Preference preference : values()) {
 +            if (preference.toString().equalsIgnoreCase(literal)) {
 +                result = preference;
 +            }
 +        }
 +
 +        if (result == null) {
 +            result = NONE;
 +        }
 +
 +        return result;
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
----------------------------------------------------------------------
diff --cc core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
index e85058c,0000000..9a796ef
mode 100644,000000..100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractAnyLogic.java
@@@ -1,259 -1,0 +1,259 @@@
 +/*
 + * 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.logic;
 +
 +import java.util.ArrayList;
 +import java.util.Collection;
 +import java.util.HashSet;
 +import java.util.List;
 +import java.util.Set;
 +import org.apache.commons.collections4.CollectionUtils;
 +import org.apache.commons.collections4.Predicate;
 +import org.apache.commons.lang3.tuple.ImmutablePair;
 +import org.apache.commons.lang3.tuple.Pair;
 +import org.apache.syncope.common.lib.SyncopeClientException;
 +import org.apache.syncope.common.lib.patch.AnyPatch;
 +import org.apache.syncope.common.lib.to.AnyTO;
 +import org.apache.syncope.common.lib.to.GroupTO;
 +import org.apache.syncope.common.lib.to.UserTO;
 +import org.apache.syncope.common.lib.types.AnyTypeKind;
 +import org.apache.syncope.common.lib.types.ClientExceptionType;
 +import org.apache.syncope.core.misc.RealmUtils;
 +import org.apache.syncope.core.misc.TemplateUtils;
 +import org.apache.syncope.core.misc.security.DelegatedAdministrationException;
 +import org.apache.syncope.core.misc.spring.ApplicationContextProvider;
 +import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
 +import org.apache.syncope.core.persistence.api.dao.RealmDAO;
 +import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
 +import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
 +import org.apache.syncope.core.persistence.api.entity.AnyType;
 +import org.apache.syncope.core.persistence.api.entity.Realm;
 +import org.apache.syncope.core.provisioning.api.LogicActions;
 +import org.springframework.beans.factory.annotation.Autowired;
 +import org.springframework.beans.factory.support.AbstractBeanDefinition;
 +
 +public abstract class AbstractAnyLogic<TO extends AnyTO, P extends AnyPatch>
 +        extends AbstractResourceAssociator<TO> {
 +
 +    @Autowired
 +    private RealmDAO realmDAO;
 +
 +    @Autowired
 +    private AnyTypeDAO anyTypeDAO;
 +
 +    @Autowired
 +    private TemplateUtils templateUtils;
 +
 +    private List<LogicActions> getActions(final Realm realm) {
 +        List<LogicActions> actions = new ArrayList<>();
 +
 +        for (String className : realm.getActionsClassNames()) {
 +            try {
 +                Class<?> actionsClass = Class.forName(className);
 +                LogicActions logicActions = (LogicActions) ApplicationContextProvider.getBeanFactory().
 +                        createBean(actionsClass, AbstractBeanDefinition.AUTOWIRE_BY_TYPE, true);
 +
 +                actions.add(logicActions);
 +            } catch (Exception e) {
 +                LOG.warn("Class '{}' not found", className, e);
 +            }
 +        }
 +
 +        return actions;
 +    }
 +
 +    protected Pair<TO, List<LogicActions>> beforeCreate(final TO input) {
 +        Realm realm = realmDAO.find(input.getRealm());
 +        if (realm == null) {
 +            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRealm);
 +            sce.getElements().add(input.getRealm());
 +            throw sce;
 +        }
 +
 +        AnyType anyType = input instanceof UserTO
 +                ? anyTypeDAO.findUser()
 +                : input instanceof GroupTO
 +                        ? anyTypeDAO.findGroup()
 +                        : anyTypeDAO.find(input.getType());
 +        if (anyType == null) {
 +            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidAnyType);
 +            sce.getElements().add(input.getType());
 +            throw sce;
 +        }
 +
 +        TO any = input;
 +
 +        templateUtils.apply(any, realm.getTemplate(anyType));
 +
 +        List<LogicActions> actions = getActions(realm);
 +        for (LogicActions action : actions) {
 +            any = action.beforeCreate(any);
 +        }
 +
 +        LOG.debug("Input: {}\nOutput: {}\n", input, any);
 +
 +        return ImmutablePair.of(any, actions);
 +    }
 +
 +    protected TO afterCreate(final TO input, final List<LogicActions> actions) {
 +        TO any = input;
 +
 +        for (LogicActions action : actions) {
 +            any = action.afterCreate(any);
 +        }
 +
 +        return any;
 +    }
 +
 +    protected Pair<P, List<LogicActions>> beforeUpdate(final P input, final String realmPath) {
 +        Realm realm = realmDAO.find(realmPath);
 +        if (realm == null) {
 +            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRealm);
 +            sce.getElements().add(realmPath);
 +            throw sce;
 +        }
 +
 +        P mod = input;
 +
 +        List<LogicActions> actions = getActions(realm);
 +        for (LogicActions action : actions) {
 +            mod = action.beforeUpdate(mod);
 +        }
 +
 +        LOG.debug("Input: {}\nOutput: {}\n", input, mod);
 +
 +        return ImmutablePair.of(mod, actions);
 +    }
 +
 +    protected TO afterUpdate(final TO input, final List<LogicActions> actions) {
 +        TO any = input;
 +
 +        for (LogicActions action : actions) {
 +            any = action.afterUpdate(any);
 +        }
 +
 +        return any;
 +    }
 +
 +    protected Pair<TO, List<LogicActions>> beforeDelete(final TO input) {
 +        Realm realm = realmDAO.find(input.getRealm());
 +        if (realm == null) {
 +            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRealm);
 +            sce.getElements().add(input.getRealm());
 +            throw sce;
 +        }
 +
 +        TO any = input;
 +
 +        List<LogicActions> actions = getActions(realm);
 +        for (LogicActions action : actions) {
 +            any = action.beforeDelete(any);
 +        }
 +
 +        LOG.debug("Input: {}\nOutput: {}\n", input, any);
 +
 +        return ImmutablePair.of(any, actions);
 +    }
 +
 +    protected TO afterDelete(final TO input, final List<LogicActions> actions) {
 +        TO any = input;
 +
 +        for (LogicActions action : actions) {
 +            any = action.afterDelete(any);
 +        }
 +
 +        return any;
 +    }
 +
 +    private static class StartsWithPredicate implements Predicate<String> {
 +
 +        private final Collection<String> targets;
 +
-         public StartsWithPredicate(final Collection<String> targets) {
++        StartsWithPredicate(final Collection<String> targets) {
 +            this.targets = targets;
 +        }
 +
 +        @Override
 +        public boolean evaluate(final String realm) {
 +            return CollectionUtils.exists(targets, new Predicate<String>() {
 +
 +                @Override
 +                public boolean evaluate(final String target) {
 +                    return realm.startsWith(target);
 +                }
 +            });
 +        }
 +
 +    }
 +
 +    protected Set<String> getEffectiveRealms(
 +            final Set<String> allowedRealms, final Collection<String> requestedRealms) {
 +
 +        Set<String> allowed = RealmUtils.normalize(allowedRealms);
 +        Set<String> requested = RealmUtils.normalize(requestedRealms);
 +
 +        Set<String> effective = new HashSet<>();
 +        CollectionUtils.select(requested, new StartsWithPredicate(allowed), effective);
 +        CollectionUtils.select(allowed, new StartsWithPredicate(requested), effective);
 +
 +        return effective;
 +    }
 +
 +    protected void securityChecks(final Set<String> effectiveRealms, final String realm, final Long key) {
 +        if (!CollectionUtils.exists(effectiveRealms, new Predicate<String>() {
 +
 +            @Override
 +            public boolean evaluate(final String ownedRealm) {
 +                return realm.startsWith(ownedRealm);
 +            }
 +        })) {
 +
 +            throw new DelegatedAdministrationException(
 +                    this instanceof UserLogic
 +                            ? AnyTypeKind.USER
 +                            : this instanceof GroupLogic
 +                                    ? AnyTypeKind.GROUP
 +                                    : AnyTypeKind.ANY_OBJECT,
 +                    key);
 +        }
 +    }
 +
 +    public abstract TO read(Long key);
 +
 +    public abstract int count(List<String> realms);
 +
 +    public abstract TO create(TO anyTO);
 +
 +    public abstract TO update(P anyPatch);
 +
 +    public abstract TO delete(Long key);
 +
 +    public abstract List<TO> list(
 +            int page, int size, List<OrderByClause> orderBy,
 +            List<String> realms,
 +            boolean details);
 +
 +    public abstract List<TO> search(
 +            SearchCond searchCondition,
 +            int page, int size, List<OrderByClause> orderBy,
 +            List<String> realms,
 +            boolean details);
 +
 +    public abstract int searchCount(SearchCond searchCondition, List<String> realms);
 +}


[2/8] syncope git commit: Upgrading surefire, failsafe and checkstyle plugins

Posted by il...@apache.org.
Upgrading surefire, failsafe and checkstyle plugins


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

Branch: refs/heads/master
Commit: 503097da8cddb197db8f54378f3721c46f32fb3f
Parents: 03c9bc2
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Mon Oct 19 15:00:42 2015 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Mon Oct 19 15:00:42 2015 +0200

----------------------------------------------------------------------
 pom.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/503097da/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e4b3787..4ef0802 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1082,7 +1082,7 @@ under the License.
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
-          <version>2.18.1</version>
+          <version>2.19</version>
           <configuration>
             <redirectTestOutputToFile>true</redirectTestOutputToFile>
             <encoding>utf-8</encoding>
@@ -1106,7 +1106,7 @@ under the License.
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-failsafe-plugin</artifactId>
-          <version>2.18.1</version>
+          <version>2.19</version>
           <configuration>
             <redirectTestOutputToFile>true</redirectTestOutputToFile>
             <encoding>utf-8</encoding>
@@ -1204,7 +1204,7 @@ under the License.
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-checkstyle-plugin</artifactId>
-          <version>2.15</version>
+          <version>2.17</version>
           <dependencies>
             <dependency>
               <groupId>org.apache.syncope</groupId>


[6/8] syncope git commit: Upgrading surefire, failsafe and checkstyle plugins

Posted by il...@apache.org.
http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/ReportCommand.java
----------------------------------------------------------------------
diff --cc client/cli/src/main/java/org/apache/syncope/client/cli/commands/ReportCommand.java
index 2178d22,0000000..c6bdb48
mode 100644,000000..100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/ReportCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/ReportCommand.java
@@@ -1,351 -1,0 +1,351 @@@
 +/*
 + * 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.client.cli.commands;
 +
 +import java.io.IOException;
 +import java.io.SequenceInputStream;
 +import java.util.ArrayList;
 +import java.util.Arrays;
 +import java.util.List;
 +import javax.xml.parsers.ParserConfigurationException;
 +import javax.xml.transform.TransformerException;
 +import javax.xml.ws.WebServiceException;
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.syncope.client.cli.Command;
 +import org.apache.syncope.client.cli.Input;
 +import org.apache.syncope.client.cli.SyncopeServices;
 +import org.apache.syncope.client.cli.messages.Messages;
 +import org.apache.syncope.client.cli.util.XMLUtils;
 +import org.apache.syncope.common.lib.SyncopeClientException;
 +import org.apache.syncope.common.lib.to.ReportExecTO;
 +import org.apache.syncope.common.lib.to.ReportTO;
 +import org.apache.syncope.common.lib.types.JobStatusType;
 +import org.apache.syncope.common.lib.types.ReportExecExportFormat;
 +import org.apache.syncope.common.rest.api.service.ReportService;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +import org.xml.sax.SAXException;
 +
 +@Command(name = "report")
 +public class ReportCommand extends AbstractCommand {
 +
 +    private static final Logger LOG = LoggerFactory.getLogger(ReportCommand.class);
 +
 +    private static final String HELP_MESSAGE = "Usage: report [options]\n"
 +            + "  Options:\n"
 +            + "    --help \n"
 +            + "    --list \n"
 +            + "    --read \n"
 +            + "       Syntax: --read {REPORT-ID} {REPORT-ID} [...] \n"
 +            + "    --delete \n"
 +            + "       Syntax: --delete {REPORT-ID} {REPORT-ID} [...]\n"
 +            + "    --execute \n"
 +            + "       Syntax: --execute {REPORT-ID} \n"
 +            + "    --read-execution \n"
 +            + "       Syntax: --read-execution {EXECUTION-ID} {EXECUTION-ID} [...]\n"
 +            + "    --delete-execution \n"
 +            + "       Syntax: --delete-execution {EXECUTION-ID} {EXECUTION-ID} [...]\n"
 +            + "    --export-execution-result \n"
 +            + "       Syntax: --export-execution-result {EXECUTION-ID} {EXECUTION-ID} [...] {FORMAT}\n"
 +            + "          Format: CSV / HTML / PDF / XML / RTF"
 +            + "    --reportlet-class";
 +
 +    @Override
 +    public void execute(final Input input) {
 +        LOG.debug("Option: {}", input.getOption());
 +        LOG.debug("Parameters:");
 +        for (final String parameter : input.getParameters()) {
 +            LOG.debug("   > " + parameter);
 +        }
 +
 +        String[] parameters = input.getParameters();
 +
 +        if (StringUtils.isBlank(input.getOption())) {
 +            input.setOption(Options.HELP.getOptionName());
 +        }
 +
 +        final ReportService reportService = SyncopeServices.get(ReportService.class);
 +        switch (Options.fromName(input.getOption())) {
 +            case LIST:
 +                try {
 +                    for (final ReportTO reportTO : reportService.list()) {
 +                        System.out.println(reportTO);
 +                    }
 +                } catch (final SyncopeClientException ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                }
 +                break;
 +            case LIST_JOBS:
 +                try {
 +                    for (final JobStatusType jobStatusType : JobStatusType.values()) {
 +                        System.out.println("Report execution for " + jobStatusType);
 +                        final List<ReportExecTO> reportExecTOs = reportService.listJobs(jobStatusType);
 +                        for (final ReportExecTO reportExecTO : reportExecTOs) {
 +                            System.out.println(" - Report execution id: " + reportExecTO.getKey());
 +                            System.out.println(" - Report execution status: " + reportExecTO.getStatus());
 +                            System.out.println(" - Report execution start date: " + reportExecTO.getStartDate());
 +                            System.out.println(" - Report execution end date: " + reportExecTO.getEndDate());
 +                            System.out.println();
 +                        }
 +                    }
 +                } catch (final SyncopeClientException ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                }
 +                break;
 +            case READ:
 +                final String readErrorMessage = "report --read {REPORT-ID} {REPORT-ID} [...]";
 +                if (parameters.length >= 1) {
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            System.out.println(reportService.read(Long.valueOf(parameter)));
 +                        } catch (final NumberFormatException ex) {
 +                            Messages.printIdNotNumberDeletedMessage("report", parameter);
 +                        } catch (final WebServiceException | SyncopeClientException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Report", parameter);
 +                            } else {
 +                                Messages.printMessage(ex.getMessage());
 +                            }
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(readErrorMessage);
 +                }
 +                break;
 +            case DELETE:
 +                final String deleteErrorMessage = "report --delete {REPORT-ID} {REPORT-ID} [...]";
 +
 +                if (parameters.length >= 1) {
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            reportService.delete(Long.valueOf(parameter));
 +                            Messages.printDeletedMessage("Report", parameter);
 +                        } catch (final WebServiceException | SyncopeClientException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Report", parameter);
 +                            } else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
 +                                Messages.printMessage("You cannot delete report " + parameter);
 +                            } else {
 +                                Messages.printMessage(ex.getMessage());
 +                            }
 +                        } catch (final NumberFormatException ex) {
 +                            Messages.printIdNotNumberDeletedMessage("report", parameter);
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(deleteErrorMessage);
 +                }
 +                break;
 +            case EXECUTE:
 +                final String executeErrorMessage = "report --execute {REPORT-ID}";
 +
 +                if (parameters.length == 1) {
 +
 +                    try {
 +                        final Long reportIdToExecute = Long.valueOf(parameters[0]);
 +                        reportService.execute(reportIdToExecute);
 +                        final List<ReportExecTO> executionList
 +                                = reportService.read(reportIdToExecute).getExecutions();
 +                        final ReportExecTO lastExecution = executionList.get(executionList.size() - 1);
 +                        System.out.println(" - Report execution id: " + lastExecution.getKey());
 +                        System.out.println(" - Report execution status: " + lastExecution.getStatus());
 +                        System.out.println(" - Report execution start date: " + lastExecution.getStartDate());
 +                    } catch (final WebServiceException | SyncopeClientException ex) {
 +                        System.out.println("Error:");
 +                        if (ex.getMessage().startsWith("NotFound")) {
 +                            Messages.printNofFoundMessage("Report", parameters[0]);
 +                        } else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
 +                            Messages.printMessage("You cannot delete report " + parameters[0]);
 +                        } else {
 +                            Messages.printMessage(ex.getMessage());
 +                        }
 +                    } catch (final NumberFormatException ex) {
 +                        Messages.printIdNotNumberDeletedMessage("report", parameters[0]);
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(executeErrorMessage);
 +                }
 +                break;
 +            case READ_EXECUTION:
 +                final String readExecutionErrorMessage = "report --read-execution {EXECUTION-ID} {EXECUTION-ID} [...]";
 +
 +                if (parameters.length >= 1) {
 +                    for (final String parameter : parameters) {
 +
 +                        try {
 +                            ReportExecTO reportExecTO = reportService.readExecution(Long.valueOf(parameter));
 +                            System.out.println(" - Report execution id: " + reportExecTO.getKey());
 +                            System.out.println(" - Report execution status: " + reportExecTO.getStatus());
 +                            System.out.println(" - Report execution start date: " + reportExecTO.getStartDate());
 +                            System.out.println(" - Report execution end date: " + reportExecTO.getEndDate());
 +                        } catch (final WebServiceException | SyncopeClientException ex) {
 +                            System.out.println("Error:");
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Report", parameter);
 +                            } else {
 +                                Messages.printMessage(ex.getMessage());
 +                            }
 +                        } catch (final NumberFormatException ex) {
 +                            Messages.printIdNotNumberDeletedMessage("report", parameter);
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(readExecutionErrorMessage);
 +                }
 +                break;
 +            case DELETE_EXECUTION:
 +                final String deleteExecutionErrorMessage
 +                        = "report --delete-execution {EXECUTION-ID} {EXECUTION-ID} [...]";
 +
 +                if (parameters.length >= 1) {
 +                    for (final String parameter : parameters) {
 +
 +                        try {
 +                            reportService.deleteExecution(Long.valueOf(parameter));
 +                            Messages.printDeletedMessage("Report execution", parameter);
 +                        } catch (final WebServiceException | SyncopeClientException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Report", parameter);
 +                            } else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
 +                                System.out.println(" - You cannot delete report " + parameter);
 +                            } else {
 +                                System.out.println(ex.getMessage());
 +                            }
 +                        } catch (final NumberFormatException ex) {
 +                            Messages.printIdNotNumberDeletedMessage("report", parameter);
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(deleteExecutionErrorMessage);
 +                }
 +                break;
 +            case EXPORT_EXECUTION_RESULT:
 +                final String exportExecutionErrorMessage
 +                        = "report --export-execution-result {EXECUTION-ID} {EXECUTION-ID} [...] {FORMAT}\n"
 +                        + "          Format: CSV / HTML / PDF / XML / RTF";
 +
 +                if (parameters.length >= 2) {
 +                    parameters = Arrays.copyOf(parameters, parameters.length - 1);
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            final ReportExecExportFormat format = ReportExecExportFormat.valueOf(input.lastParameter());
 +                            final Long exportId = Long.valueOf(parameter);
 +                            final SequenceInputStream report = (SequenceInputStream) reportService.
 +                                    exportExecutionResult(exportId, format).getEntity();
 +                            switch (format) {
 +                                case XML:
 +                                    final String xmlFinalName = "export_" + exportId + ".xml";
 +                                    XMLUtils.createXMLFile(report, xmlFinalName);
 +                                    Messages.printMessage(xmlFinalName + " successfully created");
 +                                    break;
 +                                case CSV:
 +                                    Messages.printMessage(format + " doesn't supported");
 +                                    break;
 +                                case PDF:
 +                                    Messages.printMessage(format + " doesn't supported");
 +                                    break;
 +                                case HTML:
 +                                    Messages.printMessage(format + " doesn't supported");
 +                                    break;
 +                                case RTF:
 +                                    Messages.printMessage(format + " doesn't supported");
 +                                    break;
 +                                default:
 +                                    Messages.printMessage(format + " doesn't supported");
 +                                    break;
 +                            }
 +                        } catch (final WebServiceException | SyncopeClientException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Report", parameter);
 +                            } else {
 +                                System.out.println(ex.getMessage());
 +                            }
 +                        } catch (final NumberFormatException ex) {
 +                            Messages.printIdNotNumberDeletedMessage("report", parameter);
 +                        } catch (IOException | ParserConfigurationException | SAXException | TransformerException e) {
 +                            System.out.println(" - Error creating " + "export_" + parameter + " " + e.getMessage());
 +                        } catch (final IllegalArgumentException ex) {
 +                            Messages.printTypeNotValidMessage(
 +                                    "format", input.firstParameter(),
 +                                    fromEnumToArray(ReportExecExportFormat.class));
 +                        }
 +                        break;
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(exportExecutionErrorMessage);
 +                }
 +                break;
 +            case HELP:
 +                System.out.println(HELP_MESSAGE);
 +                break;
 +            default:
 +                Messages.printDefaultMessage(input.getOption(), HELP_MESSAGE);
 +        }
 +    }
 +
 +    @Override
 +    public String getHelpMessage() {
 +        return HELP_MESSAGE;
 +    }
 +
 +    private enum Options {
 +
 +        HELP("--help"),
 +        LIST("--list"),
 +        LIST_JOBS("--list-jobs"),
 +        READ("--read"),
 +        DELETE("--delete"),
 +        EXECUTE("--execute"),
 +        READ_EXECUTION("--read-execution"),
 +        DELETE_EXECUTION("--delete-execution"),
 +        EXPORT_EXECUTION_RESULT("--export-execution-result");
 +
 +        private final String optionName;
 +
-         private Options(final String optionName) {
++        Options(final String optionName) {
 +            this.optionName = optionName;
 +        }
 +
 +        public String getOptionName() {
 +            return optionName;
 +        }
 +
 +        public boolean equalsOptionName(final String otherName) {
 +            return (otherName == null) ? false : optionName.equals(otherName);
 +        }
 +
 +        public static Options fromName(final String name) {
 +            Options optionToReturn = HELP;
 +            for (final Options option : Options.values()) {
 +                if (option.equalsOptionName(name)) {
 +                    optionToReturn = option;
 +                }
 +            }
 +            return optionToReturn;
 +        }
 +
 +        public static List<String> toList() {
 +            final List<String> options = new ArrayList<>();
 +            for (final Options value : values()) {
 +                options.add(value.getOptionName());
 +            }
 +            return options;
 +        }
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/SchemaCommand.java
----------------------------------------------------------------------
diff --cc client/cli/src/main/java/org/apache/syncope/client/cli/commands/SchemaCommand.java
index 7cb9ca1,0000000..826d8dc
mode 100644,000000..100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/SchemaCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/SchemaCommand.java
@@@ -1,308 -1,0 +1,308 @@@
 +/*
 + * 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.client.cli.commands;
 +
 +import static org.apache.syncope.client.cli.commands.AbstractCommand.fromEnumToArray;
 +
 +import java.util.ArrayList;
 +import java.util.Arrays;
 +import java.util.List;
 +import javax.xml.ws.WebServiceException;
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.syncope.client.cli.Command;
 +import org.apache.syncope.client.cli.Input;
 +import org.apache.syncope.client.cli.SyncopeServices;
 +import org.apache.syncope.client.cli.messages.Messages;
 +import org.apache.syncope.common.lib.SyncopeClientException;
 +import org.apache.syncope.common.lib.to.AbstractSchemaTO;
 +import org.apache.syncope.common.lib.to.DerSchemaTO;
 +import org.apache.syncope.common.lib.to.PlainSchemaTO;
 +import org.apache.syncope.common.lib.to.VirSchemaTO;
 +import org.apache.syncope.common.lib.types.SchemaType;
 +import org.apache.syncope.common.rest.api.service.SchemaService;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
 +@Command(name = "schema")
 +public class SchemaCommand extends AbstractCommand {
 +
 +    private static final Logger LOG = LoggerFactory.getLogger(SchemaCommand.class);
 +
 +    private static final String HELP_MESSAGE = "Usage: schema [options]\n"
 +            + "  Options:\n"
 +            + "    --help \n"
 +            + "    --list-all\n"
 +            + "    --list-plain\n"
 +            + "    --list-derived\n"
 +            + "    --list-virtual\n"
 +            + "    --list {SCHEMA-TYPE}\n"
 +            + "       Schema type: PLAIN / DERIVED / VIRTUAL";
 +
 +    @Override
 +    public void execute(final Input input) {
 +        LOG.debug("Option: {}", input.getOption());
 +        LOG.debug("Parameters:");
 +        for (final String parameter : input.getParameters()) {
 +            LOG.debug("   > " + parameter);
 +        }
 +
 +        String[] parameters = input.getParameters();
 +
 +        if (StringUtils.isBlank(input.getOption())) {
 +            input.setOption(Options.HELP.getOptionName());
 +        }
 +
 +        final SchemaService schemaService = SyncopeServices.get(SchemaService.class);
 +        switch (Options.fromName(input.getOption())) {
 +            case LIST:
 +                final String listErrorMessage = "schema --list {SCHEMA-TYPE}\n"
 +                        + "   Schema type: PLAIN / DERIVED / VIRTUAL";
 +                if (parameters.length == 1) {
 +                    try {
 +                        final SchemaType schemaType = SchemaType.valueOf(input.firstParameter());
 +                        System.out.println("");
 +                        for (final AbstractSchemaTO schemaTO : schemaService.list(schemaType)) {
 +                            switch (schemaType) {
 +                                case PLAIN:
 +                                    System.out.println(" - Schema key: " + ((PlainSchemaTO) schemaTO).getKey());
 +                                    System.out.println("      type: " + ((PlainSchemaTO) schemaTO).getType());
 +                                    System.out.println("      is mandatory: "
 +                                            + ((PlainSchemaTO) schemaTO).getMandatoryCondition());
 +                                    break;
 +                                case DERIVED:
 +                                    System.out.println(" - Schema key: " + ((DerSchemaTO) schemaTO).getKey());
 +                                    System.out.println("      expression: " + ((DerSchemaTO) schemaTO).getExpression());
 +                                    break;
 +                                case VIRTUAL:
 +                                    System.out.println(" - Schema key: " + ((VirSchemaTO) schemaTO).getKey());
 +                                    break;
 +                                default:
 +                                    break;
 +                            }
 +                        }
 +                        System.out.println("");
 +                    } catch (final SyncopeClientException ex) {
 +                        Messages.printMessage(ex.getMessage());
 +                    } catch (final IllegalArgumentException ex) {
 +                        Messages.printTypeNotValidMessage(
 +                                "schema", input.firstParameter(), fromEnumToArray(SchemaType.class));
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(listErrorMessage);
 +                }
 +                break;
 +            case LIST_ALL:
 +                try {
 +                    for (final SchemaType value : SchemaType.values()) {
 +                        System.out.println("");
 +                        System.out.println(value + " schemas");
 +                        for (final AbstractSchemaTO schemaTO : schemaService.list(value)) {
 +                            System.out.println("   - Name: " + schemaTO.getKey() + " type: "
 +                                    + schemaTO.getAnyTypeClass());
 +                        }
 +                        System.out.println("");
 +                    }
 +                } catch (final SyncopeClientException | WebServiceException ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                }
 +                break;
 +            case LIST_PLAIN:
 +                try {
 +                    System.out.println("");
 +                    for (final AbstractSchemaTO schemaTO : schemaService.list(SchemaType.PLAIN)) {
 +                        System.out.println(" - Schema key: " + ((PlainSchemaTO) schemaTO).getKey());
 +                        System.out.println("      type: " + ((PlainSchemaTO) schemaTO).getType());
 +                        System.out.println("      is mandatory: "
 +                                + ((PlainSchemaTO) schemaTO).getMandatoryCondition());
 +                    }
 +                    System.out.println("");
 +                } catch (final SyncopeClientException | WebServiceException ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                }
 +                break;
 +            case LIST_DERIVED:
 +                try {
 +                    System.out.println("");
 +                    for (final AbstractSchemaTO schemaTO : schemaService.list(SchemaType.DERIVED)) {
 +                        System.out.println(" - Schema key: " + ((DerSchemaTO) schemaTO).getKey());
 +                        System.out.println("      expression: " + ((DerSchemaTO) schemaTO).getExpression());
 +                    }
 +                    System.out.println("");
 +                } catch (final SyncopeClientException | WebServiceException ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                }
 +                break;
 +            case LIST_VIRTUAL:
 +                try {
 +                    System.out.println("");
 +                    for (final AbstractSchemaTO schemaTO : schemaService.list(SchemaType.VIRTUAL)) {
 +                        System.out.println(" - Schema key: " + ((VirSchemaTO) schemaTO).getKey());
 +                    }
 +                    System.out.println("");
 +                } catch (final SyncopeClientException | WebServiceException ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                }
 +                break;
 +            case READ:
 +                final String readErrorMessage = "schema --read {SCHEMA-TYPE} {SCHEMA-KEY}\n"
 +                        + "   Schema type: PLAIN / DERIVED / VIRTUAL";
 +                if (parameters.length >= 2) {
 +                    parameters = Arrays.copyOfRange(parameters, 1, parameters.length);
 +                    try {
 +                        final SchemaType schemaType = SchemaType.valueOf(input.firstParameter());
 +                        System.out.println("");
 +                        for (final String parameter : parameters) {
 +                            final AbstractSchemaTO schemaTO = schemaService.read(schemaType, parameter);
 +                            switch (schemaType) {
 +                                case PLAIN:
 +                                    System.out.println(" - Schema key: " + ((PlainSchemaTO) schemaTO).getKey());
 +                                    System.out.println("      any type class: "
 +                                            + ((PlainSchemaTO) schemaTO).getAnyTypeClass());
 +                                    System.out.println("      conversion pattern: "
 +                                            + ((PlainSchemaTO) schemaTO).getConversionPattern());
 +                                    System.out.println("      enumeration keys: "
 +                                            + ((PlainSchemaTO) schemaTO).getEnumerationKeys());
 +                                    System.out.println("      enumeration values: "
 +                                            + ((PlainSchemaTO) schemaTO).getEnumerationValues());
 +                                    System.out.println("      mandatory condition: "
 +                                            + ((PlainSchemaTO) schemaTO).getMandatoryCondition());
 +                                    System.out.println("      mime type: " + ((PlainSchemaTO) schemaTO).getMimeType());
 +                                    System.out.println("      secret key: "
 +                                            + ((PlainSchemaTO) schemaTO).getSecretKey());
 +                                    System.out.println("      validator class: "
 +                                            + ((PlainSchemaTO) schemaTO).getValidatorClass());
 +                                    System.out.println("      cipher algorithm: "
 +                                            + ((PlainSchemaTO) schemaTO).getCipherAlgorithm());
 +                                    System.out.println("      TYPE: "
 +                                            + ((PlainSchemaTO) schemaTO).getType());
 +                                    break;
 +                                case DERIVED:
 +                                    System.out.println(" - Schema key: " + ((DerSchemaTO) schemaTO).getKey());
 +                                    System.out.println("      any type class: "
 +                                            + ((DerSchemaTO) schemaTO).getAnyTypeClass());
 +                                    System.out.println("      expression: " + ((DerSchemaTO) schemaTO).getExpression());
 +                                    break;
 +                                case VIRTUAL:
 +                                    System.out.println(" - Schema key: " + ((VirSchemaTO) schemaTO).getKey());
 +                                    System.out.println("      any type class: "
 +                                            + ((VirSchemaTO) schemaTO).getAnyTypeClass());
 +                                    break;
 +                                default:
 +                                    break;
 +                            }
 +                            System.out.println("");
 +                        }
 +                    } catch (final SyncopeClientException | WebServiceException ex) {
 +                        if (ex.getMessage().startsWith("NotFound")) {
 +                            Messages.printNofFoundMessage("Schema", parameters[0]);
 +                        } else {
 +                            Messages.printMessage(ex.getMessage());
 +                        }
 +                    } catch (final IllegalArgumentException ex) {
 +                        Messages.printTypeNotValidMessage(
 +                                "schema", input.firstParameter(), fromEnumToArray(SchemaType.class));
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(readErrorMessage);
 +                }
 +                break;
 +            case DELETE:
 +                final String deleteErrorMessage = "schema --delete {SCHEMA-TYPE} {SCHEMA-KEY}\n"
 +                        + "   Schema type: PLAIN / DERIVED / VIRTUAL";
 +                if (parameters.length >= 2) {
 +                    parameters = Arrays.copyOfRange(parameters, 1, parameters.length);
 +                    try {
 +                        for (final String parameter : parameters) {
 +                            schemaService.delete(SchemaType.valueOf(input.firstParameter()), parameter);
 +                            Messages.printDeletedMessage("Schema", parameter);
 +                        }
 +                    } catch (final SyncopeClientException | WebServiceException ex) {
 +                        if (ex.getMessage().startsWith("NotFound")) {
 +                            Messages.printNofFoundMessage("Schema", parameters[0]);
 +                        } else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
 +                            Messages.printMessage(
 +                                    "You cannot delete schema " + parameters[0]);
 +                        } else {
 +                            Messages.printMessage(ex.getMessage());
 +                        }
 +                    } catch (final IllegalArgumentException ex) {
 +                        Messages.printTypeNotValidMessage(
 +                                "schema", input.firstParameter(), fromEnumToArray(SchemaType.class));
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(deleteErrorMessage);
 +                }
 +                break;
 +            case HELP:
 +                System.out.println(HELP_MESSAGE);
 +                break;
 +            default:
 +                Messages.printDefaultMessage(input.getOption(), HELP_MESSAGE);
 +        }
 +    }
 +
 +    @Override
 +    public String getHelpMessage() {
 +        return HELP_MESSAGE;
 +    }
 +
 +    private enum Options {
 +
 +        HELP("--help"),
 +        LIST("--list"),
 +        LIST_ALL("--list-all"),
 +        LIST_PLAIN("--list-plain"),
 +        LIST_DERIVED("--list-derived"),
 +        LIST_VIRTUAL("--list-virtual"),
 +        READ("--read"),
 +        DELETE("--delete");
 +
 +        private final String optionName;
 +
-         private Options(final String optionName) {
++        Options(final String optionName) {
 +            this.optionName = optionName;
 +        }
 +
 +        public String getOptionName() {
 +            return optionName;
 +        }
 +
 +        public boolean equalsOptionName(final String otherName) {
 +            return (otherName == null) ? false : optionName.equals(otherName);
 +        }
 +
 +        public static Options fromName(final String name) {
 +            Options optionToReturn = HELP;
 +            for (final Options option : Options.values()) {
 +                if (option.equalsOptionName(name)) {
 +                    optionToReturn = option;
 +                }
 +            }
 +            return optionToReturn;
 +        }
 +
 +        public static List<String> toList() {
 +            final List<String> options = new ArrayList<>();
 +            for (final Options value : values()) {
 +                options.add(value.getOptionName());
 +            }
 +            return options;
 +        }
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/syncope/blob/4e0783e1/client/cli/src/main/java/org/apache/syncope/client/cli/commands/TaskCommand.java
----------------------------------------------------------------------
diff --cc client/cli/src/main/java/org/apache/syncope/client/cli/commands/TaskCommand.java
index 9dcb795,0000000..535d4af
mode 100644,000000..100644
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/TaskCommand.java
+++ b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/TaskCommand.java
@@@ -1,583 -1,0 +1,583 @@@
 +/*
 + * 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.client.cli.commands;
 +
 +import java.util.ArrayList;
 +import java.util.List;
 +import java.util.Map;
 +import javax.xml.ws.WebServiceException;
 +import org.apache.commons.lang3.StringUtils;
 +import org.apache.syncope.client.cli.Command;
 +import org.apache.syncope.client.cli.Input;
 +import org.apache.syncope.client.cli.SyncopeServices;
 +import org.apache.syncope.client.cli.messages.Messages;
 +import org.apache.syncope.common.lib.SyncopeClientException;
 +import org.apache.syncope.common.lib.to.AbstractTaskTO;
 +import org.apache.syncope.common.lib.to.AnyTO;
 +import org.apache.syncope.common.lib.to.NotificationTaskTO;
 +import org.apache.syncope.common.lib.to.PropagationTaskTO;
 +import org.apache.syncope.common.lib.to.PushTaskTO;
 +import org.apache.syncope.common.lib.to.SchedTaskTO;
 +import org.apache.syncope.common.lib.to.SyncTaskTO;
 +import org.apache.syncope.common.lib.to.TaskExecTO;
 +import org.apache.syncope.common.lib.types.JobStatusType;
 +import org.apache.syncope.common.lib.types.TaskType;
 +import org.apache.syncope.common.rest.api.beans.TaskQuery;
 +import org.apache.syncope.common.rest.api.service.TaskService;
 +import org.slf4j.Logger;
 +import org.slf4j.LoggerFactory;
 +
 +@Command(name = "task")
 +public class TaskCommand extends AbstractCommand {
 +
 +    private static final Logger LOG = LoggerFactory.getLogger(LoggerCommand.class);
 +
 +    private static final String HELP_MESSAGE = "Usage: task [options]\n"
 +            + "  Options:\n"
 +            + "    --help \n"
 +            + "    --list-task \n"
 +            + "       Syntax: --list-task {TASK-TYPE} \n"
 +            + "          Task type: NOTIFICATION / PROPAGATION / PUSH / SCHEDULED / SYNCHRONIZATION\n"
 +            + "    --list-running-jobs \n"
 +            + "    --list-scheduled-jobs \n"
 +            + "    --read \n"
 +            + "       Syntax: --read {TASK-ID} {TASK-ID} [...]\n"
 +            + "    --read-execution \n"
 +            + "       Syntax: --read-execution {TASK-EXEC-ID} {TASK-EXEC-ID} [...]\n"
 +            + "    --delete \n"
 +            + "       Syntax: --delete {TASK-ID} {TASK-ID} [...]\n"
 +            + "    --delete-execution \n"
 +            + "       Syntax: --delete-execution {TASK-EXEC-ID} {TASK-EXEC-ID} [...]\n"
 +            + "    --execute \n"
 +            + "       Syntax: --execute {TASK-ID} {DRY-RUN}"
 +            + "          Dry run: true / false";
 +
 +    @Override
 +    public void execute(final Input input) {
 +        LOG.debug("Option: {}", input.getOption());
 +        LOG.debug("Parameters:");
 +        for (final String parameter : input.getParameters()) {
 +            LOG.debug("   > " + parameter);
 +        }
 +
 +        final String[] parameters = input.getParameters();
 +
 +        if (StringUtils.isBlank(input.getOption())) {
 +            input.setOption(Options.HELP.getOptionName());
 +        }
 +
 +        final TaskService taskService = SyncopeServices.get(TaskService.class);
 +        switch (Options.fromName(input.getOption())) {
 +            case LIST_TASK:
 +                final String listTaskErrorMessage = "task --list-task {TASK-TYPE}\n"
 +                        + "   Task type: NOTIFICATION / PROPAGATION / PUSH / SCHEDULED / SYNCHRONIZATION";
 +                if (parameters.length == 1) {
 +                    try {
 +                        final TaskType taskType = TaskType.valueOf(parameters[0]);
 +                        for (final AbstractTaskTO taskTO : taskService.list(taskType, new TaskQuery()).getResult()) {
 +                            switch (taskType) {
 +                                case NOTIFICATION:
 +                                    final NotificationTaskTO notificationTaskTO = (NotificationTaskTO) taskTO;
 +                                    System.out.println("");
 +                                    System.out.println(" - Notification task key: " + notificationTaskTO.getKey());
 +                                    System.out.println("     executed: " + notificationTaskTO.isExecuted());
 +                                    System.out.println("     sender: " + notificationTaskTO.getSender());
 +                                    System.out.println("     subjetc: " + notificationTaskTO.getSubject());
 +                                    System.out.println("     text body: " + notificationTaskTO.getTextBody());
 +                                    System.out.println("     html body: " + notificationTaskTO.getHtmlBody());
 +                                    System.out.println("     latest execution status: "
 +                                            + notificationTaskTO.getLatestExecStatus());
 +                                    System.out.println("     start date: " + notificationTaskTO.getStartDate());
 +                                    System.out.println("     end date: " + notificationTaskTO.getEndDate());
 +                                    System.out.println("     recipients: " + notificationTaskTO.getRecipients());
 +                                    System.out.println("     trace level: " + notificationTaskTO.getTraceLevel());
 +                                    for (final TaskExecTO taskExecTO : notificationTaskTO.getExecutions()) {
 +                                        printTaskExecTO(taskExecTO);
 +                                    }
 +                                    System.out.println("");
 +                                    break;
 +                                case PROPAGATION:
 +                                    final PropagationTaskTO propagationTaskTO = (PropagationTaskTO) taskTO;
 +                                    System.out.println("");
 +                                    System.out.println(" - Propagation task key: " + propagationTaskTO.getKey());
 +                                    System.out.println("     resource: " + propagationTaskTO.getResource());
 +                                    System.out.println("     any key: " + propagationTaskTO.getAnyKey());
 +                                    System.out.println("     any type kind: " + propagationTaskTO.getAnyTypeKind());
 +                                    System.out.println("     connector object key: "
 +                                            + propagationTaskTO.getConnObjectKey());
 +                                    System.out.println("     old connector object key: "
 +                                            + propagationTaskTO.getOldConnObjectKey());
 +                                    System.out.println("     latest execution status: "
 +                                            + propagationTaskTO.getLatestExecStatus());
 +                                    System.out.println("     class name: " + propagationTaskTO.getObjectClassName());
 +                                    System.out.println("     xml attribute: " + propagationTaskTO.getXmlAttributes());
 +                                    System.out.println("     start date: " + propagationTaskTO.getStartDate());
 +                                    System.out.println("     end date: " + propagationTaskTO.getEndDate());
 +                                    System.out.println("     operation: " + propagationTaskTO.getOperation());
 +                                    for (final TaskExecTO taskExecTO : propagationTaskTO.getExecutions()) {
 +                                        printTaskExecTO(taskExecTO);
 +                                    }
 +                                    System.out.println("");
 +                                    break;
 +                                case PUSH:
 +                                    final PushTaskTO pushTaskTO = (PushTaskTO) taskTO;
 +                                    System.out.println("");
 +                                    System.out.println(" - Push task key: " + pushTaskTO.getKey());
 +                                    System.out.println("     name: " + pushTaskTO.getName());
 +                                    System.out.println("     resource: " + pushTaskTO.getResource());
 +                                    System.out.println("     cron expression: " + pushTaskTO.getCronExpression());
 +                                    System.out.println("     description: " + pushTaskTO.getDescription());
 +                                    System.out.println("     is perform create: " + pushTaskTO.isPerformCreate());
 +                                    System.out.println("     is perform delete: " + pushTaskTO.isPerformDelete());
 +                                    System.out.println("     is perform update: " + pushTaskTO.isPerformUpdate());
 +                                    System.out.println("     is sync status: " + pushTaskTO.isSyncStatus());
 +                                    System.out.println("     start date: " + pushTaskTO.getStartDate());
 +                                    System.out.println("     end date: " + pushTaskTO.getEndDate());
 +                                    System.out.println("     last execution: " + pushTaskTO.getLastExec());
 +                                    System.out.println("     next execution: " + pushTaskTO.getNextExec());
 +                                    System.out.println("     latest execution status: "
 +                                            + pushTaskTO.getLatestExecStatus());
 +                                    System.out.println("     filters: " + pushTaskTO.getFilters());
 +                                    System.out.println("     delegate class: " + pushTaskTO.getJobDelegateClassName());
 +                                    System.out.println("     action class: " + pushTaskTO.getActionsClassNames());
 +                                    System.out.println("     matching rule: " + pushTaskTO.getMatchingRule());
 +                                    System.out.println("     not matching rule: " + pushTaskTO.getUnmatchingRule());
 +                                    for (final TaskExecTO taskExecTO : pushTaskTO.getExecutions()) {
 +                                        printTaskExecTO(taskExecTO);
 +                                    }
 +                                    System.out.println("");
 +                                    break;
 +                                case SCHEDULED:
 +                                    final SchedTaskTO schedTaskTO = (SchedTaskTO) taskTO;
 +                                    System.out.println("");
 +                                    System.out.println(" - Scheduled task key: " + schedTaskTO.getKey());
 +                                    System.out.println("     name: " + schedTaskTO.getName());
 +                                    System.out.println("     cron expression: " + schedTaskTO.getCronExpression());
 +                                    System.out.println("     description: " + schedTaskTO.getDescription());
 +                                    System.out.println("     start date: " + schedTaskTO.getStartDate());
 +                                    System.out.println("     end date: " + schedTaskTO.getEndDate());
 +                                    System.out.println("     last execution: " + schedTaskTO.getLastExec());
 +                                    System.out.println("     next execution: " + schedTaskTO.getNextExec());
 +                                    System.out.println("     latest execution status: "
 +                                            + schedTaskTO.getLatestExecStatus());
 +                                    System.out.println("     job delegate class: "
 +                                            + schedTaskTO.getJobDelegateClassName());
 +                                    for (final TaskExecTO taskExecTO : schedTaskTO.getExecutions()) {
 +                                        printTaskExecTO(taskExecTO);
 +                                    }
 +                                    System.out.println("");
 +                                    break;
 +                                case SYNCHRONIZATION:
 +                                    final SyncTaskTO syncTaskTO = (SyncTaskTO) taskTO;
 +                                    System.out.println("");
 +                                    System.out.println(" - Sync task key: " + syncTaskTO.getKey());
 +                                    System.out.println("     name: " + syncTaskTO.getName());
 +                                    System.out.println("     resource: " + syncTaskTO.getResource());
 +                                    System.out.println("     realm destination: " + syncTaskTO.getDestinationRealm());
 +                                    System.out.println("     cron expression: " + syncTaskTO.getCronExpression());
 +                                    System.out.println("     description: " + syncTaskTO.getDescription());
 +                                    System.out.println("     is full reconciliation: "
 +                                            + syncTaskTO.isFullReconciliation());
 +                                    System.out.println("     is perform create: " + syncTaskTO.isPerformCreate());
 +                                    System.out.println("     is perform delete: " + syncTaskTO.isPerformDelete());
 +                                    System.out.println("     is perform update: " + syncTaskTO.isPerformUpdate());
 +                                    System.out.println("     is sync status: " + syncTaskTO.isSyncStatus());
 +                                    System.out.println("     templates:");
 +                                    for (Map.Entry<String, AnyTO> entrySet : syncTaskTO.getTemplates().entrySet()) {
 +                                        final String key = entrySet.getKey();
 +                                        final AnyTO value = entrySet.getValue();
 +                                        System.out.println("        " + key + " key: " + value.getKey()
 +                                                + " of realm" + value.getRealm()
 +                                                + " on resource " + value.getResources());
 +
 +                                    }
 +                                    System.out.println("     start date: " + syncTaskTO.getStartDate());
 +                                    System.out.println("     end date: " + syncTaskTO.getEndDate());
 +                                    System.out.println("     next execution: " + syncTaskTO.getNextExec());
 +                                    System.out.println("     last execution: " + syncTaskTO.getLastExec());
 +                                    System.out.println("     latest execution status: "
 +                                            + syncTaskTO.getLatestExecStatus());
 +                                    System.out.println("     job delegate class: "
 +                                            + syncTaskTO.getJobDelegateClassName());
 +                                    System.out.println("     action class name: " + syncTaskTO.getActionsClassNames());
 +                                    System.out.println("     matching rule: " + syncTaskTO.getMatchingRule());
 +                                    System.out.println("     unmatching rule: " + syncTaskTO.getUnmatchingRule());
 +                                    for (final TaskExecTO taskExecTO : syncTaskTO.getExecutions()) {
 +                                        printTaskExecTO(taskExecTO);
 +                                    }
 +                                    System.out.println("");
 +                                    break;
 +                                default:
 +                                    break;
 +                            }
 +                        }
 +                    } catch (final SyncopeClientException ex) {
 +                        Messages.printMessage(ex.getMessage());
 +                    } catch (final IllegalArgumentException ex) {
 +                        Messages.printTypeNotValidMessage("task", parameters[0], fromEnumToArray(TaskType.class));
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(listTaskErrorMessage);
 +                }
 +                break;
 +            case LIST_RUNNING_JOBS:
 +                try {
 +                    for (final TaskExecTO taskExecTO : taskService.listJobs(JobStatusType.RUNNING)) {
 +                        printTaskExecTO(taskExecTO);
 +                    }
 +                } catch (final SyncopeClientException ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                }
 +                break;
 +            case LIST_SCHEDULED_JOBS:
 +                try {
 +                    for (final TaskExecTO taskExecTO : taskService.listJobs(JobStatusType.SCHEDULED)) {
 +                        printTaskExecTO(taskExecTO);
 +                    }
 +                } catch (final SyncopeClientException ex) {
 +                    Messages.printMessage(ex.getMessage());
 +                }
 +                break;
 +            case READ:
 +                final String readErrorMessage = "task --read {TASK-ID} {TASK-ID} [...]";
 +                if (parameters.length >= 1) {
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            final AbstractTaskTO taskTO = taskService.read(Long.valueOf(parameter));
 +                            if (taskTO instanceof NotificationTaskTO) {
 +                                final NotificationTaskTO notificationTaskTO = (NotificationTaskTO) taskTO;
 +                                System.out.println("");
 +                                System.out.println(" - Notification task key: " + notificationTaskTO.getKey());
 +                                System.out.println("     executed: " + notificationTaskTO.isExecuted());
 +                                System.out.println("     sender: " + notificationTaskTO.getSender());
 +                                System.out.println("     subjetc: " + notificationTaskTO.getSubject());
 +                                System.out.println("     text body: " + notificationTaskTO.getTextBody());
 +                                System.out.println("     html body: " + notificationTaskTO.getHtmlBody());
 +                                System.out.println("     latest execution status: "
 +                                        + notificationTaskTO.getLatestExecStatus());
 +                                System.out.println("     start date: " + notificationTaskTO.getStartDate());
 +                                System.out.println("     end date: " + notificationTaskTO.getEndDate());
 +                                System.out.println("     recipients: " + notificationTaskTO.getRecipients());
 +                                System.out.println("     trace level: " + notificationTaskTO.getTraceLevel());
 +                                for (final TaskExecTO taskExecTO : notificationTaskTO.getExecutions()) {
 +                                    printTaskExecTO(taskExecTO);
 +                                }
 +                                System.out.println("");
 +                            } else if (taskTO instanceof PropagationTaskTO) {
 +                                final PropagationTaskTO propagationTaskTO = (PropagationTaskTO) taskTO;
 +                                System.out.println("");
 +                                System.out.println(" - Propagation task key: " + propagationTaskTO.getKey());
 +                                System.out.println("     resource: " + propagationTaskTO.getResource());
 +                                System.out.println("     any key: " + propagationTaskTO.getAnyKey());
 +                                System.out.println("     any type kind: " + propagationTaskTO.getAnyTypeKind());
 +                                System.out.println("     connector object key: "
 +                                        + propagationTaskTO.getConnObjectKey());
 +                                System.out.println("     old connector object key: "
 +                                        + propagationTaskTO.getOldConnObjectKey());
 +                                System.out.println("     latest execution status: "
 +                                        + propagationTaskTO.getLatestExecStatus());
 +                                System.out.println("     class name: " + propagationTaskTO.getObjectClassName());
 +                                System.out.println("     xml attribute: " + propagationTaskTO.getXmlAttributes());
 +                                System.out.println("     start date: " + propagationTaskTO.getStartDate());
 +                                System.out.println("     end date: " + propagationTaskTO.getEndDate());
 +                                System.out.println("     operation: " + propagationTaskTO.getOperation());
 +                                for (final TaskExecTO taskExecTO : propagationTaskTO.getExecutions()) {
 +                                    printTaskExecTO(taskExecTO);
 +                                }
 +                                System.out.println("");
 +                            } else if (taskTO instanceof PushTaskTO) {
 +                                final PushTaskTO pushTaskTO = (PushTaskTO) taskTO;
 +                                System.out.println("");
 +                                System.out.println(" - Push task key: " + pushTaskTO.getKey());
 +                                System.out.println("     name: " + pushTaskTO.getName());
 +                                System.out.println("     resource: " + pushTaskTO.getResource());
 +                                System.out.println("     cron expression: " + pushTaskTO.getCronExpression());
 +                                System.out.println("     description: " + pushTaskTO.getDescription());
 +                                System.out.println("     is perform create: " + pushTaskTO.isPerformCreate());
 +                                System.out.println("     is perform delete: " + pushTaskTO.isPerformDelete());
 +                                System.out.println("     is perform update: " + pushTaskTO.isPerformUpdate());
 +                                System.out.println("     is sync status: " + pushTaskTO.isSyncStatus());
 +                                System.out.println("     start date: " + pushTaskTO.getStartDate());
 +                                System.out.println("     end date: " + pushTaskTO.getEndDate());
 +                                System.out.println("     last execution: " + pushTaskTO.getLastExec());
 +                                System.out.println("     next execution: " + pushTaskTO.getNextExec());
 +                                System.out.println("     latest execution status: "
 +                                        + pushTaskTO.getLatestExecStatus());
 +                                System.out.println("     filters: " + pushTaskTO.getFilters());
 +                                System.out.println("     delegate class: " + pushTaskTO.getJobDelegateClassName());
 +                                System.out.println("     action class: " + pushTaskTO.getActionsClassNames());
 +                                System.out.println("     matching rule: " + pushTaskTO.getMatchingRule());
 +                                System.out.println("     not matching rule: " + pushTaskTO.getUnmatchingRule());
 +                                for (final TaskExecTO taskExecTO : pushTaskTO.getExecutions()) {
 +                                    printTaskExecTO(taskExecTO);
 +                                }
 +                                System.out.println("");
 +                            } else if (taskTO instanceof SchedTaskTO) {
 +                                final SchedTaskTO schedTaskTO = (SchedTaskTO) taskTO;
 +                                System.out.println("");
 +                                System.out.println(" - Scheduled task key: " + schedTaskTO.getKey());
 +                                System.out.println("     name: " + schedTaskTO.getName());
 +                                System.out.println("     cron expression: " + schedTaskTO.getCronExpression());
 +                                System.out.println("     description: " + schedTaskTO.getDescription());
 +                                System.out.println("     start date: " + schedTaskTO.getStartDate());
 +                                System.out.println("     end date: " + schedTaskTO.getEndDate());
 +                                System.out.println("     last execution: " + schedTaskTO.getLastExec());
 +                                System.out.println("     next execution: " + schedTaskTO.getNextExec());
 +                                System.out.println("     latest execution status: "
 +                                        + schedTaskTO.getLatestExecStatus());
 +                                System.out.println("     job delegate class: "
 +                                        + schedTaskTO.getJobDelegateClassName());
 +                                for (final TaskExecTO taskExecTO : schedTaskTO.getExecutions()) {
 +                                    printTaskExecTO(taskExecTO);
 +                                }
 +                                System.out.println("");
 +                            } else if (taskTO instanceof SyncTaskTO) {
 +                                final SyncTaskTO syncTaskTO = (SyncTaskTO) taskTO;
 +                                System.out.println("");
 +                                System.out.println(" - Sync task key: " + syncTaskTO.getKey());
 +                                System.out.println("     name: " + syncTaskTO.getName());
 +                                System.out.println("     resource: " + syncTaskTO.getResource());
 +                                System.out.println("     realm destination: " + syncTaskTO.getDestinationRealm());
 +                                System.out.println("     cron expression: " + syncTaskTO.getCronExpression());
 +                                System.out.println("     description: " + syncTaskTO.getDescription());
 +                                System.out.println("     is full reconciliation: "
 +                                        + syncTaskTO.isFullReconciliation());
 +                                System.out.println("     is perform create: " + syncTaskTO.isPerformCreate());
 +                                System.out.println("     is perform delete: " + syncTaskTO.isPerformDelete());
 +                                System.out.println("     is perform update: " + syncTaskTO.isPerformUpdate());
 +                                System.out.println("     is sync status: " + syncTaskTO.isSyncStatus());
 +                                System.out.println("     templates:");
 +                                for (Map.Entry<String, AnyTO> entrySet : syncTaskTO.getTemplates().entrySet()) {
 +                                    final String key = entrySet.getKey();
 +                                    final AnyTO value = entrySet.getValue();
 +                                    System.out.println("        " + key + "key : " + value.getKey()
 +                                            + " of realm" + value.getRealm()
 +                                            + " on resource " + value.getResources());
 +
 +                                }
 +                                System.out.println("     start date: " + syncTaskTO.getStartDate());
 +                                System.out.println("     end date: " + syncTaskTO.getEndDate());
 +                                System.out.println("     next execution: " + syncTaskTO.getNextExec());
 +                                System.out.println("     last execution: " + syncTaskTO.getLastExec());
 +                                System.out.println("     latest execution status: "
 +                                        + syncTaskTO.getLatestExecStatus());
 +                                System.out.println("     job delegate class: "
 +                                        + syncTaskTO.getJobDelegateClassName());
 +                                System.out.println("     action class name: " + syncTaskTO.getActionsClassNames());
 +                                System.out.println("     matching rule: " + syncTaskTO.getMatchingRule());
 +                                System.out.println("     unmatching rule: " + syncTaskTO.getUnmatchingRule());
 +                                for (final TaskExecTO taskExecTO : syncTaskTO.getExecutions()) {
 +                                    printTaskExecTO(taskExecTO);
 +                                }
 +                                System.out.println("");
 +                            }
 +                        } catch (final NumberFormatException ex) {
 +                            Messages.printIdNotNumberDeletedMessage("task", parameter);
 +                        } catch (final SyncopeClientException | WebServiceException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Task", parameter);
 +                            } else {
 +                                Messages.printMessage("Error: " + ex.getMessage());
 +                            }
 +                            break;
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(readErrorMessage);
 +                }
 +                break;
 +            case READ_EXECUTION:
 +                final String readExecutionErrorMessage = "task --read-execution {TASK-ID} {TASK-ID} [...]";
 +                if (parameters.length >= 1) {
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            final TaskExecTO taskExecTO = taskService.readExecution(Long.valueOf(parameter));
 +                            printTaskExecTO(taskExecTO);
 +                        } catch (final NumberFormatException ex) {
 +                            Messages.printIdNotNumberDeletedMessage("task execution", parameter);
 +                        } catch (final SyncopeClientException | WebServiceException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Task execution", parameter);
 +                            } else {
 +                                Messages.printMessage("Error: " + ex.getMessage());
 +                            }
 +                            break;
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(readExecutionErrorMessage);
 +                }
 +                break;
 +            case DELETE:
 +                final String deleteErrorMessage = "task --delete {TASK-ID} {TASK-ID} [...]";
 +
 +                if (parameters.length >= 1) {
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            taskService.delete(Long.valueOf(parameter));
 +                            Messages.printDeletedMessage("Task", parameter);
 +                        } catch (final WebServiceException | SyncopeClientException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Task", parameter);
 +                            } else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
 +                                Messages.printMessage("You cannot delete task " + parameter);
 +                            } else {
 +                                Messages.printMessage(ex.getMessage());
 +                            }
 +                        } catch (final NumberFormatException ex) {
 +                            Messages.printIdNotNumberDeletedMessage("task", parameter);
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(deleteErrorMessage);
 +                }
 +                break;
 +            case DELETE_EXECUTION:
 +                final String deleteExecutionErrorMessage = "task --delete-execution "
 +                        + "{TASK-EXEC-ID} {TASK-EXEC-ID} [...]";
 +
 +                if (parameters.length >= 1) {
 +                    for (final String parameter : parameters) {
 +                        try {
 +                            taskService.deleteExecution(Long.valueOf(parameter));
 +                            Messages.printDeletedMessage("Task execution", parameter);
 +                        } catch (final WebServiceException | SyncopeClientException ex) {
 +                            if (ex.getMessage().startsWith("NotFound")) {
 +                                Messages.printNofFoundMessage("Task execution", parameter);
 +                            } else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
 +                                Messages.printMessage("You cannot delete task execution" + parameter);
 +                            } else {
 +                                Messages.printMessage(ex.getMessage());
 +                            }
 +                        } catch (final NumberFormatException ex) {
 +                            Messages.printIdNotNumberDeletedMessage("task execution", parameter);
 +                        }
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(deleteExecutionErrorMessage);
 +                }
 +                break;
 +            case EXECUTE:
 +                final String executeErrorMessage = "task --execute {TASK-ID} {DRY-RUN}\n"
 +                        + "          Dry run: true / false";
 +
 +                if (parameters.length == 2) {
 +
 +                    try {
 +                        final Long taskIdToExecute = Long.valueOf(parameters[0]);
 +                        boolean dryRun;
 +                        if ("false".equalsIgnoreCase(parameters[1])) {
 +                            dryRun = false;
 +                        } else if ("true".equalsIgnoreCase(parameters[1])) {
 +                            dryRun = true;
 +                        } else {
 +                            Messages.printNotBooleanDeletedMessage("dry run", parameters[1]);
 +                            break;
 +                        }
 +                        final TaskExecTO taskExecTO = taskService.execute(taskIdToExecute, dryRun);
 +                        printTaskExecTO(taskExecTO);
 +                    } catch (final WebServiceException | SyncopeClientException ex) {
 +                        System.out.println("Error:");
 +                        if (ex.getMessage().startsWith("NotFound")) {
 +                            Messages.printNofFoundMessage("Task", parameters[0]);
 +                        } else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
 +                            Messages.printMessage("You cannot delete task " + parameters[0]);
 +                        } else {
 +                            Messages.printMessage(ex.getMessage());
 +                        }
 +                    } catch (final NumberFormatException ex) {
 +                        Messages.printIdNotNumberDeletedMessage("task", parameters[0]);
 +                    }
 +                } else {
 +                    Messages.printCommandOptionMessage(executeErrorMessage);
 +                }
 +                break;
 +            case HELP:
 +                System.out.println(HELP_MESSAGE);
 +                break;
 +            default:
 +                Messages.printDefaultMessage(input.getOption(), HELP_MESSAGE);
 +        }
 +
 +    }
 +
 +    private void printTaskExecTO(final TaskExecTO taskExecTO) {
 +        System.out.println("     EXECUTIONS: ");
 +        System.out.println("     - task execution key: " + taskExecTO.getKey());
 +        System.out.println("       task: " + taskExecTO.getTask());
 +        System.out.println("       message: ");
 +        System.out.println("       ###############     <BEGIN MESSAGE>     ###############");
 +        System.out.println("       message: " + taskExecTO.getMessage());
 +        System.out.println("       ###############     <END   MESSAGE>     ###############");
 +        System.out.println("       status: " + taskExecTO.getStatus());
 +        System.out.println("       start date: " + taskExecTO.getStartDate());
 +        System.out.println("       end date: " + taskExecTO.getEndDate());
 +        System.out.println("");
 +    }
 +
 +    @Override
 +    public String getHelpMessage() {
 +        return HELP_MESSAGE;
 +    }
 +
 +    private enum Options {
 +
 +        HELP("--help"),
 +        LIST_TASK("--list-task"),
 +        LIST_RUNNING_JOBS("--list-running-jobs"),
 +        LIST_SCHEDULED_JOBS("--list-scheduled-jobs"),
 +        READ("--read"),
 +        READ_EXECUTION("--read-execution"),
 +        DELETE("--delete"),
 +        DELETE_EXECUTION("--delete-execution"),
 +        EXECUTE("--execute");
 +
 +        private final String optionName;
 +
-         private Options(final String optionName) {
++        Options(final String optionName) {
 +            this.optionName = optionName;
 +        }
 +
 +        public String getOptionName() {
 +            return optionName;
 +        }
 +
 +        public boolean equalsOptionName(final String otherName) {
 +            return (otherName == null) ? false : optionName.equals(otherName);
 +        }
 +
 +        public static Options fromName(final String name) {
 +            Options optionToReturn = HELP;
 +            for (final Options option : Options.values()) {
 +                if (option.equalsOptionName(name)) {
 +                    optionToReturn = option;
 +                }
 +            }
 +            return optionToReturn;
 +        }
 +
 +        public static List<String> toList() {
 +            final List<String> options = new ArrayList<>();
 +            for (final Options value : values()) {
 +                options.add(value.getOptionName());
 +            }
 +            return options;
 +        }
 +    }
 +}