diff options
author | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-10-01 08:30:42 +0000 |
---|---|---|
committer | tkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459> | 2012-10-01 08:30:42 +0000 |
commit | e48b7b84c057762ce8e8fa43d26814711752d399 (patch) | |
tree | 5c8ffa8be515ebdbd050088a3622ff2dd27a6cab /trunk | |
parent | 5ef8c7dd57907a9905760dbe2084e71b5750f610 (diff) | |
download | pdf-over-e48b7b84c057762ce8e8fa43d26814711752d399.tar.gz pdf-over-e48b7b84c057762ce8e8fa43d26814711752d399.tar.bz2 pdf-over-e48b7b84c057762ce8e8fa43d26814711752d399.zip |
Fixed some TODOs...
git-svn-id: https://svn.iaik.tugraz.at/svn/egiz/prj/current/12PDF-OVER-4.0@12538 3a0b52a2-8410-0410-bc02-ff6273a87459
Diffstat (limited to 'trunk')
27 files changed, 148 insertions, 99 deletions
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java index 0e78e507..d95bb466 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ConfigurationComposite.java @@ -50,12 +50,13 @@ import org.eclipse.swt.layout.FormAttachment; public class ConfigurationComposite extends StateComposite { /** - * + * Configuration Mode selection listener */ private final class ConfigurationModeSelectionListener implements SelectionListener { + /** - * + * Constructor */ public ConfigurationModeSelectionListener() { // Nothing to do @@ -100,22 +101,50 @@ public class ConfigurationComposite extends StateComposite { private static final Logger log = LoggerFactory .getLogger(ConfigurationComposite.class); + /** + * configuration manipulator + */ ConfigManipulator configManipulator = null; + /** + * configuration provider + */ ConfigProvider configProvider = null; + /** + * current base configuration composite + */ BaseConfigurationComposite configComposite; + /** + * configuration container + * Keeps state for current configuration changes + */ ConfigurationContainer configurationContainer = new ConfigurationContainerImpl(); + /** + * The stack layout + */ StackLayout compositeStack = new StackLayout(); + /** + * SWT style + */ int style; + /** + * base configuration container + */ Composite containerComposite; + /** + * checks wether the user is done + */ boolean userDone = false; + /** + * Button advanced + */ Button btnAdvanced; /** diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java index afa7be3e..8146a02d 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/DataSourceSelectComposite.java @@ -195,7 +195,7 @@ public class DataSourceSelectComposite extends StateComposite { } }); - final Label lbl_drag = new Label(this.drop_area, SWT.NONE | SWT.RESIZE); + final Label lbl_drag = new Label(this.drop_area, SWT.NONE | SWT.RESIZE ); this.fd_lbl_drag = new FormData(); this.fd_lbl_drag.left = new FormAttachment(0, 10); this.fd_lbl_drag.right = new FormAttachment(100, -10); diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ErrorComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ErrorComposite.java index f8a6fbcb..c85d046e 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ErrorComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/ErrorComposite.java @@ -114,7 +114,7 @@ public class ErrorComposite extends StateComposite { */ @Override public void doLayout() { - // TODO Auto-generated method stub + // Nothing to do } } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java index 595ca1bd..6552c3d5 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java @@ -99,8 +99,7 @@ public class MobileBKUEnterNumberComposite extends StateComposite { */ @Override public void widgetDefaultSelected(SelectionEvent e) { - // TODO Auto-generated method stub - + // Nothing to do here } } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java index 95184775..ff8d5c63 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterTANComposite.java @@ -61,8 +61,6 @@ public class MobileBKUEnterTANComposite extends StateComposite { return; } - // TODO: Check TAN! - MobileBKUEnterTANComposite.this.tan = tan; MobileBKUEnterTANComposite.this.setUserAck(true); MobileBKUEnterTANComposite.this.state.updateStateMachine(); @@ -227,8 +225,7 @@ public class MobileBKUEnterTANComposite extends StateComposite { */ @Override public void doLayout() { - // TODO Auto-generated method stub - + // Nothing to do } } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java index 26e5480c..afa2a2e7 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/OutputComposite.java @@ -32,6 +32,7 @@ import org.eclipse.swt.widgets.FileDialog; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.workflow.states.State; import at.asit.pdfover.signator.DocumentSource; @@ -116,7 +117,9 @@ public class OutputComposite extends StateComposite { return; } } else { - // TODO: Handle exception ... + log.error("OutputComposite:OpenSelectionListener:widgetSelected -> source is null!!"); //$NON-NLS-1$ + ErrorDialog dialog = new ErrorDialog(getShell(), SWT.NONE, "Failed to get signed document.", ""); + dialog.open(); } } catch (Exception ex) { log.error("OpenSelectionListener: ", ex); //$NON-NLS-1$ @@ -200,8 +203,7 @@ public class OutputComposite extends StateComposite { */ @Override public void doLayout() { - // TODO Auto-generated method stub - + // Nothing to do } } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java index 3830d6cf..a0977b9e 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SimpleConfigurationComposite.java @@ -54,6 +54,7 @@ import org.eclipse.swt.widgets.Text; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.controls.ErrorMarker; import at.asit.pdfover.gui.exceptions.InvalidEmblemFile; import at.asit.pdfover.gui.exceptions.InvalidNumberException; @@ -75,7 +76,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { * */ public ImageFileBrowser() { - // TODO Auto-generated constructor stub + // Nothing to do } @Override @@ -224,8 +225,9 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { // String filename = this.txtEmblemFile.getText(); plainEmblemSetter(filename); } catch (Exception ex) { - // TODO: Show error message! log.error("processEmblemChanged: ", ex); //$NON-NLS-1$ + ErrorDialog dialog = new ErrorDialog(getShell(), SWT.NONE, "Failed to load the emblem", ex); + dialog.open(); } } @@ -244,7 +246,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.txtMobileNumberErrorMarker.setVisible(false); plainMobileNumberSetter(); } catch (Exception ex) { - // TODO: Show error message! this.txtMobileNumberErrorMarker.setVisible(true); this.txtMobileNumberErrorMarker .setToolTipText("Phone number is invalid! Please provide in the form: +43676123456789"); @@ -271,7 +272,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.proxyHostErrorMarker.setVisible(false); plainProxyHostSetter(); } catch (Exception ex) { - // TODO: Show error message! this.proxyHostErrorMarker.setVisible(true); this.proxyHostErrorMarker.setToolTipText(ex.getMessage()); log.error("processProxyHost: ", ex); //$NON-NLS-1$ @@ -291,7 +291,6 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.txtProxyPortErrorMarker.setVisible(false); plainProxyPortSetter(); } catch (Exception ex) { - // TODO: Show error message! this.txtProxyPortErrorMarker.setVisible(true); this.txtProxyPortErrorMarker.setToolTipText(ex.getMessage()); log.error("processProxyPort: ", ex); //$NON-NLS-1$ @@ -513,8 +512,7 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { SimpleConfigurationComposite.this.configurationContainer .setEmblem(null); } catch (InvalidEmblemFile e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); + log.error("THIS EXCEPTION IS IMPOSSIBLE! ", e1); //$NON-NLS-1$ } } } @@ -729,8 +727,9 @@ public class SimpleConfigurationComposite extends BaseConfigurationComposite { this.setEmblemFileInternal(emblemFile, true); this.btnUseImage.setSelection(true); } catch (Exception e1) { - // TODO Auto-generated catch block log.error("Failed to load emblem: ", e1); //$NON-NLS-1$ + ErrorDialog dialog = new ErrorDialog(getShell(), SWT.NONE, "Failed to load emblem.", e1); + dialog.open(); } } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java index 37e4f85b..45a8d230 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarButton.java @@ -17,17 +17,12 @@ package at.asit.pdfover.gui.controls; // Imports import org.eclipse.swt.SWT; -import org.eclipse.swt.events.MouseAdapter; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseListener; -import org.eclipse.swt.events.MouseMoveListener; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.graphics.Region; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Composite; @@ -37,7 +32,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * + * Main Bar Button implementation */ public abstract class MainBarButton extends Canvas { /** @@ -100,15 +95,16 @@ public abstract class MainBarButton extends Canvas { private Image image = null; /** - * @return the imgage + * Gets the image + * @return the image */ public Image getImage() { return this.image; } /** - * @param imgage - * the imgage to set + * Sets the Image + * @param image the imgage to set */ public void setImage(Image image) { this.image = image; @@ -140,6 +136,7 @@ public abstract class MainBarButton extends Canvas { } /** + * Gets the button text * @return the text */ public String getText() { @@ -147,8 +144,8 @@ public abstract class MainBarButton extends Canvas { } /** - * @param text - * the text to set + * Sets the text for the button + * @param text the text to set */ public void setText(String text) { this.text = text; @@ -157,9 +154,15 @@ public abstract class MainBarButton extends Canvas { /** * SLF4J Logger instance **/ + @SuppressWarnings("unused") private static final Logger log = LoggerFactory .getLogger(MainBarButton.class); + /** + * Paint 3D style borders + * + * @param e + */ protected void paintBackground(PaintEvent e) { Point size = this.getSize(); @@ -185,20 +188,29 @@ public abstract class MainBarButton extends Canvas { } - private void paintControl(PaintEvent e) { + /** + * Main painting method + * @param e + */ + void paintControl(PaintEvent e) { this.paintBackground(e); this.paintButton(e); - this.paintBorderAndText(e); + this.paintText(e); } + /** + * paint the inner button + * @param e + */ protected void paintButton(PaintEvent e) { // could be overwritten by subclasses } /** + * Paint the text or image on the button * @param e */ - protected void paintBorderAndText(PaintEvent e) { + protected void paintText(PaintEvent e) { Point size = this.getSize(); int height = size.y - 2; @@ -227,7 +239,8 @@ public abstract class MainBarButton extends Canvas { } /** - * @return + * Gets the region of the button + * @return the button region */ protected abstract Region getCustomRegion(); } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java index acbff332..923df73e 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarEndButton.java @@ -38,6 +38,7 @@ public class MainBarEndButton extends MainBarButton { /** * SLF4J Logger instance **/ + @SuppressWarnings("unused") private static final Logger log = LoggerFactory .getLogger(MainBarEndButton.class); diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java index f46e7e42..5e64826f 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarMiddleButton.java @@ -38,6 +38,7 @@ public class MainBarMiddleButton extends MainBarButton { /** * SLF4J Logger instance **/ + @SuppressWarnings("unused") private static final Logger log = LoggerFactory .getLogger(MainBarMiddleButton.class); diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java index 39392307..aff1fa7e 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarRectangleButton.java @@ -40,6 +40,7 @@ public class MainBarRectangleButton extends MainBarButton { /** * SLF4J Logger instance **/ + @SuppressWarnings("unused") private static final Logger log = LoggerFactory .getLogger(MainBarRectangleButton.class); diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java index 9101e274..8cdafefa 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/controls/MainBarStartButton.java @@ -38,6 +38,7 @@ public class MainBarStartButton extends MainBarButton { /** * SLF4J Logger instance **/ + @SuppressWarnings("unused") private static final Logger log = LoggerFactory .getLogger(MainBarStartButton.class); diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java index 1adc45a4..4850a313 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java @@ -25,8 +25,6 @@ import at.asit.pdfover.signator.SignaturePosition; * */ public interface ConfigProvider { - //TODO: define interface for config provider .... - /** * Regex for parsing signature position */ diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java index 90b2fba9..ece1cf7f 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java @@ -18,6 +18,7 @@ package at.asit.pdfover.gui.workflow; //Imports import java.lang.reflect.Constructor; +import org.eclipse.swt.SWTException; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; @@ -25,6 +26,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.MainWindow; +import at.asit.pdfover.gui.workflow.states.ErrorState; import at.asit.pdfover.gui.workflow.states.PrepareConfigurationState; import at.asit.pdfover.gui.workflow.states.State; @@ -84,7 +86,9 @@ public class StateMachineImpl implements StateMachine, GUIProvider { current.run(); } catch (Exception e) { log.error("StateMachine update: ", e); //$NON-NLS-1$ - // TODO: GOTO generic error state! + ErrorState errorState = new ErrorState(this); + errorState.setException(e); + jumpToState(errorState); } if (this.exit) { @@ -203,10 +207,6 @@ public class StateMachineImpl implements StateMachine, GUIProvider { this.createMainWindow(); } - if (this.container == null) { - // TODO throw Exception... - } - return this.container; } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java index af648dfd..dd240616 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java @@ -100,8 +100,7 @@ public class ErrorState extends State { */ @Override public void updateMainWindowBehavior() { - // TODO Auto-generated method stub - + // Stay in previous state behavior } /** diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java index ca0e164c..9962d968 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java @@ -20,11 +20,14 @@ import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.PostMethod; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Display; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.MainWindow.Buttons; import at.asit.pdfover.gui.MainWindowBehavior; +import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; import at.asit.pdfover.signator.SLRequest; @@ -86,7 +89,7 @@ public class LocalBKUState extends State { log.debug("SL REQUEST: " + sl_request); //$NON-NLS-1$ method.addParameter("XMLRequest", sl_request); //$NON-NLS-1$ - + int returnCode = client.executeMethod(method); if(returnCode == HttpStatus.SC_OK) @@ -115,13 +118,12 @@ public class LocalBKUState extends State { SLResponse slResponse = new SLResponse(response, server, userAgent, signatureLayout); this.state.signingState.setSignatureResponse(slResponse); } else { - // TODO: Create HTTP exception this.state.threadException = new HttpException(method.getResponseBodyAsString()); } } catch (Exception e) { log.error("SignLocalBKUThread: ", e); //$NON-NLS-1$ - // TODO: Is local BKU running? + // this.state.threadException = e; } finally { this.state.stateMachine.invokeUpdate(); @@ -168,17 +170,13 @@ public class LocalBKUState extends State { } if(this.threadException != null) { - ErrorState error = new ErrorState(this.stateMachine); - error.setException(this.threadException); - this.setNextState(error); + ErrorDialog dialog = new ErrorDialog(Display.getCurrent().getActiveShell(), SWT.NONE, "Please check if a local BKU is running", this.threadException); + dialog.open(); + this.threadException = null; + this.run(); return; } - if(!this.signingState.hasSignatureResponse()) { - // The thread should set the response or the thread exception!!! - // TODO: Jump to error state! - } - // OK this.setNextState(new SigningState(this.stateMachine)); } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java index 2ebc3f39..a1748287 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java @@ -66,8 +66,6 @@ public class OutputState extends State { @Override public void run() { - // TODO Preform output operations ... end workflow - Status status = this.stateMachine.getStatus(); if (status.getSignResult() != null) { @@ -97,20 +95,7 @@ public class OutputState extends State { } } - /* - * DocumentSource signedDocument = - * status.getSignResult().getSignedDocument(); - * - * FileOutputStream output; try { output = new FileOutputStream(new - * File("/tmp/test.pdf")); - * output.write(signedDocument.getByteArray(), 0, - * signedDocument.getByteArray().length); output.close(); } catch - * (IOException e) { // TODO Auto-generated catch block - * e.printStackTrace(); } - */ } - - // this.stateMachine.exit(); } /* diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java index 88acc84b..af6cc3bd 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java @@ -76,8 +76,6 @@ public class PrepareSigningState extends State { this.state.signatureParameter.setSignatureDevice(status.getBKU()); this.state.signatureParameter.setSignaturePosition(status.getSignaturePosition()); - // TODO: Fill library specific signature Parameters ... - if(configuration.getDefaultEmblem() != null && !configuration.getDefaultEmblem().equals("")) { //$NON-NLS-1$ this.state.signatureParameter.setEmblem(new FileNameEmlbem(configuration.getDefaultEmblem())); } @@ -145,11 +143,6 @@ public class PrepareSigningState extends State { return; } - if(this.signingState == null || this.signingState.getSignatureRequest() == null) { - // This shouldnot happen!! PrepareDocumentThread allready performed, either we have a valid signingState or an exception!! - // TODO: Jump to error state! - } - // We got the Request set it into status and move on to next state ... status.setSigningState(this.signingState); diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java index 20813f00..413f125c 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java @@ -89,12 +89,7 @@ public class SigningState extends State { this.setNextState(error); return; } - - if(status.getSignResult() == null) { - // The thread should set the threadException or create a valid signResult - // TODO: Jump to error state - } - + this.setNextState(new OutputState(this.stateMachine)); } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java index a1868462..ee984e96 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java @@ -67,11 +67,9 @@ public class ATrustHelper { if (endidx > startidx) { return data.substring(startidx, endidx); } - // TODO: throw proper exception log.error("extracting Tag: end tag not valid!: " + start + " ... " + end); //$NON-NLS-1$//$NON-NLS-2$ throw new Exception("end tag not available!"); //$NON-NLS-1$ } - // TODO: throw proper exception log.error("extracting Tag: start tag not valid!: " + start + " ... " + end); //$NON-NLS-1$//$NON-NLS-2$ throw new Exception("start tag not available!"); //$NON-NLS-1$ } diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java index bd2f5b53..fb52fce8 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java @@ -77,7 +77,7 @@ public class PostSLRequestThread implements Runnable { PostMethod method = new PostMethod(url); method.addParameter("XMLRequest", sl_request); //$NON-NLS-1$ - + int returnCode = client.executeMethod(method); String redirectLocation = null; diff --git a/trunk/pdf-over-signator/src/main/java/at/asit/pdfover/signator/PDFFileDocumentSource.java b/trunk/pdf-over-signator/src/main/java/at/asit/pdfover/signator/PDFFileDocumentSource.java index 6fdbfe29..6aa8154b 100644 --- a/trunk/pdf-over-signator/src/main/java/at/asit/pdfover/signator/PDFFileDocumentSource.java +++ b/trunk/pdf-over-signator/src/main/java/at/asit/pdfover/signator/PDFFileDocumentSource.java @@ -62,7 +62,7 @@ public class PDFFileDocumentSource implements DocumentSource { @Override public int getLength() { if(this.file.length() > Integer.MAX_VALUE) { - // TODO: Handle error somehow or use long ... + // TODO: Handle error somehow or use long ... (Ignore Files larger than 2 GB) } this.len = (int) this.file.length(); return this.len; diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/ByteArrayPDFASDataSource.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/ByteArrayPDFASDataSource.java index 5998055a..b2f95f50 100644 --- a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/ByteArrayPDFASDataSource.java +++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/ByteArrayPDFASDataSource.java @@ -61,8 +61,7 @@ public class ByteArrayPDFASDataSource implements DataSource { @Override public String getCharacterEncoding() { - //TODO - return null; + return "UTF8"; } }
\ No newline at end of file diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSLRequest.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSLRequest.java index 493b3e9c..85f06294 100644 --- a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSLRequest.java +++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSLRequest.java @@ -21,6 +21,7 @@ import org.slf4j.LoggerFactory; import at.asit.pdfover.signator.ByteArrayDocumentSource; import at.asit.pdfover.signator.SLRequest; +import at.asit.pdfover.signer.pdfas.exceptions.PDFASSLRequestException; /** * PDF - AS Security Layer Request implementation @@ -36,12 +37,13 @@ public class PDFASSLRequest extends SLRequest { * Default constructor * @param slRequest * @param signData + * @throws PDFASSLRequestException */ - public PDFASSLRequest(String slRequest, byte[] signData) { + public PDFASSLRequest(String slRequest, byte[] signData) throws PDFASSLRequestException { if(!slRequest.contains(PDFASSigner.LOC_REF)) { - // TODO: throw Exception (Failed to prepare SL Request) log.error("PDF-AS SL request doesn't contain " + PDFASSigner.LOC_REF); log.debug("Request: " + slRequest); + throw new PDFASSLRequestException("PDF-AS SL request doesn't contain " + PDFASSigner.LOC_REF); } // Modifing SL Request ... diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java index 43179367..1b058553 100644 --- a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java +++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PDFASSigner.java @@ -10,6 +10,7 @@ import at.asit.pdfover.signator.SignResultImpl; import at.asit.pdfover.signator.SignatureParameter; import at.asit.pdfover.signator.SignaturePosition; import at.asit.pdfover.signator.SigningState; +import at.asit.pdfover.signer.pdfas.exceptions.PDFASSLRequestException; import at.gv.egiz.pdfas.api.PdfAs; import at.gv.egiz.pdfas.api.sign.SignParameters; import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation; @@ -63,7 +64,6 @@ public class PDFASSigner implements Signer { if(parameter.getSignatureDevice() == BKUs.LOCAL) { params.setSignatureDevice(Constants.SIGNATURE_DEVICE_BKU); } else if(parameter.getSignatureDevice() == BKUs.MOBILE) { - // TODO: change to MOBILE!! params.setSignatureDevice(Constants.SIGNATURE_DEVICE_MOBILE); //params.setSignatureDevice(Constants.SIGNATURE_DEVICE_MOBILETEST); } @@ -102,7 +102,10 @@ public class PDFASSigner implements Signer { state.setSignatureRequest(request); return state; - } catch (PdfAsException e) { + } catch(PDFASSLRequestException e) { + throw new SignatureException(e); + } + catch (PdfAsException e) { throw new SignatureException(e); } } diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java index 9aec98f7..5b15543e 100644 --- a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java +++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/PdfAsSignatureParameter.java @@ -16,6 +16,9 @@ package at.asit.pdfover.signer.pdfas; //Imports +import java.util.HashMap; +import java.util.Properties; + import at.asit.pdfover.signator.SignatureDimension; import at.asit.pdfover.signator.SignatureParameter; import at.gv.egiz.pdfas.api.io.DataSource; @@ -26,6 +29,8 @@ import at.gv.egiz.pdfas.api.sign.pos.SignaturePositioning; */ public class PdfAsSignatureParameter extends SignatureParameter { + private HashMap<String, String> genericProperties = new HashMap<String, String>(); + @Override public SignatureDimension getPlaceholderDimension() { // TODO Auto-generated method stub @@ -46,19 +51,16 @@ public class PdfAsSignatureParameter extends SignatureParameter { * @return ByteArrayPDFASDataSource */ public DataSource getPDFASDataSource() { - // TODO: implement Signature creation return new ByteArrayPDFASDataSource(this.getInputDocument().getByteArray()); } @Override public void setProperty(String key, String value) { - // TODO Auto-generated method stub - + this.genericProperties.put(key, value); } @Override public String getProperty(String key) { - // TODO Auto-generated method stub - return null; + return this.genericProperties.get(key); } } diff --git a/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/exceptions/PDFASSLRequestException.java b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/exceptions/PDFASSLRequestException.java new file mode 100644 index 00000000..ceb25779 --- /dev/null +++ b/trunk/pdf-over-signer/pdf-over-sigpdfas/src/main/java/at/asit/pdfover/signer/pdfas/exceptions/PDFASSLRequestException.java @@ -0,0 +1,34 @@ +/* + * Copyright 2012 by A-SIT, Secure Information Technology Center Austria + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://joinup.ec.europa.eu/software/page/eupl + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + */ +package at.asit.pdfover.signer.pdfas.exceptions; + +/** + * + */ +public class PDFASSLRequestException extends Exception { + /** + * + */ + private static final long serialVersionUID = -7515747014505057787L; + + /** + * Constructor + * @param msg + */ + public PDFASSLRequestException(String msg) { + super(msg); + } +} |