001: package org.apache.maven.embedder;
002:
003: /*
004: * Licensed to the Apache Software Foundation (ASF) under one
005: * or more contributor license agreements. See the NOTICE file
006: * distributed with this work for additional information
007: * regarding copyright ownership. The ASF licenses this file
008: * to you under the Apache License, Version 2.0 (the
009: * "License"); you may not use this file except in compliance
010: * with the License. You may obtain a copy of the License at
011: *
012: * http://www.apache.org/licenses/LICENSE-2.0
013: *
014: * Unless required by applicable law or agreed to in writing,
015: * software distributed under the License is distributed on an
016: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017: * KIND, either express or implied. See the License for the
018: * specific language governing permissions and limitations
019: * under the License.
020: */
021:
022: import java.io.FileNotFoundException;
023:
024: import org.apache.maven.settings.Settings;
025:
026: /**
027: * @author Jason van Zyl
028: */
029: public class DefaultConfigurationValidationResult implements
030: ConfigurationValidationResult {
031: private Exception userSettingsException;
032:
033: private Exception globalSettingsException;
034:
035: private Settings userSettings, globalSettings;
036:
037: public boolean isValid() {
038: return (getUserSettingsException() == null)
039: && (getGlobalSettingsException() == null);
040: }
041:
042: public Exception getUserSettingsException() {
043: return userSettingsException;
044: }
045:
046: public void setUserSettingsException(Exception e) {
047: this .userSettingsException = e;
048: }
049:
050: public Exception getGlobalSettingsException() {
051: return globalSettingsException;
052: }
053:
054: public void setGlobalSettingsException(Exception e) {
055: this .globalSettingsException = e;
056: }
057:
058: public Settings getUserSettings() {
059: return userSettings;
060: }
061:
062: public void setUserSettings(Settings settings) {
063: this .userSettings = settings;
064: }
065:
066: public Settings getGlobalSettings() {
067: return globalSettings;
068: }
069:
070: public void setGlobalSettings(Settings globalSettings) {
071: this .globalSettings = globalSettings;
072: }
073:
074: public boolean isGlobalSettingsFileParses() {
075: return getGlobalSettings() != null;
076: }
077:
078: public boolean isGlobalSettingsFilePresent() {
079: return isSettingsFilePresent(getGlobalSettings(),
080: getGlobalSettingsException());
081: }
082:
083: public boolean isUserSettingsFileParses() {
084: return getUserSettings() != null;
085: }
086:
087: public boolean isUserSettingsFilePresent() {
088: return isSettingsFilePresent(getUserSettings(),
089: getUserSettingsException());
090: }
091:
092: public void setGlobalSettingsFileParses(
093: boolean globalSettingsFileParses) {
094: // ignored
095: }
096:
097: public void setGlobalSettingsFilePresent(
098: boolean globalSettingsFilePresent) {
099: // ignored
100: }
101:
102: public void setUserSettingsFileParses(boolean userSettingsFileParses) {
103: // ignored
104: }
105:
106: public void setUserSettingsFilePresent(
107: boolean userSettingsFilePresent) {
108: // ignored
109: }
110:
111: public void display() {
112: // ignored
113: }
114:
115: private boolean isSettingsFilePresent(Settings settings, Throwable e) {
116: return (settings != null)
117: || ((e != null) && !(e instanceof FileNotFoundException));
118: }
119: }
|