001: /******************************************************************************
002: * JBoss, a division of Red Hat *
003: * Copyright 2007, Red Hat Middleware, LLC, and individual *
004: * contributors as indicated by the @authors tag. See the *
005: * copyright.txt in the distribution for a full listing of *
006: * individual contributors. *
007: * *
008: * This is free software; you can redistribute it and/or modify it *
009: * under the terms of the GNU Lesser General Public License as *
010: * published by the Free Software Foundation; either version 2.1 of *
011: * the License, or (at your option) any later version. *
012: * *
013: * This software is distributed in the hope that it will be useful, *
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of *
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
016: * Lesser General Public License for more details. *
017: * *
018: * You should have received a copy of the GNU Lesser General Public *
019: * License along with this software; if not, write to the Free *
020: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
021: * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
022: ******************************************************************************/package org.jboss.portal.wsrp.consumer;
023:
024: import org.jboss.portal.wsrp.core.ServiceDescription;
025:
026: /**
027: * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
028: * @version $Revision: 9264 $
029: * @since 2.6
030: */
031: public class RefreshResult {
032: private StringBuffer status = new StringBuffer();
033: private boolean hasIssues;
034: private boolean specificCode;
035: private final String meaning;
036: private ServiceDescription serviceDescription;
037: private static final String COLON = ".\n";
038:
039: public RefreshResult(boolean specificCode,
040: String specificCodeMeaning) {
041: this .specificCode = specificCode;
042: this .meaning = specificCodeMeaning;
043: }
044:
045: public RefreshResult(RefreshResult previous, boolean specificCode,
046: String specificCodeMeaning) {
047: this (specificCode, specificCodeMeaning);
048: appendToStatus(previous.getStatus());
049: setHasIssues(previous.hasIssues);
050: }
051:
052: public boolean hasIssues() {
053: return hasIssues;
054: }
055:
056: public void setHasIssues(boolean hasIssues) {
057: this .hasIssues = hasIssues;
058: }
059:
060: public String getStatus() {
061: return status.toString();
062: }
063:
064: StringBuffer appendToStatus(String message) {
065: return appendToStatus(message, true);
066: }
067:
068: StringBuffer appendToStatus(String message, boolean appendColon) {
069: if (message != null && message.length() > 1) {
070: status.append(message);
071: // only happen a colon if the message is not ending with one already.
072: if (appendColon
073: && (status.lastIndexOf(COLON) != status.length() - 2)) {
074: status.append(COLON);
075: }
076: }
077: return status;
078: }
079:
080: public boolean specificCode() {
081: return specificCode;
082: }
083:
084: public void setSpecificCode(boolean specificCode) {
085: this .specificCode = specificCode;
086: }
087:
088: public String getMeaning() {
089: return meaning;
090: }
091:
092: public void setServiceDescription(
093: ServiceDescription serviceDescription) {
094: this .serviceDescription = serviceDescription;
095: }
096:
097: public ServiceDescription getServiceDescription() {
098: return serviceDescription;
099: }
100: }
|