org.objectweb.jonas_ws.wsgen
Class AbsConfigGenerator

java.lang.Object
  extended byorg.objectweb.jonas_ws.wsgen.AbsConfigGenerator
All Implemented Interfaces:
ConfigGenerator
Direct Known Subclasses:
AxisConfigGenerator

public abstract class AbsConfigGenerator
extends java.lang.Object
implements ConfigGenerator

This class realizes configuration files generation. This class implements genEndpointConfig & genClientConfig methods; configuration methods stay abstract (WS implementation specific).
A class is created for each WS Engine for example, a new class called GlueConfigGenerator for Glue integration.

Author:
Xavier Delplanque & Guillaume Sauthier

Field Summary
protected  GenerationContext gCtx
          GenerationContext
protected static org.objectweb.util.monolog.api.Logger logger
          WsGen logger
 
Fields inherited from interface org.objectweb.jonas_ws.wsgen.ConfigGenerator
DEBUG, DEBUG_DEFAULT, DEFAULT_MAPPING, JAVAC_NAME, JAVAC_NAME_DEFAULT, JAVAC_OPTS, KEEP_GEN, KEEP_GEN_DEFAULT, NO_CONFIG, NO_CONFIG_DEFAULT, PARSING_VAL, SERVLET_CLASS, SERVLET_NAME, VERBOSE, VERBOSE_DEFAULT
 
Constructor Summary
AbsConfigGenerator(GenerationContext ctx)
          Constructor : creates a AbsConfigGenerator object.
 
Method Summary
protected static void addJavaSources(java.io.File dir, java.util.Vector srcs)
          Add all *.java files from directory into Vector.
 void clean()
          Remove temp directories.
protected  void compileDir(java.io.File srcDir, java.io.File destDir)
          Compile Java sources files of directory.
protected  void configureClient()
          configureClient has to be implemented in subClass.
protected  void configureEjbJarEndpoint()
          configureEjbJarEndpoint has to be implemented in subClass.
protected  void configureWebAppEndpoint()
          configureWebAppEndpoint has to be implemented in subClass.
protected static boolean destroyFile(java.io.File file)
          Recursively destroy the given file.
protected  void destroyTempDirectories()
          Destroy the temporary directory used for generation.
protected  void genClientFiles(ServiceRef[] servRefs)
          Generate client files for a set of ServiceRef.
 void genEjbJarClientConfig(EjbJarManager jm, java.util.Iterator bdIt)
          Generate client configuration files for each ServiceRef of bean descs.
 void genEjbJarEndpointConfig(WarManager wm, WSDeploymentDesc dd)
          Generate endpoint configuration files for the set of ServiceDesc included in WSDeploymentDesc contained in an EjbJar.
 void genWebAppClientConfig(WarManager wm, ServiceRef[] servRefs)
          Generate client configuration files for the list of ServiceRef of a War.
 void genWebAppEndpointConfig(WarManager wm, WSDeploymentDesc dd)
          Generate endpoint configuration files for the set of ServiceDesc included in WSDeploymentDesc contained in a WebApp.
protected  java.io.File getClientGenDir(java.lang.String id)
          Return the generation directory from ID
protected  java.io.File getEjbJarEndpointGenDir(java.lang.String id)
          Return the generation directory from ID
protected  java.lang.String getProcessingID()
          Return the processing ID from GenerationContext.
protected  java.io.File getWebAppEndpointGenDir(java.lang.String id)
          Return the generation directory from ID
protected  boolean isDebug()
          return true if debug mode is set.
protected  boolean isKeepGenerated()
          return true if keep generated files mode is set.
protected  boolean isNoConfig()
          return true if noConfig mode is set.
protected  boolean isVerbose()
          return true if verbose mode is set.
protected  void trace(java.lang.String msg)
          Display the specified message only if verbose.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static org.objectweb.util.monolog.api.Logger logger
WsGen logger


gCtx

protected GenerationContext gCtx
GenerationContext

Constructor Detail

AbsConfigGenerator

public AbsConfigGenerator(GenerationContext ctx)
Constructor : creates a AbsConfigGenerator object.

Parameters:
ctx - GenerationContext storing properties
Method Detail

genWebAppEndpointConfig

public void genWebAppEndpointConfig(WarManager wm,
                                    WSDeploymentDesc dd)
                             throws WsGenException
Generate endpoint configuration files for the set of ServiceDesc included in WSDeploymentDesc contained in a WebApp. Common method for all Web Services implementation (Glue/Axis).

Specified by:
genWebAppEndpointConfig in interface ConfigGenerator
Parameters:
wm - the managed war file.
dd - The DeploymentDesc to process (image of a webservices.xml)
Throws:
WsGenException - if generation fails

genEjbJarEndpointConfig

