001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)InOnlyImpl.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.jbi.messaging;
030:
031: import java.net.URI;
032:
033: import javax.jbi.messaging.InOnly;
034: import javax.jbi.messaging.NormalizedMessage;
035:
036: /** Implementation of In Only Message Exchange Pattern.
037: * @author Sun Microsystems, Inc.
038: */
039: public class InOnlyImpl extends MessageExchangeProxy implements InOnly {
040: /** Simple state machine for the SOURCE side of the pattern. */
041: private static final int[][] SOURCE = {
042: {
043: SET_IN | ADDRESS | SET_TRANSACTION | SET_PROPERTY
044: | DO_SEND | DO_SENDSYNCH | MARK_ACTIVE
045: | SUSPEND_TX, 1, -1, -1, -1 },
046: { DO_ACCEPT | STATUS | RESUME_TX, -1, 2, -1, -1 },
047: { MARK_DONE | COMPLETE, -1, -1, -1, -1 }, };
048:
049: /** Simple state machine for the TARGET side of the pattern */
050: private static final int[][] TARGET = {
051: { DO_ACCEPT | REQUEST | RESUME_TX, -1, 1, -1, -1 },
052: { SET_ERROR | SET_DONE | SET_PROPERTY, -1, -1, 2, -1 },
053: {
054: SET_ERROR | SET_DONE | DO_SEND | SUSPEND_TX
055: | SET_PROPERTY, 3, -1, 2, -1 },
056: { MARK_DONE, -1, -1, -1, -1 } };
057:
058: /**
059: * Default constructor.
060: */
061: InOnlyImpl() {
062: this (SOURCE);
063: }
064:
065: /**
066: * Create a new InOutImpl in the forward or reverse direction.
067: */
068: InOnlyImpl(int[][] state) {
069: super (state);
070: }
071:
072: /**
073: * Return instance of outselves in the target role.
074: */
075: MessageExchangeProxy newTwin() {
076: return (new InOnlyImpl(TARGET));
077: }
078:
079: /** Get the pattern.
080: * @return the message exchange pattern.
081: */
082: public URI getPattern() {
083: return (ExchangePattern.IN_ONLY.getURI());
084: }
085:
086: /** Retrieve the message with reference id "in" from this exchange.
087: * @return the out message, or null if it is not present in the exchange
088: */
089: public NormalizedMessage getInMessage() {
090: return getMessage(IN_MSG);
091: }
092:
093: /** Retrieve the message with reference id "in" from this exchange.
094: * @return the out message, or null if it is not present in the exchange
095: */
096: public void setInMessage(NormalizedMessage message)
097: throws javax.jbi.messaging.MessagingException {
098: setMessage(message, IN_MSG);
099: }
100: }
|