01: // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
02: // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
03: // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
04: // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
05: // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
06: // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
07: // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
08: // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
09: // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
10: // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
11: // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
12: // POSSIBILITY OF SUCH DAMAGE.
13: //
14: // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
15: package com.metaboss.sdlctools.services.jdktools;
16:
17: /** This structure contains template merge output */
18: public final class MergeResult {
19: /** This fields contains true if compiler has succeeded */
20: private boolean mIsSuccessful = false;
21: /** This fields contains the printout of the compilation */
22: private String mMergeLogPrintout = "";
23: /** This field contains the result of the merge */
24: private String mMergedOutput = "";
25:
26: /** Creates the result containing the failure */
27: public static MergeResult createMergeFailure(
28: String pMergeLogPrintout) {
29: MergeResult lResult = new MergeResult();
30: lResult.mIsSuccessful = false;
31: lResult.mMergeLogPrintout = pMergeLogPrintout;
32: lResult.mMergedOutput = "";
33: return lResult;
34: }
35:
36: /** Creates the result containing the success */
37: public static MergeResult createMergeSuccess(String pMergedOutput,
38: String pMergeLogPrintout) {
39: MergeResult lResult = new MergeResult();
40: lResult.mIsSuccessful = true;
41: lResult.mMergeLogPrintout = (pMergeLogPrintout == null) ? ""
42: : pMergeLogPrintout;
43: lResult.mMergedOutput = pMergedOutput;
44: return lResult;
45: }
46:
47: /** Creates the result containing the success */
48: public static MergeResult createMergeSuccess(String pMergedOutput) {
49: MergeResult lResult = new MergeResult();
50: lResult.mIsSuccessful = true;
51: lResult.mMergeLogPrintout = "";
52: lResult.mMergedOutput = pMergedOutput;
53: return lResult;
54: }
55:
56: /** Returns true if result is successfull */
57: public boolean isSuccessful() {
58: return mIsSuccessful;
59: }
60:
61: /** Returns result of the merge */
62: public String getMergedOutput() {
63: if (!mIsSuccessful)
64: throw new java.lang.IllegalStateException(
65: "Merged output is only available from successful merge result");
66: return mMergedOutput;
67: }
68:
69: /** Returns contents of the log output */
70: public String getMergeLogPrintout() {
71: return mMergeLogPrintout;
72: }
73: }
|