From 742138485ed1ea9d78da8d5ee136d89cc1d5140b Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Mon, 6 Feb 2017 19:38:02 +0100 Subject: [PATCH] refactoring module structure --- authorization/.gitignore | 13 -- authorization/pom.xml | 54 -------- common/.gitignore | 13 -- common/pom.xml | 37 ----- .../java/de/hsadmin/common/config/Config.java | 0 .../common/error/TechnicalException.java | 0 .../de/hsadmin/common/error/UserError.java | 0 .../hsadmin/common/error/UserErrorList.java | 0 .../hsadmin/common/error/UserException.java | 0 .../java/de/hsadmin/common/util/DateUtil.java | 0 .../hsadmin/common/util/ReflectionUtil.java | 0 .../de/hsadmin/login/CASTicketValidator.java | 0 .../java/de/hsadmin/login/LoginService.java | 0 .../de/hsadmin/login/LoginServiceLocal.java | 0 .../java/de/hsadmin/login/RequestContext.java | 0 .../java/de/hsadmin/login/RequiredScope.java | 0 .../src/main/java/de/hsadmin/login/Role.java | 0 .../java/de/hsadmin/login/ScopePolicy.java | 0 .../de/hsadmin/login/TestTicketValidator.java | 0 .../de/hsadmin/login/TicketValidator.java | 0 persistence/.gitignore | 13 -- persistence/pom.xml | 48 ------- .../de/hsadmin/bo/pac/PacEntityListener.java | 54 -------- pom.xml | 3 - .../database/hsdb-bootstrap.sql | 0 .../database/hsdb-schema.sql | 0 .../database/migrate.sql | 0 services/pom.xml | 25 ++-- .../java/de/hsadmin/bo/customer/Contact.java | 0 .../java/de/hsadmin/bo/customer/Customer.java | 0 .../de/hsadmin/bo/customer/IndicatorVAT.java | 0 .../hsadmin/bo/customer/SEPADirectDebit.java | 0 .../java/de/hsadmin/bo/database/Database.java | 0 .../de/hsadmin/bo/database/DatabaseUser.java | 0 .../de/hsadmin/bo/database/MySqlDatabase.java | 0 .../de/hsadmin/bo/database/MySqlUser.java | 0 .../de/hsadmin/bo/database/PgSqlDatabase.java | 0 .../de/hsadmin/bo/database/PgSqlUser.java | 0 .../java/de/hsadmin/bo/domain/Domain.java | 0 .../de/hsadmin/bo/domain/DomainOption.java | 0 .../de/hsadmin/bo/domain/EMailAddress.java | 0 .../java/de/hsadmin/bo/pac/BaseComponent.java | 0 .../main/java/de/hsadmin/bo/pac/BasePac.java | 0 .../java/de/hsadmin/bo/pac/Component.java | 0 .../java/de/hsadmin/bo/pac/EMailAlias.java | 0 .../src/main/java/de/hsadmin/bo/pac/Hive.java | 0 .../java/de/hsadmin/bo/pac/INetAddress.java | 0 .../src/main/java/de/hsadmin/bo/pac/Pac.java | 0 .../java/de/hsadmin/bo/pac/PacComponent.java | 2 + .../de/hsadmin/bo/pac/PacEntityListener.java | 131 ++++++++++++++++++ .../main/java/de/hsadmin/bo/pac/UnixUser.java | 0 xmlrpc/.gitignore | 1 + xmlrpc/pom.xml | 16 +-- 53 files changed, 150 insertions(+), 260 deletions(-) delete mode 100644 authorization/.gitignore delete mode 100644 authorization/pom.xml delete mode 100644 common/.gitignore delete mode 100644 common/pom.xml rename {common => framework}/src/main/java/de/hsadmin/common/config/Config.java (100%) rename {common => framework}/src/main/java/de/hsadmin/common/error/TechnicalException.java (100%) rename {common => framework}/src/main/java/de/hsadmin/common/error/UserError.java (100%) rename {common => framework}/src/main/java/de/hsadmin/common/error/UserErrorList.java (100%) rename {common => framework}/src/main/java/de/hsadmin/common/error/UserException.java (100%) rename {common => framework}/src/main/java/de/hsadmin/common/util/DateUtil.java (100%) rename {common => framework}/src/main/java/de/hsadmin/common/util/ReflectionUtil.java (100%) rename {authorization => framework}/src/main/java/de/hsadmin/login/CASTicketValidator.java (100%) rename {authorization => framework}/src/main/java/de/hsadmin/login/LoginService.java (100%) rename {authorization => framework}/src/main/java/de/hsadmin/login/LoginServiceLocal.java (100%) rename {authorization => framework}/src/main/java/de/hsadmin/login/RequestContext.java (100%) rename {authorization => framework}/src/main/java/de/hsadmin/login/RequiredScope.java (100%) rename {authorization => framework}/src/main/java/de/hsadmin/login/Role.java (100%) rename {authorization => framework}/src/main/java/de/hsadmin/login/ScopePolicy.java (100%) rename {authorization => framework}/src/main/java/de/hsadmin/login/TestTicketValidator.java (100%) rename {authorization => framework}/src/main/java/de/hsadmin/login/TicketValidator.java (100%) delete mode 100644 persistence/.gitignore delete mode 100644 persistence/pom.xml delete mode 100644 persistence/src/main/java/de/hsadmin/bo/pac/PacEntityListener.java rename {persistence => services}/database/hsdb-bootstrap.sql (100%) rename {persistence => services}/database/hsdb-schema.sql (100%) rename {persistence => services}/database/migrate.sql (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/customer/Contact.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/customer/Customer.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/customer/IndicatorVAT.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/customer/SEPADirectDebit.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/database/Database.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/database/DatabaseUser.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/database/MySqlDatabase.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/database/MySqlUser.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/database/PgSqlDatabase.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/database/PgSqlUser.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/domain/Domain.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/domain/DomainOption.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/domain/EMailAddress.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/pac/BaseComponent.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/pac/BasePac.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/pac/Component.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/pac/EMailAlias.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/pac/Hive.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/pac/INetAddress.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/pac/Pac.java (100%) rename {persistence => services}/src/main/java/de/hsadmin/bo/pac/PacComponent.java (96%) create mode 100644 services/src/main/java/de/hsadmin/bo/pac/PacEntityListener.java rename {persistence => services}/src/main/java/de/hsadmin/bo/pac/UnixUser.java (100%) diff --git a/authorization/.gitignore b/authorization/.gitignore deleted file mode 100644 index e774414..0000000 --- a/authorization/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.class - -# Package Files # -*.jar -*.war -*.ear - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* -/target -/.settings -/.classpath -/.project diff --git a/authorization/pom.xml b/authorization/pom.xml deleted file mode 100644 index 685c8dd..0000000 --- a/authorization/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - 4.0.0 - - de.hsadmin - hsadmin-parent - 1.0-SNAPSHOT - - authorization - jar - - HSAdmin Authorization - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - true - - - - - - - - - de.hsadmin - common - 1.0-SNAPSHOT - - - org.apache.geronimo.specs - geronimo-jpa_2.0_spec - 1.1 - provided - - - org.apache.geronimo.specs - geronimo-ejb_3.0_spec - 1.0.1 - provided - - - log4j - log4j - 1.2.17 - - - diff --git a/common/.gitignore b/common/.gitignore deleted file mode 100644 index e774414..0000000 --- a/common/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.class - -# Package Files # -*.jar -*.war -*.ear - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* -/target -/.settings -/.classpath -/.project diff --git a/common/pom.xml b/common/pom.xml deleted file mode 100644 index cf9d12a..0000000 --- a/common/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - 4.0.0 - - de.hsadmin - hsadmin-parent - 1.0-SNAPSHOT - - common - jar - - HSAdmin Common - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - true - - - - - - - - - log4j - log4j - 1.2.17 - - - diff --git a/common/src/main/java/de/hsadmin/common/config/Config.java b/framework/src/main/java/de/hsadmin/common/config/Config.java similarity index 100% rename from common/src/main/java/de/hsadmin/common/config/Config.java rename to framework/src/main/java/de/hsadmin/common/config/Config.java diff --git a/common/src/main/java/de/hsadmin/common/error/TechnicalException.java b/framework/src/main/java/de/hsadmin/common/error/TechnicalException.java similarity index 100% rename from common/src/main/java/de/hsadmin/common/error/TechnicalException.java rename to framework/src/main/java/de/hsadmin/common/error/TechnicalException.java diff --git a/common/src/main/java/de/hsadmin/common/error/UserError.java b/framework/src/main/java/de/hsadmin/common/error/UserError.java similarity index 100% rename from common/src/main/java/de/hsadmin/common/error/UserError.java rename to framework/src/main/java/de/hsadmin/common/error/UserError.java diff --git a/common/src/main/java/de/hsadmin/common/error/UserErrorList.java b/framework/src/main/java/de/hsadmin/common/error/UserErrorList.java similarity index 100% rename from common/src/main/java/de/hsadmin/common/error/UserErrorList.java rename to framework/src/main/java/de/hsadmin/common/error/UserErrorList.java diff --git a/common/src/main/java/de/hsadmin/common/error/UserException.java b/framework/src/main/java/de/hsadmin/common/error/UserException.java similarity index 100% rename from common/src/main/java/de/hsadmin/common/error/UserException.java rename to framework/src/main/java/de/hsadmin/common/error/UserException.java diff --git a/common/src/main/java/de/hsadmin/common/util/DateUtil.java b/framework/src/main/java/de/hsadmin/common/util/DateUtil.java similarity index 100% rename from common/src/main/java/de/hsadmin/common/util/DateUtil.java rename to framework/src/main/java/de/hsadmin/common/util/DateUtil.java diff --git a/common/src/main/java/de/hsadmin/common/util/ReflectionUtil.java b/framework/src/main/java/de/hsadmin/common/util/ReflectionUtil.java similarity index 100% rename from common/src/main/java/de/hsadmin/common/util/ReflectionUtil.java rename to framework/src/main/java/de/hsadmin/common/util/ReflectionUtil.java diff --git a/authorization/src/main/java/de/hsadmin/login/CASTicketValidator.java b/framework/src/main/java/de/hsadmin/login/CASTicketValidator.java similarity index 100% rename from authorization/src/main/java/de/hsadmin/login/CASTicketValidator.java rename to framework/src/main/java/de/hsadmin/login/CASTicketValidator.java diff --git a/authorization/src/main/java/de/hsadmin/login/LoginService.java b/framework/src/main/java/de/hsadmin/login/LoginService.java similarity index 100% rename from authorization/src/main/java/de/hsadmin/login/LoginService.java rename to framework/src/main/java/de/hsadmin/login/LoginService.java diff --git a/authorization/src/main/java/de/hsadmin/login/LoginServiceLocal.java b/framework/src/main/java/de/hsadmin/login/LoginServiceLocal.java similarity index 100% rename from authorization/src/main/java/de/hsadmin/login/LoginServiceLocal.java rename to framework/src/main/java/de/hsadmin/login/LoginServiceLocal.java diff --git a/authorization/src/main/java/de/hsadmin/login/RequestContext.java b/framework/src/main/java/de/hsadmin/login/RequestContext.java similarity index 100% rename from authorization/src/main/java/de/hsadmin/login/RequestContext.java rename to framework/src/main/java/de/hsadmin/login/RequestContext.java diff --git a/authorization/src/main/java/de/hsadmin/login/RequiredScope.java b/framework/src/main/java/de/hsadmin/login/RequiredScope.java similarity index 100% rename from authorization/src/main/java/de/hsadmin/login/RequiredScope.java rename to framework/src/main/java/de/hsadmin/login/RequiredScope.java diff --git a/authorization/src/main/java/de/hsadmin/login/Role.java b/framework/src/main/java/de/hsadmin/login/Role.java similarity index 100% rename from authorization/src/main/java/de/hsadmin/login/Role.java rename to framework/src/main/java/de/hsadmin/login/Role.java diff --git a/authorization/src/main/java/de/hsadmin/login/ScopePolicy.java b/framework/src/main/java/de/hsadmin/login/ScopePolicy.java similarity index 100% rename from authorization/src/main/java/de/hsadmin/login/ScopePolicy.java rename to framework/src/main/java/de/hsadmin/login/ScopePolicy.java diff --git a/authorization/src/main/java/de/hsadmin/login/TestTicketValidator.java b/framework/src/main/java/de/hsadmin/login/TestTicketValidator.java similarity index 100% rename from authorization/src/main/java/de/hsadmin/login/TestTicketValidator.java rename to framework/src/main/java/de/hsadmin/login/TestTicketValidator.java diff --git a/authorization/src/main/java/de/hsadmin/login/TicketValidator.java b/framework/src/main/java/de/hsadmin/login/TicketValidator.java similarity index 100% rename from authorization/src/main/java/de/hsadmin/login/TicketValidator.java rename to framework/src/main/java/de/hsadmin/login/TicketValidator.java diff --git a/persistence/.gitignore b/persistence/.gitignore deleted file mode 100644 index e774414..0000000 --- a/persistence/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.class - -# Package Files # -*.jar -*.war -*.ear - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* -/target -/.settings -/.classpath -/.project diff --git a/persistence/pom.xml b/persistence/pom.xml deleted file mode 100644 index 1417fdc..0000000 --- a/persistence/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - 4.0.0 - - de.hsadmin - hsadmin-parent - 1.0-SNAPSHOT - - persistence - jar - - HSAdmin Persistence - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - true - - - - - - - - - de.hsadmin - common - 1.0-SNAPSHOT - - - org.apache.geronimo.specs - geronimo-jpa_2.0_spec - 1.1 - provided - - - log4j - log4j - 1.2.17 - - - diff --git a/persistence/src/main/java/de/hsadmin/bo/pac/PacEntityListener.java b/persistence/src/main/java/de/hsadmin/bo/pac/PacEntityListener.java deleted file mode 100644 index d21ab58..0000000 --- a/persistence/src/main/java/de/hsadmin/bo/pac/PacEntityListener.java +++ /dev/null @@ -1,54 +0,0 @@ -package de.hsadmin.bo.pac; - -import javax.persistence.PostLoad; -import javax.persistence.PrePersist; -import javax.persistence.PreRemove; -import javax.persistence.PreUpdate; - -public class PacEntityListener { - - public PacEntityListener() { - System.out.println("PacEntityListener()"); - } - - @PostLoad - public void onLoad(Object pacObject) { - System.out.println("onLoad"); - if (pacObject instanceof Pac) { - Pac pac = (Pac) pacObject; - System.out.println("Pac: " + pac.getName() + " free:" + pac.isFree()); - } - System.out.println(" from: " + this.toString()); - } - - @PrePersist - public void onCreate(Object pacObject) { - System.out.println("onCreate"); - if (pacObject instanceof Pac) { - Pac pac = (Pac) pacObject; - System.out.println("Pac: " + pac.getName() + " free:" + pac.isFree()); - } - System.out.println(" from: " + this.toString()); - } - - @PreUpdate - public void onUpdate(Object pacObject) { - System.out.println("onUpdate"); - if (pacObject instanceof Pac) { - Pac pac = (Pac) pacObject; - System.out.println("Pac: " + pac.getName() + " free:" + pac.isFree()); - } - System.out.println(" from: " + this.toString()); - } - - @PreRemove - public void onDelete(Object pacObject) { - System.out.println("onDelete"); - if (pacObject instanceof Pac) { - Pac pac = (Pac) pacObject; - System.out.println("Pac: " + pac.getName() + " free:" + pac.isFree()); - } - System.out.println(" from: " + this.toString()); - } - -} diff --git a/pom.xml b/pom.xml index c48f1d1..19392cb 100644 --- a/pom.xml +++ b/pom.xml @@ -11,10 +11,7 @@ HSAdmin Parent Project - authorization - common framework - persistence services xmlrpc web diff --git a/persistence/database/hsdb-bootstrap.sql b/services/database/hsdb-bootstrap.sql similarity index 100% rename from persistence/database/hsdb-bootstrap.sql rename to services/database/hsdb-bootstrap.sql diff --git a/persistence/database/hsdb-schema.sql b/services/database/hsdb-schema.sql similarity index 100% rename from persistence/database/hsdb-schema.sql rename to services/database/hsdb-schema.sql diff --git a/persistence/database/migrate.sql b/services/database/migrate.sql similarity index 100% rename from persistence/database/migrate.sql rename to services/database/migrate.sql diff --git a/services/pom.xml b/services/pom.xml index d855541..f0606c6 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -33,21 +33,6 @@ framework 1.0-SNAPSHOT - - de.hsadmin - persistence - 1.0-SNAPSHOT - - - de.hsadmin - common - 1.0-SNAPSHOT - - - de.hsadmin - authorization - 1.0-SNAPSHOT - org.apache.geronimo.specs geronimo-jpa_2.0_spec @@ -66,6 +51,16 @@ 1.1 provided + + org.apache.activemq + activemq-client + 5.14.1 + + + org.apache.activemq + activemq-openwire-legacy + 5.14.1 + org.apache.xmlrpc xmlrpc-server diff --git a/persistence/src/main/java/de/hsadmin/bo/customer/Contact.java b/services/src/main/java/de/hsadmin/bo/customer/Contact.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/customer/Contact.java rename to services/src/main/java/de/hsadmin/bo/customer/Contact.java diff --git a/persistence/src/main/java/de/hsadmin/bo/customer/Customer.java b/services/src/main/java/de/hsadmin/bo/customer/Customer.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/customer/Customer.java rename to services/src/main/java/de/hsadmin/bo/customer/Customer.java diff --git a/persistence/src/main/java/de/hsadmin/bo/customer/IndicatorVAT.java b/services/src/main/java/de/hsadmin/bo/customer/IndicatorVAT.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/customer/IndicatorVAT.java rename to services/src/main/java/de/hsadmin/bo/customer/IndicatorVAT.java diff --git a/persistence/src/main/java/de/hsadmin/bo/customer/SEPADirectDebit.java b/services/src/main/java/de/hsadmin/bo/customer/SEPADirectDebit.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/customer/SEPADirectDebit.java rename to services/src/main/java/de/hsadmin/bo/customer/SEPADirectDebit.java diff --git a/persistence/src/main/java/de/hsadmin/bo/database/Database.java b/services/src/main/java/de/hsadmin/bo/database/Database.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/database/Database.java rename to services/src/main/java/de/hsadmin/bo/database/Database.java diff --git a/persistence/src/main/java/de/hsadmin/bo/database/DatabaseUser.java b/services/src/main/java/de/hsadmin/bo/database/DatabaseUser.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/database/DatabaseUser.java rename to services/src/main/java/de/hsadmin/bo/database/DatabaseUser.java diff --git a/persistence/src/main/java/de/hsadmin/bo/database/MySqlDatabase.java b/services/src/main/java/de/hsadmin/bo/database/MySqlDatabase.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/database/MySqlDatabase.java rename to services/src/main/java/de/hsadmin/bo/database/MySqlDatabase.java diff --git a/persistence/src/main/java/de/hsadmin/bo/database/MySqlUser.java b/services/src/main/java/de/hsadmin/bo/database/MySqlUser.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/database/MySqlUser.java rename to services/src/main/java/de/hsadmin/bo/database/MySqlUser.java diff --git a/persistence/src/main/java/de/hsadmin/bo/database/PgSqlDatabase.java b/services/src/main/java/de/hsadmin/bo/database/PgSqlDatabase.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/database/PgSqlDatabase.java rename to services/src/main/java/de/hsadmin/bo/database/PgSqlDatabase.java diff --git a/persistence/src/main/java/de/hsadmin/bo/database/PgSqlUser.java b/services/src/main/java/de/hsadmin/bo/database/PgSqlUser.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/database/PgSqlUser.java rename to services/src/main/java/de/hsadmin/bo/database/PgSqlUser.java diff --git a/persistence/src/main/java/de/hsadmin/bo/domain/Domain.java b/services/src/main/java/de/hsadmin/bo/domain/Domain.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/domain/Domain.java rename to services/src/main/java/de/hsadmin/bo/domain/Domain.java diff --git a/persistence/src/main/java/de/hsadmin/bo/domain/DomainOption.java b/services/src/main/java/de/hsadmin/bo/domain/DomainOption.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/domain/DomainOption.java rename to services/src/main/java/de/hsadmin/bo/domain/DomainOption.java diff --git a/persistence/src/main/java/de/hsadmin/bo/domain/EMailAddress.java b/services/src/main/java/de/hsadmin/bo/domain/EMailAddress.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/domain/EMailAddress.java rename to services/src/main/java/de/hsadmin/bo/domain/EMailAddress.java diff --git a/persistence/src/main/java/de/hsadmin/bo/pac/BaseComponent.java b/services/src/main/java/de/hsadmin/bo/pac/BaseComponent.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/pac/BaseComponent.java rename to services/src/main/java/de/hsadmin/bo/pac/BaseComponent.java diff --git a/persistence/src/main/java/de/hsadmin/bo/pac/BasePac.java b/services/src/main/java/de/hsadmin/bo/pac/BasePac.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/pac/BasePac.java rename to services/src/main/java/de/hsadmin/bo/pac/BasePac.java diff --git a/persistence/src/main/java/de/hsadmin/bo/pac/Component.java b/services/src/main/java/de/hsadmin/bo/pac/Component.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/pac/Component.java rename to services/src/main/java/de/hsadmin/bo/pac/Component.java diff --git a/persistence/src/main/java/de/hsadmin/bo/pac/EMailAlias.java b/services/src/main/java/de/hsadmin/bo/pac/EMailAlias.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/pac/EMailAlias.java rename to services/src/main/java/de/hsadmin/bo/pac/EMailAlias.java diff --git a/persistence/src/main/java/de/hsadmin/bo/pac/Hive.java b/services/src/main/java/de/hsadmin/bo/pac/Hive.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/pac/Hive.java rename to services/src/main/java/de/hsadmin/bo/pac/Hive.java diff --git a/persistence/src/main/java/de/hsadmin/bo/pac/INetAddress.java b/services/src/main/java/de/hsadmin/bo/pac/INetAddress.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/pac/INetAddress.java rename to services/src/main/java/de/hsadmin/bo/pac/INetAddress.java diff --git a/persistence/src/main/java/de/hsadmin/bo/pac/Pac.java b/services/src/main/java/de/hsadmin/bo/pac/Pac.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/pac/Pac.java rename to services/src/main/java/de/hsadmin/bo/pac/Pac.java diff --git a/persistence/src/main/java/de/hsadmin/bo/pac/PacComponent.java b/services/src/main/java/de/hsadmin/bo/pac/PacComponent.java similarity index 96% rename from persistence/src/main/java/de/hsadmin/bo/pac/PacComponent.java rename to services/src/main/java/de/hsadmin/bo/pac/PacComponent.java index 98c5d19..d15f8ba 100644 --- a/persistence/src/main/java/de/hsadmin/bo/pac/PacComponent.java +++ b/services/src/main/java/de/hsadmin/bo/pac/PacComponent.java @@ -7,6 +7,7 @@ import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.EntityListeners; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; @@ -19,6 +20,7 @@ import javax.persistence.TemporalType; @Entity(name = "PacComponents") @Table(name = "packet_component") @SequenceGenerator(name = "PacCompSeqGen", sequenceName = "packet_component_id_seq") +@EntityListeners({PacEntityListener.class}) public class PacComponent implements Serializable { private static final long serialVersionUID = 1L; diff --git a/services/src/main/java/de/hsadmin/bo/pac/PacEntityListener.java b/services/src/main/java/de/hsadmin/bo/pac/PacEntityListener.java new file mode 100644 index 0000000..749f8d1 --- /dev/null +++ b/services/src/main/java/de/hsadmin/bo/pac/PacEntityListener.java @@ -0,0 +1,131 @@ +package de.hsadmin.bo.pac; + +import java.util.Date; + +import javax.jms.JMSException; +import javax.jms.Queue; +import javax.jms.QueueConnection; +import javax.jms.QueueSender; +import javax.jms.QueueSession; +import javax.jms.Session; +import javax.jms.TextMessage; +import javax.persistence.PostLoad; +import javax.persistence.PostPersist; +import javax.persistence.PostUpdate; +import javax.persistence.PreRemove; + +import org.apache.activemq.ActiveMQConnectionFactory; + +public class PacEntityListener { + + public PacEntityListener() { + System.out.println("PacEntityListener()"); + } + + @PostLoad + public void onLoad(final Object entity) { + System.out.println("onLoad"); + Pac pac = null; + if (entity instanceof PacComponent) { + final PacComponent component = (PacComponent) entity; + pac = component.getPac(); + } + if (entity instanceof Pac) { + pac = (Pac) entity; + System.out.println("Pac: " + pac.getName() + " free:" + pac.isFree()); + } + System.out.println("Pac: " + pac.getName() + " free:" + pac.isFree()); + System.out.println(" from: " + this.toString()); + } + + @PostPersist + public void onCreate(final Object entity) { + System.out.println("onCreate"); + Pac pac = null; + if (entity instanceof PacComponent) { + final PacComponent component = (PacComponent) entity; + pac = component.getPac(); + } + if (entity instanceof Pac) { + pac = (Pac) entity; + System.out.println("Pac: " + pac.getName() + " free:" + pac.isFree()); + } + if (pac != null) { + final String name = pac.getName(); + System.out.println("Pac: " + name + " free:" + pac.isFree()); + sendNotification("pac", "add", name); + } + System.out.println(" from: " + this.toString()); + } + + @PostUpdate + public void onUpdate(final Object entity) { + System.out.println("onUpdate"); + Pac pac = null; + if (entity instanceof PacComponent) { + final PacComponent component = (PacComponent) entity; + pac = component.getPac(); + } + if (entity instanceof Pac) { + pac = (Pac) entity; + System.out.println("Pac: " + pac.getName() + " free:" + pac.isFree()); + } + if (pac != null) { + final String name = pac.getName(); + System.out.println("Pac: " + name + " free:" + pac.isFree()); + sendNotification("pac", "update", name); + } + System.out.println(" from: " + this.toString()); + } + + @PreRemove + public void onDelete(final Object entity) { + System.out.println("onDelete"); + Pac pac = null; + if (entity instanceof PacComponent) { + final PacComponent component = (PacComponent) entity; + pac = component.getPac(); + } + if (entity instanceof Pac) { + pac = (Pac) entity; + System.out.println("Pac: " + pac.getName() + " free:" + pac.isFree()); + } + if (pac != null) { + System.out.println("Pac: " + pac.getName() + " free:" + pac.isFree()); + final String name = pac.getName(); + System.out.println("Pac: " + name + " free:" + pac.isFree()); + sendNotification("pac", "delete", name); + } + System.out.println(" from: " + this.toString()); + } + + public void sendNotification(final String module, final String opCode, final String name) + { + final ActiveMQConnectionFactory connFactory = new ActiveMQConnectionFactory("ssl://hsh03.hostsharing.net:61617"); + QueueConnection connection = null; + try { + connection = connFactory.createQueueConnection("user-pactasks", "Ohf4oh"); + connection.start(); + final QueueSession session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); + final Queue queue = session.createQueue("queue.hsadminSystem-pactasks"); + final String string = module + "." + opCode + ":" + name + ":" + new Date(); + System.out.println(string); + final TextMessage message = session.createTextMessage(string); + final QueueSender sender = session.createSender(queue); + sender.send(message); + sender.close(); + session.close(); + } catch (JMSException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } finally { + if (connection != null) { try { connection.close(); } catch(JMSException e) { } } + } + } + + public static void main(String[] args) { + PacEntityListener listener = new PacEntityListener(); + listener.sendNotification("pac", "add", "xyz01"); + } + +} diff --git a/persistence/src/main/java/de/hsadmin/bo/pac/UnixUser.java b/services/src/main/java/de/hsadmin/bo/pac/UnixUser.java similarity index 100% rename from persistence/src/main/java/de/hsadmin/bo/pac/UnixUser.java rename to services/src/main/java/de/hsadmin/bo/pac/UnixUser.java diff --git a/xmlrpc/.gitignore b/xmlrpc/.gitignore index e774414..4712857 100644 --- a/xmlrpc/.gitignore +++ b/xmlrpc/.gitignore @@ -11,3 +11,4 @@ hs_err_pid* /.settings /.classpath /.project +/.distribution diff --git a/xmlrpc/pom.xml b/xmlrpc/pom.xml index 2e79149..11048a0 100644 --- a/xmlrpc/pom.xml +++ b/xmlrpc/pom.xml @@ -12,16 +12,6 @@ war HSAdmin XML-RPC Webapp - - de.hsadmin - authorization - 1.0-SNAPSHOT - - - de.hsadmin - common - 1.0-SNAPSHOT - de.hsadmin framework @@ -65,6 +55,12 @@ org.postgresql:postgresql:9.4.1209.jre7 + + ${project.basedir}/conf/client.ks + password + ${project.basedir}/conf/client.ts + password +