net.sf.ginp.setup
Class SetupManagerImpl

java.lang.Object
  extended by net.sf.ginp.setup.SetupManagerImpl
All Implemented Interfaces:
SetupManager

public class SetupManagerImpl
extends java.lang.Object
implements SetupManager

Implementation of Setup Manager

Author:
Justin Sher
See Also:
SetupManager

Constructor Summary
SetupManagerImpl()
           
 
Method Summary
 boolean configExists(java.net.URL configUrl)
          Is there an existing valid config on this machine?
 void createConfiguration(java.net.URL configUrl, java.lang.String configuration)
          Create a configuration
 void deleteConfiguration(java.net.URL configUrl)
          Delete the configuration entry for this host
 java.lang.String finalPageTransform(SetupVisit config)
          Transform the visit for the file page
 java.lang.String getCommandLineForSetupVisit(SetupVisit visit)
          Generates a command line from a setup visit
 java.util.List getDirectoriesInPictureDirectory(SetupVisit sampleConfig)
          Find the available directories to configure in the sample configuration
 SetupVisit getSetupVisitForCommandLine(java.lang.String[] argv)
          Parses a setup visit out of a command line
 void setConfiguration(SetupVisit visit)
          Sets the configuration in the preferences from the visit's path and url
 org.dom4j.Document testValidConfig(java.io.InputStream stream)
          Tests if a configuration passes validation
 java.lang.Boolean validConfigLoc(java.lang.String path)
          Check if this is a valid location for a config file that means usually is this directory writable
 java.lang.Boolean validPicturesLoc(java.lang.String path)
          Test for valid picture location.
 boolean writeConfig(SetupVisit visit, org.dom4j.Document outputDocument)
          Write a config file to disk
 org.dom4j.Document writeConfigFromVisit(SetupVisit visit)
          Build and write config file for Ginp from the Tapestry Setup Visit Object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SetupManagerImpl

public SetupManagerImpl()
Method Detail

configExists

public boolean configExists(java.net.URL configUrl)
Description copied from interface: SetupManager
Is there an existing valid config on this machine?

Specified by:
configExists in interface SetupManager
Parameters:
configUrl - the URL identifying the config to check
Returns:
true or false
See Also:
SetupManager.configExists(URL configUrl)

deleteConfiguration

public void deleteConfiguration(java.net.URL configUrl)
Description copied from interface: SetupManager
Delete the configuration entry for this host

Specified by:
deleteConfiguration in interface SetupManager
Parameters:
configUrl - the url that the config is for
See Also:
SetupManager.deleteConfiguration(java.net.URL)

createConfiguration

public void createConfiguration(java.net.URL configUrl,
                                java.lang.String configuration)
                         throws SetupException
Description copied from interface: SetupManager
Create a configuration

Specified by:
createConfiguration in interface SetupManager
Parameters:
configUrl - the url to configure for
configuration - the configuration value
Throws:
SetupException
See Also:
SetupManager.createConfiguration(java.net.URL, java.lang.String)

validConfigLoc

public java.lang.Boolean validConfigLoc(java.lang.String path)
Description copied from interface: SetupManager
Check if this is a valid location for a config file that means usually is this directory writable

Specified by:
validConfigLoc in interface SetupManager
Parameters:
path - the path
Returns:
valid or invalid boolean
See Also:
SetupManager.validConfigLoc(java.lang.String)

testValidConfig

public org.dom4j.Document testValidConfig(java.io.InputStream stream)
                                   throws SetupException,
                                          java.io.IOException
Description copied from interface: SetupManager
Tests if a configuration passes validation

Specified by:
testValidConfig in interface SetupManager
Parameters:
stream - an input stream containing the file
Returns:
the config as a document
Throws:
SetupException - if there's a problem reading the doc note: don't be fooled, we can't report the path of the offending document because it is supplied as a Stream.
java.io.IOException
See Also:
SetupManager.testValidConfig(java.io.InputStream)

validPicturesLoc

