001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)UtilBase.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package com.sun.jbi.common;
030:
031: /**
032: * DOCUMENT ME!
033: *
034: * @author Sun Microsystems, Inc.
035: */
036: public class UtilBase {
037: /**
038: *
039: */
040: /**
041: *
042: */
043: /**
044: *
045: */
046:
047: /**
048: *
049: */
050: private Exception mException;
051:
052: /**
053: *
054: */
055:
056: /**
057: *
058: */
059: private StringBuffer mError;
060:
061: /**
062: *
063: */
064:
065: /**
066: *
067: */
068: private StringBuffer mWarning;
069:
070: /**
071: *
072: */
073:
074: /**
075: *
076: */
077: private boolean mValid = true;
078:
079: /**
080: * Creates a new UtilBase object.
081: */
082: public UtilBase() {
083: mError = new StringBuffer();
084: mWarning = new StringBuffer();
085: }
086:
087: /**
088: * DOCUMENT ME!
089: *
090: * @param err NOT YET DOCUMENTED
091: */
092: public void setError(String err) {
093: mValid = false;
094: if (err != null) {
095: if (!err.trim().equals("")) {
096: mError.append("\nError : " + "Reason : " + err);
097: }
098: }
099: }
100:
101: /**
102: * DOCUMENT ME!
103: *
104: * @return NOT YET DOCUMENTED
105: */
106: public String getError() {
107: return mError.toString();
108: }
109:
110: /**
111: * DOCUMENT ME!
112: *
113: * @param ex NOT YET DOCUMENTED
114: */
115: public void setException(Exception ex) {
116: mValid = false;
117: mException = ex;
118: mError.append(ex.getMessage());
119: }
120:
121: /**
122: * DOCUMENT ME!
123: *
124: * @return NOT YET DOCUMENTED
125: */
126: public Exception getException() {
127: if (!mError.toString().trim().equals("")) {
128: mException = new Exception(mError.toString());
129: }
130:
131: return mException;
132: }
133:
134: /**
135: * DOCUMENT ME!
136: *
137: * @return NOT YET DOCUMENTED
138: */
139: public boolean isValid() {
140: return mValid;
141: }
142:
143: /**
144: * DOCUMENT ME!
145: *
146: * @return NOT YET DOCUMENTED
147: */
148: public String getWarning() {
149: return mWarning.toString();
150: }
151:
152: /**
153: *
154: */
155: public void clear() {
156: mException = null;
157: mValid = true;
158: mError = new StringBuffer();
159: mWarning = new StringBuffer();
160: }
161:
162: /**
163: * DOCUMENT ME!
164: *
165: * @param valid NOT YET DOCUMENTED
166: */
167: protected void setValid(boolean valid) {
168: mValid = valid;
169: }
170:
171: /**
172: * DOCUMENT ME!
173: *
174: * @param warn NOT YET DOCUMENTED
175: */
176: protected void setWarning(String warn) {
177: if (warn != null) {
178: if (!warn.trim().equals("")) {
179: mWarning.append("\nWarning : " + "Reason : " + warn);
180: }
181: }
182: }
183: }
|