001: /*
002: * <copyright>
003: *
004: * Copyright 1997-2004 BBNT Solutions, LLC
005: * under sponsorship of the Defense Advanced Research Projects
006: * Agency (DARPA).
007: *
008: * You can redistribute this software and/or modify it under the
009: * terms of the Cougaar Open Source License as published on the
010: * Cougaar Open Source Website (www.cougaar.org).
011: *
012: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023: *
024: * </copyright>
025: */
026:
027: package org.cougaar.planning.ldm.plan;
028:
029: import java.io.IOException;
030: import java.io.ObjectInputStream;
031: import java.io.ObjectOutputStream;
032:
033: import org.cougaar.planning.ldm.asset.Asset;
034:
035: /** An implementation of AssetVerification
036: */
037: public class AssetVerificationImpl extends PlanningDirectiveImpl
038: implements AssetVerification, NewAssetVerification {
039: private transient Asset myAsset;
040: private transient Asset myAssignee;
041: private Schedule mySchedule;
042:
043: //no-arg constructor
044: public AssetVerificationImpl() {
045: }
046:
047: public AssetVerificationImpl(Asset asset, Asset assignee,
048: Schedule schedule) {
049: setAsset(asset);
050: setAssignee(assignee);
051: setSchedule(schedule);
052: }
053:
054: /** implementation of the AssetVerification interface */
055:
056: /**
057: * Returns the asset the verification is in reference to.
058: * @return asset
059: **/
060: public Asset getAsset() {
061: return myAsset;
062: }
063:
064: /** implementation methods for the NewNotification interface **/
065:
066: /**
067: * Sets the asset the notification is in reference to.
068: * @param asset Asset
069: **/
070:
071: public void setAsset(Asset asset) {
072: myAsset = asset;
073: }
074:
075: /** implementation of the AssetVerification interface */
076:
077: /**
078: * Returns the asset the verification is in reference to.
079: * @return asset
080: **/
081: public Asset getAssignee() {
082: return myAssignee;
083: }
084:
085: /** implementation methods for the NewNotification interface **/
086:
087: /**
088: * Sets the asset the notification is in reference to.
089: **/
090: public void setAssignee(Asset assignee) {
091: myAssignee = assignee;
092: }
093:
094: /** implementation of the AssetVerification interface */
095:
096: /**
097: * Returns the schedule to be verified
098: * @return Schedule
099: **/
100: public Schedule getSchedule() {
101: return mySchedule;
102: }
103:
104: /** implementation methods for the NewNotification interface **/
105:
106: /**
107: * Sets the schedule to be verified
108: * @param schedule Schedule
109: **/
110: public void setSchedule(Schedule schedule) {
111: mySchedule = schedule;
112: }
113:
114: private void writeObject(ObjectOutputStream stream)
115: throws IOException {
116: stream.defaultWriteObject();
117:
118: stream.writeObject(myAsset);
119: stream.writeObject(myAssignee);
120: }
121:
122: private void readObject(ObjectInputStream stream)
123: throws ClassNotFoundException, IOException {
124: stream.defaultReadObject();
125:
126: myAsset = (Asset) stream.readObject();
127: myAssignee = (Asset) stream.readObject();
128: }
129:
130: public String toString() {
131: return "<AssetVerification for asset " + myAsset
132: + " assigned to " + myAssignee + ">"
133: + mySchedule.toString();
134: }
135: }
|