Skip to content

Commit

Permalink
ode-extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Ahn authored and Sean Ahn committed May 1, 2009
0 parents commit a06779d
Show file tree
Hide file tree
Showing 7 changed files with 375 additions and 0 deletions.
41 changes: 41 additions & 0 deletions Buildfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
require "buildr/xmlbeans"
#require "buildr/cobertura"

# Keep this structure to allow the build system to update version numbers.
VERSION_NUMBER = "1.0.0-SNAPSHOT"

require "dependencies.rb"
require "repositories.rb"

#ODE_VERSION = "apache-ode-1.2-SNAPSHOT-700632"
#ODE_URI = "http://www.intalio.org/public/ode/#{ODE_VERSION}.zip"

ODE_VERSION = "apache-ode-war-1.3.2-SNAPSHOT"
ODE_URI = "file:///ode/1.x/distro/target/#{ODE_VERSION}.zip"

desc "ODE Extension"
define "ode-ext" do
project.version = VERSION_NUMBER
project.group = "org.intalio.ode-ext"

compile.options.target = "1.5"

desc "Deployment Extension"
define "deploy" do
import_ode = lambda do |target|
file(target) do |task|
Buildr.ant("download ode and unzip") do |ant|
ant.get :src=>ODE_URI, :dest=>_("target/ode.zip")
ant.unzip :src=>_("target/ode.zip"), :dest=>_("target/ode/unzipped")
ant.unjar :src=>_("target/ode/unzipped/#{ODE_VERSION}/ode.war"), :dest=>_("target/ode")
end
Dir[_("target/ode/WEB-INF/lib/*.jar")].each {|f| compile.with f}
end
# Dir[_("target/ode/WEB-INF/lib/*.jar")].map {|f| file(f)}
end
build import_ode[_("target/ode/WEB-INF/lib")]
compile.with DEPLOY_SERVICE, APACHE_COMMONS[:logging], _("target/ode/WEB-INF/lib")

package(:zip).include(package(:jar)).include(artifacts(DEPLOY_SERVICE)).include(artifacts(DEPLOY_REGISTRY)).include(artifacts(SLF4J))
end
end
26 changes: 26 additions & 0 deletions dependencies.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
ANT = [ "org.apache.ant:ant:jar:1.7.1" ]

APACHE_COMMONS = {
:beanutils => "commons-beanutils:commons-beanutils:jar:1.7.0",
:cli => "commons-cli:commons-cli:jar:1.1",
:codec => "commons-codec:commons-codec:jar:1.3",
:collections => "commons-collections:commons-collections:jar:3.2",
:daemon => "commons-daemon:commons-daemon:jar:1.0.1",
:dbcp => "commons-dbcp:commons-dbcp:jar:1.2.2",
:digester => "commons-digester:commons-digester:jar:1.7",
:discovery => "commons-discovery:commons-discovery:jar:0.2",
:fileupload => "commons-fileupload:commons-fileupload:jar:1.2.1",
:httpclient => "commons-httpclient:commons-httpclient:jar:3.1",
:io => "commons-io:commons-io:jar:1.2",
:lang => "commons-lang:commons-lang:jar:2.3",
:logging => "commons-logging:commons-logging:jar:1.0.4",
:pool => "commons-pool:commons-pool:jar:1.4",
:validator => "commons-validator:commons-validator:jar:1.2.0"
}

LOG4J = "log4j:log4j:jar:1.2.15"

SLF4J = group(%w{ slf4j-api slf4j-log4j12 jcl104-over-slf4j }, :under=>"org.slf4j", :version=>"1.4.3")

