javax.jbi.messaging.ExchangeStatus Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of petals-jbi Show documentation
Show all versions of petals-jbi Show documentation
The JBI specification library
/**
* @(#) ExchangeStatus.java
*
* PETALS - PETALS Services Platform.
* Copyright (c) 2005 Fossil E-Commerce, http://www.fossilec.com/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* -------------------------------------------------------------------------
* $Id: ExchangeStatus.java 69 2006-01-17 16:00:26Z rmarins $
* -------------------------------------------------------------------------
*/
//
// This source code implements specifications defined by the Java
// Community Process. In order to remain compliant with the specification
// DO NOT add / change / or delete method signatures!
//
package javax.jbi.messaging;
/**
* Typesafe enumeration containing status values for a message exchange.
*
* @author JSR208 Expert Group
*/
public final class ExchangeStatus {
/**
* Indicates that an ME has not been processed to completion.
*/
public static final javax.jbi.messaging.ExchangeStatus ACTIVE =
new javax.jbi.messaging.ExchangeStatus("Active");
/**
* Indicates that an ME has been processed to completion.
*/
public static final javax.jbi.messaging.ExchangeStatus DONE =
new javax.jbi.messaging.ExchangeStatus("Done");
/**
* Indicates that an ME has terminated abnormally within the JBI
* environment.
*/
public static final javax.jbi.messaging.ExchangeStatus ERROR =
new javax.jbi.messaging.ExchangeStatus("Error");
/**
* Internal variable to hold enumeration id.
*/
private java.lang.String status;
/**
* Private constructor for type safe enumeration creation.
*/
private ExchangeStatus(java.lang.String aStatus) {
this.status = aStatus;
}
/**
* Returns true if this ExchangeStatus has the same type and value as the
* given object.
*
* @param obj
* value to be compared for equality
* @return true
if this object is equal to the given object
* in type and value
*/
/*public boolean equals(java.lang.Object obj) {
boolean equal = false;
if (obj instanceof ExchangeStatus) {
ExchangeStatus es = (ExchangeStatus) obj;
equal = this.status.equals(es.status);
}
return (equal);
}*/
/**
* @return Returns hash code value for this object.
*/
public int hashCode() {
return toString().hashCode();
}
/**
* Returns string value of enumerated type.
*
* @return String representation of status value; must be non-null and
* non-empty
*/
public java.lang.String toString() {
return this.status;
}
/**
* Returns instance of ExchangeStatus that corresponds to given string.
*
* @param status
* String representation of status value
* @return ExchangeStatus corresponding to the given string value; must be
* non-null
* @throws java.lang.IllegalArgumentException
* if string can't be translated (null or non-status value)
*/
public static javax.jbi.messaging.ExchangeStatus valueOf(
java.lang.String status) {
if (status.equals(ACTIVE.toString())) {
return ACTIVE;
} else if (status.equals(DONE.toString())) {
return DONE;
} else if (status.equals(ERROR.toString())) {
return ERROR;
} else {
throw new IllegalArgumentException("Unknown status: " + status);
}
}
}