コード例 #1
0
 public void commitChanges(VariableInstance var, ScopeFrame scopeFrame, Node value)
     throws ExternalVariableModuleException {
   if (var.declaration.extVar != null) /* external variable */ {
     if (__log.isDebugEnabled())
       __log.debug(
           "Write external variable: name="
               + var.declaration
               + " value="
               + DOMUtils.domToString(value));
     VariableInstance related = scopeFrame.resolve(var.declaration.extVar.related);
     Node reference = null;
     try {
       reference = fetchVariableData(var, scopeFrame, true);
     } catch (FaultException fe) {
       // In this context this is not necessarily a problem, since the assignment may re-init the
       // related var
     }
     VariableContext.ValueReferencePair vrp = _brc.writeExtVar(var, reference, value);
     commitChanges(related, scopeFrame, vrp.reference);
   } else /* normal variable */ {
     if (__log.isDebugEnabled())
       __log.debug(
           "Write variable: name=" + var.declaration + " value=" + DOMUtils.domToString(value));
     _brc.commitChanges(var, value);
   }
   writeProperties(var, value);
 }
コード例 #2
0
 /**
  * Proxy to {@link OdeRTInstanceContext#initializeVariable(Variable, Node)} then write properties.
  */
 public Node initializeVariable(VariableInstance var, ScopeFrame scopeFrame, Node val)
     throws ExternalVariableModuleException {
   try {
     if (var.declaration.extVar != null) /* external variable */ {
       if (__log.isDebugEnabled())
         __log.debug(
             "Initialize external variable: name="
                 + var.declaration
                 + " value="
                 + DOMUtils.domToString(val));
       Node reference = null;
       try {
         reference = fetchVariableData(var, scopeFrame, true);
       } catch (FaultException fe) {
         // In this context this is not necessarily a problem, since the assignment may re-init the
         // related var
       }
       if (reference != null) val = _brc.readExtVar(var, reference);
       return val;
     } else /* normal variable */ {
       if (__log.isDebugEnabled())
         __log.debug(
             "Initialize variable: name="
                 + var.declaration
                 + " value="
                 + DOMUtils.domToString(val));
       return _brc.initializeVariable(var, val);
     }
   } finally {
     writeProperties(var, val);
   }
 }
コード例 #3
0
 public Node fetchVariableData(
     VariableInstance variable, ScopeFrame scopeFrame, boolean forWriting) throws FaultException {
   if (variable.declaration.extVar != null) {
     // Note, that when using external variables, the database will not contain the value of the
     // variable, instead we need to go the external variable subsystems.
     Element reference =
         (Element)
             _brc.fetchVariableData(
                 scopeFrame.resolve(variable.declaration.extVar.related), false);
     try {
       Node ret = _brc.readExtVar(variable, reference);
       if (ret == null) {
         throw new FaultException(
             _runtime._oprocess.constants.qnUninitializedVariable,
             "The external variable \""
                 + variable.declaration.name
                 + "\" has not been initialized.");
       }
       return ret;
     } catch (IncompleteKeyException ike) {
       // This indicates that the external variable needed to be written do, put has not been.
       __log.error(
           "External variable could not be read due to incomplete key; the following key "
               + "components were missing: "
               + ike.getMissing());
       throw new FaultException(
           _runtime._oprocess.constants.qnUninitializedVariable,
           "The extenral variable \""
               + variable.declaration.name
               + "\" has not been properly initialized;"
               + "the following key compoenents were missing:"
               + ike.getMissing());
     } catch (ExternalVariableModuleException e) {
       throw new BpelEngineException(e);
     }
   } else /* not external */ {
     Node data = _brc.fetchVariableData(variable, forWriting);
     if (data == null) {
       // Special case of messageType variables with no part
       if (variable.declaration.type instanceof OMessageVarType) {
         OMessageVarType msgType = (OMessageVarType) variable.declaration.type;
         if (msgType.parts.size() == 0) {
           Document doc = DOMUtils.newDocument();
           Element root = doc.createElement("message");
           doc.appendChild(root);
           return root;
         }
       }
       throw new FaultException(
           _runtime._oprocess.constants.qnUninitializedVariable,
           "The variable " + variable.declaration.name + " isn't properly initialized.");
     }
     return data;
   }
 }
