Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dwh-api
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AKTIN
dwh-api
Commits
c1a17f27
Commit
c1a17f27
authored
Apr 28, 2016
by
R.W.Majeed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JAXB implementation of query
parent
d35accb8
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
500 additions
and
4 deletions
+500
-4
README.md
README.md
+82
-1
TODO.txt
TODO.txt
+12
-0
pom.xml
pom.xml
+24
-3
src/main/java/org/aktin/exchange/AbstractConcept.java
src/main/java/org/aktin/exchange/AbstractConcept.java
+14
-0
src/main/java/org/aktin/exchange/Principal.java
src/main/java/org/aktin/exchange/Principal.java
+37
-0
src/main/java/org/aktin/exchange/Query.java
src/main/java/org/aktin/exchange/Query.java
+56
-0
src/main/java/org/aktin/exchange/QueryRequest.java
src/main/java/org/aktin/exchange/QueryRequest.java
+62
-0
src/main/java/org/aktin/exchange/QuerySchedule.java
src/main/java/org/aktin/exchange/QuerySchedule.java
+23
-0
src/main/java/org/aktin/exchange/RawConcept.java
src/main/java/org/aktin/exchange/RawConcept.java
+8
-0
src/main/java/org/aktin/exchange/RepeatedExecution.java
src/main/java/org/aktin/exchange/RepeatedExecution.java
+22
-0
src/main/java/org/aktin/exchange/Signature.java
src/main/java/org/aktin/exchange/Signature.java
+26
-0
src/main/java/org/aktin/exchange/SingleExecution.java
src/main/java/org/aktin/exchange/SingleExecution.java
+23
-0
src/main/java/org/aktin/exchange/XMLConstants.java
src/main/java/org/aktin/exchange/XMLConstants.java
+9
-0
src/main/java/org/aktin/exchange/package-info.java
src/main/java/org/aktin/exchange/package-info.java
+24
-0
src/main/java/org/aktin/xml/DurationAdapter.java
src/main/java/org/aktin/xml/DurationAdapter.java
+26
-0
src/main/java/org/aktin/xml/InstantAdapter.java
src/main/java/org/aktin/xml/InstantAdapter.java
+26
-0
src/main/java/org/aktin/xml/PeriodAdapter.java
src/main/java/org/aktin/xml/PeriodAdapter.java
+26
-0
No files found.
README.md
View file @
c1a17f27
Common API for the AKTIN data warehouse
\ No newline at end of file
Common API for the AKTIN data warehouse
---------------------------------------
Generate XSD files:
```
"$JAVA_HOME"/bin/schemagen -d target -cp target/classes org.aktin.exchange.Query
```
Query exchange
--------------
```
<request>
<id>unique request id</id>
<date-reference>2016-04-11</date-reference>
<published>
<query>
<id>unique query id</id>
<description>
</description>
<principal>
<name></name>
<organisation></organisation>
<location></location>
<email></email>
<phone></phone>
<url></url>
</principal>
<schedule type="single|repeating|benchmark">
<duration>-P1Y</duration>
<interval>P1Y</interval>
</schedule>
<concepts>
<concept id="CEDIS30:XXX" type="raw"/>
<concept id="XXX1" type="aggregate">
<count group-by="fact.value">
</concept>
<concept id="XXX1" type="aggregate">
<!-- by arrival time -->
<count group-by="substr(8,10,fact.start)">
<max/>
<min/>
</concept>
</concepts>
<definition xsi:type="sql">
</definition>
</query>
<signature from="broker" algorithm="SHA256withRSA">...</signature>
<signature from="me" algorithm="SHA256withRSA">...</signature>
<broker>
<last-modified>max timestamp der nachfolgenden</last-modified>
<!-- timestamp the query was published by the broker -->
<published>2015-12-01T18:30:14</published>
<!-- later, the query can be either canceled or closed -->
<closed>2015-12-02T18:30:00</closed>
<canceled>2015-12-02T18:30:14</canceled>
</broker>
</query>
<request-status ref="123">
<last-modified>max timestampt der nachfolgenden</last-modified>
<received>XXXtimestamp</received>
<confirmation method="single|double|automatic">xxx</confirmation>
<!-- confirmation or rejection -->
<rejected></rejected>
<comment></comment>
<last-execution>
<completed>XXXtimestamp</completed>
<failed></failed>
</last-execution>
<last-contact>
<result-submitted>XXX timestamp</result-submitted>
</request-status>
<query-result id-ref="">
</query-result>
```
TODO.txt
0 → 100644
View file @
c1a17f27
Error in maven schemagen:
Post error in maven schemagen:
Should not convert spaces to %20:
schemagen -encoding UTF-8 -d D:\Users\marap1\Projects\2014-09 AKTIN\repo-v2\aktin\dwh-api\target\schemagen-work\compile_scope -classpath /D:/Users/marap1/Projects/2014-09%20AKTIN/repo-v2/aktin/dwh-api/src/main/java/ -episode D:\Users\marap1\Projects\2014-09 AKTIN\repo-v2\aktin\dwh-api\target\generated-resources\schemagen\META-INF\sun-jaxb.episode src\main\java\org\aktin\exchange\AbstractConcept.java src\main\java\org\aktin\exchange\Principal.java src\main\java\org\aktin\exchange\Query.java src\main\java\org\aktin\exchange\RawConcept.java src\main\java\org\aktin\exchange\XMLConstants.java src\main\java\org\aktin\exchange\package-info.java
https://github.com/mojohaus/jaxb2-maven-plugin/issues/
pom.xml
View file @
c1a17f27
...
...
@@ -12,16 +12,37 @@
<version>
0.1-SNAPSHOT
</version>
</parent>
<build>
<!--
<resources>
<resource>
<directory>
src/main/resources
</directory>
</resource>
<resource>
<directory>
target/generated-resources
</directory>
</resource>
</resources>
-->
<plugins>
<plugin>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
jaxb2-maven-plugin
</artifactId>
<version>
2.2
</version>
<executions>
<execution>
<id>
schemagen
</id>
<goals>
<goal>
schemagen
</goal>
</goals>
</execution>
</executions>
<configuration>
<locale>
en
</locale>
<sources>
<source>
src/main/java/org/aktin/exchange
</source>
</sources>
</configuration>
</plugin>
</plugins>
</build>
</build>
<dependencies>
<!-- unit tests -->
<dependency>
...
...
src/main/java/org/aktin/exchange/AbstractConcept.java
0 → 100644
View file @
c1a17f27
package
org.aktin.exchange
;
import
javax.xml.bind.annotation.XmlAttribute
;
import
javax.xml.bind.annotation.XmlSeeAlso
;
@XmlSeeAlso
({
RawConcept
.
class
})
public
abstract
class
AbstractConcept
{
/**
* Unique identifier of the concept.
*/
@XmlAttribute
public
String
id
;
}
src/main/java/org/aktin/exchange/Principal.java
0 → 100644
View file @
c1a17f27
package
org.aktin.exchange
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
/**
* Principal of a query.
* @author R.W.Majeed
*
*/
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
Principal
{
/**
* Principal's full name
*/
@XmlElement
(
required
=
true
)
public
String
name
;
/**
* Principal's organisation
*/
@XmlElement
(
required
=
true
)
public
String
organisation
;
@XmlElement
(
required
=
true
)
public
String
email
;
@XmlElement
(
required
=
true
)
public
String
phone
;
/**
* Postal address
*/
public
String
address
;
/**
* Web page URL
*/
public
String
url
;
}
src/main/java/org/aktin/exchange/Query.java
0 → 100644
View file @
c1a17f27
package
org.aktin.exchange
;
import
java.util.List
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlElementWrapper
;
import
javax.xml.bind.annotation.XmlRootElement
;
/**
* Query which can be executed in an i2b2
* data warehouse by the AKTIN remote query
* plugin.
*
* @author R.W.Majeed
*
*/
@XmlRootElement
@XmlAccessorType
(
XmlAccessType
.
NONE
)
public
class
Query
{
/**
* Unique identifier for this query. This identifier
* will not change, even if a query scheduled for repeated
* executions.
*/
@XmlElement
(
required
=
true
)
public
String
id
;
/**
* Human readable description of the query.
*/
@XmlElement
(
required
=
true
)
public
String
description
;
/**
* Contact for inquiries and further
* information about the query and research
* project.
*/
@XmlElement
(
required
=
true
)
public
Principal
principal
;
/**
* Execution schedule for the query. For now,
* only {@link SingleExecution} and {@link RepeatedExecution}
* are supported.
*/
@XmlElement
(
required
=
true
)
public
QuerySchedule
schedule
;
@XmlElementWrapper
(
name
=
"concepts"
,
required
=
true
)
@XmlElement
(
name
=
"concept"
,
required
=
true
)
public
List
<
AbstractConcept
>
concepts
;
}
src/main/java/org/aktin/exchange/QueryRequest.java
0 → 100644
View file @
c1a17f27
package
org.aktin.exchange
;
import
java.time.Instant
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlRootElement
;
@XmlRootElement
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
QueryRequest
{
/**
* Unique id for the query request.
* This id will always be unique and different
* for multiple (e.g. recurring) requests for
* the same query.
* The id is given by the broker.
*/
@XmlElement
(
required
=
true
)
String
id
;
/**
* Date reference for recurring queries. A recurring
* query may be requested once per month. The reference
* date will then be used to determine the time frame
* for the query. In other words, the reference date is used
* to fill a placeholder in the recurring query.
*/
@XmlElement
(
required
=
false
)
Instant
referenceDate
;
/**
* Time stamp when the request was published at the query broker.
*/
Instant
published
;
/**
* Due date until which the query results have to be submitted.
*/
Instant
deadline
;
/**
* Date when the request was closed by the query broker. While
* this date is unset/null, results can be sumitted at any time.
*/
Instant
closed
;
/**
* Date when the request was canceled. This indicates abnormal
* or unsuccessful termination of the request.
* A request can not be closed and canceled at the same time.
*/
Instant
canceled
;
/**
* Query to execute
*/
@XmlElement
(
required
=
true
)
Query
query
;
@XmlElement
(
name
=
"signature"
,
required
=
false
)
Signature
[]
signatures
;
}
src/main/java/org/aktin/exchange/QuerySchedule.java
0 → 100644
View file @
c1a17f27
package
org.aktin.exchange
;
import
java.time.Period
;
import
javax.xml.bind.annotation.XmlElement
;
import
javax.xml.bind.annotation.XmlSeeAlso
;
/**
* Abstract query schedule
* @author R.W.Majeed
*
*/
@XmlSeeAlso
({
SingleExecution
.
class
,
RepeatedExecution
.
class
})
public
abstract
class
QuerySchedule
{
/**
* Duration for the query. The duration is relative
* to the {@link #reference} timestamp and might also be negative.
*/
@XmlElement
(
required
=
true
)
public
Period
duration
;
}
src/main/java/org/aktin/exchange/RawConcept.java
0 → 100644
View file @
c1a17f27
package
org.aktin.exchange
;
import
javax.xml.bind.annotation.XmlType
;
@XmlType
(
name
=
"raw"
)
public
class
RawConcept
extends
AbstractConcept
{
}
src/main/java/org/aktin/exchange/RepeatedExecution.java
0 → 100644
View file @
c1a17f27
package
org.aktin.exchange
;
import
java.time.Duration
;
/**
* Repeated execution schedule for a query.
*
* The repeated execution does not contain a reference timestamp. Instead, the reference
* timestamp is provided by the query request from the broker.
*
* @author R.W.Majeed
*
*/
public
class
RepeatedExecution
extends
QuerySchedule
{
/**
* Estimated repeating interval. Only positive periods allowed.
* This property will not cause any execution on the data warehouse side.
* It is solely for information purposes.
*/
public
Duration
repeats
;
}
src/main/java/org/aktin/exchange/Signature.java
0 → 100644
View file @
c1a17f27
package
org.aktin.exchange
;
import
javax.xml.bind.annotation.XmlAttribute
;
import
javax.xml.bind.annotation.XmlValue
;
/**
* Signature during query exchange
*
* @author R.W.Majeed
*
*/
public
class
Signature
{
/** Signature author */
@XmlAttribute
String
from
;
/** Signature algorithm */
@XmlAttribute
String
algorithm
;
@XmlValue
byte
[]
value
;
// TODO add code to verify content
}
src/main/java/org/aktin/exchange/SingleExecution.java
0 → 100644
View file @
c1a17f27
package
org.aktin.exchange
;
import
java.time.Instant
;
import
javax.xml.bind.annotation.XmlElement
;
/**
* Single execution schedule for a query.
*
* A reference time stamp is provided.
*
* @author R.W.Majeed
*
*/
public
class
SingleExecution
extends
QuerySchedule
{
/**
* Reference time stamp for queries. If
*/
@XmlElement
(
required
=
false
)
public
Instant
reference
;
}
src/main/java/org/aktin/exchange/XMLConstants.java
0 → 100644
View file @
c1a17f27
package
org.aktin.exchange
;
import
javax.xml.bind.annotation.XmlTransient
;
@XmlTransient
public
class
XMLConstants
{
public
static
final
String
XML_NAMESPACE
=
"http://aktin.org/ns/exchange"
;
}
src/main/java/org/aktin/exchange/package-info.java
0 → 100644
View file @
c1a17f27
/**
* Interfaces for the AKTIN data exchange.
* Requests for query executions, query definitions,
* query responses.
*
* @author R.W.Majeed
*
*/
@XmlSchema
(
namespace
=
XMLConstants
.
XML_NAMESPACE
,
elementFormDefault
=
XmlNsForm
.
QUALIFIED
,
xmlns
=
{
@XmlNs
(
prefix
=
"xsi"
,
namespaceURI
=
javax
.
xml
.
XMLConstants
.
W3C_XML_SCHEMA_INSTANCE_NS_URI
)
//"http://www.w3.org/2001/XMLSchema-instance"
}
)
@javax
.
xml
.
bind
.
annotation
.
adapters
.
XmlJavaTypeAdapters
({
@javax
.
xml
.
bind
.
annotation
.
adapters
.
XmlJavaTypeAdapter
(
type
=
java
.
time
.
Duration
.
class
,
value
=
org
.
aktin
.
xml
.
DurationAdapter
.
class
),
@javax
.
xml
.
bind
.
annotation
.
adapters
.
XmlJavaTypeAdapter
(
type
=
java
.
time
.
Period
.
class
,
value
=
org
.
aktin
.
xml
.
PeriodAdapter
.
class
),
@javax
.
xml
.
bind
.
annotation
.
adapters
.
XmlJavaTypeAdapter
(
type
=
java
.
time
.
Instant
.
class
,
value
=
org
.
aktin
.
xml
.
InstantAdapter
.
class
)
})
package
org.aktin.exchange
;
import
javax.xml.bind.annotation.*
;
\ No newline at end of file
src/main/java/org/aktin/xml/DurationAdapter.java
0 → 100644
View file @
c1a17f27
package
org.aktin.xml
;
import
java.time.Duration
;
import
javax.xml.bind.annotation.adapters.XmlAdapter
;
/**
* JAXB adapter for processing java.time.Duration.
* This can be removed later on when native support is added to the JAXB implementation
*
*/
public
class
DurationAdapter
extends
XmlAdapter
<
String
,
Duration
>{
@Override
public
String
marshal
(
Duration
v
)
throws
Exception
{
if
(
v
==
null
)
return
null
;
else
return
v
.
toString
();
}
@Override
public
Duration
unmarshal
(
String
v
)
throws
Exception
{
if
(
v
==
null
)
return
null
;
else
return
Duration
.
parse
(
v
);
}
}
\ No newline at end of file
src/main/java/org/aktin/xml/InstantAdapter.java
0 → 100644
View file @
c1a17f27
package
org.aktin.xml
;
import
java.time.Instant
;
import
javax.xml.bind.annotation.adapters.XmlAdapter
;
/**
* JAXB adapter for processing java.time.Instant.
* This can be removed later on when native support is added to the JAXB implementation
*
*/
public
class
InstantAdapter
extends
XmlAdapter
<
String
,
Instant
>{
@Override
public
Instant
unmarshal
(
String
v
)
throws
Exception
{
if
(
v
==
null
)
return
null
;
else
return
Instant
.
parse
(
v
);
}
@Override
public
String
marshal
(
Instant
v
)
throws
Exception
{
if
(
v
==
null
)
return
null
;
else
return
v
.
toString
();
}
}
\ No newline at end of file
src/main/java/org/aktin/xml/PeriodAdapter.java
0 → 100644
View file @
c1a17f27
package
org.aktin.xml
;
import
java.time.Period
;
import
javax.xml.bind.annotation.adapters.XmlAdapter
;
/**
* JAXB adapter for processing java.time.Duration.
* This can be removed later on when native support is added to the JAXB implementation
*
*/
public
class
PeriodAdapter
extends
XmlAdapter
<
String
,
Period
>{
@Override
public
String
marshal
(
Period
v
)
throws
Exception
{
if
(
v
==
null
)
return
null
;
else
return
v
.
toString
();
}
@Override
public
Period
unmarshal
(
String
v
)
throws
Exception
{
if
(
v
==
null
)
return
null
;
else
return
Period
.
parse
(
v
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment