*/
protected ServiceProperties buildServiceProperties( ResourceDefinition resourceDef,
File wsdlFile,
File serviceDir )
{
ServiceProperties props = new ServiceProperties( resourceDef );
String targetNamespace = resourceDef.getDefinition( ).getTargetNamespace( );
props.setPackageName( GenerationUtils.getJavaPackageName( targetNamespace ) );
String serviceName = resourceDef.getName( );
String javaServiceName = getValidJavaName( resourceDef );
props.setServiceName( javaServiceName );
props.setSrcDir( new File( serviceDir, "src/java" ).getAbsolutePath( ) );
props.setJarDir( new File( m_xmlbeansDir, "lib" ).getAbsolutePath( ) );
props.setJarFileName( getJarFileName( wsdlFile ) );
props.setClassesDir( new File( serviceDir, "classes" ).getAbsolutePath( ) );
props.setEndpointURL( resourceDef.getEndpointURL( ) );
props.setEndpointServiceName( serviceName );
props.setServiceImplements( ImplementsListBuilder.getServiceImplementsList( resourceDef, m_portTypeInfoMap ) );
props.setNamespace( targetNamespace );
props.setPrefix( GenerationUtils.getPrefix( targetNamespace ) );
props.setCustomMappings( GenerationUtils.getOperationInfoMap( resourceDef ) );
props.setHasProperties( resourceDef.hasProperties( ) );
props.setWebappName( getWebbappName( ) );
if ( resourceDef.hasProperties( ) )
{
QName[] propertyNames = resourceDef.getPropertyNames( );
Map propMap = new HashMap( );
for ( int i = 0; i < propertyNames.length; i++ )
{
QName propertyName = propertyNames[i];
String propName = getJavaConstantName( propertyName, propMap );
propMap.put( propName, propertyName );
}
props.setPropertyMap( propMap );
}
// define the names of the resource props that we initialize for the user...
if ( hasScheduledResourceTerminationPortType( resourceDef ) )
{
props.addImplementedProperty( org.apache.ws.resource.lifetime.v2004_06.porttype.ScheduledResourceTerminationPortType.PROP_QNAME_TERMINATION_TIME );
props.addImplementedProperty( org.apache.ws.resource.lifetime.v2004_06.porttype.ScheduledResourceTerminationPortType.PROP_QNAME_CURRENT_TIME );
props.addImplementedProperty( org.apache.ws.resource.lifetime.v2004_11.porttype.ScheduledResourceTerminationPortType.PROP_QNAME_TERMINATION_TIME );
props.addImplementedProperty( org.apache.ws.resource.lifetime.v2004_11.porttype.ScheduledResourceTerminationPortType.PROP_QNAME_CURRENT_TIME );
}
props.setResourceImplements( ImplementsListBuilder.getResourceImplementsList( resourceDef, m_portTypeInfoMap ) );
QName propertiesDocumentName = resourceDef.getPropertiesDocumentName( );
if ( propertiesDocumentName != null )
{
props.setPropertyDocumentName( XmlBeanNameUtils.getDocumentElementXmlBeanClassName( propertiesDocumentName ) );
}
props.setWsdlName( wsdlFile.getName( ) );
props.setResourcekey( new QName( targetNamespace, "ResourceIdentifier" ) );
Iterator ptNameIter = resourceDef.getImplementedResourceCapabilities( ).keySet( ).iterator( );
while ( ptNameIter.hasNext( ) )
{
QName ptName = (QName) ptNameIter.next( );
PortType2JavaInfo ptInfo = (PortType2JavaInfo) m_portTypeInfoMap.get( ptName );
if ( ptInfo != null )
{
if ( ptInfo.getResourceTemplateFileName( ) != null )
{
props.addResourceIncludeFile( ptInfo.getResourceTemplateFileName( ) );
}
if ( ptInfo.getResourceInitMethodIncludeLocation( ) != null )
{
props.addResourceInitIncludeLocation( ptInfo.getResourceInitMethodIncludeLocation( ) );
}
if ( ptInfo.getAbstractResourceInitMethodIncludeLocation( ) != null )
{
props.addAbstractResourceInitIncludeLocation( ptInfo.getAbstractResourceInitMethodIncludeLocation( ) );
}
if ( ptInfo.getServiceTemplateFileName( ) != null )
{
props.addServiceIncludeFile( ptInfo.getServiceTemplateFileName( ) );
}
}
else
{
System.err.println( "\n\nUnable to find a port type info for the implemented capability: "
+ ptName.toString( ) + "!!!!!!\n\n" );
}
}
if ( isDraft01Specific( resourceDef ) )
{
props.setNamespaceVersionHolder( org.apache.ws.resource.properties.v2004_06.impl.NamespaceVersionHolderImpl.class );
}
else if ( isDraft05Specific( resourceDef ) )
{
props.setNamespaceVersionHolder( org.apache.ws.resource.properties.v2004_11.impl.NamespaceVersionHolderImpl.class );
}
/*
* These props are for JIRA WSRF-4 and could be added to context obj
* The question is whether the service name here should be the real wsdl
* service name or the service name as we use it...
*/
String portName = resourceDef.getPort( ).getName( );
props.setPortName( portName );
QName portTypeQName = resourceDef.getPortType( ).getQName( );
props.setPortTypeQName( portTypeQName );
QName serviceQname = new QName( targetNamespace, serviceName );
props.setServiceQName( serviceQname );
return props;
}