summaryrefslogtreecommitdiff
path: root/pdf-over-gui
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 18:52:47 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 18:52:47 +0000
commitaec0b00cb9801faa4a5093d200281763447f0696 (patch)
tree809190497f0a89624e8729319d3064c10a3b8df6 /pdf-over-gui
parente710a326314184f31cd50d4637959f44232a74ee (diff)
downloadpdf-over-aec0b00cb9801faa4a5093d200281763447f0696.tar.gz
pdf-over-aec0b00cb9801faa4a5093d200281763447f0696.tar.bz2
pdf-over-aec0b00cb9801faa4a5093d200281763447f0696.zip
State Machine refactor
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@21 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java4
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/BKUSelectionComposite.java23
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/DataSourceSelectComposite.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/MainWindow.java10
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/PositioningComposite.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/WaitingComposite.java6
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java27
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/State.java77
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java53
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java431
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java35
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java36
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/DataSourceSelectionState.java11
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java8
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java8
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java11
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java11
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java23
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java21
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java9
20 files changed, 726 insertions, 90 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java
index dcf596dc..cac40c4d 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/DeveloperMain.java
@@ -18,7 +18,7 @@ package at.asit.pdfover.gui;
//Imports
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.asit.pdfover.gui.workflow.Workflow;
+import at.asit.pdfover.gui.workflow.StateMachineImpl;
/**
* Main entry point for developers
@@ -38,7 +38,7 @@ public class DeveloperMain {
//BasicConfigurator.configure();
- Workflow flow = new Workflow(args);
+ StateMachineImpl flow = new StateMachineImpl(args);
log.debug("Starting workflow ...");
flow.start();
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/BKUSelectionComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/BKUSelectionComposite.java
index 78ca0d23..70282202 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/BKUSelectionComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/BKUSelectionComposite.java
@@ -19,7 +19,6 @@ package at.asit.pdfover.gui.components;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
@@ -28,9 +27,9 @@ import org.eclipse.swt.widgets.Composite;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.asit.pdfover.gui.workflow.Workflow;
+import at.asit.pdfover.gui.workflow.StateMachine;
import at.asit.pdfover.gui.workflow.states.BKUSelectionState;
-import at.asit.pdfover.gui.workflow.states.BKUSelectionState.BKUS;
+import at.asit.pdfover.gui.workflow.states.BKUSelectionState.BKUs;
/**
*
@@ -53,7 +52,7 @@ public class BKUSelectionComposite extends Composite implements StateComposite {
@Override
public void widgetSelected(SelectionEvent e) {
log.debug("Setting BKU to LOCAL");
- setSelected(BKUS.LOCAL);
+ setSelected(BKUs.LOCAL);
}
@Override
@@ -77,7 +76,7 @@ public class BKUSelectionComposite extends Composite implements StateComposite {
@Override
public void widgetSelected(SelectionEvent e) {
log.debug("Setting BKU to MOBILE");
- setSelected(BKUS.MOBILE);
+ setSelected(BKUs.MOBILE);
}
@Override
@@ -92,15 +91,15 @@ public class BKUSelectionComposite extends Composite implements StateComposite {
private static final Logger log = LoggerFactory
.getLogger(BKUSelectionComposite.class);
- private Workflow workflow;
+ private BKUSelectionState state;
- private BKUS selected = BKUS.NONE;
+ private BKUs selected = BKUs.NONE;
/**
* Gets selected BKU type
* @return BKUS enum
*/
- public BKUS getSelected() {
+ public BKUs getSelected() {
return this.selected;
}
@@ -108,9 +107,9 @@ public class BKUSelectionComposite extends Composite implements StateComposite {
* Sets selected BKU and updates workflow
* @param selected
*/
- public void setSelected(final BKUS selected) {
+ public void setSelected(final BKUs selected) {
this.selected = selected;
- this.workflow.update();
+ this.state.updateStateMachine();
}
/**
@@ -118,10 +117,10 @@ public class BKUSelectionComposite extends Composite implements StateComposite {
* @param parent
* @param style
*/
- public BKUSelectionComposite(Composite parent, int style, Workflow flow) {
+ public BKUSelectionComposite(Composite parent, int style, BKUSelectionState state) {
super(parent, style);
- this.workflow = flow;
+ this.state = state;
this.setLayout(new FormLayout());
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/DataSourceSelectComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/DataSourceSelectComposite.java
index d5719917..fe0cb2ee 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/DataSourceSelectComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/DataSourceSelectComposite.java
@@ -37,7 +37,7 @@ import org.eclipse.swt.dnd.*;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
-import at.asit.pdfover.gui.workflow.Workflow;
+import at.asit.pdfover.gui.workflow.StateMachineImpl;
/**
*
@@ -84,7 +84,7 @@ public class DataSourceSelectComposite extends Composite implements
private static final Logger log = LoggerFactory
.getLogger(DataSourceSelectComposite.class);
- private Workflow workflow;
+ private StateMachineImpl workflow;
/**
* Set this value through the setter method!!
@@ -116,7 +116,7 @@ public class DataSourceSelectComposite extends Composite implements
* @param style
* @param flow
*/
- public DataSourceSelectComposite(Composite parent, int style, Workflow flow) {
+ public DataSourceSelectComposite(Composite parent, int style, StateMachineImpl flow) {
super(parent, style);
this.workflow = flow;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/MainWindow.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/MainWindow.java
index 731c5f57..088afe3c 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/MainWindow.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/MainWindow.java
@@ -40,8 +40,8 @@ import at.asit.pdfover.gui.components.main_behavior.ConfigOpenPositionEnabled;
import at.asit.pdfover.gui.components.main_behavior.MainWindowAllDisabled;
import at.asit.pdfover.gui.components.main_behavior.MainWindowBehavior;
import at.asit.pdfover.gui.components.main_behavior.OnlyConfigEnabled;
-import at.asit.pdfover.gui.workflow.Workflow;
-import at.asit.pdfover.gui.workflow.WorkflowState;
+import at.asit.pdfover.gui.workflow.StateMachineImpl;
+import at.asit.pdfover.gui.workflow.State;
import at.asit.pdfover.gui.workflow.states.BKUSelectionState;
import at.asit.pdfover.gui.workflow.states.DataSourceSelectionState;
import at.asit.pdfover.gui.workflow.states.LocalBKUState;
@@ -88,7 +88,7 @@ public class MainWindow {
private CLabel lbl_status;
private Composite container;
private StackLayout stack;
- private Workflow workflow;
+ private StateMachineImpl workflow;
private Button btn_sign;
/**
@@ -135,7 +135,7 @@ public class MainWindow {
* Default contsructor
* @param workflow The main workflow
*/
- public MainWindow(Workflow workflow) {
+ public MainWindow(StateMachineImpl workflow) {
super();
this.behavior.put(PrepareConfigurationState.class, new MainWindowAllDisabled());
@@ -308,7 +308,7 @@ public class MainWindow {
* Update MainWindow to fit new status
*/
public void UpdateNewState() {
- WorkflowState state = this.workflow.getState();
+ State state = this.workflow.getState();
log.debug("Updating MainWindow state for : " + state.toString());
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/PositioningComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/PositioningComposite.java
index 7c1d4d06..c924ef79 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/PositioningComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/PositioningComposite.java
@@ -25,7 +25,7 @@ import org.eclipse.swt.widgets.Label;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.asit.pdfover.gui.workflow.Workflow;
+import at.asit.pdfover.gui.workflow.StateMachineImpl;
import at.asit.pdfover.signator.SignaturePosition;
/**
@@ -65,7 +65,7 @@ public class PositioningComposite extends Composite implements StateComposite {
private static final Logger log = LoggerFactory
.getLogger(PositioningComposite.class);
- private Workflow workflow;
+ private StateMachineImpl workflow;
private SignaturePosition position = null;
@@ -90,7 +90,7 @@ public class PositioningComposite extends Composite implements StateComposite {
* @param parent
* @param style
*/
- public PositioningComposite(Composite parent, int style, Workflow workflow) {
+ public PositioningComposite(Composite parent, int style, StateMachineImpl workflow) {
super(parent, style);
this.workflow = workflow;
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/WaitingComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/WaitingComposite.java
index 371d5e26..6ce53b22 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/WaitingComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/components/WaitingComposite.java
@@ -25,7 +25,7 @@ import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormAttachment;
-import at.asit.pdfover.gui.workflow.Workflow;
+import at.asit.pdfover.gui.workflow.StateMachineImpl;
/**
*
@@ -37,14 +37,14 @@ public class WaitingComposite extends Composite {
private static final Logger log = LoggerFactory
.getLogger(WaitingComposite.class);
- private Workflow workflow;
+ private StateMachineImpl workflow;
/**
* Create the composite.
* @param parent
* @param style
*/
- public WaitingComposite(Composite parent, int style, Workflow workflow) {
+ public WaitingComposite(Composite parent, int style, StateMachineImpl workflow) {
super(parent, style);
setLayout(new FormLayout());
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java
new file mode 100644
index 00000000..1296b373
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java
@@ -0,0 +1,27 @@
+/*
+ * 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.gui.workflow;
+
+// Imports
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ */
+public interface ConfigProvider {
+
+}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/State.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/State.java
new file mode 100644
index 00000000..305c5033
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/State.java
@@ -0,0 +1,77 @@
+/*
+ * 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.gui.workflow;
+
+//Imports
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Base state class
+ */
+public abstract class State {
+
+ /**
+ * The StateMachine
+ */
+ protected StateMachine stateMachine;
+
+ /**
+ * SFL4J Logger instance
+ **/
+ @SuppressWarnings("unused")
+ private static final Logger log = LoggerFactory.getLogger(State.class);
+
+ private State nextState = null;
+
+ /**
+ * Default Workflow State constructor
+ */
+ public State(StateMachine stateMachine) {
+ this.stateMachine = stateMachine;
+ this.nextState = this;
+ }
+
+ /**
+ * Gets the next logical state or null if this their is no state transition
+ * @return the next state (or null)
+ */
+ public State nextState() {
+ return this.nextState;
+ }
+
+ /**
+ * Sets the next logical state
+ * @param state
+ */
+ protected void setNextState(State state) {
+ this.nextState = state;
+ }
+
+ /**
+ * Perform main logic for this state
+ * @param stateMachine the state machine
+ */
+ public abstract void run();
+
+ /**
+ * Update the state machine
+ */
+ public void updateStateMachine()
+ {
+ stateMachine.update();
+ }
+}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java
new file mode 100644
index 00000000..b315b9d2
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachine.java
@@ -0,0 +1,53 @@
+/*
+ * 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.gui.workflow;
+
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ *
+ */
+public interface StateMachine {
+ /**
+ * Get the ConfigProvider
+ * @return the ConfigProvider
+ */
+ public ConfigProvider getConfigProvider();
+
+ /**
+ * Get the container Composite
+ * @return the container Composite
+ */
+ public Composite getComposite();
+
+ //public void display(Composite composite)
+ /**
+ * Get the Status
+ * @return the Status
+ */
+ public Status getStatus();
+
+ /**
+ * Update state machine
+ * Calls the next state.
+ */
+ public void update();
+
+ /**
+ * Exit state machine execution
+ */
+ public void exit();
+}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java
new file mode 100644
index 00000000..990ff00c
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java
@@ -0,0 +1,431 @@
+/*
+ * 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.gui.workflow;
+
+//Imports
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.Properties;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import at.asit.pdfover.gui.components.MainWindow;
+import at.asit.pdfover.gui.workflow.states.BKUSelectionState;
+import at.asit.pdfover.gui.workflow.states.DataSourceSelectionState;
+import at.asit.pdfover.gui.workflow.states.PositioningState;
+import at.asit.pdfover.gui.workflow.states.PrepareConfigurationState;
+import at.asit.pdfover.gui.workflow.states.BKUSelectionState.BKUs;
+import at.asit.pdfover.signator.Signator;
+import at.asit.pdfover.signator.SignatureParameter;
+import at.asit.pdfover.signator.Signer;
+
+/**
+ * Workflow holds logical state of signing process and updates the current
+ * logical state
+ */
+public class StateMachineImpl implements StateMachine {
+
+ /**
+ * SFL4J Logger instance
+ **/
+ private static final Logger log = LoggerFactory.getLogger(StateMachineImpl.class);
+
+ /**
+ * Default constructor
+ *
+ * @param cmdLineArgs
+ */
+ public StateMachineImpl(String[] cmdLineArgs) {
+ setCmdLineAargs(cmdLineArgs);
+ }
+
+ /**
+ * @uml.property name="state"
+ * @uml.associationEnd multiplicity="(1 1)" aggregation="shared"
+ * inverse="workflow1:at.asit.pdfover.gui.workflow.WorkflowState"
+ */
+ private State state = new PrepareConfigurationState();
+
+ /**
+ * Getter of the property <tt>state</tt>
+ *
+ * @return Returns the state.
+ * @uml.property name="state"
+ */
+ public State getState() {
+ return this.state;
+ }
+
+ /**
+ * Sets the workflow state This method should be used to let the user jump
+ * around between states. This Method also resets certain properties defined
+ * by later states then state
+ *
+ * @param state
+ */
+ public void setWorkflowState(State state) {
+ if (this.state != state && state != null) {
+ this.state = state;
+
+ if (state instanceof PositioningState) {
+ // User jumps to positioning state !
+ // restore possible default for bku selection / forget BKU
+ // selection
+ this.setSelectedBKU(PrepareConfigurationState
+ .readSelectedBKU(this.getConfigurationValues()));
+ // forget position
+ this.getParameter().setSignaturePosition(null);
+ } else if (state instanceof BKUSelectionState) {
+ // User jumps to bku selection state !
+ // forget bku selection
+ this.setSelectedBKU(BKUs.NONE);
+ } else if (state instanceof DataSourceSelectionState) {
+ // User jumps to data source selection state !
+ // forget bku selection / restore possible default for bku
+ // selection
+ this.setSelectedBKU(PrepareConfigurationState
+ .readSelectedBKU(this.getConfigurationValues()));
+ // forget position / restore possible default for position
+ this.getParameter().setSignaturePosition(
+ PrepareConfigurationState.readDefinedPosition(this
+ .getConfigurationValues()));
+ // forget data source selection
+ this.setDataSource(null);
+ }
+
+ this.update();
+ }
+ }
+
+ /**
+ * Update Workflow logic and let state machine do its job...
+ */
+ @Override
+ public void update() {
+ State next = null;
+ while (this.state != null) {
+ this.state.run();
+ if (this.mainWindow != null && !this.mainWindow.getShell().isDisposed()) {
+ log.debug("Allowing MainWindow to update its state for " + this.state.toString());
+ this.mainWindow.UpdateNewState();
+ this.mainWindow.doLayout();
+ }
+ next = this.state.nextState();
+ if (next == this.state) {
+ break;
+ }
+ // this.state.hideGUI();
+ log.debug("Changing state from: " + this.state.toString() + " to "
+ + next.toString());
+ this.state = next;
+ }
+ if (this.state != null) {
+ this.setCurrentStateMessage(this.state.toString());
+ } else {
+ this.setCurrentStateMessage("");
+ }
+ }
+
+ /**
+ * Invoke Update in UI (Main) Thread
+ */
+ public void InvokeUpdate() {
+ if(this.display != null) {
+ this.display.asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ StateMachineImpl.this.update();
+ }
+ });
+ }
+ }
+
+ private Display display = null;
+
+ private Shell shell = null;
+
+ private Composite container = null;
+
+ private MainWindow mainWindow = null;
+
+ /**
+ * Helper method for developing
+ *
+ * @param value
+ */
+ public void setCurrentStateMessage(String value) {
+ if (this.mainWindow != null) {
+ this.mainWindow.setStatus(value);
+ }
+ }
+
+ /**
+ * Used by active workflow state to show its own gui component
+ *
+ * @param ctrl
+ */
+ public void setTopControl(final Control ctrl) {
+ this.mainWindow.setTopControl(ctrl);
+ }
+
+ private void createMainWindow() {
+ this.display = Display.getDefault();
+
+ this.mainWindow = new MainWindow(this);
+
+ this.mainWindow.open();
+
+ this.shell = this.mainWindow.getShell();
+
+ this.container = this.mainWindow.getContainer();
+
+ this.shell.open();
+ this.shell.layout();
+ }
+
+ /**
+ * Gets the Shell for drawing the ui
+ *
+ * @return Composite
+ */
+ @Override
+ public Composite getComposite() {
+ // Main window will be build on first call
+ // returns SWT Composite container for states to draw their GUI
+
+ if (this.container == null) {
+ this.createMainWindow();
+ }
+
+ if (this.container == null) {
+ // TODO throw Exception...
+ }
+
+ return this.container;
+ }
+
+ /**
+ * Only returns a shell if one was already created ...
+ *
+ * @return
+ */
+ private Shell nonCreatingGetShell() {
+ return this.shell;
+ }
+
+ /**
+ * Exists the Workflow
+ */
+ @Override
+ public void exit() {
+ this.shell.dispose();
+ }
+
+ /**
+ * Only returns a shell if one was already created ...
+ *
+ * @return
+ */
+ private Display nonCreatingGetDisplay() {
+ return this.display;
+ }
+
+ /**
+ * Workflow main entrance point
+ */
+ public void start() {
+ // Call update to start processing ...
+ this.update();
+
+ // if a user interaction is required we have a shell ...
+ Shell shell = this.nonCreatingGetShell();
+ Display display = this.nonCreatingGetDisplay();
+
+ if (shell != null && display != null) {
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+ display.dispose();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.StateMachine#getConfigProvider()
+ */
+ @Override
+ public ConfigProvider getConfigProvider() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see at.asit.pdfover.gui.workflow.StateMachine#getStatus()
+ */
+ @Override
+ public Status getStatus() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ // Data Section
+ // =============================================================================
+
+ // Command Line Arguments
+ // -------------------------------------------------------
+ private String[] cmdLineArgs = new String[] {};
+
+ /**
+ * sets the command line arguments
+ *
+ * @param cmdLineArgs
+ */
+ private void setCmdLineAargs(String[] cmdLineArgs) {
+ this.cmdLineArgs = cmdLineArgs;
+ }
+
+ /**
+ * Gets the command line arguments
+ *
+ * @return the command line arguments
+ */
+ public String[] getCmdArgs() {
+ return this.cmdLineArgs;
+ }
+
+ // Key Value String properties
+ // -------------------------------------------------------
+ private Properties configurationValues = new Properties();
+
+ /**
+ * Gets the persistent state
+ *
+ * @return the persistent state
+ */
+ public Properties getConfigurationValues() {
+ return this.configurationValues;
+ }
+
+ // Data source
+ // -------------------------------------------------------
+ private File dataSource = null;
+
+ /**
+ * Gets the DataSource
+ *
+ * @return The data source file
+ */
+ public File getDataSource() {
+ return this.dataSource;
+ }
+
+ /**
+ * Sets the DataSource
+ *
+ * @param file
+ */
+ public void setDataSource(File file) {
+ this.dataSource = file;
+ }
+
+ // Selected BKU
+ // -------------------------------------------------------
+
+ /**
+ * The selected BKU
+ */
+ private BKUs selectedBKU = BKUs.NONE;
+
+ /**
+ * Gets the selected BKU
+ *
+ * @return the selectedBKU
+ */
+ public BKUs getSelectedBKU() {
+ return this.selectedBKU;
+ }
+
+ /**
+ * Sets the selected BKU
+ *
+ * @param selectedBKU
+ * the selectedBKU to set
+ */
+ public void setSelectedBKU(BKUs selectedBKU) {
+ this.selectedBKU = selectedBKU;
+ }
+
+ private Signator.Signers usedSignerLib = Signator.Signers.PDFAS;
+
+ /**
+ * The PDF Signer
+ */
+ private Signer pdfSigner = null;
+
+ /**
+ * @return the pdfSigner
+ */
+ public Signer getPdfSigner() {
+ return this.pdfSigner;
+ }
+
+ /**
+ * @param pdfSigner
+ * the pdfSigner to set
+ */
+ public void setPdfSigner(Signer pdfSigner) {
+ this.pdfSigner = pdfSigner;
+ }
+
+ private SignatureParameter parameter = null;
+
+ /**
+ * @return the parameter
+ */
+ public SignatureParameter getParameter() {
+ return this.parameter;
+ }
+
+ /**
+ * @param parameter
+ * the parameter to set
+ */
+ public void setParameter(SignatureParameter parameter) {
+ this.parameter = parameter;
+ }
+
+ /**
+ * @return the usedSignerLib
+ */
+ public Signator.Signers getUsedSignerLib() {
+ return this.usedSignerLib;
+ }
+
+ /**
+ * @param usedSignerLib
+ * the usedSignerLib to set
+ */
+ public void setUsedSignerLib(Signator.Signers usedSignerLib) {
+ this.usedSignerLib = usedSignerLib;
+ }
+}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java
new file mode 100644
index 00000000..ff06286b
--- /dev/null
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java
@@ -0,0 +1,35 @@
+/*
+ * 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.gui.workflow;
+
+import java.io.File;
+
+import at.asit.pdfover.gui.workflow.states.BKUSelectionState;
+import at.asit.pdfover.signator.SignaturePosition;
+
+/**
+ *
+ */
+public interface Status {
+ public void setDocument(File document);
+ public File getDocument();
+
+ public void setSignaturePosition(SignaturePosition position);
+ public SignaturePosition getSignaturePosition();
+
+ public void setBKU(BKUSelectionState.BKUs bku);
+ public BKUSelectionState.BKUs getBKU();
+}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java
index 2bd3361d..1d2c5524 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/BKUSelectionState.java
@@ -21,18 +21,26 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.components.BKUSelectionComposite;
-import at.asit.pdfover.gui.workflow.Workflow;
-import at.asit.pdfover.gui.workflow.WorkflowState;
+import at.asit.pdfover.gui.workflow.StateMachine;
+import at.asit.pdfover.gui.workflow.StateMachineImpl;
+import at.asit.pdfover.gui.workflow.State;
/**
* Decides which BKU to use (preconfigured or let user choose)
*/
-public class BKUSelectionState extends WorkflowState {
+public class BKUSelectionState extends State {
/**
- * Enumeration of available BKU type
+ * @param stateMachine
*/
- public enum BKUS {
+ public BKUSelectionState(StateMachine stateMachine) {
+ super(stateMachine);
+ }
+
+ /**
+ * Enumeration of available BKU types
+ */
+ public enum BKUs {
/**
* Local bku
*/
@@ -48,7 +56,7 @@ public class BKUSelectionState extends WorkflowState {
*/
NONE
}
-
+
/**
* SFL4J Logger instance
**/
@@ -57,28 +65,28 @@ public class BKUSelectionState extends WorkflowState {
private BKUSelectionComposite selectionComposite = null;
- private BKUSelectionComposite getSelectionComposite(Workflow workflow) {
+ private BKUSelectionComposite getSelectionComposite() {
if (this.selectionComposite == null) {
this.selectionComposite = new BKUSelectionComposite(
- workflow.getComposite(), SWT.RESIZE, workflow);
+ this.stateMachine.getComposite(), SWT.RESIZE, this);
}
return this.selectionComposite;
}
@Override
- public void update(Workflow workflow) {
+ public void run() {
- if(workflow.getSelectedBKU() == BKUS.NONE) {
+ if(this.stateMachine.getStatus().getBKU() == BKUs.NONE) {
BKUSelectionComposite selection = this
- .getSelectionComposite(workflow);
+ .getSelectionComposite();
- workflow.setTopControl(selection);
+ this.stateMachine.setTopControl(selection);
selection.layout();
- workflow.setSelectedBKU(selection.getSelected());
+ this.stateMachine.setSelectedBKU(selection.getSelected());
- if(workflow.getSelectedBKU() == BKUS.NONE) {
+ if(this.stateMachine.getSelectedBKU() == BKUs.NONE) {
this.setNextState(this);
return;
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/DataSourceSelectionState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/DataSourceSelectionState.java
index 10492dfe..6b69947a 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/DataSourceSelectionState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/DataSourceSelectionState.java
@@ -23,13 +23,14 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.components.DataSourceSelectComposite;
-import at.asit.pdfover.gui.workflow.Workflow;
-import at.asit.pdfover.gui.workflow.WorkflowState;
+import at.asit.pdfover.gui.workflow.StateMachine;
+import at.asit.pdfover.gui.workflow.StateMachineImpl;
+import at.asit.pdfover.gui.workflow.State;
/**
* Selects the data source for the signature process.
*/
-public class DataSourceSelectionState extends WorkflowState {
+public class DataSourceSelectionState extends State {
/**
* SFL4J Logger instance
@@ -39,7 +40,7 @@ public class DataSourceSelectionState extends WorkflowState {
private DataSourceSelectComposite selectionComposite = null;
- private DataSourceSelectComposite getSelectionComposite(Workflow workflow) {
+ private DataSourceSelectComposite getSelectionComposite(StateMachineImpl workflow) {
if (this.selectionComposite == null) {
this.selectionComposite = new DataSourceSelectComposite(
workflow.getComposite(), SWT.RESIZE, workflow);
@@ -49,7 +50,7 @@ public class DataSourceSelectionState extends WorkflowState {
}
@Override
- public void update(Workflow workflow) {
+ public void run(StateMachine stateMachine) {
if (workflow.getDataSource() == null) {
DataSourceSelectComposite selection = this
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java
index aa352be7..2a53dcbc 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java
@@ -19,13 +19,13 @@ package at.asit.pdfover.gui.workflow.states;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.asit.pdfover.gui.workflow.Workflow;
-import at.asit.pdfover.gui.workflow.WorkflowState;
+import at.asit.pdfover.gui.workflow.StateMachine;
+import at.asit.pdfover.gui.workflow.State;
/**
* Logical state for performing the BKU Request to a local BKU
*/
-public class LocalBKUState extends WorkflowState {
+public class LocalBKUState extends State {
/**
* SLF4J Logger instance
**/
@@ -36,7 +36,7 @@ public class LocalBKUState extends WorkflowState {
* @see at.asit.pdfover.gui.workflow.WorkflowState#update(at.asit.pdfover.gui.workflow.Workflow)
*/
@Override
- public void update(Workflow workflow) {
+ public void run(StateMachine stateMachine) {
// TODO Process SL Request and set SL Response
this.setNextState(new SigningState());
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
index 643abd45..169e9e59 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/MobileBKUState.java
@@ -19,13 +19,13 @@ package at.asit.pdfover.gui.workflow.states;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.asit.pdfover.gui.workflow.Workflow;
-import at.asit.pdfover.gui.workflow.WorkflowState;
+import at.asit.pdfover.gui.workflow.StateMachine;
+import at.asit.pdfover.gui.workflow.State;
/**
* Logical state for performing the BKU Request to the A-Trust Mobile BKU
*/
-public class MobileBKUState extends WorkflowState {
+public class MobileBKUState extends State {
/**
* SLF4J Logger instance
**/
@@ -36,7 +36,7 @@ public class MobileBKUState extends WorkflowState {
* @see at.asit.pdfover.gui.workflow.WorkflowState#update(at.asit.pdfover.gui.workflow.Workflow)
*/
@Override
- public void update(Workflow workflow) {
+ public void run(StateMachine stateMachine) {
// TODO Process SL Request and set SL Response
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java
index d7df5c19..933dd559 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java
@@ -18,13 +18,14 @@ package at.asit.pdfover.gui.workflow.states;
//Imports
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.asit.pdfover.gui.workflow.Workflow;
-import at.asit.pdfover.gui.workflow.WorkflowState;
+
+import at.asit.pdfover.gui.workflow.StateMachine;
+import at.asit.pdfover.gui.workflow.State;
/**
* Procduces the output of the signature process. (save file, open file)
*/
-public class OutputState extends WorkflowState {
+public class OutputState extends State {
/**
* SFL4J Logger instance
@@ -33,10 +34,10 @@ public class OutputState extends WorkflowState {
private static final Logger log = LoggerFactory.getLogger(OutputState.class);
@Override
- public void update(Workflow workflow) {
+ public void run(StateMachine stateMachine) {
// TODO Preform output operations ... end workflow
- workflow.exitWorkflow();
+ stateMachine.exit();
}
@Override
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java
index 180b98d9..5b764084 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PositioningState.java
@@ -21,13 +21,14 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.components.PositioningComposite;
-import at.asit.pdfover.gui.workflow.Workflow;
-import at.asit.pdfover.gui.workflow.WorkflowState;
+import at.asit.pdfover.gui.workflow.StateMachine;
+import at.asit.pdfover.gui.workflow.StateMachineImpl;
+import at.asit.pdfover.gui.workflow.State;
/**
* Decides where to position the signature block
*/
-public class PositioningState extends WorkflowState {
+public class PositioningState extends State {
/**
* SFL4J Logger instance
@@ -38,7 +39,7 @@ public class PositioningState extends WorkflowState {
private PositioningComposite positionComposite = null;
- private PositioningComposite getPositioningComosite(Workflow workflow) {
+ private PositioningComposite getPositioningComosite(StateMachineImpl workflow) {
if (this.positionComposite == null) {
this.positionComposite = new PositioningComposite(
workflow.getComposite(), SWT.NONE, workflow);
@@ -48,7 +49,7 @@ public class PositioningState extends WorkflowState {
}
@Override
- public void update(Workflow workflow) {
+ public void run(StateMachine stateMachine) {
if(workflow.getParameter().getSignaturePosition() == null) {
PositioningComposite position = this.getPositioningComosite(workflow);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java
index 91ebf01b..45e04dfd 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java
@@ -20,9 +20,10 @@ import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.asit.pdfover.gui.workflow.Workflow;
-import at.asit.pdfover.gui.workflow.WorkflowState;
-import at.asit.pdfover.gui.workflow.states.BKUSelectionState.BKUS;
+
+import at.asit.pdfover.gui.workflow.StateMachine;
+import at.asit.pdfover.gui.workflow.State;
+import at.asit.pdfover.gui.workflow.states.BKUSelectionState.BKUs;
import at.asit.pdfover.signator.Signator;
import at.asit.pdfover.signator.SignaturePosition;
@@ -31,7 +32,7 @@ import at.asit.pdfover.signator.SignaturePosition;
*
* Reads configuration, command arguments and initializes configured variables
*/
-public class PrepareConfigurationState extends WorkflowState {
+public class PrepareConfigurationState extends State {
public final static String BKU_SELECTION_CONFIG = "DEFAULT_BKU";
@@ -43,7 +44,7 @@ public class PrepareConfigurationState extends WorkflowState {
.getLogger(PrepareConfigurationState.class);
@Override
- public void update(Workflow workflow) {
+ public void run(StateMachine stateMachine) {
// TODO: Read config file and command line arguments
// Set usedSignerLib ...
@@ -69,20 +70,20 @@ public class PrepareConfigurationState extends WorkflowState {
* @param props
* @return The BKUS value
*/
- public static BKUS readSelectedBKU(final Properties props) {
+ public static BKUs readSelectedBKU(final Properties props) {
if (props.containsKey(BKU_SELECTION_CONFIG)) {
String value = props.getProperty(BKU_SELECTION_CONFIG);
value = value.trim().toLowerCase();
- if (value.equals(BKUS.LOCAL.toString().trim().toLowerCase())) {
+ if (value.equals(BKUs.LOCAL.toString().trim().toLowerCase())) {
- return BKUS.LOCAL;
+ return BKUs.LOCAL;
} else if (value
- .equals(BKUS.MOBILE.toString().trim().toLowerCase())) {
- return BKUS.MOBILE;
+ .equals(BKUs.MOBILE.toString().trim().toLowerCase())) {
+ return BKUs.MOBILE;
}
}
- return BKUS.NONE;
+ return BKUs.NONE;
}
/**
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java
index f1c291f8..efccc5de 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java
@@ -21,27 +21,28 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.components.WaitingComposite;
-import at.asit.pdfover.gui.workflow.Workflow;
-import at.asit.pdfover.gui.workflow.WorkflowState;
-import at.asit.pdfover.gui.workflow.states.BKUSelectionState.BKUS;
+import at.asit.pdfover.gui.workflow.StateMachine;
+import at.asit.pdfover.gui.workflow.StateMachineImpl;
+import at.asit.pdfover.gui.workflow.State;
+import at.asit.pdfover.gui.workflow.states.BKUSelectionState.BKUs;
/**
* User waiting state, wait for PDF Signator library to prepare document for signing.
*/
-public class PrepareSigningState extends WorkflowState {
+public class PrepareSigningState extends State {
/**
* Debug background thread
*/
private final class DebugSleeperThread implements Runnable {
- private Workflow workflow;
+ private StateMachineImpl workflow;
/**
* Default constructor
* @param work
*/
- public DebugSleeperThread(Workflow work) {
+ public DebugSleeperThread(StateMachineImpl work) {
this.workflow = work;
}
@@ -64,7 +65,7 @@ public class PrepareSigningState extends WorkflowState {
private WaitingComposite selectionComposite = null;
- private WaitingComposite getSelectionComposite(Workflow workflow) {
+ private WaitingComposite getSelectionComposite(StateMachineImpl workflow) {
if (this.selectionComposite == null) {
this.selectionComposite = new WaitingComposite(
workflow.getComposite(), SWT.RESIZE, workflow);
@@ -76,7 +77,7 @@ public class PrepareSigningState extends WorkflowState {
private boolean run = false;
@Override
- public void update(Workflow workflow) {
+ public void run(StateMachine stateMachine) {
// TODO SHOW BACKGROUND ACTIVITY ....
WaitingComposite waiting = this.getSelectionComposite(workflow);
@@ -91,9 +92,9 @@ public class PrepareSigningState extends WorkflowState {
// WAIT FOR SLREQUEST and dispatch according to BKU selection
- if(workflow.getSelectedBKU() == BKUS.LOCAL) {
+ if(workflow.getSelectedBKU() == BKUs.LOCAL) {
this.setNextState(new LocalBKUState());
- } else if(workflow.getSelectedBKU() == BKUS.MOBILE) {
+ } else if(workflow.getSelectedBKU() == BKUs.MOBILE) {
this.setNextState(new MobileBKUState());
} else {
log.error("Invalid selected BKU Value \"NONE\" in PrepareSigningState!");
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
index 8b9a5475..27dd7420 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
@@ -18,13 +18,14 @@ package at.asit.pdfover.gui.workflow.states;
//Imports
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import at.asit.pdfover.gui.workflow.Workflow;
-import at.asit.pdfover.gui.workflow.WorkflowState;
+
+import at.asit.pdfover.gui.workflow.StateMachine;
+import at.asit.pdfover.gui.workflow.State;
/**
* Logical state for signing process, usually show BKU Dialog during this state.
*/
-public class SigningState extends WorkflowState {
+public class SigningState extends State {
/**
* SFL4J Logger instance
@@ -33,7 +34,7 @@ public class SigningState extends WorkflowState {
private static final Logger log = LoggerFactory.getLogger(SigningState.class);
@Override
- public void update(Workflow workflow) {
+ public void run(StateMachine stateMachine) {
// TODO Wait until output ready and set output
this.setNextState(new OutputState());