Skip to content

Commit 9b4276f

Browse files
author
Holmistr
committed
Packages and modules reorganized
1 parent 83c80c7 commit 9b4276f

File tree

31 files changed

+287
-333
lines changed

31 files changed

+287
-333
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/my-maps-webapp/target/
22
/my-maps-backend/target/
3-
/my-maps-model/target/
3+
/my-maps-model/target/
4+
/my-maps-datalayer/target/
5+
/my-maps-servicelayer/target/

my-maps-backend/pom.xml

Lines changed: 0 additions & 31 deletions
This file was deleted.

my-maps-datalayer/pom.xml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>my-maps</artifactId>
7+
<groupId>my-maps</groupId>
8+
<version>1.0-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<name>my-maps-datalayer</name>
13+
<groupId>my-maps</groupId>
14+
<artifactId>my-maps-datalayer</artifactId>
15+
<packaging>jar</packaging>
16+
<version>1.0-SNAPSHOT</version>
17+
18+
<properties>
19+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20+
<version.arquillian>1.0.3.Final</version.arquillian>
21+
<version.arquillian.container>1.0.0.CR3</version.arquillian.container>
22+
<version.weld>1.1.5.Final</version.weld>
23+
<version.infinispan>5.2.5.Final</version.infinispan>
24+
<version.junit>4.10</version.junit>
25+
<version.specs>3.0.1.Final</version.specs>
26+
<version.slf4j>1.6.4</version.slf4j>
27+
<version.maven.surefire>2.11</version.maven.surefire>
28+
<version.hibernate>4.2.0.Final</version.hibernate>
29+
</properties>
30+
31+
<dependencyManagement>
32+
<dependencies>
33+
<dependency>
34+
<groupId>org.jboss.arquillian</groupId>
35+
<artifactId>arquillian-bom</artifactId>
36+
<version>${version.arquillian}</version>
37+
<scope>import</scope>
38+
<type>pom</type>
39+
</dependency>
40+
</dependencies>
41+
</dependencyManagement>
42+
43+
<build>
44+
<plugins>
45+
<plugin>
46+
<groupId>org.apache.maven.plugins</groupId>
47+
<artifactId>maven-compiler-plugin</artifactId>
48+
<version>2.3.2</version>
49+
<configuration>
50+
<source>1.7</source>
51+
<target>1.7</target>
52+
</configuration>
53+
</plugin>
54+
<plugin>
55+
<artifactId>maven-surefire-plugin</artifactId>
56+
<version>${version.maven.surefire}</version>
57+
</plugin>
58+
</plugins>
59+
</build>
60+
61+
<dependencies>
62+
<dependency>
63+
<groupId>org.jboss.spec</groupId>
64+
<artifactId>jboss-javaee-6.0</artifactId>
65+
<version>1.0.0.Final</version>
66+
<type>pom</type>
67+
<scope>provided</scope>
68+
</dependency>
69+
<dependency>
70+
<groupId>junit</groupId>
71+
<artifactId>junit</artifactId>
72+
<version>${version.junit}</version>
73+
<scope>test</scope>
74+
</dependency>
75+
<dependency>
76+
<groupId>org.jboss.arquillian.junit</groupId>
77+
<artifactId>arquillian-junit-container</artifactId>
78+
<scope>test</scope>
79+
</dependency>
80+
<dependency>
81+
<groupId>org.jboss.arquillian.container</groupId>
82+
<artifactId>arquillian-weld-ee-embedded-1.1</artifactId>
83+
<version>${version.arquillian.container}</version>
84+
<scope>test</scope>
85+
</dependency>
86+
<dependency>
87+
<groupId>org.jboss.weld</groupId>
88+
<artifactId>weld-core</artifactId>
89+
<version>${version.weld}</version>
90+
<scope>test</scope>
91+
</dependency>
92+
<dependency>
93+
<groupId>org.slf4j</groupId>
94+
<artifactId>slf4j-simple</artifactId>
95+
<version>${version.slf4j}</version>
96+
<scope>test</scope>
97+
</dependency>
98+
<dependency>
99+
<groupId>org.infinispan</groupId>
100+
<artifactId>infinispan-core</artifactId>
101+
<version>${version.infinispan}</version>
102+
</dependency>
103+
<dependency>
104+
<groupId>org.hibernate</groupId>
105+
<artifactId>hibernate-search</artifactId>
106+
<version>${version.hibernate}</version>
107+
</dependency>
108+
</dependencies>
109+
110+
<profiles>
111+
<profile>
112+
<id>jboss-public-repository</id>
113+
<activation>
114+
<property>
115+
<name>jboss-public-repository</name>
116+
<value>!false</value>
117+
</property>
118+
</activation>
119+
<repositories>
120+
<repository>
121+
<id>jboss-public-repository-group</id>
122+
<name>JBoss Public Maven Repository Group</name>
123+
<url>http://repository.jboss.org/nexus/content/groups/public</url>
124+
<releases>
125+
<enabled>true</enabled>
126+
<updatePolicy>never</updatePolicy>
127+
</releases>
128+
<snapshots>
129+
<enabled>true</enabled>
130+
<updatePolicy>never</updatePolicy>
131+
</snapshots>
132+
</repository>
133+
</repositories>
134+
<pluginRepositories>
135+
<pluginRepository>
136+
<id>jboss-public-repository-group</id>
137+
<name>JBoss Public Maven Repository Group</name>
138+
<url>http://repository.jboss.org/nexus/content/groups/public</url>
139+
<releases>
140+
<enabled>true</enabled>
141+
<updatePolicy>never</updatePolicy>
142+
</releases>
143+
<snapshots>
144+
<enabled>false</enabled>
145+
<updatePolicy>never</updatePolicy>
146+
</snapshots>
147+
</pluginRepository>
148+
</pluginRepositories>
149+
</profile>
150+
</profiles>
151+
152+
</project>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
package cz.muni.fi.pv243.mymaps.webapp.session;
2+
package cz.muni.fi.pv243.mymaps.caches;
33

