JavaGen Code Generator Web Service Module

Public Targets

TargetDescription
javagengenerate code from UML/XMI file
javagen.propslist JavaGen-specific properties
javagen.accountshow JavaGen account status
javagen.listlist javagen projects in your account
clean.gendelete/archive src-gen directory

Source: javagen-ws.xml

				<?xml version="1.0" encoding="UTF-8"?>
<project name="javagen">
	<description>
  + ==\_/============J=A=V=A=G=E=N===A=N=T===M=O=D=U=L=E=S================= +
  +  \(_)/                                                                  +
  +  -(_)-         JavaGen Code Generator Web Service Module                +
  +  /(_)\                                                                  +
  + ======================================================================= +
  +    Copyright (c) 2002-2005 Outsource Cafe, Inc.  All rights reserved.   +
  + ======================================================================= +
  +
  + Invokes JavaGen code generator web service, passing XMI file and properties
  + controlling what is generated.  
  +
  + Additional targets are defined for listing available code generator 
  + properties, checking JavaGen account status and for removing generated 
  + code.
  +
  + To override JavaGen-specific properties, define a property file named
  + 'props-javagen.xml' and import it into your build file before importing 
  + this file.  To protect your JavaGen account password, define it in
  + the props-user.xml file or you can specify it on the command line: 
  +    ant javagen -Djavagen.password=very-secret
  + 
  + Targets: 
  +          javagen - generate code from UML/XMI file.
  +        clean.gen - move src-gen to src-gen-old directory or
  +                    or delete src-gen if delete.src-gen.on=true.
  +    javagen.props - list javagen-specific properties
  +  javagen.account - show JavaGen account status
  +
  + Properties: 
  +       model.path - path to the xmi file.  Can include entries within a
  +                    zip file using the '!' character to seperate the file
  +                    from the entries.  For example:
  +                    /project/src/uml/uml.zuml!/entry.xmi
  +    src.model.dir - should point to the UML directory.  Default: src/uml.
  +
  + Supported Case/UML Tools:
  +   Poseidon 1.6, 2.x, 3.x
  +
  + developer: RichardEasterling@OutsourceCafe.com
  + ======================================================================= +
  + 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.
  + =J=A=M===========================================J=A=V=A=G=E=N=.=C=O=M= +
   </description>
	<property name="JAVAGEN.PRESENT" value="true"></property>
	<!-- =================================================================== -->
	<!-- public targets: -->
	<!-- =================================================================== -->
	<target name="javagen" depends="callws.javagen" description="generate code from UML/XMI file"></target>
	<target name="javagen.props" depends="callws.properties" description="list JavaGen-specific properties"></target>
	<target name="javagen.account" depends="callws.account" description="show JavaGen account status"></target>
	<target name="javagen.list" depends="callws.list" description="list javagen projects in your account"></target>
	<target name="clean.gen" depends="javagen.clean" description="delete/archive src-gen directory"></target>
	<!-- =================================================================== -->
	<!-- javagen properties -->
	<!-- =================================================================== -->
	<property name="javagen.account" value="guest"></property>
	<property name="javagen.username" value="anonymous"></property>
	<property name="javagen.password" value="anonymous"></property>
	<property name="javagen.config" value=""></property>
	<property name="javagen.url" value="http://www.javagen.org/javagen-ws/services/JavaGenWS"></property>
	<!-- set javagen.project to project.name if its defined -->
	<condition property="javagen.project" value="${project.name}">
		<isset property="project.name"></isset>
	</condition>
	<property name="javagen.properties" value="model.name,database.name,datasource.name,xdoclet.ejb.suffix,xdoclet.dto.suffix,xdoclet.webservice.suffix,appserver.name,appserver.version"></property>
	<property name="javagen.remove.duplicate.source" value="true"></property>
	<property name="javagen.delete.old.source" value="false"></property>
	<property name="gen.timestamp.file" location="${gen.dir}/timestamp.txt"></property>
	<!-- =================================================================== -->
	<!-- derived codegen properties -->
	<!-- =================================================================== -->
	<property name="jam.xsl.dir" location="${jam.home}/xsl"></property>
	<!-- =================================================================== -->
	<!-- jars needed for Axis web service call - ignored if already defined -->
	<!-- =================================================================== -->
	<!--
	<property name="axis.jar" location="${maven.repo}/axis/jars/axis-1.1.jar"/>
	-->
	<property name="activation.jar" location="${maven.repo}/activation/jars/activation-1.0.2.jar"></property>
	<property name="mail.jar" location="${maven.repo}/javamail/jars/javamail-1.3.2.jar"></property>
	<property name="commons-discovery.jar" location="${maven.repo}/commons-discovery/jars/commons-discovery-0.2.jar"></property>
	<property name="axis-saaj.jar" location="${maven.repo}/axis/jars/axis-saaj-1.2-RC2.jar"></property>
	<property name="axis-jaxrpc.jar" location="${maven.repo}/axis/jars/axis-jaxrpc-1.2-RC2.jar"></property>
	<property name="axis-wsdl4j.jar" location="${maven.repo}/axis/jars/axis-wsdl4j-1.2-RC2.jar"></property>
	<property name="axis-close-socket-patch.jar" location="${maven.repo}/axis/jars/axis-close-socket-patch-1.1.1.jar"></property>
	<property name="javagen-ws-client.jar" location="${maven.repo}/javagen-com/jars/javagen-ws-client-1.3.jar"></property>
	<!-- ===================================================================== -->
	<!-- JavaGen web service classpath -->
	<!-- ===================================================================== -->
	<path id="javagenws.classpath">
		<pathelement path="${java.class.path}"></pathelement>
		<pathelement location="${activation.jar}"></pathelement>
		<pathelement location="${mail.jar}"></pathelement>
		<pathelement location="${axis-saaj.jar}"></pathelement>
		<pathelement location="${axis-jaxrpc.jar}"></pathelement>
		<pathelement location="${log4j.jar}"></pathelement>
		<pathelement location="${axis-close-socket-patch.jar}"></pathelement>
		<pathelement location="${commons-discovery.jar}"></pathelement>
		<pathelement location="${commons-logging.jar}"></pathelement>
		<pathelement location="${javagen-ws-client.jar}"></pathelement>
		<pathelement path="${build.classes.dir}"></pathelement>
	</path>
	<!-- =================================================================== -->
	<!-- sanity check -->
	<!-- =================================================================== -->
	<available classpathref="javagenws.classpath" classname="javax.activation.DataHandler" property="jaf-jar-available"></available>
	<fail unless="jaf-jar-available" message="JAF (activation.jar) is missing.  Download from http://java.sun.com/products/javabeans/glasgow/jaf.html, extract activation.jar and copy/rename under ${activation.jar}"></fail>
	<available classpathref="javagenws.classpath" classname="javax.mail.Address" property="mail-jar-available"></available>
	<fail unless="mail-jar-available" message="JavaMail (mail.jar) is missing.  Download from http://java.sun.com/products/javamail/downloads/, extract mail.jar and copy/rename under ${mail.jar}"></fail>
	<condition property="src-model-dir-exists">
		<available file="${src.model.dir}"></available>
	</condition>
	<fail unless="src-model-dir-exists">javagen-ws.xml: 'src.model.dir' property not set: </fail>
	<condition property="model.path.exists">
		<isset property="model.path"></isset>
	</condition>
	<fail unless="model.path.exists">javagen.xml: 'model.path' property not set (exampe: src/uml/model.zuml!/model.xmi) </fail>
	<!-- ===================================================================== -->
	<!-- taskdefs -->
	<!-- ===================================================================== -->
	<taskdef name="javagen" classname="com.javagen.codegen.client.ant.JavaGenWSTask" classpathref="javagenws.classpath"></taskdef>
	<taskdef name="javagen-properties" classname="com.javagen.codegen.client.ant.JavaGenPropertiesWSTask" classpathref="javagenws.classpath"></taskdef>
	<taskdef name="javagen-account" classname="com.javagen.codegen.client.ant.JavaGenAccountWSTask" classpathref="javagenws.classpath"></taskdef>
	<taskdef name="javagen-list" classname="com.javagen.codegen.client.ant.JavaGenListWSTask" classpathref="javagenws.classpath"></taskdef>
	<!--
	<taskdef name="xmi-archive" classname="com.javagen.codegen.client.ant.ContainerFileTask" classpathref="javagenws.classpath"/>
	<typedef resource="javagenWsTaskdefs.properties"/>
	-->
	<!-- =================================================================== -->
	<!-- force code generation by deleting timestamp. Play it safe by not -->
	<!-- deleting actual files, source is retained even if web service fails. -->
	<!-- =================================================================== -->
	<target name="javagen.clean">
		<delete file="${gen.timestamp.file}" failonerror="false"></delete>
	</target>
	<!-- =================================================================== -->
	<!-- generate code - call web service -->
	<!-- =================================================================== -->
	<target name="callws.javagen" unless="javagen-uptodate">
		<echo>username     = ${javagen.username}</echo>
		<echo>account      = ${javagen.account}</echo>
		<echo>modelfile    = ${model.path}</echo>
		<echo>project      = ${javagen.project}</echo>
		<echo>wsaddress    = ${javagen.url}</echo>
		<echo>properties   = ${javagen.properties}</echo>
		<echo>Calling web service...</echo>
		<javagen modelfile="${model.path}" deleteOldSource="${javagen.delete.old.source}" removeDuplicateSource="${javagen.remove.duplicate.source}" srcGenFolder="${gen.src.folder}" srcFolder="${src.folder}" username="${javagen.username}" password="${javagen.password}" account="${javagen.account}" projectname="${javagen.project}" propertylist="${javagen.properties}" srcZipFileProperty="javagen.src.zip.file" timestampFile="${gen.timestamp.file}" url="${javagen.url}"></javagen>
		<echo>RESULT: javagen.src.zip.file = ${javagen.src.zip.file}</echo>
	</target>
	<!-- =================================================================== -->
	<!-- list javagen-specific properties - call web service -->
	<!-- =================================================================== -->
	<target name="callws.properties" depends="">
		<echo>username     = ${javagen.username}</echo>
		<echo>account      = ${javagen.account}</echo>
		<echo>project      = ${javagen.project}</echo>
		<echo>wsaddress    = ${javagen.url}</echo>
		<echo>Calling web service...</echo>
		<javagen-properties username="${javagen.username}" password="${javagen.password}" account="${javagen.account}" projectname="${javagen.project}" url="${javagen.url}" propertylist=""></javagen-properties>
	</target>
	<!-- =================================================================== -->
	<!-- list javagen-specific properties - call web service -->
	<!-- =================================================================== -->
	<target name="callws.account" depends="">
		<echo>username     = ${javagen.username}</echo>
		<echo>account      = ${javagen.account}</echo>
		<echo>project      = ${javagen.project}</echo>
		<echo>wsaddress    = ${javagen.url}</echo>
		<echo>Calling web service...</echo>
		<javagen-account username="${javagen.username}" password="${javagen.password}" account="${javagen.account}" projectname="${javagen.project}" url="${javagen.url}" propertylist=""></javagen-account>
	</target>
	<!-- =================================================================== -->
	<!-- list javagen projects in your account - call web service -->
	<!-- =================================================================== -->
	<target name="callws.list" depends="">
		<echo>username     = ${javagen.username}</echo>
		<echo>account      = ${javagen.account}</echo>
		<echo>project      = ${javagen.project}</echo>
		<echo>wsaddress    = ${javagen.url}</echo>
		<echo>Calling web service...</echo>
		<javagen-list username="${javagen.username}" password="${javagen.password}" account="${javagen.account}" projectname="${javagen.project}" url="${javagen.url}" propertylist=""></javagen-list>
	</target>
</project>