001: /*
002: * <copyright>
003: *
004: * Copyright 2003-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: package org.cougaar.servicediscovery.description;
027:
028: import java.io.Serializable;
029:
030: /**
031: *
032: * Currently envisioned as the object that the ServiceDisruptionServlet
033: * can publish, triggering action on the part of the provider agent.
034: * Created by IntelliJ IDEA.
035: * User: lgoldsto
036: * Date: Jan 10, 2003
037: * Time: 2:51:55 PM
038: * To change this template use Options | File Templates.
039: */
040: public class StatusChangeMessage implements Serializable {
041: /** A change has been requested but not submited **/
042: public static final int REQUESTED = 1;
043: /** a change is pending **/
044: public static final int PENDING = 2;
045: /** a change has completed but not yet noticed **/
046: public static final int COMPLETED = 3;
047: /** a change is complete **/
048: public static final int DONE = 4;
049: /** a change caused an error **/
050: public static final int ERROR = 5;
051:
052: private String role;
053: private boolean registryUpdated;
054: private int status;
055:
056: public StatusChangeMessage(String role, boolean registryUpdated) {
057: this .role = role;
058: this .registryUpdated = registryUpdated;
059: status = REQUESTED;
060: }
061:
062: public String getRole() {
063: return role;
064: }
065:
066: public void setRegistryUpdated(boolean registryUpdated) {
067: this .registryUpdated = registryUpdated;
068: }
069:
070: public boolean registryUpdated() {
071: return registryUpdated;
072: }
073:
074: public boolean isRequested() {
075: return status == REQUESTED;
076: }
077:
078: public boolean isPending() {
079: return status == PENDING;
080: }
081:
082: public boolean isCompleted() {
083: return status == COMPLETED;
084: }
085:
086: public boolean isDone() {
087: return status == DONE;
088: }
089:
090: public boolean isError() {
091: return status == ERROR;
092: }
093:
094: public synchronized void setStatus(int status) {
095: this .status = status;
096: }
097:
098: public int getStatus() {
099: return status;
100: }
101: }
|