Skip to content

Commit 05f8363

Browse files
author
Johannes Jumpertz
committed
Added base project
1 parent 272fecc commit 05f8363

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+3697
-0
lines changed

.gitignore

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### Maven template
3+
target/
4+
pom.xml.tag
5+
pom.xml.releaseBackup
6+
pom.xml.versionsBackup
7+
pom.xml.next
8+
release.properties
9+
dependency-reduced-pom.xml
10+
buildNumber.properties
11+
.mvn/timing.properties
12+
13+
# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored)
14+
!/.mvn/wrapper/maven-wrapper.jar
15+
### JetBrains template
16+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
17+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
18+
19+
# User-specific stuff
20+
.idea/**/workspace.xml
21+
.idea/**/tasks.xml
22+
.idea/**/dictionaries
23+
.idea/**/shelf
24+
25+
# Sensitive or high-churn files
26+
.idea/**/dataSources/
27+
.idea/**/dataSources.ids
28+
.idea/**/dataSources.local.xml
29+
.idea/**/sqlDataSources.xml
30+
.idea/**/dynamic.xml
31+
.idea/**/uiDesigner.xml
32+
.idea/**/dbnavigator.xml
33+
34+
# Gradle
35+
.idea/**/gradle.xml
36+
.idea/**/libraries
37+
38+
# CMake
39+
cmake-build-debug/
40+
cmake-build-release/
41+
42+
# Mongo Explorer plugin
43+
.idea/**/mongoSettings.xml
44+
45+
# File-based project format
46+
*.iws
47+
48+
# IntelliJ
49+
out/
50+
51+
# mpeltonen/sbt-idea plugin
52+
.idea_modules/
53+
54+
# JIRA plugin
55+
atlassian-ide-plugin.xml
56+
57+
# Cursive Clojure plugin
58+
.idea/replstate.xml
59+
60+
# Crashlytics plugin (for Android Studio and IntelliJ)
61+
com_crashlytics_export_strings.xml
62+
crashlytics.properties
63+
crashlytics-build.properties
64+
fabric.properties
65+
66+
# Editor-based Rest Client
67+
.idea/httpRequests
68+
### Java template
69+
# Compiled class file
70+
*.class
71+
72+
# Log file
73+
*.log
74+
75+
# BlueJ files
76+
*.ctxt
77+
78+
# Mobile Tools for Java (J2ME)
79+
.mtj.tmp/
80+
81+
# Package Files #
82+
*.jar
83+
*.war
84+
*.nar
85+
*.ear
86+
*.zip
87+
*.tar.gz
88+
*.rar
89+
90+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
91+
hs_err_pid*
92+

