Skip to content

Commit

Permalink
Merge pull request #1 from digidi100/master
Browse files Browse the repository at this point in the history
initial release
  • Loading branch information
Jeroen van der Heijden authored Jun 27, 2018
2 parents 62aeb2f + 3201178 commit 115efb4
Show file tree
Hide file tree
Showing 30 changed files with 2,109 additions and 204 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
# java-siridb-connector
SiriDB Connector for JAVA
# SiriDB Connector for Java

This project is under heavy development and cannot be used
This manual describes how to install and configure SiriDB Connector for Java, a self-contained Java driver for communicating with SiriDB servers, and how to use it for developing database applications.

## Installation

In order to get the connector to work properly, you need to install the Java QPack library. You can find the repository [here](https://github.com/SiriDB/java-siridb-connector). Add this library to your project in your favorite Java IDE.

After you've installed QPack succesfully, you need to install the connector itself. You can grab a copy of the compiled jar file [here](https://github.com/SiriDB/java-siridb-connector/releases/latest) or clone this repository and compile the code yourself. Add this jar file as library to your project as well.

## Example

The code shown in the example makes use of a countDownLatch which waits until requests have been completed. In this case, the connector functions asynchronously and shouldn't block the main thread. The result of the query and insertion will be stored in a blocking queue. This blocking queue waits until the completionHandlers returns a result. This result will be printed afterwards. You may need to replace the input values of the connection if you want to verify this demo. The example can be found [here](example/Example.java).

The example supports a single connection. If you want to support multiple connections at the same time, you can create a Client object. The same methods apply for the Client as for the Connection object. An example of how to create a Client can be found below.

The hostlist is a two dimensional array containing host, port and priority. A higher priority means that there is a higher change that this connection will be chosen. The connection with priority -1 will be always chosen (if it is connected).

```Java
hostlist = new String[][]{{"localhost", "9000", "-1"}, {"localhost", "9001", "5"}, {"localhost", "9002", "1"}, {"localhost", "9003", "2"}};
client = new Client("iris", "siri", "test", hostlist, true);```
73 changes: 73 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="java-siridb-connector" default="default" basedir=".">
<description>Builds, tests, and runs the project java-siridb-connector.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="java-siridb-connector-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>
4 changes: 4 additions & 0 deletions build/built-jar.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#Tue, 26 Jun 2018 13:48:29 +0200


/home/tristan/NetBeansProjects/java-siridb-connector=
Empty file.
Empty file.
6 changes: 6 additions & 0 deletions build/classes/transceptor/technology/Connection.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
transceptor.technology.CompletionStore
transceptor.technology.Connection$1
transceptor.technology.Connection
transceptor.technology.Connection$2
transceptor.technology.Connection$3
transceptor.technology.Connection$4
15 changes: 15 additions & 0 deletions build/classes/transceptor/technology/Exceptions.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
transceptor.technology.UserAuthError
transceptor.technology.QueryError
transceptor.technology.QueryErrorException
transceptor.technology.ServerError
transceptor.technology.ServerErrorException
transceptor.technology.PoolErrorException
transceptor.technology.InsertErrorException
transceptor.technology.UserAuthErrorException
transceptor.technology.InvalidPackageException
transceptor.technology.InvalidPackage
transceptor.technology.AuthenticationError
transceptor.technology.InsertError
transceptor.technology.PoolError
transceptor.technology.AuthenticationErrorException
transceptor.technology.CorruptPackage
Empty file.
Empty file.
32 changes: 32 additions & 0 deletions dist/README.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
========================
BUILD OUTPUT DESCRIPTION
========================

When you build an Java application project that has a main class, the IDE
automatically copies all of the JAR
files on the projects classpath to your projects dist/lib folder. The IDE
also adds each of the JAR files to the Class-Path element in the application
JAR files manifest file (MANIFEST.MF).

To run the project from the command line, go to the dist folder and
type the following:

java -jar "java-siridb-connector.jar"

To distribute this project, zip up the dist folder (including the lib folder)
and distribute the ZIP file.

Notes:

* If two JAR files on the project classpath have the same name, only the first
JAR file is copied to the lib folder.
* Only JAR files are copied to the lib folder.
If the classpath contains other types of files or folders, these files (folders)
are not copied.
* If a library on the projects classpath also has a Class-Path element
specified in the manifest,the content of the Class-Path element has to be on
the projects runtime path.
* To set a main class in a standard Java project, right-click the project node
in the Projects window and choose Properties. Then click Run and enter the
class name in the Main Class field. Alternatively, you can manually type the
class name in the manifest Main-Class element.
3 changes: 3 additions & 0 deletions manifest.mf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

Loading

0 comments on commit 115efb4

Please sign in to comment.