Package org.apache.ws.resource.tool.velocity

Examples of org.apache.ws.resource.tool.velocity.ServiceProperties


   {
      String capitalizedServiceName = getValidJavaName( resourceDef );
      try
      {
         VelocityContext   context = new VelocityContext(  );
         ServiceProperties props = buildServiceProperties( resourceDef, wsdlFile, serviceDir );
         context.put( "generated", props );
         updateVelocityContext( context, resourceDef );

         //generate files
         File packageDir = getPackageDir( resourceDef.getDefinition(  ).getTargetNamespace(  ),
View Full Code Here


    */
   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 );
         props.setCustomPropertyNames( resourceDef.getCustomPropertyNames(  ) );
      }

      if ( resourceDef.implementsResourceCapability( MetadataExchangePortType.NAME ) )
      {
         props.setHasMetadata( true );
      }

      // 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
                                + "!\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 );

      props.setWsdlServiceName( resourceDef.getWsdlServiceName(  ) );

      props.setServiceMethodMap( resourceDef.getAllOperations(  ) );
      return props;
   }
View Full Code Here

   {
      String capitalizedServiceName = getValidJavaName( resourceDef );
      try
      {
         VelocityContext   context = new VelocityContext(  );
         ServiceProperties props = buildServiceProperties( resourceDef, wsdlFile, serviceDir );
         context.put( VELOCITY_CONTEXT_KEY_GENERATED, props );
         updateVelocityContext( context, resourceDef );

         //generate files
         File packageDir = getPackageDir( resourceDef.getDefinition(  ).getTargetNamespace(  ),
View Full Code Here

    */
   protected ServiceProperties buildServiceProperties( ResourceDefinition resourceDef,
                                                       File               wsdlfile,
                                                       File               servicedir )
   {
      ServiceProperties serviceProps = super.buildServiceProperties( resourceDef, wsdlfile, servicedir );
      serviceProps.setNamespaceVersionHolder( WsnNamespaceVersionHolderImpl.class ); // make sure to add different ones as new versions come out

      // tell service props which properties we handle for the user...
      if ( isNotificationProducer( resourceDef ) )
      {
         serviceProps.addImplementedProperty( NotificationProducerPortType.PROP_QNAME_FIXED_TOPIC_SET );
         serviceProps.addImplementedProperty( NotificationProducerPortType.PROP_QNAME_TOPIC );
         serviceProps.addImplementedProperty( NotificationProducerPortType.PROP_QNAME_TOPIC_EXPRESSION_DIALECTS );
         serviceProps.addSpringBeanDefIncludeLocation( "templates/producer-spring-beans.xml.vm" );
      }

      return serviceProps;
   }
View Full Code Here

TOP

Related Classes of org.apache.ws.resource.tool.velocity.ServiceProperties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.