001: /*
002: * Copyright (C) 2001, 2002 Robert MacGrogan
003: *
004: * This library is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License as published by the Free Software Foundation; either
007: * version 2.1 of the License, or (at your option) any later version.
008: *
009: * This library is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * Lesser General Public License for more details.
013: *
014: * You should have received a copy of the GNU Lesser General Public
015: * License along with this library; if not, write to the Free Software
016: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017: *
018: *
019: * $Archive: SourceJammer$
020: * $FileName: StoredFileInfoBean.java$
021: * $FileID: 3963$
022: *
023: * Last change:
024: * $AuthorName: Rob MacGrogan$
025: * $Date: 4/23/03 5:05 PM$
026: * $Comment: Replaced GPL header with LGPL header.$
027: *
028: * $KeyWordsOff: $
029: */
030:
031: package org.sourcejammer.client.filesys;
032:
033: /**
034: * Title: SourceJammer Client 1.0
035: * Description:
036: * Copyright: Copyright (c) 2001
037: * Company: SourceJammer Project
038: * @author Robert MacGrogan
039: * @version 1.0
040: */
041:
042: /**
043: * This class represents information about a file from SourceJammer that has
044: * been stored on a client's file system. The information is used to determine
045: * whether the entire file needs to be retrieved from the server when the file
046: * is requested again.
047: */
048: public class StoredFileInfoBean implements java.io.Serializable {
049:
050: private String msName = null;
051: private long mlSourceVersionUniqueID = -1;
052: private long mlNumBytes = -1;
053: private long mlDate = -1;
054: private String msServerURL = null;
055: private String msArchiveName = null;
056:
057: public StoredFileInfoBean() {
058: }
059:
060: public void setName(String s) {
061: msName = s;
062: }
063:
064: public String getName() {
065: return msName;
066: }
067:
068: public void setSourceVersionUniqueID(long l) {
069: mlSourceVersionUniqueID = l;
070: }
071:
072: public long getSourceVersionUniqueID() {
073: return mlSourceVersionUniqueID;
074: }
075:
076: public void setNumBytes(long l) {
077: mlNumBytes = l;
078: }
079:
080: public long getNumBytes() {
081: return mlNumBytes;
082: }
083:
084: /**
085: * Date is stored as a long, using Date.getTime().
086: */
087: public void setDate(long l) {
088: mlDate = l;
089: }
090:
091: public void setDate(java.util.Date d) {
092: mlDate = d.getTime();
093: }
094:
095: public long getDate() {
096: return mlDate;
097: }
098:
099: public String getArchiveName() {
100: return msArchiveName;
101: }
102:
103: public void setArchiveName(String s) {
104: msArchiveName = s;
105: }
106:
107: public String getServerURL() {
108: return msServerURL;
109: }
110:
111: public void setServerURL(String s) {
112: msServerURL = s;
113: }
114:
115: /**
116: * Returns true if o is a StoredFileInfoBean and all properties
117: * of o are the same as the properties of this object. Otherwise,
118: * returns false.
119: */
120: public boolean equals(Object o) {
121: boolean bEquals = false;
122: if (o instanceof StoredFileInfoBean) {
123: StoredFileInfoBean bn = (StoredFileInfoBean) o;
124: if (mlNumBytes == bn.mlNumBytes
125: && mlSourceVersionUniqueID == bn.mlSourceVersionUniqueID
126: && mlDate == bn.mlDate && msName.equals(bn.msName)
127: && msArchiveName.equals(bn.msArchiveName)
128: && msServerURL.equals(bn.msServerURL)) {
129: bEquals = true;
130: } else {
131: bEquals = false;
132: }
133: } else {
134: bEquals = false;
135: }
136:
137: return bEquals;
138: }
139:
140: /**
141: * Returns true if o is a StoredFileInfoBean and all properties
142: * of o (other than Version) are the same as the properties of this object. Otherwise,
143: * returns false.
144: */
145: public boolean equalsIgnoreVersion(Object o) {
146: boolean bEquals = false;
147: if (o instanceof StoredFileInfoBean) {
148: StoredFileInfoBean bn = (StoredFileInfoBean) o;
149: if (mlNumBytes == bn.mlNumBytes && mlDate == bn.mlDate
150: && msName.equals(bn.msName)
151: && msArchiveName.equals(bn.msArchiveName)
152: && msServerURL.equals(bn.msServerURL)) {
153: bEquals = true;
154: } else {
155: bEquals = false;
156: }
157: } else {
158: bEquals = false;
159: }
160:
161: return bEquals;
162: }
163:
164: }
|