refactoring module structure

This commit is contained in:
Peter Hormanns 2017-02-06 19:38:02 +01:00
parent 73c6e6d1e2
commit 742138485e
53 changed files with 150 additions and 260 deletions

View File

@ -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

View File

@ -1,54 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.hsadmin</groupId>
<artifactId>hsadmin-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>authorization</artifactId>
<packaging>jar</packaging>
<name>HSAdmin Authorization</name>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>de.hsadmin</groupId>
<artifactId>common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-ejb_3.0_spec</artifactId>
<version>1.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</project>

13
common/.gitignore vendored
View File

@ -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

View File

@ -1,37 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.hsadmin</groupId>
<artifactId>hsadmin-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>common</artifactId>
<packaging>jar</packaging>
<name>HSAdmin Common</name>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</project>

View File

@ -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

View File

@ -1,48 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.hsadmin</groupId>
<artifactId>hsadmin-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>persistence</artifactId>
<packaging>jar</packaging>
<name>HSAdmin Persistence</name>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>de.hsadmin</groupId>
<artifactId>common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</project>

View File

@ -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());
}
}

View File

@ -11,10 +11,7 @@
<name>HSAdmin Parent Project</name>
<modules>
<module>authorization</module>
<module>common</module>
<module>framework</module>
<module>persistence</module>
<module>services</module>
<module>xmlrpc</module>
<module>web</module>

View File

@ -33,21 +33,6 @@
<artifactId>framework</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>de.hsadmin</groupId>
<artifactId>persistence</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>de.hsadmin</groupId>
<artifactId>common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>de.hsadmin</groupId>
<artifactId>authorization</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
@ -66,6 +51,16 @@
<version>1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-client</artifactId>
<version>5.14.1</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-openwire-legacy</artifactId>
<version>5.14.1</version>
</dependency>
<dependency>
<groupId>org.apache.xmlrpc</groupId>
<artifactId>xmlrpc-server</artifactId>

View File

@ -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;

View File

@ -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");
}
}

1
xmlrpc/.gitignore vendored
View File

@ -11,3 +11,4 @@ hs_err_pid*
/.settings
/.classpath
/.project
/.distribution

View File

@ -12,16 +12,6 @@
<packaging>war</packaging>
<name>HSAdmin XML-RPC Webapp</name>
<dependencies>
<dependency>
<groupId>de.hsadmin</groupId>
<artifactId>authorization</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>de.hsadmin</groupId>
<artifactId>common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>de.hsadmin</groupId>
<artifactId>framework</artifactId>
@ -65,6 +55,12 @@
<libs>
<lib>org.postgresql:postgresql:9.4.1209.jre7</lib>
</libs>
<systemProperties>
<javax.net.ssl.keyStore>${project.basedir}/conf/client.ks</javax.net.ssl.keyStore>
<javax.net.ssl.keyStorePassword>password</javax.net.ssl.keyStorePassword>
<javax.net.ssl.trustStore>${project.basedir}/conf/client.ts</javax.net.ssl.trustStore>
<javax.net.ssl.trustStorePassword>password</javax.net.ssl.trustStorePassword>
</systemProperties>
</configuration>
</plugin>
</plugins>