org.apache.muse.tools.generator.projectizer
Class AbstractProjectizer

java.lang.Object
  extended by org.apache.muse.tools.generator.projectizer.AbstractProjectizer
All Implemented Interfaces:
Projectizer, Configurable
Direct Known Subclasses:
J2EEAxis2Projectizer, J2EEMiniProjectizer, MiniProjectizer, ProxyProjectizer

public abstract class AbstractProjectizer
extends Object
implements Projectizer

AbstractProjectizer contains methods that are useful to projectizers built so far.

Author:
Andrew Eberbach (aeberbac)

Field Summary
protected  File _targetDirectory
          The target base directory in which the projectizer will projectize.
protected static String DEFAULT_RMD_NAME_SUFFIX
           
protected static String DEFAULT_WSDL_NAME_SUFFIX
          The default extension for WSDL files.
protected static String PLACE_HOLDER
          A placeholder in strings that can be replaced with a specific string.
 
Constructor Summary
AbstractProjectizer()
           
 
Method Summary
protected  void checkDirectory(File directory)
          Check to make sure that the given directory exists or can be created.
protected  void checkParentDirectory(File destination)
          Check to make sure that the parent directory of a given file exists or can be created.
protected  void copyJars(String[] moduleNames, File baseModulesDir, File destDir)
          Utility method for copying jars from the Muse distribution.
protected  void copyJars(String[] moduleNames, File baseModulesDir, File destDir, FileFilter filter)
           
protected  void copyStreamCheck(InputStream inputStream, File destination)
          Writes an InputStream to a file provided that the file doesn't already exist, and if it does then the _overwrite variable must be set to true.
protected  void copyTemplate(File sourceDir, File destinationDir)
          Copies all of the files (recursively) from the source folder into the parent folder.
protected  String createClassloadablePath(String directory, String filename)
           
protected  void createJavaSources(File javaSourceDir, Map[] filesMaps)
          Given a list of Maps (mapping file names to file contents) write the files to the target directory.
protected  void createJavaSources(File javaSourceDir, Map[] filesMaps, Set[] ignoreSets)
          Given a list of Maps (mapping file names to file contents) write the files to the target directory.
protected  void createOverwriteManifest()
          Create the overwrite manifest for this projectizer.
protected  void createRouterEntries(File routerEntriesDir, String serviceName, Map capabilities)
          Create a router entry for the given service in the given directory.
protected  String getMetadataFileName(String wsdlRelativePath, Document wsdl)
           
protected  String getWsdlFileName(String wsdlRelativePath, Document wsdl)
           
protected  String loadString(InputStream inputStream, Object[] filler)
          Read an InputStream replacing all occurences of PLACE_HOLDER with the values provided in the filler.
protected  void setTargetDirectory(File targetDirectory, boolean overwrite)
          Set the target directory for this projectizer.
protected  void updatePortType(Document wsdl, MetadataDescriptor metadata, File metadataFile)
           
protected  void writeStringtoFile(String string, File destination)
          Write a string to a file without doing any overwrite checks.
protected  void writeToFileCheck(Node node, File destination)
          Serializes an XML node and writes it out to a file provided that the file doesn't already exist, and if it does then the _overwrite variable must be set to true.
protected  void writeToFileCheck(String string, File destination)
           
protected  void writeToFileCheck(String string, File destination, boolean overwritable)
          Writes a string to a file provided that the file doesn't already exist, and if it does then the _overwrite variable must be set to true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.muse.tools.generator.projectizer.Projectizer
projectize
 
Methods inherited from interface org.apache.muse.tools.generator.util.Configurable
getConfigurationDataDescriptions
 

Field Detail

DEFAULT_WSDL_NAME_SUFFIX

protected static final String DEFAULT_WSDL_NAME_SUFFIX
The default extension for WSDL files.

See Also:
Constant Field Values

DEFAULT_RMD_NAME_SUFFIX

protected static final String DEFAULT_RMD_NAME_SUFFIX
See Also:
Constant Field Values

PLACE_HOLDER

protected static final String PLACE_HOLDER
A placeholder in strings that can be replaced with a specific string.

See Also:
Constant Field Values

_targetDirectory

protected File _targetDirectory
The target base directory in which the projectizer will projectize.

Constructor Detail

AbstractProjectizer

public AbstractProjectizer()
Method Detail

writeToFileCheck

protected void writeToFileCheck(Node node,
                                File destination)
                         throws Exception
Serializes an XML node and writes it out to a file provided that the file doesn't already exist, and if it does then the _overwrite variable must be set to true.

Parameters:
node - The DOM node to write out
destination - The file where this should be written
Throws:
Exception - If anything goes wrong

writeToFileCheck

protected void writeToFileCheck(String string,
                                File destination)
                         throws Exception
Throws:
Exception

writeToFileCheck

protected void writeToFileCheck(String string,
                                File destination,
                                boolean overwritable)
                         throws Exception
