diff options
author | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 18:58:27 +0000 |
---|---|---|
committer | tkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7> | 2013-04-10 18:58:27 +0000 |
commit | 96a1a5c9d04238c63247794ad9c76e5a2001b8d0 (patch) | |
tree | c0b05f0378e84e53a73cdfb62612a7d3e6ecb40a /pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow | |
parent | b8b015d3fa3b58cb5e70b4cd2ad1b8fe2a424af9 (diff) | |
download | pdf-over-96a1a5c9d04238c63247794ad9c76e5a2001b8d0.tar.gz pdf-over-96a1a5c9d04238c63247794ad9c76e5a2001b8d0.tar.bz2 pdf-over-96a1a5c9d04238c63247794ad9c76e5a2001b8d0.zip |
Moved Mobile BKU URL to configuration file
Extracted localizable Strings
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@61 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow')
12 files changed, 64 insertions, 38 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java index a669803b..b2f0f7a0 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigManipulator.java @@ -53,6 +53,11 @@ public interface ConfigManipulator { public static final String MOBILE_NUMBER_CONFIG = "MOBILE_NUMBER"; //$NON-NLS-1$ /** + * Mobile bku url config parameter + */ + public static final String MOBILE_BKU_URL_CONFIG = "MOBILE_BKU_URL"; //$NON-NLS-1$ + + /** * The emblem config parameter */ public static final String EMBLEM_CONFIG = "EMBLEM"; //$NON-NLS-1$ 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 index 4850a313..7d41a080 100644 --- 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 @@ -86,6 +86,12 @@ public interface ConfigProvider { public String getDefaultOutputFolder(); /** + * Gets the mobile BKU URL + * @return the mobile BKU URL + */ + public String getMobileBKUURL(); + + /** * Loads the current configuration to the current configuration file * @param configSource * @throws IOException diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java index 529f9d5c..ea4088c6 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProviderImpl.java @@ -42,6 +42,12 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { private BKUs defaultBKU = BKUs.NONE; + /** + * Gets the Default Mobile URL + */ + public static final String DEFAULT_MOBILE_URL = "https://www.a-trust.at/mobile/https-security-layer-request/default.aspx"; //$NON-NLS-1$ + + private SignaturePosition defaultSignaturePosition = null; /** @@ -60,6 +66,8 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { private String configurationFile = ConfigManipulator.DEFAULT_CONFIG_FILE; private int proxyPort = -1; + + private String mobileBKU = DEFAULT_MOBILE_URL; private String outputFolder = STRING_EMPTY; @@ -344,6 +352,13 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { this.setDefaultOutputFolder(config .getProperty(ConfigManipulator.OUTPUT_FOLDER_CONFIG)); + String bku = config + .getProperty(ConfigManipulator.MOBILE_BKU_URL_CONFIG); + + if(bku != null && !bku.equals("")) { //$NON-NLS-1$ + this.mobileBKU = bku; + } + // Set Proxy Port String proxyPortString = config .getProperty(ConfigManipulator.PROXY_PORT_CONFIG); @@ -433,4 +448,12 @@ public class ConfigProviderImpl implements ConfigProvider, ConfigManipulator { this.setDefaultSignaturePosition(position); } + /* (non-Javadoc) + * @see at.asit.pdfover.gui.workflow.ConfigProvider#getMobileBKUURL() + */ + @Override + public String getMobileBKUURL() { + return this.mobileBKU; + } + } 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 index 44ffd7f4..824611b5 100644 --- 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 @@ -26,6 +26,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.MainWindow; +import at.asit.pdfover.gui.Messages; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.workflow.states.PrepareConfigurationState; import at.asit.pdfover.gui.workflow.states.State; @@ -87,7 +88,7 @@ public class StateMachineImpl implements StateMachine, GUIProvider { } catch (Exception e) { log.error("StateMachine update: ", e); //$NON-NLS-1$ ErrorDialog errorState = new ErrorDialog(this.getMainShell(), - SWT.NONE, "Unexpected Error", e, false); + SWT.NONE, Messages.getString("error.Unexpected"), e, false); //$NON-NLS-1$ //errorState.setException(e); //jumpToState(errorState); errorState.open(); @@ -125,14 +126,6 @@ public class StateMachineImpl implements StateMachine, GUIProvider { this.status.setCurrentState(next); } } - - // TODO: Remove following line when releasing ... - if (this.status.getCurrentState() != null) { - this.setCurrentStateMessage(this.status.getCurrentState() - .toString()); - } else { - this.setCurrentStateMessage(""); //$NON-NLS-1$ - } } /** @@ -159,17 +152,6 @@ public class StateMachineImpl implements StateMachine, GUIProvider { private MainWindow mainWindow = null; - /** - * Helper method for developing - * - * @param value - */ - public void setCurrentStateMessage(String value) { - if (this.mainWindow != null) { - this.mainWindow.setStatus(value); - } - } - /* * (non-Javadoc) * diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java index 52dfb5c9..333b82d5 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ConfigurationUIState.java @@ -21,7 +21,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.MainWindowBehavior; -import at.asit.pdfover.gui.MainWindow.Buttons; import at.asit.pdfover.gui.composites.ConfigurationComposite; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; 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 58e957b9..0c8c7047 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 @@ -21,12 +21,12 @@ 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.Messages; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; @@ -54,7 +54,7 @@ public class LocalBKUState extends State { public final static String BKU_REPSONE_HEADER_SIGNATURE_LAYOUT = "SignatureLayout"; //$NON-NLS-1$ /** - * TODO: move to a better location ... + * PDF Over User Agent string */ public static final String PDF_OVER_USER_AGENT_STRING = "PDF-Over 4.0"; //$NON-NLS-1$ @@ -171,7 +171,7 @@ public class LocalBKUState extends State { if (this.threadException != null) { ErrorDialog dialog = new ErrorDialog( this.stateMachine.getGUIProvider().getMainShell(), SWT.NONE, - "Please check if a local BKU is running", + Messages.getString("error.LocalBKU"), //$NON-NLS-1$ this.threadException, true); if (!dialog.open()) { this.stateMachine.exit(); 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 ed6d675f..f63ecf03 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 @@ -22,6 +22,7 @@ import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.MainWindow.Buttons; import at.asit.pdfover.gui.MainWindowBehavior; +import at.asit.pdfover.gui.Messages; import at.asit.pdfover.gui.composites.MobileBKUEnterNumberComposite; import at.asit.pdfover.gui.composites.MobileBKUEnterTANComposite; import at.asit.pdfover.gui.composites.WaitingComposite; @@ -151,7 +152,7 @@ public class MobileBKUState extends State { if (this.threadException != null) { ErrorDialog error = new ErrorDialog(this.stateMachine.getGUIProvider().getMainShell(), SWT.NONE, - "Unexpected Error", this.threadException, false); + Messages.getString("error.Unexpected"), this.threadException, false); //$NON-NLS-1$ //error.setException(this.threadException); //this.setNextState(error); error.open(); @@ -164,7 +165,7 @@ public class MobileBKUState extends State { this.stateMachine.getGUIProvider().display( this.getWaitingComposite()); Thread postSLRequestThread = new Thread(new PostSLRequestThread( - this)); + this, this.stateMachine.getConfigProvider().getMobileBKUURL())); postSLRequestThread.start(); break; case POST_NUMBER: 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 5a42d3cc..f42473a9 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 @@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.MainWindow.Buttons; import at.asit.pdfover.gui.MainWindowBehavior; +import at.asit.pdfover.gui.Messages; import at.asit.pdfover.gui.composites.OutputComposite; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.workflow.StateMachine; @@ -47,7 +48,6 @@ public class OutputState extends State { /** * SFL4J Logger instance **/ - @SuppressWarnings("unused") private static final Logger log = LoggerFactory .getLogger(OutputState.class); @@ -89,7 +89,8 @@ public class OutputState extends State { output.close(); } catch (IOException e) { log.error("Failed to save signed document to configured output folder.", e); //$NON-NLS-1$ - ErrorDialog dialog = new ErrorDialog(outputComposite.getShell(), SWT.NONE, "Failed to save signed document to configured output folder.", e, false); + ErrorDialog dialog = new ErrorDialog(outputComposite.getShell(), SWT.NONE, + Messages.getString("error.SaveOutputFolder"), e, false); //$NON-NLS-1$ dialog.open(); } } 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 f720cb57..6957f85c 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 @@ -25,11 +25,13 @@ import org.eclipse.swt.SWT; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.Messages; import at.asit.pdfover.gui.cliarguments.ArgumentHandler; import at.asit.pdfover.gui.cliarguments.BKUArgument; import at.asit.pdfover.gui.cliarguments.ConfigFileArgument; import at.asit.pdfover.gui.cliarguments.EmblemArgument; import at.asit.pdfover.gui.cliarguments.HelpArgument; +import at.asit.pdfover.gui.cliarguments.InputDocumentArgument; import at.asit.pdfover.gui.cliarguments.OutputFolderArgument; import at.asit.pdfover.gui.cliarguments.PasswordArgument; import at.asit.pdfover.gui.cliarguments.PhoneNumberArgument; @@ -63,9 +65,11 @@ public class PrepareConfigurationState extends State { this.handler.addCLIArgument(new ProxyHostArgument()); this.handler.addCLIArgument(new ProxyPortArgument()); this.handler.addCLIArgument(new OutputFolderArgument()); + this.handler.addCLIArgument(new InputDocumentArgument()); // adding config file argument to this handler so it appears in help this.handler.addCLIArgument(new ConfigFileArgument()); - + + this.configFilehandler = new ArgumentHandler(this.stateMachine); this.configFilehandler.addCLIArgument(new ConfigFileArgument()); } @@ -155,7 +159,7 @@ public class PrepareConfigurationState extends State { } catch (InitializationException e) { log.error("Failed to initialize: ", e); //$NON-NLS-1$ ErrorDialog error = new ErrorDialog(this.stateMachine.getGUIProvider().getMainShell(), - SWT.NONE, "Initialization failed. Please check your configuration.", + SWT.NONE, Messages.getString("error.Initialization"), //$NON-NLS-1$ e, false); //error.setException(e); //this.setNextState(error); 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 38215593..7d8b5987 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 @@ -22,6 +22,7 @@ import org.slf4j.LoggerFactory; import at.asit.pdfover.gui.MainWindow.Buttons; import at.asit.pdfover.gui.MainWindowBehavior; +import at.asit.pdfover.gui.Messages; import at.asit.pdfover.gui.composites.WaitingComposite; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.workflow.ConfigProvider; @@ -153,7 +154,7 @@ public class PrepareSigningState extends State { if(this.threadException != null) { ErrorDialog error = new ErrorDialog(this.stateMachine.getGUIProvider().getMainShell(), - SWT.NONE, "Failed to prepare document for signature.", this.threadException, + SWT.NONE, Messages.getString("error.PrepareDocument"), this.threadException, //$NON-NLS-1$ true); this.threadException = null; if(error.open()) { 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 37877f12..6079893b 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 @@ -20,6 +20,7 @@ import org.eclipse.swt.SWT; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.Messages; import at.asit.pdfover.gui.controls.ErrorDialog; import at.asit.pdfover.gui.workflow.StateMachine; import at.asit.pdfover.gui.workflow.Status; @@ -87,7 +88,7 @@ public class SigningState extends State { if(this.threadException != null) { ErrorDialog error = new ErrorDialog(this.stateMachine.getGUIProvider().getMainShell(), - SWT.NONE, "Signature error", this.threadException, true); + SWT.NONE, Messages.getString("error.Signatur"), this.threadException, true); //$NON-NLS-1$ this.threadException = null; if(error.open()) { this.stateMachine.update(); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java index fb52fce8..789fafac 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java @@ -28,6 +28,7 @@ import org.apache.commons.httpclient.protocol.Protocol; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.gui.workflow.ConfigManipulator; import at.asit.pdfover.gui.workflow.states.LocalBKUState; import at.asit.pdfover.gui.workflow.states.MobileBKUState; @@ -43,13 +44,17 @@ public class PostSLRequestThread implements Runnable { private MobileBKUState state; + private String mobileBKUUrl = ConfigManipulator.MOBILE_BKU_URL_CONFIG; + /** * Constructor * * @param state + * @param mobileBKUUrl */ - public PostSLRequestThread(MobileBKUState state) { + public PostSLRequestThread(MobileBKUState state, String mobileBKUUrl) { this.state = state; + this.mobileBKUUrl = mobileBKUUrl; } /* @@ -69,11 +74,9 @@ public class PostSLRequestThread implements Runnable { HttpClient client = new HttpClient(); client.getParams().setParameter("http.useragent", //$NON-NLS-1$ LocalBKUState.PDF_OVER_USER_AGENT_STRING); - - // TODO: move URL to config? - String url = "https://www.a-trust.at/mobile/https-security-layer-request/default.aspx"; //$NON-NLS-1$ - //String url = "https://test1.a-trust.at/https-security-layer-request/default.aspx"; - + + String url = this.mobileBKUUrl; + PostMethod method = new PostMethod(url); method.addParameter("XMLRequest", sl_request); //$NON-NLS-1$ |