001: // Copyright (c) 2004 Sun Microsystems Inc., All Rights Reserved.
002:
003: /*
004: * UtilBase.java
005: *
006: * SUN PROPRIETARY/CONFIDENTIAL.
007: * This software is the proprietary information of Sun Microsystems, Inc.
008: * Use is subject to license terms.
009: *
010: */
011: package com.sun.jbi.common;
012:
013: /**
014: * DOCUMENT ME!
015: *
016: * @author Ramesh
017: */
018: public class UtilBase {
019: /**
020: *
021: */
022: /**
023: *
024: */
025: /**
026: *
027: */
028:
029: /**
030: *
031: */
032: private Exception mException;
033:
034: /**
035: *
036: */
037:
038: /**
039: *
040: */
041: private StringBuffer mError;
042:
043: /**
044: *
045: */
046:
047: /**
048: *
049: */
050: private StringBuffer mWarning;
051:
052: /**
053: *
054: */
055:
056: /**
057: *
058: */
059: private boolean mValid = true;
060:
061: /**
062: * Creates a new UtilBase object.
063: */
064: public UtilBase() {
065: mError = new StringBuffer();
066: mWarning = new StringBuffer();
067: }
068:
069: /**
070: * DOCUMENT ME!
071: *
072: * @param err NOT YET DOCUMENTED
073: */
074: public void setError(String err) {
075: mValid = false;
076: if (err != null) {
077: if (!err.trim().equals("")) {
078: mError.append("\nError : " + "Reason : " + err);
079: }
080: }
081: }
082:
083: /**
084: * DOCUMENT ME!
085: *
086: * @return NOT YET DOCUMENTED
087: */
088: public String getError() {
089: return mError.toString();
090: }
091:
092: /**
093: * DOCUMENT ME!
094: *
095: * @param ex NOT YET DOCUMENTED
096: */
097: public void setException(Exception ex) {
098: mValid = false;
099: mException = ex;
100: mError.append(ex.getMessage());
101: }
102:
103: /**
104: * DOCUMENT ME!
105: *
106: * @return NOT YET DOCUMENTED
107: */
108: public Exception getException() {
109: if (!mError.toString().trim().equals("")) {
110: mException = new Exception(mError.toString());
111: }
112:
113: return mException;
114: }
115:
116: /**
117: * DOCUMENT ME!
118: *
119: * @return NOT YET DOCUMENTED
120: */
121: public boolean isValid() {
122: return mValid;
123: }
124:
125: /**
126: * DOCUMENT ME!
127: *
128: * @return NOT YET DOCUMENTED
129: */
130: public String getWarning() {
131: return mWarning.toString();
132: }
133:
134: /**
135: *
136: */
137: public void clear() {
138: mException = null;
139: mValid = true;
140: mError = new StringBuffer();
141: mWarning = new StringBuffer();
142: }
143:
144: /**
145: * DOCUMENT ME!
146: *
147: * @param valid NOT YET DOCUMENTED
148: */
149: protected void setValid(boolean valid) {
150: mValid = valid;
151: }
152:
153: /**
154: * DOCUMENT ME!
155: *
156: * @param warn NOT YET DOCUMENTED
157: */
158: protected void setWarning(String warn) {
159: if (warn != null) {
160: if (!warn.trim().equals("")) {
161: mWarning.append("\nWarning : " + "Reason : " + warn);
162: }
163: }
164: }
165: }
|