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: * @(#)HeartBeatInfo.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.jbi.binding.proxy;
030:
031: import com.sun.jbi.binding.proxy.connection.Event;
032:
033: import com.sun.jbi.binding.proxy.connection.EventInfo;
034:
035: import java.util.LinkedList;
036:
037: /**
038: * Represents a HeartBeat message.
039: * @author Sun Microsystems, Inc
040: */
041: public class HeartBeatInfo extends EventInfo {
042: private final long mBirthtime;
043: private final long mLastTransitionTime;
044: private final String mInstanceId;
045: private LinkedList mEndpoints;
046:
047: public static final String EVENTNAME = "HeartBeat";
048:
049: /**
050: * Constructor.
051: */
052: public HeartBeatInfo(String id, long birthtime, long transitionTime) {
053: mInstanceId = id;
054: mBirthtime = birthtime;
055: mLastTransitionTime = transitionTime;
056: }
057:
058: public String getEventName() {
059: return (EVENTNAME);
060: }
061:
062: /**
063: * Accessor for Birthtime.
064: * @return long containing the Birthtime.
065: */
066: public long getBirthtime() {
067: return (mBirthtime);
068: }
069:
070: /**
071: * Accessor for InstanceId.
072: * @return String containing the instanceId.
073: */
074: public String getInstanceId() {
075: return (mInstanceId);
076: }
077:
078: /**
079: * Accessor for lastTransitionTime.
080: * @return long containing the lastTransitionTime.
081: */
082: public long getLastTransitionTime() {
083: return (mLastTransitionTime);
084: }
085:
086: public void setEndpoints(LinkedList endpoints) {
087: mEndpoints = endpoints;
088: }
089:
090: public LinkedList getEndpoints() {
091: return (mEndpoints);
092: }
093:
094: public HeartBeatInfo(Event event)
095: throws com.sun.jbi.binding.proxy.connection.EventException {
096: super (event);
097: mInstanceId = event.getString();
098: mBirthtime = event.getLong();
099: mLastTransitionTime = event.getLong();
100: mEndpoints = (LinkedList) event.getObject();
101: }
102:
103: public void encodeEvent(Event event)
104: throws com.sun.jbi.binding.proxy.connection.EventException {
105: event.putString(mInstanceId);
106: event.putLong(mBirthtime);
107: event.putLong(mLastTransitionTime);
108: event.putObject(mEndpoints);
109: }
110: }
|