You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-dev@ws.apache.org by ip...@apache.org on 2004/11/24 06:27:51 UTC
svn commit: r106382 - /incubator/muse/trunk/maven.xml /incubator/muse/trunk/src/java/org/apache/ws/platform/axis/deployment/wsdd/WsddUpdater.java
Author: ips
Date: Tue Nov 23 21:27:49 2004
New Revision: 106382
Modified:
incubator/muse/trunk/maven.xml
incubator/muse/trunk/src/java/org/apache/ws/platform/axis/deployment/wsdd/WsddUpdater.java
Log:
...
Modified: incubator/muse/trunk/maven.xml
Url: http://svn.apache.org/viewcvs/incubator/muse/trunk/maven.xml?view=diff&rev=106382&p1=incubator/muse/trunk/maven.xml&r1=106381&p2=incubator/muse/trunk/maven.xml&r2=106382
==============================================================================
--- incubator/muse/trunk/maven.xml (original)
+++ incubator/muse/trunk/maven.xml Tue Nov 23 21:27:49 2004
@@ -10,7 +10,10 @@
xmlns:j="jelly:core"
xmlns:util="jelly:util"
xmlns:maven="jelly:maven">
- <property environment="env" />
+
+ <property environment="env" />
+ <property name="test.config.wsdd" location="${maven.build.dir}/test-classes/server-config.wsdd" />
+
<preGoal name="java:prepare-filesystem">
<j:if test="${context.getVariable('maven.ajar.src.enabled')}" >
<attainGoal name="ajar:update-src"/>
@@ -57,7 +60,8 @@
<include name="*.wsdd" />
</fileset>
</copy>
- <property name="test.server-config.wsdd" location="${maven.build.dir}/test-classes/server-config.wsdd" />
+
+ <echo>TTT ${test.config.wsdd}</echo>
<attainGoal name="generate-submgr" />
<attainGoal name="generate-registry" />
</postGoal>
@@ -160,10 +164,8 @@
<!-- deploy the submgr deploy.wsdd to target/server-config.wsdd & target/test-classes/server-config.wsdd -->
<taskdef name="wsddUpdater" classname="org.apache.ws.platform.axis.deployment.wsdd.WsddUpdater" classpathref="jmuws.classpath.id" />
- <wsddUpdater deployWsdd="${maven.build.dest}/axis/com/hp/ws/generated/submgr/deploy.wsdd" configWsdd="${target.config.wsdd}" />
- <wsddUpdater deployWsdd="${maven.build.dest}/axis/com/hp/ws/generated/submgr/deploy.wsdd" configWsdd="${test.server-config.wsdd}" />
- <echo>*********************</echo>
- <concat><fileset dir="${maven.build.dir}/test-classes" includes="server-config.wsdd" /></concat>
+ <wsddUpdater deployWsdd="${maven.build.dest}/axis/com/hp/ws/generated/submgr/deploy.wsdd" configWsdd="${test.config.wsdd}" />
+ <wsddUpdater deployWsdd="${maven.build.dest}/axis/com/hp/ws/generated/submgr/deploy.wsdd" configWsdd="${target.config.wsdd}" />
</goal>
@@ -201,9 +203,9 @@
debug="on" />
<!-- deploy the registry deploy.wsdd to target/server-config.wsdd & target/test-classes/server-config.wsdd -->
- <taskdef name="wsddUpdater" classname="org.apache.ws.platform.axis.deployment.wsdd.WsddUpdater" classpathref="jmuws.classpath.id" />
+ <taskdef name="wsddUpdater" classname="org.apache.ws.platform.axis.deployment.wsdd.WsddUpdater" classpathref="jmuws.classpath.id" />
+ <wsddUpdater deployWsdd="${maven.build.dest}/axis/com/hp/ws/generated/registry/deploy.wsdd" configWsdd="${test.config.wsdd}" />
<wsddUpdater deployWsdd="${maven.build.dest}/axis/com/hp/ws/generated/registry/deploy.wsdd" configWsdd="${target.config.wsdd}" />
- <wsddUpdater deployWsdd="${maven.build.dest}/axis/com/hp/ws/generated/registry/deploy.wsdd" configWsdd="${test.server-config.wsdd}" />
</goal>
Modified: incubator/muse/trunk/src/java/org/apache/ws/platform/axis/deployment/wsdd/WsddUpdater.java
Url: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/java/org/apache/ws/platform/axis/deployment/wsdd/WsddUpdater.java?view=diff&rev=106382&p1=incubator/muse/trunk/src/java/org/apache/ws/platform/axis/deployment/wsdd/WsddUpdater.java&r1=106381&p2=incubator/muse/trunk/src/java/org/apache/ws/platform/axis/deployment/wsdd/WsddUpdater.java&r2=106382
==============================================================================
--- incubator/muse/trunk/src/java/org/apache/ws/platform/axis/deployment/wsdd/WsddUpdater.java (original)
+++ incubator/muse/trunk/src/java/org/apache/ws/platform/axis/deployment/wsdd/WsddUpdater.java Tue Nov 23 21:27:49 2004
@@ -23,6 +23,7 @@
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.FileSet;
+
import java.io.File;
import java.net.ServerSocket;
import java.util.ArrayList;
@@ -38,214 +39,220 @@
* @author Ian P. Springer
*/
public class WsddUpdater
- extends MatchingTask
+ extends MatchingTask
{
- /**
- * Below default can be overridden by setting the below sysprop.
- */
- public static final String SYSPROP_WSDD = "wsdd";
-
- /**
- * Default to looking for server-config.wsdd in current dir or classpath.
- */
- private static final String DEFAULT_CONFIG_WSDD = "server-config.wsdd";
-
- static
- {
- //this is done because for some reason when run using Maven the ContextClassloader is not set.
- //this causes an issue with Axis.
- if ( Thread.currentThread( ).getContextClassLoader( ) == null )
- {
- Thread.currentThread( ).setContextClassLoader( MatchingTask.class.getClassLoader( ) );
- }
- }
-
- private SimpleAxisServer m_simpleAxisServer;
- private String m_configWsdd;
- private ServerSocket m_serverSocket;
- private int m_axisServerPort;
- private List m_wsddFiles = new ArrayList( );
-
- /**
- * Creates a new {@link WsddUpdater} object.
- */
- public WsddUpdater( )
- {
- this( (String) null );
- }
-
- /**
- * Creates a new {@link WsddUpdater} object for updating the specified WSDD file.
- *
- * @param configWsdd DOCUMENT_ME
- */
- public WsddUpdater( File configWsdd )
- {
- this( configWsdd.getPath( ) );
- }
-
- /**
- * Creates a new {@link WsddUpdater} object for updating the specified WSDD, which may be a a file path or a location in
- * the classpath.
- *
- * @param configWsdd DOCUMENT_ME
- */
- public WsddUpdater( String configWsdd )
- {
- if ( configWsdd != null )
- {
- m_configWsdd = configWsdd;
- }
- else
- {
- m_configWsdd =
- ( System.getProperty( SYSPROP_WSDD ) != null ) ? System.getProperty( SYSPROP_WSDD ) : DEFAULT_CONFIG_WSDD;
- }
- }
-
- /**
- * Sets the WSDD to be updated.
- *
- * @param configWsdd the WSDD to be updated
- */
- public void setConfigWsdd( String configWsdd )
- {
- m_configWsdd = configWsdd;
- }
-
- /**
- * Sets the WSDD (un)deployment fragment to be added to the WSDD.
- *
- * @param deployWsdd the WSDD (un)deployment fragment to be added to the WSDD
- */
- public void setDeployWsdd( File deployWsdd )
- {
- m_wsddFiles.add( deployWsdd );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param wsddPaths DOCUMENT_ME
- */
- public void addConfiguredWsddPaths( FileSet wsddPaths )
- {
- File baseDir = wsddPaths.getDir( getProject( ) );
- DirectoryScanner dirScanner = wsddPaths.getDirectoryScanner( getProject( ) );
- String[] includedFiles = dirScanner.getIncludedFiles( );
- for ( int i = 0; i < includedFiles.length; i++ )
- {
- m_wsddFiles.add( new File( baseDir, includedFiles[i] ) );
- }
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param deployWsdd DOCUMENT_ME
- *
- * @throws Exception DOCUMENT_ME
- */
- public void deploy( File deployWsdd )
- throws Exception
- {
- setDeployWsdd( deployWsdd );
- execute( );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @throws BuildException DOCUMENT_ME
- */
- public void execute( )
- throws BuildException
- {
- if ( m_wsddFiles.isEmpty( ) )
- {
- throw new BuildException( "No deploy WSDDs were specified!" );
- }
-
- try
- {
- startAxisServer( );
- for ( int i = 0; i < m_wsddFiles.size( ); i++ )
- {
- deployWsdd( (File) m_wsddFiles.get( i ) );
- }
-
- stopAxisServer( );
- }
- catch ( Exception e )
- {
- throw new BuildException( e );
- }
- }
-
- /**
- * Command-line invocation entry point.
- *
- * @param args command-line arguments
- *
- * @throws Exception on fatal error
- */
- public static void main( String[] args )
- throws Exception
- {
- //System.setProperty( SYSPROP_WSDD, "C:/server-config.wsdd" );
- if ( args.length != 1 )
- {
- System.err.println( "Usage: " + WsddUpdater.class.getName( ) + " deployWsddFile" );
- System.exit( 1 );
- }
-
- new WsddUpdater( ).deploy( new File( args[0] ) );
- }
-
- /**
- * Reads in the Axis configuration file, creates a server socket to accept requests and then starts the embedded Axis
- * server.
- *
- * @throws Exception if failed to get the configuration file, failed to start the server socket or failed to start the
- * server
- */
- protected void startAxisServer( )
- throws Exception
- {
- if ( m_simpleAxisServer == null )
- {
- log( "Starting SimpleAxisServer...", Project.MSG_VERBOSE );
- m_simpleAxisServer = new SimpleAxisServer( );
- m_serverSocket = new ServerSocket( 0 );
- m_axisServerPort = m_serverSocket.getLocalPort();
- m_simpleAxisServer.setServerSocket( m_serverSocket );
- m_simpleAxisServer.setMyConfig( new FileProvider( m_configWsdd ) );
- m_simpleAxisServer.start( );
- log( "SimpleAxisServer started - listening on port " + m_axisServerPort + " ..." );
- }
- }
-
- /**
- * Stops the embedded Axis server if it is running.
- */
- protected void stopAxisServer( )
- {
- if ( m_simpleAxisServer != null )
- {
- log( "Stopping SimpleAxisServer...", Project.MSG_VERBOSE );
- m_simpleAxisServer.stop( );
- m_simpleAxisServer = null;
- }
- }
-
- private void deployWsdd( File deployWsdd )
- {
- log( "Deploying WSDD " + deployWsdd + " to configuration WSDD " + m_configWsdd + "..." );
- AdminClient.main( new String[]
- {
- "-p",
- String.valueOf( m_axisServerPort ),
- deployWsdd.getPath( )
- } );
- }
+ /**
+ * Below default can be overridden by setting the below sysprop.
+ */
+ public static final String SYSPROP_WSDD = "wsdd";
+
+ /**
+ * Default to looking for server-config.wsdd in current dir or classpath.
+ */
+ private static final String DEFAULT_CONFIG_WSDD = "server-config.wsdd";
+
+ static
+ {
+
+
+ }
+
+ private SimpleAxisServer m_simpleAxisServer;
+ private String m_configWsdd;
+ private ServerSocket m_serverSocket;
+ private int m_axisServerPort;
+ private List m_wsddFiles = new ArrayList();
+
+ /**
+ * Creates a new {@link WsddUpdater} object.
+ */
+ public WsddUpdater()
+ {
+ this( (String) null );
+ }
+
+ /**
+ * Creates a new {@link WsddUpdater} object for updating the specified WSDD file.
+ *
+ * @param configWsdd DOCUMENT_ME
+ */
+ public WsddUpdater( File configWsdd )
+ {
+ this( configWsdd.getPath() );
+ }
+
+ /**
+ * Creates a new {@link WsddUpdater} object for updating the specified WSDD, which may be a a file path or a location in
+ * the classpath.
+ *
+ * @param configWsdd DOCUMENT_ME
+ */
+ public WsddUpdater( String configWsdd )
+ {
+ initContextClassLoader();
+ if ( configWsdd != null )
+ {
+ m_configWsdd = configWsdd;
+ }
+ else
+ {
+ m_configWsdd =
+ ( System.getProperty( SYSPROP_WSDD ) != null ) ? System.getProperty( SYSPROP_WSDD ) : DEFAULT_CONFIG_WSDD;
+ }
+ }
+
+ private void initContextClassLoader()
+ {
+ //this is done because for some reason when run using Maven the ContextClassloader is not set,
+ //which causes an issue with Axis.
+ if ( Thread.currentThread().getContextClassLoader() == null )
+ {
+ Thread.currentThread().setContextClassLoader( MatchingTask.class.getClassLoader() );
+ }
+ }
+
+ /**
+ * Sets the WSDD to be updated.
+ *
+ * @param configWsdd the WSDD to be updated
+ */
+ public void setConfigWsdd( String configWsdd )
+ {
+ System.out.println( "***** Setting m_configWsdd to " + configWsdd + " ..." );
+ m_configWsdd = configWsdd;
+ }
+
+ /**
+ * Sets the WSDD (un)deployment fragment to be added to the WSDD.
+ *
+ * @param deployWsdd the WSDD (un)deployment fragment to be added to the WSDD
+ */
+ public void setDeployWsdd( File deployWsdd )
+ {
+ m_wsddFiles.add( deployWsdd );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param wsddPaths DOCUMENT_ME
+ */
+ public void addConfiguredWsddPaths( FileSet wsddPaths )
+ {
+ File baseDir = wsddPaths.getDir( getProject() );
+ DirectoryScanner dirScanner = wsddPaths.getDirectoryScanner( getProject() );
+ String[] includedFiles = dirScanner.getIncludedFiles();
+ for ( int i = 0; i < includedFiles.length; i++ )
+ {
+ m_wsddFiles.add( new File( baseDir, includedFiles[i] ) );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param deployWsdd DOCUMENT_ME
+ * @throws Exception DOCUMENT_ME
+ */
+ public void deploy( File deployWsdd )
+ throws Exception
+ {
+ setDeployWsdd( deployWsdd );
+ execute();
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @throws BuildException DOCUMENT_ME
+ */
+ public void execute()
+ throws BuildException
+ {
+ if ( m_wsddFiles.isEmpty() )
+ {
+ throw new BuildException( "No deploy WSDDs were specified!" );
+ }
+
+ try
+ {
+ startAxisServer();
+ for ( int i = 0; i < m_wsddFiles.size(); i++ )
+ {
+ deployWsdd( (File) m_wsddFiles.get( i ) );
+ }
+
+ stopAxisServer();
+ }
+ catch ( Exception e )
+ {
+ throw new BuildException( e );
+ }
+ }
+
+ /**
+ * Command-line invocation entry point.
+ *
+ * @param args command-line arguments
+ * @throws Exception on fatal error
+ */
+ public static void main( String[] args )
+ throws Exception
+ {
+ //System.setProperty( SYSPROP_WSDD, "C:/server-config.wsdd" );
+ if ( args.length != 1 )
+ {
+ System.err.println( "Usage: " + WsddUpdater.class.getName() + " deployWsddFile" );
+ System.exit( 1 );
+ }
+
+ new WsddUpdater().deploy( new File( args[0] ) );
+ }
+
+ /**
+ * Reads in the Axis configuration file, creates a server socket to
+ * accept requests and then starts the embedded Axis server.
+ *
+ * @throws Exception if failed to get the configuration file, failed to start the server socket or failed to start the
+ * server
+ */
+ protected void startAxisServer()
+ throws Exception
+ {
+ if ( m_simpleAxisServer == null )
+ {
+ log( "Starting SimpleAxisServer...", Project.MSG_VERBOSE );
+ m_simpleAxisServer = new SimpleAxisServer();
+ m_serverSocket = new ServerSocket( 0 );
+ m_axisServerPort = m_serverSocket.getLocalPort();
+ m_simpleAxisServer.setServerSocket( m_serverSocket );
+ m_simpleAxisServer.setMyConfig( new FileProvider( m_configWsdd ) );
+ m_simpleAxisServer.start();
+ log( "SimpleAxisServer started - listening on port " + m_axisServerPort + " ..." );
+ }
+ }
+
+ /**
+ * Stops the embedded Axis server if it is running.
+ */
+ protected void stopAxisServer() throws Exception
+ {
+ if ( m_simpleAxisServer != null )
+ {
+ log( "Stopping SimpleAxisServer...", Project.MSG_VERBOSE );
+ m_simpleAxisServer.stop();
+ m_simpleAxisServer = null;
+ }
+ }
+
+ private void deployWsdd( File deployWsdd )
+ {
+ log( "Deploying WSDD " + deployWsdd + " to configuration WSDD " + m_configWsdd + "..." );
+ AdminClient.main( new String[]
+ {
+ "-p",
+ String.valueOf( m_axisServerPort ),
+ deployWsdd.getPath()
+ } );
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org