DEPLOY_SERVICE = "org.intalio.deploy:deploy-api:jar:1.0.3"
DEPLOY_REGISTRY = "org.intalio.deploy:deploy-registry:jar:1.0.3"
87 changes: 87 additions & 0 deletions deploy/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<classpath>
<classpathentry kind="src" path="src/main/java" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/XmlSchema-1.3.2.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/activation-1.1.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/annogen-0.1.0.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/axiom-api-1.2.5.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/axiom-dom-1.2.5.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/axiom-impl-1.2.5.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/axion-1.0-M3-dev.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/axis2-adb-1.3.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/axis2-codegen-1.3.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/axis2-java2wsdl-1.3.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/axis2-jibx-1.3.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/axis2-kernel-1.3.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/axis2-saaj-1.3.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/axis2-xmlbeans-1.3.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/backport-util-concurrent-3.0.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/bcprov-jdk15-132.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/commons-codec-1.3.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/commons-collections-3.1.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/commons-fileupload-1.1.1.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/commons-httpclient-3.0.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/commons-io-1.4.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/commons-lang-2.3.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/commons-logging-1.1.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/commons-pool-1.2.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/commons-primitives-1.0.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/derby-10.4.1.3.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/derbytools-10.4.1.3.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/geronimo-connector-2.0.1.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/geronimo-ejb_2.1_spec-1.1.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/geronimo-j2ee-connector_1.5_spec-1.0.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/geronimo-jta_1.1_spec-1.1.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/geronimo-kernel-2.0.1.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/geronimo-spec-javamail-1.3.1-rc5.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/geronimo-spec-jms-1.1-rc4.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/geronimo-transaction-2.0.1.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/jaxen-1.1.1.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/jibx-run-1.1-beta3.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/log4j-1.2.13.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/neethi-2.0.2.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-agents-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-axis2-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-bpel-api-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-bpel-compiler-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-bpel-connector-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-bpel-dao-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-bpel-epr-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-bpel-obj-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-bpel-ql-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-bpel-runtime-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-bpel-schemas-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-bpel-store-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-dao-hibernate-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-dao-jpa-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-jacob-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-jca-ra-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-jca-server-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-scheduler-simple-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/ode-utils-1.3.2-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/openjpa-1.3.0-SNAPSHOT.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/opensaml-1.1.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/persistence-api-1.0.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/rampart-core-1.3.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/rampart-policy-1.3.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/rampart-trust-1.3.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/saxon-9.x.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/saxon-dom-9.x.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/saxon-xpath-9.x.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/saxon-xqj-9.x.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/serp-1.13.1.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/stax-api-1.0.1.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/tranql-connector-1.1.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/wsdl4j-1.6.1.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/wss4j-1.5.3.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/wstx-asl-3.2.1.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/xalan-2.7.0-2.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/xercesImpl-2.9.0.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/xmlbeans-2.3.0.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="target/ode/WEB-INF/lib/xmlsec-1.4.0.jar" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="src" path="src/main/resources" output="target/resources" excluding="**/.svn/|**/CVS/"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="var" path="M2_REPO/org/intalio/deploy/deploy-api/1.0.3/deploy-api-1.0.3.jar" sourcepath="M2_REPO/org/intalio/deploy/deploy-api/1.0.3/deploy-api-1.0.3-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar" sourcepath="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
</classpath>
12 changes: 12 additions & 0 deletions deploy/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<projectDescription>
<name>ode-ext-deploy</name>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.ode.axis2.deploy;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.axis2.ODEServer;
import org.apache.ode.bpel.iapi.ProcessState;
import org.intalio.deploy.deployment.ComponentId;
import org.intalio.deploy.deployment.DeploymentMessage;
import org.intalio.deploy.deployment.DeploymentMessage.Level;
import org.intalio.deploy.deployment.spi.ComponentManager;
import org.intalio.deploy.deployment.spi.ComponentManagerResult;
import org.intalio.deploy.deployment.utils.DeploymentServiceRegister;

