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 2018/12/18 11:57:53 UTC
[syncope] branch master updated: [SYNCOPE-1413] CLI removed
This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/master by this push:
new a66bdb9 [SYNCOPE-1413] CLI removed
a66bdb9 is described below
commit a66bdb9f5fd5ff1bcfb0fc60651fd40e285b800c
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Tue Dec 18 12:57:43 2018 +0100
[SYNCOPE-1413] CLI removed
---
client/cli/LICENSE | 687 ---------------------
client/cli/NOTICE | 61 --
client/cli/pom.xml | 206 ------
client/cli/src/assemble/cli-zip.xml | 62 --
.../org/apache/syncope/client/cli/ArgsManager.java | 50 --
.../org/apache/syncope/client/cli/Command.java | 32 -
.../syncope/client/cli/CommandClassScanner.java | 47 --
.../java/org/apache/syncope/client/cli/Input.java | 117 ----
.../apache/syncope/client/cli/ResultManager.java | 25 -
.../org/apache/syncope/client/cli/SyncopeAdm.java | 96 ---
.../apache/syncope/client/cli/SyncopeServices.java | 87 ---
.../client/cli/commands/AbstractCommand.java | 28 -
.../client/cli/commands/CommonsResultManager.java | 99 ---
.../anyobject/AbstractAnyObjectCommand.java | 27 -
.../cli/commands/anyobject/AnyObjectCommand.java | 111 ----
.../cli/commands/anyobject/AnyObjectDelete.java | 59 --
.../cli/commands/anyobject/AnyObjectList.java | 50 --
.../cli/commands/anyobject/AnyObjectRead.java | 58 --
...bjectReadAttributeBySchemaTypeAndSchemaKey.java | 61 --
.../AnyObjectReadAttributesBySchemaType.java | 64 --
.../commands/anyobject/AnyObjectResultManager.java | 77 ---
.../anyobject/AnyObjectSyncopeOperations.java | 56 --
.../AbstractConfigurationCommand.java | 28 -
.../configuration/ConfigurationCommand.java | 109 ----
.../configuration/ConfigurationDelete.java | 61 --
.../configuration/ConfigurationExport.java | 61 --
.../commands/configuration/ConfigurationGet.java | 49 --
.../commands/configuration/ConfigurationRead.java | 67 --
.../configuration/ConfigurationResultManager.java | 51 --
.../ConfigurationSyncopeOperations.java | 50 --
.../configuration/ConfigurationUpdate.java | 83 ---
.../connector/AbstractConnectorCommand.java | 27 -
.../cli/commands/connector/ConnectorCommand.java | 117 ----
.../cli/commands/connector/ConnectorDelete.java | 67 --
.../cli/commands/connector/ConnectorDetails.java | 86 ---
.../cli/commands/connector/ConnectorList.java | 50 --
.../commands/connector/ConnectorListBundles.java | 50 --
.../ConnectorListConfigurationProperties.java | 62 --
.../cli/commands/connector/ConnectorRead.java | 60 --
.../connector/ConnectorReadByResource.java | 57 --
.../commands/connector/ConnectorResultManager.java | 90 ---
.../connector/ConnectorSyncopeOperations.java | 50 --
.../cli/commands/domain/AbstractDomainCommand.java | 27 -
.../client/cli/commands/domain/DomainCommand.java | 100 ---
.../client/cli/commands/domain/DomainDelete.java | 57 --
.../client/cli/commands/domain/DomainDetails.java | 55 --
.../client/cli/commands/domain/DomainList.java | 51 --
.../client/cli/commands/domain/DomainRead.java | 56 --
.../cli/commands/domain/DomainResultManager.java | 44 --
.../commands/domain/DomainSyncopeOperations.java | 41 --
.../entitlement/AbstractEntitlementCommand.java | 27 -
.../commands/entitlement/EntitlementCommand.java | 109 ----
.../cli/commands/entitlement/EntitlementList.java | 40 --
.../commands/entitlement/EntitlementListRole.java | 67 --
.../entitlement/EntitlementReadByUserKey.java | 59 --
.../entitlement/EntitlementReadByUsername.java | 59 --
.../entitlement/EntitlementResultManager.java | 54 --
.../entitlement/EntitlementSearchByRole.java | 59 --
.../entitlement/EntitlementSyncopeOperations.java | 79 ---
.../cli/commands/group/AbstractGroupCommand.java | 27 -
.../client/cli/commands/group/GroupCommand.java | 112 ----
.../client/cli/commands/group/GroupDelete.java | 59 --
.../client/cli/commands/group/GroupDetails.java | 78 ---
.../client/cli/commands/group/GroupList.java | 50 --
.../client/cli/commands/group/GroupRead.java | 58 --
...GroupReadAttributeBySchemaTypeAndSchemaKey.java | 61 --
.../group/GroupReadAttributesBySchemaType.java | 64 --
.../cli/commands/group/GroupResultManager.java | 81 ---
.../cli/commands/group/GroupSyncopeOperations.java | 53 --
.../syncope/client/cli/commands/help/Help.java | 50 --
.../client/cli/commands/help/HelpCommand.java | 90 ---
.../cli/commands/help/HelpResultManager.java | 28 -
.../syncope/client/cli/commands/info/Info.java | 243 --------
.../client/cli/commands/info/InfoCommand.java | 171 -----
.../cli/commands/info/InfoResultManager.java | 142 -----
.../cli/commands/install/InstallCommand.java | 110 ----
.../install/InstallConfigFileTemplate.java | 78 ---
.../cli/commands/install/InstallResultManager.java | 102 ---
.../client/cli/commands/install/InstallSetup.java | 178 ------
.../cli/commands/install/InstallSetupForDebug.java | 80 ---
.../cli/commands/logger/AbstractLoggerCommand.java | 27 -
.../client/cli/commands/logger/LoggerCommand.java | 125 ----
.../client/cli/commands/logger/LoggerCreate.java | 73 ---
.../client/cli/commands/logger/LoggerDelete.java | 58 --
.../client/cli/commands/logger/LoggerDetails.java | 98 ---
.../cli/commands/logger/LoggerLastStatements.java | 54 --
.../client/cli/commands/logger/LoggerList.java | 50 --
.../commands/logger/LoggerListMemoryAppenders.java | 50 --
.../client/cli/commands/logger/LoggerRead.java | 67 --
.../cli/commands/logger/LoggerResultManager.java | 88 ---
.../commands/logger/LoggerSyncopeOperations.java | 57 --
.../client/cli/commands/logger/LoggerUpdate.java | 84 ---
.../cli/commands/logger/LoggerUpdateAll.java | 75 ---
.../notification/AbstractNotificationCommand.java | 27 -
.../commands/notification/NotificationCommand.java | 101 ---
.../commands/notification/NotificationDelete.java | 61 --
.../commands/notification/NotificationList.java | 50 --
.../commands/notification/NotificationRead.java | 60 --
.../notification/NotificationResultManager.java | 49 --
.../NotificationSyncopeOperations.java | 41 --
.../cli/commands/policy/AbstractPolicyCommand.java | 27 -
.../client/cli/commands/policy/PolicyCommand.java | 105 ----
.../client/cli/commands/policy/PolicyDelete.java | 63 --
.../client/cli/commands/policy/PolicyDetails.java | 65 --
.../client/cli/commands/policy/PolicyList.java | 58 --
.../client/cli/commands/policy/PolicyRead.java | 71 ---
.../cli/commands/policy/PolicyResultManager.java | 116 ----
.../commands/policy/PolicySyncopeOperations.java | 42 --
.../commands/question/AbstractQuestionCommand.java | 27 -
.../cli/commands/question/QuestionCommand.java | 101 ---
.../cli/commands/question/QuestionDelete.java | 62 --
.../client/cli/commands/question/QuestionList.java | 50 --
.../client/cli/commands/question/QuestionRead.java | 66 --
.../commands/question/QuestionResultManager.java | 39 --
.../question/QuestionSyncopeOperations.java | 45 --
.../cli/commands/realm/AbstractRealmCommand.java | 27 -
.../client/cli/commands/realm/RealmCommand.java | 96 ---
.../client/cli/commands/realm/RealmDetails.java | 54 --
.../client/cli/commands/realm/RealmList.java | 50 --
.../cli/commands/realm/RealmResultManager.java | 50 --
.../cli/commands/realm/RealmSyncopeOperations.java | 43 --
.../cli/commands/report/AbstractReportCommand.java | 27 -
.../client/cli/commands/report/ReportCommand.java | 121 ----
.../client/cli/commands/report/ReportDelete.java | 63 --
.../cli/commands/report/ReportDeleteExecution.java | 64 --
.../client/cli/commands/report/ReportDetails.java | 60 --
.../client/cli/commands/report/ReportExecute.java | 67 --
.../cli/commands/report/ReportExportExecution.java | 67 --
.../client/cli/commands/report/ReportList.java | 50 --
.../client/cli/commands/report/ReportListJobs.java | 57 --
.../client/cli/commands/report/ReportRead.java | 65 --
.../cli/commands/report/ReportResultManager.java | 76 ---
.../commands/report/ReportSyncopeOperations.java | 111 ----
.../commands/resource/AbstractResourceCommand.java | 27 -
.../cli/commands/resource/ResourceCommand.java | 105 ----
.../cli/commands/resource/ResourceDelete.java | 62 --
.../cli/commands/resource/ResourceDetails.java | 57 --
.../client/cli/commands/resource/ResourceList.java | 50 --
.../client/cli/commands/resource/ResourceRead.java | 66 --
.../commands/resource/ResourceResultManager.java | 99 ---
.../resource/ResourceSyncopeOperations.java | 51 --
.../cli/commands/role/AbstractRoleCommand.java | 27 -
.../client/cli/commands/role/RoleCommand.java | 105 ----
.../client/cli/commands/role/RoleDelete.java | 63 --
.../client/cli/commands/role/RoleDetails.java | 60 --
.../syncope/client/cli/commands/role/RoleList.java | 50 --
.../syncope/client/cli/commands/role/RoleRead.java | 66 --
.../cli/commands/role/RoleResultManager.java | 61 --
.../cli/commands/role/RoleSyncopeOperations.java | 41 --
.../cli/commands/schema/AbstractSchemaCommand.java | 27 -
.../client/cli/commands/schema/SchemaCommand.java | 121 ----
.../client/cli/commands/schema/SchemaDelete.java | 69 ---
.../client/cli/commands/schema/SchemaDetails.java | 63 --
.../client/cli/commands/schema/SchemaList.java | 58 --
.../client/cli/commands/schema/SchemaListAll.java | 54 --
.../cli/commands/schema/SchemaListDerived.java | 51 --
.../cli/commands/schema/SchemaListPlain.java | 51 --
.../cli/commands/schema/SchemaListVirtual.java | 51 --
.../client/cli/commands/schema/SchemaRead.java | 71 ---
.../cli/commands/schema/SchemaResultManager.java | 107 ----
.../commands/schema/SchemaSyncopeOperations.java | 55 --
.../cli/commands/task/AbstractTaskCommand.java | 27 -
.../client/cli/commands/task/TaskCommand.java | 121 ----
.../client/cli/commands/task/TaskDelete.java | 64 --
.../cli/commands/task/TaskDeleteAllProp.java | 66 --
.../client/cli/commands/task/TaskDetails.java | 126 ----
.../client/cli/commands/task/TaskExecute.java | 71 ---
.../cli/commands/task/TaskExecutionDelete.java | 64 --
.../syncope/client/cli/commands/task/TaskList.java | 58 --
.../client/cli/commands/task/TaskListJobs.java | 58 --
.../syncope/client/cli/commands/task/TaskRead.java | 71 ---
.../cli/commands/task/TaskResultManager.java | 224 -------
.../cli/commands/task/TaskSyncopeOperations.java | 63 --
.../cli/commands/user/AbstractUserCommand.java | 34 -
.../client/cli/commands/user/UserCommand.java | 129 ----
.../client/cli/commands/user/UserDelete.java | 61 --
.../client/cli/commands/user/UserDeleteAll.java | 114 ----
.../cli/commands/user/UserDeleteByAttribute.java | 100 ---
.../client/cli/commands/user/UserDetails.java | 78 ---
.../syncope/client/cli/commands/user/UserList.java | 61 --
.../cli/commands/user/UserReadByUserKey.java | 66 --
.../cli/commands/user/UserReadByUsername.java | 66 --
.../cli/commands/user/UserResultManager.java | 112 ----
.../cli/commands/user/UserSearchByAttribute.java | 76 ---
.../cli/commands/user/UserSearchByResource.java | 70 ---
.../client/cli/commands/user/UserSearchByRole.java | 66 --
.../cli/commands/user/UserSyncopeOperations.java | 126 ----
.../syncope/client/cli/util/CommandUtils.java | 90 ---
.../syncope/client/cli/util/FileSystemUtils.java | 48 --
.../syncope/client/cli/util/JasyptUtils.java | 50 --
.../apache/syncope/client/cli/util/XMLUtils.java | 50 --
.../apache/syncope/client/cli/view/Messages.java | 107 ----
.../org/apache/syncope/client/cli/view/Table.java | 197 ------
.../src/main/resources/configuration.properties | 19 -
client/cli/src/main/resources/log4j2.xml | 82 ---
client/cli/src/main/resources/messages.properties | 34 -
client/cli/src/main/resources/syncopeadm.bat | 27 -
client/cli/src/main/resources/syncopeadm.sh | 23 -
.../syncope/client/cli/util/CommandUtilsTest.java | 54 --
.../syncope/client/cli/util/JasyptUtilsTest.java | 35 --
client/cli/src/test/resources/log4j2.xml | 40 --
client/pom.xml | 1 -
fit/core-reference/pom.xml | 12 +-
.../java/org/apache/syncope/fit/cli/CLIITCase.java | 284 ---------
.../src/test/resources/cli-test.properties | 17 -
.../asciidoc/getting-started/introduction.adoc | 5 +-
src/main/asciidoc/getting-started/obtain.adoc | 171 -----
.../reference-guide/architecture/architecture.adoc | 12 +-
.../workingwithapachesyncope/cli/anyObject.adoc | 55 --
.../workingwithapachesyncope/cli/cli.adoc | 60 --
.../cli/configuration.adoc | 53 --
.../workingwithapachesyncope/cli/connector.adoc | 54 --
.../workingwithapachesyncope/cli/domain.adoc | 45 --
.../workingwithapachesyncope/cli/entitlement.adoc | 53 --
.../workingwithapachesyncope/cli/group.adoc | 55 --
.../workingwithapachesyncope/cli/info.adoc | 52 --
.../workingwithapachesyncope/cli/logger.adoc | 68 --
.../workingwithapachesyncope/cli/notification.adoc | 44 --
.../workingwithapachesyncope/cli/policy.adoc | 49 --
.../workingwithapachesyncope/cli/question.adoc | 44 --
.../workingwithapachesyncope/cli/realm.adoc | 39 --
.../workingwithapachesyncope/cli/report.adoc | 67 --
.../workingwithapachesyncope/cli/resource.adoc | 47 --
.../workingwithapachesyncope/cli/role.adoc | 47 --
.../workingwithapachesyncope/cli/schema.adoc | 57 --
.../workingwithapachesyncope/cli/task.adoc | 68 --
.../workingwithapachesyncope/cli/user.adoc | 80 ---
.../configurationparameters.adoc | 2 +-
.../systemadministration/domainsmanagement.adoc | 2 +-
.../systemadministration/importexport.adoc | 2 +-
.../workingwithapachesyncope.adoc | 2 -
231 files changed, 6 insertions(+), 16051 deletions(-)
diff --git a/client/cli/LICENSE b/client/cli/LICENSE
deleted file mode 100644
index eeb76fe..0000000
--- a/client/cli/LICENSE
+++ /dev/null
@@ -1,687 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
-
-==
-
-For Jackson (http://wiki.fasterxml.com/JacksonHome):
-This is licensed under the AL 2.0, see above.
-
-==
-
-For LMAX Disruptor (https://lmax-exchange.github.io/disruptor/):
-This is licensed under the AL 2.0, see above.
-
-==
-
-For JAX-B (http://jaxb.java.net/):
-This is licensed under the CDDL 1.0:
-
-COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
-
-1. Definitions.
-
-1.1. "Contributor" means each individual or entity that
-creates or contributes to the creation of Modifications.
-
-1.2. "Contributor Version" means the combination of the
-Original Software, prior Modifications used by a
-Contributor (if any), and the Modifications made by that
-particular Contributor.
-
-1.3. "Covered Software" means (a) the Original Software, or
-(b) Modifications, or (c) the combination of files
-containing Original Software with files containing
-Modifications, in each case including portions thereof.
-
-1.4. "Executable" means the Covered Software in any form
-other than Source Code.
-
-1.5. "Initial Developer" means the individual or entity
-that first makes Original Software available under this
-License.
-
-1.6. "Larger Work" means a work which combines Covered
-Software or portions thereof with code not governed by the
-terms of this License.
-
-1.7. "License" means this document.
-
-1.8. "Licensable" means having the right to grant, to the
-maximum extent possible, whether at the time of the initial
-grant or subsequently acquired, any and all of the rights
-conveyed herein.
-
-1.9. "Modifications" means the Source Code and Executable
-form of any of the following:
-
-A. Any file that results from an addition to,
-deletion from or modification of the contents of a
-file containing Original Software or previous
-Modifications;
-
-B. Any new file that contains any part of the
-Original Software or previous Modification; or
-
-C. Any new file that is contributed or otherwise made
-available under the terms of this License.
-
-1.10. "Original Software" means the Source Code and
-Executable form of computer software code that is
-originally released under this License.
-
-1.11. "Patent Claims" means any patent claim(s), now owned
-or hereafter acquired, including without limitation,
-method, process, and apparatus claims, in any patent
-Licensable by grantor.
-
-1.12. "Source Code" means (a) the common form of computer
-software code in which modifications are made and (b)
-associated documentation included in or with such code.
-
-1.13. "You" (or "Your") means an individual or a legal
-entity exercising rights under, and complying with all of
-the terms of, this License. For legal entities, "You"
-includes any entity which controls, is controlled by, or is
-under common control with You. For purposes of this
-definition, "control" means (a) the power, direct or
-indirect, to cause the direction or management of such
-entity, whether by contract or otherwise, or (b) ownership
-of more than fifty percent (50%) of the outstanding shares
-or beneficial ownership of such entity.
-
-2. License Grants.
-
-2.1. The Initial Developer Grant.
-
-Conditioned upon Your compliance with Section 3.1 below and
-subject to third party intellectual property claims, the
-Initial Developer hereby grants You a world-wide,
-royalty-free, non-exclusive license:
-
-(a) under intellectual property rights (other than
-patent or trademark) Licensable by Initial Developer,
-to use, reproduce, modify, display, perform,
-sublicense and distribute the Original Software (or
-portions thereof), with or without Modifications,
-and/or as part of a Larger Work; and
-
-(b) under Patent Claims infringed by the making,
-using or selling of Original Software, to make, have
-made, use, practice, sell, and offer for sale, and/or
-otherwise dispose of the Original Software (or
-portions thereof).
-
-(c) The licenses granted in Sections 2.1(a) and (b)
-are effective on the date Initial Developer first
-distributes or otherwise makes the Original Software
-available to a third party under the terms of this
-License.
-
-(d) Notwithstanding Section 2.1(b) above, no patent
-license is granted: (1) for code that You delete from
-the Original Software, or (2) for infringements
-caused by: (i) the modification of the Original
-Software, or (ii) the combination of the Original
-Software with other software or devices.
-
-2.2. Contributor Grant.
-
-Conditioned upon Your compliance with Section 3.1 below and
-subject to third party intellectual property claims, each
-Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than
-patent or trademark) Licensable by Contributor to
-use, reproduce, modify, display, perform, sublicense
-and distribute the Modifications created by such
-Contributor (or portions thereof), either on an
-unmodified basis, with other Modifications, as
-Covered Software and/or as part of a Larger Work; and
-
-(b) under Patent Claims infringed by the making,
-using, or selling of Modifications made by that
-Contributor either alone and/or in combination with
-its Contributor Version (or portions of such
-combination), to make, use, sell, offer for sale,
-have made, and/or otherwise dispose of: (1)
-Modifications made by that Contributor (or portions
-thereof); and (2) the combination of Modifications
-made by that Contributor with its Contributor Version
-(or portions of such combination).
-
-(c) The licenses granted in Sections 2.2(a) and
-2.2(b) are effective on the date Contributor first
-distributes or otherwise makes the Modifications
-available to a third party.
-
-(d) Notwithstanding Section 2.2(b) above, no patent
-license is granted: (1) for any code that Contributor
-has deleted from the Contributor Version; (2) for
-infringements caused by: (i) third party
-modifications of Contributor Version, or (ii) the
-combination of Modifications made by that Contributor
-with other software (except as part of the
-Contributor Version) or other devices; or (3) under
-Patent Claims infringed by Covered Software in the
-absence of Modifications made by that Contributor.
-
-3. Distribution Obligations.
-
-3.1. Availability of Source Code.
-
-Any Covered Software that You distribute or otherwise make
-available in Executable form must also be made available in
-Source Code form and that Source Code form must be
-distributed only under the terms of this License. You must
-include a copy of this License with every copy of the
-Source Code form of the Covered Software You distribute or
-otherwise make available. You must inform recipients of any
-such Covered Software in Executable form as to how they can
-obtain such Covered Software in Source Code form in a
-reasonable manner on or through a medium customarily used
-for software exchange.
-
-3.2. Modifications.
-
-The Modifications that You create or to which You
-contribute are governed by the terms of this License. You
-represent that You believe Your Modifications are Your
-original creation(s) and/or You have sufficient rights to
-grant the rights conveyed by this License.
-
-3.3. Required Notices.
-
-You must include a notice in each of Your Modifications
-that identifies You as the Contributor of the Modification.
-You may not remove or alter any copyright, patent or
-trademark notices contained within the Covered Software, or
-any notices of licensing or any descriptive text giving
-attribution to any Contributor or the Initial Developer.
-
-3.4. Application of Additional Terms.
-
-You may not offer or impose any terms on any Covered
-Software in Source Code form that alters or restricts the
-applicable version of this License or the recipients'
-rights hereunder. You may choose to offer, and to charge a
-fee for, warranty, support, indemnity or liability
-obligations to one or more recipients of Covered Software.
-However, you may do so only on Your own behalf, and not on
-behalf of the Initial Developer or any Contributor. You
-must make it absolutely clear that any such warranty,
-support, indemnity or liability obligation is offered by
-You alone, and You hereby agree to indemnify the Initial
-Developer and every Contributor for any liability incurred
-by the Initial Developer or such Contributor as a result of
-warranty, support, indemnity or liability terms You offer.
-
-3.5. Distribution of Executable Versions.
-
-You may distribute the Executable form of the Covered
-Software under the terms of this License or under the terms
-of a license of Your choice, which may contain terms
-different from this License, provided that You are in
-compliance with the terms of this License and that the
-license for the Executable form does not attempt to limit
-or alter the recipient's rights in the Source Code form
-from the rights set forth in this License. If You
-distribute the Covered Software in Executable form under a
-different license, You must make it absolutely clear that
-any terms which differ from this License are offered by You
-alone, not by the Initial Developer or Contributor. You
-hereby agree to indemnify the Initial Developer and every
-Contributor for any liability incurred by the Initial
-Developer or such Contributor as a result of any such terms
-You offer.
-
-3.6. Larger Works.
-
-You may create a Larger Work by combining Covered Software
-with other code not governed by the terms of this License
-and distribute the Larger Work as a single product. In such
-a case, You must make sure the requirements of this License
-are fulfilled for the Covered Software.
-
-4. Versions of the License.
-
-4.1. New Versions.
-
-Sun Microsystems, Inc. is the initial license steward and
-may publish revised and/or new versions of this License
-from time to time. Each version will be given a
-distinguishing version number. Except as provided in
-Section 4.3, no one other than the license steward has the
-right to modify this License.
-
-4.2. Effect of New Versions.
-
-You may always continue to use, distribute or otherwise
-make the Covered Software available under the terms of the
-version of the License under which You originally received
-the Covered Software. If the Initial Developer includes a
-notice in the Original Software prohibiting it from being
-distributed or otherwise made available under any
-subsequent version of the License, You must distribute and
-make the Covered Software available under the terms of the
-version of the License under which You originally received
-the Covered Software. Otherwise, You may also choose to
-use, distribute or otherwise make the Covered Software
-available under the terms of any subsequent version of the
-License published by the license steward.
-
-4.3. Modified Versions.
-
-When You are an Initial Developer and You want to create a
-new license for Your Original Software, You may create and
-use a modified version of this License if You: (a) rename
-the license and remove any references to the name of the
-license steward (except to note that the license differs
-from this License); and (b) otherwise make it clear that
-the license contains terms which differ from this License.
-
-5. DISCLAIMER OF WARRANTY.
-
-COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
-BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
-INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
-SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
-PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
-PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
-COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
-INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
-ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
-WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
-ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
-DISCLAIMER.
-
-6. TERMINATION.
-
-6.1. This License and the rights granted hereunder will
-terminate automatically if You fail to comply with terms
-herein and fail to cure such breach within 30 days of
-becoming aware of the breach. Provisions which, by their
-nature, must remain in effect beyond the termination of
-this License shall survive.
-
-6.2. If You assert a patent infringement claim (excluding
-declaratory judgment actions) against Initial Developer or
-a Contributor (the Initial Developer or Contributor against
-whom You assert such claim is referred to as "Participant")
-alleging that the Participant Software (meaning the
-Contributor Version where the Participant is a Contributor
-or the Original Software where the Participant is the
-Initial Developer) directly or indirectly infringes any
-patent, then any and all rights granted directly or
-indirectly to You by such Participant, the Initial
-Developer (if the Initial Developer is not the Participant)
-and all Contributors under Sections 2.1 and/or 2.2 of this
-License shall, upon 60 days notice from Participant
-terminate prospectively and automatically at the expiration
-of such 60 day notice period, unless if within such 60 day
-period You withdraw Your claim with respect to the
-Participant Software against such Participant either
-unilaterally or pursuant to a written agreement with
-Participant.
-
-6.3. In the event of termination under Sections 6.1 or 6.2
-above, all end user licenses that have been validly granted
-by You or any distributor hereunder prior to termination
-(excluding licenses granted to You by any distributor)
-shall survive termination.
-
-7. LIMITATION OF LIABILITY.
-
-UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
-(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
-INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
-COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
-LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
-CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
-LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
-STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
-COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
-INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
-LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
-INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
-APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
-NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
-CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
-APPLY TO YOU.
-
-8. U.S. GOVERNMENT END USERS.
-
-The Covered Software is a "commercial item," as that term is
-defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
-computer software" (as that term is defined at 48 C.F.R. $
-252.227-7014(a)(1)) and "commercial computer software
-documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
-1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
-through 227.7202-4 (June 1995), all U.S. Government End Users
-acquire Covered Software with only those rights set forth herein.
-This U.S. Government Rights clause is in lieu of, and supersedes,
-any other FAR, DFAR, or other clause or provision that addresses
-Government rights in computer software under this License.
-
-9. MISCELLANEOUS.
-
-This License represents the complete agreement concerning subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the
-extent necessary to make it enforceable. This License shall be
-governed by the law of the jurisdiction specified in a notice
-contained within the Original Software (except to the extent
-applicable law, if any, provides otherwise), excluding such
-jurisdiction's conflict-of-law provisions. Any litigation
-relating to this License shall be subject to the jurisdiction of
-the courts located in the jurisdiction and venue specified in a
-notice contained within the Original Software, with the losing
-party responsible for costs, including, without limitation, court
-costs and reasonable attorneys' fees and expenses. The
-application of the United Nations Convention on Contracts for the
-International Sale of Goods is expressly excluded. Any law or
-regulation which provides that the language of a contract shall
-be construed against the drafter shall not apply to this License.
-You agree that You alone are responsible for compliance with the
-United States export administration regulations (and the export
-control laws and regulation of any other countries) when You use,
-distribute or otherwise make available any Covered Software.
-
-10. RESPONSIBILITY FOR CLAIMS.
-
-As between Initial Developer and the Contributors, each party is
-responsible for claims and damages arising, directly or
-indirectly, out of its utilization of rights under this License
-and You agree to work with Initial Developer and Contributors to
-distribute such responsibility on an equitable basis. Nothing
-herein is intended or shall be deemed to constitute any admission
-of liability.
-
-==
-
-For javax.annotation-api (https://jcp.org/en/jsr/detail?id=250):
-This is licensed under the CDDL 1.0, see above.
-
-==
-
-For Bean Validation API (http://beanvalidation.org/):
-This is licensed under the AL 2.0, see above.
-
-==
-
-For javax.ws.rs-api (https://jax-rs-spec.java.net/):
-This is licensed under the CDDL 1.0, see above.
-
-==
-
-For Joda Time (http://www.joda.org/joda-time/):
-This is licensed under the AL 2.0, see above.
-
-==
-
-For StAX2 API (http://wiki.fasterxml.com/WoodstoxStax2):
-This is licensed under the BSD license:
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, this
-list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright notice,
-this list of conditions and the following disclaimer in the documentation
-and/or other materials provided with the distribution.
-
-3. Neither the name of the copyright holder nor the names of its contributors
-may be used to endorse or promote products derived from this software without
-specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-==
-
-For Woodstox (http://wiki.fasterxml.com/WoodstoxHome):
-This is licensed under the AL 2.0, see above.
-
-==
-
-For jasypt (http://www.jasypt.org/):
-This is licensed under the AL 2.0, see above.
-
-==
-
-For Simple Logging Facade for Java - SLF4J (http://www.slf4j.org/):
-This is licensed under the MIT license:
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-==
-
-For Spring Framework (http://projects.spring.io/spring-framework/):
-This is licensed under the AL 2.0, see above.
diff --git a/client/cli/NOTICE b/client/cli/NOTICE
deleted file mode 100644
index 3171f8e..0000000
--- a/client/cli/NOTICE
+++ /dev/null
@@ -1,61 +0,0 @@
-Apache Syncope
-Copyright 2012-2018 The Apache Software Foundation
-
-This product includes software developed by:
-The Apache Software Foundation (http://www.apache.org/).
-
-The following copyright notice(s) were affixed to portions of this code
-with which this file is now or was at one time distributed.
-
-==
-
-This product includes software developed by the Jackson project.
-
-==
-
-This product includes software developed by the JAXB project.
-Copyright (c) 2013-2016 The JAXB project.
-
-==
-
-This product includs software developed by Oracle.
-Copyright (c) 2012-2013 Oracle and/or its affiliates. All rights reserved.
-
-==
-
-This product includes software developed by the Bean Validation Project (http://beanvalidation.org).
-Copyright (c) Red Hat, Inc., Emmanuel Bernard
-
-==
-
-This product includes software developed by the JAX-RS project.
-Copyright (c) 2014, Oracle Corporation and/or its affiliates. All rights reserved.
-
-==
-
-This product includes software developed by the Joda Time project.
-Copyright (c) 2002-2016 Joda.org. All Rights Reserved.
-
-==
-
-This product includes software developed by the Stax 2 Extension API Project.
-
-==
-
-This product includes software developed by the Woodstox Project.
-
-==
-
-This project includes software developed by the Jasypt project.
-Copyright (c) 2014 The JASYPT team. All Rights Reserved
-
-==
-
-This products includes software developed by the Simple Logging Facade for Java (SLF4J) project.
-Copyright (c) 2004-2016 QOS.ch.
-
-==
-
-This product includes software developed by SpringSource.
-Copyright (c) 2004-2016 SpringSource
-All rights reserved.
diff --git a/client/cli/pom.xml b/client/cli/pom.xml
deleted file mode 100644
index e0daba5..0000000
--- a/client/cli/pom.xml
+++ /dev/null
@@ -1,206 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.syncope</groupId>
- <artifactId>syncope-client</artifactId>
- <version>3.0.0-SNAPSHOT</version>
- </parent>
-
- <name>Apache Syncope Client CLI</name>
- <description>Apache Syncope Client CLI</description>
-
- <groupId>org.apache.syncope.client</groupId>
- <artifactId>syncope-client-cli</artifactId>
- <packaging>jar</packaging>
-
- <properties>
- <rootpom.basedir>${basedir}/../..</rootpom.basedir>
- </properties>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.syncope.client.idm</groupId>
- <artifactId>syncope-client-idm-lib</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.jasypt</groupId>
- <artifactId>jasypt</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- </dependency>
- <dependency>
- <groupId>com.lmax</groupId>
- <artifactId>disruptor</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-jdbc</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.syncope.core</groupId>
- <artifactId>syncope-core-persistence-jpa</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-engine</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
-
- <defaultGoal>package</defaultGoal>
-
- <plugins>
- <plugin>
- <groupId>org.codehaus.gmaven</groupId>
- <artifactId>gmaven-plugin</artifactId>
- <inherited>true</inherited>
- <executions>
- <execution>
- <phase>generate-resources</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <source>
- project.properties['log.directory'] = System.getProperty("java.io.tmpdir")
- </source>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <appendAssemblyId>false</appendAssemblyId>
- <descriptors>
- <descriptor>src/assemble/cli-zip.xml</descriptor>
- </descriptors>
- </configuration>
- <executions>
- <execution>
- <id>make-cli-zip</id>
- <phase>verify</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
- </plugin>
- </plugins>
-
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- </resource>
-
- <resource>
- <directory>${basedir}</directory>
- <targetPath>META-INF</targetPath>
- <includes>
- <include>LICENSE</include>
- <include>NOTICE</include>
- </includes>
- </resource>
- </resources>
-
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- <filtering>true</filtering>
- </testResource>
- </testResources>
- </build>
-
- <profiles>
- <profile>
- <id>apache-release</id>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <inherited>false</inherited>
- <configuration>
- <skipSource>true</skipSource>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-</project>
diff --git a/client/cli/src/assemble/cli-zip.xml b/client/cli/src/assemble/cli-zip.xml
deleted file mode 100644
index 1e242a3..0000000
--- a/client/cli/src/assemble/cli-zip.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
- http://maven.apache.org/xsd/assembly-1.1.2.xsd">
-
- <id>cli</id>
-
- <formats>
- <format>zip</format>
- </formats>
-
- <includeBaseDirectory>false</includeBaseDirectory>
-
- <fileSets>
- <fileSet>
- <directory>${basedir}</directory>
- <includes>
- <include>LICENSE</include>
- <include>NOTICE</include>
- </includes>
- <outputDirectory>${project.build.finalName}</outputDirectory>
- </fileSet>
- <fileSet>
- <directory>${project.build.directory}/classes</directory>
- <includes>
- <include>syncopeadm.sh</include>
- <include>syncopeadm.bat</include>
- </includes>
- <outputDirectory>${project.build.finalName}</outputDirectory>
- <fileMode>0755</fileMode>
- </fileSet>
- </fileSets>
-
- <dependencySets>
- <dependencySet>
- <outputDirectory>${project.build.finalName}/lib</outputDirectory>
- <useProjectArtifact>true</useProjectArtifact>
- <unpack>false</unpack>
- <scope>runtime</scope>
- </dependencySet>
- </dependencySets>
-
-</assembly>
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/ArgsManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/ArgsManager.java
deleted file mode 100644
index 06dd7f4..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/ArgsManager.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli;
-
-import java.io.File;
-import org.apache.syncope.client.cli.commands.install.InstallConfigFileTemplate;
-
-public final class ArgsManager {
-
- public static void validator(final String[] args) throws IllegalArgumentException {
- if (args.length == 0) {
- throw new IllegalArgumentException("Syntax error: no options");
- } else if (!"install".equalsIgnoreCase(args[0])) {
- final File configFile = new File(InstallConfigFileTemplate.configurationFilePath());
- if (!configFile.exists()) {
- throw new IllegalArgumentException(
- "It seems you need to first setup the CLI client. Run install --setup.");
- }
- }
- }
-
- public static String[] operands(final String[] args) {
- final String[] operands = new String[args.length - 1];
- for (int i = 1; i < args.length; i++) {
- operands[i - 1] = args[i];
- }
- return operands;
- }
-
- private ArgsManager() {
- // private constructor for static utility class
- }
-
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/Command.java b/client/cli/src/main/java/org/apache/syncope/client/cli/Command.java
deleted file mode 100644
index 2c36dd8..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/Command.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(value = RetentionPolicy.RUNTIME)
-@Target(value = ElementType.TYPE)
-public @interface Command {
-
- String name();
-
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/CommandClassScanner.java b/client/cli/src/main/java/org/apache/syncope/client/cli/CommandClassScanner.java
deleted file mode 100644
index 9ee7885..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/CommandClassScanner.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.syncope.client.cli.commands.AbstractCommand;
-import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
-import org.springframework.core.type.filter.AnnotationTypeFilter;
-import org.springframework.util.ClassUtils;
-
-public class CommandClassScanner extends ClassPathScanningCandidateComponentProvider {
-
- public CommandClassScanner() {
- super(false);
- addIncludeFilter(new AnnotationTypeFilter(Command.class));
- }
-
- @SuppressWarnings("unchecked")
- public final List<Class<? extends AbstractCommand>> getComponentClasses() throws IllegalArgumentException {
- final String basePackage = "org.apache.syncope.client.cli.commands";
- List<Class<? extends AbstractCommand>> classes = new ArrayList<>();
- findCandidateComponents(basePackage).stream().
- map(candidate -> (Class<? extends AbstractCommand>) ClassUtils.resolveClassName(
- candidate.getBeanClassName(), ClassUtils.getDefaultClassLoader())).
- forEachOrdered(cls -> {
- classes.add(cls);
- });
- return classes;
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java b/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java
deleted file mode 100644
index 0290902..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/Input.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import org.apache.commons.lang3.tuple.Pair;
-import org.apache.syncope.client.cli.commands.AbstractCommand;
-import org.apache.syncope.client.cli.util.CommandUtils;
-
-public class Input {
-
- public static Pair<String, String> toPairParameter(final String parameter) throws IllegalArgumentException {
- if (!parameter.contains("=")) {
- throw new IllegalArgumentException("Parameter syntax error!");
- }
- final String[] pairParameterArray = parameter.split("=");
- return Pair.of(pairParameterArray[0], pairParameterArray[1]);
- }
-
- private final AbstractCommand command;
-
- private final String[] parameters;
-
- private final List<String> commandFields = new ArrayList<>();
-
- private String option;
-
- public Input(final String[] args)
- throws InstantiationException, IllegalAccessException, IllegalArgumentException,
- NoSuchMethodException, InvocationTargetException {
-
- command = CommandUtils.fromArgs(args[0]);
- commandFields.add(args[0]);
-
- if (args.length > 1) {
- option = args[1];
- commandFields.add(args[1]);
- }
-
- if (args.length > 2) {
- parameters = new String[args.length - 2];
- for (int i = 0; i < parameters.length; i++) {
- parameters[i] = args[i + 2];
- commandFields.add(parameters[i]);
- }
- } else {
- parameters = new String[0];
- }
- }
-
- public AbstractCommand getCommand() {
- return command;
- }
-
- public void setOption(final String option) {
- this.option = option;
- }
-
- public String getOption() {
- return option;
- }
-
- public String[] getParameters() {
- return parameters;
- }
-
- public List<String> listParameters() {
- return Arrays.asList(parameters);
- }
-
- public String firstParameter() {
- return parameters[0];
- }
-
- public String secondParameter() {
- return parameters[1];
- }
-
- public String thirdParameter() {
- return parameters[2];
- }
-
- public String lastParameter() {
- return parameters[parameters.length - 1];
- }
-
- public int parameterNumber() {
- return parameters.length;
- }
-
- public String printCommandFields() {
- final StringBuilder commandBuilder = new StringBuilder();
- commandFields.forEach(commandField -> {
- commandBuilder.append(commandField).append(" ");
- });
- return commandBuilder.toString();
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/ResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/ResultManager.java
deleted file mode 100644
index de3d0f1..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/ResultManager.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli;
-
-import org.apache.syncope.client.cli.commands.CommonsResultManager;
-
-public class ResultManager extends CommonsResultManager {
-
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/SyncopeAdm.java b/client/cli/src/main/java/org/apache/syncope/client/cli/SyncopeAdm.java
deleted file mode 100644
index 8a75f75..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/SyncopeAdm.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli;
-
-import java.lang.reflect.InvocationTargetException;
-import javax.ws.rs.ProcessingException;
-import org.apache.commons.lang3.exception.ExceptionUtils;
-import org.apache.syncope.client.cli.commands.AbstractCommand;
-import org.apache.syncope.client.cli.util.CommandUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class SyncopeAdm {
-
- private static final Logger LOG = LoggerFactory.getLogger(SyncopeAdm.class);
-
- private static final ResultManager RESULT_MANAGER = new ResultManager();
-
- public static void main(final String[] args) {
- LOG.debug("Starting with args \n");
-
- try {
- ArgsManager.validator(args);
- final Input input = new Input(args);
- final AbstractCommand command = input.getCommand();
-
- LOG.debug("Command: {}", command.getClass().getAnnotation(Command.class).name());
- LOG.debug("Option: {}", input.getOption());
- LOG.debug("Parameters:");
- for (final String parameter : input.getParameters()) {
- LOG.debug(" > " + parameter);
- }
-
- System.out.println("");
- System.out.println("You are running: " + input.printCommandFields());
- command.execute(input);
- } catch (IllegalAccessException | InstantiationException | NoSuchMethodException
- | InvocationTargetException e) {
-
- System.out.println(helpMessage());
- } catch (final IllegalArgumentException ex) {
- LOG.error("Error in main", ex);
- if (!ex.getMessage().startsWith("It seems you")) {
- System.out.println("");
- System.out.println(helpMessage());
- } else {
- RESULT_MANAGER.genericError(ex.getMessage());
- }
- } catch (final ProcessingException e) {
- LOG.error("Error in main", e);
- RESULT_MANAGER.genericError("Problems contacting Syncope Server");
- RESULT_MANAGER.genericError(ExceptionUtils.getMessage(e));
- }
-
- }
-
- private static String helpMessage() {
- final StringBuilder helpMessageBuilder = new StringBuilder("Usage: Main [options]\n");
- helpMessageBuilder.append(" Options:\n");
- try {
- for (AbstractCommand command : CommandUtils.commands()) {
- final String commandName = command.getClass().getAnnotation(Command.class).name();
- helpMessageBuilder.append(" ").append(commandName);
- if (!"help".equalsIgnoreCase(commandName)) {
- helpMessageBuilder.append(" --help");
- }
- helpMessageBuilder.append("\n");
- }
- } catch (Exception e) {
- LOG.error("Error in main", e);
- RESULT_MANAGER.genericError(e.getMessage());
- }
-
- return helpMessageBuilder.toString();
- }
-
- private SyncopeAdm() {
- // private constructor for static utility class
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/SyncopeServices.java b/client/cli/src/main/java/org/apache/syncope/client/cli/SyncopeServices.java
deleted file mode 100644
index 29c6feb..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/SyncopeServices.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.Properties;
-import org.apache.commons.lang3.BooleanUtils;
-import org.apache.syncope.client.cli.commands.install.InstallConfigFileTemplate;
-import org.apache.syncope.client.cli.util.JasyptUtils;
-import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.client.lib.SyncopeClientFactoryBean;
-import org.apache.syncope.client.lib.batch.BatchRequest;
-import org.apache.syncope.common.rest.api.service.SyncopeService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class SyncopeServices {
-
- private static final Logger LOG = LoggerFactory.getLogger(SyncopeServices.class);
-
- private static String SYNCOPE_ADDRESS;
-
- private static SyncopeClient client() {
- final Properties properties = new Properties();
- try (InputStream is = Files.newInputStream(Paths.get(InstallConfigFileTemplate.configurationFilePath()))) {
- properties.load(is);
- } catch (final IOException e) {
- LOG.error("Error opening properties file", e);
- }
-
- String syncopeAdminPassword = JasyptUtils.get().decrypt(properties.getProperty("syncope.admin.password"));
- SYNCOPE_ADDRESS = properties.getProperty("syncope.rest.services");
- String useGZIPCompression = properties.getProperty("useGZIPCompression");
- return new SyncopeClientFactoryBean().
- setAddress(SYNCOPE_ADDRESS).
- setUseCompression(BooleanUtils.toBoolean(useGZIPCompression)).
- create(properties.getProperty("syncope.admin.user"), syncopeAdminPassword);
- }
-
- public static <T> T get(final Class<T> clazz) {
- LOG.debug("Creating service for {}", clazz.getName());
- return client().getService(clazz);
- }
-
- public static BatchRequest batch() {
- return client().batch();
- }
-
- public static String getAddress() {
- return SYNCOPE_ADDRESS;
- }
-
- public static void testUsernameAndPassword(final String username, final String password) {
- final Properties properties = new Properties();
- try (InputStream is = Files.newInputStream(Paths.get(InstallConfigFileTemplate.configurationFilePath()))) {
- properties.load(is);
- } catch (final IOException e) {
- LOG.error("Error opening properties file", e);
- }
- final SyncopeClient syncopeClient = new SyncopeClientFactoryBean()
- .setAddress(properties.getProperty("syncope.rest.services")).create(username, password);
- syncopeClient.getService(SyncopeService.class).platform();
- }
-
- private SyncopeServices() {
- // private constructor for static utility class
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/AbstractCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/AbstractCommand.java
deleted file mode 100644
index 7d9d541..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/AbstractCommand.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands;
-
-import org.apache.syncope.client.cli.Input;
-
-public abstract class AbstractCommand {
-
- public abstract void execute(Input input);
-
- public abstract String getHelpMessage();
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
deleted file mode 100644
index da5b2b4..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/CommonsResultManager.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import org.apache.syncope.client.cli.Command;
-import org.apache.syncope.client.cli.view.Messages;
-import org.apache.syncope.client.cli.view.Table;
-import org.apache.syncope.common.lib.types.ConnConfProperty;
-
-public abstract class CommonsResultManager {
-
- public void numberFormatException(final String what, final String key) {
- Messages.printIdNotNumberDeletedMessage(what, key);
- }
-
- public void unnecessaryParameters(final List<String> parameters, final String helpMessage) {
- Messages.printUnnecessaryParameters(parameters, helpMessage);
- }
-
- public void deletedMessage(final String what, final String key) {
- Messages.printDeletedMessage(what, key);
- }
-
- public void notFoundError(final String what, final String parameter) {
- Messages.printNofFoundMessage(what, parameter);
- }
-
- public void notBooleanDeletedError(final String what, final String key) {
- Messages.printNotBooleanDeletedMessage(what, key);
- }
-
- public void typeNotValidError(final String what, final String parameter, final String[] options) {
- Messages.printTypeNotValidMessage(what, parameter, options);
- }
-
- public void commandOptionError(final String message) {
- Messages.printCommandOptionMessage(message);
- }
-
- public void defaultOptionMessage(final String option, final String helpMessage) {
- Messages.printDefaultMessage(option, helpMessage);
- }
-
- public void genericMessage(final String... messages) {
- Messages.printMessage(messages);
- }
-
- public void genericError(final String error) {
- Messages.printMessage("Error: " + error);
- }
-
- public String commandHelpMessage(final Class<?> name) {
- return Messages.commandHelpMessage(name.getAnnotation(Command.class).name());
- }
-
- protected void printConfiguration(final Collection<ConnConfProperty> props) {
- props.forEach(prop -> {
- System.out.println(" name: " + prop.getSchema().getName());
- System.out.println(" values: " + prop.getValues());
- System.out.println(" type: " + prop.getSchema().getType());
- System.out.println(" display name: " + prop.getSchema().getDisplayName());
- System.out.println(" help message: " + prop.getSchema().getHelpMessage());
- System.out.println(" order: " + prop.getSchema().getOrder());
- System.out.println(" default values: " + prop.getSchema().getDefaultValues());
- System.out.println(" confidential: " + prop.getSchema().isConfidential());
- System.out.println(" required: " + prop.getSchema().isRequired());
- System.out.println(" overridable: " + prop.isOverridable());
- System.out.println("");
- });
- }
-
- protected void printDetails(final String title, final Map<String, String> details) {
- final Table.TableBuilder tableBuilder = new Table.TableBuilder(title).header("detail").header("value");
- details.forEach((key, value) -> {
- tableBuilder.rowValues(Arrays.asList(key, value));
- });
- tableBuilder.build().print();
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AbstractAnyObjectCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AbstractAnyObjectCommand.java
deleted file mode 100644
index b78b772..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AbstractAnyObjectCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.anyobject;
-
-public abstract class AbstractAnyObjectCommand {
-
- protected final AnyObjectSyncopeOperations anySyncopeOperations = new AnyObjectSyncopeOperations();
-
- protected final AnyObjectResultManager anyResultManager = new AnyObjectResultManager();
-
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectCommand.java
deleted file mode 100644
index 520e3ec..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectCommand.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.anyobject;
-
-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.commands.AbstractCommand;
-
-@Command(name = "anyObject")
-public class AnyObjectCommand extends AbstractCommand {
-
- private final AnyObjectResultManager anyObjectResultManager = new AnyObjectResultManager();
-
- @Override
- public void execute(final Input input) {
- if (StringUtils.isBlank(input.getOption())) {
- input.setOption(AnyObjectOptions.HELP.getOptionName());
- }
- switch (AnyObjectOptions.fromName(input.getOption())) {
- case DETAILS:
- break;
- case LIST:
- new AnyObjectList(input).list();
- break;
- case READ:
- new AnyObjectRead(input).read();
- break;
- case READ_ATTRIBUTES_BY_SCHEMA:
- new AnyObjectReadAttributeBySchemaTypeAndSchemaKey(input).read();
- break;
- case READ_ATTRIBUTES_BY_SCHEMA_TYPE:
- new AnyObjectReadAttributesBySchemaType(input).read();
- break;
- case DELETE:
- new AnyObjectDelete(input).delete();
- break;
- case HELP:
- System.out.println(getHelpMessage());
- break;
- default:
- anyObjectResultManager.defaultOptionMessage(input.getOption(), getHelpMessage());
- }
- }
-
- @Override
- public String getHelpMessage() {
- return anyObjectResultManager.commandHelpMessage(getClass());
- }
-
- private enum AnyObjectOptions {
-
- HELP("--help"),
- DETAILS("--details"),
- LIST("--list"),
- READ("--read"),
- READ_ATTRIBUTES_BY_SCHEMA("--read-attr-by-schema"),
- READ_ATTRIBUTES_BY_SCHEMA_TYPE("--read-attr-by-schema-type"),
- DELETE("--delete");
-
- private final String optionName;
-
- AnyObjectOptions(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 AnyObjectOptions fromName(final String name) {
- AnyObjectOptions optionToReturn = HELP;
- for (final AnyObjectOptions option : AnyObjectOptions.values()) {
- if (option.equalsOptionName(name)) {
- optionToReturn = option;
- }
- }
- return optionToReturn;
- }
-
- public static List<String> toList() {
- final List<String> options = new ArrayList<>();
- for (final AnyObjectOptions value : values()) {
- options.add(value.getOptionName());
- }
- return options;
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectDelete.java
deleted file mode 100644
index f7b635c..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectDelete.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.anyobject;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AnyObjectDelete extends AbstractAnyObjectCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(AnyObjectDelete.class);
-
- private static final String DELETE_HELP_MESSAGE = "any --delete {ANY_OBJECT-KEY} {ANY_OBJECT-KEY} [...]";
-
- private final Input input;
-
- public AnyObjectDelete(final Input input) {
- this.input = input;
- }
-
- public void delete() {
- if (input.parameterNumber() >= 1) {
- for (final String parameter : input.getParameters()) {
- try {
- anySyncopeOperations.delete(parameter);
- anyResultManager.deletedMessage("Any", parameter);
- } catch (final SyncopeClientException ex) {
- LOG.error("Error deleting group", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- anyResultManager.notFoundError("any", parameter);
- } else {
- anyResultManager.genericError(ex.getMessage());
- }
- } catch (final NumberFormatException ex) {
- anyResultManager.numberFormatException("any", parameter);
- }
- }
- } else {
- anyResultManager.commandOptionError(DELETE_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectList.java
deleted file mode 100644
index 1e3e658..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectList.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.anyobject;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AnyObjectList extends AbstractAnyObjectCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(AnyObjectList.class);
-
- private static final String LIST_HELP_MESSAGE = "any --list {ANY-TYPE}";
-
- private final Input input;
-
- public AnyObjectList(final Input input) {
- this.input = input;
- }
-
- public void list() {
- if (input.parameterNumber() == 1) {
- try {
- anyResultManager.printAnys(anySyncopeOperations.list(input.firstParameter()));
- } catch (final SyncopeClientException ex) {
- LOG.error("Error listing any object", ex);
- anyResultManager.genericError(ex.getMessage());
- }
- } else {
- anyResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectRead.java
deleted file mode 100644
index f084c38..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectRead.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.anyobject;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AnyObjectRead extends AbstractAnyObjectCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(AnyObjectRead.class);
-
- private static final String READ_HELP_MESSAGE = "any --read {ANY_OBJECT-KEY} {ANY_OBJECT-KEY} [...]";
-
- private final Input input;
-
- public AnyObjectRead(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.parameterNumber() >= 1) {
- for (final String parameter : input.getParameters()) {
- try {
- anyResultManager.printAny(anySyncopeOperations.read(parameter));
- } catch (final SyncopeClientException ex) {
- LOG.error("Error reading group", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- anyResultManager.notFoundError("Any object", parameter);
- } else {
- anyResultManager.genericError(ex.getMessage());
- }
- } catch (final NumberFormatException ex) {
- anyResultManager.numberFormatException("any object", parameter);
- }
- }
- } else {
- anyResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectReadAttributeBySchemaTypeAndSchemaKey.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectReadAttributeBySchemaTypeAndSchemaKey.java
deleted file mode 100644
index e3deda3..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectReadAttributeBySchemaTypeAndSchemaKey.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.anyobject;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.client.cli.util.CommandUtils;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.types.SchemaType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AnyObjectReadAttributeBySchemaTypeAndSchemaKey extends AbstractAnyObjectCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(AnyObjectReadAttributeBySchemaTypeAndSchemaKey.class);
-
- private static final String READ_HELP_MESSAGE
- = "any --read-attr-by-schema {ANY_OBJECT-KEY} {SCHEMA-TYPE} {SCHEMA-KEY}\n"
- + " Schema type: PLAIN / DERIVED / VIRTUAL";
-
- private final Input input;
-
- public AnyObjectReadAttributeBySchemaTypeAndSchemaKey(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.parameterNumber() == 3) {
- try {
- anyResultManager.printAttribute(anySyncopeOperations.readAttribute(
- input.firstParameter(), input.secondParameter(), input.thirdParameter()));
- } catch (final SyncopeClientException ex) {
- LOG.error("Error reading any object", ex);
- anyResultManager.genericError(ex.getMessage());
- } catch (final NumberFormatException ex) {
- anyResultManager.numberFormatException("any object", input.firstParameter());
- } catch (final IllegalArgumentException ex) {
- LOG.error("Error reading schema", ex);
- anyResultManager.typeNotValidError(
- "schema", input.secondParameter(), CommandUtils.fromEnumToArray(SchemaType.class));
- }
- } else {
- anyResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectReadAttributesBySchemaType.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectReadAttributesBySchemaType.java
deleted file mode 100644
index c2ece79..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectReadAttributesBySchemaType.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.anyobject;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.client.cli.util.CommandUtils;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.types.SchemaType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AnyObjectReadAttributesBySchemaType extends AbstractAnyObjectCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(AnyObjectReadAttributesBySchemaType.class);
-
- private static final String READ_HELP_MESSAGE = "any --read-attr-by-schema-type {ANY_OBJECT-KEY} {SCHEMA-TYPE}\n"
- + " Schema type: PLAIN / DERIVED / VIRTUAL";
-
- private final Input input;
-
- public AnyObjectReadAttributesBySchemaType(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.parameterNumber() == 2) {
- try {
- anyResultManager.printAttributes(anySyncopeOperations.readAttributes(
- input.firstParameter(), input.secondParameter()));
- } catch (final SyncopeClientException ex) {
- LOG.error("Error reading any", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- anyResultManager.notFoundError("Any", input.firstParameter());
- } else {
- anyResultManager.genericError(ex.getMessage());
- }
- } catch (final NumberFormatException ex) {
- anyResultManager.numberFormatException("any", input.firstParameter());
- } catch (final IllegalArgumentException ex) {
- LOG.error("Error reading schema", ex);
- anyResultManager.typeNotValidError(
- "schema", input.secondParameter(), CommandUtils.fromEnumToArray(SchemaType.class));
- }
- } else {
- anyResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectResultManager.java
deleted file mode 100644
index d022ef7..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectResultManager.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.anyobject;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.syncope.client.cli.commands.CommonsResultManager;
-import org.apache.syncope.common.lib.Attr;
-import org.apache.syncope.common.lib.to.AnyObjectTO;
-
-public class AnyObjectResultManager extends CommonsResultManager {
-
- public void printAnys(final List<AnyObjectTO> anyObjectTOs) {
- System.out.println("");
- for (final AnyObjectTO anyObjectTO : anyObjectTOs) {
- printAny(anyObjectTO);
- }
- }
-
- public void printAny(final AnyObjectTO anyObjectTO) {
- System.out.println(" > ANY OBJECT KEY: " + anyObjectTO.getKey());
- System.out.println(" type: " + anyObjectTO.getType());
- System.out.println(" realm: " + anyObjectTO.getRealm());
- System.out.println(" status: " + anyObjectTO.getStatus());
- System.out.println(" RESOURCES: ");
- printResources(anyObjectTO.getResources());
- System.out.println(" PLAIN ATTRIBUTES: ");
- printAttributes(anyObjectTO.getPlainAttrs());
- System.out.println(" DERIVED ATTRIBUTES: ");
- printAttributes(anyObjectTO.getDerAttrs());
- System.out.println(" VIRTUAL ATTRIBUTES: ");
- printAttributes(anyObjectTO.getVirAttrs());
- }
-
- private void printResources(final Set<String> resources) {
- for (final String resource : resources) {
- System.out.println(" - " + resource);
- }
- }
-
- public void printAttributes(final Set<Attr> attributes) {
- for (final Attr attribute : attributes) {
- printAttribute(attribute);
- }
- System.out.println("");
- }
-
- public void printAttribute(final Attr attribute) {
- final StringBuilder attributeMessageBuilder = new StringBuilder();
- attributeMessageBuilder.append(" - ")
- .append(attribute.getSchema())
- .append(": ")
- .append(attribute.getValues());
- System.out.println(attributeMessageBuilder.toString());
- }
-
- public void printDetails(final Map<String, String> details) {
- printDetails("groups details", details);
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectSyncopeOperations.java
deleted file mode 100644
index 936ebb0..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/anyobject/AnyObjectSyncopeOperations.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.anyobject;
-
-import java.util.List;
-import java.util.Set;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.client.lib.SyncopeClient;
-import org.apache.syncope.common.lib.Attr;
-import org.apache.syncope.common.lib.to.AnyObjectTO;
-import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.rest.api.beans.AnyQuery;
-import org.apache.syncope.common.rest.api.service.AnyObjectService;
-
-public class AnyObjectSyncopeOperations {
-
- private final AnyObjectService anyObjectService = SyncopeServices.get(AnyObjectService.class);
-
- public List<AnyObjectTO> list(final String type) {
- return anyObjectService.search(
- new AnyQuery.Builder().fiql(SyncopeClient.getAnyObjectSearchConditionBuilder(type).query()).build()).
- getResult();
- }
-
- public AnyObjectTO read(final String anyKey) {
- return anyObjectService.read(anyKey);
- }
-
- public Set<Attr> readAttributes(final String anyKey, final String schemaType) {
- return anyObjectService.read(anyKey, SchemaType.valueOf(schemaType));
- }
-
- public Attr readAttribute(final String anyKey, final String schemaType, final String schema) {
- return anyObjectService.read(anyKey, SchemaType.valueOf(schemaType), schema);
- }
-
- public void delete(final String anyKey) {
- anyObjectService.delete(anyKey);
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/AbstractConfigurationCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/AbstractConfigurationCommand.java
deleted file mode 100644
index d7e2d27..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/AbstractConfigurationCommand.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.configuration;
-
-public abstract class AbstractConfigurationCommand {
-
- protected final ConfigurationSyncopeOperations configurationSyncopeOperations =
- new ConfigurationSyncopeOperations();
-
- protected final ConfigurationResultManager configurationResultManager = new ConfigurationResultManager();
-
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationCommand.java
deleted file mode 100644
index ed7a613..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationCommand.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.configuration;
-
-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.commands.AbstractCommand;
-
-@Command(name = "configuration")
-public class ConfigurationCommand extends AbstractCommand {
-
- private final ConfigurationResultManager configurationResultManager = new ConfigurationResultManager();
-
- @Override
- public void execute(final Input input) {
- if (StringUtils.isBlank(input.getOption())) {
- input.setOption(Options.HELP.getOptionName());
- }
-
- switch (Options.fromName(input.getOption())) {
- case GET:
- new ConfigurationGet(input).get();
- break;
- case READ:
- new ConfigurationRead(input).read();
- break;
- case UPDATE:
- new ConfigurationUpdate(input).update();
- break;
- case DELETE:
- new ConfigurationDelete(input).delete();
- break;
- case EXPORT:
- new ConfigurationExport(input).export();
- break;
- case HELP:
- System.out.println(getHelpMessage());
- break;
- default:
- configurationResultManager.defaultOptionMessage(input.getOption(), getHelpMessage());
- }
- }
-
- @Override
- public String getHelpMessage() {
- return configurationResultManager.commandHelpMessage(getClass());
- }
-
- private enum Options {
-
- HELP("--help"),
- GET("--get"),
- READ("--read"),
- UPDATE("--update"),
- DELETE("--delete"),
- EXPORT("--export");
-
- private 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;
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java
deleted file mode 100644
index 423139b..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationDelete.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.configuration;
-
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConfigurationDelete extends AbstractConfigurationCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(ConfigurationDelete.class);
-
- private static final String DELETE_HELP_MESSAGE = "configuration --delete {CONF-NAME} {CONF-NAME} [...]";
-
- private final Input input;
-
- public ConfigurationDelete(final Input input) {
- this.input = input;
- }
-
- public void delete() {
- if (input.parameterNumber() >= 1) {
- for (final String parameter : input.getParameters()) {
- try {
- configurationSyncopeOperations.delete(parameter);
- configurationResultManager.deletedMessage("Configuration", parameter);
- } catch (final SyncopeClientException | WebServiceException ex) {
- LOG.error("Error deleting configuration", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- configurationResultManager.notFoundError("Configuration", parameter);
- } else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
- configurationResultManager.genericError("You cannot delete configuration " + parameter);
- } else {
- configurationResultManager.genericError(ex.getMessage());
- }
- break;
- }
- }
- } else {
- configurationResultManager.commandOptionError(DELETE_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java
deleted file mode 100644
index d86a95d..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationExport.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.configuration;
-
-import java.io.InputStream;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.client.cli.util.XMLUtils;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConfigurationExport extends AbstractConfigurationCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(ConfigurationExport.class);
-
- private static final String EXPORT_HELP_MESSAGE = "configuration --export {WHERE-DIR}";
-
- private static final String EXPORT_FILE_NAME = "/content.xml";
-
- private final Input input;
-
- public ConfigurationExport(final Input input) {
- this.input = input;
- }
-
- public void export() {
- if (input.parameterNumber() == 1) {
- try {
- XMLUtils.createXMLFile(
- (InputStream) configurationSyncopeOperations.export().getEntity(),
- input.firstParameter() + EXPORT_FILE_NAME);
- configurationResultManager.genericMessage(
- input.firstParameter() + EXPORT_FILE_NAME + " successfully created");
- } catch (final SyncopeClientException ex) {
- LOG.error("Error exporting configuration", ex);
- configurationResultManager.genericError("Error calling configuration service " + ex.getMessage());
- } catch (final Exception ex) {
- LOG.error("Error exporting configuration", ex);
- configurationResultManager.genericError(ex.getMessage());
- }
- } else {
- configurationResultManager.commandOptionError(EXPORT_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
deleted file mode 100644
index af620e2..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationGet.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.configuration;
-
-import org.apache.syncope.client.cli.Input;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConfigurationGet extends AbstractConfigurationCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(ConfigurationGet.class);
-
- private static final String GET_HELP_MESSAGE = "configuration --get";
-
- private final Input input;
-
- public ConfigurationGet(final Input input) {
- this.input = input;
- }
-
- public void get() {
- if (input.parameterNumber() == 0) {
- try {
- configurationResultManager.fromGet(configurationSyncopeOperations.list());
- } catch (final Exception ex) {
- LOG.error("Error getting configuration", ex);
- configurationResultManager.genericError(ex.getMessage());
- }
- } else {
- configurationResultManager.unnecessaryParameters(input.listParameters(), GET_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java
deleted file mode 100644
index dbde8ff..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationRead.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.configuration;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.Attr;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConfigurationRead extends AbstractConfigurationCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(ConfigurationRead.class);
-
- private static final String READ_HELP_MESSAGE = "configuration --read {CONF-NAME} {CONF-NAME} [...]";
-
- private final Input input;
-
- public ConfigurationRead(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.parameterNumber() >= 1) {
- final List<Attr> attrList = new ArrayList<>();
- boolean failed = false;
- for (final String parameter : input.getParameters()) {
- try {
- attrList.add(configurationSyncopeOperations.get(parameter));
- } catch (final SyncopeClientException | WebServiceException ex) {
- LOG.error("Error reading configuration", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- configurationResultManager.notFoundError("Configuration", parameter);
- } else {
- configurationResultManager.genericError(ex.getMessage());
- }
- failed = true;
- break;
- }
- }
- if (!failed) {
- configurationResultManager.fromGet(attrList);
- }
- } else {
- configurationResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationResultManager.java
deleted file mode 100644
index 94509e3..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationResultManager.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.configuration;
-
-import java.util.Arrays;
-import java.util.List;
-import org.apache.syncope.client.cli.commands.CommonsResultManager;
-import org.apache.syncope.client.cli.view.Table;
-import org.apache.syncope.common.lib.Attr;
-
-public class ConfigurationResultManager extends CommonsResultManager {
-
- public void fromGet(final List<Attr> attrTOs) {
- fromCommandToView("syncope configuration", attrTOs);
- }
-
- public void fromRead(final List<Attr> attrTOs) {
- fromCommandToView("selected conf attributes", attrTOs);
- }
-
- public void fromUpdate(final List<Attr> attrTOs) {
- fromCommandToView("updated conf attributes", attrTOs);
- }
-
- private void fromCommandToView(final String title, final List<Attr> attrTOs) {
- final Table.TableBuilder tableBuilder = new Table.TableBuilder(title).header("attribute").header("value");
- attrTOs.forEach(attrTO -> {
- String attrValue = attrTO.getValues().toString();
- attrValue = attrValue.substring(0, attrValue.length() - 1);
- attrValue = attrValue.substring(1, attrValue.length());
- tableBuilder.rowValues(Arrays.asList(attrTO.getSchema(), attrValue));
- });
- tableBuilder.build().print();
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationSyncopeOperations.java
deleted file mode 100644
index c9e6856..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationSyncopeOperations.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.configuration;
-
-import java.util.List;
-import javax.ws.rs.core.Response;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.lib.Attr;
-import org.apache.syncope.common.rest.api.service.ConfigurationService;
-
-public class ConfigurationSyncopeOperations {
-
- private final ConfigurationService configurationService = SyncopeServices.get(ConfigurationService.class);
-
- public Attr get(final String schema) {
- return configurationService.get(schema);
- }
-
- public void set(final Attr attrTO) {
- configurationService.set(attrTO);
- }
-
- public List<Attr> list() {
- return configurationService.list();
- }
-
- public Response export() {
- return configurationService.export();
- }
-
- public void delete(final String schema) {
- configurationService.delete(schema);
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java
deleted file mode 100644
index e4e4f9e..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/configuration/ConfigurationUpdate.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.configuration;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.ws.WebServiceException;
-import org.apache.commons.lang3.tuple.Pair;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.Attr;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConfigurationUpdate extends AbstractConfigurationCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(ConfigurationUpdate.class);
-
- private static final String UPDATE_HELP_MESSAGE =
- "configuration --update {CONF-NAME}={CONF-VALUE} {CONF-NAME}={CONF-VALUE} [...]";
-
- private final Input input;
-
- public ConfigurationUpdate(final Input input) {
- this.input = input;
- }
-
- public void update() {
- if (input.parameterNumber() >= 1) {
- List<Attr> attrList = new ArrayList<>();
- boolean failed = false;
- for (String parameter : input.getParameters()) {
- Pair<String, String> pairParameter = Input.toPairParameter(parameter);
- try {
- Attr attrTO = configurationSyncopeOperations.get(pairParameter.getKey());
- attrTO.getValues().clear();
- attrTO.getValues().add(pairParameter.getValue());
- configurationSyncopeOperations.set(attrTO);
- attrList.add(attrTO);
- } catch (IllegalArgumentException ex) {
- LOG.error("Error updating configuration", ex);
- configurationResultManager.genericError(ex.getMessage());
- configurationResultManager.genericError(UPDATE_HELP_MESSAGE);
- failed = true;
- break;
- } catch (SyncopeClientException | WebServiceException ex) {
- LOG.error("Error updating configuration", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- configurationResultManager.notFoundError("Configuration", pairParameter.getKey());
- } else if (ex.getMessage().startsWith("InvalidValues")) {
- configurationResultManager.genericError(
- pairParameter.getValue() + " is not a valid value for " + pairParameter.getKey());
- } else {
- configurationResultManager.genericError(ex.getMessage());
- }
- failed = true;
- break;
- }
- }
- if (!failed) {
- configurationResultManager.fromUpdate(attrList);
- }
- } else {
- configurationResultManager.commandOptionError(UPDATE_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/AbstractConnectorCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/AbstractConnectorCommand.java
deleted file mode 100644
index 6286ed4..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/AbstractConnectorCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.connector;
-
-public abstract class AbstractConnectorCommand {
-
- protected final ConnectorSyncopeOperations connectorSyncopeOperations = new ConnectorSyncopeOperations();
-
- protected final ConnectorResultManager connectorResultManager = new ConnectorResultManager();
-
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorCommand.java
deleted file mode 100644
index aeec15c..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorCommand.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.connector;
-
-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.commands.AbstractCommand;
-
-@Command(name = "connector")
-public class ConnectorCommand extends AbstractCommand {
-
- private final ConnectorResultManager connectorResultManager = new ConnectorResultManager();
-
- @Override
- public void execute(final Input input) {
- if (StringUtils.isBlank(input.getOption())) {
- input.setOption(ConnectorOptions.HELP.getOptionName());
- }
-
- switch (ConnectorOptions.fromName(input.getOption())) {
- case DETAILS:
- new ConnectorDetails(input).details();
- break;
- case LIST:
- new ConnectorList(input).list();
- break;
- case LIST_BUNDLES:
- new ConnectorListBundles(input).list();
- break;
- case LIST_CONFIGURATION:
- new ConnectorListConfigurationProperties(input).list();
- break;
- case READ:
- new ConnectorRead(input).read();
- break;
- case READ_BY_RESOURCE:
- new ConnectorReadByResource(input).read();
- break;
- case DELETE:
- new ConnectorDelete(input).delete();
- break;
- case HELP:
- System.out.println(getHelpMessage());
- break;
- default:
- connectorResultManager.defaultOptionMessage(input.getOption(), getHelpMessage());
- }
- }
-
- @Override
- public String getHelpMessage() {
- return connectorResultManager.commandHelpMessage(getClass());
- }
-
- public enum ConnectorOptions {
-
- HELP("--help"),
- LIST("--list"),
- DETAILS("--details"),
- LIST_BUNDLES("--list-bundles"),
- LIST_CONFIGURATION("--list-configuration-properties"),
- READ("--read"),
- READ_BY_RESOURCE("--read-by-resource"),
- DELETE("--delete");
-
- private final String optionName;
-
- ConnectorOptions(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 ConnectorOptions fromName(final String name) {
- ConnectorOptions optionToReturn = HELP;
- for (final ConnectorOptions option : ConnectorOptions.values()) {
- if (option.equalsOptionName(name)) {
- optionToReturn = option;
- }
- }
- return optionToReturn;
- }
-
- public static List<String> toList() {
- final List<String> options = new ArrayList<>();
- for (final ConnectorOptions value : values()) {
- options.add(value.getOptionName());
- }
- return options;
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java
deleted file mode 100644
index 4039c40..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDelete.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.connector;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.ConnInstanceTO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConnectorDelete extends AbstractConnectorCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(ConnectorDelete.class);
-
- private static final String DELETE_HELP_MESSAGE = "connector --delete {CONNECTOR-KEY} {CONNECTOR-KEY} [...]";
-
- private final Input input;
-
- public ConnectorDelete(final Input input) {
- this.input = input;
- }
-
- public void delete() {
- if (input.getParameters().length >= 1) {
- final List<ConnInstanceTO> connInstanceTOs = new ArrayList<>();
- for (final String parameter : input.getParameters()) {
- try {
- connectorSyncopeOperations.delete(parameter);
- connectorResultManager.deletedMessage("connector", parameter);
- } catch (final NumberFormatException ex) {
- connectorResultManager.numberFormatException("connector", parameter);
- } catch (final SyncopeClientException | WebServiceException ex) {
- LOG.error("Error deleting connector", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- LOG.error("Error deleting connector", ex);
- connectorResultManager.notFoundError("Connector", parameter);
- } else {
- connectorResultManager.genericError(ex.getMessage());
- }
- break;
- }
- }
- connectorResultManager.printConnectors(connInstanceTOs);
- } else {
- connectorResultManager.commandOptionError(DELETE_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDetails.java
deleted file mode 100644
index ac3072c..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorDetails.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.connector;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.ConnInstanceTO;
-import org.apache.syncope.common.lib.types.ConnectorCapability;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConnectorDetails extends AbstractConnectorCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(ConnectorDetails.class);
-
- private static final String DETAILS_HELP_MESSAGE = "connector --details";
-
- private final Input input;
-
- public ConnectorDetails(final Input input) {
- this.input = input;
- }
-
- public void details() {
- if (input.parameterNumber() == 0) {
- try {
- final Map<String, String> details = new LinkedHashMap<>();
- final List<ConnInstanceTO> connInstanceTOs = connectorSyncopeOperations.list();
- int withCreateCapability = 0;
- int withDeleteCapability = 0;
- int withSearchCapability = 0;
- int withSyncCapability = 0;
- int withUpdateCapability = 0;
- for (final ConnInstanceTO connInstanceTO : connInstanceTOs) {
- if (connInstanceTO.getCapabilities().contains(ConnectorCapability.CREATE)) {
- withCreateCapability++;
- }
- if (connInstanceTO.getCapabilities().contains(ConnectorCapability.DELETE)) {
- withDeleteCapability++;
- }
- if (connInstanceTO.getCapabilities().contains(ConnectorCapability.SEARCH)) {
- withSearchCapability++;
- }
- if (connInstanceTO.getCapabilities().contains(ConnectorCapability.SYNC)) {
- withSyncCapability++;
- }
- if (connInstanceTO.getCapabilities().contains(ConnectorCapability.UPDATE)) {
- withUpdateCapability++;
- }
- }
- details.put("Total number", String.valueOf(connInstanceTOs.size()));
- details.put("With create capability", String.valueOf(withCreateCapability));
- details.put("With delete capability", String.valueOf(withDeleteCapability));
- details.put("With search capability", String.valueOf(withSearchCapability));
- details.put("With sync capability", String.valueOf(withSyncCapability));
- details.put("With update capability", String.valueOf(withUpdateCapability));
- details.put("Bundles number", String.valueOf(connectorSyncopeOperations.getBundles().size()));
- connectorResultManager.printDetails(details);
- } catch (final SyncopeClientException ex) {
- LOG.error("Error reading details about connector", ex);
- connectorResultManager.genericError(ex.getMessage());
- }
- } else {
- connectorResultManager.unnecessaryParameters(input.listParameters(), DETAILS_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java
deleted file mode 100644
index 19d81a4..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorList.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.connector;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConnectorList extends AbstractConnectorCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(ConnectorList.class);
-
- private static final String LIST_HELP_MESSAGE = "connector --list";
-
- private final Input input;
-
- public ConnectorList(final Input input) {
- this.input = input;
- }
-
- public void list() {
- if (input.parameterNumber() == 0) {
- try {
- connectorResultManager.printConnectors(connectorSyncopeOperations.list());
- } catch (final SyncopeClientException ex) {
- LOG.error("Error listening connector", ex);
- connectorResultManager.genericError(ex.getMessage());
- }
- } else {
- connectorResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java
deleted file mode 100644
index 1327120..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListBundles.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.connector;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConnectorListBundles extends AbstractConnectorCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(ConnectorListBundles.class);
-
- private static final String LIST_HELP_MESSAGE = "connector --list-bundles";
-
- private final Input input;
-
- public ConnectorListBundles(final Input input) {
- this.input = input;
- }
-
- public void list() {
- if (input.parameterNumber() == 0) {
- try {
- connectorResultManager.printBundles(connectorSyncopeOperations.getBundles());
- } catch (final SyncopeClientException ex) {
- LOG.error("Error listening connector", ex);
- connectorResultManager.genericError(ex.getMessage());
- }
- } else {
- connectorResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
deleted file mode 100644
index d830f80..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorListConfigurationProperties.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.connector;
-
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConnectorListConfigurationProperties extends AbstractConnectorCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(ConnectorListConfigurationProperties.class);
-
- private static final String LIST_CONFIGURATION_HELP_MESSAGE
- = "connector --list-configuration-properties {CONNECTOR-KEY} {CONNECTOR-KEY} [...]";
-
- private final Input input;
-
- public ConnectorListConfigurationProperties(final Input input) {
- this.input = input;
- }
-
- public void list() {
- if (input.getParameters().length >= 1) {
- for (final String parameter : input.getParameters()) {
- try {
- connectorResultManager.printConfigurationProperties(
- connectorSyncopeOperations.read(parameter).getConf());
- } catch (final NumberFormatException ex) {
- LOG.error("Error listening connector", ex);
- connectorResultManager.numberFormatException("connector", parameter);
- } catch (final SyncopeClientException | WebServiceException ex) {
- LOG.error("Error listening connector", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- connectorResultManager.notFoundError("Connector", parameter);
- } else {
- connectorResultManager.genericError(ex.getMessage());
- }
- }
- }
- } else {
- connectorResultManager.commandOptionError(LIST_CONFIGURATION_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java
deleted file mode 100644
index 732b2ae..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorRead.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.connector;
-
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConnectorRead extends AbstractConnectorCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(ConnectorRead.class);
-
- private static final String READ_HELP_MESSAGE = "connector --read {CONNECTOR-KEY} {CONNECTOR-KEY} [...]";
-
- private final Input input;
-
- public ConnectorRead(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.getParameters().length >= 1) {
- for (final String parameter : input.getParameters()) {
- try {
- connectorResultManager.printConnector(connectorSyncopeOperations.read(parameter));
- } catch (final NumberFormatException ex) {
- LOG.error("Error reading connector", ex);
- connectorResultManager.numberFormatException("connector", parameter);
- } catch (final SyncopeClientException | WebServiceException ex) {
- LOG.error("Error reading connector", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- connectorResultManager.notFoundError("Connector", parameter);
- } else {
- connectorResultManager.genericError(ex.getMessage());
- }
- }
- }
- } else {
- connectorResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java
deleted file mode 100644
index c6c3345..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorReadByResource.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.connector;
-
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConnectorReadByResource extends AbstractConnectorCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(ConnectorReadByResource.class);
-
- private static final String READ_HELP_MESSAGE = "connector --read-by-resource {RESOURCE-KEY} {RESOURCE-KEY} [...]";
-
- private final Input input;
-
- public ConnectorReadByResource(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.getParameters().length >= 1) {
- for (final String parameter : input.getParameters()) {
- try {
- connectorResultManager.printConnector(connectorSyncopeOperations.readByResource(parameter));
- } catch (final SyncopeClientException | WebServiceException ex) {
- LOG.error("Error reading connector", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- connectorResultManager.notFoundError("Resource", parameter);
- } else {
- connectorResultManager.genericError(ex.getMessage());
- }
- }
- }
- } else {
- connectorResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java
deleted file mode 100644
index 6b7e91e..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorResultManager.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.connector;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.syncope.client.cli.commands.CommonsResultManager;
-import org.apache.syncope.common.lib.to.ConnBundleTO;
-import org.apache.syncope.common.lib.to.ConnInstanceTO;
-import org.apache.syncope.common.lib.to.ConnPoolConfTO;
-import org.apache.syncope.common.lib.types.ConnConfProperty;
-import org.apache.syncope.common.lib.types.ConnectorCapability;
-
-public class ConnectorResultManager extends CommonsResultManager {
-
- public void printConnectors(final List<ConnInstanceTO> connInstanceTOs) {
- System.out.println("");
- connInstanceTOs.forEach(connInstanceTO -> {
- printConnector(connInstanceTO);
- });
- }
-
- public void printConnector(final ConnInstanceTO connInstanceTO) {
- System.out.println(" > CONNECTOR KEY: " + connInstanceTO.getKey());
- System.out.println(" bundle name: " + connInstanceTO.getBundleName());
- System.out.println(" connector name: " + connInstanceTO.getConnectorName());
- System.out.println(" display name: " + connInstanceTO.getDisplayName());
- System.out.println(" location: " + connInstanceTO.getLocation());
- System.out.println(" version: " + connInstanceTO.getVersion());
- System.out.println(" timeout: " + connInstanceTO.getConnRequestTimeout());
- System.out.println(" CAPABILITIES:");
- printCapabilities(connInstanceTO.getCapabilities());
- System.out.println(" CONFIGURATION:");
- printConfiguration(connInstanceTO.getConf());
- System.out.println(" POOL CONFIGURATION:");
- printConfPool(connInstanceTO.getPoolConf());
- System.out.println("");
- }
-
- private void printCapabilities(final Set<ConnectorCapability> capabilities) {
- capabilities.forEach(capability -> {
- System.out.println(" - " + capability.name());
- });
- }
-
- private void printConfPool(final ConnPoolConfTO connPoolConfTO) {
- System.out.println(" min idle: " + connPoolConfTO.getMinIdle());
- System.out.println(" min evictlable idle: " + connPoolConfTO.getMinEvictableIdleTimeMillis());
- System.out.println(" max idle: " + connPoolConfTO.getMaxIdle());
- System.out.println(" max objects: " + connPoolConfTO.getMaxObjects());
- System.out.println(" max wait: " + connPoolConfTO.getMaxWait());
- }
-
- public void printBundles(final List<ConnBundleTO> connBundleTOs) {
- connBundleTOs.forEach(connBundleTO -> {
- System.out.println(" > BUNDLE NAME: " + connBundleTO.getBundleName());
- System.out.println(" connector name: " + connBundleTO.getConnectorName());
- System.out.println(" display name: " + connBundleTO.getDisplayName());
- System.out.println(" location: " + connBundleTO.getLocation());
- System.out.println(" version: " + connBundleTO.getVersion());
- });
- }
-
- public void printConfigurationProperties(final Collection<ConnConfProperty> connConfPropertys) {
- printConfiguration(connConfPropertys);
-
- }
-
- public void printDetails(final Map<String, String> details) {
- printDetails("connectors details", details);
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorSyncopeOperations.java
deleted file mode 100644
index 44c9ea8..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/connector/ConnectorSyncopeOperations.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.connector;
-
-import java.util.List;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.lib.to.ConnBundleTO;
-import org.apache.syncope.common.lib.to.ConnInstanceTO;
-import org.apache.syncope.common.rest.api.service.ConnectorService;
-
-public class ConnectorSyncopeOperations {
-
- private final ConnectorService connectorService = SyncopeServices.get(ConnectorService.class);
-
- public ConnInstanceTO readByResource(final String resourceName) {
- return connectorService.readByResource(resourceName, null);
- }
-
- public ConnInstanceTO read(final String resourceKey) {
- return connectorService.read(resourceKey, null);
- }
-
- public List<ConnBundleTO> getBundles() {
- return connectorService.getBundles(null);
- }
-
- public List<ConnInstanceTO> list() {
- return connectorService.list(null);
- }
-
- public void delete(final String resourceKey) {
- connectorService.delete(resourceKey);
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/AbstractDomainCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/AbstractDomainCommand.java
deleted file mode 100644
index 902f55c..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/AbstractDomainCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.domain;
-
-public abstract class AbstractDomainCommand {
-
- protected final DomainSyncopeOperations domainSyncopeOperations = new DomainSyncopeOperations();
-
- protected final DomainResultManager domainResultManager = new DomainResultManager();
-
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainCommand.java
deleted file mode 100644
index c3a023a..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainCommand.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.domain;
-
-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.commands.AbstractCommand;
-
-@Command(name = "domain")
-public class DomainCommand extends AbstractCommand {
-
- private final DomainResultManager domainResultManager = new DomainResultManager();
-
- @Override
- public void execute(final Input input) {
- if (StringUtils.isBlank(input.getOption())) {
- input.setOption(Options.HELP.getOptionName());
- }
- switch (Options.fromName(input.getOption())) {
- case DETAILS:
- new DomainDetails(input).details();
- break;
- case LIST:
- new DomainList(input).list();
- break;
- case DELETE:
- new DomainDelete(input).delete();
- break;
- case HELP:
- System.out.println(getHelpMessage());
- break;
- default:
- new DomainResultManager().deletedMessage(input.getOption(), getHelpMessage());
- }
- }
-
- @Override
- public String getHelpMessage() {
- return domainResultManager.commandHelpMessage(getClass());
- }
-
- private enum Options {
-
- HELP("--help"),
- DETAILS("--details"),
- LIST("--list"),
- DELETE("--delete");
-
- private 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;
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java
deleted file mode 100644
index d666301..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDelete.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.domain;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DomainDelete extends AbstractDomainCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(DomainDelete.class);
-
- private static final String DELETE_HELP_MESSAGE = "domain --delete {DOMAIN-NAME} {DOMAIN-NAME} [...]";
-
- private final Input input;
-
- public DomainDelete(final Input input) {
- this.input = input;
- }
-
- public void delete() {
- if (input.parameterNumber() >= 1) {
- for (final String parameter : input.getParameters()) {
- try {
- domainSyncopeOperations.delete(parameter);
- domainResultManager.deletedMessage("Domain", parameter);
- } catch (final SyncopeClientException ex) {
- LOG.error("Error deleting domain", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- domainResultManager.notFoundError("Domain", parameter);
- } else {
- domainResultManager.genericError(ex.getMessage());
- }
- }
- }
- } else {
- domainResultManager.commandOptionError(DELETE_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDetails.java
deleted file mode 100644
index 061b8f3..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainDetails.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.domain;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DomainDetails extends AbstractDomainCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(DomainDetails.class);
-
- private static final String LIST_HELP_MESSAGE = "domain --details";
-
- private final Input input;
-
- public DomainDetails(final Input input) {
- this.input = input;
- }
-
- public void details() {
- if (input.parameterNumber() == 0) {
- try {
- final Map<String, String> details = new LinkedHashMap<>();
- details.put("Total number", String.valueOf(domainSyncopeOperations.list().size()));
- domainResultManager.printDetails(details);
- } catch (final SyncopeClientException ex) {
- LOG.error("Error reading details about domain", ex);
- domainResultManager.genericError(ex.getMessage());
- }
- } else {
- domainResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
- }
-
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java
deleted file mode 100644
index aa4a0f8..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainList.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.domain;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DomainList extends AbstractDomainCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(DomainList.class);
-
- private static final String LIST_HELP_MESSAGE = "domain --list";
-
- private final Input input;
-
- public DomainList(final Input input) {
- this.input = input;
- }
-
- public void list() {
- if (input.parameterNumber() == 0) {
- try {
- domainResultManager.printDomains(domainSyncopeOperations.list());
- } catch (final SyncopeClientException ex) {
- LOG.error("Error listing domain", ex);
- domainResultManager.genericError(ex.getMessage());
- }
- } else {
- domainResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
- }
-
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java
deleted file mode 100644
index 015bf06..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainRead.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.domain;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DomainRead extends AbstractDomainCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(DomainRead.class);
-
- private static final String READ_HELP_MESSAGE = "domain --read {DOMAIN-NAME} {DOMAIN-NAME} [...]";
-
- private final Input input;
-
- public DomainRead(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.parameterNumber() >= 1) {
- for (final String parameter : input.getParameters()) {
- try {
- domainResultManager.printDomain(domainSyncopeOperations.read(parameter));
- } catch (final SyncopeClientException ex) {
- LOG.error("Error reading domain", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- domainResultManager.notFoundError("Domain", parameter);
- } else {
- domainResultManager.genericError(ex.getMessage());
- }
- }
- }
- } else {
- domainResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainResultManager.java
deleted file mode 100644
index 23fad70..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainResultManager.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.domain;
-
-import java.util.List;
-import java.util.Map;
-import org.apache.syncope.client.cli.commands.CommonsResultManager;
-import org.apache.syncope.common.lib.to.DomainTO;
-
-public class DomainResultManager extends CommonsResultManager {
-
- public void printDomains(final List<DomainTO> domainTOs) {
- System.out.println("");
- domainTOs.forEach(domainTO -> {
- printDomain(domainTO);
- });
- }
-
- public void printDomain(final DomainTO domainTO) {
- System.out.println(" > DOIMAIN KEY: " + domainTO.getKey());
- System.out.println(" cipher algorithm: " + domainTO.getAdminCipherAlgorithm());
- System.out.println("");
- }
-
- public void printDetails(final Map<String, String> details) {
- printDetails("domains details", details);
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainSyncopeOperations.java
deleted file mode 100644
index 994c217..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/domain/DomainSyncopeOperations.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.domain;
-
-import java.util.List;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.lib.to.DomainTO;
-import org.apache.syncope.common.rest.api.service.DomainService;
-
-public class DomainSyncopeOperations {
-
- private final DomainService domainService = SyncopeServices.get(DomainService.class);
-
- public DomainTO read(final String domainName) {
- return domainService.read(domainName);
- }
-
- public List<DomainTO> list() {
- return domainService.list();
- }
-
- public void delete(final String domainName) {
- domainService.delete(domainName);
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/AbstractEntitlementCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/AbstractEntitlementCommand.java
deleted file mode 100644
index f09665d..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/AbstractEntitlementCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.entitlement;
-
-public abstract class AbstractEntitlementCommand {
-
- protected final EntitlementSyncopeOperations entitlementSyncopeOperations = new EntitlementSyncopeOperations();
-
- protected final EntitlementResultManager entitlementResultManager = new EntitlementResultManager();
-
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementCommand.java
deleted file mode 100644
index 2c4420e..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementCommand.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.entitlement;
-
-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.commands.AbstractCommand;
-
-@Command(name = "entitlement")
-public class EntitlementCommand extends AbstractCommand {
-
- private final EntitlementResultManager entitlementResultManager = new EntitlementResultManager();
-
- @Override
- public void execute(final Input input) {
- if (StringUtils.isBlank(input.getOption())) {
- input.setOption(EntitlementOptions.HELP.getOptionName());
- }
-
- switch (EntitlementOptions.fromName(input.getOption())) {
- case LIST:
- new EntitlementList(input).list();
- break;
- case READ_BY_USERNAME:
- new EntitlementReadByUsername(input).read();
- break;
- case READ_BY_USERKEY:
- new EntitlementReadByUserKey(input).read();
- break;
- case SEARCH_BY_ROLE:
- new EntitlementSearchByRole(input).search();
- break;
- case LIST_ROLE:
- new EntitlementListRole(input).list();
- break;
- case HELP:
- System.out.println(getHelpMessage());
- break;
- default:
- entitlementResultManager.defaultOptionMessage(input.getOption(), getHelpMessage());
- }
- }
-
- @Override
- public String getHelpMessage() {
- return entitlementResultManager.commandHelpMessage(getClass());
- }
-
- public enum EntitlementOptions {
-
- HELP("--help"),
- LIST("--list"),
- READ_BY_USERNAME("--read-by-username"),
- READ_BY_USERKEY("--read-by-userkey"),
- SEARCH_BY_ROLE("--search-by-role"),
- LIST_ROLE("--list-role");
-
- private final String optionName;
-
- EntitlementOptions(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 EntitlementOptions fromName(final String name) {
- EntitlementOptions optionToReturn = HELP;
- for (final EntitlementOptions option : EntitlementOptions.values()) {
- if (option.equalsOptionName(name)) {
- optionToReturn = option;
- }
- }
- return optionToReturn;
- }
-
- public static List<String> toList() {
- final List<String> options = new ArrayList<>();
- for (final EntitlementOptions value : values()) {
- options.add(value.getOptionName());
- }
- return options;
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementList.java
deleted file mode 100644
index e204823..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementList.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.entitlement;
-
-import org.apache.syncope.client.cli.Input;
-
-public class EntitlementList extends AbstractEntitlementCommand {
-
- private static final String READ_HELP_MESSAGE = "entitlement --list";
-
- private final Input input;
-
- public EntitlementList(final Input input) {
- this.input = input;
- }
-
- public void list() {
- if (input.parameterNumber() == 0) {
- entitlementResultManager.toView(entitlementSyncopeOperations.list());
- } else {
- entitlementResultManager.unnecessaryParameters(input.listParameters(), READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementListRole.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementListRole.java
deleted file mode 100644
index 575208f..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementListRole.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.entitlement;
-
-import java.util.Set;
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class EntitlementListRole extends AbstractEntitlementCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(EntitlementListRole.class);
-
- private static final String READ_HELP_MESSAGE = "entitlement --list-role {ENTITLEMENT-NAME}";
-
- private final Input input;
-
- public EntitlementListRole(final Input input) {
- this.input = input;
- }
-
- public void list() {
- if (input.getParameters().length == 1) {
- try {
- final Set<RoleTO> roleTOs = entitlementSyncopeOperations.rolePerEntitlements(input.firstParameter());
- if (!entitlementSyncopeOperations.exists(input.firstParameter())) {
- entitlementResultManager.notFoundError("Entitlement", input.firstParameter());
- } else if (roleTOs != null && !roleTOs.isEmpty()) {
- entitlementResultManager.rolesToView(roleTOs);
- } else {
- entitlementResultManager.genericMessage("No roles found for entitlement " + input.firstParameter());
- }
- } catch (final SyncopeClientException | WebServiceException ex) {
- LOG.error("Error reading entitlement", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- entitlementResultManager.notFoundError("User", input.firstParameter());
- } else {
- entitlementResultManager.genericError(ex.getMessage());
- }
- } catch (final NumberFormatException ex) {
- LOG.error("Error reading entitlement", ex);
- entitlementResultManager.numberFormatException("user", input.firstParameter());
- }
- } else {
- entitlementResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUserKey.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUserKey.java
deleted file mode 100644
index 1cbc794..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUserKey.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.entitlement;
-
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class EntitlementReadByUserKey extends AbstractEntitlementCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(EntitlementReadByUserKey.class);
-
- private static final String READ_HELP_MESSAGE = "entitlement --read-by-userkey {USER-KEY}";
-
- private final Input input;
-
- public EntitlementReadByUserKey(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.getParameters().length == 1) {
- try {
- entitlementResultManager.toView(
- entitlementSyncopeOperations.userIdEntitlements(input.firstParameter()));
- } catch (final SyncopeClientException | WebServiceException ex) {
- LOG.error("Error reading entitlement", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- entitlementResultManager.notFoundError("User", input.firstParameter());
- } else {
- entitlementResultManager.genericError(ex.getMessage());
- }
- } catch (final NumberFormatException ex) {
- LOG.error("Error reading entitlement", ex);
- entitlementResultManager.numberFormatException("user", input.firstParameter());
- }
- } else {
- entitlementResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUsername.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUsername.java
deleted file mode 100644
index 8e77d7e..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementReadByUsername.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.entitlement;
-
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class EntitlementReadByUsername extends AbstractEntitlementCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(EntitlementReadByUsername.class);
-
- private static final String READ_HELP_MESSAGE = "entitlement --read-by-username {USERNAME}";
-
- private final Input input;
-
- public EntitlementReadByUsername(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.getParameters().length == 1) {
- try {
- entitlementResultManager.toView(
- entitlementSyncopeOperations.usernameEntitlements(input.firstParameter()));
- } catch (final SyncopeClientException | WebServiceException ex) {
- if (ex.getMessage().startsWith("NotFound")) {
- LOG.error("Error reading username", ex);
- entitlementResultManager.notFoundError("User", input.firstParameter());
- } else {
- entitlementResultManager.genericError(ex.getMessage());
- }
- } catch (final NumberFormatException ex) {
- LOG.error("Error reading username", ex);
- entitlementResultManager.numberFormatException("user", input.firstParameter());
- }
- } else {
- entitlementResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementResultManager.java
deleted file mode 100644
index 6a5b5b5..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementResultManager.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.entitlement;
-
-import java.util.Collection;
-import org.apache.syncope.client.cli.commands.CommonsResultManager;
-import org.apache.syncope.common.lib.to.RoleTO;
-
-public class EntitlementResultManager extends CommonsResultManager {
-
- public void toView(final Collection<String> entitlements) {
- System.out.println("");
- entitlements.forEach(entitlement -> {
- System.out.println("- " + entitlement);
- });
- System.out.println("");
- }
-
- public void rolesToView(final Collection<RoleTO> roles) {
- System.out.println("");
- roles.forEach(role -> {
- printRole(role);
- });
- }
-
- private void printRole(final RoleTO roleTO) {
- System.out.println(" > ROLE KEY: " + roleTO.getKey());
- System.out.println(" REALMS: ");
- printRealms(roleTO.getRealms());
- System.out.println("");
- }
-
- private void printRealms(final Collection<String> realms) {
- realms.forEach(realm -> {
- System.out.println(" - " + realm);
- });
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSearchByRole.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSearchByRole.java
deleted file mode 100644
index 30ec04b..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSearchByRole.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.entitlement;
-
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class EntitlementSearchByRole extends AbstractEntitlementCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(EntitlementSearchByRole.class);
-
- private static final String READ_HELP_MESSAGE = "entitlement --search-by-role {ROLE-KEY}";
-
- private final Input input;
-
- public EntitlementSearchByRole(final Input input) {
- this.input = input;
- }
-
- public void search() {
- if (input.getParameters().length == 1) {
- try {
- entitlementResultManager.toView(
- entitlementSyncopeOperations.entitlementsPerRole(input.firstParameter()));
- } catch (final SyncopeClientException | WebServiceException ex) {
- LOG.error("Error searching entitlement", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- entitlementResultManager.notFoundError("User", input.firstParameter());
- } else {
- entitlementResultManager.genericError(ex.getMessage());
- }
- } catch (final NumberFormatException ex) {
- LOG.error("Error searching entitlement", ex);
- entitlementResultManager.numberFormatException("user", input.firstParameter());
- }
- } else {
- entitlementResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSyncopeOperations.java
deleted file mode 100644
index 6d13269..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/entitlement/EntitlementSyncopeOperations.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.entitlement;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.TreeSet;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.client.cli.commands.role.RoleSyncopeOperations;
-import org.apache.syncope.client.cli.commands.user.UserSyncopeOperations;
-import org.apache.syncope.common.lib.to.RoleTO;
-import org.apache.syncope.common.lib.info.PlatformInfo;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.rest.api.service.SyncopeService;
-
-public class EntitlementSyncopeOperations {
-
- private final PlatformInfo platformInfo = SyncopeServices.get(SyncopeService.class).platform();
-
- private final UserSyncopeOperations userSyncopeOperations = new UserSyncopeOperations();
-
- private final RoleSyncopeOperations roleSyncopeOperations = new RoleSyncopeOperations();
-
- public Set<String> list() {
- return platformInfo.getEntitlements();
- }
-
- public boolean exists(final String entitlement) {
- return list().contains(entitlement);
- }
-
- public Set<String> usernameEntitlements(final String username) {
- final Set<String> entitlements = new TreeSet<>();
- final UserTO userTO = userSyncopeOperations.read(username);
- for (final String role : userTO.getRoles()) {
- entitlements.addAll(roleSyncopeOperations.read(role).getEntitlements());
- }
- return entitlements;
- }
-
- public Set<String> userIdEntitlements(final String userId) {
- final Set<String> entitlements = new TreeSet<>();
- final UserTO userTO = userSyncopeOperations.read(userId);
- for (final String role : userTO.getRoles()) {
- entitlements.addAll(roleSyncopeOperations.read(role).getEntitlements());
- }
- return entitlements;
- }
-
- public Set<String> entitlementsPerRole(final String roleId) {
- return roleSyncopeOperations.read(roleId).getEntitlements();
- }
-
- public Set<RoleTO> rolePerEntitlements(final String entitlement) {
- final Set<RoleTO> roles = new HashSet<>();
- for (final RoleTO role : roleSyncopeOperations.list()) {
- if (role.getEntitlements().contains(entitlement)) {
- roles.add(role);
- }
- }
- return roles;
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/AbstractGroupCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/AbstractGroupCommand.java
deleted file mode 100644
index b8f53a5..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/AbstractGroupCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.group;
-
-public abstract class AbstractGroupCommand {
-
- protected final GroupSyncopeOperations groupSyncopeOperations = new GroupSyncopeOperations();
-
- protected final GroupResultManager groupResultManager = new GroupResultManager();
-
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupCommand.java
deleted file mode 100644
index 1197a55..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupCommand.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.group;
-
-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.commands.AbstractCommand;
-
-@Command(name = "group")
-public class GroupCommand extends AbstractCommand {
-
- private final GroupResultManager groupResultManager = new GroupResultManager();
-
- @Override
- public void execute(final Input input) {
- if (StringUtils.isBlank(input.getOption())) {
- input.setOption(GroupOptions.HELP.getOptionName());
- }
- switch (GroupOptions.fromName(input.getOption())) {
- case DETAILS:
- new GroupDetails(input).details();
- break;
- case LIST:
- new GroupList(input).list();
- break;
- case READ:
- new GroupRead(input).read();
- break;
- case READ_ATTRIBUTES_BY_SCHEMA_TYPE:
- new GroupReadAttributesBySchemaType(input).read();
- break;
- case READ_ATTRIBUTES_BY_SCHEMA:
- new GroupReadAttributeBySchemaTypeAndSchemaKey(input).read();
- break;
- case DELETE:
- new GroupDelete(input).delete();
- break;
- case HELP:
- System.out.println(getHelpMessage());
- break;
- default:
- groupResultManager.defaultOptionMessage(input.getOption(), getHelpMessage());
- }
- }
-
- @Override
- public String getHelpMessage() {
- return groupResultManager.commandHelpMessage(getClass());
- }
-
- public enum GroupOptions {
-
- HELP("--help"),
- DETAILS("--details"),
- LIST("--list"),
- READ("--read"),
- READ_ATTRIBUTES_BY_SCHEMA("--read-attr-by-schema"),
- READ_ATTRIBUTES_BY_SCHEMA_TYPE("--read-attr-by-schema-type"),
- DELETE("--delete");
-
- private final String optionName;
-
- GroupOptions(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 GroupOptions fromName(final String name) {
- GroupOptions optionToReturn = HELP;
- for (final GroupOptions option : GroupOptions.values()) {
- if (option.equalsOptionName(name)) {
- optionToReturn = option;
- }
- }
- return optionToReturn;
- }
-
- public static List<String> toList() {
- final List<String> options = new ArrayList<>();
- for (final GroupOptions value : values()) {
- options.add(value.getOptionName());
- }
- return options;
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupDelete.java
deleted file mode 100644
index 9e5d96c..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupDelete.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.group;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GroupDelete extends AbstractGroupCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(GroupDelete.class);
-
- private static final String DELETE_HELP_MESSAGE = "group --delete {GROUP-KEY} {GROUP-KEY} [...]";
-
- private final Input input;
-
- public GroupDelete(final Input input) {
- this.input = input;
- }
-
- public void delete() {
- if (input.parameterNumber() >= 1) {
- for (final String parameter : input.getParameters()) {
- try {
- groupSyncopeOperations.delete(parameter);
- groupResultManager.deletedMessage("Group", parameter);
- } catch (final SyncopeClientException ex) {
- LOG.error("Error deleting group", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- groupResultManager.notFoundError("group", parameter);
- } else {
- groupResultManager.genericError(ex.getMessage());
- }
- } catch (final NumberFormatException ex) {
- groupResultManager.numberFormatException("group", parameter);
- }
- }
- } else {
- groupResultManager.commandOptionError(DELETE_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupDetails.java
deleted file mode 100644
index 26da0e9..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupDetails.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.group;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.SyncopeConstants;
-import org.apache.syncope.common.lib.to.GroupTO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GroupDetails extends AbstractGroupCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(GroupDetails.class);
-
- private static final String DETAILS_HELP_MESSAGE = "group --details";
-
- private final Input input;
-
- public GroupDetails(final Input input) {
- this.input = input;
- }
-
- public void details() {
- if (input.parameterNumber() == 0) {
- try {
- final Map<String, String> details = new LinkedHashMap<>();
- final List<GroupTO> groupTOs = groupSyncopeOperations.list();
- int withoudResources = 0;
- int withoudAttributes = 0;
- int onRootRealm = 0;
- for (final GroupTO groupTO : groupTOs) {
- if (groupTO.getResources() == null || groupTO.getResources().isEmpty()) {
- withoudResources++;
- }
- if ((groupTO.getPlainAttrs() == null || groupTO.getPlainAttrs().isEmpty())
- && (groupTO.getDerAttrs() == null || groupTO.getDerAttrs().isEmpty())
- && (groupTO.getVirAttrs() == null || groupTO.getVirAttrs().isEmpty())) {
- withoudAttributes++;
- }
- if (SyncopeConstants.ROOT_REALM.equals(groupTO.getRealm())) {
- onRootRealm++;
- }
- }
- details.put("Total number", String.valueOf(groupTOs.size()));
- details.put("Without resources", String.valueOf(withoudResources));
- details.put("Without attributes", String.valueOf(withoudAttributes));
- details.put("On root realm", String.valueOf(onRootRealm));
- details.put("On the other realm", String.valueOf(groupTOs.size() - onRootRealm));
- groupResultManager.printDetails(details);
- } catch (final SyncopeClientException ex) {
- LOG.error("Error reading details about realm", ex);
- groupResultManager.genericError(ex.getMessage());
- }
- } else {
- groupResultManager.unnecessaryParameters(input.listParameters(), DETAILS_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupList.java
deleted file mode 100644
index f5996bb..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupList.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.group;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GroupList extends AbstractGroupCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(GroupList.class);
-
- private static final String LIST_HELP_MESSAGE = "group --list";
-
- private final Input input;
-
- public GroupList(final Input input) {
- this.input = input;
- }
-
- public void list() {
- if (input.parameterNumber() == 0) {
- try {
- groupResultManager.printGroups(groupSyncopeOperations.list());
- } catch (final SyncopeClientException ex) {
- LOG.error("Error listing group", ex);
- groupResultManager.genericError(ex.getMessage());
- }
- } else {
- groupResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupRead.java
deleted file mode 100644
index c8c82cc..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupRead.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.group;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GroupRead extends AbstractGroupCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(GroupRead.class);
-
- private static final String READ_HELP_MESSAGE = "group --read {GROUP-KEY} {GROUP-KEY} [...]";
-
- private final Input input;
-
- public GroupRead(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.parameterNumber() >= 1) {
- for (final String parameter : input.getParameters()) {
- try {
- groupResultManager.printGroup(groupSyncopeOperations.read(parameter));
- } catch (final SyncopeClientException ex) {
- LOG.error("Error reading group", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- groupResultManager.notFoundError("Group", parameter);
- } else {
- groupResultManager.genericError(ex.getMessage());
- }
- } catch (final NumberFormatException ex) {
- groupResultManager.numberFormatException("group", parameter);
- }
- }
- } else {
- groupResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupReadAttributeBySchemaTypeAndSchemaKey.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupReadAttributeBySchemaTypeAndSchemaKey.java
deleted file mode 100644
index 18f8939..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupReadAttributeBySchemaTypeAndSchemaKey.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.group;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.client.cli.util.CommandUtils;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.types.SchemaType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GroupReadAttributeBySchemaTypeAndSchemaKey extends AbstractGroupCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(GroupReadAttributeBySchemaTypeAndSchemaKey.class);
-
- private static final String READ_HELP_MESSAGE
- = "group --read-attr-by-schema {GROUP-KEY} {SCHEMA-TYPE} {SCHEMA-KEY}\n"
- + " Schema type: PLAIN / DERIVED / VIRTUAL";
-
- private final Input input;
-
- public GroupReadAttributeBySchemaTypeAndSchemaKey(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.parameterNumber() == 3) {
- try {
- groupResultManager.printAttribute(groupSyncopeOperations.readAttribute(
- input.firstParameter(), input.secondParameter(), input.thirdParameter()));
- } catch (final SyncopeClientException ex) {
- LOG.error("Error reading group", ex);
- groupResultManager.genericError(ex.getMessage());
- } catch (final NumberFormatException ex) {
- groupResultManager.numberFormatException("group", input.firstParameter());
- } catch (final IllegalArgumentException ex) {
- LOG.error("Error reading schema", ex);
- groupResultManager.typeNotValidError(
- "schema", input.secondParameter(), CommandUtils.fromEnumToArray(SchemaType.class));
- }
- } else {
- groupResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupReadAttributesBySchemaType.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupReadAttributesBySchemaType.java
deleted file mode 100644
index df6dcc2..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupReadAttributesBySchemaType.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.group;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.client.cli.util.CommandUtils;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.types.SchemaType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class GroupReadAttributesBySchemaType extends AbstractGroupCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(GroupReadAttributesBySchemaType.class);
-
- private static final String READ_HELP_MESSAGE = "group --read-attr-by-schema-type {GROUP-KEY} {SCHEMA-TYPE}\n"
- + " Schema type: PLAIN / DERIVED / VIRTUAL";
-
- private final Input input;
-
- public GroupReadAttributesBySchemaType(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.parameterNumber() == 2) {
- try {
- groupResultManager.printAttributes(groupSyncopeOperations.readAttributes(
- input.firstParameter(), input.secondParameter()));
- } catch (final SyncopeClientException ex) {
- LOG.error("Error reading group", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- groupResultManager.notFoundError("Group", input.firstParameter());
- } else {
- groupResultManager.genericError(ex.getMessage());
- }
- } catch (final NumberFormatException ex) {
- groupResultManager.numberFormatException("group", input.firstParameter());
- } catch (final IllegalArgumentException ex) {
- LOG.error("Error reading schema", ex);
- groupResultManager.typeNotValidError(
- "schema", input.secondParameter(), CommandUtils.fromEnumToArray(SchemaType.class));
- }
- } else {
- groupResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupResultManager.java
deleted file mode 100644
index 6ae5c91..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupResultManager.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.group;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.syncope.client.cli.commands.CommonsResultManager;
-import org.apache.syncope.common.lib.Attr;
-import org.apache.syncope.common.lib.to.GroupTO;
-
-public class GroupResultManager extends CommonsResultManager {
-
- public void printGroups(final List<GroupTO> groupTOs) {
- System.out.println("");
- groupTOs.forEach(groupTO -> {
- printGroup(groupTO);
- });
- }
-
- public void printGroup(final GroupTO groupTO) {
- System.out.println(" > GROUP KEY: " + groupTO.getKey());
- System.out.println(" name: " + groupTO.getName());
- System.out.println(" type: " + groupTO.getType());
- System.out.println(" realm: " + groupTO.getRealm());
- System.out.println(" status: " + groupTO.getStatus());
- System.out.println(" user owner: " + groupTO.getUserOwner());
- System.out.println(" group owner: " + groupTO.getGroupOwner());
- System.out.println(" RESOURCES: ");
- printResources(groupTO.getResources());
- System.out.println(" PLAIN ATTRIBUTES: ");
- printAttributes(groupTO.getPlainAttrs());
- System.out.println(" DERIVED ATTRIBUTES: ");
- printAttributes(groupTO.getDerAttrs());
- System.out.println(" VIRTUAL ATTRIBUTES: ");
- printAttributes(groupTO.getVirAttrs());
- System.out.println("");
- }
-
- private void printResources(final Set<String> resources) {
- resources.forEach(resource -> {
- System.out.println(" - " + resource);
- });
- }
-
- public void printAttributes(final Set<Attr> attributes) {
- attributes.forEach(attribute -> {
- printAttribute(attribute);
- });
- }
-
- public void printAttribute(final Attr attribute) {
- final StringBuilder attributeMessageBuilder = new StringBuilder();
- attributeMessageBuilder.append(" - ")
- .append(attribute.getSchema())
- .append(": ")
- .append(attribute.getValues());
- System.out.println(attributeMessageBuilder.toString());
- System.out.println("");
- }
-
- public void printDetails(final Map<String, String> details) {
- printDetails("groups details", details);
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupSyncopeOperations.java
deleted file mode 100644
index 053804e..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/group/GroupSyncopeOperations.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.group;
-
-import java.util.List;
-import java.util.Set;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.lib.Attr;
-import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.lib.types.SchemaType;
-import org.apache.syncope.common.rest.api.beans.AnyQuery;
-import org.apache.syncope.common.rest.api.service.GroupService;
-
-public class GroupSyncopeOperations {
-
- private final GroupService groupService = SyncopeServices.get(GroupService.class);
-
- public List<GroupTO> list() {
- return groupService.search(new AnyQuery()).getResult();
- }
-
- public GroupTO read(final String groupKey) {
- return groupService.read(groupKey);
- }
-
- public Set<Attr> readAttributes(final String groupKey, final String schemaType) {
- return groupService.read(groupKey, SchemaType.valueOf(schemaType));
- }
-
- public Attr readAttribute(final String groupKey, final String schemaType, final String schema) {
- return groupService.read(groupKey, SchemaType.valueOf(schemaType), schema);
- }
-
- public void delete(final String groupKey) {
- groupService.delete(groupKey);
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/Help.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/Help.java
deleted file mode 100644
index 516ad3c..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/Help.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.help;
-
-import org.apache.syncope.client.cli.Command;
-import org.apache.syncope.client.cli.commands.AbstractCommand;
-import org.apache.syncope.client.cli.util.CommandUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Help {
-
- private static final Logger LOG = LoggerFactory.getLogger(Help.class);
-
- private final HelpResultManager helpResultManager = new HelpResultManager();
-
- public void 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");
- }
- helpResultManager.toView(generalHelpBuilder.toString());
- } catch (Exception e) {
- LOG.error("Error helping", e);
- helpResultManager.genericMessage(e.getMessage());
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/HelpCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/HelpCommand.java
deleted file mode 100644
index a42ff85..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/HelpCommand.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.help;
-
-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.commands.AbstractCommand;
-import org.apache.syncope.client.cli.util.CommandUtils;
-
-@Command(name = "help")
-public class HelpCommand extends AbstractCommand {
-
- @Override
- public void execute(final Input input) {
- if (StringUtils.isBlank(input.getOption())) {
- input.setOption(Options.HELP.getOptionName());
- }
-
- switch (Options.fromName(input.getOption())) {
- case HELP:
- new Help().help();
- break;
- default:
- new HelpResultManager().defaultOptionMessage(
- input.getOption(), CommandUtils.helpMessage("info", Options.toList()));
- break;
- }
- }
-
- @Override
- public String getHelpMessage() {
- return CommandUtils.helpMessage("help", Options.toList());
- }
-
- private enum Options {
-
- HELP("--print");
-
- private 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;
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/HelpResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/HelpResultManager.java
deleted file mode 100644
index b70664d..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/help/HelpResultManager.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.help;
-
-import org.apache.syncope.client.cli.commands.CommonsResultManager;
-
-public class HelpResultManager extends CommonsResultManager {
-
- public void toView(final String generalHelp) {
- System.out.println(generalHelp);
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/Info.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/Info.java
deleted file mode 100644
index e277b9d..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/Info.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.info;
-
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.lib.info.PlatformInfo;
-import org.apache.syncope.common.lib.types.ImplementationType;
-import org.apache.syncope.common.rest.api.service.SyncopeService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Info {
-
- private static final Logger LOG = LoggerFactory.getLogger(Info.class);
-
- private final PlatformInfo platformInfo = SyncopeServices.get(SyncopeService.class).platform();
-
- private final InfoResultManager infoResultManager = new InfoResultManager();
-
- public void version() {
- try {
- infoResultManager.printVersion(platformInfo.getVersion());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- }
-
- public void pwdResetAllowed() {
- try {
- infoResultManager.printPwdResetAllowed(platformInfo.isPwdResetAllowed());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- }
-
- public void resetWithSecurityQuestion() {
- try {
- infoResultManager.printPwdResetRequiringSecurityQuestions(
- platformInfo.isPwdResetRequiringSecurityQuestions());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- }
-
- public void selfRegistrationAllowed() {
- try {
- infoResultManager.printSelfRegistrationAllowed(platformInfo.isSelfRegAllowed());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- }
-
- public void provisioningManager() {
- try {
- infoResultManager.printProvisioningManager(
- platformInfo.getProvisioningInfo().getAnyObjectProvisioningManager(),
- platformInfo.getProvisioningInfo().getUserProvisioningManager(),
- platformInfo.getProvisioningInfo().getGroupProvisioningManager());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- }
-
- public void accountRules() {
- platformInfo.getJavaImplInfo(ImplementationType.ACCOUNT_RULE).ifPresent(info -> {
- try {
- infoResultManager.printAccountRules(info.getClasses());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- });
- }
-
- public void connidLocations() {
- try {
- infoResultManager.printConnidLocations(platformInfo.getConnIdLocations());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- }
-
- public void reconFilterBuilders() {
- platformInfo.getJavaImplInfo(ImplementationType.RECON_FILTER_BUILDER).ifPresent(info -> {
- try {
- infoResultManager.printAccountRules(info.getClasses());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- });
- }
-
- public void logicActions() {
- platformInfo.getJavaImplInfo(ImplementationType.LOGIC_ACTIONS).ifPresent(info -> {
- try {
- infoResultManager.printAccountRules(info.getClasses());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- });
- }
-
- public void itemTransformers() {
- platformInfo.getJavaImplInfo(ImplementationType.ITEM_TRANSFORMER).ifPresent(info -> {
- try {
- infoResultManager.printAccountRules(info.getClasses());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- });
- }
-
- public void passwordRules() {
- platformInfo.getJavaImplInfo(ImplementationType.PASSWORD_RULE).ifPresent(info -> {
- try {
- infoResultManager.printAccountRules(info.getClasses());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- });
- }
-
- public void propagationActions() {
- platformInfo.getJavaImplInfo(ImplementationType.PROPAGATION_ACTIONS).ifPresent(info -> {
- try {
- infoResultManager.printAccountRules(info.getClasses());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- });
- }
-
- public void pushActions() {
- platformInfo.getJavaImplInfo(ImplementationType.PUSH_ACTIONS).ifPresent(info -> {
- try {
- infoResultManager.printAccountRules(info.getClasses());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- });
- }
-
- public void reportletConfs() {
- platformInfo.getJavaImplInfo(ImplementationType.REPORTLET).ifPresent(info -> {
- try {
- infoResultManager.printAccountRules(info.getClasses());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- });
- }
-
- public void pullActions() {
- platformInfo.getJavaImplInfo(ImplementationType.PULL_ACTIONS).ifPresent(info -> {
- try {
- infoResultManager.printAccountRules(info.getClasses());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- });
- }
-
- public void pullCorrelationRules() {
- platformInfo.getJavaImplInfo(ImplementationType.PULL_CORRELATION_RULE).ifPresent(info -> {
- try {
- infoResultManager.printAccountRules(info.getClasses());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- });
- }
-
- public void taskJobs() {
- platformInfo.getJavaImplInfo(ImplementationType.TASKJOB_DELEGATE).ifPresent(info -> {
- try {
- infoResultManager.printAccountRules(info.getClasses());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- });
- }
-
- public void validators() {
- platformInfo.getJavaImplInfo(ImplementationType.VALIDATOR).ifPresent(info -> {
- try {
- infoResultManager.printAccountRules(info.getClasses());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- });
- }
-
- public void passwordGenerator() {
- try {
- infoResultManager.printPasswordGenerator(platformInfo.getPasswordGenerator());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- }
-
- public void virAttrCache() {
- try {
- infoResultManager.printVirtualAttributeCacheClass(platformInfo.getProvisioningInfo().getVirAttrCache());
- } catch (final Exception ex) {
- LOG.error("Information error", ex);
- infoResultManager.genericError(ex.getMessage());
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/InfoCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/InfoCommand.java
deleted file mode 100644
index 460d54a..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/InfoCommand.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.info;
-
-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.commands.AbstractCommand;
-import org.apache.syncope.client.cli.util.CommandUtils;
-
-@Command(name = "info")
-public class InfoCommand extends AbstractCommand {
-
- @Override
- public void execute(final Input input) {
- final Info info = new Info();
- if (StringUtils.isBlank(input.getOption())) {
- input.setOption(Options.HELP.getOptionName());
- }
-
- switch (Options.fromName(input.getOption())) {
- case VERSION:
- info.version();
- break;
- case PWD_RESET_ALLOWED:
- info.pwdResetAllowed();
- break;
- case PWD_RESET_WITH_SECURITY_QUESTION:
- info.resetWithSecurityQuestion();
- break;
- case SELF_REG_ALLOWED:
- info.selfRegistrationAllowed();
- break;
- case PROVISIONING_MANAGER:
- info.provisioningManager();
- break;
- case ACCOUNT_RULES:
- info.accountRules();
- break;
- case CONNID_LOCATION:
- info.connidLocations();
- break;
- case RECON_FILTER_BUILDERS:
- info.reconFilterBuilders();
- break;
- case LOGIC_ACTIONS:
- info.logicActions();
- break;
- case MAPPING_ITEM_TRANSFORMERS:
- info.itemTransformers();
- break;
- case PASSWORD_RULES:
- info.passwordRules();
- break;
- case PROPAGATION_ACTIONS:
- info.propagationActions();
- break;
- case PUSH_ACTIONS:
- info.pushActions();
- break;
- case REPORTLET_CONFS:
- info.reportletConfs();
- break;
- case SYNC_ACTIONS:
- info.pullActions();
- break;
- case SYNC_CORRELATION_RULES:
- info.pullCorrelationRules();
- break;
- case TASK_JOBS:
- info.taskJobs();
- break;
- case VALIDATORS:
- info.validators();
- break;
- case PASSWORD_GENERATOR:
- info.passwordGenerator();
- break;
- case VIR_ATTR_CACHE:
- info.virAttrCache();
- break;
- case HELP:
- System.out.println(CommandUtils.helpMessage("info", Options.toList()));
- break;
- default:
- new InfoResultManager().defaultOptionMessage(
- input.getOption(), CommandUtils.helpMessage("info", Options.toList()));
- break;
- }
- }
-
- @Override
- public String getHelpMessage() {
- return CommandUtils.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"),
- ACCOUNT_RULES("--account-rules-classes"),
- CONNID_LOCATION("--connid-locations"),
- RECON_FILTER_BUILDERS("--reconciliation-filter-builders"),
- LOGIC_ACTIONS("--logic-actions"),
- MAPPING_ITEM_TRANSFORMERS("--mapping-item-transformers"),
- PASSWORD_RULES("--password-rules"),
- PROPAGATION_ACTIONS("--propagation-actions"),
- PUSH_ACTIONS("--push-actions"),
- REPORTLET_CONFS("--reportletConfs"),
- 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;
-
- 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;
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/InfoResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/InfoResultManager.java
deleted file mode 100644
index 65ba206..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/info/InfoResultManager.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.info;
-
-import java.util.Collection;
-import org.apache.syncope.client.cli.commands.CommonsResultManager;
-
-public class InfoResultManager extends CommonsResultManager {
-
- public void printVersion(final String version) {
- genericMessage("Syncope version: " + version);
- }
-
- public void printPwdResetAllowed(final boolean pwdResetAllowed) {
- genericMessage("Password reset allowed: " + pwdResetAllowed);
- }
-
- public void printPwdResetRequiringSecurityQuestions(final boolean pwdResetRequiringSecurityQuestions) {
- genericMessage("Password reset requiring security question: " + pwdResetRequiringSecurityQuestions);
- }
-
- public void printSelfRegistrationAllowed(final boolean selfRegAllowed) {
- genericMessage("Self registration allowed: " + selfRegAllowed);
- }
-
- public void printProvisioningManager(final String anyObjectProvisioningManager,
- final String getUserProvisioningManager,
- final String getGroupProvisioningManager) {
- genericMessage(
- "Any object provisioning manager class: " + anyObjectProvisioningManager,
- "User provisioning manager class: " + getUserProvisioningManager,
- "Group provisioning manager class: " + getGroupProvisioningManager);
- }
-
- public void printAccountRules(final Collection<String> rules) {
- rules.forEach(accountRule -> {
- genericMessage("Account rule: " + accountRule);
- });
- }
-
- public void printConnidLocations(final Collection<String> locations) {
- locations.forEach(location -> {
- genericMessage("ConnId location: " + location);
- });
- }
-
- public void printReconFilterBuilders(final Collection<String> reconFilterBuilders) {
- reconFilterBuilders.forEach(reconciliationFilterBuilder -> {
- genericMessage("Reconciliation filter builder: " + reconciliationFilterBuilder);
- });
- }
-
- public void printLogicActions(final Collection<String> actions) {
- actions.forEach(action -> {
- genericMessage("Logic action: " + action);
- });
- }
-
- public void printItemTransformers(final Collection<String> transformers) {
- transformers.forEach(tranformer -> {
- genericMessage("Mapping item tranformer: " + tranformer);
- });
- }
-
- public void printPasswordRules(final Collection<String> rules) {
- rules.forEach(rule -> {
- genericMessage("Password rule: " + rule);
- });
- }
-
- public void printCorrelationRules(final Collection<String> rules) {
- rules.forEach(rule -> {
- genericMessage("Correlation rule: " + rule);
- });
- }
-
- public void printPropagationActions(final Collection<String> actions) {
- actions.forEach(action -> {
- genericMessage("Propagation action: " + action);
- });
- }
-
- public void printPushActions(final Collection<String> actions) {
- actions.forEach(action -> {
- genericMessage("Push action: " + action);
- });
- }
-
- public void printPullActions(final Collection<String> actions) {
- actions.forEach(action -> {
- genericMessage("Sync action: " + action);
- });
- }
-
- public void printCorrelationActions(final Collection<String> actions) {
- actions.forEach(action -> {
- genericMessage("Push correlation rule: " + action);
- });
- }
-
- public void printReportletConfs(final Collection<String> reportletConfs) {
- reportletConfs.forEach(reportletConf -> {
- genericMessage("Reportlet conf: " + reportletConf);
- });
- }
-
- public void printJobs(final Collection<String> jobs) {
- jobs.forEach(job -> {
- genericMessage("Task job: " + job);
- });
- }
-
- public void printValidators(final Collection<String> validators) {
- validators.forEach(validator -> {
- genericMessage("Validator: " + validator);
- });
- }
-
- public void printPasswordGenerator(final String passwordGenerator) {
- genericMessage("Password generator class: " + passwordGenerator);
- }
-
- public void printVirtualAttributeCacheClass(final String virAttrCache) {
- genericMessage("Virtual attribute cache class: " + virAttrCache);
- }
-}
diff --git 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
deleted file mode 100644
index 172e261..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallCommand.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.install;
-
-import java.io.FileNotFoundException;
-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.commands.AbstractCommand;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@Command(name = "install")
-public class InstallCommand extends AbstractCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(InstallCommand.class);
-
- private final InstallResultManager installResultManager = new InstallResultManager();
-
- private static final String HELP_MESSAGE = "\nUsage: install [options]\n"
- + " Options:\n"
- + " --help \n"
- + " --setup\n"
- + " --setup-debug\n";
-
- @Override
- public void execute(final Input input) {
- if (StringUtils.isBlank(input.getOption())) {
- input.setOption(Options.HELP.getOptionName());
- }
-
- switch (Options.fromName(input.getOption())) {
- case SETUP:
- try {
- new InstallSetup().setup();
- } catch (final FileNotFoundException | IllegalAccessException ex) {
- LOG.error("Error installing CLI", ex);
- installResultManager.genericError(ex.getMessage());
- break;
- }
- break;
- case SETUP_DEBUG:
- try {
- new InstallSetupForDebug().setup();
- } catch (final FileNotFoundException | IllegalAccessException ex) {
- LOG.error("Error installing CLI", ex);
- installResultManager.genericError(ex.getMessage());
- break;
- }
- break;
- case HELP:
- System.out.println(HELP_MESSAGE);
- break;
- default:
- installResultManager.defaultOptionMessage(input.getOption(), HELP_MESSAGE);
- }
- }
-
- @Override
- public String getHelpMessage() {
- return HELP_MESSAGE;
- }
-
- public enum Options {
-
- HELP("--help"),
- SETUP("--setup"),
- SETUP_DEBUG("--setup-debug");
-
- private 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;
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallConfigFileTemplate.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallConfigFileTemplate.java
deleted file mode 100644
index 4eb15a4..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallConfigFileTemplate.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.install;
-
-import java.util.ResourceBundle;
-import org.apache.commons.lang3.SystemUtils;
-
-public final class InstallConfigFileTemplate {
-
- private static final ResourceBundle CONF = ResourceBundle.getBundle("configuration");
-
- public static final String CONFIGURATION_FILE_NAME = CONF.getString("cli.installation.filename");
-
- private static final String SYNCOPE_REST_SERVICES = "syncope.rest.services=%s://%s:%s%s";
-
- private static final String SYNCOPE_ADMIN_USER = "syncope.admin.user=%s";
-
- private static final String SYNCOPE_ADMIN_PASSWORD = "syncope.admin.password=%s";
-
- public static String cliPropertiesFile(
- final String schema,
- final String hostname,
- final String port,
- final String restContext,
- final String user,
- final String password) {
-
- final String syncopeRestServices = String.format(SYNCOPE_REST_SERVICES, schema, hostname, port, restContext);
- final String syncopeAdminUser = String.format(SYNCOPE_ADMIN_USER, user);
- final String syncopeAdminPassword = String.format(SYNCOPE_ADMIN_PASSWORD, password);
- final String useGZIPCompression = String.format("syncope.useGZIPCompression=true");
-
- return syncopeRestServices + "\n" + syncopeAdminUser + "\n" + syncopeAdminPassword + "\n" + useGZIPCompression;
- }
-
- public static String dirPath() {
- if (SystemUtils.IS_OS_WINDOWS) {
- return CONF.getString("cli.installation.directory.windows");
- } else {
- return CONF.getString("cli.installation.directory.linux");
- }
- }
-
- public static String configurationFilePath() {
- return dirPath() + CONFIGURATION_FILE_NAME;
- }
-
- private static String scriptFileName() {
- if (SystemUtils.IS_OS_WINDOWS) {
- return CONF.getString("script.file.name.windows");
- } else {
- return CONF.getString("script.file.name.linux");
- }
- }
-
- public static String scriptFilePath() {
- return dirPath() + scriptFileName();
- }
-
- private InstallConfigFileTemplate() {
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallResultManager.java
deleted file mode 100644
index ad854f1..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallResultManager.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.install;
-
-import java.net.ConnectException;
-import java.net.UnknownHostException;
-import javax.ws.rs.ProcessingException;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.client.cli.commands.CommonsResultManager;
-
-public class InstallResultManager extends CommonsResultManager {
-
- public void printWelcome() {
- 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("");
- }
-
- public void installationSuccessful(final String version) {
- System.out.println("Installation parameters checked on Syncope core version: " + version);
- 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("");
- }
-
- public void manageProcessingException(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 the installation AGAIN! #");
- 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 the installation AGAIN! #");
- System.out.println("# #");
- System.out.println("###############################################");
- System.out.println("");
- }
- }
-
- public void manageException(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 the installation AGAIN! #");
- 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 the installation AGAIN! #");
- System.out.println("# #");
- System.out.println("###############################################");
- System.out.println("");
- System.out.println(e.getMessage());
- System.out.println("");
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java
deleted file mode 100644
index 7acf12f..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetup.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.install;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Scanner;
-import javax.ws.rs.ProcessingException;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.client.cli.SyncopeServices;
-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;
-
-public class InstallSetup {
-
- private static final Logger LOG = LoggerFactory.getLogger(InstallSetup.class);
-
- private final InstallResultManager installResultManager = new InstallResultManager();
-
- private String syncopeAdminUser;
-
- private String syncopeAdminPassword;
-
- private String syncopeServerSchema;
-
- private String syncopeServerHostname = "localhost";
-
- private String syncopeServerPort = "8080";
-
- private String syncopeServerRestContext = "/syncope/rest/";
-
- public void setup() throws FileNotFoundException, IllegalAccessException {
- installResultManager.printWelcome();
-
- System.out.println("Path to config files of Syncope CLI client will be: "
- + InstallConfigFileTemplate.dirPath());
-
- if (!FileSystemUtils.exists(InstallConfigFileTemplate.dirPath())) {
- throw new FileNotFoundException("Directory: " + InstallConfigFileTemplate.dirPath() + " does not exists!");
- }
-
- if (!FileSystemUtils.canWrite(InstallConfigFileTemplate.dirPath())) {
- throw new IllegalAccessException("Permission denied on " + InstallConfigFileTemplate.dirPath());
- }
- System.out.println("- File system permission checked");
- System.out.println("");
-
- try (Scanner scanIn = new Scanner(System.in)) {
- System.out.print("Syncope server schema [http/https]: ");
- String syncopeServerSchemaFromSystemIn = scanIn.nextLine();
- boolean schemaFound = false;
- while (!schemaFound) {
- if (("http".equalsIgnoreCase(syncopeServerSchemaFromSystemIn))
- || ("https".equalsIgnoreCase(syncopeServerSchemaFromSystemIn))) {
- syncopeServerSchema = syncopeServerSchemaFromSystemIn;
- schemaFound = true;
- } else {
- System.out.println("Please use one of below values: ");
- System.out.println(" - http");
- System.out.println(" - https");
- syncopeServerSchemaFromSystemIn = scanIn.nextLine();
- }
- }
-
- System.out.print("Syncope server hostname [e.g. " + syncopeServerHostname + "]: ");
- String syncopeServerHostnameFromSystemIn = scanIn.nextLine();
- boolean syncopeServerHostnameFound = false;
- while (!syncopeServerHostnameFound) {
- if (StringUtils.isNotBlank(syncopeServerHostnameFromSystemIn)) {
- syncopeServerHostname = syncopeServerHostnameFromSystemIn;
- syncopeServerHostnameFound = true;
- } else {
- System.out.print("Syncope server hostname [e.g. " + syncopeServerHostname + "]: ");
- syncopeServerHostnameFromSystemIn = scanIn.nextLine();
- }
- }
-
- System.out.print("Syncope server port [e.g. " + syncopeServerPort + "]: ");
- String syncopeServerPortFromSystemIn = scanIn.nextLine();
- boolean syncopeServerPortFound = false;
- while (!syncopeServerPortFound) {
- if (StringUtils.isNotBlank(syncopeServerPortFromSystemIn)) {
- syncopeServerPort = syncopeServerPortFromSystemIn;
- syncopeServerPortFound = true;
- } else if (!StringUtils.isNumeric(syncopeServerPortFromSystemIn)) {
- System.err.println(syncopeServerPortFromSystemIn + " is not a numeric string, try again");
- syncopeServerPortFromSystemIn = scanIn.nextLine();
- } else {
- System.out.print("Syncope server port [e.g. " + syncopeServerPort + "]: ");
- syncopeServerPortFromSystemIn = scanIn.nextLine();
- }
- }
-
- System.out.print("Syncope server rest context [e.g. " + syncopeServerRestContext + "]: ");
- String syncopeServerRestContextFromSystemIn = scanIn.nextLine();
- boolean syncopeServerRestContextFound = false;
- while (!syncopeServerRestContextFound) {
- if (StringUtils.isNotBlank(syncopeServerRestContextFromSystemIn)) {
- syncopeServerRestContext = syncopeServerRestContextFromSystemIn;
- syncopeServerRestContextFound = true;
- } else {
- System.out.print("Syncope server port [e.g. " + syncopeServerRestContext + "]: ");
- syncopeServerRestContextFromSystemIn = scanIn.nextLine();
- }
- }
-
- System.out.print("Syncope admin user: ");
- String syncopeAdminUserFromSystemIn = scanIn.nextLine();
- boolean syncopeAdminUserFound = false;
- while (!syncopeAdminUserFound) {
- if (StringUtils.isNotBlank(syncopeAdminUserFromSystemIn)) {
- syncopeAdminUser = syncopeAdminUserFromSystemIn;
- syncopeAdminUserFound = true;
- } else {
- System.out.print("Syncope admin user: ");
- syncopeAdminUserFromSystemIn = scanIn.nextLine();
- }
- }
-
- char[] syncopeAdminPasswordFromSystemConsole = System.console().readPassword("Syncope admin password: ");
- boolean syncopeAdminPasswordFound = false;
- while (!syncopeAdminPasswordFound) {
- if (syncopeAdminPasswordFromSystemConsole != null && syncopeAdminPasswordFromSystemConsole.length > 0) {
- syncopeAdminPassword = new String(syncopeAdminPasswordFromSystemConsole);
- syncopeAdminPasswordFound = true;
- } else {
- syncopeAdminPasswordFromSystemConsole = System.console().readPassword("Syncope admin password: ");
- }
- }
- }
-
- final JasyptUtils jasyptUtils = JasyptUtils.get();
- try {
-
- final String contentCliPropertiesFile = InstallConfigFileTemplate.cliPropertiesFile(
- syncopeServerSchema,
- syncopeServerHostname,
- syncopeServerPort,
- syncopeServerRestContext,
- syncopeAdminUser,
- jasyptUtils.encrypt(syncopeAdminPassword));
- FileSystemUtils.createFileWith(InstallConfigFileTemplate.configurationFilePath(), contentCliPropertiesFile);
- } catch (final IOException ex) {
- System.out.println(ex.getMessage());
- }
-
- try {
- final SyncopeService syncopeService = SyncopeServices.get(SyncopeService.class);
- final String syncopeVersion = syncopeService.platform().getVersion();
- installResultManager.installationSuccessful(syncopeVersion);
- } catch (final ProcessingException ex) {
- LOG.error("Error installing CLI", ex);
- installResultManager.manageProcessingException(ex);
- } catch (final Exception e) {
- LOG.error("Error installing CLI", e);
- installResultManager.manageException(e);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetupForDebug.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetupForDebug.java
deleted file mode 100644
index 7e7bc46..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/install/InstallSetupForDebug.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.install;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import javax.ws.rs.ProcessingException;
-import org.apache.syncope.client.cli.SyncopeServices;
-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;
-
-public class InstallSetupForDebug {
-
- private static final Logger LOG = LoggerFactory.getLogger(InstallSetupForDebug.class);
-
- private final InstallResultManager installResultManager = new InstallResultManager();
-
- public void setup() throws FileNotFoundException, IllegalAccessException {
- installResultManager.printWelcome();
-
- System.out.println("Path to config files of Syncope CLI client will be: "
- + InstallConfigFileTemplate.dirPath());
-
- if (!FileSystemUtils.exists(InstallConfigFileTemplate.dirPath())) {
- throw new FileNotFoundException("Directory: " + InstallConfigFileTemplate.dirPath() + " does not exists!");
- }
-
- if (!FileSystemUtils.canWrite(InstallConfigFileTemplate.dirPath())) {
- throw new IllegalAccessException("Permission denied on " + InstallConfigFileTemplate.dirPath());
- }
- System.out.println("- File system permission checked");
- System.out.println("");
-
- final JasyptUtils jasyptUtils = JasyptUtils.get();
- try {
-
- final String contentCliPropertiesFile = InstallConfigFileTemplate.cliPropertiesFile(
- "http",
- "localhost",
- "9080",
- "/syncope/rest",
- "admin",
- jasyptUtils.encrypt("password"));
- FileSystemUtils.createFileWith(InstallConfigFileTemplate.configurationFilePath(), contentCliPropertiesFile);
- } catch (final IOException ex) {
- System.out.println(ex.getMessage());
- }
-
- try {
- final SyncopeService syncopeService = SyncopeServices.get(SyncopeService.class);
- final String syncopeVersion = syncopeService.platform().getVersion();
- installResultManager.installationSuccessful(syncopeVersion);
- } catch (final ProcessingException ex) {
- LOG.error("Error installing CLI", ex);
- installResultManager.manageProcessingException(ex);
- } catch (final Exception e) {
- LOG.error("Error installing CLI", e);
- installResultManager.manageException(e);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/AbstractLoggerCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/AbstractLoggerCommand.java
deleted file mode 100644
index 3e0978a..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/AbstractLoggerCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.logger;
-
-public abstract class AbstractLoggerCommand {
-
- protected final LoggerSyncopeOperations loggerSyncopeOperations = new LoggerSyncopeOperations();
-
- protected final LoggerResultManager loggerResultManager = new LoggerResultManager();
-
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCommand.java
deleted file mode 100644
index 9161571..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCommand.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.logger;
-
-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.commands.AbstractCommand;
-
-@Command(name = "logger")
-public class LoggerCommand extends AbstractCommand {
-
- private final LoggerResultManager loggerResultManager = new LoggerResultManager();
-
- @Override
- public void execute(final Input input) {
- if (StringUtils.isBlank(input.getOption())) {
- input.setOption(LoggerOptions.HELP.getOptionName());
- }
-
- switch (LoggerOptions.fromName(input.getOption())) {
- case DETAILS:
- new LoggerDetails(input).details();
- break;
- case LIST:
- new LoggerList(input).list();
- break;
- case LIST_MEMORY_APPENDERS:
- new LoggerListMemoryAppenders(input).list();
- break;
- case LAST_STATEMENTS:
- new LoggerLastStatements(input).read();
- break;
- case READ:
- new LoggerRead(input).read();
- break;
- case UPDATE:
- new LoggerUpdate(input).update();
- break;
- case UPDATE_ALL:
- new LoggerUpdateAll(input).updateAll();
- break;
- case CREATE:
- new LoggerCreate(input).create();
- break;
- case DELETE:
- new LoggerDelete(input).delete();
- break;
- case HELP:
- System.out.println(getHelpMessage());
- break;
- default:
- loggerResultManager.defaultOptionMessage(input.getOption(), getHelpMessage());
- }
- }
-
- @Override
- public String getHelpMessage() {
- return loggerResultManager.commandHelpMessage(getClass());
- }
-
- public enum LoggerOptions {
-
- HELP("--help"),
- DETAILS("--details"),
- LIST_MEMORY_APPENDERS("--list-memory-appenders"),
- LAST_STATEMENTS("--last-statements"),
- LIST("--list"),
- READ("--read"),
- UPDATE("--update"),
- UPDATE_ALL("--update-all"),
- CREATE("--create"),
- DELETE("--delete");
-
- private final String optionName;
-
- LoggerOptions(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 LoggerOptions fromName(final String name) {
- LoggerOptions optionToReturn = HELP;
- for (final LoggerOptions option : LoggerOptions.values()) {
- if (option.equalsOptionName(name)) {
- optionToReturn = option;
- }
- }
- return optionToReturn;
- }
-
- public static List<String> toList() {
- final List<String> options = new ArrayList<>();
- for (final LoggerOptions value : values()) {
- options.add(value.getOptionName());
- }
- return options;
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java
deleted file mode 100644
index 7c95633..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerCreate.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.logger;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.ws.WebServiceException;
-import org.apache.commons.lang3.tuple.Pair;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.client.cli.util.CommandUtils;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.log.LoggerTO;
-import org.apache.syncope.common.lib.types.LoggerLevel;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LoggerCreate extends AbstractLoggerCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(LoggerCreate.class);
-
- private static final String CREATE_HELP_MESSAGE =
- "logger --create {LOG-NAME}={LOG-LEVEL} {LOG-NAME}={LOG-LEVEL} [...]";
-
- private final Input input;
-
- public LoggerCreate(final Input input) {
- this.input = input;
- }
-
- public void create() {
- if (input.parameterNumber() >= 1) {
- final List<LoggerTO> loggerTOs = new ArrayList<>();
- boolean failed = false;
- for (String parameter : input.getParameters()) {
- LoggerTO loggerTO = new LoggerTO();
- Pair<String, String> pairParameter = Input.toPairParameter(parameter);
- try {
- loggerTO.setKey(pairParameter.getKey());
- loggerTO.setLevel(LoggerLevel.valueOf(pairParameter.getValue()));
- loggerSyncopeOperations.update(loggerTO);
- loggerTOs.add(loggerTO);
- } catch (WebServiceException | SyncopeClientException | IllegalArgumentException ex) {
- LOG.error("Error creating logger", ex);
- loggerResultManager.typeNotValidError(
- "logger level", input.firstParameter(), CommandUtils.fromEnumToArray(LoggerLevel.class));
- failed = true;
- break;
- }
- }
- if (!failed) {
- loggerResultManager.fromUpdate(loggerTOs);
- }
- } else {
- loggerResultManager.commandOptionError(CREATE_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java
deleted file mode 100644
index 15038c3..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDelete.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.logger;
-
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LoggerDelete extends AbstractLoggerCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(LoggerDelete.class);
-
- private static final String DELETE_HELP_MESSAGE = "logger --delete {LOG-NAME} {LOG-NAME} [...]";
-
- private final Input input;
-
- public LoggerDelete(final Input input) {
- this.input = input;
- }
-
- public void delete() {
- if (input.parameterNumber() >= 1) {
- for (final String parameter : input.getParameters()) {
- try {
- loggerSyncopeOperations.delete(parameter);
- loggerResultManager.deletedMessage("Logger", parameter);
- } catch (final WebServiceException | SyncopeClientException ex) {
- LOG.error("Error deleting logger", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- loggerResultManager.notFoundError("Logger", parameter);
- } else {
- loggerResultManager.genericError(ex.getMessage());
- }
- }
- }
- } else {
- loggerResultManager.commandOptionError(DELETE_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDetails.java
deleted file mode 100644
index 3a2006c..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerDetails.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.logger;
-
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.log.LoggerTO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LoggerDetails extends AbstractLoggerCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(LoggerDetails.class);
-
- private static final String LIST_HELP_MESSAGE = "logger --details";
-
- private final Input input;
-
- public LoggerDetails(final Input input) {
- this.input = input;
- }
-
- public void details() {
- if (input.parameterNumber() == 0) {
- try {
- final Map<String, String> details = new LinkedHashMap<>();
- final List<LoggerTO> loggerTOs = loggerSyncopeOperations.list();
- int debugLevel = 0;
- int errorLevel = 0;
- int fatalLevel = 0;
- int infoLevel = 0;
- int offLevel = 0;
- int traceLevel = 0;
- int warnLevel = 0;
- for (final LoggerTO loggerTO : loggerTOs) {
- switch (loggerTO.getLevel()) {
- case DEBUG:
- debugLevel++;
- break;
- case ERROR:
- errorLevel++;
- break;
- case FATAL:
- fatalLevel++;
- break;
- case INFO:
- infoLevel++;
- break;
- case OFF:
- offLevel++;
- break;
- case TRACE:
- traceLevel++;
- break;
- case WARN:
- warnLevel++;
- break;
- default:
- break;
- }
- }
- details.put("Total number", String.valueOf(loggerTOs.size()));
- details.put("Set to DEBUG", String.valueOf(debugLevel));
- details.put("Set to ERROR", String.valueOf(errorLevel));
- details.put("Set to FATAL", String.valueOf(fatalLevel));
- details.put("Set to INFO", String.valueOf(infoLevel));
- details.put("Set to OFF", String.valueOf(offLevel));
- details.put("Set to TRACE", String.valueOf(traceLevel));
- details.put("Set to WARN", String.valueOf(warnLevel));
- loggerResultManager.printDetails(details);
- } catch (final SyncopeClientException ex) {
- LOG.error("Error reading details about logger", ex);
- loggerResultManager.genericError(ex.getMessage());
- }
- } else {
- loggerResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerLastStatements.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerLastStatements.java
deleted file mode 100644
index 62fd2e1..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerLastStatements.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.logger;
-
-import org.apache.syncope.client.cli.Input;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LoggerLastStatements extends AbstractLoggerCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(LoggerLastStatements.class);
-
- private static final String READ_HELP_MESSAGE = "logger --last-statements {APPENDER-NAME}";
-
- private final Input input;
-
- public LoggerLastStatements(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.getParameters().length == 1) {
- try {
- loggerResultManager.fromGetLastLogStatements(
- loggerSyncopeOperations.getLastLogStatements(input.getParameters()[0]));
- } catch (final Exception ex) {
- LOG.error("Error reading last statements", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- loggerResultManager.notFoundError("Memory appender", input.getParameters()[0]);
- } else {
- loggerResultManager.genericError(ex.getMessage());
- }
- }
- } else {
- loggerResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java
deleted file mode 100644
index 28bf679..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerList.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.logger;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LoggerList extends AbstractLoggerCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(LoggerList.class);
-
- private static final String LIST_HELP_MESSAGE = "logger --list";
-
- private final Input input;
-
- public LoggerList(final Input input) {
- this.input = input;
- }
-
- public void list() {
- if (input.parameterNumber() == 0) {
- try {
- loggerResultManager.fromList(loggerSyncopeOperations.list());
- } catch (final SyncopeClientException ex) {
- LOG.error("Error listing logger", ex);
- loggerResultManager.genericError(ex.getMessage());
- }
- } else {
- loggerResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerListMemoryAppenders.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerListMemoryAppenders.java
deleted file mode 100644
index e39b03a..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerListMemoryAppenders.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.logger;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LoggerListMemoryAppenders extends AbstractLoggerCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(LoggerListMemoryAppenders.class);
-
- private static final String LIST_HELP_MESSAGE = "logger --list-memory-appenders";
-
- private final Input input;
-
- public LoggerListMemoryAppenders(final Input input) {
- this.input = input;
- }
-
- public void list() {
- if (input.parameterNumber() == 0) {
- try {
- loggerResultManager.fromListMemoryAppenders(loggerSyncopeOperations.listMemoryAppenders());
- } catch (final SyncopeClientException ex) {
- LOG.error("Error listing memory appenders", ex);
- loggerResultManager.genericError(ex.getMessage());
- }
- } else {
- loggerResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java
deleted file mode 100644
index af4ec24..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerRead.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.logger;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.log.LoggerTO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LoggerRead extends AbstractLoggerCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(LoggerRead.class);
-
- private static final String READ_HELP_MESSAGE = "logger --read {LOG-NAME} {LOG-NAME} [...]";
-
- private final Input input;
-
- public LoggerRead(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.getParameters().length >= 1) {
- final List<LoggerTO> loggerTOs = new ArrayList<>();
- boolean failed = false;
- for (final String parameter : input.getParameters()) {
- try {
- loggerTOs.add(loggerSyncopeOperations.read(parameter));
- } catch (final SyncopeClientException | WebServiceException ex) {
- LOG.error("Error reading logger", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- loggerResultManager.notFoundError("Logger", parameter);
- } else {
- loggerResultManager.genericError(ex.getMessage());
- }
- failed = true;
- break;
- }
- }
- if (!failed) {
- loggerResultManager.fromRead(loggerTOs);
- }
- } else {
- loggerResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java
deleted file mode 100644
index 2865b92..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerResultManager.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.logger;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import org.apache.syncope.client.cli.commands.CommonsResultManager;
-import org.apache.syncope.client.cli.view.Table;
-import org.apache.syncope.common.lib.log.LogStatement;
-import org.apache.syncope.common.lib.log.LoggerTO;
-
-public class LoggerResultManager extends CommonsResultManager {
-
- private static final ObjectMapper MAPPER = new ObjectMapper();
-
- public void fromListMemoryAppenders(final List<String> memoryAppenders) {
- final Table.TableBuilder tableBuilder = new Table.TableBuilder("list memory appenders").header("appender");
- memoryAppenders.forEach(appender -> {
- tableBuilder.rowValues(Collections.singletonList(appender));
- });
- tableBuilder.build().print();
- }
-
- public void fromGetLastLogStatements(final List<LogStatement> statements) throws JsonProcessingException {
- final Table.TableBuilder tableBuilder = new Table.TableBuilder("last statements").header("statement");
- for (final LogStatement statement : statements) {
- tableBuilder.rowValues(Collections.singletonList(
- MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(statement)));
- }
- tableBuilder.build().print();
- }
-
- public void fromList(final List<LoggerTO> loggerTOs) {
- fromCommandToView("list loggers", "level", loggerTOs);
- }
-
- public void fromRead(final List<LoggerTO> loggerTOs) {
- fromCommandToView("read loggers", "level", loggerTOs);
- }
-
- public void fromCreate(final List<LoggerTO> loggerTOs) {
- fromCommandToView("created loggers", "level", loggerTOs);
- }
-
- public void fromUpdate(final List<LoggerTO> loggerTOs) {
- fromCommandToView("updated loggers", "new level", loggerTOs);
- }
-
- public void fromDelete(final List<LoggerTO> loggerTOs) {
- fromCommandToView("deleted loggers", "new level", loggerTOs);
- }
-
- private void fromCommandToView(
- final String title,
- final String secondHeader,
- final List<LoggerTO> loggerTOs) {
-
- final Table.TableBuilder tableBuilder = new Table.TableBuilder(title).header("logger").header(secondHeader);
- loggerTOs.forEach(loggerTO -> {
- tableBuilder.rowValues(Arrays.asList(loggerTO.getKey(), loggerTO.getLevel().getLevel().name()));
- });
- tableBuilder.build().print();
- }
-
- public void printDetails(final Map<String, String> details) {
- printDetails("loggers details", details);
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerSyncopeOperations.java
deleted file mode 100644
index 8b44c37..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerSyncopeOperations.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.logger;
-
-import java.util.List;
-import java.util.stream.Collectors;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.lib.log.LogAppender;
-import org.apache.syncope.common.lib.log.LogStatement;
-import org.apache.syncope.common.lib.log.LoggerTO;
-import org.apache.syncope.common.lib.types.LoggerType;
-import org.apache.syncope.common.rest.api.service.LoggerService;
-
-public class LoggerSyncopeOperations {
-
- private final LoggerService loggerService = SyncopeServices.get(LoggerService.class);
-
- public List<String> listMemoryAppenders() {
- return loggerService.memoryAppenders().stream().map(LogAppender::getName).collect(Collectors.toList());
- }
-
- public List<LogStatement> getLastLogStatements(final String appender) {
- return loggerService.getLastLogStatements(appender);
- }
-
- public List<LoggerTO> list() {
- return loggerService.list(LoggerType.LOG);
- }
-
- public void update(final LoggerTO loggerTO) {
- loggerService.update(LoggerType.LOG, loggerTO);
- }
-
- public LoggerTO read(final String loggerName) {
- return loggerService.read(LoggerType.LOG, loggerName);
- }
-
- public void delete(final String loggerName) {
- loggerService.delete(LoggerType.LOG, loggerName);
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java
deleted file mode 100644
index 03335b9..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdate.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.logger;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.ws.WebServiceException;
-import org.apache.commons.lang3.tuple.Pair;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.client.cli.util.CommandUtils;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.log.LoggerTO;
-import org.apache.syncope.common.lib.types.LoggerLevel;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LoggerUpdate extends AbstractLoggerCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(LoggerUpdate.class);
-
- private static final String UPDATE_HELP_MESSAGE =
- "logger --update {LOG-NAME}={LOG-LEVEL} {LOG-NAME}={LOG-LEVEL} [...]";
-
- private final Input input;
-
- public LoggerUpdate(final Input input) {
- this.input = input;
- }
-
- public void update() {
- if (input.parameterNumber() >= 1) {
- final List<LoggerTO> loggerTOs = new ArrayList<>();
- boolean failed = false;
- for (String parameter : input.getParameters()) {
- Pair<String, String> pairParameter = Input.toPairParameter(parameter);
- try {
- LoggerTO loggerTO = loggerSyncopeOperations.read(pairParameter.getKey());
- loggerTO.setLevel(LoggerLevel.valueOf(pairParameter.getValue()));
- loggerSyncopeOperations.update(loggerTO);
- loggerTOs.add(loggerTO);
- } catch (WebServiceException | SyncopeClientException | IllegalArgumentException ex) {
- LOG.error("Error updating logger", ex);
- if (ex.getMessage().startsWith("No enum constant org.apache.syncope.common.lib.types.")) {
- loggerResultManager.typeNotValidError(
- "logger level",
- input.firstParameter(),
- CommandUtils.fromEnumToArray(LoggerLevel.class));
- } else if ("Parameter syntax error!".equalsIgnoreCase(ex.getMessage())) {
- loggerResultManager.genericError(ex.getMessage());
- loggerResultManager.genericError(UPDATE_HELP_MESSAGE);
- } else if (ex.getMessage().startsWith("NotFound")) {
- loggerResultManager.notFoundError("Logger", parameter);
- } else {
- loggerResultManager.genericError(ex.getMessage());
- loggerResultManager.genericError(UPDATE_HELP_MESSAGE);
- }
- failed = true;
- break;
- }
- }
- if (!failed) {
- loggerResultManager.fromUpdate(loggerTOs);
- }
- } else {
- loggerResultManager.commandOptionError(UPDATE_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java
deleted file mode 100644
index 2ba5728..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/logger/LoggerUpdateAll.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.logger;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.client.cli.util.CommandUtils;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.log.LoggerTO;
-import org.apache.syncope.common.lib.types.LoggerLevel;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LoggerUpdateAll extends AbstractLoggerCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(LoggerUpdateAll.class);
-
- private static final String UPDATE_ALL_HELP_MESSAGE = "logger --update-all {LOG-LEVEL}";
-
- private final Input input;
-
- public LoggerUpdateAll(final Input input) {
- this.input = input;
- }
-
- public void updateAll() {
- if (input.parameterNumber() == 1) {
- final List<LoggerTO> loggerTOs = new ArrayList<>();
- boolean failed = false;
- for (final LoggerTO loggerTO : loggerSyncopeOperations.list()) {
- try {
- loggerTO.setLevel(LoggerLevel.valueOf(input.firstParameter()));
- loggerSyncopeOperations.update(loggerTO);
- loggerTOs.add(loggerTO);
- } catch (final WebServiceException | SyncopeClientException | IllegalArgumentException ex) {
- LOG.error("Error updating logger", ex);
- if (ex.getMessage().startsWith("No enum constant org.apache.syncope.common.lib.types.")) {
- loggerResultManager.typeNotValidError(
- "logger level",
- input.firstParameter(),
- CommandUtils.fromEnumToArray(LoggerLevel.class));
- } else {
- loggerResultManager.genericError(ex.getMessage());
- loggerResultManager.genericError(UPDATE_ALL_HELP_MESSAGE);
- }
- failed = true;
- break;
- }
- }
- if (!failed) {
- loggerResultManager.fromUpdate(loggerTOs);
- }
- } else {
- loggerResultManager.commandOptionError(UPDATE_ALL_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/AbstractNotificationCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/AbstractNotificationCommand.java
deleted file mode 100644
index a21f2cd..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/AbstractNotificationCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.notification;
-
-public abstract class AbstractNotificationCommand {
-
- protected final NotificationSyncopeOperations notificationSyncopeOperations = new NotificationSyncopeOperations();
-
- protected final NotificationResultManager notificationResultManager = new NotificationResultManager();
-
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationCommand.java
deleted file mode 100644
index 3acbda3..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationCommand.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.notification;
-
-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.commands.AbstractCommand;
-
-@Command(name = "notification")
-public class NotificationCommand extends AbstractCommand {
-
- private final NotificationResultManager notificationResultManager = new NotificationResultManager();
-
- @Override
- public void execute(final Input input) {
- if (StringUtils.isBlank(input.getOption())) {
- input.setOption(Options.HELP.getOptionName());
- }
-
- switch (Options.fromName(input.getOption())) {
- case LIST:
- new NotificationList(input).list();
- break;
- case READ:
- new NotificationRead(input).read();
- break;
- case DELETE:
- new NotificationDelete(input).delete();
- break;
- case HELP:
- System.out.println(getHelpMessage());
- break;
- default:
- notificationResultManager.deletedMessage(input.getOption(), getHelpMessage());
- }
- }
-
- @Override
- public String getHelpMessage() {
- return notificationResultManager.commandHelpMessage(getClass());
- }
-
- private enum Options {
-
- HELP("--help"),
- LIST("--list"),
- READ("--read"),
- DELETE("--delete");
-
- private 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;
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java
deleted file mode 100644
index d684ec7..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationDelete.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.notification;
-
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NotificationDelete extends AbstractNotificationCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(NotificationDelete.class);
-
- private static final String DELETE_HELP_MESSAGE =
- "notification --delete {NOTIFICATION-KEY} {NOTIFICATION-KEY} [...]";
-
- private final Input input;
-
- public NotificationDelete(final Input input) {
- this.input = input;
- }
-
- public void delete() {
- if (input.parameterNumber() >= 1) {
- for (final String parameter : input.getParameters()) {
- try {
- notificationSyncopeOperations.delete(parameter);
- notificationResultManager.deletedMessage("Notification", parameter);
- } catch (final WebServiceException | SyncopeClientException ex) {
- LOG.error("Error deleting notification", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- notificationResultManager.notFoundError("Notification", parameter);
- } else {
- notificationResultManager.genericError(ex.getMessage());
- }
- } catch (final NumberFormatException ex) {
- notificationResultManager.notBooleanDeletedError("notification", parameter);
- }
- }
- } else {
- notificationResultManager.commandOptionError(DELETE_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
deleted file mode 100644
index 463d8e9..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationList.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.notification;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NotificationList extends AbstractNotificationCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(NotificationList.class);
-
- private static final String LIST_HELP_MESSAGE = "notification --list";
-
- private final Input input;
-
- public NotificationList(final Input input) {
- this.input = input;
- }
-
- public void list() {
- if (input.parameterNumber() == 0) {
- try {
- notificationResultManager.printNotifications(notificationSyncopeOperations.list());
- } catch (final SyncopeClientException ex) {
- LOG.error("Error listing notification", ex);
- notificationResultManager.genericError(ex.getMessage());
- }
- } else {
- notificationResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
deleted file mode 100644
index c51c8ec..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationRead.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.notification;
-
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NotificationRead extends AbstractNotificationCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(NotificationRead.class);
-
- private static final String READ_HELP_MESSAGE = "notification --read {NOTIFICATION-KEY} {NOTIFICATION-KEY} [...]";
-
- private final Input input;
-
- public NotificationRead(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.parameterNumber() >= 1) {
- for (final String parameter : input.getParameters()) {
- try {
- notificationResultManager.printNotification(notificationSyncopeOperations.read(parameter));
- } catch (final NumberFormatException ex) {
- LOG.error("Error reading notification", ex);
- notificationResultManager.notBooleanDeletedError("notification", parameter);
- } catch (final WebServiceException | SyncopeClientException ex) {
- LOG.error("Error reading notification", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- notificationResultManager.notFoundError("Notification", parameter);
- } else {
- notificationResultManager.genericError(ex.getMessage());
- }
- }
- }
- } else {
- notificationResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationResultManager.java
deleted file mode 100644
index 5e1740f..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationResultManager.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.notification;
-
-import java.util.List;
-import org.apache.syncope.client.cli.commands.CommonsResultManager;
-import org.apache.syncope.common.lib.to.NotificationTO;
-
-public class NotificationResultManager extends CommonsResultManager {
-
- public void printNotifications(final List<NotificationTO> notificationTOs) {
- System.out.println("");
- notificationTOs.forEach(notificationTO -> {
- printNotification(notificationTO);
- });
- }
-
- public void printNotification(final NotificationTO notificationTO) {
- System.out.println(" > NOTIFICATION KEY: " + notificationTO.getKey());
- System.out.println(" events: " + notificationTO.getEvents());
- System.out.println(" sender: " + notificationTO.getSender());
- System.out.println(" subject: " + notificationTO.getSubject());
- System.out.println(" recipients: " + notificationTO.getRecipientsFIQL());
- System.out.println(" recipient attribute name: " + notificationTO.getRecipientAttrName());
- System.out.println(" template: " + notificationTO.getTemplate());
- System.out.println(" abouts: " + notificationTO.getAbouts());
- System.out.println(" static recipient: " + notificationTO.getStaticRecipients());
- System.out.println(" trace level: " + notificationTO.getTraceLevel());
- System.out.println(" active: " + notificationTO.isActive());
- System.out.println(" self as recipient: " + notificationTO.isSelfAsRecipient());
- System.out.println("");
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationSyncopeOperations.java
deleted file mode 100644
index cbdbf61..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/notification/NotificationSyncopeOperations.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.notification;
-
-import java.util.List;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.lib.to.NotificationTO;
-import org.apache.syncope.common.rest.api.service.NotificationService;
-
-public class NotificationSyncopeOperations {
-
- private final NotificationService notificationService = SyncopeServices.get(NotificationService.class);
-
- public NotificationTO read(final String notificationKey) {
- return notificationService.read(notificationKey);
- }
-
- public List<NotificationTO> list() {
- return notificationService.list();
- }
-
- public void delete(final String notificationKey) {
- notificationService.delete(notificationKey);
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/AbstractPolicyCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/AbstractPolicyCommand.java
deleted file mode 100644
index 0c8a55f..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/AbstractPolicyCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.policy;
-
-public abstract class AbstractPolicyCommand {
-
- protected final PolicySyncopeOperations policySyncopeOperations = new PolicySyncopeOperations();
-
- protected final PolicyResultManager policyResultManager = new PolicyResultManager();
-
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyCommand.java
deleted file mode 100644
index f334888..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyCommand.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.policy;
-
-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.commands.AbstractCommand;
-
-@Command(name = "policy")
-public class PolicyCommand extends AbstractCommand {
-
- private final PolicyResultManager policyResultManager = new PolicyResultManager();
-
- @Override
- public void execute(final Input input) {
- if (StringUtils.isBlank(input.getOption())) {
- input.setOption(PolicyOptions.HELP.getOptionName());
- }
-
- switch (PolicyOptions.fromName(input.getOption())) {
- case DETAILS:
- new PolicyDetails(input).details();
- break;
- case LIST:
- new PolicyList(input).list();
- break;
- case READ:
- new PolicyRead(input).read();
- break;
- case DELETE:
- new PolicyDelete(input).delete();
- break;
- case HELP:
- System.out.println(getHelpMessage());
- break;
- default:
- policyResultManager.defaultOptionMessage(input.getOption(), getHelpMessage());
- }
- }
-
- @Override
- public String getHelpMessage() {
- return policyResultManager.commandHelpMessage(getClass());
- }
-
- public enum PolicyOptions {
-
- HELP("--help"),
- DETAILS("--details"),
- LIST("--list"),
- READ("--read"),
- DELETE("--delete");
-
- private final String optionName;
-
- PolicyOptions(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 PolicyOptions fromName(final String name) {
- PolicyOptions optionToReturn = HELP;
- for (final PolicyOptions option : PolicyOptions.values()) {
- if (option.equalsOptionName(name)) {
- optionToReturn = option;
- }
- }
- return optionToReturn;
- }
-
- public static List<String> toList() {
- final List<String> options = new ArrayList<>();
- for (final PolicyOptions value : values()) {
- options.add(value.getOptionName());
- }
- return options;
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java
deleted file mode 100644
index c9f5ff9..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDelete.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.policy;
-
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class PolicyDelete extends AbstractPolicyCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(PolicyDelete.class);
-
- private static final String DELETE_HELP_MESSAGE = "policy --delete {POLICY-KEY} {POLICY-KEY} [...]";
-
- private final Input input;
-
- public PolicyDelete(final Input input) {
- this.input = input;
- }
-
- public void delete() {
- if (input.parameterNumber() >= 1) {
- for (final String parameter : input.getParameters()) {
- try {
- policySyncopeOperations.delete(parameter);
- policyResultManager.deletedMessage("Policy", parameter);
- } catch (final WebServiceException | SyncopeClientException ex) {
- LOG.error("Error deleting policy", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- policyResultManager.notFoundError("Policy", parameter);
- } else if (ex.getMessage().startsWith("DataIntegrityViolation")) {
- policyResultManager.genericError("You cannot delete policy " + parameter);
- } else {
- policyResultManager.genericError(ex.getMessage());
- }
- } catch (final NumberFormatException ex) {
- LOG.error("Error deleting policy", ex);
- policyResultManager.notBooleanDeletedError("policy", parameter);
- }
- }
- } else {
- policyResultManager.commandOptionError(DELETE_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDetails.java
deleted file mode 100644
index bc4b5cf..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyDetails.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.policy;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.types.PolicyType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class PolicyDetails extends AbstractPolicyCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(PolicyDetails.class);
-
- private static final String DETAILS_HELP_MESSAGE = "policy --details";
-
- private final Input input;
-
- public PolicyDetails(final Input input) {
- this.input = input;
- }
-
- public void details() {
- if (input.parameterNumber() == 0) {
- try {
- final Map<String, String> details = new LinkedHashMap<>();
- final int accountPolicySize = policySyncopeOperations.list(PolicyType.ACCOUNT.name()).size();
- final int passwordPolicySize = policySyncopeOperations.list(PolicyType.PASSWORD.name()).size();
- final int pullPolicySize = policySyncopeOperations.list(PolicyType.PULL.name()).size();
- final int pushPolicySize = policySyncopeOperations.list(PolicyType.PUSH.name()).size();
- details.put("total number", String.valueOf(accountPolicySize
- + passwordPolicySize
- + pullPolicySize
- + pushPolicySize));
- details.put("account policies", String.valueOf(accountPolicySize));
- details.put("password policies", String.valueOf(passwordPolicySize));
- details.put("pull policies", String.valueOf(pullPolicySize));
- details.put("push policies", String.valueOf(pushPolicySize));
- policyResultManager.printDetails(details);
- } catch (final Exception ex) {
- LOG.error("Error reading details about policy", ex);
- policyResultManager.genericError(ex.getMessage());
- }
- } else {
- policyResultManager.commandOptionError(DETAILS_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
deleted file mode 100644
index 213f2e4..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyList.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.policy;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.client.cli.util.CommandUtils;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.types.PolicyType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class PolicyList extends AbstractPolicyCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(PolicyList.class);
-
- private static final String LIST_HELP_MESSAGE = "policy --list {POLICY-TYPE}\n"
- + " Policy type: ACCOUNT / PASSWORD / SYNC / PUSH";
-
- private final Input input;
-
- public PolicyList(final Input input) {
- this.input = input;
- }
-
- public void list() {
- if (input.parameterNumber() == 1) {
- try {
- policyResultManager.printPoliciesByType(
- input.firstParameter(), policySyncopeOperations.list(input.firstParameter()));
- } catch (final SyncopeClientException ex) {
- LOG.error("Error listing policy", ex);
- policyResultManager.genericError(ex.getMessage());
- } catch (final IllegalArgumentException ex) {
- LOG.error("Error listing policy", ex);
- policyResultManager.typeNotValidError(
- "policy", input.firstParameter(), CommandUtils.fromEnumToArray(PolicyType.class));
- }
- } else {
- policyResultManager.commandOptionError(LIST_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
deleted file mode 100644
index 26ee655..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyRead.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.policy;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.client.cli.util.CommandUtils;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.policy.PolicyTO;
-import org.apache.syncope.common.lib.types.PolicyType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class PolicyRead extends AbstractPolicyCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(PolicyRead.class);
-
- private static final String READ_HELP_MESSAGE = "policy --read {POLICY-TYPE} {POLICY-KEY}\n"
- + " Policy type: ACCOUNT / PASSWORD / PULL / PUSH";
-
- private final Input input;
-
- public PolicyRead(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.parameterNumber() >= 2) {
- final String[] parameters = Arrays.copyOfRange(input.getParameters(), 1, input.parameterNumber());
- try {
- final List<PolicyTO> policyTOs = new ArrayList<>();
- for (final String parameter : parameters) {
- policyTOs.add(policySyncopeOperations.read(input.firstParameter(), parameter));
- }
- policyResultManager.printPolicies(policyTOs);
- } catch (final SyncopeClientException | WebServiceException ex) {
- LOG.error("Error reading policy", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- policyResultManager.notFoundError("Policy", parameters[0]);
- } else {
- policyResultManager.genericError(ex.getMessage());
- }
- } catch (final IllegalArgumentException ex) {
- LOG.error("Error reading policy", ex);
- policyResultManager.typeNotValidError(
- "policy", input.firstParameter(), CommandUtils.fromEnumToArray(PolicyType.class));
- }
- } else {
- policyResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyResultManager.java
deleted file mode 100644
index 70d373d..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicyResultManager.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.policy;
-
-import java.util.List;
-import java.util.Map;
-import org.apache.syncope.client.cli.commands.CommonsResultManager;
-import org.apache.syncope.common.lib.policy.PolicyTO;
-import org.apache.syncope.common.lib.policy.AccountPolicyTO;
-import org.apache.syncope.common.lib.policy.PasswordPolicyTO;
-import org.apache.syncope.common.lib.policy.PullPolicyTO;
-import org.apache.syncope.common.lib.types.PolicyType;
-
-public class PolicyResultManager extends CommonsResultManager {
-
- public void printPolicies(final List<PolicyTO> policyTOs) {
- System.out.println("");
- policyTOs.forEach(policyTO -> {
- if (policyTO instanceof AccountPolicyTO) {
- printAccountPolicy((AccountPolicyTO) policyTO);
- } else if (policyTO instanceof PasswordPolicyTO) {
- printPasswordPolicy((PasswordPolicyTO) policyTO);
- } else if (policyTO instanceof PullPolicyTO) {
- printPullPolicy((PullPolicyTO) policyTO);
- }
- });
- }
-
- public void printPoliciesByType(final String policyTypeString, final List<PolicyTO> policyTOs) {
- System.out.println("");
- final PolicyType policyType = PolicyType.valueOf(policyTypeString);
- switch (policyType) {
- case ACCOUNT:
- policyTOs.forEach(policyTO -> {
- printAccountPolicy((AccountPolicyTO) policyTO);
- });
- break;
- case PASSWORD:
- policyTOs.forEach(policyTO -> {
- printPasswordPolicy((PasswordPolicyTO) policyTO);
- });
- break;
- case PUSH:
- policyTOs.forEach(policyTO -> {
- System.out.println(policyTO);
- });
- break;
- case PULL:
- policyTOs.forEach(policyTO -> {
- printPullPolicy((PullPolicyTO) policyTO);
- });
- break;
- default:
- break;
- }
- }
-
- public void printAccountPolicy(final AccountPolicyTO policyTO) {
- System.out.println(" > KEY: " + policyTO.getKey());
- System.out.println(" type: " + policyTO.getClass().getSimpleName());
- System.out.println(" description: " + policyTO.getDescription());
- System.out.println(" resources : " + policyTO.getUsedByResources().toString());
- System.out.println(" realms : " + policyTO.getUsedByRealms().toString());
- System.out.println(" max authentication attempts : " + policyTO.getMaxAuthenticationAttempts());
- System.out.println(" propagation suspension : " + policyTO.isPropagateSuspension());
- System.out.println(" RULES : ");
- System.out.println(" > class : " + policyTO.getRules());
- System.out.println("");
- }
-
- public void printPasswordPolicy(final PasswordPolicyTO policyTO) {
- System.out.println(" > KEY: " + policyTO.getKey());
- System.out.println(" type: " + policyTO.getClass().getSimpleName());
- System.out.println(" description: " + policyTO.getDescription());
- System.out.println(" resources : " + policyTO.getUsedByResources().toString());
- System.out.println(" realms : " + policyTO.getUsedByRealms().toString());
- System.out.println(" history lenght : " + policyTO.getHistoryLength());
- System.out.println(" allow null password : " + policyTO.isAllowNullPassword());
- System.out.println(" RULES : ");
- System.out.println(" > class : " + policyTO.getRules());
- System.out.println("");
- }
-
- public void printPullPolicy(final PullPolicyTO policyTO) {
- System.out.println(" > KEY: " + policyTO.getKey());
- System.out.println(" type: " + policyTO.getClass().getSimpleName());
- System.out.println(" description: " + policyTO.getDescription());
- System.out.println(" resources : " + policyTO.getUsedByResources().toString());
- System.out.println(" realms : " + policyTO.getUsedByRealms().toString());
- System.out.println(" conflict resolution action: "
- + policyTO.getConflictResolutionAction().name());
- System.out.println(" correlation rules : "
- + policyTO.getCorrelationRules().toString());
- System.out.println("");
- }
-
- public void printDetails(final Map<String, String> details) {
- printDetails("policies details", details);
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java
deleted file mode 100644
index f738ad9..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/policy/PolicySyncopeOperations.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.policy;
-
-import java.util.List;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.lib.policy.PolicyTO;
-import org.apache.syncope.common.lib.types.PolicyType;
-import org.apache.syncope.common.rest.api.service.PolicyService;
-
-public class PolicySyncopeOperations {
-
- private final PolicyService policyService = SyncopeServices.get(PolicyService.class);
-
- public <T extends PolicyTO> T read(final String type, final String policyKey) {
- return policyService.read(PolicyType.valueOf(type), policyKey);
- }
-
- public <T extends PolicyTO> List<T> list(final String policyType) {
- return policyService.list(PolicyType.valueOf(policyType));
- }
-
- public void delete(final String policyKey) {
- policyService.delete(null, policyKey);
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/AbstractQuestionCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/AbstractQuestionCommand.java
deleted file mode 100644
index 0a3846a..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/AbstractQuestionCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.question;
-
-public abstract class AbstractQuestionCommand {
-
- protected final QuestionSyncopeOperations questionSyncopeOperations = new QuestionSyncopeOperations();
-
- protected final QuestionResultManager questionResultManager = new QuestionResultManager();
-
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java
deleted file mode 100644
index 8c40375..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionCommand.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.question;
-
-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.commands.AbstractCommand;
-
-@Command(name = "question")
-public class QuestionCommand extends AbstractCommand {
-
- private final QuestionResultManager questionResultManager = new QuestionResultManager();
-
- @Override
- public void execute(final Input input) {
- if (StringUtils.isBlank(input.getOption())) {
- input.setOption(QuestionOptions.HELP.getOptionName());
- }
-
- switch (QuestionOptions.fromName(input.getOption())) {
- case LIST:
- new QuestionList(input).list();
- break;
- case READ:
- new QuestionRead(input).read();
- break;
- case DELETE:
- new QuestionDelete(input).delete();
- break;
- case HELP:
- System.out.println(getHelpMessage());
- break;
- default:
- questionResultManager.defaultOptionMessage(input.getOption(), getHelpMessage());
- }
- }
-
- @Override
- public String getHelpMessage() {
- return questionResultManager.commandHelpMessage(getClass());
- }
-
- private enum QuestionOptions {
-
- HELP("--help"),
- LIST("--list"),
- READ("--read"),
- DELETE("--delete");
-
- private final String optionName;
-
- QuestionOptions(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 QuestionOptions fromName(final String name) {
- QuestionOptions optionToReturn = HELP;
- for (final QuestionOptions option : QuestionOptions.values()) {
- if (option.equalsOptionName(name)) {
- optionToReturn = option;
- }
- }
- return optionToReturn;
- }
-
- public static List<String> toList() {
- final List<String> options = new ArrayList<>();
- for (final QuestionOptions value : values()) {
- options.add(value.getOptionName());
- }
- return options;
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionDelete.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionDelete.java
deleted file mode 100644
index a83ca1c..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionDelete.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.question;
-
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class QuestionDelete extends AbstractQuestionCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(QuestionDelete.class);
-
- private static final String DELETE_HELP_MESSAGE = "question --delete {QUESTION-KEY} {QUESTION-KEY} [...]";
-
- private final Input input;
-
- public QuestionDelete(final Input input) {
- this.input = input;
- }
-
- public void delete() {
- if (input.getParameters().length >= 1) {
- for (final String parameter : input.getParameters()) {
- try {
- questionSyncopeOperations.delete(parameter);
- questionResultManager.deletedMessage("security question", parameter);
- } catch (final SyncopeClientException | WebServiceException ex) {
- LOG.error("Error deleting question", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- questionResultManager.notFoundError("Security question", parameter);
- } else {
- questionResultManager.genericError(ex.getMessage());
- }
- break;
- } catch (final NumberFormatException ex) {
- LOG.error("Error deleting question", ex);
- questionResultManager.numberFormatException("security question", parameter);
- }
- }
- } else {
- questionResultManager.commandOptionError(DELETE_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionList.java
deleted file mode 100644
index 081d418..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionList.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.question;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class QuestionList extends AbstractQuestionCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(QuestionList.class);
-
- private static final String LIST_HELP_MESSAGE = "question --list";
-
- private final Input input;
-
- public QuestionList(final Input input) {
- this.input = input;
- }
-
- public void list() {
- if (input.parameterNumber() == 0) {
- try {
- questionResultManager.printQuestions(questionSyncopeOperations.list());
- } catch (final SyncopeClientException ex) {
- LOG.error("Error listing question", ex);
- questionResultManager.genericError(ex.getMessage());
- }
- } else {
- questionResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionRead.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionRead.java
deleted file mode 100644
index 6393774..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionRead.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.question;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.ws.WebServiceException;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.SecurityQuestionTO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class QuestionRead extends AbstractQuestionCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(QuestionRead.class);
-
- private static final String READ_HELP_MESSAGE = "question --read {QUESTION-KEY} {QUESTION-KEY} [...]";
-
- private final Input input;
-
- public QuestionRead(final Input input) {
- this.input = input;
- }
-
- public void read() {
- if (input.getParameters().length >= 1) {
- final List<SecurityQuestionTO> questionTOs = new ArrayList<>();
- for (final String parameter : input.getParameters()) {
- try {
- questionTOs.add(questionSyncopeOperations.read(parameter));
- } catch (final SyncopeClientException | WebServiceException ex) {
- LOG.error("Error reading question", ex);
- if (ex.getMessage().startsWith("NotFound")) {
- questionResultManager.notFoundError("Security question", parameter);
- } else {
- questionResultManager.genericError(ex.getMessage());
- }
- break;
- } catch (final NumberFormatException ex) {
- LOG.error("Error reading question", ex);
- questionResultManager.numberFormatException("security question", parameter);
- }
- }
- questionResultManager.printQuestions(questionTOs);
- } else {
- questionResultManager.commandOptionError(READ_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionResultManager.java
deleted file mode 100644
index fb0bd18..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionResultManager.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.question;
-
-import java.util.List;
-import org.apache.syncope.client.cli.commands.CommonsResultManager;
-import org.apache.syncope.common.lib.to.SecurityQuestionTO;
-
-public class QuestionResultManager extends CommonsResultManager {
-
- public void printQuestions(final List<SecurityQuestionTO> questionTOs) {
- System.out.println("");
- questionTOs.forEach(questionTO -> {
- printQuestion(questionTO);
- });
- }
-
- public void printQuestion(final SecurityQuestionTO securityQuestionTO) {
- System.out.println(" > SECURITY QUESTION KEY: " + securityQuestionTO.getKey());
- System.out.println(" content: " + securityQuestionTO.getContent());
- System.out.println("");
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionSyncopeOperations.java
deleted file mode 100644
index f4c09bb..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/question/QuestionSyncopeOperations.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.question;
-
-import java.util.List;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.lib.to.SecurityQuestionTO;
-import org.apache.syncope.common.rest.api.service.SecurityQuestionService;
-
-public class QuestionSyncopeOperations {
-
- private final SecurityQuestionService securityQuestionService = SyncopeServices.get(SecurityQuestionService.class);
-
- public List<SecurityQuestionTO> list() {
- return securityQuestionService.list();
- }
-
- public void delete(final String questionKey) {
- securityQuestionService.delete(questionKey);
- }
-
- public SecurityQuestionTO read(final String questionKey) {
- return securityQuestionService.read(questionKey);
- }
-
- public SecurityQuestionTO readByUser(final String username) {
- return securityQuestionService.readByUser(username);
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/AbstractRealmCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/AbstractRealmCommand.java
deleted file mode 100644
index 06cd1ba..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/AbstractRealmCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.realm;
-
-public abstract class AbstractRealmCommand {
-
- protected final RealmSyncopeOperations realmSyncopeOperations = new RealmSyncopeOperations();
-
- protected final RealmResultManager realmResultManager = new RealmResultManager();
-
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java
deleted file mode 100644
index db62d91..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmCommand.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.realm;
-
-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.commands.AbstractCommand;
-
-@Command(name = "realm")
-public class RealmCommand extends AbstractCommand {
-
- private final RealmResultManager realmResultManager = new RealmResultManager();
-
- @Override
- public void execute(final Input input) {
- if (StringUtils.isBlank(input.getOption())) {
- input.setOption(RealmOptions.HELP.getOptionName());
- }
- switch (RealmOptions.fromName(input.getOption())) {
- case DETAILS:
- new RealmDetails(input).details();
- break;
- case LIST:
- new RealmList(input).list();
- break;
- case HELP:
- System.out.println(getHelpMessage());
- break;
- default:
- realmResultManager.defaultOptionMessage(input.getOption(), getHelpMessage());
- }
- }
-
- @Override
- public String getHelpMessage() {
- return realmResultManager.commandHelpMessage(getClass());
- }
-
- private enum RealmOptions {
-
- HELP("--help"),
- DETAILS("--details"),
- LIST("--list");
-
- private final String optionName;
-
- RealmOptions(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 RealmOptions fromName(final String name) {
- RealmOptions optionToReturn = HELP;
- for (final RealmOptions option : RealmOptions.values()) {
- if (option.equalsOptionName(name)) {
- optionToReturn = option;
- }
- }
- return optionToReturn;
- }
-
- public static List<String> toList() {
- final List<String> options = new ArrayList<>();
- for (final RealmOptions value : values()) {
- options.add(value.getOptionName());
- }
- return options;
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmDetails.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmDetails.java
deleted file mode 100644
index 1468aa3..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmDetails.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.realm;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RealmDetails extends AbstractRealmCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(RealmDetails.class);
-
- private static final String DETAILS_HELP_MESSAGE = "realm --details";
-
- private final Input input;
-
- public RealmDetails(final Input input) {
- this.input = input;
- }
-
- public void details() {
- if (input.parameterNumber() == 0) {
- try {
- final Map<String, String> details = new LinkedHashMap<>();
- details.put("Total number", String.valueOf(realmSyncopeOperations.list().size()));
- realmResultManager.printDetails(details);
- } catch (final SyncopeClientException ex) {
- LOG.error("Error reading details about realm", ex);
- realmResultManager.genericError(ex.getMessage());
- }
- } else {
- realmResultManager.unnecessaryParameters(input.listParameters(), DETAILS_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmList.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmList.java
deleted file mode 100644
index 8a444ac..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmList.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.realm;
-
-import org.apache.syncope.client.cli.Input;
-import org.apache.syncope.common.lib.SyncopeClientException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RealmList extends AbstractRealmCommand {
-
- private static final Logger LOG = LoggerFactory.getLogger(RealmList.class);
-
- private static final String LIST_HELP_MESSAGE = "realm --list";
-
- private final Input input;
-
- public RealmList(final Input input) {
- this.input = input;
- }
-
- public void list() {
- if (input.parameterNumber() == 0) {
- try {
- realmResultManager.printRealms(realmSyncopeOperations.list());
- } catch (final SyncopeClientException ex) {
- LOG.error("Error listing realm", ex);
- realmResultManager.genericError(ex.getMessage());
- }
- } else {
- realmResultManager.unnecessaryParameters(input.listParameters(), LIST_HELP_MESSAGE);
- }
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmResultManager.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmResultManager.java
deleted file mode 100644
index b207450..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmResultManager.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.realm;
-
-import java.util.List;
-import java.util.Map;
-import org.apache.syncope.client.cli.commands.CommonsResultManager;
-import org.apache.syncope.common.lib.to.RealmTO;
-
-public class RealmResultManager extends CommonsResultManager {
-
- public void printRealms(final List<RealmTO> realmTOs) {
- System.out.println("");
- realmTOs.forEach(realmTO -> {
- printRealm(realmTO);
- });
- }
-
- private void printRealm(final RealmTO realmTO) {
- System.out.println(" > REALM KEY: " + realmTO.getKey());
- System.out.println(" name: " + realmTO.getName());
- System.out.println(" full path: " + realmTO.getFullPath());
- System.out.println(" actions: " + realmTO.getActions());
- System.out.println(" templates: " + realmTO.getTemplates());
- System.out.println(" parent key: " + realmTO.getParent());
- System.out.println(" account policy key: " + realmTO.getAccountPolicy());
- System.out.println(" password policy key: " + realmTO.getPasswordPolicy());
- System.out.println("");
- }
-
- public void printDetails(final Map<String, String> details) {
- printDetails("realms details", details);
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmSyncopeOperations.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmSyncopeOperations.java
deleted file mode 100644
index 19af12f..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/realm/RealmSyncopeOperations.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.realm;
-
-import java.util.List;
-import org.apache.syncope.client.cli.SyncopeServices;
-import org.apache.syncope.common.lib.to.RealmTO;
-import org.apache.syncope.common.rest.api.service.RealmService;
-
-public class RealmSyncopeOperations {
-
- private final RealmService realmService = SyncopeServices.get(RealmService.class);
-
- public List<RealmTO> list() {
- return realmService.list();
- }
-
- public boolean exists(final String realm) {
- boolean exists = false;
- for (final RealmTO list : list()) {
- if (list.getName().equals(realm)) {
- exists = true;
- }
- }
- return exists;
- }
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/AbstractReportCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/AbstractReportCommand.java
deleted file mode 100644
index 38a7b2f..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/AbstractReportCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.report;
-
-public abstract class AbstractReportCommand {
-
- protected final ReportSyncopeOperations reportSyncopeOperations = new ReportSyncopeOperations();
-
- protected final ReportResultManager reportResultManager = new ReportResultManager();
-
-}
diff --git a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportCommand.java b/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportCommand.java
deleted file mode 100644
index 7612610..0000000
--- a/client/cli/src/main/java/org/apache/syncope/client/cli/commands/report/ReportCommand.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.client.cli.commands.report;
-
-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.commands.AbstractCommand;
-
-@Command(name = "report")
-public class ReportCommand extends AbstractCommand {
-
- private final ReportResultManager reportResultManager = new ReportResultManager();
-
- @Override
- public void execute(final Input input) {
- if (StringUtils.isBlank(input.getOption())) {
- input.setOption(ReportOptions.HELP.getOptionName());
- }
-
- switch (ReportOptions.fromName(input.getOption())) {
- case LIST:
- new ReportList(input).list();
- break;
- case DETAILS:
- new ReportDetails(input).details();
- break;
- case LIST_JOBS:
- new ReportListJobs(input).list();
- break;
- case READ:
- new ReportRead(input).read();
- break;
- case DELETE:
- new ReportDelete(input).delete();
- break;
- case EXECUTE:
- new ReportExecute(input).execute();
- break;
- case DELETE_EXECUTION:
- new ReportDeleteExecution(input).delete();
- break;
- case EXPORT_EXECUTION_RESULT:
- new ReportExportExecution(input).export();
- break;
- case HELP:
- System.out.println(getHelpMessage());
- break;
- default:
- reportResultManager.defaultOptionMessage(input.getOption(), getHelpMessage());
- }
- }
-
- @Override
- public String getHelpMessage() {
- return reportResultManager.commandHelpMessage(getClass());
- }
-
- public enum ReportOptions {
-
- HELP("--help"),
- DETAILS("--details"),
- LIST("--list"),
- LIST_JOBS("--list-jobs"),
- READ("--read"),
- DELETE("--delete"),
- EXECUTE("--execute"),
- DELETE_EXECUTION("--delete-execution"),
- EXPORT_EXECUTION_RESULT("--export-execution-result");
-
- private final String optionName;
-
- ReportOptions(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 ReportOptions fromName(final String name) {
- ReportOptions optionToReturn = HELP;
- for (final ReportOptions option : ReportOptions.values()) {
- if (option.equalsOptionName(name)) {
... 7763 lines suppressed ...