You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-dev@ws.apache.org by ip...@apache.org on 2004/12/24 19:06:03 UTC
svn commit: r123296 - /incubator/apollo/trunk/apache_incubator.ppt /incubator/apollo/trunk/build.properties.sample /incubator/apollo/trunk/src/java/org/apache/ws/resource/Wsdl2Java.java /incubator/apollo/trunk/src/java/org/apache/ws/resource/Wsdl2JavaTask.java
Author: ips
Date: Fri Dec 24 10:06:02 2004
New Revision: 123296
URL: http://svn.apache.org/viewcvs?view=rev&rev=123296
Log:
various minor
Added:
incubator/apollo/trunk/build.properties.sample
Removed:
incubator/apollo/trunk/apache_incubator.ppt
Modified:
incubator/apollo/trunk/src/java/org/apache/ws/resource/Wsdl2Java.java
incubator/apollo/trunk/src/java/org/apache/ws/resource/Wsdl2JavaTask.java
Deleted: /incubator/apollo/trunk/apache_incubator.ppt
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/apache_incubator.ppt?view=auto&rev=123295
==============================================================================
Added: incubator/apollo/trunk/build.properties.sample
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/build.properties.sample?view=auto&rev=123296
==============================================================================
--- (empty file)
+++ incubator/apollo/trunk/build.properties.sample Fri Dec 24 10:06:02 2004
@@ -0,0 +1,16 @@
+# MAVEN CORE
+##############
+# comma-spearated list of remote JAR repository URLs
+maven.repo.remote = http://www.apache.org/dist/java-repository/, http://cvs.apache.org/repository/, http://mirrors.sunsite.dk/maven/, http://apache.org/~ips/maven-repo/, http://mip.esr.hp.com/wsdm/repository
+
+# AJAR PLUGIN
+##############
+maven.ajar.src.enabled = true
+maven.ajar.src.expand.enabled = false
+
+maven.ajar.api.enabled = true
+maven.ajar.api.expand.enabled = true
+
+# INTELLIJ PLUGIN
+##################
+idea.project.iml = C:/Documents and Settings/Ian P. Springer/IdeaProjects/Apollo/Apollo.iml
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/Wsdl2Java.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/Wsdl2Java.java?view=diff&rev=123296&p1=incubator/apollo/trunk/src/java/org/apache/ws/resource/Wsdl2Java.java&r1=123295&p2=incubator/apollo/trunk/src/java/org/apache/ws/resource/Wsdl2Java.java&r2=123296
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/Wsdl2Java.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/Wsdl2Java.java Fri Dec 24 10:06:02 2004
@@ -16,6 +16,7 @@
package org.apache.ws.resource;
import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.apache.commons.lang.StringUtils;
@@ -27,8 +28,8 @@
import org.apache.ws.resource.i18n.Keys;
import org.apache.ws.resource.i18n.MessagesImpl;
import org.apache.ws.resource.impl.ResourceDefinitionImpl;
-import org.apache.ws.util.XmlBeanNameUtils;
import org.apache.ws.util.GenerationUtils;
+import org.apache.ws.util.XmlBeanNameUtils;
import org.apache.ws.util.i18n.Messages;
import org.apache.ws.util.velocity.ConstQNames;
import org.apache.ws.util.velocity.ImplementsListBuilder;
@@ -59,536 +60,550 @@
*/
public class Wsdl2Java
{
-
- private static final Messages MSG = MessagesImpl.getInstance( );
- /** DOCUMENT_ME */
- protected static final org.apache.commons.cli.Options CMD_LINE_OPTIONS = new org.apache.commons.cli.Options( );
+ private static final Messages MSG = MessagesImpl.getInstance();
- /** DOCUMENT_ME */
- protected static final String LONG_OPT_SRC_OUTPUT_DIR = "srcOutputDir";
+ /**
+ * DOCUMENT_ME
+ */
+ protected static final Options CMD_LINE_OPTIONS = new Options();
- /** DOCUMENT_ME */
- protected static final String LONG_OPT_CLASSES_OUTPUT_DIR = "classesOutputDir";
-
- /** DOCUMENT_ME */
- protected static final String LONG_OPT_VERBOSE = "verbose";
-
- /** DOCUMENT_ME */
- protected static final String LONG_OPT_DEBUG = "debug";
-
- /** DOCUMENT_ME */
- protected static final String LONG_OPT_CLASSPATH = "classpath";
-
- /**
- * Denotes if service is a singleton
- */
- protected static final String LONG_OPT_IS_SINGLETON = "singleton";
-
- /**
- * QName (squigly format) of Resource Key to be used.
- */
- protected static final String LONG_OPT_RESOURCEKEY = "resourcekey";
-
- static
- {
- initCmdLineOptions( );
- }
-
- private File[] m_wsdlFiles;
- private File m_srcOutputDir;
- private File m_classesOutputDir;
- private Options m_options;
- private boolean m_isSingleton;
- private String m_resourceKey;
+ static
+ {
+ initCmdLineOptions();
+ }
+ private File[] m_wsdlFiles;
+ private File m_srcOutputDir;
+ private File m_classesOutputDir;
+ private Wsdl2JavaOptions m_options;
/**
- * Creates a new {@link Wsdl2Java} object.
- *
- * @param wsdlFiles DOCUMENT_ME
- * @param srcOutputDir DOCUMENT_ME
+ * Creates a new {@link Wsdl2Java} object.
+ *
+ * @param wsdlFiles DOCUMENT_ME
+ * @param srcOutputDir DOCUMENT_ME
* @param classesOutputDir DOCUMENT_ME
- * @param options DOCUMENT_ME
- * @param singleton
- * @param resourceKey
+ * @param options DOCUMENT_ME
+ */
+ public Wsdl2Java( File[] wsdlFiles,
+ File srcOutputDir,
+ File classesOutputDir,
+ Wsdl2JavaOptions options )
+ {
+ m_wsdlFiles = wsdlFiles;
+ if ( m_wsdlFiles.length == 0 )
+ {
+ System.out.println( MSG.getMessage( Keys.WARN_EMPTY_WSDLS ) );
+ }
+
+ m_srcOutputDir = srcOutputDir;
+ m_classesOutputDir = classesOutputDir;
+ m_options = ( options != null ) ? options : new Wsdl2JavaOptions();
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public File getClassesOutputDir()
+ {
+ return m_classesOutputDir;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public Wsdl2JavaOptions getOptions()
+ {
+ return m_options;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
*/
- public Wsdl2Java(File[] wsdlFiles,
- File srcOutputDir,
- File classesOutputDir,
- Options options, boolean singleton, String resourceKey)
- {
- m_wsdlFiles = wsdlFiles;
- if ( m_wsdlFiles.length == 0 )
- {
- System.out.println( MSG.getMessage( Keys.WARN_EMPTY_WSDLS ) );
- }
-
- m_srcOutputDir = srcOutputDir;
- m_classesOutputDir = classesOutputDir;
- m_options = ( options != null ) ? options : new Options( );
- m_isSingleton = singleton;
- m_resourceKey = resourceKey;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public File getClassesOutputDir( )
- {
- return m_classesOutputDir;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public Options getOptions( )
- {
- return m_options;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public File getSrcOutputDir( )
- {
- return m_srcOutputDir;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public File[] getWsdlFiles( )
- {
- return m_wsdlFiles;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @throws Exception DOCUMENT_ME
- */
- public void generate( )
- throws Exception
- {
- //generateXmlBeans( );
- initVelocityProperties( );
- for ( int i = 0; i < m_wsdlFiles.length; i++ )
- {
- WSDLReader wsdlReader = WSDLFactory.newInstance( ).newWSDLReader( );
- File wsdlFile = m_wsdlFiles[i];
- Definition def = wsdlReader.readWSDL( wsdlFile.getPath() );
- Iterator serviceIter = def.getServices( ).values( ).iterator( );
- while ( serviceIter.hasNext( ) )
- {
- Service service = (Service) serviceIter.next( );
- ResourceDefinition resourceDef = new ResourceDefinitionImpl( def, service );
- generateSkeletonCode(resourceDef,wsdlFile.getName());
- }
- }
- }
+ public File getSrcOutputDir()
+ {
+ return m_srcOutputDir;
+ }
/**
- * DOCUMENT_ME
- *
- * @param args DOCUMENT_ME
- *
- * @throws ParseException DOCUMENT_ME
- */
- public static void main( String[] args )
- throws ParseException
- {
- CommandLine cmdLine = new PosixParser( ).parse( CMD_LINE_OPTIONS, args, true );
- checkForRequiredOption( cmdLine, "s" );
- checkForRequiredOption( cmdLine, "c" );
- File srcOutputDir = new File( cmdLine.getOptionValue( "s" ) );
- File classesOutputDir = new File( cmdLine.getOptionValue( "c" ) );
- Options options = new Wsdl2Java.Options( );
- boolean singleton = false;
- String resourceKey = null;
-
- if( cmdLine.hasOption( LONG_OPT_IS_SINGLETON))
- {
- singleton = true;
- }
- if( cmdLine.hasOption( LONG_OPT_RESOURCEKEY))
- {
- resourceKey = cmdLine.getOptionValue( LONG_OPT_RESOURCEKEY );
- }
- if ( cmdLine.hasOption( LONG_OPT_CLASSPATH ) )
- {
- options.setClasspath( cmdLine.getOptionValue( LONG_OPT_CLASSPATH ) );
- }
-
- if ( cmdLine.hasOption( LONG_OPT_VERBOSE ) )
- {
- options.setVerbose( Boolean.valueOf( cmdLine.getOptionValue( LONG_OPT_VERBOSE ) ).booleanValue( ) );
- }
-
- if ( cmdLine.hasOption( LONG_OPT_DEBUG ) )
- {
- options.setVerbose( Boolean.valueOf( cmdLine.getOptionValue( LONG_OPT_DEBUG ) ).booleanValue( ) );
- }
-
- File[] wsdlFiles = new File[cmdLine.getArgs( ).length];
- for ( int i = 0; i < cmdLine.getArgs( ).length; i++ )
- {
- wsdlFiles[i] = new File( cmdLine.getArgs( )[i] );
- }
-
- try
- {
- System.out.println( MSG.getMessage( Keys.WSDL4J_PASSED_ARGUMENTS,
- Integer.toString( wsdlFiles.length ),
- srcOutputDir.toString( ),
- classesOutputDir.toString( ) ) );
- new Wsdl2Java( wsdlFiles, srcOutputDir, classesOutputDir, options, singleton, resourceKey ).generate( );
- }
- catch ( Exception e )
- {
- e.printStackTrace( );
- System.exit( 1 );
- }
- }
-
- private static void checkForRequiredOption( CommandLine cmdLine,
- String opt )
- {
- if ( !cmdLine.hasOption( opt ) )
- {
- System.err.println( MSG.getMessage( Keys.OPT_REQUIRED, opt ) );
- System.exit( 1 );
- }
- }
-
- private static void initCmdLineOptions( )
- {
- CMD_LINE_OPTIONS.addOption( "s",
- LONG_OPT_SRC_OUTPUT_DIR,
- true,
- MSG.getMessage( Keys.OPT_OUTPUT_DIR_FOR_GEN_SRC ) );
- CMD_LINE_OPTIONS.addOption( "c",
- LONG_OPT_CLASSES_OUTPUT_DIR,
- true,
- MSG.getMessage( Keys.OPT_OUTPUT_DIR_FOR_GEN_CLASSES ) );
- CMD_LINE_OPTIONS.addOption( "v",
- LONG_OPT_VERBOSE,
- false,
- MSG.getMessage( Keys.OPT_ENABLE_VERBOSE ) );
- CMD_LINE_OPTIONS.addOption( "d",
- LONG_OPT_DEBUG,
- false,
- MSG.getMessage( Keys.OPT_ENABLE_DEBUG ) );
- CMD_LINE_OPTIONS.addOption( "C",
- LONG_OPT_CLASSPATH,
- false,
- MSG.getMessage( Keys.OPT_CLASSPATH_SENT_TO_XMLBEANS ) );
- }
-
- private void generateSkeletonCode(ResourceDefinition resourceDef, String wsdlFileName)
- throws Exception
- {
- String serviceName = StringUtils.capitalize(resourceDef.getName());
- try
- {
- VelocityContext context = new VelocityContext( );
- String targetNamespace = resourceDef.getDefinition().getTargetNamespace();
- ServiceProperties props = buildServiceProperties(serviceName, resourceDef, wsdlFileName,targetNamespace);
-
- //add to context
- context.put( "generated", props );
- context.put( "qnames", new ConstQNames() );
-
- //generate files
- String javaPackageName = GenerationUtils.getJavaPackageName(targetNamespace);
- javaPackageName = javaPackageName.replace('.','/');
- File packageDir = new File(m_srcOutputDir, javaPackageName);
- packageDir.mkdirs();
- File generatedSrc = new File( packageDir, "Abstract" + serviceName + "Service.java" );
- writeGeneratedSrcFile( context,
- "templates/AbstractService.vm",
- generatedSrc.getAbsolutePath( ) );
-
- generatedSrc = new File( packageDir, serviceName + "Service.java" );
- //only generate if it doesn't exist
- if(!generatedSrc.exists())
- {
- writeGeneratedSrcFile( context,
- "templates/Service.vm",
- generatedSrc.getAbsolutePath( ) );
- }
- generatedSrc = new File( packageDir, "Abstract" + serviceName + "Resource.java" );
- writeGeneratedSrcFile( context,
- "templates/AbstractResource.vm",
- generatedSrc.getAbsolutePath( ) );
-
- generatedSrc = new File( packageDir, serviceName + "Resource.java" );
- //only generate if it doesn't exist
- if(!generatedSrc.exists())
- {
- writeGeneratedSrcFile( context,
- "templates/Resource.vm",
- generatedSrc.getAbsolutePath( ) );
- }
-
- generatedSrc = new File( packageDir, serviceName + "Home.java" );
- //only generate if it doesn't exist
- if(!generatedSrc.exists())
- {
- writeGeneratedSrcFile( context,
- "templates/Home.vm",
- generatedSrc.getAbsolutePath( ) );
- }
- //only if they implemented properties does this make sense.
- if(resourceDef.hasProperties())
- {
- generatedSrc = new File( packageDir, serviceName + "PropertyQNames.java" );
- writeGeneratedSrcFile( context,
- "templates/PropertyQNames.vm",
- generatedSrc.getAbsolutePath( ) );
- }
-
- generatedSrc = new File( packageDir, serviceName + "_deploy.wsdd" );
- writeGeneratedSrcFile( context,
- "templates/deploy.vm",
- generatedSrc.getAbsolutePath( ) );
-
- generatedSrc = new File( packageDir, serviceName + "_jndi-config.wsdd" );
- writeGeneratedSrcFile( context,
- "templates/jndi.vm",
- generatedSrc.getAbsolutePath( ) );
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public File[] getWsdlFiles()
+ {
+ return m_wsdlFiles;
+ }
+ /**
+ * DOCUMENT_ME
+ *
+ * @throws Exception DOCUMENT_ME
+ */
+ public void generate()
+ throws Exception
+ {
+ //generateXmlBeans( );
+ initVelocityProperties();
+ for ( int i = 0; i < m_wsdlFiles.length; i++ )
+ {
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ File wsdlFile = m_wsdlFiles[i];
+ Definition def = wsdlReader.readWSDL( wsdlFile.getPath() );
+ Iterator serviceIter = def.getServices().values().iterator();
+ while ( serviceIter.hasNext() )
+ {
+ Service service = (Service) serviceIter.next();
+ ResourceDefinition resourceDef = new ResourceDefinitionImpl( def, service );
+ generateSkeletonCode( resourceDef, wsdlFile.getName() );
+ }
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param args DOCUMENT_ME
+ *
+ * @throws ParseException DOCUMENT_ME
+ */
+ public static void main( String[] args )
+ throws ParseException
+ {
+ CommandLine cmdLine = new PosixParser().parse( CMD_LINE_OPTIONS, args, true );
+ checkForRequiredOption( cmdLine, "s" );
+ checkForRequiredOption( cmdLine, "c" );
+ File srcOutputDir = new File( cmdLine.getOptionValue( "s" ) );
+ File classesOutputDir = new File( cmdLine.getOptionValue( "c" ) );
+ Wsdl2JavaOptions options = new Wsdl2Java.Wsdl2JavaOptions();
+ if ( cmdLine.hasOption( Opts.SINGLETON ) )
+ {
+ options.setSingleton( true );
+ }
+ if ( cmdLine.hasOption( Opts.RESOURCE_KEY ) )
+ {
+ options.setResourceKey( QName.valueOf( cmdLine.getOptionValue( Opts.RESOURCE_KEY ) ) );
+ }
+ if ( cmdLine.hasOption( Opts.CLASSPATH ) )
+ {
+ options.setClasspath( cmdLine.getOptionValue( Opts.CLASSPATH ) );
+ }
+
+ if ( cmdLine.hasOption( Opts.VERBOSE ) )
+ {
+ options.setVerbose( Boolean.valueOf( cmdLine.getOptionValue( Opts.VERBOSE ) ).booleanValue() );
+ }
+
+ if ( cmdLine.hasOption( Opts.DEBUG ) )
+ {
+ options.setVerbose( Boolean.valueOf( cmdLine.getOptionValue( Opts.DEBUG ) ).booleanValue() );
+ }
+
+ File[] wsdlFiles = new File[cmdLine.getArgs().length];
+ for ( int i = 0; i < cmdLine.getArgs().length; i++ )
+ {
+ wsdlFiles[i] = new File( cmdLine.getArgs()[i] );
+ }
+
+ try
+ {
+ System.out.println( MSG.getMessage( Keys.WSDL4J_PASSED_ARGUMENTS,
+ Integer.toString( wsdlFiles.length ),
+ srcOutputDir.toString(),
+ classesOutputDir.toString() ) );
+ new Wsdl2Java( wsdlFiles, srcOutputDir, classesOutputDir, options ).generate();
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ System.exit( 1 );
+ }
+ }
+
+ private static void checkForRequiredOption( CommandLine cmdLine,
+ String opt )
+ {
+ if ( !cmdLine.hasOption( opt ) )
+ {
+ System.err.println( MSG.getMessage( Keys.OPT_REQUIRED, opt ) );
+ System.exit( 1 );
+ }
+ }
+
+ private static void initCmdLineOptions()
+ {
+ CMD_LINE_OPTIONS.addOption( Opts.SRC_OUTPUT_DIR,
+ LongOpts.SRC_OUTPUT_DIR,
+ true,
+ MSG.getMessage( Keys.OPT_OUTPUT_DIR_FOR_GEN_SRC ) );
+ CMD_LINE_OPTIONS.addOption( Opts.CLASSES_OUTPUT_DIR,
+ LongOpts.CLASSES_OUTPUT_DIR,
+ true,
+ MSG.getMessage( Keys.OPT_OUTPUT_DIR_FOR_GEN_CLASSES ) );
+ CMD_LINE_OPTIONS.addOption( Opts.VERBOSE,
+ LongOpts.VERBOSE,
+ false,
+ MSG.getMessage( Keys.OPT_ENABLE_VERBOSE ) );
+ CMD_LINE_OPTIONS.addOption( Opts.DEBUG,
+ LongOpts.DEBUG,
+ false,
+ MSG.getMessage( Keys.OPT_ENABLE_DEBUG ) );
+ CMD_LINE_OPTIONS.addOption( Opts.CLASSPATH,
+ LongOpts.CLASSPATH,
+ false,
+ MSG.getMessage( Keys.OPT_CLASSPATH_SENT_TO_XMLBEANS ) );
+ }
+
+ private void generateSkeletonCode( ResourceDefinition resourceDef, String wsdlFileName )
+ throws Exception
+ {
+ String serviceName = StringUtils.capitalize( resourceDef.getName() );
+ try
+ {
+ VelocityContext context = new VelocityContext();
+ String targetNamespace = resourceDef.getDefinition().getTargetNamespace();
+ ServiceProperties props = buildServiceProperties( serviceName, resourceDef, wsdlFileName, targetNamespace );
+
+ //add to context
+ context.put( "generated", props );
+ context.put( "qnames", new ConstQNames() );
+
+ //generate files
+ String javaPackageName = GenerationUtils.getJavaPackageName( targetNamespace );
+ javaPackageName = javaPackageName.replace( '.', '/' );
+ File packageDir = new File( m_srcOutputDir, javaPackageName );
+ packageDir.mkdirs();
+ File generatedSrc = new File( packageDir, "Abstract" + serviceName + "Service.java" );
+ writeGeneratedSrcFile( context,
+ "templates/AbstractService.vm",
+ generatedSrc.getAbsolutePath() );
+
+ generatedSrc = new File( packageDir, serviceName + "Service.java" );
+ //only generate if it doesn't exist
+ if ( !generatedSrc.exists() )
+ {
+ writeGeneratedSrcFile( context,
+ "templates/Service.vm",
+ generatedSrc.getAbsolutePath() );
+ }
+ generatedSrc = new File( packageDir, "Abstract" + serviceName + "Resource.java" );
+ writeGeneratedSrcFile( context,
+ "templates/AbstractResource.vm",
+ generatedSrc.getAbsolutePath() );
+
+ generatedSrc = new File( packageDir, serviceName + "Resource.java" );
+ //only generate if it doesn't exist
+ if ( !generatedSrc.exists() )
+ {
+ writeGeneratedSrcFile( context,
+ "templates/Resource.vm",
+ generatedSrc.getAbsolutePath() );
+ }
+
+ generatedSrc = new File( packageDir, serviceName + "Home.java" );
+ //only generate if it doesn't exist
+ if ( !generatedSrc.exists() )
+ {
+ writeGeneratedSrcFile( context,
+ "templates/Home.vm",
+ generatedSrc.getAbsolutePath() );
+ }
+ //only if they implemented properties does this make sense.
+ if ( resourceDef.hasProperties() )
+ {
+ generatedSrc = new File( packageDir, serviceName + "PropertyQNames.java" );
+ writeGeneratedSrcFile( context,
+ "templates/PropertyQNames.vm",
+ generatedSrc.getAbsolutePath() );
+ }
+
+ generatedSrc = new File( packageDir, serviceName + "_deploy.wsdd" );
+ writeGeneratedSrcFile( context,
+ "templates/deploy.vm",
+ generatedSrc.getAbsolutePath() );
+
+ generatedSrc = new File( packageDir, serviceName + "_jndi-config.wsdd" );
+ writeGeneratedSrcFile( context,
+ "templates/jndi.vm",
+ generatedSrc.getAbsolutePath() );
generatedSrc = new File( packageDir, serviceName + "CustomOperationsPortType.java" );
writeGeneratedSrcFile( context,
- "templates/CustomOperationsPortType.vm",
- generatedSrc.getAbsolutePath( ) );
+ "templates/CustomOperationsPortType.vm",
+ generatedSrc.getAbsolutePath() );
- }
- catch ( Exception e )
- {
- System.out.println( e );
- }
- }
+ }
+ catch ( Exception e )
+ {
+ System.out.println( e );
+ }
+ }
- private ServiceProperties buildServiceProperties(String serviceName, ResourceDefinition resourceDef, String wsdlFileName, String targetNamespace)
+ private ServiceProperties buildServiceProperties( String serviceName, ResourceDefinition resourceDef, String wsdlFileName, String targetNamespace )
{
ServiceProperties props = new ServiceProperties();
- props.setPackageName(GenerationUtils.getJavaPackageName(targetNamespace));
- props.setServiceName(serviceName);
- props.setServiceImplements(ImplementsListBuilder.getServiceImplementsList(resourceDef));
- props.setNamespace(targetNamespace);
- props.setPrefix(GenerationUtils.getPrefix(targetNamespace));
- props.setCustomMappings(GenerationUtils.getOperationInfoMap(resourceDef));
+ props.setPackageName( GenerationUtils.getJavaPackageName( targetNamespace ) );
+ props.setServiceName( serviceName );
+ props.setServiceImplements( ImplementsListBuilder.getServiceImplementsList( resourceDef ) );
+ props.setNamespace( targetNamespace );
+ props.setPrefix( GenerationUtils.getPrefix( targetNamespace ) );
+ props.setCustomMappings( GenerationUtils.getOperationInfoMap( resourceDef ) );
QName[] customPropertyNames = resourceDef.getCustomPropertyNames();
Map customPropMap = new HashMap();
- for (int i = 0; i < customPropertyNames.length; i++)
+ for ( int i = 0; i < customPropertyNames.length; i++ )
{
QName customPropertyName = customPropertyNames[i];
String propName = customPropertyName.getLocalPart().toUpperCase();
int count = 2;
- while(customPropMap.containsKey(propName))
+ while ( customPropMap.containsKey( propName ) )
{
propName = propName + count;
count++;
}
- customPropMap.put(propName,customPropertyName);
+ customPropMap.put( propName, customPropertyName );
}
- props.setPropertyMap(customPropMap);
- props.setResourceImplements(ImplementsListBuilder.getResourceImplementsList(resourceDef));
- props.setPropertyDocumentName(XmlBeanNameUtils.getDocumentElementXmlBeanClassName(resourceDef.getPropertiesDocumentName()));
- props.setWsdlName(wsdlFileName);
- if( m_resourceKey == null )
- {
- //if its not a singleton and is null, create a default
- if(m_isSingleton == false)
- {
- props.setResourcekey(new QName(targetNamespace,"ResourceID"));
- }
- }
- else
+ props.setPropertyMap( customPropMap );
+ props.setResourceImplements( ImplementsListBuilder.getResourceImplementsList( resourceDef ) );
+ props.setPropertyDocumentName( XmlBeanNameUtils.getDocumentElementXmlBeanClassName( resourceDef.getPropertiesDocumentName() ) );
+ props.setWsdlName( wsdlFileName );
+ if ( m_options.getResourceKey() == null && !m_options.isSingleton() )
{
- props.setResourcekey(QName.valueOf(m_resourceKey));
+ m_options.setResourceKey( new QName( targetNamespace, "ResourceID" ) );
}
+ props.setResourcekey( m_options.getResourceKey() );
return props;
}
- private void generateXmlBeans( )
- throws Exception
- {
- SchemaCompiler.Parameters scompParams = new SchemaCompiler.Parameters( );
- scompParams.setSrcDir( m_srcOutputDir );
- scompParams.setClassesDir( m_classesOutputDir );
- scompParams.setWsdlFiles( m_wsdlFiles );
- scompParams.setDownload( true );
- scompParams.setClasspath( m_options.getClasspath( ) );
- scompParams.setVerbose( m_options.isVerbose( ) );
- scompParams.setDebug( m_options.isDebug( ) );
- final boolean beNoisy = true;
- XmlErrorPrinter xErrorListener = new XmlErrorPrinter( beNoisy, null );
- scompParams.setErrorListener( xErrorListener );
- m_srcOutputDir.mkdirs( ); // necessary?
- m_classesOutputDir.mkdirs( ); // necessary?
- if ( !SchemaCompiler.compile( scompParams ) )
- {
- throw new Exception( xErrorListener.toString( ) );
- }
- }
-
- private void initVelocityProperties( )
- throws Exception
- {
- Velocity.addProperty( Velocity.RESOURCE_LOADER, "classpath" );
- Velocity.setProperty( "classpath." + Velocity.RESOURCE_LOADER + ".class",
- "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader" );
- Velocity.setProperty( "classpath." + Velocity.RESOURCE_LOADER + ".cache", "false" );
- Velocity.setProperty( "classpath." + Velocity.RESOURCE_LOADER + ".modificationCheckInterval", "2" );
- Velocity.init( );
- }
-
- private void writeGeneratedSrcFile( VelocityContext context,
- String templateName,
- String outputSrcPath )
- throws Exception
- {
- /*
- * get the Template object. This is the parsed version of your
- * template input file. Note that getTemplate() can throw
- * ResourceNotFoundException : if it doesn't find the template
- * ParseErrorException : if there is something wrong with the VTL
- * Exception : if something else goes wrong (this is generally
- * indicative of as serious problem...)
- */
- Template template = null;
-
- try
- {
- template = Velocity.getTemplate( templateName );
-
- /*
- * Now have the template engine process your template using the
- * data placed into the context. Think of it as a 'merge'
- * of the template and the data to produce the output stream.
- */
- FileWriter writer = writer = new FileWriter( outputSrcPath );
-
- if ( template != null )
- {
- template.merge( context, writer );
- }
-
- /*
- * flush and cleanup
- */
- writer.flush( );
- writer.close( );
- }
- catch ( ResourceNotFoundException rnfe )
- {
- System.out.println( "Example : error : cannot find template " + templateName );
- }
- catch ( ParseErrorException pee )
- {
- System.out.println( "Example : Syntax error in template " + templateName + ":" + pee );
- }
- }
-
- /**
- * DOCUMENT_ME
- *
- * @version $Revision: 1.8 $
- * @author $author$
- */
- public static class Options
- {
- private boolean m_verbose;
- private boolean m_debug;
- private File[] m_classpath;
-
- /**
- * DOCUMENT_ME
- *
- * @param classpath DOCUMENT_ME
- */
- public void setClasspath( File[] classpath )
- {
- m_classpath = classpath;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param classpath DOCUMENT_ME
- */
- public void setClasspath( String classpath )
- {
- List classpathItems = new ArrayList( );
- for ( StringTokenizer tokenizer = new StringTokenizer( classpath, File.pathSeparator );
- tokenizer.hasMoreTokens( ); )
- {
- classpathItems.add( new File( tokenizer.nextToken( ) ) );
- }
-
- m_classpath = (File[]) classpathItems.toArray( new File[0] );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public File[] getClasspath( )
- {
- return m_classpath;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param debug DOCUMENT_ME
- */
- public void setDebug( boolean debug )
- {
- m_debug = debug;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public boolean isDebug( )
- {
- return m_debug;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param verbose DOCUMENT_ME
- */
- public void setVerbose( boolean verbose )
- {
- m_verbose = verbose;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public boolean isVerbose( )
- {
- return m_verbose;
- }
- }
+ private void generateXmlBeans()
+ throws Exception
+ {
+ SchemaCompiler.Parameters scompParams = new SchemaCompiler.Parameters();
+ scompParams.setSrcDir( m_srcOutputDir );
+ scompParams.setClassesDir( m_classesOutputDir );
+ scompParams.setWsdlFiles( m_wsdlFiles );
+ scompParams.setDownload( true );
+ scompParams.setClasspath( m_options.getClasspath() );
+ scompParams.setVerbose( m_options.isVerbose() );
+ scompParams.setDebug( m_options.isDebug() );
+ final boolean beNoisy = true;
+ XmlErrorPrinter xErrorListener = new XmlErrorPrinter( beNoisy, null );
+ scompParams.setErrorListener( xErrorListener );
+ m_srcOutputDir.mkdirs(); // necessary?
+ m_classesOutputDir.mkdirs(); // necessary?
+ if ( !SchemaCompiler.compile( scompParams ) )
+ {
+ throw new Exception( xErrorListener.toString() );
+ }
+ }
+
+ private void initVelocityProperties()
+ throws Exception
+ {
+ Velocity.addProperty( Velocity.RESOURCE_LOADER, "classpath" );
+ Velocity.setProperty( "classpath." + Velocity.RESOURCE_LOADER + ".class",
+ "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader" );
+ Velocity.setProperty( "classpath." + Velocity.RESOURCE_LOADER + ".cache", "false" );
+ Velocity.setProperty( "classpath." + Velocity.RESOURCE_LOADER + ".modificationCheckInterval", "2" );
+ Velocity.init();
+ }
+
+ private void writeGeneratedSrcFile( VelocityContext context,
+ String templateName,
+ String outputSrcPath )
+ throws Exception
+ {
+ /*
+ * get the Template object. This is the parsed version of your
+ * template input file. Note that getTemplate() can throw
+ * ResourceNotFoundException : if it doesn't find the template
+ * ParseErrorException : if there is something wrong with the VTL
+ * Exception : if something else goes wrong (this is generally
+ * indicative of as serious problem...)
+ */
+ Template template = null;
+
+ try
+ {
+ template = Velocity.getTemplate( templateName );
+
+ /*
+ * Now have the template engine process your template using the
+ * data placed into the context. Think of it as a 'merge'
+ * of the template and the data to produce the output stream.
+ */
+ FileWriter writer = writer = new FileWriter( outputSrcPath );
+
+ if ( template != null )
+ {
+ template.merge( context, writer );
+ }
+
+ /*
+ * flush and cleanup
+ */
+ writer.flush();
+ writer.close();
+ }
+ catch ( ResourceNotFoundException rnfe )
+ {
+ System.out.println( "Example : error : cannot find template " + templateName );
+ }
+ catch ( ParseErrorException pee )
+ {
+ System.out.println( "Example : Syntax error in template " + templateName + ":" + pee );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @author $author$
+ * @version $Revision: 1.8 $
+ */
+ public static class Wsdl2JavaOptions
+ {
+ private boolean m_verbose;
+ private boolean m_debug;
+ private File[] m_classpath;
+ private boolean m_singleton;
+ private QName m_resourceKey;
+
+ public QName getResourceKey()
+ {
+ return m_resourceKey;
+ }
+
+ public void setResourceKey( QName resourceKey )
+ {
+ m_resourceKey = resourceKey;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param classpath DOCUMENT_ME
+ */
+ public void setClasspath( File[] classpath )
+ {
+ m_classpath = classpath;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param classpath DOCUMENT_ME
+ */
+ public void setClasspath( String classpath )
+ {
+ List classpathItems = new ArrayList();
+ for ( StringTokenizer tokenizer = new StringTokenizer( classpath, File.pathSeparator );
+ tokenizer.hasMoreTokens(); )
+ {
+ classpathItems.add( new File( tokenizer.nextToken() ) );
+ }
+
+ m_classpath = (File[]) classpathItems.toArray( new File[0] );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public File[] getClasspath()
+ {
+ return m_classpath;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param debug DOCUMENT_ME
+ */
+ public void setDebug( boolean debug )
+ {
+ m_debug = debug;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public boolean isDebug()
+ {
+ return m_debug;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param verbose DOCUMENT_ME
+ */
+ public void setVerbose( boolean verbose )
+ {
+ m_verbose = verbose;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public boolean isSingleton()
+ {
+ return m_singleton;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param singleton DOCUMENT_ME
+ */
+ public void setSingleton( boolean singleton )
+ {
+ m_singleton = singleton;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public boolean isVerbose()
+ {
+ return m_verbose;
+ }
+ }
+
+ static interface LongOpts
+ {
+ String SRC_OUTPUT_DIR = "srcOutputDir";
+ String CLASSES_OUTPUT_DIR = "classesOutputDir";
+ String VERBOSE = "verbose";
+ String DEBUG = "debug";
+ String CLASSPATH = "classpath";
+ String SINGLETON = "singleton";
+ String RESOURCE_KEY = "resourceKey";
+ }
+
+ static interface Opts
+ {
+ String SRC_OUTPUT_DIR = "s";
+ String CLASSES_OUTPUT_DIR = "c";
+ String VERBOSE = "v";
+ String DEBUG = "d";
+ String CLASSPATH = "C";
+ String SINGLETON = "S";
+ String RESOURCE_KEY = "k";
+ }
+
}
Modified: incubator/apollo/trunk/src/java/org/apache/ws/resource/Wsdl2JavaTask.java
Url: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/resource/Wsdl2JavaTask.java?view=diff&rev=123296&p1=incubator/apollo/trunk/src/java/org/apache/ws/resource/Wsdl2JavaTask.java&r1=123295&p2=incubator/apollo/trunk/src/java/org/apache/ws/resource/Wsdl2JavaTask.java&r2=123296
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/resource/Wsdl2JavaTask.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/resource/Wsdl2JavaTask.java Fri Dec 24 10:06:02 2004
@@ -23,13 +23,14 @@
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;
+import javax.xml.namespace.QName;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* LOG-DONE
- *
+ * <p/>
* Ant task that wraps {@link Wsdl2Java}.
*
* @author Ian P. Springer (Hewlett-Packard Company)
@@ -37,254 +38,254 @@
public class Wsdl2JavaTask extends MatchingTask
{
- static
- {
- if ( System.getProperty( "log4j.configuration" ) == null )
- {
- System.setProperty( "log4j.configuration", "log4j.properties" );
- }
- }
-
- private List m_wsdls = new ArrayList();
- private File m_classesOutputDir;
- private File m_srcOutputDir;
- private Path m_classpath;
- private Boolean m_verbose;
- private Boolean m_debug;
- private boolean m_singleton;
- private String m_resourceKey;
-
- public boolean isSingleton()
+ static
{
- return m_singleton;
+ if ( System.getProperty( "log4j.configuration" ) == null )
+ {
+ System.setProperty( "log4j.configuration", "log4j.properties" );
+ }
}
- public void setSingleton(boolean singleton)
+ private List m_wsdls = new ArrayList();
+ private File m_classesOutputDir;
+ private File m_srcOutputDir;
+ private Path m_classpath;
+ private Boolean m_verbose;
+ private Boolean m_debug;
+ private Boolean m_singleton;
+ private String m_resourceKey;
+
+ public void setSingleton( Boolean singleton )
{
m_singleton = singleton;
}
- public String getResourceKey()
+ public void setResourceKey( String resourceKey )
{
- return m_resourceKey;
+ m_resourceKey = resourceKey;
}
- public void setResourceKey(String resourceKey)
+ public void setSrcOutputDir( File srcOutputDir )
{
- m_resourceKey = resourceKey;
+ m_srcOutputDir = srcOutputDir;
}
- public void setSrcOutputDir( File srcOutputDir )
- {
- m_srcOutputDir = srcOutputDir;
- }
-
- public void setClassesOutputDir( File classesOutputDir )
- {
- m_classesOutputDir = classesOutputDir;
- }
-
- /**
- * Set the classpath to be passed to the XMLBeans schema compiler.
- *
- * @param classpath the classpath to be passed to the XMLBeans schema compiler
- */
- public void setClasspath( Path classpath )
- {
- if ( m_classpath == null )
- {
- m_classpath = classpath;
- }
- else
- {
- m_classpath.append( classpath );
- }
- }
-
- /**
- * Gets the classpath to be used for this compilation.
- *
- * @return the classpath
- */
- public Path getClasspath()
- {
- return m_classpath;
- }
-
- /**
- * Adds a reference to a classpath defined elsewhere.
- *
- * @param ref the reference to add
- */
- public void setClasspathRef( Reference ref )
- {
- createClasspath().setRefid( ref );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param verbose DOCUMENT_ME
- */
- public void setVerbose( boolean verbose )
- {
- m_verbose = Boolean.valueOf( verbose );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param debug DOCUMENT_ME
- */
- public void setDebug( boolean debug )
- {
- m_debug = Boolean.valueOf( debug );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param nonProxyHosts DOCUMENT_ME
- */
- public void setNonProxyHosts( String nonProxyHosts )
- {
- nonProxyHosts = nonProxyHosts.trim();
- if ( !nonProxyHosts.startsWith( "${" ) )
- {
- System.setProperty( "http.nonProxyHosts", nonProxyHosts );
- }
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param proxyHost DOCUMENT_ME
- */
- public void setProxyHost( String proxyHost )
- {
- proxyHost = proxyHost.trim();
- if ( !proxyHost.startsWith( "${" ) )
- {
- System.setProperty( "http.proxyHost", proxyHost );
- }
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param proxyPort DOCUMENT_ME
- */
- public void setProxyPort( String proxyPort )
- {
- proxyPort = proxyPort.trim();
- if ( !proxyPort.startsWith( "${" ) )
- {
- System.setProperty( "http.proxyPort", proxyPort );
- }
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param wsdl a WSDM WSDL file
- */
- public void setWsdl( File wsdl )
- {
- m_wsdls.add( wsdl );
- }
-
- /**
- * Sets a system property.
- *
- * @param var the system property to be set
- */
- public void addConfiguredSysproperty( Environment.Variable var )
- {
- getProject().log( "Setting system property: " + var.getKey() + " = " + var.getValue() );
- System.setProperty( var.getKey(),
- var.getValue() );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param wsdls DOCUMENT_ME
- */
- public void addConfiguredWsdls( FileSet wsdls )
- {
- processWsdlFileset( wsdls );
- }
-
- /**
- * Creates the classpath.
- *
- * @return the classpath
- */
- public Path createClasspath()
- {
- if ( m_classpath == null )
- {
- m_classpath = new Path( getProject() );
- }
- return m_classpath.createPath();
- }
-
- /**
- * DOCUMENT_ME
- *
- * @throws org.apache.tools.ant.BuildException
- * DOCUMENT_ME
- */
- public void execute()
- throws BuildException
- {
- Wsdl2Java.Options options = new Wsdl2Java.Options();
- if ( m_classpath != null )
- {
- options.setClasspath( m_classpath.toString() );
- }
- if ( m_verbose != null )
- {
- options.setVerbose( m_verbose.booleanValue() );
- }
- if ( m_debug != null )
- {
- options.setDebug( m_debug.booleanValue() );
- }
- Wsdl2Java wsdl2Java = new Wsdl2Java( (File[]) m_wsdls.toArray( new File[0] ), m_srcOutputDir, m_classesOutputDir, options, m_singleton, m_resourceKey);
- try
- {
- wsdl2Java.generate();
- }
- catch ( Exception e )
- {
- throw new BuildException( e );
- }
- }
-
- /**
- * DOCUMENT_ME
- *
- * @return DOCUMENT_ME
- */
- public String toString()
- {
- return "Wsdl2Java Ant task";
- }
-
- private void processWsdlFileset( FileSet fileSet )
- {
- if ( fileSet.getDir( getProject() ) != null )
- {
- FileScanner scanner = fileSet.getDirectoryScanner( getProject() );
- File basedir = scanner.getBasedir();
- String[] files = scanner.getIncludedFiles();
-
- for ( int i = 0; i < files.length; i++ )
- {
- m_wsdls.add( new File( basedir, files[i] ) );
- }
- }
- }
+ public void setClassesOutputDir( File classesOutputDir )
+ {
+ m_classesOutputDir = classesOutputDir;
+ }
+
+ /**
+ * Set the classpath to be passed to the XMLBeans schema compiler.
+ *
+ * @param classpath the classpath to be passed to the XMLBeans schema compiler
+ */
+ public void setClasspath( Path classpath )
+ {
+ if ( m_classpath == null )
+ {
+ m_classpath = classpath;
+ }
+ else
+ {
+ m_classpath.append( classpath );
+ }
+ }
+
+ /**
+ * Gets the classpath to be used for this compilation.
+ *
+ * @return the classpath
+ */
+ public Path getClasspath()
+ {
+ return m_classpath;
+ }
+
+ /**
+ * Adds a reference to a classpath defined elsewhere.
+ *
+ * @param ref the reference to add
+ */
+ public void setClasspathRef( Reference ref )
+ {
+ createClasspath().setRefid( ref );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param verbose DOCUMENT_ME
+ */
+ public void setVerbose( boolean verbose )
+ {
+ m_verbose = Boolean.valueOf( verbose );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param debug DOCUMENT_ME
+ */
+ public void setDebug( boolean debug )
+ {
+ m_debug = Boolean.valueOf( debug );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param nonProxyHosts DOCUMENT_ME
+ */
+ public void setNonProxyHosts( String nonProxyHosts )
+ {
+ nonProxyHosts = nonProxyHosts.trim();
+ if ( !nonProxyHosts.startsWith( "${" ) )
+ {
+ System.setProperty( "http.nonProxyHosts", nonProxyHosts );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param proxyHost DOCUMENT_ME
+ */
+ public void setProxyHost( String proxyHost )
+ {
+ proxyHost = proxyHost.trim();
+ if ( !proxyHost.startsWith( "${" ) )
+ {
+ System.setProperty( "http.proxyHost", proxyHost );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param proxyPort DOCUMENT_ME
+ */
+ public void setProxyPort( String proxyPort )
+ {
+ proxyPort = proxyPort.trim();
+ if ( !proxyPort.startsWith( "${" ) )
+ {
+ System.setProperty( "http.proxyPort", proxyPort );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param wsdl a WSDM WSDL file
+ */
+ public void setWsdl( File wsdl )
+ {
+ m_wsdls.add( wsdl );
+ }
+
+ /**
+ * Sets a system property.
+ *
+ * @param var the system property to be set
+ */
+ public void addConfiguredSysproperty( Environment.Variable var )
+ {
+ getProject().log( "Setting system property: " + var.getKey() + " = " + var.getValue() );
+ System.setProperty( var.getKey(),
+ var.getValue() );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param wsdls DOCUMENT_ME
+ */
+ public void addConfiguredWsdls( FileSet wsdls )
+ {
+ processWsdlFileset( wsdls );
+ }
+
+ /**
+ * Creates the classpath.
+ *
+ * @return the classpath
+ */
+ public Path createClasspath()
+ {
+ if ( m_classpath == null )
+ {
+ m_classpath = new Path( getProject() );
+ }
+ return m_classpath.createPath();
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @throws org.apache.tools.ant.BuildException
+ * DOCUMENT_ME
+ */
+ public void execute()
+ throws BuildException
+ {
+ Wsdl2Java.Wsdl2JavaOptions options = new Wsdl2Java.Wsdl2JavaOptions();
+ if ( m_classpath != null )
+ {
+ options.setClasspath( m_classpath.toString() );
+ }
+ if ( m_resourceKey != null )
+ {
+ options.setResourceKey( QName.valueOf( m_resourceKey ) );
+ }
+
+ if ( m_verbose != null )
+ {
+ options.setVerbose( m_verbose.booleanValue() );
+ }
+ if ( m_debug != null )
+ {
+ options.setDebug( m_debug.booleanValue() );
+ }
+ if ( m_singleton != null )
+ {
+ options.setSingleton( m_singleton.booleanValue() );
+ }
+
+ Wsdl2Java wsdl2Java = new Wsdl2Java( (File[]) m_wsdls.toArray( new File[0] ), m_srcOutputDir, m_classesOutputDir, options );
+ try
+ {
+ wsdl2Java.generate();
+ }
+ catch ( Exception e )
+ {
+ throw new BuildException( e );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String toString()
+ {
+ return "Wsdl2Java Ant task";
+ }
+
+ private void processWsdlFileset( FileSet fileSet )
+ {
+ if ( fileSet.getDir( getProject() ) != null )
+ {
+ FileScanner scanner = fileSet.getDirectoryScanner( getProject() );
+ File basedir = scanner.getBasedir();
+ String[] files = scanner.getIncludedFiles();
+
+ for ( int i = 0; i < files.length; i++ )
+ {
+ m_wsdls.add( new File( basedir, files[i] ) );
+ }
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: apollo-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: apollo-dev-help@ws.apache.org