You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by as...@apache.org on 2007/03/23 03:45:32 UTC

svn commit: r521561 - in /incubator/ode/trunk: Rakefile bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler20.java bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java tasks/ tasks/derby.rake

Author: assaf
Date: Thu Mar 22 19:45:31 2007
New Revision: 521561

URL: http://svn.apache.org/viewvc?view=rev&rev=521561
Log:
Moved Derby creation to tasks/derby.rake

Added:
    incubator/ode/trunk/tasks/
    incubator/ode/trunk/tasks/derby.rake
Modified:
    incubator/ode/trunk/Rakefile
    incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler20.java
    incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java

Modified: incubator/ode/trunk/Rakefile
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/Rakefile?view=diff&rev=521561&r1=521560&r2=521561
==============================================================================
--- incubator/ode/trunk/Rakefile (original)
+++ incubator/ode/trunk/Rakefile Thu Mar 22 19:45:31 2007
@@ -1,5 +1,4 @@
 require "buildr/lib/buildr.rb"
-require "open3"
 
 # Keep this structure to allow the build system to update version numbers.
 VERSION_NUMBER = "2.0-SNAPSHOT"
@@ -150,7 +149,7 @@
     compile.with project("ode:bpel-api"), project("ode:bpel-obj"),
       project("ode:bpel-schemas"), project("ode:bpel-scripts"),
       project("ode:utils"),
-      COMMONS.logging, JAXEN, SAXON, WSDL4J, XALAN, XERCES
+      COMMONS.logging, JAVAX.stream, JAXEN, SAXON, WSDL4J, XALAN, XERCES
     package :jar
   end
 
@@ -319,7 +318,7 @@
     derby_xml = path_to(:src_dir, "main/descriptors/persistence.derby.xml")
     quartz_sql = path_to(:src_dir, "main/scripts/quartz-derby.sql")
     derby_sql = file(path_to(:target_dir, "derby.sql")=>[derby_xml, quartz_sql]) do |task|