public java.lang.Boolean validPicturesLoc(java.lang.String path)
Description copied from interface: SetupManager
Test for valid picture location. That means writable and readable

Specified by:
validPicturesLoc in interface SetupManager
Parameters:
path - the file system path
Returns:
true or false if its a valid location
See Also:
SetupManager.validPicturesLoc(java.lang.String)

writeConfigFromVisit

public org.dom4j.Document writeConfigFromVisit(SetupVisit visit)
                                        throws SetupException
Description copied from interface: SetupManager
Build and write config file for Ginp from the Tapestry Setup Visit Object

Specified by:
writeConfigFromVisit in interface SetupManager
Parameters:
visit - the visit object
Returns:
the config file as a document obj
Throws:
SetupException
See Also:
SetupManager.writeConfigFromVisit(net.sf.ginp.setup.data.SetupVisit)

writeConfig

public boolean writeConfig(SetupVisit visit,
                           org.dom4j.Document outputDocument)
                    throws java.io.FileNotFoundException,
                           java.io.UnsupportedEncodingException,
                           java.io.IOException
Description copied from interface: SetupManager
Write a config file to disk

Specified by:
writeConfig in interface SetupManager
Parameters:
visit -
outputDocument -
Returns:
success
Throws:
java.io.FileNotFoundException
java.io.UnsupportedEncodingException
java.io.IOException

finalPageTransform

public java.lang.String finalPageTransform(SetupVisit config)
                                    throws javax.xml.transform.TransformerException,
                                           org.dom4j.DocumentException
Description copied from interface: SetupManager
Transform the visit for the file page

Specified by:
finalPageTransform in interface SetupManager
Parameters:
config - the config file.
Returns:
the HTML fragment that goes in the document
Throws:
javax.xml.transform.TransformerException
org.dom4j.DocumentException
See Also:
SetupManager.finalPageTransform(net.sf.ginp.setup.data.SetupVisit)

getCommandLineForSetupVisit

public java.lang.String getCommandLineForSetupVisit(SetupVisit visit)
Description copied from interface: SetupManager
Generates a command line from a setup visit

Specified by:
getCommandLineForSetupVisit in interface SetupManager
Parameters:
visit - the setup visit
Returns:
the command line
See Also:
SetupManager.getCommandLineForSetupVisit(net.sf.ginp.setup.data.SetupVisit)

getSetupVisitForCommandLine

public SetupVisit getSetupVisitForCommandLine(java.lang.String[] argv)
                                       throws org.dom4j.DocumentException,
                                              javax.xml.transform.TransformerException
Description copied from interface: SetupManager
Parses a setup visit out of a command line

Specified by:
getSetupVisitForCommandLine in interface SetupManager
Parameters:
argv - the command line args
Returns:
the setup visit
Throws:
org.dom4j.DocumentException - if problem generating config from sample visit
javax.xml.transform.TransformerException - if problem generating config from sample visit
See Also:
SetupManager.getSetupVisitForCommandLine(java.lang.String[])

getDirectoriesInPictureDirectory

public java.util.List getDirectoriesInPictureDirectory(SetupVisit sampleConfig)
Description copied from interface: SetupManager
Find the available directories to configure in the sample configuration

Specified by:
getDirectoriesInPictureDirectory in interface SetupManager
Parameters:
sampleConfig -
Returns:
See Also:
SetupManager.getDirectoriesInPictureDirectory(net.sf.ginp.setup.data.SetupVisit)

setConfiguration

public void setConfiguration(SetupVisit visit)
                      throws java.net.MalformedURLException,
                             SetupException
Sets the configuration in the preferences from the visit's path and url

Specified by:
setConfiguration in interface SetupManager
Parameters:
visit - the Setup Visit
Throws:
SetupException
java.net.MalformedURLException
See Also:
SetupManager.setConfiguration(net.sf.ginp.setup.data.SetupVisit)


Copyright © 2004-2007 null. All Rights Reserved.