001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.catalina.tribes.transport.bio.util;
019:
020: import org.apache.catalina.tribes.ChannelMessage;
021: import org.apache.catalina.tribes.ErrorHandler;
022: import org.apache.catalina.tribes.Member;
023: import org.apache.catalina.tribes.group.InterceptorPayload;
024:
025: /**
026: * The class <b>LinkObject</b> implements an element
027: * for a linked list, consisting of a general
028: * data object and a pointer to the next element.
029: *
030: * @author Rainer Jung
031: * @author Peter Rossbach
032: * @author Filip Hanik
033: * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (mar., 24 oct. 2006) $
034:
035: */
036:
037: public class LinkObject {
038:
039: private ChannelMessage msg;
040: private LinkObject next;
041: private byte[] key;
042: private Member[] destination;
043: private InterceptorPayload payload;
044:
045: /**
046: * Construct a new element from the data object.
047: * Sets the pointer to null.
048: *
049: * @param key The key
050: * @param payload The data object.
051: */
052: public LinkObject(ChannelMessage msg, Member[] destination,
053: InterceptorPayload payload) {
054: this .msg = msg;
055: this .next = null;
056: this .key = msg.getUniqueId();
057: this .payload = payload;
058: this .destination = destination;
059: }
060:
061: /**
062: * Set the next element.
063: * @param next The next element.
064: */
065: public void append(LinkObject next) {
066: this .next = next;
067: }
068:
069: /**
070: * Get the next element.
071: * @return The next element.
072: */
073: public LinkObject next() {
074: return next;
075: }
076:
077: public void setNext(LinkObject next) {
078: this .next = next;
079: }
080:
081: /**
082: * Get the data object from the element.
083: * @return The data object from the element.
084: */
085: public ChannelMessage data() {
086: return msg;
087: }
088:
089: /**
090: * Get the unique message id
091: * @return the unique message id
092: */
093: public byte[] getKey() {
094: return key;
095: }
096:
097: public ErrorHandler getHandler() {
098: return payload != null ? payload.getErrorHandler() : null;
099: }
100:
101: public InterceptorPayload getPayload() {
102: return payload;
103: }
104:
105: public Member[] getDestination() {
106: return destination;
107: }
108:
109: }
|