wjhk.jupload2.context
Class JUploadContextExecutable

java.lang.Object
  extended by wjhk.jupload2.context.DefaultJUploadContext
      extended by wjhk.jupload2.context.JUploadContextExecutable
All Implemented Interfaces:
JUploadContext

public class JUploadContextExecutable
extends DefaultJUploadContext

Implementation of the JUploadContext, for an executable, that is: for a stand alone application. One such context is created at run time. Its main capabilities, is to load the properties either by a file in the jar file (see DAEMON_PROPERTIES_FILE), or an URL given to the JUploadDaemon.main(String[]) method.

Version:
$Revision: 750 $
Author:
etienne_sf
See Also:
DefaultJUploadContext, JUploadDaemon

Field Summary
(package private) static java.lang.String DAEMON_PROPERTIES_FILE
           
protected  java.util.Properties daemonProperties
          Content of the /conf/_deamon.properties file.
(package private) static java.lang.String DEFAULT_PROPERTIES_FILE
           
protected  java.util.Properties defaultProperties
          Content of the /conf/default_deamon.properties file.
private  javax.swing.JFrame jframe
          The main window of the application.
 
Fields inherited from class wjhk.jupload2.context.DefaultJUploadContext
uploadPolicy
 
Constructor Summary
protected JUploadContextExecutable(javax.swing.JFrame jframe)
          This constructor does nothing.
  JUploadContextExecutable(javax.swing.JFrame jframe, java.lang.String propertiesURL)
          The constructor of the context, which needs the top level container to be created.
 
Method Summary
 void displayURL(java.lang.String url, boolean success)
          Just throws a UnsupportedOperationException exception.
 javax.swing.JApplet getApplet()
          Just throws a UnsupportedOperationException exception.
 java.awt.Cursor getCursor()
          Just throws a UnsupportedOperationException exception.
 boolean getParameter(java.lang.String key, boolean def)
          Just throws a UnsupportedOperationException exception.
 float getParameter(java.lang.String key, float def)
          Just throws a UnsupportedOperationException exception.
 int getParameter(java.lang.String key, int def)
          Just throws a UnsupportedOperationException exception.
 long getParameter(java.lang.String key, long def)
          Just throws a UnsupportedOperationException exception.
 java.lang.String getParameter(java.lang.String key, java.lang.String def)
          Get a String parameter value from applet properties or System properties.
(package private)  java.util.Properties loadPropertiesFromFileInJar(java.lang.String filename, java.util.Properties defaultProperties)
          Creates and loads a property file, and return the loaded result.
private  java.util.Properties loadPropertiesFromURL(java.lang.String propertiesURL, java.util.Properties defaultProperties)
          Creates and loads a property file, and return the loaded result.
 java.lang.String normalizeURL(java.lang.String url)
          This class doesn't control the URL.
 void readCookieFromNavigator(java.util.Vector<java.lang.String> headers)
          Just throws a UnsupportedOperationException exception.
 void readUserAgentFromNavigator(java.util.Vector<java.lang.String> headers)
          Just throws a UnsupportedOperationException exception.
 java.awt.Cursor setCursor(java.awt.Cursor cursor)
          Just throws a UnsupportedOperationException exception.
 void showStatus(java.lang.String status)
          Just throws a UnsupportedOperationException exception.
 
Methods inherited from class wjhk.jupload2.context.DefaultJUploadContext
displayDebug, displayDebugParameterValue, displayErr, displayInfo, displayWarn, getBuildDate, getBuildNumber, getLastModified, getLogWindow, getMimeType, getSvnProperties, getUploadPanel, getUploadPolicy, getVersion, init, main, parseBoolean, parseFloat, parseInt, parseLong, registerUnload, runUnload, setProperty, setWaitCursor, startUpload
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PROPERTIES_FILE

static final java.lang.String DEFAULT_PROPERTIES_FILE
See Also:
Constant Field Values

DAEMON_PROPERTIES_FILE

static final java.lang.String DAEMON_PROPERTIES_FILE
See Also:
Constant Field Values

jframe

private javax.swing.JFrame jframe
The main window of the application.


defaultProperties

protected java.util.Properties defaultProperties
Content of the /conf/default_deamon.properties file. These value override default value, that would be wrong values for the daemon standalone application.


daemonProperties

protected java.util.Properties daemonProperties
Content of the /conf/_deamon.properties file. These value are the properties given to parameterize the daemon, according to the specific needs of the project.

Constructor Detail

JUploadContextExecutable

protected JUploadContextExecutable(javax.swing.JFrame jframe)
This constructor does nothing. It should be used by test case only.


JUploadContextExecutable

public JUploadContextExecutable(javax.swing.JFrame jframe,
                                java.lang.String propertiesURL)
The constructor of the context, which needs the top level container to be created.

Parameters:
jframe - The owner TopLevelWindow
propertiesURL - The URL where the configuration properties for the daemon can be read. If null, the daemon try to read the /conf/daemon.properties file, in the current jar.
Method Detail

loadPropertiesFromFileInJar