-      mkpath path_to(:target_dir)
+      mkpath path_to(:target_dir), :verbose=>false
       OpenJPA.mapping_tool :properties=>derby_xml, :action=>"build", :sql=>task.name,
         :classpath=>artifacts( project("ode:bpel-store"), project("ode:dao-jpa"),
                       project("ode:bpel-api"), project("ode:bpel-dao"),
@@ -327,36 +326,8 @@
       File.open(task.name, "a") { |file| file.write File.read(quartz_sql) }
     end
 
-    # Generate the derby database using the DDL.
-    derby_db = file(path_to(:target_dir, "derby")=>derby_sql) do |task|
-      cmd = [ Java.path_to_bin("java") ]
-      cmd << "-cp" << artifacts(DERBY, DERBY_TOOLS).join(File::PATH_SEPARATOR)
-      cmd << "org.apache.derby.tools.ij"
-      Open3.popen3(*cmd) do |stdin, stdout, stderr|
-        # Shutdown so if a database already exists, we can remove it.
-        stdin.puts "connect 'jdbc:derby:;shutdown=true';"
-        rm_rf path_to(:target, "derby") rescue nil
-        # Create a new database, and load all the prerequisites.
-        stdin.puts "connect 'jdbc:derby:#{task.name}/jpadb;create=true;user=sa'"
-        stdin.puts "set schema sa"
-        stdin.puts "autocommit on;"
-        #puts "Going to write prereqs: #{prereq.to_s}"
-        task.prerequisites.each { |prereq| stdin.write File.read(prereq.to_s) }
-        # Exiting will shutdown the database so we can copy the files around.
-        stdin.puts "exit"
-        stdin.close
-        # Helps when dignosing SQL errors.
-        returning(stdout.read) { |output| puts output if Rake.application.options.trace }
-      end
-      # Copy the SQL files into the database directory.
-      filter(task.prerequisites).into("#{task.name}/jpadb").invoke
-      # Tell other tasks we're refreshed, this also prevents running task
-      # due to time differences between derby and jpadb directories.
-      touch task.name 
-    end
-
-    build derby_db
-    package :zip, :include=>path_to(:target_dir, "derby/*")
+    build derby_db = Derby.create(path_to(:target_dir, "derby/jpadb")=>derby_sql)
+    package :zip, :include=>derby_db
   end
 
   desc "ODE Axis2 Based Distribution"
@@ -447,7 +418,7 @@
 
   desc "ODE Utils"
   define "utils" do
-    compile.with COMMONS.logging, COMMONS.pool, LOG4J, XERCES
+    compile.with COMMONS.logging, COMMONS.pool, LOG4J, XERCES, JAVAX.stream
     package :jar
   end
 

Modified: incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler20.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler20.java?view=diff&rev=521561&r1=521560&r2=521561
==============================================================================
--- incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler20.java (original)
+++ incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/BpelCompiler20.java Thu Mar 22 19:45:31 2007
@@ -41,7 +41,7 @@
         registerActivityCompiler(AssignActivity.class, new AssignGenerator());
         registerActivityCompiler(ThrowActivity.class, new ThrowGenerator());
         registerActivityCompiler(WhileActivity.class, new WhileGenerator());
-        registerActivityCompiler(RepeatUntilActivity.class, new RepeatUntilGenerator());
+        //registerActivityCompiler(RepeatUntilActivity.class, new RepeatUntilGenerator());
         registerActivityCompiler(IfActivity.class, new IfGenerator());
         registerActivityCompiler(PickActivity.class, new PickGenerator());
         registerActivityCompiler(ReplyActivity.class, new ReplyGenerator());

Modified: incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java?view=diff&rev=521561&r1=521560&r2=521561
==============================================================================
--- incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java (original)
+++ incubator/ode/trunk/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/bom/BpelObjectFactory.java Thu Mar 22 19:45:31 2007
@@ -69,7 +69,7 @@
         _mappings.put(Bpel20QNames.SWITCH, IfActivity.class);
         _mappings.put(Bpel20QNames.IF, IfActivity.class);
         _mappings.put(Bpel20QNames.WHILE, WhileActivity.class);
-        _mappings.put(Bpel20QNames.REPEATUNTIL,RepeatUntilActivity.class);
+        //_mappings.put(Bpel20QNames.REPEATUNTIL,RepeatUntilActivity.class);
         _mappings.put(Bpel20QNames.SEQUENCE, SequenceActivity.class);
         _mappings.put(Bpel20QNames.PICK, PickActivity.class);
         _mappings.put(Bpel20QNames.SCOPE, ScopeActivity.class);

Added: incubator/ode/trunk/tasks/derby.rake
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/tasks/derby.rake?view=auto&rev=521561
==============================================================================
--- incubator/ode/trunk/tasks/derby.rake (added)
+++ incubator/ode/trunk/tasks/derby.rake Thu Mar 22 19:45:31 2007
@@ -0,0 +1,38 @@
+require "open3"
+
+
+module Derby
+  DERBY       = "org.apache.derby:derby:jar:10.1.2.1"
+  DERBY_TOOLS = "org.apache.derby:derbytools:jar:10.1.2.1"
+
+  def self.create(args)
+    db, prereqs = Rake.application.resolve_args(args)
+    file(db=>prereqs) do |task|
+      cmd = [ Java.path_to_bin("java") ]
+      cmd << "-cp" << artifacts(DERBY, DERBY_TOOLS).join(File::PATH_SEPARATOR)
+      cmd << "org.apache.derby.tools.ij"
+      Open3.popen3(*cmd) do |stdin, stdout, stderr|
+        # Shutdown so if a database already exists, we can remove it.
+        stdin.puts "connect 'jdbc:derby:;shutdown=true';"
+        rm_rf task.to_s if File.exist?(task.to_s)
+        # Create a new database, and load all the prerequisites.
+        stdin.puts "connect 'jdbc:derby:#{task.to_s};create=true;user=sa'"
+        stdin.puts "set schema sa"
+        stdin.puts "autocommit on;"
+        task.prerequisites.each { |prereq| stdin.write File.read(prereq.to_s) }
+        # Exiting will shutdown the database so we can copy the files around.
+        stdin.puts "exit"
+        stdin.close
+        # Helps when dignosing SQL errors.
+        stdout.read.tap { |output| puts output if Rake.application.options.trace }
+      end
+      # Copy the SQL files into the database directory.
+      filter(task.prerequisites).into(db).invoke
+      # Tell other tasks we're refreshed, this also prevents running task
+      # due to time differences between parent directory and db directory.
+      touch task.to_s 
+    end
+  end
+end      
+
+