[jbossws-commits] JBossWS SVN: r5525 - in stack/native/trunk: src/main/distro and 1 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Jan 23 10:49:19 EST 2008


Author: alessio.soldano at jboss.com
Date: 2008-01-23 10:49:19 -0500 (Wed, 23 Jan 2008)
New Revision: 5525

Added:
   stack/native/trunk/src/main/distro/bin-dist-project-gen.xml
   stack/native/trunk/src/main/distro/eclipse.classpath
   stack/native/trunk/src/main/distro/eclipse.project
   stack/native/trunk/src/main/distro/user-project-build.xml
   stack/native/trunk/src/main/java/org/jboss/ws/tools/ant/FixPathTask.java
Modified:
   stack/native/trunk/ant-import/build-bin-dist.xml
   stack/native/trunk/src/main/distro/bin-dist-build.xml
Log:
- Simple user WS-enabled project generator (like Seam-gen)
- [JBWS-1887] Basic Eclipse configuration for user WS-enabled projects
- [JBWS-1888] Simple Ant build file for user WS-enabled projects


Modified: stack/native/trunk/ant-import/build-bin-dist.xml
===================================================================
--- stack/native/trunk/ant-import/build-bin-dist.xml	2008-01-23 14:29:51 UTC (rev 5524)
+++ stack/native/trunk/ant-import/build-bin-dist.xml	2008-01-23 15:49:19 UTC (rev 5525)
@@ -43,6 +43,7 @@
 		<copy tofile="${bindist.dir}/version.properties" file="${core.dir}/version.properties"/>
 		<copy tofile="${bindist.dir}/build.xml" file="${core.distro.dir}/bin-dist-build.xml"/>
 		<copy tofile="${bindist.build.dir}/build-deploy.xml" file="${core.distro.dir}/bin-dist-deploy.xml"/>
+		<copy tofile="${bindist.build.dir}/build-project-gen.xml" file="${core.distro.dir}/bin-dist-project-gen.xml"/>
 
 		<!-- build -->
 		<copy todir="${bindist.build.dir}">
@@ -50,6 +51,11 @@
 				<include name="macros-deploy-framework.xml"/>
 				<include name="macros-deploy-native.xml"/>
 			</fileset>
+			<fileset dir="${core.distro.dir}">
+				<include name="user-project-build.xml"/>
+				<include name="eclipse.project"/>
+				<include name="eclipse.classpath"/>
+			</fileset>
 		</copy>
 
 		<unzip dest="${bindist.bin.dir}" src="${thirdparty.dir}/jbossws-framework-scripts.zip"/>

Modified: stack/native/trunk/src/main/distro/bin-dist-build.xml
===================================================================
--- stack/native/trunk/src/main/distro/bin-dist-build.xml	2008-01-23 14:29:51 UTC (rev 5524)
+++ stack/native/trunk/src/main/distro/bin-dist-build.xml	2008-01-23 15:49:19 UTC (rev 5525)
@@ -98,6 +98,7 @@
   <fail message="JDK1.5 or above is required" unless="HAVE_JDK_1.5"/>
 
 	<import file="${basedir}/build/build-deploy.xml"/>
+	<import file="${basedir}/build/build-project-gen.xml"/>
 	<import file="${basedir}/build/macros-deploy-framework.xml"/>
 	<import file="${basedir}/build/macros-deploy-native.xml"/>
 	<import file="${basedir}/tests/ant-import/build-testsuite.xml"/>