44
import org.infinispan.api.BasicCacheContainer;
55

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* To change this template, choose Tools | Templates
33
* and open the template in the editor.
44
*/
5-
package cz.muni.fi.pv243.mymaps.webapp.session;
5+
package cz.muni.fi.pv243.mymaps.caches;
66

77
import java.io.IOException;
88
import javax.annotation.PreDestroy;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package cz.muni.fi.pv243.mymaps.webapp.session;
1+
package cz.muni.fi.pv243.mymaps.caches;
22

33
import java.io.IOException;
44
import javax.annotation.PreDestroy;
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
package cz.muni.fi.pv243.mymaps.dao;
2+
3+
import cz.muni.fi.pv243.mymaps.entities.AbstractEntity;
4+
import cz.muni.fi.pv243.mymaps.caches.CacheContainerProvider;
5+
import java.util.Collections;
6+
import javax.enterprise.context.Dependent;
7+
import javax.enterprise.inject.Model;
8+
import javax.inject.Inject;
9+
import org.infinispan.api.BasicCache;
10+
11+
@Model
12+
@Dependent
13+
public class GenericDao<T extends AbstractEntity>{
14+
15+
@Inject
16+
protected CacheContainerProvider provider;
17+
18+
protected BasicCache<Long, T> cache;
19+
20+
public T create(T entity) {
21+
if(cache == null){
22+
//TODO: write exception text
23+
throw new IllegalStateException();
24+
}
25+
26+
if(entity.getId() != null){
27+
//TODO: write exception text
28+
throw new IllegalArgumentException();
29+
}
30+
31+
Long id;
32+
if(!cache.keySet().isEmpty()){
33+
id = Collections.max(cache.keySet()) + 1;
34+
}
35+
else{
36+
id = 1L;
37+
}
38+
39+
cache.put(id, entity);
40+
entity.setId(id);
41+
42+
return entity;
43+
}
44+
45+
public void delete(T entity) {
46+
if(cache == null){
47+
//TODO: write exception text
48+
throw new IllegalStateException();
49+
}
50+
51+
if(entity.getId() == null){
52+
//TODO: write exception text
53+
throw new IllegalArgumentException();
54+
}
55+
56+
cache.remove(entity.getId());
57+
}
58+
59+
public T update(T entity) {
60+
if(cache == null){
61+
//TODO: write exception text
62+
throw new IllegalStateException();
63+
}
64+
65+
if(entity.getId() == null){
66+
//TODO: write exception text
67+
throw new IllegalArgumentException();
68+
}
69+
70+
cache.put(entity.getId(), entity);
71+
72+
return entity;
73+
}
74+
75+
public T getById(Long id) {
76+
if(cache == null){
77+
//TODO: write exception text
78+
throw new IllegalStateException();
79+
}
80+
81+
if(id == null){
82+
//TODO: write exception text
83+
throw new IllegalArgumentException();
84+
}
85+
86+
return cache.get(id);
87+
}
88+
89+
}

my-maps-webapp/src/main/java/cz/muni/fi/pv243/mymaps/dao/impl/PointDaoImpl.java renamed to my-maps-datalayer/src/main/java/cz/muni/fi/pv243/mymaps/dao/impl/PointDaoImpl.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
import cz.muni.fi.pv243.mymaps.dao.GenericDao;
55
import cz.muni.fi.pv243.mymaps.dao.PointDao;
66
import cz.muni.fi.pv243.mymaps.entities.PointEntity;
7-
import cz.muni.fi.pv243.mymaps.webapp.session.CacheContainerProvider;
8-
import java.io.IOException;
97
import javax.annotation.PostConstruct;
10-
import javax.inject.Inject;
118

129
/**
1310
*

0 commit comments

Comments
 (0)