Exemplo n.º 1
0
 /** @see org.apache.ode.jacob.JacobRunnable#run() */
 public void run() {
   Selector selector;
   try {
     PickResponseChannel pickResponseChannel = newChannel(PickResponseChannel.class);
     if (_oevent.isRestful()) {
       getBpelRuntime()
           .checkResourceRoute(
               _scopeFrame.resolve(_oevent.resource),
               _oevent.messageExchangeId + _counter,
               pickResponseChannel,
               0);
     } else {
       PartnerLinkInstance pLinkInstance = _scopeFrame.resolve(_oevent.partnerLink);
       selector =
           new Selector(
               0,
               pLinkInstance,
               _oevent.operation.getName(),
               _oevent.operation.getOutput() == null,
               _oevent.messageExchangeId,
               getCorrelationKey(pLinkInstance));
       getBpelRuntime().select(pickResponseChannel, null, false, new Selector[] {selector});
     }
     instance(new WAITING(pickResponseChannel, _scopeFrame, _counter));
   } catch (FaultException e) {
     __log.error(e);
     if (_fault == null) {
       _fault = createFault(e.getQName(), _oevent);
     }
     terminateActive();
     instance(new WAITING(null, _scopeFrame, _counter));
   }
 }
Exemplo n.º 2
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());
         }
       }
     }
   }
 }
Exemplo n.º 3
0
    /** @see org.apache.ode.jacob.JacobRunnable#run() */
    public void run() {
      Selector selector;
      try {
        PickResponseChannel pickResponseChannel = newChannel(PickResponseChannel.class);
        CorrelationKeySet keySet = new CorrelationKeySet();
        PartnerLinkInstance pLinkInstance = _scopeFrame.resolve(_oevent.partnerLink);
        for (OScope.CorrelationSet cset : _oevent.joinCorrelations) {
          if (getBpelRuntimeContext().isCorrelationInitialized(_scopeFrame.resolve(cset))) {
            keySet.add(getBpelRuntimeContext().readCorrelation(_scopeFrame.resolve(cset)));
          }
        }
        for (OScope.CorrelationSet cset : _oevent.matchCorrelations) {
          if (!getBpelRuntimeContext().isCorrelationInitialized(_scopeFrame.resolve(cset))) {
            throw new FaultException(
                _oevent.getOwner().constants.qnCorrelationViolation,
                "Correlation not initialized.");
          }
          keySet.add(getBpelRuntimeContext().readCorrelation(_scopeFrame.resolve(cset)));
        }
        if (keySet.isEmpty()) {
          // Adding a route for opaque correlation. In this case correlation is done on
          // "out-of-band" session id.
          String sessionId = getBpelRuntimeContext().fetchMySessionId(pLinkInstance);
          keySet.add(new CorrelationKey("-1", new String[] {sessionId}));
        }

        selector =
            new Selector(
                0,
                pLinkInstance,
                _oevent.operation.getName(),
                _oevent.operation.getOutput() == null,
                _oevent.messageExchangeId,
                keySet,
                _oevent.route);
        getBpelRuntimeContext().select(pickResponseChannel, null, false, new Selector[] {selector});
        instance(new WAITING(pickResponseChannel));
      } catch (FaultException e) {
        __log.error(e);
        if (_fault == null) {
          _fault = createFault(e.getQName(), _oevent);
        }
        terminateActive();
        instance(new WAITING(null));
      }
    }
Exemplo n.º 4
0
  @SuppressWarnings("unchecked")
  private CorrelationKey computeCorrelationKey(
      OScope.CorrelationSet cset, OMessageVarType messagetype, Element msg) {
    CorrelationKey key = null;

    String[] values = new String[cset.properties.size()];

    int jIdx = 0;
    for (Iterator j = cset.properties.iterator(); j.hasNext(); ++jIdx) {
      OProcess.OProperty property = (OProcess.OProperty) j.next();
      OProcess.OPropertyAlias alias = property.getAlias(messagetype);

      if (alias == null) {
        // TODO: Throw a real exception! And catch this at compile
        // time.
        throw new IllegalArgumentException(
            "No alias matching property '"
                + property.name
                + "' with message type '"
                + messagetype
                + "'");
      }

      String value;
      try {
        value = _process.extractProperty(msg, alias, msg.toString());
      } catch (FaultException fe) {
        String emsg =
            __msgs.msgPropertyAliasDerefFailedOnMessage(alias.getDescription(), fe.getMessage());
        __log.error(emsg, fe);
        throw new InvalidMessageException(emsg, fe);
      }
      values[jIdx] = value;
    }

    if (cset.hasJoinUseCases) {
      key = new OptionalCorrelationKey(cset.name, values);
    } else {
      key = new CorrelationKey(cset.name, values);
    }

    return key;
  }