.idea/RealmDrive.iml

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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+
<modelVersion>4.0.0</modelVersion>
6+
7+
<artifactId>realm-drive</artifactId>
8+
<groupId>net.endrealm</groupId>
9+
<version>0.0.1-PRE</version>
10+
11+
<properties>
12+
<maven.compiler.target>1.8</maven.compiler.target>
13+
<maven.compiler.source>1.8</maven.compiler.source>
14+
</properties>
15+
16+
<dependencies>
17+
<!-- https://mvnrepository.com/artifact/org.mongodb/mongo-java-driver -->
18+
<dependency>
19+
<groupId>org.mongodb</groupId>
20+
<artifactId>mongo-java-driver</artifactId>
21+
<version>3.10.1</version>
22+
<scope>compile</scope>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.projectlombok</groupId>
26+
<artifactId>lombok</artifactId>
27+
<version>1.16.20</version>
28+
<scope>provided</scope>
29+
</dependency>
30+
31+
</dependencies>
32+
<build>
33+
<plugins>
34+
<plugin>
35+
<groupId>org.apache.maven.plugins</groupId>
36+
<artifactId>maven-shade-plugin</artifactId>
37+
<version>3.2.1</version>
38+
<configuration>
39+
<!-- put your configurations here -->
40+
</configuration>
41+
<executions>
42+
<execution>
43+
<phase>package</phase>
44+
<goals>
45+
<goal>shade</goal>
46+
</goals>
47+
</execution>
48+
</executions>
49+
</plugin>
50+
</plugins>
51+
</build>
52+
53+
</project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package net.endrealm.realmdrive.annotations;
2+
3+
import net.endrealm.realmdrive.inst.ConversionHandler;
4+
5+
import java.lang.annotation.ElementType;
6+
import java.lang.annotation.Retention;
7+
import java.lang.annotation.RetentionPolicy;
8+
import java.lang.annotation.Target;
9+
10+
/**
11+
* @author johannesjumpertz
12+
* Used to mark fields to be saved into the drive system. If other objects are linked, they have to be registered as well.
13+
*
14+
* @see ConversionHandler
15+
*/
16+
@Retention(RetentionPolicy.RUNTIME)
17+
@Target(ElementType.FIELD)
18+
public @interface SaveVar {
19+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* @author johannesjumpertz
3+
* Contains all annotations used by the drive system
4+
*/
5+
package net.endrealm.realmdrive.annotations;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package net.endrealm.realmdrive.exceptions;
2+
3+
/**
4+
* @author johannesjumpertz
5+
*
6+
* Exception thrown when an inserted value is not a primitive although it should be
7+
*/
8+
public class NotAPrimitiveTypeException extends Exception {
9+
10+
/**
11+
* Creates a new empty primitive exception
12+
*/
13+
public NotAPrimitiveTypeException() {
14+
super();
15+
}
16+
17+
/**
18+
* Creates a new primitive exception
19+
* @param root root cause that threw this exception
20+
*/
21+
public NotAPrimitiveTypeException(Throwable root) {
22+
super(root);
23+
}
24+
25+
/**
26+
* Creates a new primitive exception
27+
* @param value the value that caused this exception
28+
*/
29+
public NotAPrimitiveTypeException(Object value) {
30+
super(value.toString());
31+
}
32+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package net.endrealm.realmdrive.exceptions;
2+
3+
/**
4+
* @author johannesjumpertz
5+
*
6+
* Thrown if trying to call a write operation on a read only object
7+
*/
8+
public class ObjectReadOnlyException extends Exception {
9+
10+
/**
11+
* Creates a new readonly exception
12+
*/
13+
public ObjectReadOnlyException() {
14+
super("Tried writing to an readonly object");
15+
}
16+
17+
/**
18+
* Creates a new readonly exception
19+
* @param root root cause that threw this exception
20+
*/
21+
public ObjectReadOnlyException(Throwable root) {
22+
super("Tried writing to an readonly object", root);
23+
}
24+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* Additional exceptions thrown
3+
*/
4+
package net.endrealm.realmdrive.exceptions;
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package net.endrealm.realmdrive.factory;
2+
3+
import net.endrealm.realmdrive.exceptions.NotAPrimitiveTypeException;
4+
import net.endrealm.realmdrive.inst.SimpleDriveObject;
5+
import net.endrealm.realmdrive.inst.SimpleElementArray;
6+
import net.endrealm.realmdrive.inst.SimplePrimitiveDriveElement;
7+
import net.endrealm.realmdrive.interfaces.*;
8+
import net.endrealm.realmdrive.interfaces.DriveElement;
9+
import net.endrealm.realmdrive.interfaces.DriveObject;
10+
11+
/**
12+
* @author johannesjumpertz
13+
*
14+
* A factory creating drive object
15+
*
16+
* @see DriveObject
17+
* @see DriveElement
18+
*/
19+
public class DriveObjectFactory {
20+
21+
/**
22+
* The drive service this factory is used by
23+
*/
24+
private DriveService driveService;
25+
26+
/**
27+
* Creates a new drive object factory using the specified {@link DriveService}
28+
* @param driveService the service using the factory
29+
*/
30+
public DriveObjectFactory(DriveService driveService) {
31+
this.driveService = driveService;
32+
}
33+
34+
/**
35+
* Instantiates a new empty {@link DriveObject}
36+
*
37+
* @return a empty {@link DriveObject}
38+
*
39+
* @see SimpleDriveObject
40+
*/
41+
public DriveObject createEmptyObject() {
42+
return new SimpleDriveObject(this);
43+
}
44+
45+
/**
46+
* Creates a new primitive element
47+
*
48+
* @param value value to be contained
49+
* @return null if the value isn't a primitive
50+
*/
51+
public DriveElement createPrimitive(Object value) {
52+
try {
53+
return new SimplePrimitiveDriveElement(value);
54+
} catch (NotAPrimitiveTypeException e) {
55+
e.printStackTrace();
56+
}
57+
return null;
58+
}
59+
60+
public DriveElementArray createEmptyArray() {
61+
return new SimpleElementArray(this);
62+
}
63+
64+
/**
65+
* @return drive service used by this factory
66+
*/
67+
public DriveService getDriveService() {
68+
return driveService;
69+
}
70+
}

0 commit comments

Comments
 (0)