public void genEjbJarEndpointConfig(WarManager wm,
                                    WSDeploymentDesc dd)
                             throws WsGenException
Generate endpoint configuration files for the set of ServiceDesc included in WSDeploymentDesc contained in an EjbJar. Common method for all Web Services implementation (Glue/Axis).

Specified by:
genEjbJarEndpointConfig in interface ConfigGenerator
Parameters:
wm - the war file dispatching request on EJBs endpoint.
dd - The DeploymentDesc to process (image of a webservices.xml)
Throws:
WsGenException - if generation fails

addJavaSources

protected static void addJavaSources(java.io.File dir,
                                     java.util.Vector srcs)
                              throws WsGenException
Add all *.java files from directory into Vector.

Parameters:
dir - directory containing source files.
srcs - Vector updates with source files.
Throws:
WsGenException - when IOException occurs.

compileDir

protected void compileDir(java.io.File srcDir,
                          java.io.File destDir)
                   throws WsGenException
Compile Java sources files of directory.

Parameters:
srcDir - File representing source directory.
destDir - File representing destination directory.
Throws:
WsGenException - when compilation fails.

genClientFiles

protected void genClientFiles(ServiceRef[] servRefs)
                       throws WsGenException
Generate client files for a set of ServiceRef.

Parameters:
servRefs - an Array of ServiceRef.
Throws:
WsGenException - when configureClient fails.

genEjbJarClientConfig

public void genEjbJarClientConfig(EjbJarManager jm,
                                  java.util.Iterator bdIt)
                           throws WsGenException
Generate client configuration files for each ServiceRef of bean descs. Common method for all Web Services implementation (Glue/Axis).

Specified by:
genEjbJarClientConfig in interface ConfigGenerator
Parameters:
jm - the jar file containing clients.
bdIt - an iterator on a bean desc list
Throws:
WsGenException - if generation fails

genWebAppClientConfig

public void genWebAppClientConfig(WarManager wm,
                                  ServiceRef[] servRefs)
                           throws WsGenException
Generate client configuration files for the list of ServiceRef of a War. Common method for all Web Services implementation (Glue/Axis).

Specified by:
genWebAppClientConfig in interface ConfigGenerator
Parameters:
wm - the managed war file.
servRefs - The list of ServiceRef to process.
Throws:
WsGenException - if generation fails

destroyFile

protected static boolean destroyFile(java.io.File file)
Recursively destroy the given file.

Parameters:
file - the file to destroy.
Returns:
true if deletion OK, otherwise false.

destroyTempDirectories

protected void destroyTempDirectories()
Destroy the temporary directory used for generation.


getProcessingID

protected java.lang.String getProcessingID()
Return the processing ID from GenerationContext.

Returns:
the processing ID from GenerationContext.

getWebAppEndpointGenDir

protected java.io.File getWebAppEndpointGenDir(java.lang.String id)
Return the generation directory from ID

Parameters:
id - processing id
Returns:
the File for the directory

getEjbJarEndpointGenDir

protected java.io.File getEjbJarEndpointGenDir(java.lang.String id)
Return the generation directory from ID

Parameters:
id - processing id
Returns:
the File for the directory

getClientGenDir

protected java.io.File getClientGenDir(java.lang.String id)
Return the generation directory from ID

Parameters:
id - processing id
Returns:
the File for the directory

configureWebAppEndpoint

protected void configureWebAppEndpoint()
                                throws WsGenException
configureWebAppEndpoint has to be implemented in subClass. hold specific process for endpoint with specific WebService engine.

Throws:
WsGenException - if generation fails if the method isn't implemented

configureEjbJarEndpoint

protected void configureEjbJarEndpoint()
                                throws WsGenException
configureEjbJarEndpoint has to be implemented in subClass. hold specific process for endpoint with specific WebService engine.

Throws:
WsGenException - if generation fails if the method isn't implemented

configureClient

protected void configureClient()
                        throws WsGenException
configureClient has to be implemented in subClass. hold specific process for client with specific WebService engine.

Throws:
WsGenException - if generation fails if the method isn't implemented

trace

protected void trace(java.lang.String msg)
Display the specified message only if verbose.

Parameters:
msg - the message to display

isVerbose

protected boolean isVerbose()
return true if verbose mode is set.

Returns:
true if verbose mode is set.

isDebug

protected boolean isDebug()
return true if debug mode is set.

Returns:
true if debug mode is set.

isNoConfig

protected boolean isNoConfig()
return true if noConfig mode is set.

Returns:
true if noConfig mode is set.

isKeepGenerated

protected boolean isKeepGenerated()
return true if keep generated files mode is set.

Returns:
true if keep generated files mode is set.

clean

public void clean()
Remove temp directories.

Specified by:
clean in interface ConfigGenerator