import javax.xml.namespace.QName;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
* The new deployment service based deployment poller. On start() or stop(), this object
* starts or stops the default deployment poller plus, registering or un-registering itself to the
* deployment service.
* <p>
* The naming of the deployment unit has been changed to:
* <p>
* &lt;assembly_name&gt;-&lt;assembly_version&gt;/&lt;component_name&gt;
* <p>
*
* The assembly version is stripped off when the version is 0. The component name does
* not include the component type.
*/
public class ProcessComponentManager extends DeploymentPoller implements ComponentManager {
private final static Log __log = LogFactory.getLog(ProcessComponentManager.class);
private DeploymentServiceRegister register;

private final static String COMPONENT_MANAGER_NAME = "ode";

public ProcessComponentManager(File deployDir, ODEServer odeServer) {
super(deployDir, odeServer);
}

public void start() {
super.start();

// register the component manager to deployment service
if( register != null ) {
register.destroy();
register = null;
}
register = new DeploymentServiceRegister(this);
register.init();

__log.info("ProcessComponentManager started.");
}

public void stop() {
// un-register the component manager from deployment service
if( register != null ) {
register.destroy();
register = null;
}

super.stop();
}

@Override
protected boolean isDeploymentFromODEFileSystemAllowed() {
return !Boolean.getBoolean("org.intalio.pxe.disable.oldfsdeploy");
}

public ComponentManagerResult deploy(ComponentId name, File path, boolean activate) {
List<DeploymentMessage> messages = new ArrayList<DeploymentMessage>();
List<String> deployedResources = new ArrayList<String>();

/**
* 1. scan the path and compile processes
* 2. retire all old revisions
* 3. if "activate" is false, the new revision is set to "retired"
*/
try {
String duName = resolvePackageNameFromComponentId(name);
Collection<QName> deployed = _odeServer.getProcessStore().deploy(path, activate, duName);
__log.info("Deployment of artifact " + path.getName() + " successful: " + deployed );
deployedResources.add(duName);
} catch (Exception e) {
__log.error("Deployment of " + path.getAbsolutePath() + " failed, aborting for now.", e);
messages.add(new DeploymentMessage(Level.ERROR, e.getMessage()));
}

return new ComponentManagerResult(messages, deployedResources);
}

public void deployed(ComponentId cid, File path, List<String> deployedResources, boolean active) {
// nothing to do
}

public void initialize(ComponentId cid, File path, List<String> deployedResources, boolean active) {
// nothing to do
}

public void start(ComponentId cid, File path, List<String> deployedResources, boolean active) {
// start up the scheduler if not started up yet, not yet implemented
}

public void stop(ComponentId cid, File path, List<String> deployedResources, boolean active) {
// stop the scheduler if this is the last kind of process component, not yet implemented
}

public void dispose(ComponentId cid, File path, List<String> deployedResources, boolean active) {
// nothing to do
}

public void undeploy(ComponentId cid, File path, List<String> deployedResources) {
if( deployedResources.isEmpty() ) {
throw new IllegalArgumentException("Deployed resources that were passed in from Deployment Service do not contain ODE deployment unit name!!");
}
_odeServer.getProcessStore().undeploy(deployedResources.iterator().next());
}

public void undeployed(ComponentId cid, File path, List<String> deployedResources) {
// nothing to do
}

public String getComponentManagerName() {
return COMPONENT_MANAGER_NAME;
}

public void activate(ComponentId cid, File path, List<String> deployedResources) {
// activate all processes belonging to the component
for( QName pid : _odeServer.getProcessStore().listProcesses(resolvePackageNameFromComponentId(cid)) ) {
_odeServer.getProcessStore().setState(pid, ProcessState.ACTIVE);
}
}

public void activated(ComponentId cid, File path, List<String> deployedResources) {
// nothing to do
}

public void retire(ComponentId cid, File path, List<String> deployedResources) {
// retire all processes belonging to the component
for( QName pid : _odeServer.getProcessStore().listProcesses(resolvePackageNameFromComponentId(cid)) ) {
_odeServer.getProcessStore().setState(pid, ProcessState.RETIRED);
}
}

public void retired(ComponentId cid, File path, List<String> deployedResources) {
// nothing to do
}

protected String resolvePackageNameFromComponentId(ComponentId name) {
return name.getAssemblyId() + "/" + name.getComponentName();
}

public void finalize() {
stop();
}
}
Loading

0 comments on commit a06779d

Please sign in to comment.