/** * Returns instance of ExchangeStatus that corresponds to given string. * * @param status * String representation of status value * @return ExchangeStatus corresponding to the given string value; must be * non-null * @throws java.lang.IllegalArgumentException * if string can't be translated (null or non-status value) */ public static javax.jbi.messaging.ExchangeStatus valueOf(final java.lang.String status) { if (status.equals(ACTIVE.toString())) { return ACTIVE; } else if (status.equals(DONE.toString())) { return DONE; } else if (status.equals(ERROR.toString())) { return ERROR; } else { throw new IllegalArgumentException("Unknown status: " + status); } }
/** * Read from a stream * * @param input * @throws IOException * @throws ClassNotFoundException */ public void readExternal(ObjectInput input) throws IOException, ClassNotFoundException { pattern = URI.create(input.readUTF()); exchangeId = input.readUTF(); status = ExchangeStatus.valueOf(input.readUTF()); destinationId = (ComponentNameSpace) input.readObject(); sourceId = (ComponentNameSpace) input.readObject(); serviceName = (QName) input.readObject(); interfaceName = (QName) input.readObject(); operationName = (QName) input.readObject(); error = (Exception) input.readObject(); properties = (Map) input.readObject(); in = (NormalizedMessageImpl) input.readObject(); out = (NormalizedMessageImpl) input.readObject(); fault = (FaultImpl) input.readObject(); endpoint = (ServiceEndpoint) input.readObject(); byte p = input.readByte(); persistent = (p == 0) ? null : p == 1 ? Boolean.TRUE : Boolean.FALSE; }
public static ExchangeStatus valueOf(String status) { ExchangeStatus instance; // // Convert symbolic name to object reference. // if (status.equals(DONE.toString())) { instance = DONE; } else if (status.equals(ERROR.toString())) { instance = ERROR; } else if (status.equals(ACTIVE.toString())) { instance = ACTIVE; } else { // // Someone has a problem. // throw new java.lang.IllegalArgumentException(status); } return instance; }
/** * Returns instance of ExchangeStatus that corresponds to given string. * * @param status string value of status * @return ExchangeStatus * @throws java.lang.IllegalArgumentException if string can't be translated */ public static ExchangeStatus valueOf(String status) { ExchangeStatus instance; // // Convert symbolic name to object reference. // if (status.equals(DONE.toString())) { instance = DONE; } else if (status.equals(ERROR.toString())) { instance = ERROR; } else if (status.equals(ACTIVE.toString())) { instance = ACTIVE; } else { // // Someone has a problem. // throw new java.lang.IllegalArgumentException(status); } return instance; }
@Override public boolean isActive() { return ExchangeStatus.ACTIVE.equals(this.status); }
/** * Write to a Stream * * @param output * @throws IOException */ public void writeExternal(ObjectOutput output) throws IOException { output.writeUTF(pattern.toString()); output.writeUTF(exchangeId != null ? exchangeId : ""); output.writeUTF(status.toString()); output.writeObject(destinationId); output.writeObject(sourceId); output.writeObject(serviceName); output.writeObject(interfaceName); output.writeObject(operationName); output.writeObject(error); output.writeObject(properties); output.writeObject(in); output.writeObject(out); output.writeObject(fault); output.writeObject(endpoint); output.writeByte((persistent == null) ? 0 : persistent.booleanValue() ? 1 : 2); }
@Override public boolean isError() { return ExchangeStatus.ERROR.equals(this.status); }
fw.write(trackingInfo.getStatus().toString()); fw.write("\n");
@Override public boolean isDone() { return ExchangeStatus.DONE.equals(this.status); }
this.getLogger() .fine(String.format("Received acknowledgment '%s' for transfered file '%s'. Delete it", asyncExchange.getStatus().toString(), transferedfile.getAbsolutePath())); if (!transferedfile.delete()) { this.getLogger().log(Level.WARNING,
private static Status toStatus(final ExchangeStatus status) { if (ExchangeStatus.ACTIVE.equals(status)) { return Status.ACTIVE; } else if (ExchangeStatus.DONE.equals(status)) { return Status.DONE; } else if (ExchangeStatus.ERROR.equals(status)) { return Status.ERROR; } else { throw new IllegalArgumentException("unknown status"); } }
SoapConstants.SOAP.ERROR_WRONG_MESSAGE_STATUS + " " + exchange.getStatus().toString(), FAULT_SERVER);
/** * Depending on the state of the Exchange, clean IN and/or OUT normalized * messages to reduce exchange size. Status DONE, ERROR : all messages are * cleared Fault message : all other messages are cleared OUT message set : * IN message is cleared */ public void cleanMessages() { // if status is DONE or ERROR, do not send // Normalized messages if (!ExchangeStatus.ACTIVE.equals(status)) { messages.clear(); fault = null; } // if there is a fault, no other messages are kept if (fault != null) { messages.clear(); } // if OUT response, IN msg is not kept if (messages.containsKey(OUT_MSG) && messages.containsKey(IN_MSG)) { messages.remove(IN_MSG); } }
/** * Retrieve the right {@code OnJBIResponseTransformation} for the the given InOnly JBI exchange. * * @param jbiExchange * The JBI Exchange * @param onJBIResponseTransformation * A holder in which the right {@code OnJBIResponseTransformation} will be put * @throws OnJBIResponseTransformationException * Unexpected case that should not occur, or system error */ private void lookForJBITransformationAsInOnly(final Exchange jbiExchange, final Holder<OnJBIResponseTransformation> onJBIResponseTransformation) throws OnJBIResponseTransformationException { final ExchangeStatus status = jbiExchange.getStatus(); if (status.equals(ExchangeStatus.DONE)) { onJBIResponseTransformation.value = this.lookForJBIOutTransformation(null); } else if (status.equals(ExchangeStatus.ERROR)) { onJBIResponseTransformation.value = this.lookForJBIErrorTransformation(null); } else { throw new OnJBIResponseTransformationException( String.format("Invalid JBI response status for the MEP InOnly (status: %s)", status), HttpStatus.INTERNAL_SERVER_ERROR_500); } }
/** * @see MessageExchangeImpl#writeObject(ObjectOutputStream) */ protected void writeObjectDelegate(ObjectOutputStream s) throws IOException { // Role serialization if (MessageExchange.Role.CONSUMER.equals(role)) { s.writeShort(SERIALIZE_ROLE_CONSUMER); } else { s.writeShort(SERIALIZE_ROLE_PROVIDER); } // Status serialization if (ExchangeStatus.ACTIVE.equals(status)) { s.writeShort(SERIALIZE_STATUS_ACTIVE); } else if (ExchangeStatus.DONE.equals(status)) { s.writeShort(SERIALIZE_STATUS_DONE); } else { s.writeShort(SERIALIZE_STATUS_ERROR); } s.defaultWriteObject(); }
/** * Used to serialize Status and Role objects * * @param s * @throws IOException */ private void writeObject(final ObjectOutputStream s) throws IOException { // Role serialization if (isConsumer()) { s.writeShort(SERIALIZE_ROLE_CONSUMER); } else { s.writeShort(SERIALIZE_ROLE_PROVIDER); } // Status serialization if (ExchangeStatus.ACTIVE.equals(this.status)) { s.writeShort(SERIALIZE_STATUS_ACTIVE); } else if (ExchangeStatus.DONE.equals(this.status)) { s.writeShort(SERIALIZE_STATUS_DONE); } else { s.writeShort(SERIALIZE_STATUS_ERROR); } s.defaultWriteObject(); } }