Author: assaf
Date: Mon Apr 2 16:37:25 2007
New Revision: 524970
URL: http://svn.apache.org/viewvc?view=rev&rev=524970
Log:
Added JBI packaging support
Added:
incubator/ode/trunk/tasks/jbi.rake
Modified:
incubator/ode/trunk/Rakefile
Modified: incubator/ode/trunk/Rakefile
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/Rakefile?view=diff&rev=524970&r1=524969&r2=524970
==============================================================================
--- incubator/ode/trunk/Rakefile (original)
+++ incubator/ode/trunk/Rakefile Mon Apr 2 16:37:25 2007
@@ -421,7 +421,15 @@
project("ode:bpel-schemas"), project("ode:bpel-store"),
project("ode:utils"),
COMMONS.logging, COMMONS.pool, JAVAX.transaction, JBI, LOG4J, WSDL4J,
XERCES
- package :jar
+
+ libs = [ package(:jar) ] # Insert more stuff here
+ package(:jbi).tap do |jbi|
+ jbi.component :type=>:service_engine, :name=>"OdeBpelEngine",
:description=>self.comment
+ jbi.component :class_name=>"org.apache.ode.jbi.OdeComponent",
:delegation=>:self, :libs=>libs
+ jbi.bootstrap :class_name=>"org.apache.ode.jbi.OdeBootstrap", :libs=>libs
+ jbi.merge project("ode:dao-hibernate-db").package(:zip)
+ jbi.merge project("ode:dao-jpa-ojpa-derby").package(:zip)
+ end
end
desc "ODE JCA Resource Archive"
@@ -493,3 +501,28 @@
task("jetty:bounce" => ["ode:axis2-war:jetty:bounce"])
task("jetty:shutdown" => ["ode:axis2-war:jetty:shutdown"])
+
+
+def jbi_descriptor(args)
+ delegation = lambda { |key| "#{key || :parent}-first" }
+ xml = Builder::XmlMarkup.new(:target=>$stdout, :indent=>2)
+ xml.instruct!
+ xml.jbi :xmlns=>"http://java.sun.com/xml/ns/jbi", :version=>"1.0" do
+ xml.component :type=>args[:type].to_s.sub("_", "-"),
+
"component-class-loader-delegation"=>delegation[args[:component][:delegation]],
+
"bootstrap-class-loader-delegation"=>delegation[args[:bootstrap][:delegation]]
do
+ xml.identification do
+ xml.name args[:name]
+ xml.description args[:description]
+ end
+ xml.tag! "component-class-name", args[:component][:class]
+ xml.tag! "component-class-path" do
+ args[:component][:path].each { |path| xml.tag! "path-element", path }
+ end
+ xml.tag! "bootstrap-class-name", args[:bootstrap][:class]
+ xml.tag! "bootstrap-class-path" do
+ args[:bootstrap][:path].each { |path| xml.tag! "path-element", path }
+ end
+ end
+ end
+end
Added: incubator/ode/trunk/tasks/jbi.rake
URL:
http://svn.apache.org/viewvc/incubator/ode/trunk/tasks/jbi.rake?view=auto&rev=524970
==============================================================================
--- incubator/ode/trunk/tasks/jbi.rake (added)
+++ incubator/ode/trunk/tasks/jbi.rake Mon Apr 2 16:37:25 2007
@@ -0,0 +1,98 @@
+module Buildr
+ class JBITask < ZipTask
+
+ class Component
+ attr_accessor :name
+ attr_accessor :type
+ attr_accessor :description
+ attr_accessor :delegation
+ attr_accessor :class_name
+ attr_writer :libs
+ def libs()
+ @libs ||= []
+ end
+ end
+
+ class Bootstrap
+ attr_accessor :delegation
+ attr_accessor :class_name
+ attr_writer :libs
+ def libs()
+ @libs ||= []
+ end
+ end
+
+ def []=(key, value)
+ case key.to_sym
+ when :name, :description, :type
+ self.component.send "#{name}=", value
+ when :component
+ self.component value
+ when :bootstrap
+ self.bootstrap value
+ else
+ super key, value
+ end
+ value
+ end
+
+ def component(args = nil)
+ @component ||= Component.new
+ args.each { |k, v| @component.send "#{k}=", v } if args
+ @component
+ end
+
+ def bootstrap(args = nil)
+ @bootstrap ||= Bootstrap.new
+ args.each { |k, v| @bootstrap.send "#{k}=", v } if args
+ @bootstrap
+ end
+
+ protected
+
+ def create(zip)
+ zip.mkdir "META-INF"
+ zip.file.open("META-INF/jbi.xml", "w") { |output| output.write
descriptor }
+ path("lib").include component.libs.flatten, bootstrap.libs.flatten
+ super zip
+ end
+
+ def descriptor()
+ delegation = lambda { |key| "#{key || :parent}-first" }
+ xml = Builder::XmlMarkup.new(:indent=>2)
+ xml.instruct!
+ xml.jbi :xmlns=>"http://java.sun.com/xml/ns/jbi", :version=>"1.0" do
+ xml.component :type=>component.type.to_s.sub("_", "-"),
+
"component-class-loader-delegation"=>delegation[component.delegation],
+
"bootstrap-class-loader-delegation"=>delegation[bootstrap.delegation] do
+ xml.identification do
+ xml.name component.name
+ xml.description component.description
+ end
+ xml.tag! "component-class-name", component.class_name
+ xml.tag! "component-class-path" do
+ component.libs.each { |lib| xml.tag! "path-element", lib.to_s }
+ end
+ xml.tag! "bootstrap-class-name", bootstrap.class_name
+ xml.tag! "bootstrap-class-path" do
+ bootstrap.libs.each { |lib| xml.tag! "path-element", lib.to_s }
+ end
+ end
+ end
+ end
+
+ end
+
+ class Project
+
+ def package_as_jbi(args)
+ args[:type] = :zip
+ file_name = args[:file] || path_to(:target_dir,
Artifact.hash_to_file_name(args))
+ unless Rake::Task.task_defined?(file_name)
+ JBITask.define_task(file_name).tap { |task| package_extend task, args }
+ end
+ file(file_name).tap { |task| task.include args[:include] if
args[:include] }
+ end
+ end
+end
+