Added: stack/native/trunk/src/main/distro/bin-dist-project-gen.xml
===================================================================
--- stack/native/trunk/src/main/distro/bin-dist-project-gen.xml	                        (rev 0)
+++ stack/native/trunk/src/main/distro/bin-dist-project-gen.xml	2008-01-23 15:49:19 UTC (rev 5525)
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!--                                                                        -->
+<!--  JBoss, the OpenSource J2EE webOS                                      -->
+<!--                                                                        -->
+<!--  Distributable under LGPL license.                                     -->
+<!--  See terms of license at http://www.gnu.org.                           -->
+<!--                                                                        -->
+<!-- ====================================================================== -->
+
+<!-- $Id$ -->
+
+<project>
+
+  <target name="init-project-properties">
+    <property file="./user-project.properties" />
+    <property name="project.home" value="${workspace.home}/${project.name}"/>
+    
+    <filterset id="project">
+      <filter token="projectName" value="${project.name}" />
+      <filter token="jbossHome" value="${jboss.home}" />
+   	</filterset>
+  	
+  	<path id="jbws-ant.path" path="${basedir}/lib/jbossws-core.jar"/>
+  	<taskdef name="pathFixer" classname="org.jboss.ws.tools.ant.FixPathTask" classpathref="jbws-ant.path"/>
+  </target>
+
+  <target name="setup-new-project" depends="init-project-properties" description="Prompt for settings and setup configuration for a new user project">
+    <property file="./user-project.properties" prefix="old" />
+    
+    <echo message="-------------------------------------------------"/>
+    <echo message="  Welcome to the JBossWS user project generator"/>
+    <echo message="-------------------------------------------------"/>
+    <echo message=""/>
+    
+    <property name="old.workspace.home" value="C:/Projects"/>
+    <input addproperty="workspace.home.new" 
+           message="Enter your Java project workspace (the directory that contains your projects) [${old.workspace.home}]" 
+           defaultvalue="${old.workspace.home}"/>
+    <pathFixer property="workspace.home.new" />
+    
+    <property name="old.jboss.home" value="C:/Program Files/jboss-4.2.2.GA"/>
+    <input addproperty="jboss.home.new" 
+           message="Enter your JBoss home directory [${old.jboss.home}]" 
+           defaultvalue="${old.jboss.home}"/>
+    <pathFixer property="jboss.home.new" />
+    
+    <property name="old.jboss.conf" value="default"/>
+    <input addproperty="jboss.conf.new" 
+           message="Enter the JBoss configuration you would like to use [${old.jboss.conf}]" 
+           defaultvalue="${old.jboss.conf}"/>
+    
+    <property name="old.project.name" value="myproject"/>
+    <input addproperty="project.name.new" 
+           message="Enter the project name [${old.project.name}]" 
+           defaultvalue="${old.project.name}"/>
+    
+    <property name="old.project.type" value="jar"/>
+    <input addproperty="project.type.new" 
+           message="Is this project deployed as an JAR (with EJB3 components) or a WAR (with no EJB3 support) [${old.project.type}] " 
+           validargs="jar,war"
+           defaultvalue="${old.project.type}"/>
+    
+    <delete file="user-project.properties"/>
+    <propertyfile file="user-project.properties" comment="Generated by JBossWS user project setup">
+        <entry key="workspace.home" value="${workspace.home.new}"/>
+        <entry key="project.name" value="${project.name.new}"/>
+        <entry key="project.type" value="${project.type.new}"/>
+        <entry key="jboss.home" value="${jboss.home.new}"/>
+        <entry key="jboss.conf" value="${jboss.conf.new}"/>
+    </propertyfile>
+    
+    <echo message=""/>
+    <echo message="Your project settings have been saved in file 'user-project.properties'."/>
+    <echo message="Please type 'ant create-project' to create the new project."/>
+  </target>
+
+  <target name="create-project" depends="validate-settings,configure-project,copy-libraries" description="Create a new user project">
+    <echo message="A basic webservice project named '${project.name}' has been created in the ${workspace.home} directory."/>
+    <echo message="It includes a simple Ant build file and the required libraries."/>
+    <echo message="Please refer to http://jbws.dyndns.org/mediawiki/index.php?title=JBossWS for the authoritative documentation."/>
+    <echo message=""/>
+    <echo message="If you are an Eclipse user, import the project into Eclipse: right click in "/>
+    <echo message="'Package Explorer -> Import...' and select 'General -> Existing Projects into Workspace'."/>
+    <echo message="Then click on 'Next' and set the root directory browsing to your workspace directory."/>
+  </target>
+  
+  <target name="validate-settings" depends="init-project-properties">
+    <fail message="No project name specified (run 'ant setup-new-project' first)">
+      <condition>
+        <or>
+          <not><isset property="project.name"/></not>
+          <equals arg1="${project.name}" arg2=""/>
+        </or>
+      </condition>
+    </fail>
+    <fail message="No project workspace specified (run 'ant setup-new-project' first)">
+      <condition>
+        <or>
+          <not><isset property="workspace.home"/></not>
+          <equals arg1="${workspace.home}" arg2=""/>
+        </or>
+      </condition>
+    </fail>
+  </target>
+  
+  <target name="configure-project">
+    <mkdir dir="${project.home}/src/main/java"/>
+    <mkdir dir="${project.home}/src/main/resources"/>
+    <mkdir dir="${project.home}/lib"/>
+    <copy tofile="${project.home}/build.xml" file="${basedir}/build/user-project-build.xml">
+      <filterset refid="project"/>
+    </copy>
+    <copy tofile="${project.home}/.project" file="${basedir}/build/eclipse.project">
+      <filterset refid="project"/>
+    </copy>
+    <copy tofile="${project.home}/.classpath" file="${basedir}/build/eclipse.classpath"/>
+    <copy tofile="${project.home}/build.properties" file="${basedir}/user-project.properties"/>
+  </target>
+
+  <target name="copy-libraries">
+    <echo message="Copying JBossWS libraries to the ${project.home}/lib directory..." />
+    <copy todir="${project.home}/lib" overwrite="true">
+      <fileset dir="${basedir}/lib" >
+        <include name="jaxb-api.jar"/>
+        <include name="jboss-jaxrpc.jar"/>
+        <include name="jboss-jaxws.jar"/>
+        <include name="jbossws-client.jar"/>
+        <include name="jbossws-core.jar"/>
+        <include name="jbossws-spi.jar"/>
+      </fileset>
+    </copy>
+    <echo message="Copying other JBoss libraries to the ${project.home}/lib directory..." />
+    <copy todir="${project.home}/lib" overwrite="true">
+      <fileset dir="${jboss.home}/client" >
+        <include name="jbossall-client.jar"/>
+        <include name="jboss-ejb3x.jar"/>
+        <include name="ejb3-persistence.jar"/>
+      </fileset>
+    </copy>
+  </target>
+
+
+  <target name="update-project" depends="validate-settings,copy-libraries" description="Update user project libs">
+    <echo message="Libraries from the current configuration have been copied to the '${project.name}' project's lib directory."/>
+    <echo message="Please refresh / rebuild your project now." />
+  </target>
+  
+  <target name="delete-project" depends="validate-settings" description="Delete the configured user project">
+    <echo message="Deleting the entire project in ${project.home}" />
+    <delete dir="${project.home}" />
+  </target>
+  
+  <target name="settings" depends="init-project-properties" description="Print the current project settings">
+    <echo message="Java project workspace: ${workspace.home}"/>
+    <echo message="JBoss home: ${jboss.home}"/>
+    <echo message="JBoss conf: ${jboss.conf}"/>
+    <echo message="Project name: ${project.name}"/>
+    <echo message="Project type: ${project.type}"/>
+  </target>
+  
+</project>
\ No newline at end of file