コード例 #4
0
 /** Record all values of properties of a 'MessageType' variable for efficient lookup. */
 private void writeProperties(VariableInstance variable, Node value) {
   if (variable.declaration.type instanceof OMessageVarType) {
     for (OProcess.OProperty property : variable.declaration.getOwner().properties) {
       OProcess.OPropertyAlias alias = property.getAlias(variable.declaration.type);
       if (alias != null) {
         try {
           String val =
               extractProperty((Element) value, alias, variable.declaration.getDescription());
           if (val != null) _brc.writeVariableProperty(variable, property.name, val);
         } catch (UninitializedVariableException uve) {
           // This really should not happen, since we are writing to a variable that we just
           // modified.
           __log.fatal(
               "Couldn't extract property '"
                   + property.toString()
                   + "' in property pre-extraction: "
                   + uve);
           throw new RuntimeException(uve);
         } catch (FaultException e) {
           // This will fail as we're basically trying to extract properties on all received
           // messages
           // for optimization purposes.
           if (__log.isDebugEnabled())
             __log.debug(
                 "Couldn't extract property '"
                     + property.toString()
                     + "' in property pre-extraction: "
                     + e.toString());
         }
       }
     }
   }
 }
コード例 #5
0
 /** Called when the process completes to clean up any outstanding message exchanges. */
 private void cleanupOutstandingMyRoleExchanges(FaultInfo optionalFaultData) {
   // TODO: all this should be moved into the engine. We don't really need the ORM to find
   // these mexs, we can just scan the database
   String[] mexRefs = getORM().releaseAll();
   for (String mexId : mexRefs) {
     _brc.noreply(mexId, optionalFaultData);
   }
 }
コード例 #6
0
 /** Proxy to {@link VariableContext#readVariableProperty(Variable, QName)}. */
 public String readProperty(VariableInstance variable, OProcess.OProperty property)
     throws FaultException {
   try {
     return _brc.readVariableProperty(variable, property.name);
   } catch (UninitializedVariableException e) {
     throw new FaultException(_runtime._oprocess.constants.qnUninitializedVariable);
   }
 }
コード例 #7
0
  public Node fetchPartnerRoleEndpointReferenceData(PartnerLinkInstance link)
      throws FaultException {
    Element epr = _brc.fetchPartnerRoleEndpointReferenceData(link);
    if (epr == null) {
      throw new FaultException(_runtime._oprocess.constants.qnUninitializedPartnerRole);
    }

    return epr;
  }
コード例 #8
0
 /**
  * Proxy to {@link RecoveryContext#registerActivityForRecovery(String, long, String, Date,
  * Element, String[], int)}.
  */
 public void registerActivityForRecovery(
     ActivityRecoveryChannel recoveryChannel,
     long id,
     String reason,
     Date dateTime,
     Element details,
     String[] actions,
     int retryCount) {
   _brc.registerActivityForRecovery(
       recoveryChannel.export(), id, reason, dateTime, details, actions, retryCount);
 }
コード例 #9
0
  public void writeCorrelation(CorrelationSetInstance cset, CorrelationKey ckeyVal)
      throws FaultException {
    OScope.CorrelationSet csetdef = cset.declaration;
    QName[] propNames = new QName[csetdef.properties.size()];
    for (int m = 0; m < csetdef.properties.size(); m++) {
      OProcess.OProperty oProperty = csetdef.properties.get(m);
      propNames[m] = oProperty.name;
    }

    ckeyVal.setUnique(cset.declaration.isUnique());
    _brc.writeCorrelation(cset, propNames, ckeyVal);
  }
コード例 #10
0
 /**
  * @param instance
  * @param operation
  * @param outboundMsg
  * @param object
  */
 public String invoke(
     String invokeId,
     PartnerLinkInstance instance,
     Operation operation,
     Element outboundMsg,
     Object object)
     throws FaultException {
   try {
     return _brc.invoke(invokeId, instance, operation, outboundMsg);
   } catch (UninitializedPartnerEPR e) {
     throw new FaultException(_runtime._oprocess.constants.qnUninitializedPartnerRole);
   }
 }
