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: package org.apache.catalina.ha.session;
018:
019: import org.apache.catalina.ha.ClusterMessage;
020: import org.apache.catalina.ha.ClusterMessageBase;
021:
022: /**
023: * Session id change cluster message
024: *
025: * @author Peter Rossbach
026: *
027: * @version $Revision: 531471 $ $Date: 2007-04-23 16:11:44 +0200 (lun., 23 avr. 2007) $
028: */
029: public class SessionIDMessage extends ClusterMessageBase implements
030: ClusterMessage {
031:
032: private int messageNumber;
033:
034: private String orignalSessionID;
035:
036: private String backupSessionID;
037:
038: private String host;
039: private String contextPath;
040:
041: public String getUniqueId() {
042: StringBuffer result = new StringBuffer(getOrignalSessionID());
043: result.append("#-#");
044: result.append(getHost());
045: result.append("#-#");
046: result.append(getContextPath());
047: result.append("#-#");
048: result.append(getMessageNumber());
049: result.append("#-#");
050: result.append(System.currentTimeMillis());
051: return result.toString();
052: }
053:
054: /**
055: * @return Returns the host.
056: */
057: public String getHost() {
058: return host;
059: }
060:
061: /**
062: * @param host The host to set.
063: */
064: public void setHost(String host) {
065: this .host = host;
066: }
067:
068: /**
069: * @return Returns the contextPath.
070: */
071: public String getContextPath() {
072: return contextPath;
073: }
074:
075: /**
076: * @param contextPath The contextPath to set.
077: */
078: public void setContextPath(String contextPath) {
079: this .contextPath = contextPath;
080: }
081:
082: /**
083: * @return Returns the messageNumber.
084: */
085: public int getMessageNumber() {
086: return messageNumber;
087: }
088:
089: /**
090: * @param messageNumber
091: * The messageNumber to set.
092: */
093: public void setMessageNumber(int messageNumber) {
094: this .messageNumber = messageNumber;
095: }
096:
097: /**
098: * @return Returns the backupSessionID.
099: */
100: public String getBackupSessionID() {
101: return backupSessionID;
102: }
103:
104: /**
105: * @param backupSessionID
106: * The backupSessionID to set.
107: */
108: public void setBackupSessionID(String backupSessionID) {
109: this .backupSessionID = backupSessionID;
110: }
111:
112: /**
113: * @return Returns the orignalSessionID.
114: */
115: public String getOrignalSessionID() {
116: return orignalSessionID;
117: }
118:
119: /**
120: * @param orignalSessionID
121: * The orignalSessionID to set.
122: */
123: public void setOrignalSessionID(String orignalSessionID) {
124: this .orignalSessionID = orignalSessionID;
125: }
126:
127: public String toString() {
128: return "SESSIONID-UPDATE#" + getHost() + "." + getContextPath()
129: + "#" + getOrignalSessionID() + ":"
130: + getBackupSessionID();
131: }
132:
133: }
|