Overlord SVN: r215 - in cdl/trunk/samples/jbossesb: creditAgency and 7 other directories.
by overlord-commits@lists.jboss.org
Author: jeff.yuchang
Date: 2008-08-04 11:30:18 -0400 (Mon, 04 Aug 2008)
New Revision: 215
Removed:
cdl/trunk/samples/jbossesb/creditAgency/build.xml
cdl/trunk/samples/jbossesb/creditAgency/src/main/resources/hibernate.cfg.xml
cdl/trunk/samples/jbossesb/purchasing/build.xml
cdl/trunk/samples/jbossesb/purchasing/src/main/resources/hibernate.cfg.xml
Modified:
cdl/trunk/samples/jbossesb/README.txt
cdl/trunk/samples/jbossesb/creditAgency/pom.xml
cdl/trunk/samples/jbossesb/creditAgency/src/main/java/com/acme/services/creditAgency/CreditAgencyPurchase.java
cdl/trunk/samples/jbossesb/creditAgency/src/main/resources/META-INF/deployment.xml
cdl/trunk/samples/jbossesb/purchasing/pom.xml
cdl/trunk/samples/jbossesb/purchasing/src/main/java/com/acme/services/broker/PurchaseGoods.java
cdl/trunk/samples/jbossesb/purchasing/src/main/resources/META-INF/deployment.xml
Log:
[SOAG-29] Separating esb artifacts.
* CDL based artifacts are only depedent on runtime-jbossesb.jar.
* The packaging should not include any libraries, since in the deployment, it is already having cdl-jbossesb.esb.
* Remove the build.xml, as now it uses the JBossAS default DB, doesn't need to start another one.
Modified: cdl/trunk/samples/jbossesb/README.txt
===================================================================
--- cdl/trunk/samples/jbossesb/README.txt 2008-08-04 15:11:28 UTC (rev 214)
+++ cdl/trunk/samples/jbossesb/README.txt 2008-08-04 15:30:18 UTC (rev 215)
@@ -23,9 +23,12 @@
- Before jbossesb-rosetta.jar and jbossesb-config-model.jar get published in jboss maven repository, you need to install these two artifacts into
your local repository by using following commands:
-mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id>
- -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
+mvn install:install-file -Dfile=<path-to-rosetta> -DgroupId=org.jboss.jbossesb
+ -DartifactId=rosetta -Dversion=4.3 -Dpackaging=jar
+mvn install:install-file -Dfile=<path-to-configmodel> -DgroupId=org.jboss.jbossesb
+ -DartifactId=config-model -Dversion=1.0.1 -Dpackaging=jar
+
Notice: Here we are using jbossesb-rosetta 4.3 version, jbossesb-config-model 1.0.1 version.
Deleted: cdl/trunk/samples/jbossesb/creditAgency/build.xml
===================================================================
--- cdl/trunk/samples/jbossesb/creditAgency/build.xml 2008-08-04 15:11:28 UTC (rev 214)
+++ cdl/trunk/samples/jbossesb/creditAgency/build.xml 2008-08-04 15:30:18 UTC (rev 215)
@@ -1,38 +0,0 @@
-<project name="purchasing" default="startdb" basedir=".">
- <property name="M2_REPO" value="/opt/m2/repo" />
- <property name="database.dir" value="${basedir}/database" />
-
- <path id="database.classpath">
- <fileset dir="${M2_REPO}" >
- <include name="hsqldb/hsqldb/1.8.0.7/hsqldb-1.8.0.7.jar" />
- </fileset>
- </path>
-
- <!-- Start the HSQL DB server -->
- <target name="startdb" description="Run HSQL database server with clean DB">
- <!-- Delete database files -->
- <delete dir="${database.dir}"/>
- <java classname="org.hsqldb.Server"
- fork="yes"
- classpathref="database.classpath"
- failonerror="true">
- <arg value="-database.0"/>
- <arg value="file:${database.dir}/db"/>
- </java>
- </target>
-
- <!-- Start the HSQL DB browser tool -->
- <target name="dbmanager" description="Start HSQL DB manager">
- <java
- classname="org.hsqldb.util.DatabaseManagerSwing"
- fork="yes"
- classpathref="database.classpath"
- failonerror="true">
- <arg value="-url"/>
- <arg value="jdbc:hsqldb:hsql://localhost/"/>
- <arg value="-driver"/>
- <arg value="org.hsqldb.jdbcDriver"/>
- </java>
- </target>
-
-</project>
Modified: cdl/trunk/samples/jbossesb/creditAgency/pom.xml
===================================================================
--- cdl/trunk/samples/jbossesb/creditAgency/pom.xml 2008-08-04 15:11:28 UTC (rev 214)
+++ cdl/trunk/samples/jbossesb/creditAgency/pom.xml 2008-08-04 15:30:18 UTC (rev 215)
@@ -20,102 +20,20 @@
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.soa.overlord.cdl</groupId>
<artifactId>runtime-jbossesb</artifactId>
<version>1.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-commons-annotations</artifactId>
- <version>${hibernate-commons-annotations}</version>
- </dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-tools</artifactId>
- <version>${hibernate-tools-version}</version>
<scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>${hsqldb-version}</version>
</dependency>
-
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>5.0.5</version>
- </dependency>
</dependencies>
<build>
<finalName>creditAgency</finalName>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <!--export schemas to database -->
- <execution>
- <id>schemaexport</id>
- <phase>compile</phase>
- <configuration>
- <tasks>
- <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"
- classpathref="maven.compile.classpath"/>
- <hibernatetool destdir=".">
- <classpath>
- <pathelement path="maven.compile.classpath" />
- </classpath>
- <annotationconfiguration configurationfile="target/classes/hibernate.cfg.xml" />
- <hbm2ddl
- create="true"
- drop="true"
- export="true"
- outputfilename="purchasing-ddl.sql"
- delimiter=";"
- format="true"/>
- </hibernatetool>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
-
- <!--Deploy esb artifact to JBoss AS/ESB -->
- <execution>
- <id>deploy</id>
- <phase>install</phase>
- <configuration>
- <tasks>
- <copy file="target/creditAgency.esb" todir="${deploy.dir}" overwrite="true" />
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
-
- </executions>
- </plugin>
- </plugins>
</build>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-report-plugin</artifactId>
- </plugin>
- </plugins>
- </reporting>
-
</project>
Modified: cdl/trunk/samples/jbossesb/creditAgency/src/main/java/com/acme/services/creditAgency/CreditAgencyPurchase.java
===================================================================
--- cdl/trunk/samples/jbossesb/creditAgency/src/main/java/com/acme/services/creditAgency/CreditAgencyPurchase.java 2008-08-04 15:11:28 UTC (rev 214)
+++ cdl/trunk/samples/jbossesb/creditAgency/src/main/java/com/acme/services/creditAgency/CreditAgencyPurchase.java 2008-08-04 15:30:18 UTC (rev 215)
@@ -19,19 +19,16 @@
*/
package com.acme.services.creditAgency;
+import java.io.Serializable;
+
import javax.persistence.Column;
-import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import javax.persistence.Table;
-import org.jboss.soa.overlord.conversation.HibernateObject;
import org.jboss.soa.overlord.jbossesb.actions.Service;
@Service(name="{http://www.jboss.org/overlord/purchase}CreditAgency", conversationType="overlord.cdl.samples.purchasing@CreditAgency",root=true)
-@Entity
-@Table(name="T_CA_PURCHASE")
-public class CreditAgencyPurchase implements HibernateObject {
+public class CreditAgencyPurchase implements Serializable {
@Id @GeneratedValue
@Column(name="ID")
Modified: cdl/trunk/samples/jbossesb/creditAgency/src/main/resources/META-INF/deployment.xml
===================================================================
--- cdl/trunk/samples/jbossesb/creditAgency/src/main/resources/META-INF/deployment.xml 2008-08-04 15:11:28 UTC (rev 214)
+++ cdl/trunk/samples/jbossesb/creditAgency/src/main/resources/META-INF/deployment.xml 2008-08-04 15:30:18 UTC (rev 215)
@@ -1,11 +1,6 @@
<jbossesb-deployment>
+ <depends>jboss.esb:deployment=cdl-jbossesb.esb</depends>
<depends>jboss.esb.gen.destination:service=Queue,name=esb-creditAgency</depends>
<depends>jboss.esb.gen.destination:service=Queue,name=esb-creditAgency1</depends>
<depends>jboss.esb.gen.destination:service=Queue,name=esb-creditAgency2</depends>
- <loader-repository>
- org.jboss.soa.overlord.creditAgency:loader=creditAgency
- <loader-repository-config>
- java2ParentDelegaton=false
- </loader-repository-config>
- </loader-repository>
</jbossesb-deployment>
Deleted: cdl/trunk/samples/jbossesb/creditAgency/src/main/resources/hibernate.cfg.xml
===================================================================
--- cdl/trunk/samples/jbossesb/creditAgency/src/main/resources/hibernate.cfg.xml 2008-08-04 15:11:28 UTC (rev 214)
+++ cdl/trunk/samples/jbossesb/creditAgency/src/main/resources/hibernate.cfg.xml 2008-08-04 15:30:18 UTC (rev 215)
@@ -1,79 +0,0 @@
-<!DOCTYPE hibernate-configuration SYSTEM
-"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
-<!--
- JBoss, Home of Professional Open Source
- Copyright 2008, JBoss Inc., and others contributors as indicated
- by the @authors tag. All rights reserved.
- See the copyright.txt in the distribution for a
- full listing of individual contributors.
- This copyrighted material is made available to anyone wishing to use,
- modify, copy, or redistribute it subject to the terms and conditions
- of the GNU Lesser General Public License, v. 2.1.
- This program is distributed in the hope that it will be useful, but WITHOUT A
- 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,
- v.2.1 along with this distribution; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02110-1301, USA.
-
- (C) 2008,
- @author JBoss Inc.
--->
-<hibernate-configuration>
- <session-factory>
- <!--property name="hibernate.connection.driver_class">
- org.gjt.mm.mysql.Driver
- </property>
- <property name="hibernate.connection.url">
- jdbc:mysql://localhost:3306/cdl
- </property>
- <property name="hibernate.connection.username">
- root
- </property>
- <property name="hibernate.connection.password">
- jeff
- </property>
- <property name="hibernate.dialect">
- org.hibernate.dialect.MySQL5Dialect
- </property-->
-
- <property name="hibernate.connection.driver_class">
- org.hsqldb.jdbcDriver
- </property>
- <property name="hibernate.connection.url">
- jdbc:hsqldb:hsql://localhost
- </property>
- <property name="hibernate.connection.username">
- sa
- </property>
- <property name="hibernate.dialect">
- org.hibernate.dialect.HSQLDialect
- </property>
-
- <!-- Use the C3P0 connection pool provider -->
- <property name="hibernate.c3p0.min_size">5</property>
- <property name="hibernate.c3p0.max_size">20</property>
- <property name="hibernate.c3p0.timeout">300</property>
- <property name="hibernate.c3p0.max_statements">50</property>
- <property name="hibernate.c3p0.idle_test_period">3000</property>
-
- <property name="current_session_context_class">thread</property>
- <property name="hibernate.connection.isolation">4</property>
-
- <!-- Show and print nice SQL on stdout -->
- <property name="show_sql">false</property>
- <property name="format_sql">true</property>
-
- <!-- List of annotationed classes (Internal conversation class)-->
- <mapping class="org.jboss.soa.overlord.conversation.Session" />
- <mapping class="org.jboss.soa.overlord.conversation.ScheduleItem"/>
- <mapping class="org.jboss.soa.overlord.conversation.JoinState"/>
- <mapping class="org.jboss.soa.overlord.conversation.Identity"/>
- <mapping class="org.jboss.soa.overlord.conversation.EPRWrapper"/>
-
- <!-- List of Business State class -->
- <mapping class="com.acme.services.creditAgency.CreditAgencyPurchase" />
-
- </session-factory>
-</hibernate-configuration>
Deleted: cdl/trunk/samples/jbossesb/purchasing/build.xml
===================================================================
--- cdl/trunk/samples/jbossesb/purchasing/build.xml 2008-08-04 15:11:28 UTC (rev 214)
+++ cdl/trunk/samples/jbossesb/purchasing/build.xml 2008-08-04 15:30:18 UTC (rev 215)
@@ -1,38 +0,0 @@
-<project name="purchasing" default="startdb" basedir=".">
- <property name="M2_REPO" value="/opt/m2/repo" />
- <property name="database.dir" value="${basedir}/database" />
-
- <path id="database.classpath">
- <fileset dir="${M2_REPO}" >
- <include name="hsqldb/hsqldb/1.8.0.7/hsqldb-1.8.0.7.jar" />
- </fileset>
- </path>
-
- <!-- Start the HSQL DB server -->
- <target name="startdb" description="Run HSQL database server with clean DB">
- <!-- Delete database files -->
- <delete dir="${database.dir}"/>
- <java classname="org.hsqldb.Server"
- fork="yes"
- classpathref="database.classpath"
- failonerror="true">
- <arg value="-database.0"/>
- <arg value="file:${database.dir}/db"/>
- </java>
- </target>
-
- <!-- Start the HSQL DB browser tool -->
- <target name="dbmanager" description="Start HSQL DB manager">
- <java
- classname="org.hsqldb.util.DatabaseManagerSwing"
- fork="yes"
- classpathref="database.classpath"
- failonerror="true">
- <arg value="-url"/>
- <arg value="jdbc:hsqldb:hsql://localhost/"/>
- <arg value="-driver"/>
- <arg value="org.hsqldb.jdbcDriver"/>
- </java>
- </target>
-
-</project>
Modified: cdl/trunk/samples/jbossesb/purchasing/pom.xml
===================================================================
--- cdl/trunk/samples/jbossesb/purchasing/pom.xml 2008-08-04 15:11:28 UTC (rev 214)
+++ cdl/trunk/samples/jbossesb/purchasing/pom.xml 2008-08-04 15:30:18 UTC (rev 215)
@@ -7,7 +7,7 @@
<version>1.0-SNAPSHOT</version>
<packaging>jboss-esb</packaging>
<name>Overlord::CDL::Samples::Purchasing</name>
- <url>http://www.jboss.org/overlord</url>
+ <url>http://www.jboss.org/soag</url>
<parent>
<groupId>org.jboss.soa.overlord.cdl</groupId>
@@ -20,102 +20,19 @@
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.soa.overlord.cdl</groupId>
<artifactId>runtime-jbossesb</artifactId>
<version>1.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-commons-annotations</artifactId>
- <version>${hibernate-commons-annotations}</version>
- </dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-tools</artifactId>
- <version>${hibernate-tools-version}</version>
<scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>${hsqldb-version}</version>
</dependency>
-
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>5.0.5</version>
- </dependency>
-
</dependencies>
<build>
<finalName>purchasing</finalName>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <!--export schemas to database -->
- <execution>
- <id>schemaexport</id>
- <phase>compile</phase>
- <configuration>
- <tasks>
- <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"
- classpathref="maven.compile.classpath"/>
- <hibernatetool destdir=".">
- <classpath>
- <pathelement path="maven.compile.classpath" />
- </classpath>
- <annotationconfiguration configurationfile="target/classes/hibernate.cfg.xml" />
- <hbm2ddl
- create="true"
- drop="true"
- export="true"
- outputfilename="purchasing-ddl.sql"
- delimiter=";"
- format="true"/>
- </hibernatetool>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
-
- <!--Deploy esb artifact to JBoss AS/ESB -->
- <execution>
- <id>deploy</id>
- <phase>install</phase>
- <configuration>
- <tasks>
- <copy file="target/purchasing.esb" todir="${deploy.dir}" overwrite="true" />
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
-
- </executions>
- </plugin>
- </plugins>
</build>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-report-plugin</artifactId>
- </plugin>
- </plugins>
- </reporting>
-
</project>
Modified: cdl/trunk/samples/jbossesb/purchasing/src/main/java/com/acme/services/broker/PurchaseGoods.java
===================================================================
--- cdl/trunk/samples/jbossesb/purchasing/src/main/java/com/acme/services/broker/PurchaseGoods.java 2008-08-04 15:11:28 UTC (rev 214)
+++ cdl/trunk/samples/jbossesb/purchasing/src/main/java/com/acme/services/broker/PurchaseGoods.java 2008-08-04 15:30:18 UTC (rev 215)
@@ -19,19 +19,16 @@
*/
package com.acme.services.broker;
+import java.io.Serializable;
+
import javax.persistence.Column;
-import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
-import javax.persistence.Table;
-import org.jboss.soa.overlord.conversation.HibernateObject;
import org.jboss.soa.overlord.jbossesb.actions.Service;
@Service(name="{http://www.jboss.org/overlord/purchase}Broker", conversationType="overlord.cdl.samples.purchasing@Broker", root=true)
-@Entity
-@Table(name = "T_PURCHASE_GOOD")
-public class PurchaseGoods implements HibernateObject{
+public class PurchaseGoods implements Serializable{
@Id @GeneratedValue
@Column(name="PG_ID")
Modified: cdl/trunk/samples/jbossesb/purchasing/src/main/resources/META-INF/deployment.xml
===================================================================
--- cdl/trunk/samples/jbossesb/purchasing/src/main/resources/META-INF/deployment.xml 2008-08-04 15:11:28 UTC (rev 214)
+++ cdl/trunk/samples/jbossesb/purchasing/src/main/resources/META-INF/deployment.xml 2008-08-04 15:30:18 UTC (rev 215)
@@ -1,4 +1,5 @@
<jbossesb-deployment>
+ <depends>jboss.esb:deployment=cdl-jbossesb.esb</depends>
<depends>jboss.esb.gen.destination:service=Queue,name=esb-broker</depends>
<depends>jboss.esb.gen.destination:service=Queue,name=esb-broker_reply</depends>
<depends>jboss.esb.gen.destination:service=Queue,name=esb-broker1</depends>
@@ -8,10 +9,4 @@
<depends>jboss.esb.gen.destination:service=Queue,name=esb-broker5</depends>
<depends>jboss.esb.gen.destination:service=Queue,name=esb-broker6</depends>
<depends>jboss.esb.gen.destination:service=Queue,name=esb-broker7</depends>
- <loader-repository>
- org.jboss.soa.overlord.purchasing:loader=purchasing
- <loader-repository-config>
- java2ParentDelegaton=true
- </loader-repository-config>
- </loader-repository>
</jbossesb-deployment>
Deleted: cdl/trunk/samples/jbossesb/purchasing/src/main/resources/hibernate.cfg.xml
===================================================================
--- cdl/trunk/samples/jbossesb/purchasing/src/main/resources/hibernate.cfg.xml 2008-08-04 15:11:28 UTC (rev 214)
+++ cdl/trunk/samples/jbossesb/purchasing/src/main/resources/hibernate.cfg.xml 2008-08-04 15:30:18 UTC (rev 215)
@@ -1,79 +0,0 @@
-<!DOCTYPE hibernate-configuration SYSTEM
-"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
-<!--
- JBoss, Home of Professional Open Source
- Copyright 2008, JBoss Inc., and others contributors as indicated
- by the @authors tag. All rights reserved.
- See the copyright.txt in the distribution for a
- full listing of individual contributors.
- This copyrighted material is made available to anyone wishing to use,
- modify, copy, or redistribute it subject to the terms and conditions
- of the GNU Lesser General Public License, v. 2.1.
- This program is distributed in the hope that it will be useful, but WITHOUT A
- 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,
- v.2.1 along with this distribution; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02110-1301, USA.
-
- (C) 2008,
- @author JBoss Inc.
--->
-<hibernate-configuration>
- <session-factory>
- <!--property name="hibernate.connection.driver_class">
- org.gjt.mm.mysql.Driver
- </property>
- <property name="hibernate.connection.url">
- jdbc:mysql://localhost:3306/cdl
- </property>
- <property name="hibernate.connection.username">
- root
- </property>
- <property name="hibernate.connection.password">
- jeff
- </property>
- <property name="hibernate.dialect">
- org.hibernate.dialect.MySQL5Dialect
- </property-->
-
- <property name="hibernate.connection.driver_class">
- org.hsqldb.jdbcDriver
- </property>
- <property name="hibernate.connection.url">
- jdbc:hsqldb:hsql://localhost
- </property>
- <property name="hibernate.connection.username">
- sa
- </property>
- <property name="hibernate.dialect">
- org.hibernate.dialect.HSQLDialect
- </property>
-
- <!-- Use the C3P0 connection pool provider -->
- <property name="hibernate.c3p0.min_size">5</property>
- <property name="hibernate.c3p0.max_size">20</property>
- <property name="hibernate.c3p0.timeout">300</property>
- <property name="hibernate.c3p0.max_statements">50</property>
- <property name="hibernate.c3p0.idle_test_period">3000</property>
-
- <property name="current_session_context_class">thread</property>
- <property name="hibernate.connection.isolation">4</property>
-
- <!-- Show and print nice SQL on stdout -->
- <property name="show_sql">false</property>
- <property name="format_sql">true</property>
-
- <!-- List of annotationed classes (Internal conversation class)-->
- <mapping class="org.jboss.soa.overlord.conversation.Session" />
- <mapping class="org.jboss.soa.overlord.conversation.ScheduleItem"/>
- <mapping class="org.jboss.soa.overlord.conversation.JoinState"/>
- <mapping class="org.jboss.soa.overlord.conversation.Identity"/>
- <mapping class="org.jboss.soa.overlord.conversation.EPRWrapper"/>
-
- <!-- List of Business State class -->
- <mapping class="com.acme.services.broker.PurchaseGoods" />
-
- </session-factory>
-</hibernate-configuration>
15 years, 9 months
Overlord SVN: r214 - in cdl/trunk/distribution: assembly and 6 other directories.
by overlord-commits@lists.jboss.org
Author: jeff.yuchang
Date: 2008-08-04 11:11:28 -0400 (Mon, 04 Aug 2008)
New Revision: 214
Added:
cdl/trunk/distribution/assembly/
cdl/trunk/distribution/assembly/jbossesb/
cdl/trunk/distribution/assembly/jbossesb/pom.xml
cdl/trunk/distribution/assembly/jbossesb/src/
cdl/trunk/distribution/assembly/jbossesb/src/main/
cdl/trunk/distribution/assembly/jbossesb/src/main/java/
cdl/trunk/distribution/assembly/jbossesb/src/main/resources/
cdl/trunk/distribution/assembly/jbossesb/src/main/resources/META-INF/
cdl/trunk/distribution/assembly/jbossesb/src/main/resources/META-INF/deployment.xml
cdl/trunk/distribution/assembly/jbossesb/src/main/resources/META-INF/jboss-esb.xml
cdl/trunk/distribution/assembly/jbossesb/src/main/resources/cdl-ds.xml
cdl/trunk/distribution/assembly/jbossesb/src/main/resources/cdl-service.xml
cdl/trunk/distribution/assembly/jbossesb/src/main/resources/cdl-sql/
cdl/trunk/distribution/assembly/jbossesb/src/main/resources/cdl-sql/cdl.hsqldb.sql
cdl/trunk/distribution/assembly/jbossesb/src/main/resources/hibernate.cfg.xml
cdl/trunk/distribution/assembly/pom.xml
Log:
[SOAG-28] * Using JBossAS default database.
* This builds a esb artifact that wraps the conversation actions.
Added: cdl/trunk/distribution/assembly/jbossesb/pom.xml
===================================================================
--- cdl/trunk/distribution/assembly/jbossesb/pom.xml (rev 0)
+++ cdl/trunk/distribution/assembly/jbossesb/pom.xml 2008-08-04 15:11:28 UTC (rev 214)
@@ -0,0 +1,93 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.soa.overlord.cdl.assembly</groupId>
+ <artifactId>jbossesb</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jboss-esb</packaging>
+ <name>Overlord::CDL::Assembly::JBossESB</name>
+ <url>http://www.jboss.org/soag</url>
+
+ <parent>
+ <groupId>org.jboss.soa.overlord.cdl</groupId>
+ <artifactId>assembly</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <properties>
+ <hibernate-commons-annotations>3.0.0.ga</hibernate-commons-annotations>
+ <hibernate-tools-version>3.2.0.ga</hibernate-tools-version>
+ <hsqldb-version>1.8.0.7</hsqldb-version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.soa.overlord.cdl</groupId>
+ <artifactId>runtime-jbossesb</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-commons-annotations</artifactId>
+ <version>${hibernate-commons-annotations}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-tools</artifactId>
+ <version>${hibernate-tools-version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>${hsqldb-version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>cdl-jbossesb</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <!--export schemas to database -->
+ <!--execution>
+ <id>schemaexport</id>
+ <phase>compile</phase>
+ <configuration>
+ <tasks>
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"
+ classpathref="maven.compile.classpath"/>
+ <hibernatetool destdir=".">
+ <classpath>
+ <pathelement path="maven.compile.classpath" />
+ </classpath>
+ <annotationconfiguration configurationfile="target/classes/hibernate.cfg.xml" />
+ <hbm2ddl
+ create="true"
+ drop="false"
+ export="true"
+ outputfilename="cdl.hsqldb.sql"
+ delimiter=";"
+ format="true"/>
+ </hibernatetool>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution-->
+
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
+
Added: cdl/trunk/distribution/assembly/jbossesb/src/main/resources/META-INF/deployment.xml
===================================================================
--- cdl/trunk/distribution/assembly/jbossesb/src/main/resources/META-INF/deployment.xml (rev 0)
+++ cdl/trunk/distribution/assembly/jbossesb/src/main/resources/META-INF/deployment.xml 2008-08-04 15:11:28 UTC (rev 214)
@@ -0,0 +1,5 @@
+<jbossesb-deployment>
+ <depends>jboss.esb:deployment=jbossesb.esb</depends>
+ <depends>jboss.jca:service=DataSourceBinding,name=cdlDS</depends>
+ <depends>jboss.esb:service=CDLDatabaseInitializer</depends>
+</jbossesb-deployment>
Added: cdl/trunk/distribution/assembly/jbossesb/src/main/resources/META-INF/jboss-esb.xml
===================================================================
--- cdl/trunk/distribution/assembly/jbossesb/src/main/resources/META-INF/jboss-esb.xml (rev 0)
+++ cdl/trunk/distribution/assembly/jbossesb/src/main/resources/META-INF/jboss-esb.xml 2008-08-04 15:11:28 UTC (rev 214)
@@ -0,0 +1,24 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright 2008, JBoss Inc., and others contributors as indicated
+ by the @authors tag. All rights reserved.
+ See the copyright.txt in the distribution for a
+ full listing of individual contributors.
+ This copyrighted material is made available to anyone wishing to use,
+ modify, copy, or redistribute it subject to the terms and conditions
+ of the GNU Lesser General Public License, v. 2.1.
+ This program is distributed in the hope that it will be useful, but WITHOUT A
+ 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,
+ v.2.1 along with this distribution; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ (C) 2008,
+-->
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml..."
+ parameterReloadSecs="500">
+
+</jbossesb>
Added: cdl/trunk/distribution/assembly/jbossesb/src/main/resources/cdl-ds.xml
===================================================================
--- cdl/trunk/distribution/assembly/jbossesb/src/main/resources/cdl-ds.xml (rev 0)
+++ cdl/trunk/distribution/assembly/jbossesb/src/main/resources/cdl-ds.xml 2008-08-04 15:11:28 UTC (rev 214)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<datasources>
+<!--
+ <xa-datasource>
+ <jndi-name>JbpmDS</jndi-name>
+ <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
+ <track-connection-by-tx/>
+ <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
+ <xa-datasource-property name="URL">jdbc:h2:${jboss.server.data.dir}${/}h2${/}jbpmDB;MVCC=TRUE</xa-datasource-property>
+ <xa-datasource-property name="User">sa</xa-datasource-property>
+ <xa-datasource-property name="Password"></xa-datasource-property>
+ <min-pool-size>5</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <idle-timeout-minutes>0</idle-timeout-minutes>
+ <prepared-statement-cache-size>32</prepared-statement-cache-size>
+ <depends>jboss:service=h2,database=jbpmDB</depends>
+ </xa-datasource>
+-->
+ <local-tx-datasource>
+ <jndi-name>cdlDS</jndi-name>
+ <connection-url>jdbc:h2:${jboss.server.data.dir}${/}h2${/}cdlDB;MVCC=TRUE</connection-url>
+ <driver-class>org.h2.Driver</driver-class>
+ <user-name>sa</user-name>
+ <password/>
+ <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
+ <min-pool-size>5</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ <idle-timeout-minutes>0</idle-timeout-minutes>
+ <prepared-statement-cache-size>32</prepared-statement-cache-size>
+ <depends>jboss:service=h2,database=cdlDB</depends>
+ </local-tx-datasource>
+ <mbean code="org.jboss.internal.soa.esb.dependencies.H2Database"
+ name="jboss:service=h2,database=cdlDB">
+ <attribute name="Database">cdlDB</attribute>
+ </mbean>
+</datasources>
Added: cdl/trunk/distribution/assembly/jbossesb/src/main/resources/cdl-service.xml
===================================================================
--- cdl/trunk/distribution/assembly/jbossesb/src/main/resources/cdl-service.xml (rev 0)
+++ cdl/trunk/distribution/assembly/jbossesb/src/main/resources/cdl-service.xml 2008-08-04 15:11:28 UTC (rev 214)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+ <classpath codebase="deploy" archives="cdl-jbossesb.esb"/>
+ <classpath codebase="deploy/jbossesb.sar/lib" archives="jbossesb-rosetta.jar"/>
+ <mbean code="org.jboss.internal.soa.esb.dependencies.DatabaseInitializer"
+ name="jboss.esb:service=CDLDatabaseInitializer">
+ <attribute name="Datasource">java:/cdlDS</attribute>
+ <attribute name="ExistsSql">select * from CDL_SESSION</attribute>
+ <attribute name="SqlFiles">
+ cdl-sql/cdl.hsqldb.sql
+ </attribute>
+ <depends>jboss.jca:service=DataSourceBinding,name=cdlDS</depends>
+ <attribute name="UseEOL">true</attribute>
+ </mbean>
+
+</server>
Added: cdl/trunk/distribution/assembly/jbossesb/src/main/resources/cdl-sql/cdl.hsqldb.sql
===================================================================
--- cdl/trunk/distribution/assembly/jbossesb/src/main/resources/cdl-sql/cdl.hsqldb.sql (rev 0)
+++ cdl/trunk/distribution/assembly/jbossesb/src/main/resources/cdl-sql/cdl.hsqldb.sql 2008-08-04 15:11:28 UTC (rev 214)
@@ -0,0 +1,19 @@
+ create table CDL_EPRS (ID bigint generated by default as identity (start with 1),name varchar(255),EPR longvarchar,SESSION_ID bigint,primary key (ID));
+
+ create table CDL_IDENTITY (ID bigint generated by default as identity (start with 1),TYPE varchar(255),PROPERTY_VALUE varchar(255),SERVICE_NAME varchar(255),SESSION_ID bigint not null,primary key (ID));
+
+ create table CDL_JOIN_STATES (ID bigint generated by default as identity (start with 1),CATEGORY varchar(255) not null,NAME varchar(255) not null,ITEM_COUNT integer,SESSION_ID bigint,primary key (ID));
+
+ create table CDL_SCHEDULE_ITEM (ID bigint generated by default as identity (start with 1),CATEGORY varchar(255) not null,NAME varchar(255) not null,SESSION_ID bigint,primary key (ID));
+
+ create table CDL_SESSION (SESSION_ID bigint generated by default as identity (start with 1),STATUS varchar(255),POJO_CLASS varchar(255),SERVICE_NAME varchar(255),CONVERSATION_TYPE varchar(255),Business_OBJECT longvarbinary,PARENT_ID bigint,primary key (SESSION_ID));
+
+ alter table CDL_EPRS add constraint FKC42217E088C85D6A foreign key (SESSION_ID)references CDL_SESSION;
+
+ alter table CDL_IDENTITY add constraint FK41FEEA7288C85D6A foreign key (SESSION_ID) references CDL_SESSION;
+
+ alter table CDL_JOIN_STATES add constraint FKBBDE508388C85D6A foreign key (SESSION_ID) references CDL_SESSION;
+
+ alter table CDL_SCHEDULE_ITEM add constraint FKA523168788C85D6A foreign key (SESSION_ID) references CDL_SESSION;
+
+ alter table CDL_SESSION add constraint FKD597E42A1212ED6 foreign key (PARENT_ID) references CDL_SESSION;
Added: cdl/trunk/distribution/assembly/jbossesb/src/main/resources/hibernate.cfg.xml
===================================================================
--- cdl/trunk/distribution/assembly/jbossesb/src/main/resources/hibernate.cfg.xml (rev 0)
+++ cdl/trunk/distribution/assembly/jbossesb/src/main/resources/hibernate.cfg.xml 2008-08-04 15:11:28 UTC (rev 214)
@@ -0,0 +1,64 @@
+<!DOCTYPE hibernate-configuration SYSTEM
+"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright 2008, JBoss Inc., and others contributors as indicated
+ by the @authors tag. All rights reserved.
+ See the copyright.txt in the distribution for a
+ full listing of individual contributors.
+ This copyrighted material is made available to anyone wishing to use,
+ modify, copy, or redistribute it subject to the terms and conditions
+ of the GNU Lesser General Public License, v. 2.1.
+ This program is distributed in the hope that it will be useful, but WITHOUT A
+ 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,
+ v.2.1 along with this distribution; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ (C) 2008,
+ @author JBoss Inc.
+-->
+<hibernate-configuration>
+ <session-factory>
+ <!--property name="hibernate.connection.driver_class">
+ org.hsqldb.jdbcDriver
+ </property>
+ <property name="hibernate.connection.url">
+ jdbc:hsqldb:hsql://localhost
+ </property>
+ <property name="hibernate.connection.username">
+ sa
+ </property-->
+
+ <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+
+ <!-- DataSource properties (begin) === -->
+ <property name="hibernate.connection.datasource">java:/cdlDS</property>
+ <!-- ==== DataSource properties (end) -->
+
+
+ <!-- Use the C3P0 connection pool provider -->
+ <property name="hibernate.c3p0.min_size">5</property>
+ <property name="hibernate.c3p0.max_size">20</property>
+ <property name="hibernate.c3p0.timeout">300</property>
+ <property name="hibernate.c3p0.max_statements">50</property>
+ <property name="hibernate.c3p0.idle_test_period">3000</property>
+
+ <property name="current_session_context_class">thread</property>
+ <property name="hibernate.connection.isolation">4</property>
+
+ <!-- Show and print nice SQL on stdout -->
+ <property name="show_sql">false</property>
+ <property name="format_sql">true</property>
+
+ <!-- List of annotationed classes (Internal conversation class)-->
+ <mapping class="org.jboss.soa.overlord.conversation.Session" />
+ <mapping class="org.jboss.soa.overlord.conversation.ScheduleItem"/>
+ <mapping class="org.jboss.soa.overlord.conversation.JoinState"/>
+ <mapping class="org.jboss.soa.overlord.conversation.Identity"/>
+ <mapping class="org.jboss.soa.overlord.conversation.EPRWrapper"/>
+
+ </session-factory>
+</hibernate-configuration>
Added: cdl/trunk/distribution/assembly/pom.xml
===================================================================
--- cdl/trunk/distribution/assembly/pom.xml (rev 0)
+++ cdl/trunk/distribution/assembly/pom.xml 2008-08-04 15:11:28 UTC (rev 214)
@@ -0,0 +1,47 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.soa.overlord.cdl</groupId>
+ <artifactId>assembly</artifactId>
+ <packaging>pom</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>Overlord::CDL::Assembly</name>
+ <url>http://www.jboss.org/soag</url>
+
+ <parent>
+ <groupId>org.jboss.soa.overlord</groupId>
+ <artifactId>cdl</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <modules>
+ <module>jbossesb</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-packaging-maven-plugin</artifactId>
+ <version>2.0-20080130.110241-9</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots/>
+ <id>jboss-plugin-snapshots</id>
+ <name>JBoss Snapshot Plugin Repository</name>
+ <url>http://snapshots.repository.codehaus.org</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+
+</project>
+
15 years, 9 months
Overlord SVN: r213 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb: src/java/org/jboss/tools/overlord/jbossesb/dialogs and 2 other directories.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2008-08-01 11:14:49 -0400 (Fri, 01 Aug 2008)
New Revision: 213
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/util/ConversationUtil.java
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/META-INF/MANIFEST.MF
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/GenerateDialog.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/change/ConversationInteractionModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/change/ConversationModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/change/IfModelChangeRule.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/util/InteractionUtil.java
Log:
Generation dialog now creates the Java project, stores the jboss-esb.xml and creates the business object type class.
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/META-INF/MANIFEST.MF
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/META-INF/MANIFEST.MF 2008-08-01 11:06:31 UTC (rev 212)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/META-INF/MANIFEST.MF 2008-08-01 15:14:49 UTC (rev 213)
@@ -13,7 +13,8 @@
org.scribble.osgi,
org.scribble.conversation.model,
org.scribble.lang.model,
- org.scribble.core
+ org.scribble.core,
+ org.eclipse.jface.text
Scribble-Extensions: org.jboss.tools.overlord.jbossesb.parser.JBossESBParser,
org.jboss.tools.overlord.jbossesb.parser.JBossESBNotation,
org.jboss.tools.overlord.jbossesb.validation.ESBLanguageModelValidationRule,
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/GenerateDialog.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/GenerateDialog.java 2008-08-01 11:06:31 UTC (rev 212)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/GenerateDialog.java 2008-08-01 15:14:49 UTC (rev 213)
@@ -20,6 +20,11 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -29,15 +34,17 @@
import org.eclipse.swt.widgets.*;
import org.jboss.tools.overlord.jbossesb.model.DefaultESBLanguageModel;
import org.jboss.tools.overlord.jbossesb.model.ESBLanguageModel;
+import org.jboss.tools.overlord.jbossesb.model.util.ConversationUtil;
+import org.jboss.tools.overlord.jbossesb.model.util.InteractionUtil;
import org.scribble.conversation.model.ConversationModel;
import org.scribble.extensions.RegistryFactory;
-import org.scribble.model.DefaultModelListener;
-import org.scribble.model.Model;
-import org.scribble.model.ModelReference;
-import org.scribble.model.ModelRepository;
-import org.scribble.model.Role;
+import org.scribble.model.*;
import org.scribble.model.change.ModelGenerator;
+import org.scribble.conversation.model.*;
+import org.w3c.dom.Node;
import org.eclipse.jdt.core.*;
+import org.eclipse.jdt.core.dom.*;
+import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
@@ -47,11 +54,11 @@
*/
public class GenerateDialog extends org.eclipse.jface.dialogs.Dialog {
+ private static final String ESB_CONFIG_PATH = "src/conf/jboss-esb.xml";
private static final String JAVA_SOURCE_LOCATION = "src/java";
-
private static final String CLASSPATH_FILENAME = ".classpath";
-
private static final String OUTPUT_LOCATION = "classes";
+
/**
* This is the constructor for the generate dialog.
*
@@ -370,6 +377,180 @@
org.w3c.dom.Element esbConfig, ConversationModel localcm)
throws Exception {
+ IJavaProject jproj=createJavaProject(projectName);
+
+ if (jproj != null && esbConfig != null) {
+ // Store ESB configuration
+ IPath esbConfigPath=jproj.getPath().append(new Path(ESB_CONFIG_PATH));
+
+ IFile esbConfigFile=jproj.getProject().getWorkspace().getRoot().getFile(esbConfigPath);
+ createParentFolder(esbConfigFile);
+ esbConfigFile.create(null, true,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+
+ String config=getText(esbConfig);
+
+ if (config != null) {
+ esbConfigFile.setContents(new java.io.ByteArrayInputStream(
+ config.getBytes()), true, false,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+ }
+
+ // Generate business object types for
+ // local conversation model
+ generateBusinessObjectType(jproj, localcm.getConversation());
+ }
+ }
+
+ protected void generateBusinessObjectType(IJavaProject jproj,
+ Conversation conversation) throws Exception {
+
+ IPath sourceLocation=jproj.getPath().append(new Path(JAVA_SOURCE_LOCATION));
+
+ String javaClass=ConversationUtil.getBusinessObjectType(conversation);
+
+ String javaPath=javaClass.replace('.', '/')+".java";
+
+ IPath javaFile=sourceLocation.append(new Path(javaPath));
+
+ IFile file=jproj.getProject().getWorkspace().getRoot().getFile(javaFile);
+ createParentFolder(file);
+ file.create(null, true, new org.eclipse.core.runtime.NullProgressMonitor());
+
+ String text="package "+
+ ConversationUtil.getBusinessObjectTypePackageName(conversation)+";\r\n"+
+ "public class "+
+ ConversationUtil.getBusinessObjectTypeClassName(conversation)+" {\r\n}\r\n";
+
+ ASTParser parser = ASTParser.newParser(AST.JLS3);
+ parser.setResolveBindings(true);
+ parser.setSource(new char[0]);
+
+ CompilationUnit root=(CompilationUnit)parser.createAST(null);
+
+ AST ast=root.getAST();
+
+ org.eclipse.jface.text.IDocument doc=
+ new org.eclipse.jface.text.Document();
+
+ root.recordModifications();
+
+ PackageDeclaration pd=ast.newPackageDeclaration();
+ pd.setName(ast.newName(ConversationUtil.getBusinessObjectTypePackageName(conversation)));
+ root.setPackage(pd);
+
+ TypeDeclaration type=ast.newTypeDeclaration();
+
+ type.setName(ast.newSimpleName(ConversationUtil.getBusinessObjectTypeClassName(conversation)));
+
+ Modifier pubmod=ast.newModifier(ModifierKeyword.PUBLIC_KEYWORD);
+ type.modifiers().add(pubmod);
+
+ root.types().add(type);
+
+ // Process conversation to obtain necessary methods and
+ // properties
+ generateBusinessObjectTypeMethods(type, conversation);
+
+ org.eclipse.text.edits.TextEdit edits=root.rewrite(doc, null);
+
+ try {
+ edits.apply(doc);
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+
+ java.io.ByteArrayInputStream is=
+ new java.io.ByteArrayInputStream(doc.get().getBytes());
+
+ file.setContents(is, false, true, null);
+
+ is.close();
+ }
+
+ protected void generateBusinessObjectTypeMethods(TypeDeclaration type,
+ final Conversation conversation) throws Exception {
+ final java.util.List<Role> roles=new java.util.Vector<Role>();
+
+ conversation.visit(new Visitor() {
+ public boolean visit(ModelObject obj) {
+ boolean ret=true;
+
+ if (obj instanceof Conversation &&
+ obj != conversation) {
+ ret = false;
+ } else if (obj instanceof Interaction) {
+ Interaction interaction=(Interaction)obj;
+
+ // If send and a response, then create
+ // 'to' role service category/name
+ // methods
+ if (InteractionUtil.isSend(interaction) &&
+ interaction.getReplyToLabel() == null &&
+ interaction.getToRole() != null &&
+ roles.contains(interaction.getToRole()) == false) {
+ roles.add(interaction.getToRole());
+ }
+ }
+
+ return(ret);
+ }
+ });
+
+ for (int i=0; i < roles.size(); i++) {
+ AST ast=type.getAST();
+
+ String methodName=
+ InteractionUtil.getRoleServiceCategoryAccessorMethod(roles.get(i).getName());
+
+ MethodDeclaration method=ast.newMethodDeclaration();
+ method.setName(ast.newSimpleName(methodName));
+ method.setReturnType2(ast.newSimpleType(
+ ast.newName("String")));
+
+ method.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
+
+ org.eclipse.jdt.core.dom.Block block=ast.newBlock();
+
+ LineComment comment=ast.newLineComment();
+
+ ReturnStatement retStatement=ast.newReturnStatement();
+
+ retStatement.setExpression(ast.newNullLiteral());
+
+ block.statements().add(retStatement);
+
+ method.setBody(block);
+
+ type.bodyDeclarations().add(method);
+
+ methodName=
+ InteractionUtil.getRoleServiceNameAccessorMethod(roles.get(i).getName());
+
+ method=ast.newMethodDeclaration();
+ method.setName(ast.newSimpleName(methodName));
+ method.setReturnType2(ast.newSimpleType(
+ ast.newName("String")));
+
+ method.modifiers().add(ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
+
+ block=ast.newBlock();
+
+ retStatement=ast.newReturnStatement();
+
+ retStatement.setExpression(ast.newNullLiteral());
+
+ block.statements().add(retStatement);
+
+ method.setBody(block);
+
+ type.bodyDeclarations().add(method);
+ }
+ }
+
+ protected IJavaProject createJavaProject(String projectName)
+ throws Exception {
+
// Create project
IProject project=m_file.getWorkspace().getRoot().getProject(projectName);
project.create(new org.eclipse.core.runtime.NullProgressMonitor());
@@ -379,12 +560,22 @@
project.open(new org.eclipse.core.runtime.NullProgressMonitor());
IProjectDescription description = jproj.getProject().getDescription();
+
+ // Update the project natures to include Java Nature
String[] prevNatures= description.getNatureIds();
String[] newNatures= new String[prevNatures.length + 1];
System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
newNatures[prevNatures.length]= JavaCore.NATURE_ID;
description.setNatureIds(newNatures);
+ // Setup project reference to CDM project
+ IProject[] prevProjects=description.getReferencedProjects();
+ IProject[] newProjects=new IProject[prevProjects.length+1];
+ System.arraycopy(prevProjects, 0, newProjects, 0, prevProjects.length);
+ newProjects[prevProjects.length] = m_file.getProject();
+ description.setReferencedProjects(newProjects);
+
+ // Set the description
jproj.getProject().setDescription(description,
new org.eclipse.core.runtime.NullProgressMonitor());
@@ -421,6 +612,8 @@
jproj.setRawClasspath(classpaths, outputLocation,
new org.eclipse.core.runtime.NullProgressMonitor());
+
+ return(jproj);
}
/**
@@ -448,6 +641,140 @@
}
/**
+ * This class converts a DOM representation node to
+ * text.
+ *
+ * @param node The DOM node
+ * @return The text
+ * @throws Exception Failed to convert
+ */
+ protected String getText(Node node) throws Exception {
+ String ret=null;
+
+ try {
+ // Transform the DOM represent to text
+ java.io.ByteArrayOutputStream xmlstr=
+ new java.io.ByteArrayOutputStream();
+
+ DOMSource source=new DOMSource();
+ source.setNode(node);
+
+ StreamResult result=new StreamResult(xmlstr);
+
+ Transformer trans=
+ TransformerFactory.newInstance().newTransformer();
+ trans.transform(source, result);
+
+ xmlstr.close();
+
+ ret = new String(xmlstr.toByteArray());
+
+ if ((node instanceof org.w3c.dom.Document) == false) {
+
+ // Strip off any <?xml> header
+ int index=ret.indexOf("<?xml");
+ if (index != -1) {
+ index = ret.indexOf("<", 1);
+
+ if (index != -1) {
+ ret = ret.substring(index);
+ } else {
+ index = ret.indexOf("?>");
+
+ if (index != -1) {
+ index += 2;
+
+ // Remove any trailing whitespaces
+ // after XML header
+ while (index < ret.length() &&
+ Character.isWhitespace(ret.charAt(index))) {
+ index++;
+ }
+
+ ret = ret.substring(index);
+ }
+ }
+ }
+ }
+
+ } catch(Exception e) {
+ throw new Exception("Failed to transform " +
+ "DOM representation into text", e);
+ }
+
+ int pos=0;
+ int prevpos=0;
+ StringBuffer buf=new StringBuffer();
+ int level=0;
+
+ while ((pos=ret.indexOf('<', prevpos)) != -1) {
+
+ if (prevpos < pos &&
+ ret.substring(prevpos, pos).trim().length() > 0 &&
+ ret.charAt(prevpos-1) != '?') {
+
+ if (ret.charAt(prevpos) == '\r' &&
+ ret.charAt(prevpos+1) == '\n') {
+ prevpos += 2;
+ }
+ for (int i=0; i < level; i++) {
+ buf.append(" ");
+ }
+
+ buf.append(ret.substring(prevpos, pos).trim());
+ buf.append("\r\n");
+ }
+
+ int endpos=ret.indexOf('>', pos);
+
+ if (endpos > 0) {
+ boolean noreturn=false;
+
+ if (pos > 0 && ret.charAt(pos+1) == '/') {
+ level--;
+ }
+
+ for (int i=0; i < level; i++) {
+ buf.append(" ");
+ }
+ buf.append(ret.substring(pos, endpos+1));
+
+ if (ret.charAt(endpos-1)== '?') {
+ //noreturn = true;
+
+ } else if (ret.charAt(endpos-1) == '/') {
+ // Ignore
+ } else if (pos > 0 && ret.charAt(pos+1) == '/') {
+ // Ignore
+
+ } else if (pos > 0 && ret.charAt(pos+1) == '!') {
+ // Ignore
+
+ } else {
+ level++;
+ }
+
+ if (noreturn == false) {
+ buf.append("\r\n");
+ }
+
+ pos = endpos+1;
+ }
+
+ prevpos = pos;
+ }
+
+ if (prevpos != -1 &&
+ ret.substring(prevpos).trim().length() > 0) {
+ buf.append(ret.substring(prevpos));
+ }
+
+ ret = buf.toString();
+
+ return(ret);
+ }
+
+ /**
* This method is used to report an error.
*
* @param mesg The error message
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/change/ConversationInteractionModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/change/ConversationInteractionModelChangeRule.java 2008-08-01 11:06:31 UTC (rev 212)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/change/ConversationInteractionModelChangeRule.java 2008-08-01 15:14:49 UTC (rev 213)
@@ -19,6 +19,7 @@
import org.jboss.tools.overlord.jbossesb.model.*;
import org.jboss.tools.overlord.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.jbossesb.model.util.ConversationUtil;
import org.jboss.tools.overlord.jbossesb.model.util.IdentityUtil;
import org.jboss.tools.overlord.jbossesb.model.util.InteractionUtil;
import org.scribble.model.*;
@@ -32,9 +33,6 @@
@RegistryInfo(extension=ModelChangeRule.class,notation=ESBLanguageModel.JBOSSESB_NOTATION)
public class ConversationInteractionModelChangeRule extends AbstractModelChangeRule {
- private static final String SERVICE_NAME_ACCESSOR_SUFFIX = "ServiceName";
- private static final String SERVICE_CATEGORY_ACCESSOR_SUFFIX = "ServiceCategory";
-
/**
* This method determines whether the rule is appropriate
* for the supplied type of model, parent (in the context) and
@@ -167,8 +165,9 @@
interaction.getToRole().getName().charAt(0))+
interaction.getToRole().getName().substring(1);
- action.setDestinationExpression(roleName+SERVICE_CATEGORY_ACCESSOR_SUFFIX,
- roleName+SERVICE_NAME_ACCESSOR_SUFFIX);
+ action.setDestinationExpression(
+ InteractionUtil.getRoleServiceCategoryProperty(roleName),
+ InteractionUtil.getRoleServiceNameProperty(roleName));
}
if (interaction.getEnclosingDefinition() instanceof Conversation &&
@@ -250,6 +249,12 @@
((ESBService)context.getParent()).addAction(action, -1);
+ if (((ESBService)context.getParent()).getFirstSessionBasedAction() == action &&
+ interaction.getEnclosingDefinition() instanceof Conversation) {
+ action.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)interaction.getEnclosingDefinition())));
+ }
+
// If not a response, then add to the gateway
if (interaction.getReplyToLabel() == null) {
ESBService gwService=esbModel.getGatewayService();
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/change/ConversationModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/change/ConversationModelChangeRule.java 2008-08-01 11:06:31 UTC (rev 212)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/change/ConversationModelChangeRule.java 2008-08-01 15:14:49 UTC (rev 213)
@@ -19,6 +19,7 @@
import org.jboss.tools.overlord.jbossesb.model.*;
import org.jboss.tools.overlord.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.jbossesb.model.util.ConversationUtil;
import org.scribble.model.*;
import org.scribble.model.change.*;
import org.scribble.conversation.model.*;
@@ -146,6 +147,7 @@
}
csa.setServiceDescriptionName(sdname);
+ csa.setBusinessObjectType(ConversationUtil.getBusinessObjectType(conv));
service.addAction(csa, -1);
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/change/IfModelChangeRule.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/change/IfModelChangeRule.java 2008-08-01 11:06:31 UTC (rev 212)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/change/IfModelChangeRule.java 2008-08-01 15:14:49 UTC (rev 213)
@@ -21,6 +21,7 @@
import org.jboss.tools.overlord.jbossesb.model.*;
import org.jboss.tools.overlord.jbossesb.model.actions.*;
+import org.jboss.tools.overlord.jbossesb.model.util.ConversationUtil;
import org.jboss.tools.overlord.jbossesb.model.util.InteractionUtil;
import org.scribble.model.*;
import org.scribble.model.change.*;
@@ -257,6 +258,12 @@
}
}
}
+
+ if (service.getFirstSessionBasedAction() == switchAction &&
+ ifElem.getEnclosingDefinition() instanceof Conversation) {
+ switchAction.setBusinessObjectType(ConversationUtil.getBusinessObjectType(
+ ((Conversation)ifElem.getEnclosingDefinition())));
+ }
}
return(true);
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/util/ConversationUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/util/ConversationUtil.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/util/ConversationUtil.java 2008-08-01 15:14:49 UTC (rev 213)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.jbossesb.model.util;
+
+import org.scribble.conversation.model.*;
+
+/**
+ * This class contains utility functions related to the
+ * Conversation.
+ */
+public class ConversationUtil {
+
+ /**
+ * This method returns the full class name associated with the
+ * business object type for the supplied conversation.
+ *
+ * @param conversation The conversation
+ * @return The business object type full class name
+ */
+ public static String getBusinessObjectType(Conversation conversation) {
+ String ret=getBusinessObjectTypePackageName(conversation);
+
+ ret += "."+getBusinessObjectTypeClassName(conversation);
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the package name associated with the
+ * business object type for the supplied conversation.
+ *
+ * @param conversation The conversation
+ * @return The business object type package name
+ */
+ public static String getBusinessObjectTypePackageName(Conversation conversation) {
+ String ret=null;
+
+ if (conversation.getModel() != null &&
+ conversation.getModel().getNamespace() != null) {
+ ret = conversation.getModel().getNamespace().getName()+".";
+ } else {
+ ret = "";
+ }
+
+ if (conversation.getModelName().getLocatedRole() != null) {
+ ret += conversation.getModelName().getLocatedRole();
+ }
+
+ ret = ret.toLowerCase();
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the class name associated with the
+ * business object type for the supplied conversation.
+ *
+ * @param conversation The conversation
+ * @return The business object type class name
+ */
+ public static String getBusinessObjectTypeClassName(Conversation conversation) {
+ String ret=conversation.getModelName().getName();
+
+ return(ret);
+ }
+}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/util/InteractionUtil.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/util/InteractionUtil.java 2008-08-01 11:06:31 UTC (rev 212)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/util/InteractionUtil.java 2008-08-01 15:14:49 UTC (rev 213)
@@ -24,6 +24,9 @@
*/
public class InteractionUtil {
+ private static final String SERVICE_NAME_ACCESSOR_SUFFIX = "ServiceName";
+ private static final String SERVICE_CATEGORY_ACCESSOR_SUFFIX = "ServiceCategory";
+
/**
* This method returns the text representation of the
* supplied type reference.
@@ -70,4 +73,64 @@
return(ret);
}
+
+ /**
+ * This method returns the business object type property
+ * for the role's service category.
+ *
+ * @param roleName The role
+ * @return The service category property
+ */
+ public static String getRoleServiceCategoryProperty(String roleName) {
+ String ret=roleName+SERVICE_CATEGORY_ACCESSOR_SUFFIX;
+
+ ret = Character.toLowerCase(ret.charAt(0))+ret.substring(1);
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the business object type property
+ * for the role's service name.
+ *
+ * @param roleName The role
+ * @return The service name property
+ */
+ public static String getRoleServiceNameProperty(String roleName) {
+ String ret=roleName+SERVICE_NAME_ACCESSOR_SUFFIX;
+
+ ret = Character.toLowerCase(ret.charAt(0))+ret.substring(1);
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the business object type accessor method
+ * for the role's service category.
+ *
+ * @param roleName The role
+ * @return The service category property
+ */
+ public static String getRoleServiceCategoryAccessorMethod(String roleName) {
+ String ret=roleName+SERVICE_CATEGORY_ACCESSOR_SUFFIX;
+
+ ret = "get"+Character.toUpperCase(ret.charAt(0))+ret.substring(1);
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the business object type accessor method
+ * for the role's service name.
+ *
+ * @param roleName The role
+ * @return The service name property
+ */
+ public static String getRoleServiceNameAccessorMethod(String roleName) {
+ String ret=roleName+SERVICE_NAME_ACCESSOR_SUFFIX;
+
+ ret = "get"+Character.toUpperCase(ret.charAt(0))+ret.substring(1);
+
+ return(ret);
+ }
}
15 years, 9 months
Overlord SVN: r212 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb: actions and 2 other directories.
by overlord-commits@lists.jboss.org
Author: objectiser
Date: 2008-08-01 07:06:31 -0400 (Fri, 01 Aug 2008)
New Revision: 212
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/GenerateDialog.java
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/actions/GenerateAction.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/eclipse/Activator.java
Log:
Initial implementation of generation dialog.
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/actions/GenerateAction.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/actions/GenerateAction.java 2008-07-31 16:34:40 UTC (rev 211)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/actions/GenerateAction.java 2008-08-01 11:06:31 UTC (rev 212)
@@ -41,6 +41,7 @@
import org.scribble.model.change.*;
import org.w3c.dom.Node;
+import org.jboss.tools.overlord.jbossesb.dialogs.*;
import org.jboss.tools.overlord.jbossesb.model.*;
/**
@@ -64,7 +65,20 @@
IResource res=(IResource)sel.getFirstElement();
if (res instanceof IFile) {
- generate((IFile)res);
+
+ if (true) {
+ GenerateDialog dialog=
+ new GenerateDialog(m_targetPart.getSite().getShell(),
+ (IFile)res);
+
+ try {
+ dialog.open();
+ } catch(Throwable e) {
+ e.printStackTrace();
+ }
+ } else {
+ generate((IFile)res);
+ }
}
}
}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/GenerateDialog.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/GenerateDialog.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/dialogs/GenerateDialog.java 2008-08-01 11:06:31 UTC (rev 212)
@@ -0,0 +1,473 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.jbossesb.dialogs;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+import org.jboss.tools.overlord.jbossesb.model.DefaultESBLanguageModel;
+import org.jboss.tools.overlord.jbossesb.model.ESBLanguageModel;
+import org.scribble.conversation.model.ConversationModel;
+import org.scribble.extensions.RegistryFactory;
+import org.scribble.model.DefaultModelListener;
+import org.scribble.model.Model;
+import org.scribble.model.ModelReference;
+import org.scribble.model.ModelRepository;
+import org.scribble.model.Role;
+import org.scribble.model.change.ModelGenerator;
+import org.eclipse.jdt.core.*;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.*;
+
+/**
+ * This class provides the dialog for generating JBossESB
+ * service artefacts.
+ */
+public class GenerateDialog extends org.eclipse.jface.dialogs.Dialog {
+
+ private static final String JAVA_SOURCE_LOCATION = "src/java";
+
+ private static final String CLASSPATH_FILENAME = ".classpath";
+
+ private static final String OUTPUT_LOCATION = "classes";
+ /**
+ * This is the constructor for the generate dialog.
+ *
+ * @param shell The shell
+ */
+ public GenerateDialog(Shell shell, IFile file) {
+ super(shell);
+
+ m_file = file;
+
+ initialize(m_file);
+ }
+
+ /**
+ * This method initializes the conversation model associated
+ * with the supplied file resource.
+ *
+ * @param res The file
+ */
+ protected void initialize(IFile res) {
+ ModelReference ref=
+ org.scribble.osgi.model.OSGIModelRepository.createReference(res);
+
+ if (ref != null) {
+ ModelRepository mrep=(ModelRepository)
+ RegistryFactory.getRegistry().getExtension(
+ ModelRepository.class, null);
+
+ if (mrep != null) {
+ Model model=mrep.getModel(ref,
+ new DefaultModelListener());
+
+ if (model instanceof ConversationModel) {
+ m_conversationModel = (ConversationModel)model;
+
+ m_roles = m_conversationModel.getRoles();
+ }
+ }
+ }
+
+ if (m_conversationModel == null) {
+ error("Unable to load model used to generate " +
+ "the ESB artefacts", null);
+ }
+ }
+
+ /**
+ * This method creates the dialog details.
+ *
+ * @param parent The parent control
+ * @return The control containing the dialog components
+ */
+ protected Control createDialogArea(Composite parent) {
+
+ Composite composite=(Composite)super.createDialogArea(parent);
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ composite.setLayout(layout);
+
+ GridData gd=null;
+
+ Group group=new Group(composite, SWT.H_SCROLL|SWT.V_SCROLL);
+
+ gd=new GridData();
+ gd.horizontalAlignment = SWT.FILL;
+ gd.horizontalSpan = 1;
+ gd.widthHint = 500;
+ gd.grabExcessHorizontalSpace = true;
+ group.setLayoutData(gd);
+
+ layout = new GridLayout();
+ layout.numColumns = 2;
+ group.setLayout(layout);
+
+ // Labels
+ Label label=new Label(group, SWT.NONE);
+ label.setText("Service Role");
+
+ gd = new GridData();
+ gd.horizontalSpan = 1;
+ gd.widthHint = 150;
+ label.setLayoutData(gd);
+
+ label = new Label(group, SWT.NONE);
+ label.setText("Project Name");
+
+ gd = new GridData();
+ gd.horizontalSpan = 1;
+ gd.widthHint = 150;
+ label.setLayoutData(gd);
+
+ if (m_conversationModel != null) {
+
+ for (int i=0; i < m_roles.size(); i++) {
+
+ Button button=new Button(group, SWT.CHECK);
+ button.setText(m_roles.get(i).getName());
+ button.setSelection(true);
+
+ gd = new GridData();
+ gd.horizontalSpan = 1;
+ gd.widthHint = 150;
+ button.setLayoutData(gd);
+
+ m_roleButtons.add(button);
+
+ button.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ checkStatus();
+ }
+ });
+
+ Text projectName=new Text(group, SWT.NONE);
+ projectName.setText(m_roles.get(i).getName());
+
+ gd = new GridData();
+ gd.horizontalSpan = 1;
+ gd.widthHint = 300;
+ projectName.setLayoutData(gd);
+
+ m_projectNames.add(projectName);
+
+ projectName.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ checkStatus();
+ }
+ });
+
+ }
+ }
+
+ Button button=new Button(group, SWT.NONE);
+ button.setText("Check All");
+
+ gd = new GridData();
+ gd.horizontalSpan = 1;
+ gd.widthHint = 150;
+ button.setLayoutData(gd);
+
+ button.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ for (int i=0; i < m_roleButtons.size(); i++) {
+ m_roleButtons.get(i).setSelection(true);
+ }
+ checkStatus();
+ }
+ });
+
+ button=new Button(group, SWT.NONE);
+ button.setText("Clear All");
+
+ gd = new GridData();
+ gd.horizontalSpan = 1;
+ gd.widthHint = 150;
+ button.setLayoutData(gd);
+
+ button.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ for (int i=0; i < m_roleButtons.size(); i++) {
+ m_roleButtons.get(i).setSelection(false);
+ }
+ checkStatus();
+ }
+ });
+
+ return(composite);
+ }
+
+ @Override
+ protected Control createButtonBar(Composite parent) {
+ Control ret=super.createButtonBar(parent);
+
+ checkStatus();
+
+ return(ret);
+ }
+
+ protected void checkStatus() {
+ int selected=0;
+ boolean f_error=false;
+
+ for (int i=0; i < m_roleButtons.size(); i++) {
+ if (m_roleButtons.get(i).getSelection()) {
+ selected++;
+
+ m_projectNames.get(i).setEnabled(true);
+
+ // Check project name
+ String projectName=m_projectNames.get(i).getText();
+
+ if (isProjectNameValid(projectName) == false) {
+ f_error = true;
+
+ m_projectNames.get(i).setBackground(
+ Display.getCurrent().getSystemColor(SWT.COLOR_RED));
+ } else {
+ m_projectNames.get(i).setBackground(
+ Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+ }
+ } else {
+ m_projectNames.get(i).setEnabled(false);
+ m_projectNames.get(i).setBackground(
+ Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+ }
+ }
+
+ if (f_error || selected == 0) {
+ getButton(IDialogConstants.OK_ID).setEnabled(false);
+ } else {
+ getButton(IDialogConstants.OK_ID).setEnabled(true);
+ }
+ }
+
+ protected boolean isProjectNameValid(String name) {
+ boolean ret=true;
+
+ if (name == null || name.trim().length() == 0) {
+ ret = false;
+ } else if (m_file.getWorkspace().getRoot().getProject(name).exists()) {
+ ret = false;
+ } else {
+ for (int i=0; ret && i < name.length(); i++) {
+ if (i == 0) {
+ ret = Character.isJavaIdentifierStart(name.charAt(i));
+ } else {
+ ret = Character.isJavaIdentifierPart(name.charAt(i));
+ }
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * The ok button has been pressed.
+ */
+ public void okPressed() {
+
+ try {
+ for (int i=0; i < m_roles.size(); i++) {
+
+ if (m_roleButtons.get(i).getSelection()) {
+ generateRole(m_roles.get(i),
+ m_projectNames.get(i).getText());
+ }
+ }
+
+ super.okPressed();
+ } catch(Exception e) {
+ error("Failed to generate ESB artefacts", e);
+ }
+ }
+
+ protected void generateRole(Role role, String projectName)
+ throws Exception {
+
+ if (logger.isLoggable(Level.FINEST)) {
+ logger.finest("Generate role '"+role+"' for: "+
+ m_conversationModel);
+ }
+
+ // Project to role
+ org.scribble.projector.Projector projector=
+ (org.scribble.projector.Projector)
+ RegistryFactory.getRegistry().getExtension(
+ org.scribble.projector.Projector.class, null);
+
+ if (projector != null) {
+ Model localModel=projector.project(m_conversationModel,
+ role, new DefaultModelListener());
+
+ if (localModel instanceof ConversationModel &&
+ ((ConversationModel)localModel).getConversation() != null) {
+ ConversationModel lcm=(ConversationModel)localModel;
+
+ ModelReference targetRef=
+ new ModelReference(ESBLanguageModel.JBOSSESB_NOTATION);
+
+ DefaultESBLanguageModel target=
+ new DefaultESBLanguageModel(targetRef);
+
+ ModelGenerator generator=(ModelGenerator)
+ RegistryFactory.getRegistry().getExtension(
+ ModelGenerator.class, null);
+
+ if (generator != null) {
+ generator.generate(targetRef, role, target,
+ lcm);
+
+ generateRoleProject(projectName,
+ target.getESBConfiguration(),
+ lcm);
+ } else {
+ logger.severe("Unable to find model generator");
+ }
+ }
+ }
+ }
+
+ protected void generateRoleProject(String projectName,
+ org.w3c.dom.Element esbConfig, ConversationModel localcm)
+ throws Exception {
+
+ // Create project
+ IProject project=m_file.getWorkspace().getRoot().getProject(projectName);
+ project.create(new org.eclipse.core.runtime.NullProgressMonitor());
+
+ IJavaProject jproj=JavaCore.create(project);
+
+ project.open(new org.eclipse.core.runtime.NullProgressMonitor());
+
+ IProjectDescription description = jproj.getProject().getDescription();
+ String[] prevNatures= description.getNatureIds();
+ String[] newNatures= new String[prevNatures.length + 1];
+ System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
+ newNatures[prevNatures.length]= JavaCore.NATURE_ID;
+ description.setNatureIds(newNatures);
+
+ jproj.getProject().setDescription(description,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+
+ IPath outputLocation=jproj.getPath().append(new Path(OUTPUT_LOCATION));
+ IPath classpathLocation=jproj.getPath().append(new Path(CLASSPATH_FILENAME));
+ IPath sourceLocation=jproj.getPath().append(new Path(JAVA_SOURCE_LOCATION));
+
+ // create and set the output and source paths first
+ IFolder outputFolder= jproj.getProject().getWorkspace().getRoot().getFolder(outputLocation);
+ createParentFolder(outputFolder);
+ outputFolder.create(true, true, new org.eclipse.core.runtime.NullProgressMonitor());
+ outputFolder.setDerived(true);
+
+ IFolder sourceFolder= jproj.getProject().getWorkspace().getRoot().getFolder(sourceLocation);
+ createParentFolder(sourceFolder);
+ sourceFolder.create(true, true, new org.eclipse.core.runtime.NullProgressMonitor());
+ sourceFolder.setDerived(true);
+
+ IFile file=jproj.getProject().getWorkspace().getRoot().getFile(classpathLocation);
+ file.create(null, true, new org.eclipse.core.runtime.NullProgressMonitor());
+ file.setDerived(true);
+
+ // Write empty contents, to overcome 'Resource '..' is not local' exception
+ String classpath="<classpath/>";
+ file.setContents(new java.io.ByteArrayInputStream(classpath.getBytes()), true,
+ false, new org.eclipse.core.runtime.NullProgressMonitor());
+
+ IClasspathEntry[] classpaths=new IClasspathEntry[2];
+
+ classpaths[0] = JavaCore.newContainerEntry(
+ new Path("org.eclipse.jdt.launching.JRE_CONTAINER"));
+
+ classpaths[1] = JavaCore.newSourceEntry(sourceLocation);
+
+ jproj.setRawClasspath(classpaths, outputLocation,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+ }
+
+ /**
+ * This method checks whether the parent folder exists,
+ * and if not attempts to create it.
+ *
+ * @param res The current resource
+ */
+ protected void createParentFolder(IResource res) {
+
+ if (res.getParent() instanceof IFolder) {
+ IFolder parent=(IFolder)res.getParent();
+
+ if (parent.exists() == false) {
+ createParentFolder(parent);
+
+ try {
+ parent.create(true, true,
+ new org.eclipse.core.runtime.NullProgressMonitor());
+ } catch(Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ /**
+ * This method is used to report an error.
+ *
+ * @param mesg The error message
+ * @param ex The exception
+ */
+ public void error(String mesg, Exception ex) {
+
+ org.jboss.tools.overlord.jbossesb.eclipse.Activator.logError(mesg, ex);
+
+ MessageBox mbox=new MessageBox(getShell(),
+ SWT.ICON_ERROR|SWT.OK);
+ mbox.setMessage(mesg);
+ mbox.open();
+ }
+
+ private static Logger logger = Logger.getLogger("org.jboss.tools.overlord.jbossesb.dialogs");
+
+ private IFile m_file=null;
+ private ConversationModel m_conversationModel=null;
+ private java.util.List<Role> m_roles=null;
+ private java.util.List<Button> m_roleButtons=new java.util.Vector<Button>();
+ private java.util.List<Text> m_projectNames=new java.util.Vector<Text>();
+}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/eclipse/Activator.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/eclipse/Activator.java 2008-07-31 16:34:40 UTC (rev 211)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/eclipse/Activator.java 2008-08-01 11:06:31 UTC (rev 212)
@@ -19,6 +19,9 @@
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import java.util.logging.Logger;
/**
* The activator class controls the plug-in life cycle
@@ -66,4 +69,24 @@
return plugin;
}
+ /**
+ * This method logs an error against the plugin.
+ *
+ * @param mesg The error message
+ * @param t The optional exception
+ */
+ public static void logError(String mesg, Throwable t) {
+
+ if (getDefault() != null) {
+ Status status=new Status(IStatus.ERROR,
+ PLUGIN_ID, 0, mesg, t);
+
+ getDefault().getLog().log(status);
+ }
+
+ logger.severe("LOG ERROR: "+mesg+
+ (t == null ? "" : ": "+t));
+ }
+
+ private static Logger logger = Logger.getLogger("org.pi4soa.service.generation.eclipse");
}
15 years, 9 months