ode-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Viraf Bankwalla <viraf_bankwa...@yahoo.com>
Subject Adding Business Relevant Data to Events
Date Fri, 26 Jan 2007 19:19:16 GMT
      There is a need to determine the state of a process and provide metrics on the process.
 The current implementation of ODE provides the mechanism by which to emit events (as defined
in ODE Execution Events), and notify observers of the event.  The event structure lacks the
process context (“VariableData’) that may be needed by observers.  I would like to propose
that ‘variableData’ be added to the ‘ScopeEvent’ so that observers have business context.
 Your feedback on the proposed changes would be appreciated. 
   
  1.      The ScopeEvent would be updated to include
   
        private HashMap<String, String> variableData;
   
  2.      Populate variableData
  All events get fired from ACTIVITY object.  The following retrieves variable data and populates
variableData in the scope object.  
   
  In org.apache.ode.bpel.runtime.ACTIVITY replace the code for sendEvent(ScopeEvent event)
with the following code
   
  protected void sendEvent(ScopeEvent event)      
  {
      if (event.getLineNo() == -1 && _self.o.debugInfo != null) 
      {
          event.setLineNo(_self.o.debugInfo.startLine);
      }
      _scopeFrame.fillEventInfo(event);
      fillVariableInfo(event);   // Add variableData to ScopeEvent
      getBpelRuntimeContext().sendEvent(event);
  }
   
  /**
  * Adds process context to the ScopeEvent as variableData
  *
   * @param event The ScopeEvent to which the process context is to be added
   */
  protected void fillVariableInfo(ScopeEvent event)
  {
      HashMap<String,String> variableData = new HashMap<String,String>();
      Iterator<String> variableNames = _scopeFrame.oscope.variables.keySet().iterator();
      while(variableNames.hasNext())
      {
          String name = variableNames.next();
          String value = "";
          Variable var = _scopeFrame.oscope.variables.get(name);
          VariableInstance varInst = _scopeFrame.resolve(var);
          try 
          {
              Node varNode = getBpelRuntimeContext().fetchVariableData(varInst, false);
              value = DOMUtils.domToString(varNode);
          } 
          catch (FaultException e) 
          {
          }
          variableData.put(name, value);
        }
    event.setVariableData(variableData);
  }
  

Look forward to your commnets.
 Thanks
- viraf

  
 
---------------------------------
Have a burning question? Go to Yahoo! Answers and get answers from real people who know.
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message