com.threerings.presents.tools
Class GenServiceTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by com.threerings.presents.tools.GenTask
              extended by com.threerings.presents.tools.InvocationTask
                  extended by com.threerings.presents.tools.GenServiceTask
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
GenCPPServiceTask

public class GenServiceTask
extends InvocationTask

An Ant task for generating invocation service marshalling and unmarshalling classes. TODO: when generating the imports for exported action script files, there are just enough conversions of primitive types (e.g. float -> Number), array types (e.g. int[] -> TypedArray) and three rings utility types (e.g. float -> Float) to make the existing serivces work. It should be possible to create a complete list of these conversions so that future services can be generated without problems.


Nested Class Summary
 class GenServiceTask.Adapter
          Used to track services for which we should create listener adapters in actionscript.
 class GenServiceTask.Providerless
          Used to track services for which we should not generate a provider interface.
protected  class GenServiceTask.ServiceDescription
          Rolls up everything needed for the generate* methods.
 class GenServiceTask.ServiceListener
          Used to keep track of custom InvocationListener derivations.
 
Nested classes/interfaces inherited from class com.threerings.presents.tools.InvocationTask
InvocationTask.ListenerArgument, InvocationTask.ServiceMethod
 
Field Summary
protected  Set<String> _aslistenerAdapters
          Services for which we should generate actionscript listener adapters.
protected  File _asroot
          The path to our ActionScript source files.
protected  Set<String> _providerless
          Services for which we should not generate provider interfaces.
protected  boolean _verbose
          Show extra output if set.
protected static String AS_LISTENER_ADAPTER_SERVICE_TMPL
          Specifies the path to the ActionScript listener adapter service template.
protected static String AS_LISTENER_MARSHALLER_TMPL
          Specifies the path to the ActionScript listener marshaller template.
protected static String AS_LISTENER_SERVICE_TMPL
          Specifies the path to the ActionScript listener service template.
protected static String AS_MARSHALLER_TMPL
          Specifies the path to the ActionScript marshaller template.
protected static String AS_SERVICE_TMPL
          Specifies the path to the ActionScript service template.
protected static String DISPATCHER_TMPL
          Specifies the path to the dispatcher template.
protected static String MARSHALLER_TMPL
          Specifies the path to the marshaller template.
protected static String PROVIDER_TMPL
          Specifies the path to the provider template.
 
Fields inherited from class com.threerings.presents.tools.InvocationTask
_iclient, _ilistener
 
Fields inherited from class com.threerings.presents.tools.GenTask
_checking, _cloader, _filesets, _header, _modifiedPaths, EOL
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
GenServiceTask()
           
 
Method Summary
 GenServiceTask.Adapter createAdapter()
           
 GenServiceTask.Providerless createProviderless()
           
protected  void generateDispatcher(File source, GenServiceTask.ServiceDescription sdesc)
           
protected  void generateMarshaller(File source, GenServiceTask.ServiceDescription sdesc)
           
protected  void generateProvider(File source, GenServiceTask.ServiceDescription sdesc)
           
protected  String getGeneratedAnnotation(String name)
          Helper to get the appropriate "@Generated" annotation for service classes.
 void processClass(File source, Class<?> service)
          Process a class found from the given source file that was on the filesets given to this task.
 void setAsroot(File asroot)
          Configures the path to our ActionScript source files.
 void setVerbose(boolean verbose)
          Configures to output extra information when generating code.
 
Methods inherited from class com.threerings.presents.tools.InvocationTask
checkedAdd, createAndGatherImports, execute, replacePath
 
Methods inherited from class com.threerings.presents.tools.GenTask
addFileset, convertEols, createMap, loadClass, loadClass, mergeTemplate, mergeTemplate, setChecking, setClasspathref, setHeader, wouldProduceSameFile, writeFile, writeTemplate, writeTemplate
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_verbose

protected boolean _verbose
Show extra output if set.


_asroot

protected File _asroot
The path to our ActionScript source files.


_providerless

protected Set<String> _providerless
Services for which we should not generate provider interfaces.


_aslistenerAdapters

protected Set<String> _aslistenerAdapters
Services for which we should generate actionscript listener adapters.


MARSHALLER_TMPL

protected static final String MARSHALLER_TMPL
Specifies the path to the marshaller template.

See Also:
Constant Field Values

DISPATCHER_TMPL

protected static final String DISPATCHER_TMPL
Specifies the path to the dispatcher template.

See Also:
Constant Field Values

PROVIDER_TMPL

protected static final String PROVIDER_TMPL
Specifies the path to the provider template.

See Also:
Constant Field Values

AS_SERVICE_TMPL

protected static final String AS_SERVICE_TMPL
Specifies the path to the ActionScript service template.

See Also:
Constant Field Values

AS_LISTENER_SERVICE_TMPL

protected static final String AS_LISTENER_SERVICE_TMPL
Specifies the path to the ActionScript listener service template.

See Also:
Constant Field Values

AS_LISTENER_ADAPTER_SERVICE_TMPL

protected static final String AS_LISTENER_ADAPTER_SERVICE_TMPL
Specifies the path to the ActionScript listener adapter service template.

See Also:
Constant Field Values

AS_MARSHALLER_TMPL

protected static final String AS_MARSHALLER_TMPL
Specifies the path to the ActionScript marshaller template.

See Also:
Constant Field Values

AS_LISTENER_MARSHALLER_TMPL

protected static final String AS_LISTENER_MARSHALLER_TMPL
Specifies the path to the ActionScript listener marshaller template.

See Also:
Constant Field Values
Constructor Detail

GenServiceTask

public GenServiceTask()
Method Detail

setVerbose

public void setVerbose(boolean verbose)
Configures to output extra information when generating code.


setAsroot

public void setAsroot(File asroot)
Configures the path to our ActionScript source files.


createProviderless

public GenServiceTask.Providerless createProviderless()

createAdapter

public GenServiceTask.Adapter createAdapter()

processClass

public void processClass(File source,
                         Class<?> service)
                  throws Exception
Description copied from class: GenTask
Process a class found from the given source file that was on the filesets given to this task.

Specified by:
processClass in class GenTask
Throws:
Exception

generateMarshaller

protected void generateMarshaller(File source,
                                  GenServiceTask.ServiceDescription sdesc)
                           throws Exception
Throws:
Exception

generateDispatcher

protected void generateDispatcher(File source,
                                  GenServiceTask.ServiceDescription sdesc)
                           throws Exception
Throws:
Exception

generateProvider

protected void generateProvider(File source,
                                GenServiceTask.ServiceDescription sdesc)
                         throws Exception
Throws:
Exception

getGeneratedAnnotation

protected String getGeneratedAnnotation(String name)
Helper to get the appropriate "@Generated" annotation for service classes.