You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2008/10/20 06:07:12 UTC
svn commit: r706117 - in /ode/branches/restful: ./
bpel-api/src/main/java/org/apache/ode/bpel/iapi/ bpel-schemas/src/main/xsd/
bpel-store/src/main/java/org/apache/ode/store/
dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/
engine/src/main/j...
Author: mriou
Date: Sun Oct 19 21:07:11 2008
New Revision: 706117
URL: http://svn.apache.org/viewvc?rev=706117&view=rev
Log:
Resources in the omodel. Started splitting ODEProcess.
Added:
ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/ODERestfulProcess.java
ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/ODEWSProcess.java
ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OCollect.java
ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OResource.java
Modified:
ode/branches/restful/Rakefile
ode/branches/restful/bpel-api/src/main/java/org/apache/ode/bpel/iapi/MessageExchange.java
ode/branches/restful/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java
ode/branches/restful/bpel-schemas/src/main/xsd/pmapi.xsd
ode/branches/restful/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
ode/branches/restful/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorSelector.java
ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java
ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java
ode/branches/restful/il-common/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java
ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OPickReceive.java
ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OProcess.java
ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OReply.java
ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OScope.java
ode/branches/restful/utils/src/main/java/org/apache/ode/utils/xsd/SchemaModelImpl.java
Modified: ode/branches/restful/Rakefile
URL: http://svn.apache.org/viewvc/ode/branches/restful/Rakefile?rev=706117&r1=706116&r2=706117&view=diff
==============================================================================
--- ode/branches/restful/Rakefile (original)
+++ ode/branches/restful/Rakefile Sun Oct 19 21:07:11 2008
@@ -170,16 +170,7 @@
repositories.remote << "http://download.java.net/maven/2"
repositories.release_to[:url] ||= "sftp://guest@localhost/home/guest"
-# Changing releases tag names
-class Release
- class << self
- def tag_with_apache_ode(version)
- tag_without_apache_ode("APACHE_ODE_#{version.upcase}")
- end
- alias :tag_without_apache_ode :tag
- alias :tag :tag_with_apache_ode
- end
-end
+Release.tag_name = lambda { |ver| "APACHE_ODE_#{ver.upcase}" }
desc "Apache ODE"
#define "ode", :group=>"org.apache.ode", :version=>VERSION_NUMBER do
@@ -552,7 +543,7 @@
"ode:bpel-dao", "ode:engine", "ode:bpel-store", "ode:il-common", "ode:dao-jpa"),
COMMONS.collections, COMMONS.lang, COMMONS.logging, DERBY, JAVAX.connector,
JAVAX.stream, JAVAX.transaction, JAXEN, HSQLDB, LOG4J, SAXON, XERCES, XMLBEANS, XALAN,
- DERBY, Java::JUnit::JUNIT_REQUIRES, JAVAX.persistence, OPENJPA, WSDL4J, JAVAX.transaction
+ DERBY, JAVAX.persistence, OPENJPA, WSDL4J, JAVAX.transaction
package :jar
end
Modified: ode/branches/restful/bpel-api/src/main/java/org/apache/ode/bpel/iapi/MessageExchange.java
URL: http://svn.apache.org/viewvc/ode/branches/restful/bpel-api/src/main/java/org/apache/ode/bpel/iapi/MessageExchange.java?rev=706117&r1=706116&r2=706117&view=diff
==============================================================================
--- ode/branches/restful/bpel-api/src/main/java/org/apache/ode/bpel/iapi/MessageExchange.java (original)
+++ ode/branches/restful/bpel-api/src/main/java/org/apache/ode/bpel/iapi/MessageExchange.java Sun Oct 19 21:07:11 2008
@@ -130,16 +130,14 @@
*
* @return name of the operation (WSDL 1.1) /message exchange (WSDL 1.2?).
*/
- String getOperationName()
- throws BpelEngineException;
+ String getOperationName() throws BpelEngineException;
/**
* Get a reference to the end-point targeted by this message exchange.
* @return end-point reference for this message exchange
*/
- EndpointReference getEndpointReference()
- throws BpelEngineException;
+ EndpointReference getEndpointReference() throws BpelEngineException;
AckType getAckType();
Modified: ode/branches/restful/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java
URL: http://svn.apache.org/viewvc/ode/branches/restful/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java?rev=706117&r1=706116&r2=706117&view=diff
==============================================================================
--- ode/branches/restful/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java (original)
+++ ode/branches/restful/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java Sun Oct 19 21:07:11 2008
@@ -63,7 +63,12 @@
* @return <code>true</code> if this is a transient process.
*/
boolean isTransient();
-
+
+ /**
+ * Indicates whether this process implements REST-style resources.
+ */
+ boolean isRestful();
+
/**
* Get the CBP stream.
* @return new stream to the CBP file.
Modified: ode/branches/restful/bpel-schemas/src/main/xsd/pmapi.xsd
URL: http://svn.apache.org/viewvc/ode/branches/restful/bpel-schemas/src/main/xsd/pmapi.xsd?rev=706117&r1=706116&r2=706117&view=diff
==============================================================================
--- ode/branches/restful/bpel-schemas/src/main/xsd/pmapi.xsd (original)
+++ ode/branches/restful/bpel-schemas/src/main/xsd/pmapi.xsd Sun Oct 19 21:07:11 2008
@@ -595,7 +595,6 @@
</annotation>
</element>
<element name="failures" type="pmapi:tFailuresInfo" minOccurs="0"/>
- <element name="myElement" type="string"/>
</sequence>
</complexType>
<complexType name="tScopeRef">
Modified: ode/branches/restful/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/restful/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java?rev=706117&r1=706116&r2=706117&view=diff
==============================================================================
--- ode/branches/restful/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java (original)
+++ ode/branches/restful/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java Sun Oct 19 21:07:11 2008
@@ -278,6 +278,10 @@
return _inMemory;
}
+ public boolean isRestful() {
+ return getProvideEndpoints().size() == 0;
+ }
+
public void setTransient(boolean t) {
_pinfo.setInMemory(t);
_inMemory = t;
Modified: ode/branches/restful/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorSelector.java
URL: http://svn.apache.org/viewvc/ode/branches/restful/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorSelector.java?rev=706117&r1=706116&r2=706117&view=diff
==============================================================================
--- ode/branches/restful/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorSelector.java (original)
+++ ode/branches/restful/dao-hibernate/src/main/java/org/apache/ode/daohib/bpel/hobj/HCorrelatorSelector.java Sun Oct 19 21:07:11 2008
@@ -43,7 +43,7 @@
_instance = instance;
}
- /**
+ /** after c
* @hibernate.property column="SELGRPID"
* @hibernate.column name="SELGRPID" index="IDX_SELECTOR_SELGRPID" not-null="true"
*/
Modified: ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java?rev=706117&r1=706116&r2=706117&view=diff
==============================================================================
--- ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java (original)
+++ ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java Sun Oct 19 21:07:11 2008
@@ -342,7 +342,7 @@
__log.debug("Registering process " + conf.getProcessId() + " with server.");
- ODEProcess process = new ODEProcess(this, conf, null, _myRoleMexCache);
+ ODEProcess process = new ODEWSProcess(this, conf, null, _myRoleMexCache);
for (Endpoint e : process.getServiceNames()) {
__log.debug("Register process: serviceId=" + e + ", process=" + process);
Modified: ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java
URL: http://svn.apache.org/viewvc/ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java?rev=706117&r1=706116&r2=706117&view=diff
==============================================================================
--- ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java (original)
+++ ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java Sun Oct 19 21:07:11 2008
@@ -86,75 +86,39 @@
* @author Maciej Szefler <mszefler at gmail dot com>
* @author Matthieu Riou <mriou at apache dot org>
*/
-public class ODEProcess {
+public abstract class ODEProcess {
static final Log __log = LogFactory.getLog(ODEProcess.class);
- private static final Messages __msgs = MessageBundle.getMessages(Messages.class);
+ protected static final Messages __msgs = MessageBundle.getMessages(Messages.class);
- private volatile Map<PartnerLinkModel, PartnerLinkPartnerRoleImpl> _partnerRoles;
-
- private volatile Map<PartnerLinkModel, PartnerLinkMyRoleImpl> _myRoles;
-
- /** Mapping from {"Service Name" (QNAME) / port} to a myrole. */
- private volatile Map<Endpoint, PartnerLinkMyRoleImpl> _endpointToMyRoleMap;
-
- // Backup hashmaps to keep initial endpoints handy after dehydration
- private Map<Endpoint, EndpointReference> _myEprs = new HashMap<Endpoint, EndpointReference>();
-
- private Map<Endpoint, EndpointReference> _partnerEprs = new HashMap<Endpoint, EndpointReference>();
-
- private Map<Endpoint, PartnerRoleChannel> _partnerChannels = new HashMap<Endpoint, PartnerRoleChannel>();
-
- /** Mapping from a potentially shared endpoint to its EPR */
- private SharedEndpoints _sharedEps;
-
- final QName _pid;
-
- private volatile ProcessModel _processModel;
-
- // Has the process already been hydrated before?
- private boolean _hydratedOnce = false;
+ protected final QName _pid;
+ protected volatile ProcessModel _processModel;
+ protected volatile OdeRuntime _runtime;
+ protected final ProcessConf _pconf;
+ protected Contexts _contexts;
+ protected final Set<InvocationStyle> _invocationStyles;
+ protected final BpelDAOConnectionFactoryImpl _inMemDao;
+ protected final BpelServerImpl _server;
/** Last time the process was used. */
- private volatile long _lastUsed;
+ protected volatile long _lastUsed;
- volatile OdeRuntime _runtime;
-
- DebuggerSupport _debugger;
-
- final ProcessConf _pconf;
+ protected DebuggerSupport _debugger;
/** {@link MessageExchangeInterceptor}s registered for this process. */
- private final List<MessageExchangeInterceptor> _mexInterceptors = new ArrayList<MessageExchangeInterceptor>();
-
- /** Latch-like thing to control hydration/dehydration. */
- HydrationLatch _hydrationLatch;
-
- protected Contexts _contexts;
-
- final BpelInstanceWorkerCache _instanceWorkerCache = new BpelInstanceWorkerCache(this);
-
- private final Set<InvocationStyle> _invocationStyles;
-
- private final BpelDAOConnectionFactoryImpl _inMemDao;
-
- final BpelServerImpl _server;
-
- private MyRoleMessageExchangeCache _myRoleMexCache;
+ protected final List<MessageExchangeInterceptor> _mexInterceptors = new ArrayList<MessageExchangeInterceptor>();
+ protected final BpelInstanceWorkerCache _instanceWorkerCache = new BpelInstanceWorkerCache(this);
/** Deploy-time configuraton for external variables. */
- private ExternalVariableConf _extVarConf;
+ protected ExternalVariableConf _extVarConf;
+ protected ExternalVariableManager _evm;
- private ExternalVariableManager _evm;
-
- ODEProcess(BpelServerImpl server, ProcessConf conf, BpelEventListener debugger, MyRoleMessageExchangeCache mexCache) {
+ ODEProcess(BpelServerImpl server, ProcessConf conf, BpelEventListener debugger) {
_server = server;
_pid = conf.getProcessId();
_pconf = conf;
- _hydrationLatch = new HydrationLatch();
_contexts = server._contexts;
_inMemDao = new BpelDAOConnectionFactoryImpl(_contexts.txManager);
- _myRoleMexCache = mexCache;
// TODO : do this on a per-partnerlink basis, support transacted styles.
HashSet<InvocationStyle> istyles = new HashSet<InvocationStyle>();
@@ -185,21 +149,27 @@
_evm = new ExternalVariableManager(_pid, _extVarConf, _contexts.externalVariableEngines);
}
+ public ExternalVariableManager getEVM() {
+ return _evm;
+ }
public String toString() {
return "ODEProcess[" + _pid + "]";
}
-
- public ExternalVariableManager getEVM() {
- return _evm;
- }
-
+
+ abstract void activate(Contexts contexts);
+ abstract void deactivate();
+
+ protected abstract void latch(int s);
+ protected abstract void releaseLatch(int s);
+ protected abstract boolean isLatched(int s);
+
void recoverActivity(ProcessInstanceDAO instanceDAO, final String channel, final long activityId, final String action,
final FaultInfo fault) {
if (__log.isDebugEnabled())
__log.debug("Recovering activity in process " + instanceDAO.getInstanceId() + " with action " + action);
- _hydrationLatch.latch(1);
+ latch(1);
try {
markused();
BpelInstanceWorker iworker = _instanceWorkerCache.get(instanceDAO.getInstanceId());
@@ -216,19 +186,18 @@
throw new BpelEngineException(e);
}
} finally {
- _hydrationLatch.release(1);
+ releaseLatch(1);
}
}
/**
* Entry point for message exchanges aimed at the my role.
- *
- * @param mex
+ * @param mexdao
*/
void invokeProcess(final MessageExchangeDAO mexdao) {
InvocationStyle istyle = mexdao.getInvocationStyle();
- _hydrationLatch.latch(1);
+ latch(1);
try {
// The following check is mostly for sanity purposes. MexImpls should prevent this from
// happening.
@@ -311,7 +280,7 @@
; // do nothing
}
} finally {
- _hydrationLatch.release(1);
+ releaseLatch(1);
// If we did not get an ACK during this method, then mark this MEX as needing an ASYNC wake-up
if (mexdao.getStatus() != Status.ACK) mexdao.setStatus(Status.ASYNC);
@@ -322,7 +291,7 @@
}
void executeCreateInstance(MessageExchangeDAO mexdao) {
- assert _hydrationLatch.isLatched(1);
+ assert isLatched(1);
BpelInstanceWorker worker = _instanceWorkerCache.get(mexdao.getInstance().getInstanceId());
assert worker.isWorkerThread();
@@ -332,7 +301,7 @@
}
void executeContinueInstanceMyRoleRequestReceived(MessageExchangeDAO mexdao) {
- assert _hydrationLatch.isLatched(1);
+ assert isLatched(1);
BpelInstanceWorker worker = _instanceWorkerCache.get(mexdao.getInstance().getInstanceId());
assert worker.isWorkerThread();
@@ -412,7 +381,7 @@
}
void executeContinueInstancePartnerRoleResponseReceived(MessageExchangeDAO mexdao) {
- assert _hydrationLatch.isLatched(1);
+ assert isLatched(1);
ProcessInstanceDAO instanceDao = mexdao.getInstance();
if (instanceDao == null)
throw new BpelEngineException("InternalError: No instance for partner mex " + mexdao);
@@ -448,16 +417,6 @@
}
}
- private PartnerLinkMyRoleImpl getMyRoleForService(QName serviceName) {
- assert _hydrationLatch.isLatched(1);
-
- for (Map.Entry<Endpoint, PartnerLinkMyRoleImpl> e : _endpointToMyRoleMap.entrySet()) {
- if (e.getKey().serviceName.equals(serviceName))
- return e.getValue();
- }
- return null;
- }
-
/**
* Process the message-exchange interceptors.
* @return <code>true</code> if execution should continue, <code>false</code> otherwise
@@ -585,57 +544,6 @@
.getMessageExchange(mexId);
}
- private void setRoles(ProcessModel oprocess) {
- _partnerRoles = new HashMap<PartnerLinkModel, PartnerLinkPartnerRoleImpl>();
- _myRoles = new HashMap<PartnerLinkModel, PartnerLinkMyRoleImpl>();
- _endpointToMyRoleMap = new HashMap<Endpoint, PartnerLinkMyRoleImpl>();
-
- // Create myRole endpoint name mapping (from deployment descriptor)
- HashMap<PartnerLinkModel, Endpoint> myRoleEndpoints = new HashMap<PartnerLinkModel, Endpoint>();
- for (Map.Entry<String, Endpoint> provide : _pconf.getProvideEndpoints().entrySet()) {
- PartnerLinkModel plink = oprocess.getPartnerLink(provide.getKey());
- if (plink == null) {
- String errmsg = "Error in deployment descriptor for process " + _pid + "; reference to unknown partner link "
- + provide.getKey();
- __log.error(errmsg);
- throw new BpelEngineException(errmsg);
- }
- myRoleEndpoints.put(plink, provide.getValue());
- }
-
- // Create partnerRole initial value mapping
- for (Map.Entry<String, Endpoint> invoke : _pconf.getInvokeEndpoints().entrySet()) {
- PartnerLinkModel plink = oprocess.getPartnerLink(invoke.getKey());
- if (plink == null) {
- String errmsg = "Error in deployment descriptor for process " + _pid + "; reference to unknown partner link "
- + invoke.getKey();
- __log.error(errmsg);
- throw new BpelEngineException(errmsg);
- }
- __log.debug("Processing <invoke> element for process " + _pid + ": partnerlink " + invoke.getKey() + " --> "
- + invoke.getValue());
- }
-
- for (PartnerLinkModel pl : oprocess.getAllPartnerLinks()) {
- if (pl.hasMyRole()) {
- Endpoint endpoint = myRoleEndpoints.get(pl);
- if (endpoint == null && pl.isInitializePartnerRoleSet())
- throw new IllegalArgumentException("No service name for myRole plink " + pl.getName());
- PartnerLinkMyRoleImpl myRole = new PartnerLinkMyRoleImpl(this, pl, endpoint);
- _myRoles.put(pl, myRole);
- _endpointToMyRoleMap.put(endpoint, myRole);
- }
-
- if (pl.hasPartnerRole()) {
- Endpoint endpoint = _pconf.getInvokeEndpoints().get(pl.getName());
- if (endpoint == null)
- throw new IllegalArgumentException(pl.getName() + " must be bound to an endpoint in deloy.xml");
- PartnerLinkPartnerRoleImpl partnerRole = new PartnerLinkPartnerRoleImpl(this, pl, endpoint);
- _partnerRoles.put(pl, partnerRole);
- }
- }
- }
-
ProcessDAO getProcessDAO() {
return isInMemory() ? _inMemDao.getConnection().getProcess(_pid) : _contexts.dao.getConnection().getProcess(_pid);
}
@@ -657,55 +565,10 @@
return endpoints;
}
- void activate(Contexts contexts) {
+ void activateResources(Contexts contexts) {
_contexts = contexts;
- _debugger = new DebuggerSupport(this);
-
- __log.debug("Activating " + _pid);
- // Activate all the my-role endpoints.
- for (Map.Entry<String, Endpoint> entry : _pconf.getProvideEndpoints().entrySet()) {
- Endpoint endpoint = entry.getValue();
- EndpointReference initialEPR = null;
- if (isShareable(endpoint)) {
- // Check if the EPR already exists for the given endpoint
- initialEPR = _sharedEps.getEndpointReference(endpoint);
- if (initialEPR == null) {
- // Create an EPR by physically activating the endpoint
- initialEPR = _contexts.bindingContext.activateMyRoleEndpoint(_pid, entry.getValue());
- _sharedEps.addEndpoint(endpoint, initialEPR);
- __log.debug("Activated " + _pid + " myrole " + entry.getKey() + ": EPR is " + initialEPR);
- }
- // Increment the reference count on the endpoint
- _sharedEps.incrementReferenceCount(endpoint);
- } else {
- // Create an EPR by physically activating the endpoint
- initialEPR = _contexts.bindingContext.activateMyRoleEndpoint(_pid, entry.getValue());
- __log.debug("Activated " + _pid + " myrole " + entry.getKey() + ": EPR is " + initialEPR);
- }
- _myEprs.put(endpoint, initialEPR);
- }
- __log.debug("Activated " + _pid);
-
- markused();
- }
+ __log.debug("Activating endpoints for " + _pid);
- void deactivate() {
- // Deactivate all the my-role endpoints.
- for (Endpoint endpoint : _myEprs.keySet()) {
- // Deactivate the EPR only if there are no more references
- // to this endpoint from any (active) BPEL process.
- if (isShareable(endpoint)) {
- __log.debug("deactivating shared endpoint " + endpoint);
- if (!_sharedEps.decrementReferenceCount(endpoint)) {
- _contexts.bindingContext.deactivateMyRoleEndpoint(endpoint);
- _sharedEps.removeEndpoint(endpoint);
- }
- } else {
- __log.debug("deactivating non-shared endpoint " + endpoint);
- _contexts.bindingContext.deactivateMyRoleEndpoint(endpoint);
- }
- }
- // TODO Deactivate all the partner-role channels
}
private boolean isShareable(Endpoint endpoint) {
@@ -716,41 +579,6 @@
return false;
}
- EndpointReference getInitialPartnerRoleEPR(PartnerLinkModel link) {
- _hydrationLatch.latch(1);
- try {
- PartnerLinkPartnerRoleImpl prole = _partnerRoles.get(link);
- if (prole == null)
- throw new IllegalStateException("Unknown partner link " + link);
- return prole.getInitialEPR();
- } finally {
- _hydrationLatch.release(1);
- }
- }
-
- Endpoint getInitialPartnerRoleEndpoint(PartnerLinkModel link) {
- _hydrationLatch.latch(1);
- try {
- PartnerLinkPartnerRoleImpl prole = _partnerRoles.get(link);
- if (prole == null)
- throw new IllegalStateException("Unknown partner link " + link);
- return prole._initialPartner;
- } finally {
- _hydrationLatch.release(1);
- }
- }
-
- EndpointReference getInitialMyRoleEPR(PartnerLinkModel link) {
- _hydrationLatch.latch(1);
- try {
- PartnerLinkMyRoleImpl myRole = _myRoles.get(link);
- if (myRole == null) throw new IllegalStateException("Unknown partner link " + link);
- return myRole.getInitialEPR();
- } finally {
- _hydrationLatch.release(1);
- }
- }
-
QName getPID() {
return _pid;
}
@@ -759,18 +587,6 @@
return _pconf.getType();
}
- PartnerRoleChannel getPartnerRoleChannel(PartnerLinkModel partnerLink) {
- _hydrationLatch.latch(1);
- try {
- PartnerLinkPartnerRoleImpl prole = _partnerRoles.get(partnerLink);
- if (prole == null)
- throw new IllegalStateException("Unknown partner link " + partnerLink);
- return prole._channel;
- } finally {
- _hydrationLatch.release(1);
- }
- }
-
public void saveEvent(ProcessInstanceEvent event, ProcessInstanceDAO instanceDao) {
markused();
if (instanceDao != null)
@@ -783,35 +599,29 @@
instanceDao.insertBpelEvent(event);
}
- /**
- * Ask the process to dehydrate.
- */
- void dehydrate() {
- _hydrationLatch.latch(0);
+ ProcessModel getProcessModel() {
+ latch(1);
try {
- // We don't actually need to do anything, the latch will run the doDehydrate method
- // when necessary..
+ return _processModel;
} finally {
- _hydrationLatch.release(0);
+ releaseLatch(1);
}
}
- void hydrate() {
- _hydrationLatch.latch(1);
+ MyRoleMessageExchange createNewMyRoleMex(final InvocationStyle istyle, final QName targetService, final String operation) {
+ final String mexId = new GUID().toString();
+ latch(1);
try {
- // We don't actually need to do anything, the latch will run the doHydrate method
- // when necessary..
- } finally {
- _hydrationLatch.release(1);
- }
- }
+ final PartnerLinkMyRoleImpl target = getPartnerLinkForService(targetService);
+ if (target == null)
+ throw new BpelEngineException("NoSuchService: " + targetService);
+ final Operation op = target._plinkDef.getMyRoleOperation(operation);
+ if (op == null)
+ throw new BpelEngineException("NoSuchOperation: " + operation);
- ProcessModel getProcessModel() {
- _hydrationLatch.latch(1);
- try {
- return _processModel;
+ return newMyRoleMex(istyle, mexId, target._endpoint.serviceName, target._plinkDef, op);
} finally {
- _hydrationLatch.release(1);
+ releaseLatch(1);
}
}
@@ -857,7 +667,7 @@
MyRoleMessageExchangeImpl recreateMyRoleMex(MessageExchangeDAO mexdao) {
InvocationStyle istyle = mexdao.getInvocationStyle();
- _hydrationLatch.latch(1);
+ latch(1);
try {
PartnerLinkModel plink = _processModel.getPartnerLink(mexdao.getPartnerLinkModelId());
if (plink == null) {
@@ -888,19 +698,19 @@
mex.load(mexdao);
return mex;
} finally {
- _hydrationLatch.release(1);
+ releaseLatch(1);
}
}
PartnerRoleMessageExchangeImpl createPartnerRoleMex(MessageExchangeDAO mexdao) {
- _hydrationLatch.latch(1);
+ latch(1);
try {
PartnerLinkModel plink = _processModel.getPartnerLink(mexdao.getPartnerLinkModelId());
PartnerLinkPartnerRoleImpl prole = _partnerRoles.get(plink);
return prole.createPartnerRoleMex(mexdao);
} finally {
- _hydrationLatch.release(1);
+ releaseLatch(1);
}
}
@@ -909,25 +719,6 @@
return _invocationStyles;
}
- /**
- * Find the partner-link-my-role that corresponds to the given service name.
- *
- * @param serviceName
- * name of service
- * @return corresponding {@link PartnerLinkMyRoleImpl}
- */
- private PartnerLinkMyRoleImpl getPartnerLinkForService(QName serviceName) {
- assert _hydrationLatch.isLatched(1);
-
- PartnerLinkMyRoleImpl target = null;
- for (Endpoint endpoint : _endpointToMyRoleMap.keySet())
- if (endpoint.serviceName.equals(serviceName))
- target = _endpointToMyRoleMap.get(endpoint);
-
- return target;
-
- }
-
public boolean isInMemory() {
return _pconf.isTransient();
}
@@ -952,7 +743,7 @@
* If necessary, create an object in the data store to represent the process. We'll re-use an existing object if it already
* exists and matches the GUID.
*/
- private void bounceProcessDAO(BpelDAOConnection conn, final QName pid, final long version, final ProcessModel mprocess) {
+ protected void bounceProcessDAO(BpelDAOConnection conn, final QName pid, final long version, final ProcessModel mprocess) {
__log.debug("Creating process DAO for " + pid + " (guid=" + mprocess.getGuid() + ")");
try {
boolean create = true;
@@ -1019,23 +810,6 @@
_server.enqueueRunnable(new ProcessRunnable(worker));
}
- MyRoleMessageExchange createNewMyRoleMex(final InvocationStyle istyle, final QName targetService, final String operation) {
- final String mexId = new GUID().toString();
- _hydrationLatch.latch(1);
- try {
- final PartnerLinkMyRoleImpl target = getPartnerLinkForService(targetService);
- if (target == null)
- throw new BpelEngineException("NoSuchService: " + targetService);
- final Operation op = target._plinkDef.getMyRoleOperation(operation);
- if (op == null)
- throw new BpelEngineException("NoSuchOperation: " + operation);
-
- return newMyRoleMex(istyle, mexId, target._endpoint.serviceName, target._plinkDef, op);
- } finally {
- _hydrationLatch.release(1);
- }
- }
-
void onMyRoleMexAck(MessageExchangeDAO mexdao, Status old) {
if (mexdao.getPipedMessageExchangeId() != null) /* p2p */{
ODEProcess caller = _server.getBpelProcess(mexdao.getPipedPID());
@@ -1100,11 +874,11 @@
_work = work;
}
public void run() {
- _hydrationLatch.latch(1);
+ latch(1);
try {
_work.run();
} finally {
- _hydrationLatch.release(1);
+ releaseLatch(1);
}
}
}
@@ -1117,107 +891,13 @@
}
public T call() throws Exception {
- _hydrationLatch.latch(1);
+ latch(1);
try {
return _work.call();
} finally {
- _hydrationLatch.release(1);
+ releaseLatch(1);
}
-
- }
-
- }
-
- class HydrationLatch extends NStateLatch {
-
- HydrationLatch() {
- super(new Runnable[2]);
- _transitions[0] = new Runnable() {
- public void run() {
- doDehydrate();
- }
- };
- _transitions[1] = new Runnable() {
- public void run() {
- doHydrate();
- }
- };
- }
-
- private void doDehydrate() {
- _processModel = null;
- _partnerRoles = null;
- _myRoles = null;
- _endpointToMyRoleMap = null;
}
-
- private void doHydrate() {
- markused();
- try {
- _processModel = deserializeCompiledProcess(_pconf.getCBPInputStream());
- } catch (Exception e) {
- String errmsg = "Error reloading compiled process " + _pconf.getProcessId() + "; the file appears to be corrupted.";
- __log.error(errmsg);
- throw new BpelEngineException(errmsg, e);
- }
- _runtime = buildRuntime(_processModel.getModelVersion());
- _runtime.init(_pconf, _processModel);
-
- setRoles(_processModel);
- initExternalVariables();
-
- if (!_hydratedOnce) {
- for (PartnerLinkPartnerRoleImpl prole : _partnerRoles.values()) {
- if (prole._initialPartner != null) {
- PartnerRoleChannel channel = _contexts.bindingContext.createPartnerRoleChannel(_pid,
- prole._plinkDef.getPartnerRolePortType(), prole._initialPartner);
- prole._channel = channel;
- _partnerChannels.put(prole._initialPartner, prole._channel);
- EndpointReference epr = channel.getInitialEndpointReference();
- if (epr != null) {
- prole._initialEPR = epr;
- _partnerEprs.put(prole._initialPartner, epr);
- }
- __log.debug("Activated " + _pid + " partnerrole " + prole.getPartnerLinkName() + ": EPR is "
- + prole._initialEPR);
- }
- }
- _hydratedOnce = true;
- }
-
- for (PartnerLinkMyRoleImpl myrole : _myRoles.values()) {
- myrole._initialEPR = _myEprs.get(myrole._endpoint);
- }
-
- for (PartnerLinkPartnerRoleImpl prole : _partnerRoles.values()) {
- prole._channel = _partnerChannels.get(prole._initialPartner);
- if (_partnerEprs.get(prole._initialPartner) != null) {
- prole._initialEPR = _partnerEprs.get(prole._initialPartner);
- }
- }
-
- if (isInMemory()) {
- bounceProcessDAO(_inMemDao.getConnection(), _pid, _pconf.getVersion(), _processModel);
- } else if (_contexts.isTransacted()) {
- // If we have a transaction, we do this in the current transaction.
- bounceProcessDAO(_contexts.dao.getConnection(), _pid, _pconf.getVersion(), _processModel);
- } else {
- // If we do not have a transaction we need to create one.
- try {
- _contexts.execTransaction(new Callable<Object>() {
- public Object call() throws Exception {
- bounceProcessDAO(_contexts.dao.getConnection(), _pid, _pconf.getVersion(), _processModel);
- return null;
- }
- });
- } catch (Exception ex) {
- String errmsg = "DbError";
- __log.error(errmsg, ex);
- throw new BpelEngineException(errmsg, ex);
- }
- }
- }
-
}
public String scheduleWorkEvent(WorkEvent we, Date timeToFire) {
Added: ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/ODERestfulProcess.java
URL: http://svn.apache.org/viewvc/ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/ODERestfulProcess.java?rev=706117&view=auto
==============================================================================
--- ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/ODERestfulProcess.java (added)
+++ ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/ODERestfulProcess.java Sun Oct 19 21:07:11 2008
@@ -0,0 +1,10 @@
+package org.apache.ode.bpel.engine;
+
+public class ODERestfulProcess extends ODEProcess {
+
+
+ // Restful processes don't lazy load their OModel, they need it right away
+ protected void latch(int s) { }
+ protected void releaseLatch(int s) { }
+ protected boolean isLatched(int s) { return false; }
+}
Added: ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/ODEWSProcess.java
URL: http://svn.apache.org/viewvc/ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/ODEWSProcess.java?rev=706117&view=auto
==============================================================================
--- ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/ODEWSProcess.java (added)
+++ ode/branches/restful/engine/src/main/java/org/apache/ode/bpel/engine/ODEWSProcess.java Sun Oct 19 21:07:11 2008
@@ -0,0 +1,350 @@
+package org.apache.ode.bpel.engine;
+
+import org.apache.ode.bpel.rapi.PartnerLinkModel;
+import org.apache.ode.bpel.rapi.ProcessModel;
+import org.apache.ode.bpel.iapi.*;
+import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
+
+import javax.xml.namespace.QName;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Collections;
+import java.util.concurrent.Callable;
+
+public class ODEWSProcess extends ODEProcess {
+
+ private volatile Map<PartnerLinkModel, PartnerLinkPartnerRoleImpl> _partnerRoles;
+
+ private volatile Map<PartnerLinkModel, PartnerLinkMyRoleImpl> _myRoles;
+
+ /** Mapping from {"Service Name" (QNAME) / port} to a myrole. */
+ private volatile Map<Endpoint, PartnerLinkMyRoleImpl> _endpointToMyRoleMap;
+
+ // Backup hashmaps to keep initial endpoints handy after dehydration
+ private Map<Endpoint, EndpointReference> _myEprs = new HashMap<Endpoint, EndpointReference>();
+
+ private Map<Endpoint, EndpointReference> _partnerEprs = new HashMap<Endpoint, EndpointReference>();
+
+ private Map<Endpoint, PartnerRoleChannel> _partnerChannels = new HashMap<Endpoint, PartnerRoleChannel>();
+
+ /** Mapping from a potentially shared endpoint to its EPR */
+ private SharedEndpoints _sharedEps;
+
+ // Has the process already been hydrated before?
+ private boolean _hydratedOnce = false;
+
+ /** Latch-like thing to control hydration/dehydration. */
+ HydrationLatch _hydrationLatch;
+
+ private MyRoleMessageExchangeCache _myRoleMexCache;
+
+ ODEWSProcess(BpelServerImpl server, ProcessConf conf, BpelEventListener debugger, MyRoleMessageExchangeCache mexCache) {
+ super(server, conf, debugger);
+ _hydrationLatch = new HydrationLatch();
+ _myRoleMexCache = mexCache;
+ }
+
+ private PartnerLinkMyRoleImpl getMyRoleForService(QName serviceName) {
+ assert isLatched(1);
+ for (Map.Entry<Endpoint, PartnerLinkMyRoleImpl> e : _endpointToMyRoleMap.entrySet()) {
+ if (e.getKey().serviceName.equals(serviceName))
+ return e.getValue();
+ }
+ return null;
+ }
+
+ void activate(Contexts contexts) {
+ _contexts = contexts;
+ _debugger = new DebuggerSupport(this);
+
+ __log.debug("Activating endpoints for " + _pid);
+ // Activate all the my-role endpoints.
+ for (Map.Entry<String, Endpoint> entry : _pconf.getProvideEndpoints().entrySet()) {
+ Endpoint endpoint = entry.getValue();
+ EndpointReference initialEPR = null;
+ if (isShareable(endpoint)) {
+ // Check if the EPR already exists for the given endpoint
+ initialEPR = _sharedEps.getEndpointReference(endpoint);
+ if (initialEPR == null) {
+ // Create an EPR by physically activating the endpoint
+ initialEPR = _contexts.bindingContext.activateMyRoleEndpoint(_pid, entry.getValue());
+ _sharedEps.addEndpoint(endpoint, initialEPR);
+ __log.debug("Activated " + _pid + " myrole " + entry.getKey() + ": EPR is " + initialEPR);
+ }
+ // Increment the reference count on the endpoint
+ _sharedEps.incrementReferenceCount(endpoint);
+ } else {
+ // Create an EPR by physically activating the endpoint
+ initialEPR = _contexts.bindingContext.activateMyRoleEndpoint(_pid, entry.getValue());
+ __log.debug("Activated " + _pid + " myrole " + entry.getKey() + ": EPR is " + initialEPR);
+ }
+ _myEprs.put(endpoint, initialEPR);
+ }
+ __log.debug("Activated " + _pid);
+
+ markused();
+ }
+
+ void deactivate() {
+ // Deactivate all the my-role endpoints.
+ for (Endpoint endpoint : _myEprs.keySet()) {
+ // Deactivate the EPR only if there are no more references
+ // to this endpoint from any (active) BPEL process.
+ if (isShareable(endpoint)) {
+ __log.debug("deactivating shared endpoint " + endpoint);
+ if (!_sharedEps.decrementReferenceCount(endpoint)) {
+ _contexts.bindingContext.deactivateMyRoleEndpoint(endpoint);
+ _sharedEps.removeEndpoint(endpoint);
+ }
+ } else {
+ __log.debug("deactivating non-shared endpoint " + endpoint);
+ _contexts.bindingContext.deactivateMyRoleEndpoint(endpoint);
+ }
+ }
+ // TODO Deactivate all the partner-role channels
+ }
+
+ EndpointReference getInitialPartnerRoleEPR(PartnerLinkModel link) {
+ latch(1);
+ try {
+ PartnerLinkPartnerRoleImpl prole = _partnerRoles.get(link);
+ if (prole == null)
+ throw new IllegalStateException("Unknown partner link " + link);
+ return prole.getInitialEPR();
+ } finally {
+ releaseLatch(1);
+ }
+ }
+
+ Endpoint getInitialPartnerRoleEndpoint(PartnerLinkModel link) {
+ latch(1);
+ try {
+ PartnerLinkPartnerRoleImpl prole = _partnerRoles.get(link);
+ if (prole == null)
+ throw new IllegalStateException("Unknown partner link " + link);
+ return prole._initialPartner;
+ } finally {
+ releaseLatch(1);
+ }
+ }
+
+ EndpointReference getInitialMyRoleEPR(PartnerLinkModel link) {
+ latch(1);
+ try {
+ PartnerLinkMyRoleImpl myRole = _myRoles.get(link);
+ if (myRole == null) throw new IllegalStateException("Unknown partner link " + link);
+ return myRole.getInitialEPR();
+ } finally {
+ releaseLatch(1);
+ }
+ }
+
+ PartnerRoleChannel getPartnerRoleChannel(PartnerLinkModel partnerLink) {
+ latch(1);
+ try {
+ PartnerLinkPartnerRoleImpl prole = _partnerRoles.get(partnerLink);
+ if (prole == null)
+ throw new IllegalStateException("Unknown partner link " + partnerLink);
+ return prole._channel;
+ } finally {
+ releaseLatch(1);
+ }
+ }
+
+ /**
+ * Find the partner-link-my-role that corresponds to the given service name.
+ *
+ * @param serviceName
+ * name of service
+ * @return corresponding {@link PartnerLinkMyRoleImpl}
+ */
+ private PartnerLinkMyRoleImpl getPartnerLinkForService(QName serviceName) {
+ assert isLatched(1);
+
+ PartnerLinkMyRoleImpl target = null;
+ for (Endpoint endpoint : _endpointToMyRoleMap.keySet())
+ if (endpoint.serviceName.equals(serviceName))
+ target = _endpointToMyRoleMap.get(endpoint);
+
+ return target;
+
+ }
+
+ private void setRoles(ProcessModel oprocess) {
+ _partnerRoles = new HashMap<PartnerLinkModel, PartnerLinkPartnerRoleImpl>();
+ _myRoles = new HashMap<PartnerLinkModel, PartnerLinkMyRoleImpl>();
+ _endpointToMyRoleMap = new HashMap<Endpoint, PartnerLinkMyRoleImpl>();
+
+ // Create myRole endpoint name mapping (from deployment descriptor)
+ HashMap<PartnerLinkModel, Endpoint> myRoleEndpoints = new HashMap<PartnerLinkModel, Endpoint>();
+ for (Map.Entry<String, Endpoint> provide : _pconf.getProvideEndpoints().entrySet()) {
+ PartnerLinkModel plink = oprocess.getPartnerLink(provide.getKey());
+ if (plink == null) {
+ String errmsg = "Error in deployment descriptor for process " + _pid + "; reference to unknown partner link "
+ + provide.getKey();
+ __log.error(errmsg);
+ throw new BpelEngineException(errmsg);
+ }
+ myRoleEndpoints.put(plink, provide.getValue());
+ }
+
+ // Create partnerRole initial value mapping
+ for (Map.Entry<String, Endpoint> invoke : _pconf.getInvokeEndpoints().entrySet()) {
+ PartnerLinkModel plink = oprocess.getPartnerLink(invoke.getKey());
+ if (plink == null) {
+ String errmsg = "Error in deployment descriptor for process " + _pid + "; reference to unknown partner link "
+ + invoke.getKey();
+ __log.error(errmsg);
+ throw new BpelEngineException(errmsg);
+ }
+ __log.debug("Processing <invoke> element for process " + _pid + ": partnerlink " + invoke.getKey() + " --> "
+ + invoke.getValue());
+ }
+
+ for (PartnerLinkModel pl : oprocess.getAllPartnerLinks()) {
+ if (pl.hasMyRole()) {
+ Endpoint endpoint = myRoleEndpoints.get(pl);
+ if (endpoint == null && pl.isInitializePartnerRoleSet())
+ throw new IllegalArgumentException("No service name for myRole plink " + pl.getName());
+ PartnerLinkMyRoleImpl myRole = new PartnerLinkMyRoleImpl(this, pl, endpoint);
+ _myRoles.put(pl, myRole);
+ _endpointToMyRoleMap.put(endpoint, myRole);
+ }
+
+ if (pl.hasPartnerRole()) {
+ Endpoint endpoint = _pconf.getInvokeEndpoints().get(pl.getName());
+ if (endpoint == null)
+ throw new IllegalArgumentException(pl.getName() + " must be bound to an endpoint in deloy.xml");
+ PartnerLinkPartnerRoleImpl partnerRole = new PartnerLinkPartnerRoleImpl(this, pl, endpoint);
+ _partnerRoles.put(pl, partnerRole);
+ }
+ }
+ }
+
+ protected void latch(int s) {
+ _hydrationLatch.latch(s);
+ }
+ protected void releaseLatch(int s) {
+ _hydrationLatch.release(s);
+ }
+ protected boolean isLatched(int s) {
+ return _hydrationLatch.isLatched(s);
+ }
+
+ class HydrationLatch extends NStateLatch {
+
+ HydrationLatch() {
+ super(new Runnable[2]);
+ _transitions[0] = new Runnable() {
+ public void run() {
+ doDehydrate();
+ }
+ };
+ _transitions[1] = new Runnable() {
+ public void run() {
+ doHydrate();
+ }
+ };
+ }
+
+ private void doDehydrate() {
+ _processModel = null;
+ _partnerRoles = null;
+ _myRoles = null;
+ _endpointToMyRoleMap = null;
+ }
+
+ private void doHydrate() {
+ markused();
+ try {
+ _processModel = deserializeCompiledProcess(_pconf.getCBPInputStream());
+ } catch (Exception e) {
+ String errmsg = "Error reloading compiled process " + _pconf.getProcessId() + "; the file appears to be corrupted.";
+ __log.error(errmsg);
+ throw new BpelEngineException(errmsg, e);
+ }
+ _runtime = buildRuntime(_processModel.getModelVersion());
+ _runtime.init(_pconf, _processModel);
+
+ setRoles(_processModel);
+ initExternalVariables();
+
+ if (!_hydratedOnce) {
+ for (PartnerLinkPartnerRoleImpl prole : _partnerRoles.values()) {
+ if (prole._initialPartner != null) {
+ PartnerRoleChannel channel = _contexts.bindingContext.createPartnerRoleChannel(_pid,
+ prole._plinkDef.getPartnerRolePortType(), prole._initialPartner);
+ prole._channel = channel;
+ _partnerChannels.put(prole._initialPartner, prole._channel);
+ EndpointReference epr = channel.getInitialEndpointReference();
+ if (epr != null) {
+ prole._initialEPR = epr;
+ _partnerEprs.put(prole._initialPartner, epr);
+ }
+ __log.debug("Activated " + _pid + " partnerrole " + prole.getPartnerLinkName() + ": EPR is "
+ + prole._initialEPR);
+ }
+ }
+ _hydratedOnce = true;
+ }
+
+ for (PartnerLinkMyRoleImpl myrole : _myRoles.values()) {
+ myrole._initialEPR = _myEprs.get(myrole._endpoint);
+ }
+
+ for (PartnerLinkPartnerRoleImpl prole : _partnerRoles.values()) {
+ prole._channel = _partnerChannels.get(prole._initialPartner);
+ if (_partnerEprs.get(prole._initialPartner) != null) {
+ prole._initialEPR = _partnerEprs.get(prole._initialPartner);
+ }
+ }
+
+ if (isInMemory()) {
+ bounceProcessDAO(_inMemDao.getConnection(), _pid, _pconf.getVersion(), _processModel);
+ } else if (_contexts.isTransacted()) {
+ // If we have a transaction, we do this in the current transaction.
+ bounceProcessDAO(_contexts.dao.getConnection(), _pid, _pconf.getVersion(), _processModel);
+ } else {
+ // If we do not have a transaction we need to create one.
+ try {
+ _contexts.execTransaction(new Callable<Object>() {
+ public Object call() throws Exception {
+ bounceProcessDAO(_contexts.dao.getConnection(), _pid, _pconf.getVersion(), _processModel);
+ return null;
+ }
+ });
+ } catch (Exception ex) {
+ String errmsg = "DbError";
+ __log.error(errmsg, ex);
+ throw new BpelEngineException(errmsg, ex);
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Ask the process to dehydrate.
+ */
+ void dehydrate() {
+ _hydrationLatch.latch(0);
+ try {
+ // We don't actually need to do anything, the latch will run the doDehydrate method
+ // when necessary..
+ } finally {
+ _hydrationLatch.release(0);
+ }
+ }
+
+ void hydrate() {
+ _hydrationLatch.latch(1);
+ try {
+ // We don't actually need to do anything, the latch will run the doHydrate method
+ // when necessary..
+ } finally {
+ _hydrationLatch.release(1);
+ }
+ }
+
+}
Modified: ode/branches/restful/il-common/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java
URL: http://svn.apache.org/viewvc/ode/branches/restful/il-common/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java?rev=706117&r1=706116&r2=706117&view=diff
==============================================================================
--- ode/branches/restful/il-common/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java (original)
+++ ode/branches/restful/il-common/src/main/java/org/apache/ode/il/config/OdeConfigProperties.java Sun Oct 19 21:07:11 2008
@@ -48,7 +48,6 @@
public static final String PROP_DB_INTERNAL_URL = "db.int.jdbcurl";
-
public static final String PROP_DB_INTERNAL_DRIVER = "db.int.driver";
public static final String PROP_DB_INTERNAL_PASSWORD = "db.int.password";
Added: ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OCollect.java
URL: http://svn.apache.org/viewvc/ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OCollect.java?rev=706117&view=auto
==============================================================================
--- ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OCollect.java (added)
+++ ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OCollect.java Sun Oct 19 21:07:11 2008
@@ -0,0 +1,30 @@
+package org.apache.ode.bpel.rtrep.v2;
+
+/**
+ * RESTful read activity. Provides an idempotent GET method on a given resource.
+ */
+public class OCollect extends OActivity {
+
+ private OResource resource;
+ private OScope.Variable variable;
+
+ public OCollect(OProcess owner, OActivity parent) {
+ super(owner, parent);
+ }
+
+ public OResource getResource() {
+ return resource;
+ }
+
+ public void setResource(OResource resource) {
+ this.resource = resource;
+ }
+
+ public OScope.Variable getVariable() {
+ return variable;
+ }
+
+ public void setVariable(OScope.Variable variable) {
+ this.variable = variable;
+ }
+}
Modified: ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OPickReceive.java
URL: http://svn.apache.org/viewvc/ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OPickReceive.java?rev=706117&r1=706116&r2=706117&view=diff
==============================================================================
--- ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OPickReceive.java (original)
+++ ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OPickReceive.java Sun Oct 19 21:07:11 2008
@@ -62,6 +62,7 @@
/** Correlation set to match on. */
public OScope.CorrelationSet matchCorrelation;
+ public OResource resource;
public OPartnerLink partnerLink;
public Operation operation;
public OScope.Variable variable;
@@ -77,5 +78,9 @@
public String getCorrelatorId() {
return partnerLink.getId() + "." + operation.getName();
}
+
+ public boolean isRestful() {
+ return partnerLink == null && resource != null;
+ }
}
}
Modified: ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OProcess.java
URL: http://svn.apache.org/viewvc/ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OProcess.java?rev=706117&r1=706116&r2=706117&view=diff
==============================================================================
--- ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OProcess.java (original)
+++ ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OProcess.java Sun Oct 19 21:07:11 2008
@@ -58,9 +58,16 @@
/** ProcessImpl-level scope. */
public OScope processScope;
+ /** First receive met during the compilation of the process. Serves as a hint when the instantiating
+ * receive isn't explicitly specified (optional in simpel). */
+ public OActivity firstReceive;
+
/** All partner links in the process. */
public final Set<PartnerLinkModel> allPartnerLinks = new HashSet<PartnerLinkModel>();
+ /** All web resources in the process. */
+ public final Set<OResource> allResources = new HashSet<OResource>();
+
public final List<OProperty> properties = new ArrayList<OProperty>();
/** All declared extensions in the process. **/
@@ -114,7 +121,6 @@
throw new UnsupportedOperationException();
}
-
public Set<PartnerLinkModel> getAllPartnerLinks() {
return Collections.unmodifiableSet(allPartnerLinks);
}
@@ -126,6 +132,10 @@
return null;
}
+ public Set<OResource> getAllResources() {
+ return Collections.unmodifiableSet(allResources);
+ }
+
public PartnerLinkModel getPartnerLink(int partnerLinkModelId) {
return (PartnerLinkModel) getChild(partnerLinkModelId);
}
Modified: ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OReply.java
URL: http://svn.apache.org/viewvc/ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OReply.java?rev=706117&r1=706116&r2=706117&view=diff
==============================================================================
--- ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OReply.java (original)
+++ ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OReply.java Sun Oct 19 21:07:11 2008
@@ -37,6 +37,8 @@
/** The type of the fault (if isFaultReply). */
public QName fault;
+ public OResource resource;
+
public OPartnerLink partnerLink;
public Operation operation;
public OScope.Variable variable;
Added: ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OResource.java
URL: http://svn.apache.org/viewvc/ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OResource.java?rev=706117&view=auto
==============================================================================
--- ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OResource.java (added)
+++ ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OResource.java Sun Oct 19 21:07:11 2008
@@ -0,0 +1,40 @@
+package org.apache.ode.bpel.rtrep.v2;
+
+/**
+ * RESTful resource representation at the process level
+ */
+public class OResource extends OBase {
+
+ private String name;
+ private OExpression subpath;
+ private OResource reference;
+
+ public OResource(OProcess owner) {
+ super(owner);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public OExpression getSubpath() {
+ return subpath;
+ }
+
+ public void setSubpath(OExpression subpath) {
+ this.subpath = subpath;
+ }
+
+ public OResource getReference() {
+ return reference;
+ }
+
+ public void setReference(OResource reference) {
+ this.reference = reference;
+ }
+
+}
Modified: ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OScope.java
URL: http://svn.apache.org/viewvc/ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OScope.java?rev=706117&r1=706116&r2=706117&view=diff
==============================================================================
--- ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OScope.java (original)
+++ ode/branches/restful/runtimes/src/main/java/org/apache/ode/bpel/rtrep/v2/OScope.java Sun Oct 19 21:07:11 2008
@@ -60,6 +60,9 @@
/** Variables declared within the scope. */
public final HashMap<String,Variable> variables = new HashMap<String,Variable>();
+ /** Resources declared within the scope. */
+ public final HashMap<String,OResource> resource = new HashMap<String,OResource>();
+
/** OCorrelation sets declared within the scope. */
public final Map<String,CorrelationSet> correlationSets = new HashMap<String, CorrelationSet>();
Modified: ode/branches/restful/utils/src/main/java/org/apache/ode/utils/xsd/SchemaModelImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/restful/utils/src/main/java/org/apache/ode/utils/xsd/SchemaModelImpl.java?rev=706117&r1=706116&r2=706117&view=diff
==============================================================================
--- ode/branches/restful/utils/src/main/java/org/apache/ode/utils/xsd/SchemaModelImpl.java (original)
+++ ode/branches/restful/utils/src/main/java/org/apache/ode/utils/xsd/SchemaModelImpl.java Sun Oct 19 21:07:11 2008
@@ -98,19 +98,11 @@
private static class SchemaErrorHandler implements DOMErrorHandler {
public boolean handleError(DOMError error) {
- boolean isWarning = (error.getSeverity() == DOMError.SEVERITY_WARNING);
- if (isWarning) {
- __log.warn("Schema error", ((Exception)error.getRelatedException()));
- __log.warn(error.getLocation().getUri() + ":" + error.getLocation().getLineNumber());
- __log.warn(error.getRelatedData());
- __log.warn(error.getRelatedException());
- } else {
- __log.error("Schema error", ((Exception)error.getRelatedException()));
- __log.error(error.getLocation().getUri() + ":" + error.getLocation().getLineNumber());
- __log.error(error.getRelatedData());
- __log.error(error.getRelatedException());
- }
- return isWarning;
+ __log.warn("Schema error", ((Exception)error.getRelatedException()));
+ __log.warn(error.getLocation().getUri() + ":" + error.getLocation().getLineNumber());
+ __log.warn(error.getRelatedData());
+ __log.warn(error.getRelatedException());
+ return true;
}
}