summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java5
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java31
-rw-r--r--BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties2
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java9
-rw-r--r--STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java2
5 files changed, 36 insertions, 13 deletions
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java
index 350925ce..3f64de3d 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java
@@ -154,11 +154,6 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable,
return;
}
-// //TODO factory for SignRequestHandler providing either WebServiceHDISignRequestHandler or ExternalHDIDisplaySignRequestHandler
-// AppletContext ctx = parent.getAppletContext();
-// log.debug("register SignRequestHandler for HashDataURL " + hashDataURL);
-// addRequestHandler(at.gv.egiz.stal.SignRequest.class, new ExternalDisplaySignRequestHandler(ctx, hashDataURL));
-
try {
String sessionId = parent.getMyAppletParameter(BKUApplet.SESSION_ID);
if (sessionId == null) {
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java b/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java
index b0285345..2b5ee7e7 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java
@@ -7,7 +7,11 @@ package at.gv.egiz.stal.impl;
import at.gv.egiz.stal.HashDataInput;
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.io.InputStream;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
*
@@ -15,6 +19,8 @@ import java.io.InputStream;
*/
public class ByteArrayHashDataInput implements HashDataInput {
+ private static final Log log = LogFactory.getLog(ByteArrayHashDataInput.class);
+
protected byte[] hashData;
protected String id;
protected String mimeType;
@@ -30,6 +36,31 @@ public class ByteArrayHashDataInput implements HashDataInput {
this.encoding = encoding;
}
+ /**
+ * caches the hashdata input's stream
+ * @param hdi to be cached
+ */
+ public ByteArrayHashDataInput(HashDataInput hdi) {
+ if (hdi == null) {
+ throw new NullPointerException("HashDataInput not provided.");
+ }
+ InputStream is = hdi.getHashDataInput();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ try {
+ byte[] buffer = new byte[1024];
+ for (int i = is.read(buffer); i > -1; i = is.read(buffer)) {
+ baos.write(buffer, 0, i);
+ }
+ this.hashData = baos.toByteArray();
+ } catch (IOException ex) {
+ log.error("Failed to cache provided HashDataInput: " + ex.getMessage(), ex);
+ this.hashData = new byte[0];
+ }
+ this.id = hdi.getReferenceId();
+ this.mimeType = hdi.getMimeType();
+ this.encoding = hdi.getEncoding();
+ }
+
@Override
public String getReferenceId() {
return id;
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
index d0e4726e..a38e2cf8 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
@@ -35,7 +35,7 @@ message.hashdatalist=<html>{0} Signaturdatenobjekte:</html>
message.retries=<html>Noch {0} Versuch(e)</html>
message.overwrite=<html>M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?</html>
label.pin=<html>{0}:</html>
-label.pinsize=<html>{0} stellig</html>
+label.pinsize=<html>({0} stellig)</html>
button.ok=OK
button.cancel=Abbrechen
button.back=Zur\u00FCck
diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java
index 03c7c601..7f4a9273 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java
@@ -32,7 +32,6 @@ import at.gv.egiz.stal.service.types.QuitRequestType;
import at.gv.egiz.stal.service.types.RequestType;
import at.gv.egiz.stal.service.types.ResponseType;
import at.gv.egiz.stal.service.types.SignRequestType;
-import at.gv.egiz.stal.util.HashDataInputProxy;
import at.gv.egiz.stal.util.STALTranslator;
import java.util.ArrayList;
import java.util.Collections;
@@ -42,7 +41,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
- * An instance of STALRequestBroker is shared between a producer threads (SLCommand)
+ * An instance of STALRequestBroker is shared between a producer thread (SLCommand)
* and multiple consumer threads (STALService).
* This implementation assures that handleRequest is executed only once the previous invocation returned.
* The BindingProcessor assures that a new SLCommand calls handleRequest() only once
@@ -109,10 +108,8 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
req.setKeyIdentifier(((SignRequest) stalRequest).getKeyIdentifier());
req.setSignedInfo(((SignRequest) stalRequest).getSignedInfo());
requests.add(req);
- for (HashDataInput hdi : ((SignRequest) stalRequest).getHashDataInput()) {
- hashDataInputs.add(new HashDataInputProxy(hdi));
- }
- //hashDataInputs.addAll(((SignRequest) stalRequest).getHashDataInput());
+ //DataObjectHashDataInput with reference caching enabled DataObject
+ hashDataInputs.addAll(((SignRequest) stalRequest).getHashDataInput());
break;
} else if (stalRequest instanceof InfoboxReadRequest) {
log.trace("Received InfoboxReadRequest");
diff --git a/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java b/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java
index dda20968..01d207d2 100644
--- a/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java
+++ b/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java
@@ -13,7 +13,7 @@ import at.gv.egiz.stal.HashDataInput;
/**
* Enables multiple read requests.
- *
+ * @deprecated use at.gv.egiz.stal.impl.ByteArrayHashDataInput
*/
public class HashDataInputProxy implements HashDataInput {