You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2015/02/12 10:14:55 UTC
[50/54] [abbrv] [partial] syncope git commit: [SYNCOPE-620] Renaming
'server' after 'core',
to provide continuity with older releases (especially for archetype)
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/archetype/pom.xml
----------------------------------------------------------------------
diff --git a/syncope620/archetype/pom.xml b/syncope620/archetype/pom.xml
index be93a6b..94e7e0d 100644
--- a/syncope620/archetype/pom.xml
+++ b/syncope620/archetype/pom.xml
@@ -124,66 +124,66 @@ under the License.
</resource>
<resource>
- <directory>../server/provisioning-java/src/main/resources</directory>
+ <directory>../core/provisioning-java/src/main/resources</directory>
<excludes>
<exclude>*Context.xml</exclude>
</excludes>
- <targetPath>${project.build.outputDirectory}/archetype-resources/server/src/main/resources</targetPath>
+ <targetPath>${project.build.outputDirectory}/archetype-resources/core/src/main/resources</targetPath>
</resource>
<resource>
- <directory>../server/persistence-jpa/src/main/resources</directory>
+ <directory>../core/persistence-jpa/src/main/resources</directory>
<excludes>
<exclude>*Context.xml</exclude>
<exclude>META-INF/spring-persistence.xml</exclude>
</excludes>
- <targetPath>${project.build.outputDirectory}/archetype-resources/server/src/main/resources</targetPath>
+ <targetPath>${project.build.outputDirectory}/archetype-resources/core/src/main/resources</targetPath>
</resource>
<resource>
- <directory>../server/persistence-jpa/src/test/resources</directory>
+ <directory>../core/persistence-jpa/src/test/resources</directory>
<includes>
<include>persistence.properties</include>
</includes>
- <targetPath>${project.build.outputDirectory}/archetype-resources/server/src/test/resources</targetPath>
+ <targetPath>${project.build.outputDirectory}/archetype-resources/core/src/test/resources</targetPath>
</resource>
<resource>
- <directory>../server/logic/src/main/resources</directory>
- <targetPath>${project.build.outputDirectory}/archetype-resources/server/src/main/resources</targetPath>
+ <directory>../core/logic/src/main/resources</directory>
+ <targetPath>${project.build.outputDirectory}/archetype-resources/core/src/main/resources</targetPath>
<excludes>
<exclude>*Context.xml</exclude>
</excludes>
</resource>
<resource>
- <directory>../server/misc/src/main/resources</directory>
+ <directory>../core/misc/src/main/resources</directory>
<includes>
<include>security.properties</include>
</includes>
- <targetPath>${project.build.outputDirectory}/archetype-resources/server/src/main/resources</targetPath>
+ <targetPath>${project.build.outputDirectory}/archetype-resources/core/src/main/resources</targetPath>
</resource>
<resource>
- <directory>../fit/server-reference/src/main/resources</directory>
- <targetPath>${project.build.outputDirectory}/archetype-resources/server/src/main/resources</targetPath>
+ <directory>../fit/core-reference/src/main/resources</directory>
+ <targetPath>${project.build.outputDirectory}/archetype-resources/core/src/main/resources</targetPath>
<includes>
- <include>serverContext.xml</include>
+ <include>coreContext.xml</include>
<include>log4j2.xml</include>
</includes>
</resource>
<resource>
- <directory>../fit/server-reference/src/main/resources/all</directory>
- <targetPath>${project.build.outputDirectory}/archetype-resources/server/src/main/resources</targetPath>
+ <directory>../fit/core-reference/src/main/resources/all</directory>
+ <targetPath>${project.build.outputDirectory}/archetype-resources/core/src/main/resources</targetPath>
<includes>
<include>workflow.properties</include>
</includes>
</resource>
<resource>
- <directory>../fit/server-reference/src/main/webapp</directory>
- <targetPath>${project.build.outputDirectory}/archetype-resources/server/src/test/resources</targetPath>
+ <directory>../fit/core-reference/src/main/webapp</directory>
+ <targetPath>${project.build.outputDirectory}/archetype-resources/core/src/test/resources</targetPath>
<includes>
<include>*.jsp</include>
</includes>
</resource>
<resource>
- <directory>../fit/server-reference/src/main/webapp/WEB-INF</directory>
- <targetPath>${project.build.outputDirectory}/archetype-resources/server/src/main/webapp/WEB-INF</targetPath>
+ <directory>../fit/core-reference/src/main/webapp/WEB-INF</directory>
+ <targetPath>${project.build.outputDirectory}/archetype-resources/core/src/main/webapp/WEB-INF</targetPath>
</resource>
<resource>
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
----------------------------------------------------------------------
diff --git a/syncope620/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml b/syncope620/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
index a23bb67..44f3cfb 100644
--- a/syncope620/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/syncope620/archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -26,7 +26,7 @@ under the License.
</requiredProperties>
<modules>
- <module id="server" dir="server" name="server">
+ <module id="core" dir="core" name="core">
<fileSets>
<fileSet filtered="false" encoding="UTF-8">
<directory>src/main/resources</directory>
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/archetype/src/main/resources/archetype-resources/console/pom.xml
----------------------------------------------------------------------
diff --git a/syncope620/archetype/src/main/resources/archetype-resources/console/pom.xml b/syncope620/archetype/src/main/resources/archetype-resources/console/pom.xml
index 82c79c1..0344a40 100644
--- a/syncope620/archetype/src/main/resources/archetype-resources/console/pom.xml
+++ b/syncope620/archetype/src/main/resources/archetype-resources/console/pom.xml
@@ -211,11 +211,11 @@ under the License.
<phase>package</phase>
<configuration>
<target>
- <copy file="../server/target/test-classes/persistence.properties"
- todir="../server/target/syncope/WEB-INF/classes"
+ <copy file="../core/target/test-classes/persistence.properties"
+ todir="../core/target/syncope/WEB-INF/classes"
overwrite="true"/>
- <copy file="../server/target/test-classes/db.jsp"
- todir="../server/target/syncope"
+ <copy file="../core/target/test-classes/db.jsp"
+ todir="../core/target/syncope"
overwrite="true"/>
<copy file="${project.build.directory}/test-classes/console.properties"
@@ -255,7 +255,7 @@ under the License.
</configuration>
<deployables>
<deployable>
- <location>../server/target/syncope</location>
+ <location>../core/target/syncope</location>
<properties>
<context>syncope</context>
</properties>
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/archetype/src/main/resources/archetype-resources/core/pom.xml
----------------------------------------------------------------------
diff --git a/syncope620/archetype/src/main/resources/archetype-resources/core/pom.xml b/syncope620/archetype/src/main/resources/archetype-resources/core/pom.xml
new file mode 100644
index 0000000..0dac78f
--- /dev/null
+++ b/syncope620/archetype/src/main/resources/archetype-resources/core/pom.xml
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>${groupId}</groupId>
+ <artifactId>${rootArtifactId}</artifactId>
+ <version>${version}</version>
+ </parent>
+
+ <name>Apache Syncope sample project - Core</name>
+ <groupId>${groupId}</groupId>
+ <artifactId>${artifactId}</artifactId>
+ <packaging>war</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>javax.servlet.jsp-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.syncope.core</groupId>
+ <artifactId>syncope-core-rest-cxf</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.syncope.core</groupId>
+ <artifactId>syncope-core-workflow-java</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.syncope.core</groupId>
+ <artifactId>syncope-core-persistence-jpa</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.syncope.core</groupId>
+ <artifactId>syncope-core-workflow-activiti</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-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>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>jquery</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>jquery-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.webjars</groupId>
+ <artifactId>highlightjs</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>syncope</finalName>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <failOnMissingWebXml>false</failOnMissingWebXml>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <inherited>true</inherited>
+ <executions>
+ <execution>
+ <id>set-bundles</id>
+ <phase>process-test-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/archetype/src/main/resources/archetype-resources/pom.xml
----------------------------------------------------------------------
diff --git a/syncope620/archetype/src/main/resources/archetype-resources/pom.xml b/syncope620/archetype/src/main/resources/archetype-resources/pom.xml
index e08edd2..6b2029c 100644
--- a/syncope620/archetype/src/main/resources/archetype-resources/pom.xml
+++ b/syncope620/archetype/src/main/resources/archetype-resources/pom.xml
@@ -40,24 +40,24 @@ under the License.
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.apache.syncope.server</groupId>
- <artifactId>syncope-server-rest-cxf</artifactId>
+ <groupId>org.apache.syncope.core</groupId>
+ <artifactId>syncope-core-rest-cxf</artifactId>
<version>${syncope.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.syncope.server</groupId>
- <artifactId>syncope-server-workflow-java</artifactId>
+ <groupId>org.apache.syncope.core</groupId>
+ <artifactId>syncope-core-workflow-java</artifactId>
<version>${syncope.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.syncope.server</groupId>
- <artifactId>syncope-server-persistence-jpa</artifactId>
+ <groupId>org.apache.syncope.core</groupId>
+ <artifactId>syncope-core-persistence-jpa</artifactId>
<version>${syncope.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.syncope.server</groupId>
- <artifactId>syncope-server-workflow-activiti</artifactId>
+ <groupId>org.apache.syncope.core</groupId>
+ <artifactId>syncope-core-workflow-activiti</artifactId>
<version>${syncope.version}</version>
</dependency>
@@ -103,7 +103,7 @@ under the License.
</build>
<modules>
- <module>server</module>
+ <module>core</module>
<module>console</module>
</modules>
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/archetype/src/main/resources/archetype-resources/server/pom.xml
----------------------------------------------------------------------
diff --git a/syncope620/archetype/src/main/resources/archetype-resources/server/pom.xml b/syncope620/archetype/src/main/resources/archetype-resources/server/pom.xml
deleted file mode 100644
index 8acc6c4..0000000
--- a/syncope620/archetype/src/main/resources/archetype-resources/server/pom.xml
+++ /dev/null
@@ -1,155 +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/xsd/maven-4.0.0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>${groupId}</groupId>
- <artifactId>${rootArtifactId}</artifactId>
- <version>${version}</version>
- </parent>
-
- <name>Apache Syncope sample project - Server</name>
- <groupId>${groupId}</groupId>
- <artifactId>${artifactId}</artifactId>
- <packaging>war</packaging>
-
- <dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet.jsp</groupId>
- <artifactId>javax.servlet.jsp-api</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>jstl</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.syncope.server</groupId>
- <artifactId>syncope-server-rest-cxf</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.syncope.server</groupId>
- <artifactId>syncope-server-workflow-java</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.syncope.server</groupId>
- <artifactId>syncope-server-persistence-jpa</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.syncope.server</groupId>
- <artifactId>syncope-server-workflow-activiti</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-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>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.webjars</groupId>
- <artifactId>jquery</artifactId>
- </dependency>
- <dependency>
- <groupId>org.webjars</groupId>
- <artifactId>jquery-ui</artifactId>
- </dependency>
- <dependency>
- <groupId>org.webjars</groupId>
- <artifactId>highlightjs</artifactId>
- </dependency>
- </dependencies>
-
- <build>
- <finalName>syncope</finalName>
-
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <inherited>true</inherited>
- <configuration>
- <failOnMissingWebXml>false</failOnMissingWebXml>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <inherited>true</inherited>
- <executions>
- <execution>
- <id>set-bundles</id>
- <phase>process-test-resources</phase>
- <goals>
- <goal>copy</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
-
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- </resource>
- </resources>
-
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- <filtering>true</filtering>
- </testResource>
- </testResources>
- </build>
-
-</project>
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/archetype/src/main/resources/meta-pom.xml
----------------------------------------------------------------------
diff --git a/syncope620/archetype/src/main/resources/meta-pom.xml b/syncope620/archetype/src/main/resources/meta-pom.xml
index bb26a01..4ce00b3 100644
--- a/syncope620/archetype/src/main/resources/meta-pom.xml
+++ b/syncope620/archetype/src/main/resources/meta-pom.xml
@@ -44,24 +44,24 @@ under the License.
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.apache.syncope.server</groupId>
- <artifactId>syncope-server-rest-cxf</artifactId>
+ <groupId>org.apache.syncope.core</groupId>
+ <artifactId>syncope-core-rest-cxf</artifactId>
<version>${syncope.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.syncope.server</groupId>
- <artifactId>syncope-server-workflow-java</artifactId>
+ <groupId>org.apache.syncope.core</groupId>
+ <artifactId>syncope-core-workflow-java</artifactId>
<version>${syncope.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.syncope.server</groupId>
- <artifactId>syncope-server-persistence-jpa</artifactId>
+ <groupId>org.apache.syncope.core</groupId>
+ <artifactId>syncope-core-persistence-jpa</artifactId>
<version>${syncope.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.syncope.server</groupId>
- <artifactId>syncope-server-workflow-activiti</artifactId>
+ <groupId>org.apache.syncope.core</groupId>
+ <artifactId>syncope-core-workflow-activiti</artifactId>
<version>${syncope.version}</version>
</dependency>
@@ -107,7 +107,7 @@ under the License.
</build>
<modules>
- <module>server</module>
+ <module>core</module>
<module>console</module>
</modules>
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
----------------------------------------------------------------------
diff --git a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
index 1150e60..5a92daa 100644
--- a/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
+++ b/syncope620/common/lib/src/main/java/org/apache/syncope/common/lib/types/EntityViolationType.java
@@ -24,38 +24,38 @@ import javax.xml.bind.annotation.XmlEnum;
public enum EntityViolationType {
Standard(""),
- InvalidAccountPolicy("org.apache.syncope.server.persistence.validation.accountpolicy"),
- InvalidConnInstanceLocation("org.apache.syncope.server.persistence.validation.conninstance.location"),
- InvalidConnPoolConf("org.apache.syncope.server.persistence.validation.conninstance.poolConf"),
- InvalidCPlainSchema("org.apache.syncope.server.persistence.validation.attrvalue.cPlainSchema"),
- InvalidMapping("org.apache.syncope.server.persistence.validation.mapping"),
- InvalidMPlainSchema("org.apache.syncope.server.persistence.validation.attrvalue.mPlainSchema"),
- InvalidMDerSchema("org.apache.syncope.server.persistence.validation.attrvalue.mDerSchema"),
- InvalidMVirSchema("org.apache.syncope.server.persistence.validation.attrvalue.mVirSchema"),
- InvalidName("org.apache.syncope.server.persistence.validation.name"),
- InvalidNotification("org.apache.syncope.server.persistence.validation.notification"),
- InvalidPassword("org.apache.syncope.server.persistence.validation.user.password"),
- InvalidPasswordPolicy("org.apache.syncope.server.persistence.validation.passwordpolicy"),
- InvalidPolicy("org.apache.syncope.server.persistence.validation.policy"),
- InvalidPropagationTask("org.apache.syncope.server.persistence.validation.propagationtask"),
- InvalidRPlainSchema("org.apache.syncope.server.persistence.validation.attrvalue.rPlainSchema"),
- InvalidRDerSchema("org.apache.syncope.server.persistence.validation.attrvalue.rDerSchema"),
- InvalidRVirSchema("org.apache.syncope.server.persistence.validation.attrvalue.rVirSchema"),
- InvalidReport("org.apache.syncope.server.persistence.validation.report"),
- InvalidResource("org.apache.syncope.server.persistence.validation.externalresource"),
- InvalidRoleOwner("org.apache.syncope.server.persistence.validation.role.owner"),
- InvalidSchemaEncrypted("org.apache.syncope.server.persistence.validation.schema.encrypted"),
- InvalidSchemaEnum("org.apache.syncope.server.persistence.validation.schema.enum"),
- InvalidSchemaMultivalueUnique("org.apache.syncope.server.persistence.validation.schema.multivalueUnique"),
- InvalidSchedTask("org.apache.syncope.server.persistence.validation.schedtask"),
- InvalidSyncTask("org.apache.syncope.server.persistence.validation.synctask"),
- InvalidSyncPolicy("org.apache.syncope.server.persistence.validation.syncpolicy"),
- InvalidUPlainSchema("org.apache.syncope.server.persistence.validation.attrvalue.uPlainSchema"),
- InvalidUDerSchema("org.apache.syncope.server.persistence.validation.attrvalue.derSchema"),
- InvalidUVirSchema("org.apache.syncope.server.persistence.validation.attrvalue.uVirSchema"),
- InvalidUsername("org.apache.syncope.server.persistence.validation.user.username"),
- InvalidValueList("org.apache.syncope.server.persistence.validation.attr.valueList"),
- MoreThanOneNonNull("org.apache.syncope.server.persistence.validation.attrvalue.moreThanOneNonNull");
+ InvalidAccountPolicy("org.apache.syncope.core.persistence.validation.accountpolicy"),
+ InvalidConnInstanceLocation("org.apache.syncope.core.persistence.validation.conninstance.location"),
+ InvalidConnPoolConf("org.apache.syncope.core.persistence.validation.conninstance.poolConf"),
+ InvalidCPlainSchema("org.apache.syncope.core.persistence.validation.attrvalue.cPlainSchema"),
+ InvalidMapping("org.apache.syncope.core.persistence.validation.mapping"),
+ InvalidMPlainSchema("org.apache.syncope.core.persistence.validation.attrvalue.mPlainSchema"),
+ InvalidMDerSchema("org.apache.syncope.core.persistence.validation.attrvalue.mDerSchema"),
+ InvalidMVirSchema("org.apache.syncope.core.persistence.validation.attrvalue.mVirSchema"),
+ InvalidName("org.apache.syncope.core.persistence.validation.name"),
+ InvalidNotification("org.apache.syncope.core.persistence.validation.notification"),
+ InvalidPassword("org.apache.syncope.core.persistence.validation.user.password"),
+ InvalidPasswordPolicy("org.apache.syncope.core.persistence.validation.passwordpolicy"),
+ InvalidPolicy("org.apache.syncope.core.persistence.validation.policy"),
+ InvalidPropagationTask("org.apache.syncope.core.persistence.validation.propagationtask"),
+ InvalidRPlainSchema("org.apache.syncope.core.persistence.validation.attrvalue.rPlainSchema"),
+ InvalidRDerSchema("org.apache.syncope.core.persistence.validation.attrvalue.rDerSchema"),
+ InvalidRVirSchema("org.apache.syncope.core.persistence.validation.attrvalue.rVirSchema"),
+ InvalidReport("org.apache.syncope.core.persistence.validation.report"),
+ InvalidResource("org.apache.syncope.core.persistence.validation.externalresource"),
+ InvalidRoleOwner("org.apache.syncope.core.persistence.validation.role.owner"),
+ InvalidSchemaEncrypted("org.apache.syncope.core.persistence.validation.schema.encrypted"),
+ InvalidSchemaEnum("org.apache.syncope.core.persistence.validation.schema.enum"),
+ InvalidSchemaMultivalueUnique("org.apache.syncope.core.persistence.validation.schema.multivalueUnique"),
+ InvalidSchedTask("org.apache.syncope.core.persistence.validation.schedtask"),
+ InvalidSyncTask("org.apache.syncope.core.persistence.validation.synctask"),
+ InvalidSyncPolicy("org.apache.syncope.core.persistence.validation.syncpolicy"),
+ InvalidUPlainSchema("org.apache.syncope.core.persistence.validation.attrvalue.uPlainSchema"),
+ InvalidUDerSchema("org.apache.syncope.core.persistence.validation.attrvalue.derSchema"),
+ InvalidUVirSchema("org.apache.syncope.core.persistence.validation.attrvalue.uVirSchema"),
+ InvalidUsername("org.apache.syncope.core.persistence.validation.user.username"),
+ InvalidValueList("org.apache.syncope.core.persistence.validation.attr.valueList"),
+ MoreThanOneNonNull("org.apache.syncope.core.persistence.validation.attrvalue.moreThanOneNonNull");
private String message;
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/common/rest-api/pom.xml
----------------------------------------------------------------------
diff --git a/syncope620/common/rest-api/pom.xml b/syncope620/common/rest-api/pom.xml
index addc3b9..f4409c5 100644
--- a/syncope620/common/rest-api/pom.xml
+++ b/syncope620/common/rest-api/pom.xml
@@ -69,7 +69,7 @@ under the License.
<build>
<plugins>
- <!-- Generating javadoc JAR artifact for usage with CXF's WADL generator (for server) -->
+ <!-- Generating javadoc JAR artifact for usage with CXF's WADL generator (for core) -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/pom.xml
----------------------------------------------------------------------
diff --git a/syncope620/core/logic/pom.xml b/syncope620/core/logic/pom.xml
new file mode 100644
index 0000000..6a9aaa3
--- /dev/null
+++ b/syncope620/core/logic/pom.xml
@@ -0,0 +1,181 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.syncope</groupId>
+ <artifactId>syncope-core</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </parent>
+
+ <name>Apache Syncope Core Logic</name>
+ <description>Apache Syncope Core Logic</description>
+ <groupId>org.apache.syncope.core</groupId>
+ <artifactId>syncope-core-logic</artifactId>
+ <packaging>jar</packaging>
+
+ <properties>
+ <rootpom.basedir>${basedir}/../..</rootpom.basedir>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-dbcp2</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jdbc</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjweaver</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.cocoon.sax</groupId>
+ <artifactId>cocoon-sax</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cocoon.optional</groupId>
+ <artifactId>cocoon-optional</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.xmlgraphics</groupId>
+ <artifactId>fop</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.avalon.framework</groupId>
+ <artifactId>avalon-framework-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.avalon.framework</groupId>
+ <artifactId>avalon-framework-impl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.syncope.core</groupId>
+ <artifactId>syncope-core-provisioning-java</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- TEST -->
+ <dependency>
+ <groupId>com.icegreen</groupId>
+ <artifactId>greenmail</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.syncope.core</groupId>
+ <artifactId>syncope-core-workflow-java</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>javax.el-api</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>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}/src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>${basedir}/src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ <testResource>
+ <directory>${basedir}/../persistence-jpa/src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractLogic.java b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractLogic.java
new file mode 100644
index 0000000..35e806a
--- /dev/null
+++ b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractLogic.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.logic;
+
+import java.lang.reflect.Method;
+import org.apache.syncope.common.lib.AbstractBaseBean;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Superclass for all controllers.
+ *
+ * @param <T> transfer object used for input / output
+ */
+abstract class AbstractLogic<T extends AbstractBaseBean> {
+
+ /**
+ * Logger.
+ */
+ protected static final Logger LOG = LoggerFactory.getLogger(AbstractLogic.class);
+
+ /**
+ * Resolves stored bean (if existing) referred by the given CUD method.
+ * <br />
+ * Read-only methods will be unresolved for performance reasons.
+ *
+ * @param method method.
+ * @param args method arguments.
+ * @return referred stored bean.
+ * @throws UnresolvedReferenceException in case of failures, read-only methods and unresolved bean.
+ */
+ public T resolveBeanReference(final Method method, final Object... args) throws UnresolvedReferenceException {
+ final Transactional transactional = method.getAnnotation(Transactional.class);
+ if (transactional != null && transactional.readOnly()) {
+ throw new UnresolvedReferenceException();
+ }
+ return resolveReference(method, args);
+ }
+
+ protected abstract T resolveReference(Method method, Object... args) throws UnresolvedReferenceException;
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractResourceAssociator.java
----------------------------------------------------------------------
diff --git a/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractResourceAssociator.java b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractResourceAssociator.java
new file mode 100644
index 0000000..3d3b393
--- /dev/null
+++ b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractResourceAssociator.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.logic;
+
+import java.util.Collection;
+import org.apache.syncope.common.lib.to.AbstractAttributableTO;
+
+public abstract class AbstractResourceAssociator<T extends AbstractAttributableTO> extends AbstractLogic<T> {
+
+ public abstract T unlink(Long id, Collection<String> resources);
+
+ public abstract T link(Long id, Collection<String> resources);
+
+ public abstract T unassign(Long id, Collection<String> resources);
+
+ public abstract T assign(Long id, Collection<String> resources, boolean changepwd, String password);
+
+ public abstract T deprovision(Long userId, Collection<String> resources);
+
+ public abstract T provision(Long userId, Collection<String> resources, boolean changepwd, String password);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractSubjectLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractSubjectLogic.java b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractSubjectLogic.java
new file mode 100644
index 0000000..a1a94b4
--- /dev/null
+++ b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractSubjectLogic.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.logic;
+
+import java.util.List;
+import org.apache.syncope.common.lib.mod.AbstractSubjectMod;
+import org.apache.syncope.common.lib.to.AbstractSubjectTO;
+import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
+import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
+
+public abstract class AbstractSubjectLogic<T extends AbstractSubjectTO, V extends AbstractSubjectMod>
+ extends AbstractResourceAssociator<T> {
+
+ public abstract T read(Long key);
+
+ public abstract int count();
+
+ public abstract T update(V attributableMod);
+
+ public abstract T delete(Long key);
+
+ public abstract List<T> list(int page, int size, List<OrderByClause> orderBy);
+
+ public abstract List<T> search(SearchCond searchCondition, int page, int size, List<OrderByClause> orderBy);
+
+ public abstract int searchCount(SearchCond searchCondition);
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractTransactionalLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractTransactionalLogic.java b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractTransactionalLogic.java
new file mode 100644
index 0000000..08f2069
--- /dev/null
+++ b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/AbstractTransactionalLogic.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.logic;
+
+import org.apache.syncope.common.lib.AbstractBaseBean;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Adds Spring's transactional support to {@link AbstractLogic}.
+ *
+ * @param <T> transfer object used for input / output
+ */
+@Transactional(rollbackFor = { Throwable.class })
+abstract class AbstractTransactionalLogic<T extends AbstractBaseBean> extends AbstractLogic<T> {
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java
new file mode 100644
index 0000000..9874e4d
--- /dev/null
+++ b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/ConfigurationLogic.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.logic;
+
+import java.io.OutputStream;
+import java.lang.reflect.Method;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.ConfTO;
+import org.apache.syncope.core.persistence.api.content.ContentExporter;
+import org.apache.syncope.core.persistence.api.dao.ConfDAO;
+import org.apache.syncope.core.persistence.api.dao.NotFoundException;
+import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
+import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttr;
+import org.apache.syncope.core.persistence.api.entity.conf.CPlainSchema;
+import org.apache.syncope.core.provisioning.api.data.ConfigurationDataBinder;
+import org.apache.syncope.core.workflow.api.RoleWorkflowAdapter;
+import org.apache.syncope.core.workflow.api.UserWorkflowAdapter;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+@Component
+public class ConfigurationLogic extends AbstractTransactionalLogic<ConfTO> {
+
+ @Autowired
+ private ConfDAO confDAO;
+
+ @Autowired
+ private PlainSchemaDAO plainSchemaDAO;
+
+ @Autowired
+ private ConfigurationDataBinder binder;
+
+ @Autowired
+ private ContentExporter exporter;
+
+ @Autowired
+ private UserWorkflowAdapter uwfAdapter;
+
+ @Autowired
+ private RoleWorkflowAdapter rwfAdapter;
+
+ @PreAuthorize("hasRole('CONFIGURATION_DELETE')")
+ public void delete(final String key) {
+ confDAO.delete(key);
+ }
+
+ @PreAuthorize("hasRole('CONFIGURATION_LIST')")
+ public ConfTO list() {
+ return binder.getConfTO(confDAO.get());
+ }
+
+ @PreAuthorize("isAuthenticated()")
+ public AttrTO read(final String key) {
+ AttrTO result;
+
+ CPlainAttr conf = confDAO.find(key);
+ if (conf == null) {
+ CPlainSchema schema = plainSchemaDAO.find(key, CPlainSchema.class);
+ if (schema == null) {
+ throw new NotFoundException("Configuration key " + key);
+ }
+
+ result = new AttrTO();
+ result.setSchema(key);
+ } else {
+ result = binder.getAttrTO(conf);
+ }
+
+ return result;
+ }
+
+ @PreAuthorize("hasRole('CONFIGURATION_SET')")
+ public void set(final AttrTO value) {
+ confDAO.save(binder.getAttribute(value));
+ }
+
+ @PreAuthorize("hasRole('CONFIGURATION_EXPORT')")
+ @Transactional(readOnly = true)
+ public void export(final OutputStream os) {
+ try {
+ exporter.export(os, uwfAdapter.getPrefix(), rwfAdapter.getPrefix());
+ LOG.debug("Database content successfully exported");
+ } catch (Exception e) {
+ LOG.error("While exporting database content", e);
+ }
+ }
+
+ @Override
+ protected ConfTO resolveReference(final Method method, final Object... args)
+ throws UnresolvedReferenceException {
+
+ throw new UnresolvedReferenceException();
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
new file mode 100644
index 0000000..f5a707f
--- /dev/null
+++ b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/ConnectorLogic.java
@@ -0,0 +1,341 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.logic;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.to.BulkAction;
+import org.apache.syncope.common.lib.to.BulkActionResult;
+import org.apache.syncope.common.lib.to.ConnBundleTO;
+import org.apache.syncope.common.lib.to.ConnInstanceTO;
+import org.apache.syncope.common.lib.types.ClientExceptionType;
+import org.apache.syncope.common.lib.types.ConnConfProperty;
+import org.apache.syncope.core.persistence.api.dao.ConnInstanceDAO;
+import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
+import org.apache.syncope.core.persistence.api.dao.NotFoundException;
+import org.apache.syncope.core.persistence.api.entity.ConnInstance;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+import org.apache.syncope.core.provisioning.api.ConnIdBundleManager;
+import org.apache.syncope.core.provisioning.api.Connector;
+import org.apache.syncope.core.provisioning.api.ConnectorFactory;
+import org.apache.syncope.core.provisioning.api.data.ConnInstanceDataBinder;
+import org.identityconnectors.common.l10n.CurrentLocale;
+import org.identityconnectors.framework.api.ConfigurationProperties;
+import org.identityconnectors.framework.api.ConnectorInfo;
+import org.identityconnectors.framework.api.ConnectorKey;
+import org.identityconnectors.framework.common.objects.ObjectClass;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+
+@Component
+public class ConnectorLogic extends AbstractTransactionalLogic<ConnInstanceTO> {
+
+ @Autowired
+ private ConnIdBundleManager connIdBundleManager;
+
+ @Autowired
+ private ExternalResourceDAO resourceDAO;
+
+ @Autowired
+ private ConnInstanceDAO connInstanceDAO;
+
+ @Autowired
+ private ConnInstanceDataBinder binder;
+
+ @Autowired
+ private ConnectorFactory connFactory;
+
+ @PreAuthorize("hasRole('CONNECTOR_CREATE')")
+ public ConnInstanceTO create(final ConnInstanceTO connInstanceTO) {
+ ConnInstance connInstance = binder.getConnInstance(connInstanceTO);
+ try {
+ connInstance = connInstanceDAO.save(connInstance);
+ } catch (SyncopeClientException e) {
+ throw e;
+ } catch (Exception e) {
+ SyncopeClientException ex = SyncopeClientException.build(ClientExceptionType.InvalidConnInstance);
+ ex.getElements().add(e.getMessage());
+ throw ex;
+ }
+
+ return binder.getConnInstanceTO(connInstance);
+ }
+
+ @PreAuthorize("hasRole('CONNECTOR_UPDATE')")
+ public ConnInstanceTO update(final ConnInstanceTO connInstanceTO) {
+ ConnInstance connInstance = binder.updateConnInstance(connInstanceTO.getKey(), connInstanceTO);
+ try {
+ connInstance = connInstanceDAO.save(connInstance);
+ } catch (SyncopeClientException e) {
+ throw e;
+ } catch (Exception e) {
+ SyncopeClientException ex = SyncopeClientException.build(ClientExceptionType.InvalidConnInstance);
+ ex.getElements().add(e.getMessage());
+ throw ex;
+ }
+
+ return binder.getConnInstanceTO(connInstance);
+ }
+
+ @PreAuthorize("hasRole('CONNECTOR_DELETE')")
+ public ConnInstanceTO delete(final Long connInstanceId) {
+ ConnInstance connInstance = connInstanceDAO.find(connInstanceId);
+ if (connInstance == null) {
+ throw new NotFoundException("Connector '" + connInstanceId + "'");
+ }
+
+ if (!connInstance.getResources().isEmpty()) {
+ SyncopeClientException associatedResources = SyncopeClientException.build(
+ ClientExceptionType.AssociatedResources);
+ for (ExternalResource resource : connInstance.getResources()) {
+ associatedResources.getElements().add(resource.getKey());
+ }
+ throw associatedResources;
+ }
+
+ ConnInstanceTO connToDelete = binder.getConnInstanceTO(connInstance);
+
+ connInstanceDAO.delete(connInstanceId);
+
+ return connToDelete;
+ }
+
+ @PreAuthorize("hasRole('CONNECTOR_LIST')")
+ @Transactional(readOnly = true)
+ public List<ConnInstanceTO> list(final String lang) {
+ if (StringUtils.isBlank(lang)) {
+ CurrentLocale.set(Locale.ENGLISH);
+ } else {
+ CurrentLocale.set(new Locale(lang));
+ }
+
+ List<ConnInstance> connInstances = connInstanceDAO.findAll();
+
+ final List<ConnInstanceTO> connInstanceTOs = new ArrayList<>();
+
+ for (ConnInstance connector : connInstances) {
+ try {
+ connInstanceTOs.add(binder.getConnInstanceTO(connector));
+ } catch (NotFoundException e) {
+ LOG.error("Connector '{}#{}' not found", connector.getBundleName(), connector.getVersion());
+ }
+ }
+
+ return connInstanceTOs;
+ }
+
+ @PreAuthorize("hasRole('CONNECTOR_READ')")
+ @Transactional(readOnly = true)
+ public ConnInstanceTO read(final Long connInstanceId) {
+ ConnInstance connInstance = connInstanceDAO.find(connInstanceId);
+ if (connInstance == null) {
+ throw new NotFoundException("Connector '" + connInstanceId + "'");
+ }
+
+ return binder.getConnInstanceTO(connInstance);
+ }
+
+ @PreAuthorize("hasRole('CONNECTOR_READ')")
+ @Transactional(readOnly = true)
+ public List<ConnBundleTO> getBundles(final String lang) {
+ if (StringUtils.isBlank(lang)) {
+ CurrentLocale.set(Locale.ENGLISH);
+ } else {
+ CurrentLocale.set(new Locale(lang));
+ }
+
+ List<ConnBundleTO> connectorBundleTOs = new ArrayList<>();
+ for (Map.Entry<String, List<ConnectorInfo>> entry : connIdBundleManager.getConnectorInfos().entrySet()) {
+ for (ConnectorInfo bundle : entry.getValue()) {
+ ConnBundleTO connBundleTO = new ConnBundleTO();
+ connBundleTO.setDisplayName(bundle.getConnectorDisplayName());
+
+ connBundleTO.setLocation(entry.getKey());
+
+ ConnectorKey key = bundle.getConnectorKey();
+ connBundleTO.setBundleName(key.getBundleName());
+ connBundleTO.setConnectorName(key.getConnectorName());
+ connBundleTO.setVersion(key.getBundleVersion());
+
+ ConfigurationProperties properties = connIdBundleManager.getConfigurationProperties(bundle);
+
+ for (String propName : properties.getPropertyNames()) {
+ connBundleTO.getProperties().add(binder.buildConnConfPropSchema(properties.getProperty(propName)));
+ }
+
+ LOG.debug("Connector bundle: {}", connBundleTO);
+
+ connectorBundleTOs.add(connBundleTO);
+ }
+ }
+
+ return connectorBundleTOs;
+ }
+
+ @PreAuthorize("hasRole('CONNECTOR_READ')")
+ @Transactional(readOnly = true)
+ public List<String> getSchemaNames(final ConnInstanceTO connInstanceTO, final boolean includeSpecial) {
+ final ConnInstance connInstance = connInstanceDAO.find(connInstanceTO.getKey());
+ if (connInstance == null) {
+ throw new NotFoundException("Connector '" + connInstanceTO.getKey() + "'");
+ }
+
+ // consider the possibility to receive overridden properties only
+ final Set<ConnConfProperty> conf = binder.mergeConnConfProperties(connInstanceTO.getConfiguration(),
+ connInstance.getConfiguration());
+
+ // We cannot use Spring bean because this method could be used during resource definition or modification:
+ // bean couldn't exist or couldn't be updated.
+ // This is the reason why we should take a "not mature" connector facade proxy to ask for schema names.
+ final List<String> result = new ArrayList<>(connFactory.createConnector(connInstance, conf).
+ getSchemaNames(includeSpecial));
+
+ return result;
+ }
+
+ @PreAuthorize("hasRole('CONNECTOR_READ')")
+ @Transactional(readOnly = true)
+ public List<String> getSupportedObjectClasses(final ConnInstanceTO connInstanceTO) {
+ final ConnInstance connInstance = connInstanceDAO.find(connInstanceTO.getKey());
+ if (connInstance == null) {
+ throw new NotFoundException("Connector '" + connInstanceTO.getKey() + "'");
+ }
+
+ // consider the possibility to receive overridden properties only
+ final Set<ConnConfProperty> conf = binder.mergeConnConfProperties(connInstanceTO.getConfiguration(),
+ connInstance.getConfiguration());
+
+ // We cannot use Spring bean because this method could be used during resource definition or modification:
+ // bean couldn't exist or couldn't be updated.
+ // This is the reason why we should take a "not mature" connector facade proxy to ask for object classes.
+ Set<ObjectClass> objectClasses = connFactory.createConnector(connInstance, conf).getSupportedObjectClasses();
+
+ List<String> result = new ArrayList<>(objectClasses.size());
+ for (ObjectClass objectClass : objectClasses) {
+ result.add(objectClass.getObjectClassValue());
+ }
+
+ return result;
+ }
+
+ @PreAuthorize("hasRole('CONNECTOR_READ')")
+ @Transactional(readOnly = true)
+ public List<ConnConfProperty> getConfigurationProperties(final Long connInstanceId) {
+
+ final ConnInstance connInstance = connInstanceDAO.find(connInstanceId);
+ if (connInstance == null) {
+ throw new NotFoundException("Connector '" + connInstanceId + "'");
+ }
+
+ return new ArrayList<ConnConfProperty>(connInstance.getConfiguration());
+ }
+
+ @PreAuthorize("hasRole('CONNECTOR_READ')")
+ @Transactional(readOnly = true)
+ public boolean check(final ConnInstanceTO connInstanceTO) {
+ final Connector connector = connFactory.createConnector(
+ binder.getConnInstance(connInstanceTO), connInstanceTO.getConfiguration());
+
+ boolean result;
+ try {
+ connector.test();
+ result = true;
+ } catch (Exception ex) {
+ LOG.error("Test connection failure {}", ex);
+ result = false;
+ }
+
+ return result;
+ }
+
+ @PreAuthorize("hasRole('CONNECTOR_READ')")
+ @Transactional(readOnly = true)
+ public ConnInstanceTO readByResource(final String resourceName) {
+ ExternalResource resource = resourceDAO.find(resourceName);
+ if (resource == null) {
+ throw new NotFoundException("Resource '" + resourceName + "'");
+ }
+ return binder.getConnInstanceTO(connFactory.getConnector(resource).getActiveConnInstance());
+ }
+
+ @PreAuthorize("hasRole('CONNECTOR_RELOAD')")
+ @Transactional(readOnly = true)
+ public void reload() {
+ connFactory.unload();
+ connFactory.load();
+ }
+
+ @PreAuthorize("hasRole('CONNECTOR_DELETE') and #bulkAction.operation == #bulkAction.operation.DELETE")
+ public BulkActionResult bulk(final BulkAction bulkAction) {
+ BulkActionResult res = new BulkActionResult();
+
+ if (bulkAction.getOperation() == BulkAction.Type.DELETE) {
+ for (String id : bulkAction.getTargets()) {
+ try {
+ res.add(delete(Long.valueOf(id)).getKey(), BulkActionResult.Status.SUCCESS);
+ } catch (Exception e) {
+ LOG.error("Error performing delete for connector {}", id, e);
+ res.add(id, BulkActionResult.Status.FAILURE);
+ }
+ }
+ }
+
+ return res;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected ConnInstanceTO resolveReference(final Method method, final Object... args)
+ throws UnresolvedReferenceException {
+
+ Long id = null;
+
+ if (ArrayUtils.isNotEmpty(args)) {
+ for (int i = 0; id == null && i < args.length; i++) {
+ if (args[i] instanceof Long) {
+ id = (Long) args[i];
+ } else if (args[i] instanceof ConnInstanceTO) {
+ id = ((ConnInstanceTO) args[i]).getKey();
+ }
+ }
+ }
+
+ if ((id != null) && !id.equals(0l)) {
+ try {
+ return binder.getConnInstanceTO(connInstanceDAO.find(id));
+ } catch (Throwable ignore) {
+ LOG.debug("Unresolved reference", ignore);
+ throw new UnresolvedReferenceException(ignore);
+ }
+ }
+
+ throw new UnresolvedReferenceException();
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/EntitlementLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/EntitlementLogic.java b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/EntitlementLogic.java
new file mode 100644
index 0000000..312ed19
--- /dev/null
+++ b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/EntitlementLogic.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.logic;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import org.apache.syncope.common.lib.wrap.EntitlementTO;
+import org.apache.syncope.core.persistence.api.dao.EntitlementDAO;
+import org.apache.syncope.core.persistence.api.entity.Entitlement;
+import org.apache.syncope.core.misc.security.AuthContextUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class EntitlementLogic extends AbstractTransactionalLogic<EntitlementTO> {
+
+ @Autowired
+ private EntitlementDAO entitlementDAO;
+
+ public List<String> getAll() {
+ List<Entitlement> entitlements = entitlementDAO.findAll();
+ List<String> result = new ArrayList<>(entitlements.size());
+ for (Entitlement entitlement : entitlements) {
+ result.add(entitlement.getKey());
+ }
+
+ return result;
+ }
+
+ public Set<String> getOwn() {
+ return AuthContextUtil.getOwnedEntitlementNames();
+ }
+
+ @Override
+ protected EntitlementTO resolveReference(final Method method, final Object... args)
+ throws UnresolvedReferenceException {
+
+ throw new UnresolvedReferenceException();
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
----------------------------------------------------------------------
diff --git a/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
new file mode 100644
index 0000000..f1efdea
--- /dev/null
+++ b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/LoggerLogic.java
@@ -0,0 +1,307 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.logic;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.config.LoggerConfig;
+import org.apache.syncope.common.lib.SyncopeClientException;
+import org.apache.syncope.common.lib.SyncopeConstants;
+import org.apache.syncope.common.lib.to.EventCategoryTO;
+import org.apache.syncope.common.lib.to.LoggerTO;
+import org.apache.syncope.common.lib.types.AttributableType;
+import org.apache.syncope.common.lib.types.AuditElements.EventCategoryType;
+import org.apache.syncope.common.lib.types.AuditLoggerName;
+import org.apache.syncope.common.lib.types.ClientExceptionType;
+import org.apache.syncope.common.lib.types.LoggerLevel;
+import org.apache.syncope.common.lib.types.LoggerType;
+import org.apache.syncope.common.lib.types.ResourceOperation;
+import org.apache.syncope.common.lib.types.TaskType;
+import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
+import org.apache.syncope.core.persistence.api.dao.LoggerDAO;
+import org.apache.syncope.core.persistence.api.dao.NotFoundException;
+import org.apache.syncope.core.persistence.api.dao.TaskDAO;
+import org.apache.syncope.core.persistence.api.entity.EntityFactory;
+import org.apache.syncope.core.persistence.api.entity.ExternalResource;
+import org.apache.syncope.core.persistence.api.entity.Logger;
+import org.apache.syncope.core.persistence.api.entity.task.SchedTask;
+import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
+import org.apache.syncope.core.misc.spring.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
+import org.springframework.core.type.classreading.MetadataReader;
+import org.springframework.core.type.classreading.MetadataReaderFactory;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.ClassUtils;
+import org.springframework.util.SystemPropertyUtils;
+
+@Component
+public class LoggerLogic extends AbstractTransactionalLogic<LoggerTO> {
+
+ @Autowired
+ private LoggerDAO loggerDAO;
+
+ @Autowired
+ private ExternalResourceDAO resourceDAO;
+
+ @Autowired
+ private TaskDAO taskDAO;
+
+ @Autowired
+ private EntityFactory entityFactory;
+
+ private List<LoggerTO> list(final LoggerType type) {
+ List<LoggerTO> result = new ArrayList<>();
+ for (Logger logger : loggerDAO.findAll(type)) {
+ LoggerTO loggerTO = new LoggerTO();
+ BeanUtils.copyProperties(logger, loggerTO);
+ result.add(loggerTO);
+ }
+
+ return result;
+ }
+
+ @PreAuthorize("hasRole('LOG_LIST')")
+ @Transactional(readOnly = true)
+ public List<LoggerTO> listLogs() {
+ return list(LoggerType.LOG);
+ }
+
+ @PreAuthorize("hasRole('AUDIT_LIST')")
+ @Transactional(readOnly = true)
+ public List<AuditLoggerName> listAudits() {
+ List<AuditLoggerName> result = new ArrayList<>();
+
+ for (LoggerTO logger : list(LoggerType.AUDIT)) {
+ try {
+ result.add(AuditLoggerName.fromLoggerName(logger.getKey()));
+ } catch (Exception e) {
+ LOG.warn("Unexpected audit logger name: {}", logger.getKey(), e);
+ }
+ }
+
+ return result;
+ }
+
+ private void throwInvalidLogger(final LoggerType type) {
+ SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidLogger);
+ sce.getElements().add("Expected " + type.name());
+
+ throw sce;
+ }
+
+ private LoggerTO setLevel(final String name, final Level level, final LoggerType expectedType) {
+ Logger syncopeLogger = loggerDAO.find(name);
+ if (syncopeLogger == null) {
+ LOG.debug("Logger {} not found: creating new...", name);
+
+ syncopeLogger = entityFactory.newEntity(Logger.class);
+ syncopeLogger.setKey(name);
+ syncopeLogger.setType(name.startsWith(LoggerType.AUDIT.getPrefix())
+ ? LoggerType.AUDIT
+ : LoggerType.LOG);
+ }
+
+ if (expectedType != syncopeLogger.getType()) {
+ throwInvalidLogger(expectedType);
+ }
+
+ syncopeLogger.setLevel(LoggerLevel.fromLevel(level));
+ syncopeLogger = loggerDAO.save(syncopeLogger);
+
+ LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
+ LoggerConfig logConf = SyncopeConstants.ROOT_LOGGER.equals(name)
+ ? ctx.getConfiguration().getLoggerConfig(LogManager.ROOT_LOGGER_NAME)
+ : ctx.getConfiguration().getLoggerConfig(name);
+ logConf.setLevel(level);
+ ctx.updateLoggers();
+
+ LoggerTO result = new LoggerTO();
+ BeanUtils.copyProperties(syncopeLogger, result);
+
+ return result;
+ }
+
+ @PreAuthorize("hasRole('LOG_SET_LEVEL')")
+ public LoggerTO setLogLevel(final String name, final Level level) {
+ return setLevel(name, level, LoggerType.LOG);
+ }
+
+ @PreAuthorize("hasRole('AUDIT_ENABLE')")
+ public void enableAudit(final AuditLoggerName auditLoggerName) {
+ try {
+ setLevel(auditLoggerName.toLoggerName(), Level.DEBUG, LoggerType.AUDIT);
+ } catch (IllegalArgumentException e) {
+ SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidLogger);
+ sce.getElements().add(e.getMessage());
+ throw sce;
+ }
+ }
+
+ private LoggerTO delete(final String name, final LoggerType expectedType) throws NotFoundException {
+ Logger syncopeLogger = loggerDAO.find(name);
+ if (syncopeLogger == null) {
+ throw new NotFoundException("Logger " + name);
+ } else if (expectedType != syncopeLogger.getType()) {
+ throwInvalidLogger(expectedType);
+ }
+
+ LoggerTO loggerToDelete = new LoggerTO();
+ BeanUtils.copyProperties(syncopeLogger, loggerToDelete);
+
+ // remove SyncopeLogger from local storage, so that LoggerLoader won't load this next time
+ loggerDAO.delete(syncopeLogger);
+
+ // set log level to OFF in order to disable configured logger until next reboot
+ LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
+ org.apache.logging.log4j.core.Logger logger = SyncopeConstants.ROOT_LOGGER.equals(name)
+ ? ctx.getLogger(LogManager.ROOT_LOGGER_NAME) : ctx.getLogger(name);
+ logger.setLevel(Level.OFF);
+ ctx.updateLoggers();
+
+ return loggerToDelete;
+ }
+
+ @PreAuthorize("hasRole('LOG_DELETE')")
+ public LoggerTO deleteLog(final String name) throws NotFoundException {
+ return delete(name, LoggerType.LOG);
+ }
+
+ @PreAuthorize("hasRole('AUDIT_DISABLE')")
+ public void disableAudit(final AuditLoggerName auditLoggerName) {
+ try {
+ delete(auditLoggerName.toLoggerName(), LoggerType.AUDIT);
+ } catch (NotFoundException e) {
+ LOG.debug("Ignoring disable of non existing logger {}", auditLoggerName.toLoggerName());
+ } catch (IllegalArgumentException e) {
+ SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidLogger);
+ sce.getElements().add(e.getMessage());
+ throw sce;
+ }
+ }
+
+ @PreAuthorize("hasRole('AUDIT_LIST') or hasRole('NOTIFICATION_LIST')")
+ public List<EventCategoryTO> listAuditEvents() {
+ // use set to avoi duplications or null elements
+ final Set<EventCategoryTO> events = new HashSet<EventCategoryTO>();
+
+ try {
+ final ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
+ final MetadataReaderFactory metadataReaderFactory =
+ new CachingMetadataReaderFactory(resourcePatternResolver);
+
+ final String packageSearchPath =
+ ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX
+ + ClassUtils.convertClassNameToResourcePath(
+ SystemPropertyUtils.resolvePlaceholders(this.getClass().getPackage().getName()))
+ + "/" + "**/*.class";
+
+ final Resource[] resources = resourcePatternResolver.getResources(packageSearchPath);
+ for (Resource resource : resources) {
+ if (resource.isReadable()) {
+ final MetadataReader metadataReader = metadataReaderFactory.getMetadataReader(resource);
+ final Class<?> clazz = Class.forName(metadataReader.getClassMetadata().getClassName());
+
+ if (clazz.isAnnotationPresent(Component.class)
+ && AbstractLogic.class.isAssignableFrom(clazz)) {
+ final EventCategoryTO eventCategoryTO = new EventCategoryTO();
+ eventCategoryTO.setCategory(clazz.getSimpleName());
+ for (Method method : clazz.getDeclaredMethods()) {
+ if (Modifier.isPublic(method.getModifiers())) {
+ eventCategoryTO.getEvents().add(method.getName());
+ }
+ }
+ events.add(eventCategoryTO);
+ }
+ }
+ }
+
+ //SYNCOPE-608
+ final EventCategoryTO authenticationControllerEvents = new EventCategoryTO();
+ authenticationControllerEvents.setCategory("AuthenticationController");
+ authenticationControllerEvents.getEvents().add("login");
+ events.add(authenticationControllerEvents);
+
+ events.add(new EventCategoryTO(EventCategoryType.PROPAGATION));
+ events.add(new EventCategoryTO(EventCategoryType.SYNCHRONIZATION));
+ events.add(new EventCategoryTO(EventCategoryType.PUSH));
+
+ for (AttributableType attributableType : AttributableType.values()) {
+ for (ExternalResource resource : resourceDAO.findAll()) {
+ final EventCategoryTO propEventCategoryTO = new EventCategoryTO(EventCategoryType.PROPAGATION);
+ final EventCategoryTO syncEventCategoryTO = new EventCategoryTO(EventCategoryType.SYNCHRONIZATION);
+ final EventCategoryTO pushEventCategoryTO = new EventCategoryTO(EventCategoryType.PUSH);
+
+ propEventCategoryTO.setCategory(attributableType.name().toLowerCase());
+ propEventCategoryTO.setSubcategory(resource.getKey());
+
+ syncEventCategoryTO.setCategory(attributableType.name().toLowerCase());
+ pushEventCategoryTO.setCategory(attributableType.name().toLowerCase());
+ syncEventCategoryTO.setSubcategory(resource.getKey());
+ pushEventCategoryTO.setSubcategory(resource.getKey());
+
+ for (ResourceOperation resourceOperation : ResourceOperation.values()) {
+ propEventCategoryTO.getEvents().add(resourceOperation.name().toLowerCase());
+ syncEventCategoryTO.getEvents().add(resourceOperation.name().toLowerCase());
+ pushEventCategoryTO.getEvents().add(resourceOperation.name().toLowerCase());
+ }
+
+ events.add(propEventCategoryTO);
+ events.add(syncEventCategoryTO);
+ events.add(pushEventCategoryTO);
+ }
+ }
+
+ for (SchedTask task : taskDAO.<SchedTask>findAll(TaskType.SCHEDULED)) {
+ final EventCategoryTO eventCategoryTO = new EventCategoryTO(EventCategoryType.TASK);
+ eventCategoryTO.setCategory(Class.forName(task.getJobClassName()).getSimpleName());
+ events.add(eventCategoryTO);
+ }
+
+ for (SyncTask task : taskDAO.<SyncTask>findAll(TaskType.SYNCHRONIZATION)) {
+ final EventCategoryTO eventCategoryTO = new EventCategoryTO(EventCategoryType.TASK);
+ eventCategoryTO.setCategory(Class.forName(task.getJobClassName()).getSimpleName());
+ events.add(eventCategoryTO);
+ }
+ } catch (Exception e) {
+ LOG.error("Failure retrieving audit/notification events", e);
+ }
+
+ return new ArrayList<>(events);
+ }
+
+ @Override
+ protected LoggerTO resolveReference(final Method method, final Object... args)
+ throws UnresolvedReferenceException {
+
+ throw new UnresolvedReferenceException();
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/LogicInvocationHandler.java
----------------------------------------------------------------------
diff --git a/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/LogicInvocationHandler.java b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/LogicInvocationHandler.java
new file mode 100644
index 0000000..968a34c
--- /dev/null
+++ b/syncope620/core/logic/src/main/java/org/apache/syncope/core/logic/LogicInvocationHandler.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.core.logic;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import org.apache.syncope.common.lib.types.AuditElements;
+import org.apache.syncope.core.misc.AuditManager;
+import org.apache.syncope.core.provisioning.api.notification.NotificationManager;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+@Aspect
+public class LogicInvocationHandler {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG = LoggerFactory.getLogger(LogicInvocationHandler.class);
+
+ @Autowired
+ private NotificationManager notificationManager;
+
+ @Autowired
+ private AuditManager auditManager;
+
+ @Around("execution(* org.apache.syncope.core.logic.AbstractLogic+.*(..))")
+ public Object around(final ProceedingJoinPoint joinPoint) throws Throwable {
+ final Class<?> clazz = joinPoint.getTarget().getClass();
+
+ final Object[] input = joinPoint.getArgs();
+
+ final String category = clazz.getSimpleName();
+
+ final MethodSignature ms = (MethodSignature) joinPoint.getSignature();
+ Method method = ms.getMethod();
+
+ final String event = joinPoint.getSignature().getName();
+
+ AuditElements.Result result = null;
+ Object output = null;
+ Object before = null;
+
+ try {
+ LOG.debug("Before {}.{}({})", clazz.getSimpleName(), event,
+ input == null || input.length == 0 ? "" : Arrays.asList(input));
+
+ try {
+ before = ((AbstractLogic) joinPoint.getTarget()).resolveBeanReference(method, input);
+ } catch (UnresolvedReferenceException ignore) {
+ LOG.debug("Unresolved bean reference ...");
+ }
+
+ output = joinPoint.proceed();
+ result = AuditElements.Result.SUCCESS;
+
+ LOG.debug("After returning {}.{}: {}", clazz.getSimpleName(), event, output);
+ return output;
+ } catch (Throwable t) {
+ output = t;
+ result = AuditElements.Result.FAILURE;
+
+ LOG.debug("After throwing {}.{}", clazz.getSimpleName(), event);
+ throw t;
+ } finally {
+ notificationManager.createTasks(
+ AuditElements.EventCategoryType.REST,
+ category,
+ null,
+ event,
+ result,
+ before,
+ output,
+ input);
+
+ auditManager.audit(
+ AuditElements.EventCategoryType.REST,
+ category,
+ null,
+ event,
+ result,
+ before,
+ output,
+ input);
+ }
+ }
+}