You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-commits@ws.apache.org by sc...@apache.org on 2005/08/02 18:30:44 UTC
svn commit: r227033 [21/27] - in /webservices/wsrf/trunk: ./
src/java/org/apache/ws/ src/java/org/apache/ws/addressing/
src/java/org/apache/ws/addressing/v2003_03/
src/java/org/apache/ws/addressing/v2004_08_10/
src/java/org/apache/ws/resource/ src/java...
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanNamingContext.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanNamingContext.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanNamingContext.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanNamingContext.java Tue Aug 2 09:28:49 2005
@@ -23,7 +23,6 @@
import org.apache.ws.util.jndi.tools.Resource;
import org.apache.ws.util.jndi.tools.ResourceLink;
import org.apache.ws.util.jndi.tools.ResourceParameters;
-
import javax.naming.Context;
import javax.naming.LinkRef;
import javax.naming.NamingException;
@@ -38,322 +37,337 @@
*/
public class XmlBeanNamingContext
{
- private static Log LOG = LogFactory.getLog( XmlBeanNamingContext.class.getName() );
- private Context m_context;
+ private static Log LOG = LogFactory.getLog( XmlBeanNamingContext.class.getName( ) );
+ private Context m_context;
- /**
- * Creates a new {@link XmlBeanNamingContext} object.
- *
- * @param context DOCUMENT_ME
- */
- public XmlBeanNamingContext( Context context )
- {
- m_context = context;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param environment DOCUMENT_ME
- *
- * @throws IllegalArgumentException DOCUMENT_ME
- * @throws NamingException DOCUMENT_ME
- */
- public void addEnvironment( Environment environment )
- throws IllegalArgumentException,
- NamingException
- {
- Object value = null;
-
- // Instantiate a new instance of the correct object type, and
- // initialize it.
- String type = environment.getType();
- LOG.debug( "Attempting to add environment for type: " + type );
- try
- {
- if ( type.equals( "java.lang.String" ) )
- {
- value = environment.getValue();
- }
- else if ( type.equals( "java.lang.Byte" ) )
- {
- if ( environment.getValue() == null )
- {
- value = new Byte( (byte) 0 );
- }
- else
- {
- value = Byte.decode( environment.getValue() );
- }
- }
- else if ( type.equals( "java.lang.Short" ) )
- {
- if ( environment.getValue() == null )
- {
- value = new Short( (short) 0 );
- }
- else
- {
- value = Short.decode( environment.getValue() );
- }
- }
- else if ( type.equals( "java.lang.Integer" ) )
- {
- if ( environment.getValue() == null )
- {
- value = new Integer( 0 );
- }
- else
- {
- value = Integer.decode( environment.getValue() );
- }
- }
- else if ( type.equals( "java.lang.Long" ) )
- {
- if ( environment.getValue() == null )
- {
- value = new Long( 0 );
- }
- else
- {
- value = Long.decode( environment.getValue() );
- }
- }
- else if ( type.equals( "java.lang.Boolean" ) )
- {
- value = Boolean.valueOf( environment.getValue() );
- }
- else if ( type.equals( "java.lang.Double" ) )
- {
- if ( environment.getValue() == null )
- {
- value = new Double( 0 );
- }
- else
- {
- value = Double.valueOf( environment.getValue() );
- }
- }
- else if ( type.equals( "java.lang.Float" ) )
- {
- if ( environment.getValue() == null )
- {
- value = new Float( 0 );
- }
- else
- {
- value = Float.valueOf( environment.getValue() );
- }
- }
- else if ( type.equals( "java.lang.Character" ) )
- {
- if ( environment.getValue() == null )
- {
- value = new Character( (char) 0 );
- }
- else
- {
- if ( environment.getValue().length() == 1 )
- {
- value = new Character( environment.getValue().charAt( 0 ) );
- }
- else
- {
- throw new IllegalArgumentException();
- }
- }
+ /**
+ * Creates a new {@link XmlBeanNamingContext} object.
+ *
+ * @param context DOCUMENT_ME
+ */
+ public XmlBeanNamingContext( Context context )
+ {
+ m_context = context;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public Context getContext( )
+ {
+ return m_context;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param environment DOCUMENT_ME
+ *
+ * @throws IllegalArgumentException DOCUMENT_ME
+ * @throws NamingException DOCUMENT_ME
+ */
+ public void addEnvironment( Environment environment )
+ throws IllegalArgumentException,
+ NamingException
+ {
+ Object value = null;
+
+ // Instantiate a new instance of the correct object type, and
+ // initialize it.
+ String type = environment.getType( );
+ LOG.debug( "Attempting to add environment for type: " + type );
+ try
+ {
+ if ( type.equals( "java.lang.String" ) )
+ {
+ value = environment.getValue( );
+ }
+ else if ( type.equals( "java.lang.Byte" ) )
+ {
+ if ( environment.getValue( ) == null )
+ {
+ value = new Byte( (byte) 0 );
+ }
+ else
+ {
+ value = Byte.decode( environment.getValue( ) );
+ }
+ }
+ else if ( type.equals( "java.lang.Short" ) )
+ {
+ if ( environment.getValue( ) == null )
+ {
+ value = new Short( (short) 0 );
+ }
+ else
+ {
+ value = Short.decode( environment.getValue( ) );
+ }
+ }
+ else if ( type.equals( "java.lang.Integer" ) )
+ {
+ if ( environment.getValue( ) == null )
+ {
+ value = new Integer( 0 );
}
else
{
- throw new IllegalArgumentException( "invalidType : " + type );
+ value = Integer.decode( environment.getValue( ) );
}
- }
- catch ( NumberFormatException e )
- {
- String msg = "invalidValueForType : " + environment.getValue() + " : " + type;
- LOG.error( msg, e );
- throw new IllegalArgumentException( msg );
- }
-
- // Bind the object to the appropriate name
- createSubcontexts( environment.getName() );
- this.m_context.bind( environment.getName(),
- value );
- if ( LOG.isDebugEnabled() )
- {
- LOG.debug( "Added environment entry with name: " + environment.getName() );
- LOG.debug( "value: " + value + " and type: " + environment.getType() );
- }
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param resource DOCUMENT_ME
- *
- * @throws NamingException DOCUMENT_ME
- */
- public void addResource( Resource resource )
- throws NamingException
- {
- Reference reference =
- new ResourceRef( resource.getType(),
- resource.getDescription(),
- resource.getScope(),
- resource.getAuth() );
- this.addParameters( reference,
- resource.getParameters() );
- this.createSubcontexts( resource.getName() );
- this.m_context.bind( resource.getName(),
- reference );
- LOG.debug( "Added resource entry with name: " + resource.getName() );
- }
-
- public Context getContext()
- {
- return m_context;
- }
-
- public void bind( String name, Object ref ) throws NamingException
- {
- this.m_context.bind( name, ref );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param resourceLink DOCUMENT_ME
- *
- * @throws NamingException DOCUMENT_ME
- */
- public void addResourceLink( ResourceLink resourceLink )
- throws NamingException
- {
- LinkRef link = new LinkRef( resourceLink.getTarget() );
- this.createSubcontexts( resourceLink.getName() );
- this.m_context.bind( resourceLink.getName(),
- link );
- if ( LOG.isDebugEnabled() )
- {
- LOG.debug( "Added resource link with name: " + resourceLink.getName() );
- LOG.debug( "Pointing to: " + resourceLink.getTarget() );
- }
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param subContext DOCUMENT_ME
- *
- * @throws NamingException DOCUMENT_ME
- */
- public void addService( ConfigContext subContext )
- throws NamingException
- {
- String serviceName = subContext.getName();
- Set names;
- Iterator nameIterator;
- XmlBeanNamingContext newContext;
-
- JNDIUtils.createSubcontexts( m_context, serviceName );
-
- try
- {
- newContext = new XmlBeanNamingContext( m_context.createSubcontext( serviceName ) );
- LOG.debug( "Created new subcontext with name: " + serviceName );
- }
- catch ( Exception e )
- {
- newContext = new XmlBeanNamingContext( (Context) m_context.lookup( serviceName ) );
- LOG.debug( "Adding entries to existing subcontext with name: " + serviceName );
- }
-
- names = subContext.getEnvironmentNames();
- nameIterator = names.iterator();
-
- while ( nameIterator.hasNext() )
- {
- newContext.addEnvironment( subContext.getEnvironment( (String) nameIterator.next() ) );
- }
-
- names = subContext.getResourceNames();
- nameIterator = names.iterator();
-
- while ( nameIterator.hasNext() )
- {
- newContext.addServiceResource( subContext.getResource( (String) nameIterator.next() ),
- serviceName );
- }
-
- names = subContext.getResourceLinkNames();
- nameIterator = names.iterator();
-
- while ( nameIterator.hasNext() )
- {
- newContext.addResourceLink( subContext.getResourceLink( (String) nameIterator.next() ) );
- }
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param resource DOCUMENT_ME
- * @param serviceName DOCUMENT_ME
- *
- * @throws NamingException DOCUMENT_ME
- */
- public void addServiceResource( Resource resource,
- String serviceName )
- throws NamingException
- {
- Reference reference =
- new XmlBeanServiceResourceRef( resource.getType(),
- resource.getDescription(),
- resource.getScope(),
- resource.getAuth(), serviceName );
- this.addParameters( reference,
- resource.getParameters() );
- this.createSubcontexts( resource.getName() );
- this.m_context.bind( resource.getName(),
- reference );
- LOG.debug( "Added service resource entry with name: " + resource.getName() );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param subContext DOCUMENT_ME
- *
- * @throws NamingException DOCUMENT_ME
- */
- public void addSubContext( ConfigContext subContext )
- throws NamingException
- {
- addService( subContext );
- }
-
- private void addParameters( Reference reference,
- ResourceParameters parameters )
- {
- if ( parameters != null )
- {
- Set names = parameters.getParameterNames();
- Iterator nameIterator = names.iterator();
- RefAddr parameter;
- String parameterName;
- while ( nameIterator.hasNext() )
- {
- parameterName = (String) nameIterator.next();
- parameter = new StringRefAddr( parameterName,
- parameters.getParameter( parameterName ) );
- reference.add( parameter );
- }
- }
- }
-
- private void createSubcontexts( String name )
- throws NamingException
- {
- JNDIUtils.createSubcontexts( this.m_context, name );
- }
+ }
+ else if ( type.equals( "java.lang.Long" ) )
+ {
+ if ( environment.getValue( ) == null )
+ {
+ value = new Long( 0 );
+ }
+ else
+ {
+ value = Long.decode( environment.getValue( ) );
+ }
+ }
+ else if ( type.equals( "java.lang.Boolean" ) )
+ {
+ value = Boolean.valueOf( environment.getValue( ) );
+ }
+ else if ( type.equals( "java.lang.Double" ) )
+ {
+ if ( environment.getValue( ) == null )
+ {
+ value = new Double( 0 );
+ }
+ else
+ {
+ value = Double.valueOf( environment.getValue( ) );
+ }
+ }
+ else if ( type.equals( "java.lang.Float" ) )
+ {
+ if ( environment.getValue( ) == null )
+ {
+ value = new Float( 0 );
+ }
+ else
+ {
+ value = Float.valueOf( environment.getValue( ) );
+ }
+ }
+ else if ( type.equals( "java.lang.Character" ) )
+ {
+ if ( environment.getValue( ) == null )
+ {
+ value = new Character( (char) 0 );
+ }
+ else
+ {
+ if ( environment.getValue( ).length( ) == 1 )
+ {
+ value = new Character( environment.getValue( ).charAt( 0 ) );
+ }
+ else
+ {
+ throw new IllegalArgumentException( );
+ }
+ }
+ }
+ else
+ {
+ throw new IllegalArgumentException( "invalidType : " + type );
+ }
+ }
+ catch ( NumberFormatException e )
+ {
+ String msg = "invalidValueForType : " + environment.getValue( ) + " : " + type;
+ LOG.error( msg, e );
+ throw new IllegalArgumentException( msg );
+ }
+
+ // Bind the object to the appropriate name
+ createSubcontexts( environment.getName( ) );
+ this.m_context.bind( environment.getName( ),
+ value );
+ if ( LOG.isDebugEnabled( ) )
+ {
+ LOG.debug( "Added environment entry with name: " + environment.getName( ) );
+ LOG.debug( "value: " + value + " and type: " + environment.getType( ) );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param resource DOCUMENT_ME
+ *
+ * @throws NamingException DOCUMENT_ME
+ */
+ public void addResource( Resource resource )
+ throws NamingException
+ {
+ Reference reference =
+ new ResourceRef( resource.getType( ),
+ resource.getDescription( ),
+ resource.getScope( ),
+ resource.getAuth( ) );
+ this.addParameters( reference,
+ resource.getParameters( ) );
+ this.createSubcontexts( resource.getName( ) );
+ this.m_context.bind( resource.getName( ),
+ reference );
+ LOG.debug( "Added resource entry with name: " + resource.getName( ) );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param resourceLink DOCUMENT_ME
+ *
+ * @throws NamingException DOCUMENT_ME
+ */
+ public void addResourceLink( ResourceLink resourceLink )
+ throws NamingException
+ {
+ LinkRef link = new LinkRef( resourceLink.getTarget( ) );
+ this.createSubcontexts( resourceLink.getName( ) );
+ this.m_context.bind( resourceLink.getName( ),
+ link );
+ if ( LOG.isDebugEnabled( ) )
+ {
+ LOG.debug( "Added resource link with name: " + resourceLink.getName( ) );
+ LOG.debug( "Pointing to: " + resourceLink.getTarget( ) );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param subContext DOCUMENT_ME
+ *
+ * @throws NamingException DOCUMENT_ME
+ */
+ public void addService( ConfigContext subContext )
+ throws NamingException
+ {
+ String serviceName = subContext.getName( );
+ Set names;
+ Iterator nameIterator;
+ XmlBeanNamingContext newContext;
+
+ JNDIUtils.createSubcontexts( m_context, serviceName );
+
+ try
+ {
+ newContext = new XmlBeanNamingContext( m_context.createSubcontext( serviceName ) );
+ LOG.debug( "Created new subcontext with name: " + serviceName );
+ }
+ catch ( Exception e )
+ {
+ newContext = new XmlBeanNamingContext( (Context) m_context.lookup( serviceName ) );
+ LOG.debug( "Adding entries to existing subcontext with name: " + serviceName );
+ }
+
+ names = subContext.getEnvironmentNames( );
+ nameIterator = names.iterator( );
+
+ while ( nameIterator.hasNext( ) )
+ {
+ newContext.addEnvironment( subContext.getEnvironment( (String) nameIterator.next( ) ) );
+ }
+
+ names = subContext.getResourceNames( );
+ nameIterator = names.iterator( );
+
+ while ( nameIterator.hasNext( ) )
+ {
+ newContext.addServiceResource( subContext.getResource( (String) nameIterator.next( ) ),
+ serviceName );
+ }
+
+ names = subContext.getResourceLinkNames( );
+ nameIterator = names.iterator( );
+
+ while ( nameIterator.hasNext( ) )
+ {
+ newContext.addResourceLink( subContext.getResourceLink( (String) nameIterator.next( ) ) );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param resource DOCUMENT_ME
+ * @param serviceName DOCUMENT_ME
+ *
+ * @throws NamingException DOCUMENT_ME
+ */
+ public void addServiceResource( Resource resource,
+ String serviceName )
+ throws NamingException
+ {
+ Reference reference =
+ new XmlBeanServiceResourceRef( resource.getType( ),
+ resource.getDescription( ),
+ resource.getScope( ),
+ resource.getAuth( ), serviceName );
+ this.addParameters( reference,
+ resource.getParameters( ) );
+ this.createSubcontexts( resource.getName( ) );
+ this.m_context.bind( resource.getName( ),
+ reference );
+ LOG.debug( "Added service resource entry with name: " + resource.getName( ) );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param subContext DOCUMENT_ME
+ *
+ * @throws NamingException DOCUMENT_ME
+ */
+ public void addSubContext( ConfigContext subContext )
+ throws NamingException
+ {
+ addService( subContext );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param name DOCUMENT_ME
+ * @param ref DOCUMENT_ME
+ *
+ * @throws NamingException DOCUMENT_ME
+ */
+ public void bind( String name,
+ Object ref )
+ throws NamingException
+ {
+ this.m_context.bind( name, ref );
+ }
+
+ private void addParameters( Reference reference,
+ ResourceParameters parameters )
+ {
+ if ( parameters != null )
+ {
+ Set names = parameters.getParameterNames( );
+ Iterator nameIterator = names.iterator( );
+ RefAddr parameter;
+ String parameterName;
+ while ( nameIterator.hasNext( ) )
+ {
+ parameterName = (String) nameIterator.next( );
+ parameter = new StringRefAddr( parameterName,
+ parameters.getParameter( parameterName ) );
+ reference.add( parameter );
+ }
+ }
+ }
+
+ private void createSubcontexts( String name )
+ throws NamingException
+ {
+ JNDIUtils.createSubcontexts( this.m_context, name );
+ }
}
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanServiceResourceRef.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanServiceResourceRef.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanServiceResourceRef.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanServiceResourceRef.java Tue Aug 2 09:28:49 2005
@@ -16,7 +16,6 @@
package org.apache.ws.util.jndi;
-
/**LOG-DONE
* DOCUMENT_ME
*
@@ -26,7 +25,7 @@
public class XmlBeanServiceResourceRef
extends org.apache.naming.ResourceRef
{
- private String name;
+ private String name;
/**
* Creates a new {@link XmlBeanServiceResourceRef} object.
@@ -37,16 +36,15 @@
* @param auth DOCUMENT_ME
* @param serviceName DOCUMENT_ME
*/
- public XmlBeanServiceResourceRef( String resourceClass,
- String description,
- String scope,
- String auth,
- String serviceName )
+ public XmlBeanServiceResourceRef( String resourceClass,
+ String description,
+ String scope,
+ String auth,
+ String serviceName )
{
super( resourceClass, description, scope, auth, null, null );
- this.name = serviceName;
+ this.name = serviceName;
}
-
/**
* DOCUMENT_ME
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/JndiConfigUpdater.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/JndiConfigUpdater.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/JndiConfigUpdater.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/JndiConfigUpdater.java Tue Aug 2 09:28:49 2005
@@ -1,221 +1,232 @@
-/*=============================================================================*
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-package org.apache.ws.util.jndi.tools;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.taskdefs.MatchingTask;
-import org.apache.tools.ant.types.FileSet;
-import org.apache.wsfx.wsrf.jndi.config.JndiConfigDocument;
-import org.apache.wsfx.wsrf.jndi.config.ServiceDocument;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author Sal Campana
- */
-public class JndiConfigUpdater
- extends MatchingTask
-{
- /**
- * Below default can be overridden by setting the below sysprop.
- */
- public static final String SYSPROP_JNDI_CONFIG = "wsdd";
-
- /**
- * Default to looking for jndi-config.xml in current dir or classpath.
- */
- private static final String DEFAULT_JNDI_CONFIG = "jndi-config.xml";
- private String m_jndiConfig;
- private List m_jndiConfigFiles = new ArrayList();
-
- /**
- * Creates a new {@link JndiConfigUpdater} object.
- */
- public JndiConfigUpdater( )
- {
- this( (String) null );
- }
-
- /**
- * Creates a new {@link JndiConfigUpdater} object for updating the specified WSDD file.
- *
- * @param jndiConfig DOCUMENT_ME
- */
- public JndiConfigUpdater( File jndiConfig )
- {
- this( jndiConfig.getPath( ) );
- }
-
- /**
- * Creates a new {@link JndiConfigUpdater} object for updating the specified jndi-config.xml, which may be a a file path or a location in
- * the classpath.
- *
- * @param jndiConfig DOCUMENT_ME
- */
- public JndiConfigUpdater( String jndiConfig )
- {
- initContextClassLoader( );
- if ( jndiConfig != null )
- {
- m_jndiConfig = jndiConfig;
- }
- else
- {
- m_jndiConfig =
- ( System.getProperty( SYSPROP_JNDI_CONFIG ) != null ) ? System.getProperty( SYSPROP_JNDI_CONFIG )
- : DEFAULT_JNDI_CONFIG;
- }
- }
-
- /**
- * Sets the JndiConfig fragment to be added to the JNDIonfig file.
- *
- * @param deployJndiConfig the JNDIConfigfragment to be added to the JndiConfig file.
- */
- public void setDeployJndiConfig( File deployJndiConfig )
- {
- m_jndiConfigFiles.add( deployJndiConfig );
- }
- public void addConfiguredJndiConfigPaths( FileSet jndiConfigPaths )
- {
- File baseDir = jndiConfigPaths.getDir( getProject() );
- DirectoryScanner dirScanner = jndiConfigPaths.getDirectoryScanner( getProject() );
- String[] includedFiles = dirScanner.getIncludedFiles();
- for ( int i = 0; i < includedFiles.length; i++ )
- {
- m_jndiConfigFiles.add( new File( baseDir, includedFiles[i] ) );
- }
- }
- /**
- * Sets the WSDD to be updated.
- *
- * @param jndiConfig the Jndi-config.xml to be updated
- */
- public void setJndiConfig( String jndiConfig )
- {
- m_jndiConfig = jndiConfig;
- }
-
- /**
- * DOCUMENT_ME
- *
- * @param deployJndiConfig DOCUMENT_ME
- * @throws Exception DOCUMENT_ME
- */
- public void deploy( File deployJndiConfig )
- throws Exception
- {
- setDeployJndiConfig( deployJndiConfig );
- execute( );
- }
-
- /**
- * DOCUMENT_ME
- *
- * @throws BuildException DOCUMENT_ME
- */
- public void execute( )
- throws BuildException
- {
- if ( m_jndiConfigFiles.isEmpty( ) )
- {
- throw new BuildException( "No deploy jndi-config's were specified!" );
- }
-
- try
- {
- for ( int i = 0; i < m_jndiConfigFiles.size( ); i++ )
- {
- deployJndiConfig( (File) m_jndiConfigFiles.get( i ) );
- }
- }
- 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_JNDI_CONFIG, "C:/jndi-config.xml" );
- if ( args.length != 1 )
- {
- System.err.println( "Usage: " + JndiConfigUpdater.class.getName( ) + " deployJndiConfigFile" );
- System.exit( 1 );
- }
-
- new JndiConfigUpdater( ).deploy( new File( args[0] ) );
- }
-
- private void deployJndiConfig( File deployJndiConfig )
- throws Exception
- {
- log( "Deploying Jndi-Config " + deployJndiConfig + " to configuration Jndi-Config " + m_jndiConfig + "..." );
- File jndiConfigFile = new File(m_jndiConfig);
- JndiConfigDocument sourceConfig = JndiConfigDocument.Factory.parse(new File(m_jndiConfig));
- JndiConfigDocument.JndiConfig jndiConfig = sourceConfig.getJndiConfig();
- Map services = new HashMap();
- ServiceDocument.Service[] serviceArray = jndiConfig.getServiceArray();
- for (int i = 0; i < serviceArray.length; i++)
- {
- ServiceDocument.Service service = serviceArray[i];
- services.put(service.getName(), service);
- }
-
- for (int i = 0; i < m_jndiConfigFiles.size(); i++)
- {
- File config = (File) m_jndiConfigFiles.get(i);
- JndiConfigDocument newConfig = JndiConfigDocument.Factory.parse(config);
- ServiceDocument.Service[] newServices = newConfig.getJndiConfig().getServiceArray();
- for (int j = 0; j < newServices.length; j++)
- {
- ServiceDocument.Service newService = newServices[j];
- String name = newService.getName();
- if(services.containsKey(name))
- {
- System.out.println("The service named: " + name + " is being updated in the jndi-config file: " + m_jndiConfig);
- }
- services.put(newService.getName(), newService );
- }
- }
-
- ServiceDocument.Service[] updatedServiceArray = (ServiceDocument.Service[]) services.values().toArray(new ServiceDocument.Service[0]);
- jndiConfig.setServiceArray(updatedServiceArray);
- sourceConfig.save(jndiConfigFile);
- }
-
- private void initContextClassLoader( )
- {
- // this is done because for some reason, when run using Maven,
- // the ContextClassloader is null, which causes an issue with Axis.
- if ( Thread.currentThread( ).getContextClassLoader( ) == null )
- {
- Thread.currentThread( ).setContextClassLoader( MatchingTask.class.getClassLoader( ) );
- }
- }
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.util.jndi.tools;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.wsfx.wsrf.jndi.config.JndiConfigDocument;
+import org.apache.wsfx.wsrf.jndi.config.ServiceDocument;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Sal Campana
+ */
+public class JndiConfigUpdater
+ extends MatchingTask
+{
+ /**
+ * Below default can be overridden by setting the below sysprop.
+ */
+ public static final String SYSPROP_JNDI_CONFIG = "wsdd";
+
+ /**
+ * Default to looking for jndi-config.xml in current dir or classpath.
+ */
+ private static final String DEFAULT_JNDI_CONFIG = "jndi-config.xml";
+ private String m_jndiConfig;
+ private List m_jndiConfigFiles = new ArrayList( );
+
+ /**
+ * Creates a new {@link JndiConfigUpdater} object.
+ */
+ public JndiConfigUpdater( )
+ {
+ this( (String) null );
+ }
+
+ /**
+ * Creates a new {@link JndiConfigUpdater} object for updating the specified WSDD file.
+ *
+ * @param jndiConfig DOCUMENT_ME
+ */
+ public JndiConfigUpdater( File jndiConfig )
+ {
+ this( jndiConfig.getPath( ) );
+ }
+
+ /**
+ * Creates a new {@link JndiConfigUpdater} object for updating the specified jndi-config.xml, which may be a a file path or a location in
+ * the classpath.
+ *
+ * @param jndiConfig DOCUMENT_ME
+ */
+ public JndiConfigUpdater( String jndiConfig )
+ {
+ initContextClassLoader( );
+ if ( jndiConfig != null )
+ {
+ m_jndiConfig = jndiConfig;
+ }
+ else
+ {
+ m_jndiConfig =
+ ( System.getProperty( SYSPROP_JNDI_CONFIG ) != null ) ? System.getProperty( SYSPROP_JNDI_CONFIG )
+ : DEFAULT_JNDI_CONFIG;
+ }
+ }
+
+ /**
+ * Sets the JndiConfig fragment to be added to the JNDIonfig file.
+ *
+ * @param deployJndiConfig the JNDIConfigfragment to be added to the JndiConfig file.
+ */
+ public void setDeployJndiConfig( File deployJndiConfig )
+ {
+ m_jndiConfigFiles.add( deployJndiConfig );
+ }
+
+ /**
+ * Sets the WSDD to be updated.
+ *
+ * @param jndiConfig the Jndi-config.xml to be updated
+ */
+ public void setJndiConfig( String jndiConfig )
+ {
+ m_jndiConfig = jndiConfig;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param jndiConfigPaths DOCUMENT_ME
+ */
+ public void addConfiguredJndiConfigPaths( FileSet jndiConfigPaths )
+ {
+ File baseDir = jndiConfigPaths.getDir( getProject( ) );
+ DirectoryScanner dirScanner = jndiConfigPaths.getDirectoryScanner( getProject( ) );
+ String[] includedFiles = dirScanner.getIncludedFiles( );
+ for ( int i = 0; i < includedFiles.length; i++ )
+ {
+ m_jndiConfigFiles.add( new File( baseDir, includedFiles[i] ) );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param deployJndiConfig DOCUMENT_ME
+ * @throws Exception DOCUMENT_ME
+ */
+ public void deploy( File deployJndiConfig )
+ throws Exception
+ {
+ setDeployJndiConfig( deployJndiConfig );
+ execute( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @throws BuildException DOCUMENT_ME
+ */
+ public void execute( )
+ throws BuildException
+ {
+ if ( m_jndiConfigFiles.isEmpty( ) )
+ {
+ throw new BuildException( "No deploy jndi-config's were specified!" );
+ }
+
+ try
+ {
+ for ( int i = 0; i < m_jndiConfigFiles.size( ); i++ )
+ {
+ deployJndiConfig( (File) m_jndiConfigFiles.get( i ) );
+ }
+ }
+ 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_JNDI_CONFIG, "C:/jndi-config.xml" );
+ if ( args.length != 1 )
+ {
+ System.err.println( "Usage: " + JndiConfigUpdater.class.getName( ) + " deployJndiConfigFile" );
+ System.exit( 1 );
+ }
+
+ new JndiConfigUpdater( ).deploy( new File( args[0] ) );
+ }
+
+ private void deployJndiConfig( File deployJndiConfig )
+ throws Exception
+ {
+ log( "Deploying Jndi-Config " + deployJndiConfig + " to configuration Jndi-Config " + m_jndiConfig + "..." );
+ File jndiConfigFile = new File( m_jndiConfig );
+ JndiConfigDocument sourceConfig = JndiConfigDocument.Factory.parse( new File( m_jndiConfig ) );
+ JndiConfigDocument.JndiConfig jndiConfig = sourceConfig.getJndiConfig( );
+ Map services = new HashMap( );
+ ServiceDocument.Service[] serviceArray = jndiConfig.getServiceArray( );
+ for ( int i = 0; i < serviceArray.length; i++ )
+ {
+ ServiceDocument.Service service = serviceArray[i];
+ services.put( service.getName( ),
+ service );
+ }
+
+ for ( int i = 0; i < m_jndiConfigFiles.size( ); i++ )
+ {
+ File config = (File) m_jndiConfigFiles.get( i );
+ JndiConfigDocument newConfig = JndiConfigDocument.Factory.parse( config );
+ ServiceDocument.Service[] newServices = newConfig.getJndiConfig( ).getServiceArray( );
+ for ( int j = 0; j < newServices.length; j++ )
+ {
+ ServiceDocument.Service newService = newServices[j];
+ String name = newService.getName( );
+ if ( services.containsKey( name ) )
+ {
+ System.out.println( "The service named: " + name + " is being updated in the jndi-config file: "
+ + m_jndiConfig );
+ }
+
+ services.put( newService.getName( ),
+ newService );
+ }
+ }
+
+ ServiceDocument.Service[] updatedServiceArray =
+ (ServiceDocument.Service[]) services.values( ).toArray( new ServiceDocument.Service[0] );
+ jndiConfig.setServiceArray( updatedServiceArray );
+ sourceConfig.save( jndiConfigFile );
+ }
+
+ private void initContextClassLoader( )
+ {
+ // this is done because for some reason, when run using Maven,
+ // the ContextClassloader is null, which causes an issue with Axis.
+ if ( Thread.currentThread( ).getContextClassLoader( ) == null )
+ {
+ Thread.currentThread( ).setContextClassLoader( MatchingTask.class.getClassLoader( ) );
+ }
+ }
}
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/MetadataConfig.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/MetadataConfig.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/MetadataConfig.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/MetadataConfig.java Tue Aug 2 09:28:49 2005
@@ -1,22 +1,62 @@
-package org.apache.ws.util.jndi.tools;
-
-import org.apache.wsfx.wsrf.jndi.config.MetadataConfigDocument;
-
-import java.util.Map;
-
-/**
- * @author Sal Campana
- */
-public abstract class MetadataConfig
-{
- public MetadataConfig(MetadataConfigDocument.MetadataConfig metadata)
- {
- //used to enforce constructor for reflection
- }
- public abstract Map getAllMetadata( );
-
- public abstract Map getMetadata( String dialect,
- String identifierUri );
-
- public abstract Map getMetadata( String dialect );
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.util.jndi.tools;
+
+import org.apache.wsfx.wsrf.jndi.config.MetadataConfigDocument;
+import java.util.Map;
+
+/**
+ * @author Sal Campana
+ */
+public abstract class MetadataConfig
+{
+ /**
+ * Creates a new {@link MetadataConfig} object.
+ *
+ * @param metadata DOCUMENT_ME
+ */
+ public MetadataConfig( MetadataConfigDocument.MetadataConfig metadata )
+ {
+ //used to enforce constructor for reflection
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public abstract Map getAllMetadata( );
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param dialect DOCUMENT_ME
+ * @param identifierUri DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public abstract Map getMetadata( String dialect,
+ String identifierUri );
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param dialect DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public abstract Map getMetadata( String dialect );
+}
\ No newline at end of file
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/MetadataConfigImpl.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/MetadataConfigImpl.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/MetadataConfigImpl.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/tools/MetadataConfigImpl.java Tue Aug 2 09:28:49 2005
@@ -1,336 +1,337 @@
-/*=============================================================================*
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-package org.apache.ws.util.jndi.tools;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.wsfx.wsrf.jndi.config.MetadataConfigDocument;
-import org.apache.wsfx.wsrf.jndi.config.MetadataDocument;
-import org.apache.xmlbeans.XmlObject;
-import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
-import org.xmlsoap.schemas.ws.x2004.x09.mex.LocationDocument;
-import org.xmlsoap.schemas.ws.x2004.x09.mex.MetadataReferenceDocument;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * A config object to represent the MetadataExchange information from the
- * jndi-config.xml config file.
- * <p/>
- * This class will store any "loadable" metadata documents, this will avoid
- * unnecessary loading of files.
- *
- * @author Sal Campana
- */
-public class MetadataConfigImpl extends MetadataConfig
-{
- private static final Log LOG = LogFactory.getLog( MetadataConfigImpl.class );
-
- /**
- * Constant used for adding/getting the IDENTIFIER map from the dialect map
- */
- private static final String IDENTIFIER_MAP = "IDENTIFIER_MAP";
- /**
- * Constant for pulling the Complete list of metatdata from the dialect map.
- */
- private static final String COMPLETE_METADATA_LIST = "COMPLETE_METADATA_LIST";
-
- /** XmlBean MetadataConfigImpl object */
- MetadataConfigDocument.MetadataConfig m_metadata;
-
- /**
- * Internal Map for storing metatdata.
- *
- * The map will have the structure of:
- *
- * key=dialect
- * value=Map (dialect-specific Map)
- *
- * The dialect-specific Map will have the structure:
- *
- * Two Entries:
- * key= IDENTIFIER_MAP
- * value= A Map keyed on Identifier keyed-to the metatdata
- *
- * key= COMPLETE_METADATA_LIST
- * value= A List containing ALL metadata given this dialect (this includes all entries from IDENTIFIER_MAP)
- *
- **/
- private Map m_metatdataMap = new HashMap( );
-
- /**
- * Creates a new {@link MetadataConfigImpl} object.
- *
- * @param metadata DOCUMENT_ME
- */
- public MetadataConfigImpl( MetadataConfigDocument.MetadataConfig metadata )
- {
- super(metadata);
- m_metadata = metadata;
- loadMetadata( );
- }
-
- /**
- * Returns all known metadata for all dialects.
- *
- * @return A Map keyed on dialect keyed-to a List of metadata
- */
- public Map getAllMetadata( )
- {
- Map allMetatdata = new HashMap( );
-
- //iterate all the metadata
- Iterator iterator = m_metatdataMap.keySet().iterator();
- while (iterator.hasNext())
- {
- String key = (String) iterator.next();
- Map dialectMap = (Map) m_metatdataMap.get(key);
- List all = (List) dialectMap.get(COMPLETE_METADATA_LIST);
- allMetatdata.put(key, all);
- }
-
- return allMetatdata;
- }
-
- /**
- * Returns the metadata given a dialect and an identifier.
- *
- * @param dialect
- * @param identifierUri
- * @return A Map keyed on dialect keyed-to a List of metadata
- */
- public Map getMetadata( String dialect,
- String identifierUri )
- {
- Map results = new HashMap( );
- if ( ( dialect != null ) && !"".equals( dialect ) ) //only get metatdata for specific dialect
- {
- Map dialectMap = (Map) m_metatdataMap.get( dialect );
- if ( dialectMap != null )
- {
- if ( identifierUri != null )
- {
- Map identifierMap = (Map) dialectMap.get( IDENTIFIER_MAP );
- Object metatdata = identifierMap.get( identifierUri );
- if ( metatdata != null )
- {
- List list = new ArrayList();
- list.add(metatdata);
- results.put( dialect, list );
- }
- }
- else
- {
- List metatdataList = (List) dialectMap.get( COMPLETE_METADATA_LIST );
- results.put( dialect, metatdataList );
- }
- }
- }
- else //get all metatdata
- {
- return getAllMetadata( );
- }
-
- return results;
- }
-
- /**
- * Returns metadata based on dialect
- *
- * @param dialect
- * @return A Map keyed on dialect keyed-to a List of metadata
- */
- public Map getMetadata( String dialect )
- {
- return getMetadata( dialect, null );
- }
-
- /**
- * Adds the parsed-in metadata to the undelying lookup structures.
- *
- * precondition: The structures have already been setup for the metadata
- *
- * @param dialect
- * @param identifier
- * @param metadata The "parsed" metadata (could be XmlObject, MetadataReference or Location )
- */
- protected void addToMetadataMap( String dialect,
- String identifier,
- XmlObject metadata )
- {
- Map dialectMap = (Map) m_metatdataMap.get( dialect );
- if ( dialectMap == null )
- {
- addStructureForDialect( dialect );
- dialectMap = (Map) m_metatdataMap.get( dialect );
- }
-
- List metatadataList = (List) dialectMap.get( COMPLETE_METADATA_LIST );
- metatadataList.add( metadata );
-
- if ( ( identifier != null ) && !"".equals( identifier ) )
- {
- Map identifierMap = (Map) dialectMap.get( IDENTIFIER_MAP );
- identifierMap.put( identifier, metadata );
- }
- }
-
- /**
- * Builds the lookup structure given a dialect.
- *
- * @param dialect
- */
- private synchronized void addStructureForDialect( String dialect )
- {
- Map dialectMap = new HashMap( );
- m_metatdataMap.put( dialect, dialectMap ); //add to metadatamap
-
- //add parsedMetatdata to the list of metadata for this dialect
- dialectMap.put( COMPLETE_METADATA_LIST,
- new ArrayList( ) );
- dialectMap.put( IDENTIFIER_MAP,
- new HashMap( ) );
- }
-
- /**
- * Loads up lookup structures with the metadata.
- *
- * This method initializes a Map for a given dialect if it doesn't already exist. The Map is keyed using
- * 2 constants for pulling a map of identifiers->metatada AND a List of all metatdata.
- */
- private synchronized void loadMetadata( )
- {
- MetadataDocument.Metadata[] metadataArray = m_metadata.getMetadataArray( );
- for ( int i = 0; i < metadataArray.length; i++ )
- {
- MetadataDocument.Metadata metadata = metadataArray[i];
- String dialect = metadata.getDialect( );
- String identifier = metadata.getIdentifier( );
- XmlObject parsedMetadata = parseMetadata( metadata );
-
- if ( parsedMetadata != null )
- {
- //see if we already built a map for this dialect, then just add the metatdata
- if ( m_metatdataMap.containsKey( dialect ) )
- {
- addToMetadataMap( dialect, identifier, parsedMetadata );
- }
- else //build the mapping for this dialect
- {
- addStructureForDialect( dialect );
- addToMetadataMap( dialect, identifier, parsedMetadata );
- }
- }
- }
- }
-
- /**
- * This method will return either a MetadataReferenceDocument,
- * LocationDocument or an XmlObject which has the metadata document parsed into it.
- * <p/>
- * The operation ALWAYS avoids loading the file if the metadata contains a MetadataReference.
- * The operation ALWAYS avoids loading the file if the metadata contains a Location which is a standard Http URL.
- * <p/>
- * The operation WILL load the file if it is a file or a file URL.
- * The operation WILL load the file if it is located in the classpath.
- * <p/>
- * Note: The "load" scenarios are handled last, and if the documents are un-loadable, null will be returned
- *
- * @param metadata
- * @return The XmlObject metadata or null
- */
- private XmlObject parseMetadata( MetadataDocument.Metadata metadata )
- {
- //check for MetadataReference...if its there, we're finished.
- XmlObject result = null;
- EndpointReferenceType metadataReferece = metadata.getReference();
- if ( metadataReferece != null )
- {
- MetadataReferenceDocument metadataReferenceDocument = MetadataReferenceDocument.Factory.newInstance( );
- metadataReferenceDocument.setMetadataReference( metadataReferece );
- result = metadataReferenceDocument;
- }
- else //use location instead
- {
- String location = metadata.getLocation( );
-
- //determine if its a valid URL
- if ( location != null )
- {
- try
- {
- URL url = new URL( location );
-
- //if we get here then is it a file url??? if so load it
- if ( location.startsWith( "file" ) )
- {
- try
- {
- result = XmlObject.Factory.parse( new File(url.getFile()) );
- }
- catch ( Exception e )
- {
- LOG.fatal( "*********Unable to load file from file url: " + url+ " CAUSE:", e );
- }
- }
- else //if not then return a Location...let them do it....
- {
- LocationDocument locationDocument = LocationDocument.Factory.newInstance( );
- locationDocument.setLocation( location );
- result = locationDocument;
- }
- }
- catch ( MalformedURLException e )
- {
- //not valid..is it a file withoud url prefix? ...load it
- File f = new File( location );
- if ( f.exists( ) )
- {
- try
- {
- result = XmlObject.Factory.parse( f );
- }
- catch ( Exception e1 )
- {
- LOG.fatal( "*********Unable to load file: " + f + " CAUSE:", e );
- }
- }
- else //check classpath
- {
- URL resource = this.getClass( ).getClassLoader( ).getResource( location );
- try
- {
- result = XmlObject.Factory.parse( resource );
- }
- catch ( Exception e1 )
- {
- LOG.fatal( "*********Unable to load file: " + resource + " from classpath."+ " CAUSE:", e );
- }
- }
- }
- }
- }
-
- return result;
- }
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.util.jndi.tools;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.wsfx.wsrf.jndi.config.MetadataConfigDocument;
+import org.apache.wsfx.wsrf.jndi.config.MetadataDocument;
+import org.apache.xmlbeans.XmlObject;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
+import org.xmlsoap.schemas.ws.x2004.x09.mex.LocationDocument;
+import org.xmlsoap.schemas.ws.x2004.x09.mex.MetadataReferenceDocument;
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A config object to represent the MetadataExchange information from the
+ * jndi-config.xml config file.
+ * <p/>
+ * This class will store any "loadable" metadata documents, this will avoid
+ * unnecessary loading of files.
+ *
+ * @author Sal Campana
+ */
+public class MetadataConfigImpl
+ extends MetadataConfig
+{
+ private static final Log LOG = LogFactory.getLog( MetadataConfigImpl.class );
+
+ /**
+ * Constant used for adding/getting the IDENTIFIER map from the dialect map
+ */
+ private static final String IDENTIFIER_MAP = "IDENTIFIER_MAP";
+
+ /**
+ * Constant for pulling the Complete list of metatdata from the dialect map.
+ */
+ private static final String COMPLETE_METADATA_LIST = "COMPLETE_METADATA_LIST";
+
+ /** XmlBean MetadataConfigImpl object */
+ MetadataConfigDocument.MetadataConfig m_metadata;
+
+ /**
+ * Internal Map for storing metatdata.
+ *
+ * The map will have the structure of:
+ *
+ * key=dialect
+ * value=Map (dialect-specific Map)
+ *
+ * The dialect-specific Map will have the structure:
+ *
+ * Two Entries:
+ * key= IDENTIFIER_MAP
+ * value= A Map keyed on Identifier keyed-to the metatdata
+ *
+ * key= COMPLETE_METADATA_LIST
+ * value= A List containing ALL metadata given this dialect (this includes all entries from IDENTIFIER_MAP)
+ *
+ **/
+ private Map m_metatdataMap = new HashMap( );
+
+ /**
+ * Creates a new {@link MetadataConfigImpl} object.
+ *
+ * @param metadata DOCUMENT_ME
+ */
+ public MetadataConfigImpl( MetadataConfigDocument.MetadataConfig metadata )
+ {
+ super( metadata );
+ m_metadata = metadata;
+ loadMetadata( );
+ }
+
+ /**
+ * Returns all known metadata for all dialects.
+ *
+ * @return A Map keyed on dialect keyed-to a List of metadata
+ */
+ public Map getAllMetadata( )
+ {
+ Map allMetatdata = new HashMap( );
+
+ //iterate all the metadata
+ Iterator iterator = m_metatdataMap.keySet( ).iterator( );
+ while ( iterator.hasNext( ) )
+ {
+ String key = (String) iterator.next( );
+ Map dialectMap = (Map) m_metatdataMap.get( key );
+ List all = (List) dialectMap.get( COMPLETE_METADATA_LIST );
+ allMetatdata.put( key, all );
+ }
+
+ return allMetatdata;
+ }
+
+ /**
+ * Returns the metadata given a dialect and an identifier.
+ *
+ * @param dialect
+ * @param identifierUri
+ * @return A Map keyed on dialect keyed-to a List of metadata
+ */
+ public Map getMetadata( String dialect,
+ String identifierUri )
+ {
+ Map results = new HashMap( );
+ if ( ( dialect != null ) && !"".equals( dialect ) ) //only get metatdata for specific dialect
+ {
+ Map dialectMap = (Map) m_metatdataMap.get( dialect );
+ if ( dialectMap != null )
+ {
+ if ( identifierUri != null )
+ {
+ Map identifierMap = (Map) dialectMap.get( IDENTIFIER_MAP );
+ Object metatdata = identifierMap.get( identifierUri );
+ if ( metatdata != null )
+ {
+ List list = new ArrayList( );
+ list.add( metatdata );
+ results.put( dialect, list );
+ }
+ }
+ else
+ {
+ List metatdataList = (List) dialectMap.get( COMPLETE_METADATA_LIST );
+ results.put( dialect, metatdataList );
+ }
+ }
+ }
+ else //get all metatdata
+ {
+ return getAllMetadata( );
+ }
+
+ return results;
+ }
+
+ /**
+ * Returns metadata based on dialect
+ *
+ * @param dialect
+ * @return A Map keyed on dialect keyed-to a List of metadata
+ */
+ public Map getMetadata( String dialect )
+ {
+ return getMetadata( dialect, null );
+ }
+
+ /**
+ * Adds the parsed-in metadata to the undelying lookup structures.
+ *
+ * precondition: The structures have already been setup for the metadata
+ *
+ * @param dialect
+ * @param identifier
+ * @param metadata The "parsed" metadata (could be XmlObject, MetadataReference or Location )
+ */
+ protected void addToMetadataMap( String dialect,
+ String identifier,
+ XmlObject metadata )
+ {
+ Map dialectMap = (Map) m_metatdataMap.get( dialect );
+ if ( dialectMap == null )
+ {
+ addStructureForDialect( dialect );
+ dialectMap = (Map) m_metatdataMap.get( dialect );
+ }
+
+ List metatadataList = (List) dialectMap.get( COMPLETE_METADATA_LIST );
+ metatadataList.add( metadata );
+
+ if ( ( identifier != null ) && !"".equals( identifier ) )
+ {
+ Map identifierMap = (Map) dialectMap.get( IDENTIFIER_MAP );
+ identifierMap.put( identifier, metadata );
+ }
+ }
+
+ /**
+ * Builds the lookup structure given a dialect.
+ *
+ * @param dialect
+ */
+ private synchronized void addStructureForDialect( String dialect )
+ {
+ Map dialectMap = new HashMap( );
+ m_metatdataMap.put( dialect, dialectMap ); //add to metadatamap
+
+ //add parsedMetatdata to the list of metadata for this dialect
+ dialectMap.put( COMPLETE_METADATA_LIST,
+ new ArrayList( ) );
+ dialectMap.put( IDENTIFIER_MAP,
+ new HashMap( ) );
+ }
+
+ /**
+ * Loads up lookup structures with the metadata.
+ *
+ * This method initializes a Map for a given dialect if it doesn't already exist. The Map is keyed using
+ * 2 constants for pulling a map of identifiers->metatada AND a List of all metatdata.
+ */
+ private synchronized void loadMetadata( )
+ {
+ MetadataDocument.Metadata[] metadataArray = m_metadata.getMetadataArray( );
+ for ( int i = 0; i < metadataArray.length; i++ )
+ {
+ MetadataDocument.Metadata metadata = metadataArray[i];
+ String dialect = metadata.getDialect( );
+ String identifier = metadata.getIdentifier( );
+ XmlObject parsedMetadata = parseMetadata( metadata );
+
+ if ( parsedMetadata != null )
+ {
+ //see if we already built a map for this dialect, then just add the metatdata
+ if ( m_metatdataMap.containsKey( dialect ) )
+ {
+ addToMetadataMap( dialect, identifier, parsedMetadata );
+ }
+ else //build the mapping for this dialect
+ {
+ addStructureForDialect( dialect );
+ addToMetadataMap( dialect, identifier, parsedMetadata );
+ }
+ }
+ }
+ }
+
+ /**
+ * This method will return either a MetadataReferenceDocument,
+ * LocationDocument or an XmlObject which has the metadata document parsed into it.
+ * <p/>
+ * The operation ALWAYS avoids loading the file if the metadata contains a MetadataReference.
+ * The operation ALWAYS avoids loading the file if the metadata contains a Location which is a standard Http URL.
+ * <p/>
+ * The operation WILL load the file if it is a file or a file URL.
+ * The operation WILL load the file if it is located in the classpath.
+ * <p/>
+ * Note: The "load" scenarios are handled last, and if the documents are un-loadable, null will be returned
+ *
+ * @param metadata
+ * @return The XmlObject metadata or null
+ */
+ private XmlObject parseMetadata( MetadataDocument.Metadata metadata )
+ {
+ //check for MetadataReference...if its there, we're finished.
+ XmlObject result = null;
+ EndpointReferenceType metadataReferece = metadata.getReference( );
+ if ( metadataReferece != null )
+ {
+ MetadataReferenceDocument metadataReferenceDocument = MetadataReferenceDocument.Factory.newInstance( );
+ metadataReferenceDocument.setMetadataReference( metadataReferece );
+ result = metadataReferenceDocument;
+ }
+ else //use location instead
+ {
+ String location = metadata.getLocation( );
+
+ //determine if its a valid URL
+ if ( location != null )
+ {
+ try
+ {
+ URL url = new URL( location );
+
+ //if we get here then is it a file url??? if so load it
+ if ( location.startsWith( "file" ) )
+ {
+ try
+ {
+ result = XmlObject.Factory.parse( new File( url.getFile( ) ) );
+ }
+ catch ( Exception e )
+ {
+ LOG.fatal( "*********Unable to load file from file url: " + url + " CAUSE:", e );
+ }
+ }
+ else //if not then return a Location...let them do it....
+ {
+ LocationDocument locationDocument = LocationDocument.Factory.newInstance( );
+ locationDocument.setLocation( location );
+ result = locationDocument;
+ }
+ }
+ catch ( MalformedURLException e )
+ {
+ //not valid..is it a file withoud url prefix? ...load it
+ File f = new File( location );
+ if ( f.exists( ) )
+ {
+ try
+ {
+ result = XmlObject.Factory.parse( f );
+ }
+ catch ( Exception e1 )
+ {
+ LOG.fatal( "*********Unable to load file: " + f + " CAUSE:", e );
+ }
+ }
+ else //check classpath
+ {
+ URL resource = this.getClass( ).getClassLoader( ).getResource( location );
+ try
+ {
+ result = XmlObject.Factory.parse( resource );
+ }
+ catch ( Exception e1 )
+ {
+ LOG.fatal( "*********Unable to load file: " + resource + " from classpath." + " CAUSE:", e );
+ }
+ }
+ }
+ }
+ }
+
+ return result;
+ }
}
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/lock/Lock.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/lock/Lock.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/lock/Lock.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/lock/Lock.java Tue Aug 2 09:28:49 2005
@@ -28,12 +28,14 @@
*/
public class Lock
{
- private static final Log LOG = LogFactory.getLog( Lock.class );
- public static final Messages MSG = MessagesImpl.getInstance();
- private int m_waiters;
- private LockManager m_lockManager;
- private Object m_key;
- private ReentrantLock m_lock;
+ private static final Log LOG = LogFactory.getLog( Lock.class );
+
+ /** DOCUMENT_ME */
+ public static final Messages MSG = MessagesImpl.getInstance( );
+ private int m_waiters;
+ private LockManager m_lockManager;
+ private Object m_key;
+ private ReentrantLock m_lock;
/**
* Creates a new {@link Lock} object.
@@ -57,7 +59,7 @@
public synchronized void acquire( )
throws InterruptedException
{
- LOG.trace(MSG.getMessage( Keys.ACQUIRE_LCK));
+ LOG.trace( MSG.getMessage( Keys.ACQUIRE_LCK ) );
m_waiters++;
m_lock.acquire( );
@@ -69,7 +71,7 @@
*/
public synchronized void release( )
{
- LOG.trace(MSG.getMessage( Keys.RELEASE_LCK));
+ LOG.trace( MSG.getMessage( Keys.RELEASE_LCK ) );
m_lock.release( );
if ( ( m_waiters == 0 ) && ( m_lockManager != null ) )
{
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/lock/LockManager.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/lock/LockManager.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/lock/LockManager.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/lock/LockManager.java Tue Aug 2 09:28:49 2005
@@ -20,7 +20,6 @@
import org.apache.ws.util.i18n.Keys;
import org.apache.ws.util.i18n.Messages;
import org.apache.ws.util.i18n.MessagesImpl;
-
import java.util.HashMap;
import java.util.Map;
@@ -29,10 +28,11 @@
*/
public class LockManager
{
- private static final Log LOG = LogFactory.getLog( LockManager.class );
- public static final Messages MSG = MessagesImpl.getInstance();
+ private static final Log LOG = LogFactory.getLog( LockManager.class );
- private Map m_locks;
+ /** DOCUMENT_ME */
+ public static final Messages MSG = MessagesImpl.getInstance( );
+ private Map m_locks;
/**
* Creates a new {@link LockManager} object.
@@ -51,8 +51,7 @@
*/
public synchronized Lock getLock( Object key )
{
-
- LOG.trace(MSG.getMessage( Keys.GET_LOCK_FOR_KEY,key));
+ LOG.trace( MSG.getMessage( Keys.GET_LOCK_FOR_KEY, key ) );
Lock lock = (Lock) m_locks.get( key );
if ( lock == null )
{
@@ -72,7 +71,7 @@
*/
public synchronized Lock removeLock( Object key )
{
- LOG.trace(MSG.getMessage( Keys.REMOVING_LCK_FOR_KEY,key));
+ LOG.trace( MSG.getMessage( Keys.REMOVING_LCK_FOR_KEY, key ) );
return (Lock) m_locks.remove( key );
}
}
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/JaxRpcPlatform.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/JaxRpcPlatform.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/JaxRpcPlatform.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/JaxRpcPlatform.java Tue Aug 2 09:28:49 2005
@@ -1,123 +1,123 @@
-/*=============================================================================*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-package org.apache.ws.util.platform;
-
-import org.apache.ws.util.platform.axis.AxisJaxRpcPlatform;
-import org.apache.ws.util.platform.weblogic.WeblogicJaxRpcPlatform;
-
-import javax.xml.soap.SOAPFactory;
-import javax.xml.soap.SOAPException;
-
-/**
- * An Enumeration of JAX-RPC platform types supported by Apache WSRF.
- * Currently the supported platforms are Apache Axis ({@link #AXIS})
- * and BEA WebLogic Server ({@link #WEBLOGIC}).
- *
- * @author Ian Springer, Sal Campana
- */
-public abstract class JaxRpcPlatform
-{
-
- /**
- * Axis JaxRpcPlatform instance.
- */
- public static JaxRpcPlatform AXIS =
- new AxisJaxRpcPlatform();
-
- /**
- * Weblogic JaxRpcPlatform instance.
- */
- public static JaxRpcPlatform WEBLOGIC =
- new WeblogicJaxRpcPlatform();
-
- /**
- * Represents the platform detected in this classloader.
- */
- private static JaxRpcPlatform s_platformType;
-
- /**
- * Returns a short description of the platform.
- *
- * @return a short description of the platform
- */
- public abstract String getDescription();
-
- /**
- * Returns the SOAPFactoryImpl class name.
- *
- * @return SOAPFactoryImpl class name.
- */
- public abstract String getSoapFactoryImpl();
-
- /**
- * Returns the platform-specific endpoint url for a service on a given platform.
- *
- * An example of this would be:</br>
- * baseWebappUrl = http://localhost:8080/wsrf</br>
- * serviceName = filesystem</br>
- *
- * On the Axis platform the endpoint URL is: http://localhost:8080/wsrf/services/filesystem
- *
- * @param baseWebappUrl The url containing the webapp context (i.e. http://localhost:8080/wsrf)
- * @param serviceName The service name which is registered with the platform
- * @return The endpoint url for the service.
- */
- public abstract String getEndpointUrl(String baseWebappUrl, String serviceName);
-
- /**
- * Returns the description of the JAX-RPC platform.
- *
- * @return String
- */
- public abstract String toString();
-
- /**
- * Returns the JaxRpcPlatform for this environment. This method is meant to be called from within the classloader
- * hosting the JAX-RPC engine.
- *
- * @return the JaxRpcPlatform for this classloader
- */
- public synchronized static JaxRpcPlatform getJaxRpcPlatform()
- {
- if ( s_platformType != null )
- {
- return s_platformType;
- }
- SOAPFactory soapFactory;
- try
- {
- soapFactory = SOAPFactory.newInstance();
- }
- catch ( SOAPException soape )
- {
- throw new RuntimeException( "JAX-RPC platform not found!" );
- }
- if ( soapFactory.getClass().getName().equals( AXIS.getSoapFactoryImpl() ) )
- {
- s_platformType = AXIS;
- }
- else if ( soapFactory.getClass().getName().equals( WEBLOGIC.getSoapFactoryImpl() ) )
- {
- s_platformType = WEBLOGIC;
- }
- if ( s_platformType == null)
- {
- throw new RuntimeException( "Unsupported JAX-RPC platform." );
- }
- return s_platformType;
- }
-
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.util.platform;
+
+import org.apache.ws.util.platform.axis.AxisJaxRpcPlatform;
+import org.apache.ws.util.platform.weblogic.WeblogicJaxRpcPlatform;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+
+/**
+ * An Enumeration of JAX-RPC platform types supported by Apache WSRF.
+ * Currently the supported platforms are Apache Axis ({@link #AXIS})
+ * and BEA WebLogic Server ({@link #WEBLOGIC}).
+ *
+ * @author Ian Springer, Sal Campana
+ */
+public abstract class JaxRpcPlatform
+{
+ /**
+ * Axis JaxRpcPlatform instance.
+ */
+ public static JaxRpcPlatform AXIS = new AxisJaxRpcPlatform( );
+
+ /**
+ * Weblogic JaxRpcPlatform instance.
+ */
+ public static JaxRpcPlatform WEBLOGIC = new WeblogicJaxRpcPlatform( );
+
+ /**
+ * Represents the platform detected in this classloader.
+ */
+ private static JaxRpcPlatform s_platformType;
+
+ /**
+ * Returns a short description of the platform.
+ *
+ * @return a short description of the platform
+ */
+ public abstract String getDescription( );
+
+ /**
+ * Returns the platform-specific endpoint url for a service on a given platform.
+ *
+ * An example of this would be:</br>
+ * baseWebappUrl = http://localhost:8080/wsrf</br>
+ * serviceName = filesystem</br>
+ *
+ * On the Axis platform the endpoint URL is: http://localhost:8080/wsrf/services/filesystem
+ *
+ * @param baseWebappUrl The url containing the webapp context (i.e. http://localhost:8080/wsrf)
+ * @param serviceName The service name which is registered with the platform
+ * @return The endpoint url for the service.
+ */
+ public abstract String getEndpointUrl( String baseWebappUrl,
+ String serviceName );
+
+ /**
+ * Returns the SOAPFactoryImpl class name.
+ *
+ * @return SOAPFactoryImpl class name.
+ */
+ public abstract String getSoapFactoryImpl( );
+
+ /**
+ * Returns the description of the JAX-RPC platform.
+ *
+ * @return String
+ */
+ public abstract String toString( );
+
+ /**
+ * Returns the JaxRpcPlatform for this environment. This method is meant to be called from within the classloader
+ * hosting the JAX-RPC engine.
+ *
+ * @return the JaxRpcPlatform for this classloader
+ */
+ public static synchronized JaxRpcPlatform getJaxRpcPlatform( )
+ {
+ if ( s_platformType != null )
+ {
+ return s_platformType;
+ }
+
+ SOAPFactory soapFactory;
+ try
+ {
+ soapFactory = SOAPFactory.newInstance( );
+ }
+ catch ( SOAPException soape )
+ {
+ throw new RuntimeException( "JAX-RPC platform not found!" );
+ }
+
+ if ( soapFactory.getClass( ).getName( ).equals( AXIS.getSoapFactoryImpl( ) ) )
+ {
+ s_platformType = AXIS;
+ }
+ else if ( soapFactory.getClass( ).getName( ).equals( WEBLOGIC.getSoapFactoryImpl( ) ) )
+ {
+ s_platformType = WEBLOGIC;
+ }
+
+ if ( s_platformType == null )
+ {
+ throw new RuntimeException( "Unsupported JAX-RPC platform." );
+ }
+
+ return s_platformType;
+ }
+}
\ No newline at end of file
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/axis/AxisJaxRpcPlatform.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/axis/AxisJaxRpcPlatform.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/axis/AxisJaxRpcPlatform.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/platform/axis/AxisJaxRpcPlatform.java Tue Aug 2 09:28:49 2005
@@ -1,75 +1,89 @@
-package org.apache.ws.util.platform.axis;
-
-import org.apache.ws.util.platform.JaxRpcPlatform;
-
-
-/**
- * @author Sal Campana
- */
-public class AxisJaxRpcPlatform extends JaxRpcPlatform
-{
-
- /**
- * Axis description.
- */
- private static final String AXIS_DESC = "Apache Axis";
-
- /**
- * Class name of Axis' impl of SAAJ {@link javax.xml.soap.SOAPFactory} interface.
- */
- private static final String IMPL_SOAP_FACTORY_AXIS = "org.apache.axis.soap.SOAPFactoryImpl";
-
- /**
- * The services portion of the endpoint url.
- */
- private static final String SERVICES_CONTEXT = "/services/";
-
-
- /**
- * Returns a short description of the platform.
- *
- * @return a short description of the platform
- */
- public String getDescription()
- {
- return AXIS_DESC;
- }
-
- /**
- * Returns the SOAPFactoryImpl class name.
- *
- * @return SOAPFactoryImpl class name.
- */
- public String getSoapFactoryImpl()
- {
- return IMPL_SOAP_FACTORY_AXIS;
- }
-
- /**
- * Returns the platform-specific endpoint url for a service on a given platform.
- * <p/>
- * An example of this would be:</br>
- * baseWebappUrl = http://localhost:8080/wsrf</br>
- * serviceName = filesystem</br>
- * <p/>
- * On the Axis platform the endpoint URL is: http://localhost:8080/wsrf/services/filesystem
- *
- * @param baseWebappUrl The url containing the webapp context (i.e. http://localhost:8080/wsrf)
- * @param serviceName The service name which is registered with the platform
- * @return The endpoint url for the service.
- */
- public String getEndpointUrl(String baseWebappUrl, String serviceName)
- {
- return baseWebappUrl + SERVICES_CONTEXT + serviceName;
- }
-
- /**
- * Returns the description of the JAX-RPC platform.
- *
- * @return String
- */
- public String toString()
- {
- return AXIS_DESC;
- }
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.util.platform.axis;
+
+import org.apache.ws.util.platform.JaxRpcPlatform;
+
+/**
+ * @author Sal Campana
+ */
+public class AxisJaxRpcPlatform
+ extends JaxRpcPlatform
+{
+ /**
+ * Axis description.
+ */
+ private static final String AXIS_DESC = "Apache Axis";
+
+ /**
+ * Class name of Axis' impl of SAAJ {@link javax.xml.soap.SOAPFactory} interface.
+ */
+ private static final String IMPL_SOAP_FACTORY_AXIS = "org.apache.axis.soap.SOAPFactoryImpl";
+
+ /**
+ * The services portion of the endpoint url.
+ */
+ private static final String SERVICES_CONTEXT = "/services/";
+
+ /**
+ * Returns a short description of the platform.
+ *
+ * @return a short description of the platform
+ */
+ public String getDescription( )
+ {
+ return AXIS_DESC;
+ }
+
+ /**
+ * Returns the platform-specific endpoint url for a service on a given platform.
+ * <p/>
+ * An example of this would be:</br>
+ * baseWebappUrl = http://localhost:8080/wsrf</br>
+ * serviceName = filesystem</br>
+ * <p/>
+ * On the Axis platform the endpoint URL is: http://localhost:8080/wsrf/services/filesystem
+ *
+ * @param baseWebappUrl The url containing the webapp context (i.e. http://localhost:8080/wsrf)
+ * @param serviceName The service name which is registered with the platform
+ * @return The endpoint url for the service.
+ */
+ public String getEndpointUrl( String baseWebappUrl,
+ String serviceName )
+ {
+ return baseWebappUrl + SERVICES_CONTEXT + serviceName;
+ }
+
+ /**
+ * Returns the SOAPFactoryImpl class name.
+ *
+ * @return SOAPFactoryImpl class name.
+ */
+ public String getSoapFactoryImpl( )
+ {
+ return IMPL_SOAP_FACTORY_AXIS;
+ }
+
+ /**
+ * Returns the description of the JAX-RPC platform.
+ *
+ * @return String
+ */
+ public String toString( )
+ {
+ return AXIS_DESC;
+ }
+}
\ No newline at end of file