コード例 #11
0
  /** Proxy to {@link IOContext#reply(PartnerLink, String, String, Element, QName) }. */
  public void reply(
      PartnerLinkInstance plink, String opName, String bpelmex, Element element, QName fault)
      throws FaultException {
    String mexid = getORM().release(plink, opName, bpelmex);
    if (mexid == null) throw new FaultException(_runtime._oprocess.constants.qnMissingRequest);

    try {
      _brc.reply(mexid, plink, opName, element, fault);
    } catch (NoSuchOperationException e) {
      // reply to operation that is either not defined or one-way. Perhaps this should be detected
      // at compile time?
      throw new FaultException(
          _runtime._oprocess.constants.qnMissingRequest,
          "Undefined two-way operation \"" + opName + "\".");
    }
  }
コード例 #12
0
  /** Proxy to {@link BpelRuntimeContext# }. */
  public void cancel(PickResponseChannel responseChannel) {
    final String id = responseChannel.export();
    _brc.cancelSelect(id);

    getORM().cancel(id);

    _vpu.inject(
        new JacobRunnable() {
          private static final long serialVersionUID = 6157913683737696396L;

          public void run() {
            TimerResponseChannel responseChannel = importChannel(id, TimerResponseChannel.class);
            responseChannel.onCancel();
          }
        });
  }
コード例 #13
0
  public void select(
      PickResponseChannel pickResponseChannel,
      Date timeout,
      boolean createInstance,
      Selector[] selectors)
      throws FaultException {

    final String pickResponseChannelStr = pickResponseChannel.export();

    int conflict = getORM().findConflict(selectors);
    if (conflict != -1)
      throw new FaultException(
          _runtime._oprocess.constants.qnConflictingReceive, selectors[conflict].toString());

    getORM().register(pickResponseChannelStr, selectors);

    _brc.select(pickResponseChannelStr, timeout, selectors);
  }
コード例 #14
0
 public boolean isVariableInitialized(VariableInstance var) {
   return _brc.isVariableInitialized(var);
 }
コード例 #15
0
 public boolean isPartnerRoleEndpointInitialized(PartnerLinkInstance pLink) {
   return _brc.isPartnerRoleEndpointInitialized(pLink);
 }
コード例 #16
0
 public void setAtomicScope(boolean atomicScope) {
   _brc.setAtomicScope(atomicScope);
 }
コード例 #17
0
 public Node getProcessProperty(QName propertyName) {
   return _brc.getProcessProperty(propertyName);
 }
コード例 #18
0
 public void setRetriesDone() {
   _brc.setAtomicScopeRetriesDone();
 }
コード例 #19
0
 public boolean isCorrelationInitialized(CorrelationSetInstance correlationSet) {
   return _brc.isCorrelationInitialized(correlationSet);
 }
コード例 #20
0
 public boolean isRetryable() {
   return _brc.isAtomicScopeRetryable();
 }
コード例 #21
0
 /** Proxy to {@link ProcessControlContext#terminate()}. */
 public void terminate() {
   cleanupOutstandingMyRoleExchanges(null);
   _brc.terminate();
 }
コード例 #22
0
 public int getRetryDelay() {
   return _brc.getAtomicScopeRetryDelay();
 }
コード例 #23
0
 public boolean isFirstTry() {
   return _brc.isAtomicScopeFirstTry();
 }
コード例 #24
0
 /** Proxy to {@link IOContext#getPartnerFaultExplanation(String) }. */
 public String getPartnerFaultExplanation(String mexId) {
   return _brc.getPartnerFaultExplanation(mexId);
 }
コード例 #25
0
 /**
  * Proxy to {@link OdeRTInstanceContext#sendEvent(org.apache.ode.bpel.evt.ProcessInstanceEvent) }.
  */
 public void sendEvent(ProcessInstanceStartedEvent evt) {
   _brc.sendEvent(evt);
 }
コード例 #26
0
 /** Proxy to {@link ProcessControlContext#forceFlush() }. */
 public void forceFlush() {
   _brc.forceFlush();
 }
コード例 #27
0
 public void completedFault(FaultData faultData) {
   cleanupOutstandingMyRoleExchanges(faultData);
   _brc.completedFault(faultData);
 }
コード例 #28
0
 public void setRetriedOnce() {
   _brc.setAtomicScopeRetriedOnce();
 }
コード例 #29
0
 public void completedOk() {
   cleanupOutstandingMyRoleExchanges(null);
   _brc.completedOk();
 }
コード例 #30
0
 /** Proxy to {@link ProcessControlContext#forceRollback() }. */
 public void forceRollback() {
   _brc.forceRollback();
 }