01: /**
02: * $Id: ProducerEntityStatus.java,v 1.2 2003/12/19 22:46:51 jtb Exp $
03: * Copyright 2003 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.wsrp.consumer.producermanager;
14:
15: public class ProducerEntityStatus {
16:
17: public static final ProducerEntityStatus OK = new ProducerEntityStatus(
18: (short) 0);
19:
20: public static final ProducerEntityStatus DISABLED = new ProducerEntityStatus(
21: (short) 1);
22:
23: public static final ProducerEntityStatus BAD_REGISTRATION = new ProducerEntityStatus(
24: (short) 2);
25:
26: public static final ProducerEntityStatus SERVICE_DESCRIPTION_CHANGED = new ProducerEntityStatus(
27: (short) 3);
28:
29: private short _status = -1;
30:
31: private ProducerEntityStatus(short status) {
32: _status = status;
33: }
34:
35: public short getValue() {
36: return _status;
37: }
38:
39: public static ProducerEntityStatus getProducerEntityStatus(
40: String statusString) {
41: short status = Short.parseShort(statusString);
42: return new ProducerEntityStatus(status);
43: }
44:
45: public boolean equals(Object status) {
46: if (status instanceof ProducerEntityStatus) {
47: if (status != null
48: && ((ProducerEntityStatus) status).getValue() == _status) {
49: return true;
50: }
51: }
52: return false;
53: }
54:
55: public String toString() {
56: String statusString = "UNKNOWN";
57: if (this .equals(OK)) {
58: statusString = "OK";
59: } else if (this .equals(DISABLED)) {
60: statusString = "DISABLED";
61: } else if (this .equals(BAD_REGISTRATION)) {
62: statusString = "BAD_REGISTRATION";
63: } else if (this .equals(SERVICE_DESCRIPTION_CHANGED)) {
64: statusString = "SERVICE_DESCRIPTION_CHANGED";
65: }
66: return statusString;
67: }
68: }
|