java.util.Properties loadPropertiesFromFileInJar(java.lang.String filename,
                                                 java.util.Properties defaultProperties)
Creates and loads a property file, and return the loaded result.

Parameters:
filename - The name of the file, which contains the properties to load
defaultProperties - The default properties value. Put null if no default Properties should be used.
Returns:
The loaded properties. It's empty if an error occurs.

loadPropertiesFromURL

private java.util.Properties loadPropertiesFromURL(java.lang.String propertiesURL,
                                                   java.util.Properties defaultProperties)
Creates and loads a property file, and return the loaded result.

Parameters:
propertiesURL - The url that points to the properties configuration file for the daemon.
defaultProperties - The default properties value. Put null if no default Properties should be used.
Returns:
The loaded properties. It's empty if an error occurs.

getParameter

public java.lang.String getParameter(java.lang.String key,
                                     java.lang.String def)
Get a String parameter value from applet properties or System properties.

Specified by:
getParameter in interface JUploadContext
Overrides:
getParameter in class DefaultJUploadContext
Parameters:
key - The name of the parameter to fetch.
def - A default value which is used, when the specified parameter is not set.
Returns:
The value of the applet parameter (resp. system property). If the parameter was not specified or no such system property exists, returns the given default value.

getParameter

public int getParameter(java.lang.String key,
                        int def)
Just throws a UnsupportedOperationException exception.

Specified by:
getParameter in interface JUploadContext
Overrides:
getParameter in class DefaultJUploadContext
Parameters:
key - The parameter name
def - The default value
Returns:
Not used

getParameter

public float getParameter(java.lang.String key,
                          float def)
Just throws a UnsupportedOperationException exception.

Specified by:
getParameter in interface JUploadContext
Overrides:
getParameter in class DefaultJUploadContext
Parameters:
key - The parameter name
def - The default value
Returns:
Not used

getParameter

public long getParameter(java.lang.String key,
                         long def)
Just throws a UnsupportedOperationException exception.

Specified by:
getParameter in interface JUploadContext
Overrides:
getParameter in class DefaultJUploadContext
Parameters:
key - The parameter name
def - The default value
Returns:
Not used

getParameter

public boolean getParameter(java.lang.String key,
                            boolean def)
Just throws a UnsupportedOperationException exception.

Specified by:
getParameter in interface JUploadContext
Overrides:
getParameter in class DefaultJUploadContext
Parameters:
key - The parameter name
def - The default value
Returns:
Not used

displayURL

public void displayURL(java.lang.String url,
                       boolean success)
Just throws a UnsupportedOperationException exception.

Specified by:
displayURL in interface JUploadContext
Overrides:
displayURL in class DefaultJUploadContext
Parameters:
url - The URL to display, in text format. It will be normalized 'before use'.
success - Indicates whether the upload was a success or not.

getApplet

public javax.swing.JApplet getApplet()
Just throws a UnsupportedOperationException exception.

Specified by:
getApplet in interface JUploadContext
Overrides:
getApplet in class DefaultJUploadContext
Returns:
Not used

getCursor

public java.awt.Cursor getCursor()
Just throws a UnsupportedOperationException exception.

Specified by:
getCursor in interface JUploadContext
Overrides:
getCursor in class DefaultJUploadContext
Returns:
Not used.
See Also:
UploadPolicy.setCursor(Cursor)

normalizeURL

public java.lang.String normalizeURL(java.lang.String url)
                              throws JUploadException
This class doesn't control the URL. It expects it to be already normalized. No work here. Just throws a UnsupportedOperationException exception.

Specified by:
normalizeURL in interface JUploadContext
Overrides:
normalizeURL in class DefaultJUploadContext
Parameters:
url - A url. Can be a path relative to the current one.
Returns:
Not used
Throws:
JUploadException

readCookieFromNavigator

public void readCookieFromNavigator(java.util.Vector<java.lang.String> headers)
Just throws a UnsupportedOperationException exception.

Specified by:
readCookieFromNavigator in interface JUploadContext
Overrides:
readCookieFromNavigator in class DefaultJUploadContext
Parameters:
headers - The headers, coming from DefaultUploadPolicy

readUserAgentFromNavigator

public void readUserAgentFromNavigator(java.util.Vector<java.lang.String> headers)
Just throws a UnsupportedOperationException exception.

Specified by:
readUserAgentFromNavigator in interface JUploadContext
Overrides:
readUserAgentFromNavigator in class DefaultJUploadContext
Parameters:
headers - The headers, coming from DefaultUploadPolicy

setCursor

public java.awt.Cursor setCursor(java.awt.Cursor cursor)
Just throws a UnsupportedOperationException exception.

Specified by:
setCursor in interface JUploadContext
Overrides:
setCursor in class DefaultJUploadContext
Parameters:
cursor - The cursor to set
Returns:
Not used
See Also:
UploadPolicy.setCursor(Cursor)

showStatus

public void showStatus(java.lang.String status)
Just throws a UnsupportedOperationException exception.

Specified by:
showStatus in interface JUploadContext
Overrides:
showStatus in class DefaultJUploadContext