Writes a string to a file provided that the file doesn't already exist, and if it does then the _overwrite variable must be set to true.

Parameters:
string - The string to write out
destination - The file where this should be written
overwritable - Flag to see if this filename should be passed to the OverwriteHelper
Throws:
Exception - If anything goes wrong

copyStreamCheck

protected void copyStreamCheck(InputStream inputStream,
                               File destination)
                        throws Exception
Writes an InputStream to a file provided that the file doesn't already exist, and if it does then the _overwrite variable must be set to true.

Parameters:
inputStream - The InputStream to write out
destination - The file where this should be written
Throws:
Exception - If anything goes wrong

loadString

protected String loadString(InputStream inputStream,
                            Object[] filler)
                     throws Exception
Read an InputStream replacing all occurences of PLACE_HOLDER with the values provided in the filler.

Parameters:
inputStream - The source input
filler - The filler for the string template
Returns:
A string with as many PLACE_HOLDERs replaced as possible
Throws:
Exception - If anything goes wrong

copyTemplate

protected void copyTemplate(File sourceDir,
                            File destinationDir)
                     throws Exception
Copies all of the files (recursively) from the source folder into the parent folder.

Parameters:
sourceDir - The source folder
destinationDir - The destination, ie what the folder will be called
Throws:
Exception

createRouterEntries

protected void createRouterEntries(File routerEntriesDir,
                                   String serviceName,
                                   Map capabilities)
                            throws Exception
Create a router entry for the given service in the given directory. This will generate a router entry using a simple integer counter for the file name and it will contain an empty ReferenceParameters element.

Parameters:
routerEntriesDir - The directory where the router entries should be created
serviceName - The name of the service
Throws:
Exception - If anything goes wrong

createJavaSources

protected void createJavaSources(File javaSourceDir,
                                 Map[] filesMaps)
                          throws Exception
Given a list of Maps (mapping file names to file contents) write the files to the target directory.

Parameters:
javaSourceDir - The target directory
filesMaps - A list of Maps which map file names to file content
Throws:
Exception - If anything goes wrong

createJavaSources

protected void createJavaSources(File javaSourceDir,
                                 Map[] filesMaps,
                                 Set[] ignoreSets)
                          throws Exception
Given a list of Maps (mapping file names to file contents) write the files to the target directory.

Parameters:
javaSourceDir - The target directory
filesMaps - A list of Maps which map file names to file content
ignoreSets - A list of sets of files to not include in the overwrite manifest
Throws:
Exception - If anything goes wrong

copyJars

protected void copyJars(String[] moduleNames,
                        File baseModulesDir,
                        File destDir)
                 throws Exception
Utility method for copying jars from the Muse distribution. The module names serve as names of directories (ie. core, tools, and so on). The baseModulesDir is where to start from (ie. c:\muse-2.0\modules). All of the jars in each modulename directory are copied to the destDir.

Parameters:
moduleNames - The modules to copy
baseModulesDir - The location where the modules reside
destDir - The destination directory
Throws:
IOException - If anything goes wrong
Exception

copyJars

protected void copyJars(String[] moduleNames,
                        File baseModulesDir,
                        File destDir,
                        FileFilter filter)
                 throws Exception
Throws:
Exception

writeStringtoFile

protected void writeStringtoFile(String string,
                                 File destination)
                          throws Exception
Write a string to a file without doing any overwrite checks.

Parameters:
string - The string to write
destination - The file into which to write the string
Throws:
Exception

checkParentDirectory

protected void checkParentDirectory(File destination)
                             throws Exception
Check to make sure that the parent directory of a given file exists or can be created. If it can be created, then try to make the directory.

Parameters:
destination - Target file to check
Throws:
Exception

checkDirectory

protected void checkDirectory(File directory)
                       throws Exception
Check to make sure that the given directory exists or can be created. If it can be created, then try to make the directory.

Parameters:
directory - Target directory to check
Throws:
Exception

setTargetDirectory

protected void setTargetDirectory(File targetDirectory,
                                  boolean overwrite)
Set the target directory for this projectizer. Also load an OverwriteHelper to keep track of which files can be overwritten.

Parameters:
targetDirectory - The target directory for the projectizer
overwrite - Flag to determine if every conflicting file should be overwritten

createOverwriteManifest

protected void createOverwriteManifest()
                                throws Exception
Create the overwrite manifest for this projectizer. Writes out the current list of files from the OverwriteHelper.

Throws:
Exception

getWsdlFileName

protected String getWsdlFileName(String wsdlRelativePath,
                                 Document wsdl)

getMetadataFileName

protected String getMetadataFileName(String wsdlRelativePath,
                                     Document wsdl)

createClassloadablePath

protected String createClassloadablePath(String directory,
                                         String filename)

updatePortType

protected void updatePortType(Document wsdl,
                              MetadataDescriptor metadata,
                              File metadataFile)


Copyright © 2005-2011 Apache Web Services - Muse. All Rights Reserved.