Property changes on: stack/native/trunk/src/main/distro/bin-dist-project-gen.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: stack/native/trunk/src/main/distro/eclipse.classpath
===================================================================
--- stack/native/trunk/src/main/distro/eclipse.classpath	                        (rev 0)
+++ stack/native/trunk/src/main/distro/eclipse.classpath	2008-01-23 15:49:19 UTC (rev 5525)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="classes/main" path="src/main/java"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="lib" path="lib/ejb3-persistence.jar"/>
+	<classpathentry kind="lib" path="lib/jaxb-api.jar"/>
+	<classpathentry kind="lib" path="lib/jboss-ejb3x.jar"/>
+	<classpathentry kind="lib" path="lib/jboss-jaxrpc.jar"/>
+	<classpathentry kind="lib" path="lib/jboss-jaxws.jar"/>
+	<classpathentry kind="lib" path="lib/jbossall-client.jar"/>
+	<classpathentry kind="lib" path="lib/jbossws-client.jar"/>
+	<classpathentry kind="lib" path="lib/jbossws-core.jar"/>
+	<classpathentry kind="lib" path="lib/jbossws-spi.jar"/>
+	<classpathentry kind="output" path="classes"/>
+</classpath>

Added: stack/native/trunk/src/main/distro/eclipse.project
===================================================================
--- stack/native/trunk/src/main/distro/eclipse.project	                        (rev 0)
+++ stack/native/trunk/src/main/distro/eclipse.project	2008-01-23 15:49:19 UTC (rev 5525)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>@projectName@</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: stack/native/trunk/src/main/distro/user-project-build.xml
===================================================================
--- stack/native/trunk/src/main/distro/user-project-build.xml	                        (rev 0)
+++ stack/native/trunk/src/main/distro/user-project-build.xml	2008-01-23 15:49:19 UTC (rev 5525)
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+<project name="@projectName@" default="deploy" basedir="." >
+
+	<property file="${basedir}/build.properties" />
+
+	<!-- set global properties for this build -->
+	<property name="project.name" value="@projectName@" />
+	<property name="dist.dir" value="dist" />
+	<property name="lib.dir" value="lib" />
+	<property name="deploy.dir" value="${jboss.home}/server/default/deploy" />
+	<property name="output.dir" value="output" />
+	<property name="src.main.dir" value="src/main/java" />
+	<property name="resources.main.dir" value="src/main/resources" />
+	<property name="classes.main.dir" value="classes/main/java" />
+	<property name="javac.debug" value="true" />
+	<property name="javac.deprecation" value="false" />
+
+	<condition property="project.war" value="true">
+		<equals arg1="${project.type}" arg2="war"/>
+	</condition>
+
+	<fileset id="lib" dir="${lib.dir}">
+		<include name="*.jar" />
+	</fileset>
+
+	<path id="build.classpath">
+		<fileset refid="lib" />
+	</path>
+
+	<target name="clean">
+		<delete dir="${output.dir}" />
+		<delete dir="${dist.dir}" />
+	</target>
+
+	<target name="init">
+		<mkdir dir="${output.dir}" />
+		<mkdir dir="${dist.dir}" />
+	</target>
+
+	<target name="compile" depends="init" description="Compile the Java source code" unless="eclipse.running">
+		<tstamp/>
+		<javac destdir="${output.dir}" classpathref="build.classpath" debug="${javac.debug}" deprecation="${javac.deprecation}" nowarn="on">
+			<src path="${src.main.dir}" />
+		</javac>
+	</target>
+
+	<target name="copyclasses" depends="init" description="Copy the classes that were compiled by Eclipse" if="eclipse.running">
+		<copy todir="${output.dir}">
+			<fileset dir="${classes/main}">
+				<include name="**/*.class"/>
+			</fileset>
+		</copy>
+	</target>
+
+	<target name="dist" depends="compile,copyclasses" description="Create the application distribution archive">
+		<fail unless="project.type">project.type not set</fail>
+		<jar jarfile="${dist.dir}/${project.name}.${project.type}">
+			<fileset dir="${output.dir}" />
+			<fileset dir="${resources.main.dir}">
+				<include name="META-INF/**"/>
+				<include name="WEB-INF/**" if="project.war" />
+			</fileset>
+		</jar>
+	</target>
+
+	<target name="deploy" depends="dist" description="Deploy to JBoss AS">
+		<fail unless="jboss.home">jboss.home not set</fail>
+		<copy todir="${deploy.dir}" file="${dist.dir}/${project.name}.${project.type}" />
+	</target>
+
+	<target name="undeploy" description="Undeploy from JBoss AS">
+		<fail unless="jboss.home">jboss.home not set</fail>
+		<fail unless="jboss.conf">jboss.conf not set</fail>
+		<delete file="${deploy.dir}/${project.name}.${project.type}" />
+	</target>
+
+</project>


Property changes on: stack/native/trunk/src/main/distro/user-project-build.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: stack/native/trunk/src/main/java/org/jboss/ws/tools/ant/FixPathTask.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/tools/ant/FixPathTask.java	                        (rev 0)
+++ stack/native/trunk/src/main/java/org/jboss/ws/tools/ant/FixPathTask.java	2008-01-23 15:49:19 UTC (rev 5525)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.tools.ant;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+public class FixPathTask extends Task
+{
+   private String propertyName;
+
+   @Override
+   public void execute() throws BuildException
+   {
+      String path = getProject().getProperty(propertyName);
+
+      if (path != null)
+      {
+         getProject().setProperty(propertyName, path.replace('\\', '/'));
+      }
+   }
+
+   public void setProperty(String propertyName)
+   {
+      this.propertyName = propertyName;
+   }
+}


Property changes on: stack/native/trunk/src/main/java/org/jboss/ws/tools/ant/FixPathTask.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jbossws-commits mailing list