aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web-statistic-api
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2015-02-23 11:27:59 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2015-02-23 11:27:59 +0100
commit4973b940cc8ce0885653ed7c0223cbedd3dde3bc (patch)
treed711ed5b272631c9a24cd346a19e2c0b6426f83e /pdf-as-web-statistic-api
parentfee3c9a59945a2ee74029dfe63c074c753a51dbf (diff)
downloadpdf-as-4-4973b940cc8ce0885653ed7c0223cbedd3dde3bc.tar.gz
pdf-as-4-4973b940cc8ce0885653ed7c0223cbedd3dde3bc.tar.bz2
pdf-as-4-4973b940cc8ce0885653ed7c0223cbedd3dde3bc.zip
added Statistics Facilities to PDF-AS Web
Diffstat (limited to 'pdf-as-web-statistic-api')
-rw-r--r--pdf-as-web-statistic-api/build.gradle39
-rw-r--r--pdf-as-web-statistic-api/src/main/java/at/gv/egiz/pdfas/web/stats/StatisticBackend.java6
-rw-r--r--pdf-as-web-statistic-api/src/main/java/at/gv/egiz/pdfas/web/stats/StatisticEvent.java206
3 files changed, 251 insertions, 0 deletions
diff --git a/pdf-as-web-statistic-api/build.gradle b/pdf-as-web-statistic-api/build.gradle
new file mode 100644
index 00000000..5de4630a
--- /dev/null
+++ b/pdf-as-web-statistic-api/build.gradle
@@ -0,0 +1,39 @@
+apply plugin: 'java'
+apply plugin: 'war'
+apply plugin: 'eclipse'
+apply plugin: 'java-library-distribution'
+
+jar {
+ manifest {
+ attributes 'Implementation-Title': 'PDF-AS-4 Web Statistic Library', 'JARMANIFEST': 'PDF-AS-LIB'
+ }
+}
+
+repositories {
+ mavenLocal()
+ mavenCentral()
+}
+
+configurations { providedCompile }
+
+sourceSets.main.compileClasspath += configurations.providedCompile
+sourceSets.test.compileClasspath += configurations.providedCompile
+sourceSets.test.runtimeClasspath += configurations.providedCompile
+
+dependencies {
+ compile group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
+ compile 'org.apache.commons:commons-lang3:3.3.2'
+ testCompile group: 'junit', name: 'junit', version: '4.+'
+}
+
+task releases(type: Copy) {
+ from jar.outputs
+ from distZip.outputs
+ from distTar.outputs
+ into rootDir.toString() + "/releases/" + version
+}
+
+releases.dependsOn jar
+releases.dependsOn sourcesJar
+releases.dependsOn distZip
+releases.dependsOn distTar
diff --git a/pdf-as-web-statistic-api/src/main/java/at/gv/egiz/pdfas/web/stats/StatisticBackend.java b/pdf-as-web-statistic-api/src/main/java/at/gv/egiz/pdfas/web/stats/StatisticBackend.java
new file mode 100644
index 00000000..0d38f2d7
--- /dev/null
+++ b/pdf-as-web-statistic-api/src/main/java/at/gv/egiz/pdfas/web/stats/StatisticBackend.java
@@ -0,0 +1,6 @@
+package at.gv.egiz.pdfas.web.stats;
+
+public interface StatisticBackend {
+ public String getName();
+ public void storeEvent(StatisticEvent statisticEvent);
+}
diff --git a/pdf-as-web-statistic-api/src/main/java/at/gv/egiz/pdfas/web/stats/StatisticEvent.java b/pdf-as-web-statistic-api/src/main/java/at/gv/egiz/pdfas/web/stats/StatisticEvent.java
new file mode 100644
index 00000000..b1c5de11
--- /dev/null
+++ b/pdf-as-web-statistic-api/src/main/java/at/gv/egiz/pdfas/web/stats/StatisticEvent.java
@@ -0,0 +1,206 @@
+package at.gv.egiz.pdfas.web.stats;
+
+import java.util.Date;
+
+
+/**
+ * Timestamp; [Der Zeitpunkt des Signaturvorgangs]
+Operation; [Die Operation des Signaturvorgangs (SIGN | VERIFY) ]
+Signaturemode; [Der Siganturemode (BINARY | TEXTUAL) default BINARY]
+Device; [Das Signaturgeraet (bku (lokale BKU) | moa (configured moa instance) | moc (online bku MOCCA) | mobile (Handy Signatur))]
+ProfileId; [Das verwendete Signaturprofil ein Beispiel waere: SIGNATURBLOCK_DE]
+Filesize; [Die Dateigroesse des PDF Dokuments]
+User Agent; [Der User-Agent (wenn verfuegbar)]
+Status; [Der Status der Operation: (OK | ERROR)]
+Exception Class; [Exception Klasse falls ein Fehler vorliegt]
+ErrorCode; [Exception Code falls ein Fehler vorliegt]
+External Errorcode; [Exception Code von externer Componente falls vorhanden]
+Duration [Verbrauchte Zeit fuer diese Operation in Millisekunden, wenn feststellbar]
+ * @author Andreas Fitzek
+ *
+ */
+public class StatisticEvent {
+
+ public enum Operation {
+ SIGN("sign"),
+ VERIFY("verify");
+
+ private String name;
+
+ private Operation(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+ }
+
+ public enum Source {
+ WEB("web"),
+ SOAP("soap");
+
+ private String name;
+
+ private Source(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+ }
+
+ public enum Status {
+ OK("ok"),
+ ERROR("error");
+
+ private String name;
+
+ private Status(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+ }
+
+ private long timestamp;
+ private Operation operation;
+ private String device;
+ private String profileId;
+ private long filesize;
+ private String userAgent;
+ private Status status;
+ private Throwable exception;
+ private long errorCode;
+ private long start;
+ private long end;
+ private Source source;
+ private boolean logged = false;
+
+ public StatisticEvent() {
+
+ }
+
+ public long getStart() {
+ return start;
+ }
+
+ public void setStart(long start) {
+ this.start = start;
+ }
+
+ public void setStartNow() {
+ this.start = (new Date()).getTime();
+ }
+
+ public long getEnd() {
+ return end;
+ }
+
+ public void setEnd(long end) {
+ this.end = end;
+ }
+
+ public void setEndNow() {
+ this.end = (new Date()).getTime();
+ }
+
+ public Source getSource() {
+ return source;
+ }
+
+ public void setSource(Source source) {
+ this.source = source;
+ }
+
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(long timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public void setTimestampNow() {
+ this.timestamp = (new Date()).getTime();
+ }
+
+ public Operation getOperation() {
+ return operation;
+ }
+
+ public void setOperation(Operation operation) {
+ this.operation = operation;
+ }
+
+ public String getDevice() {
+ return device;
+ }
+
+ public void setDevice(String device) {
+ this.device = device;
+ }
+
+ public String getProfileId() {
+ return profileId;
+ }
+
+ public void setProfileId(String profileId) {
+ this.profileId = profileId;
+ }
+
+ public long getFilesize() {
+ return filesize;
+ }
+
+ public void setFilesize(long filesize) {
+ this.filesize = filesize;
+ }
+
+ public String getUserAgent() {
+ return userAgent;
+ }
+
+ public void setUserAgent(String userAgent) {
+ this.userAgent = userAgent;
+ }
+
+ public Status getStatus() {
+ return status;
+ }
+
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+
+ public Throwable getException() {
+ return exception;
+ }
+
+ public void setException(Throwable exception) {
+ this.exception = exception;
+ }
+
+ public long getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(long errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ public long getDuration() {
+ return this.end - this.start;
+ }
+
+ public boolean isLogged() {
+ return logged;
+ }
+
+ public void setLogged(boolean logged) {
+ this.logged = logged;
+ }
+}