net.sf.ginp.setup
Interface SetupManager

All Known Implementing Classes:
SetupManagerImpl

public interface SetupManager

Utilities for doing the initital configuration of ginp

Author:
Justin Sher

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 sampleConfig)
          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)
          Write the configuration into the preferences API
 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 stream)
          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
 

Method Detail

configExists

boolean configExists(java.net.URL configUrl)
Is there an existing valid config on this machine?

Parameters:
configUrl - the config to check
Returns:
true or false.

deleteConfiguration

void deleteConfiguration(java.net.URL configUrl)
                         throws SetupException
Delete the configuration entry for this host

Parameters:
configUrl - the url that the config is for
Throws:
SetupException

createConfiguration

void createConfiguration(java.net.URL configUrl,
                         java.lang.String configuration)
                         throws SetupException
Create a configuration

Parameters:
configUrl - the url to configure for
configuration - the configuration value
Throws:
SetupException

validConfigLoc

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

Parameters:
path - the path
Returns:
valid or invalid boolean

testValidConfig

org.dom4j.Document testValidConfig(java.io.InputStream stream)
                                   throws SetupException,
                                          java.io.IOException
Tests if a configuration passes validation

Parameters:
stream - an input stream containing the file
Returns:
the config as a document
Throws:
SetupException - if there's an error with the document
java.io.IOException

validPicturesLoc

java.lang.Boolean validPicturesLoc(java.lang.String path)
Test for valid picture location. That means writable and readable

Parameters:
path - the file system path
Returns:
true or false if its a valid location

writeConfigFromVisit

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

Parameters:
visit - the visit object
Returns:
the config file as a document obj
Throws:
SetupException

finalPageTransform

java.lang.String finalPageTransform(SetupVisit sampleConfig)
                                    throws javax.xml.transform.TransformerException,
                                           org.dom4j.DocumentException
Transform the visit for the file page

Parameters:
sampleConfig - the config file.
Returns:
the HTML fragment that goes in the document
Throws:
org.dom4j.DocumentException
javax.xml.transform.TransformerException

getSetupVisitForCommandLine

SetupVisit getSetupVisitForCommandLine(java.lang.String[] argv)
                                       throws SetupException,
                                              org.dom4j.DocumentException,
                                              javax.xml.transform.TransformerException
Parses a setup visit out of a command line

Parameters:
argv - the command line args
Returns:
the setup visit
Throws:
javax.xml.transform.TransformerException - if problem generating config from sample visit
org.dom4j.DocumentException - if problem generating config from sample visit
SetupException - if some exception while initializing

getCommandLineForSetupVisit

java.lang.String getCommandLineForSetupVisit(SetupVisit visit)
Generates a command line from a setup visit

Parameters:
visit - the setup visit
Returns:
the command line

writeConfig

boolean writeConfig(SetupVisit visit,
                    org.dom4j.Document stream)
                    throws java.io.FileNotFoundException,
                           java.io.UnsupportedEncodingException,
                           java.io.IOException
Write a config file to disk

Parameters:
visit - the Setup Visit object containing the config file path
stream - the document to read the data to write from
Returns:
success
Throws:
java.io.IOException - read/write error
java.io.UnsupportedEncodingException - read/write error
java.io.FileNotFoundException - file to write to not found

getDirectoriesInPictureDirectory

java.util.List getDirectoriesInPictureDirectory(SetupVisit sampleConfig)
Find the available directories to configure in the sample configuration

Parameters:
sampleConfig - the sample configuration setup object
Returns:
the list of picture directories

setConfiguration

void setConfiguration(SetupVisit visit)
                      throws java.net.MalformedURLException,
                             SetupException
Write the configuration into the preferences API

Parameters:
visit - the Setup Visit
Throws:
SetupException
java.net.MalformedURLException


Copyright © 2004-2007 null. All Rights Reserved.