Coverage Report - org.jitr.core.ConfigurationModel
 
Classes in this File Line Coverage Branch Coverage Complexity
ConfigurationModel
100%
22/22
N/A
0
 
 1  
 /*
 2  
  * Copyright 2009, Josh Devins, Jitr.org.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 
 17  
 package org.jitr.core;
 18  
 
 19  
 import org.apache.commons.lang.Validate;
 20  
 
 21  
 /**
 22  
  * A simple, immutable model containing a complete Jitr runtime configuration.
 23  
  * 
 24  
  * @author Josh Devins (info@joshdevins.net)
 25  
  */
 26  
 public final class ConfigurationModel {
 27  
 
 28  
     private final String baseUri;
 29  
 
 30  
     private final Class<?> containerClass;
 31  
 
 32  
     private final String containerWorkPath;
 33  
 
 34  
     private final String contextPath;
 35  
 
 36  
     private final OperationalMode mode;
 37  
 
 38  
     private final int port;
 39  
 
 40  
     private final String warPath;
 41  
 
 42  
     public ConfigurationModel(final String baseUri, final Class<?> containerClass,
 43  
             final String containerWorkPath, final String contextPath, final OperationalMode mode,
 44  7
             final int port, final String warPath) {
 45  
 
 46  7
         Validate.notEmpty(baseUri, "Base URI must not be empty.");
 47  7
         Validate.notNull(containerClass, "Container class must not be null.");
 48  7
         Validate.notNull(containerWorkPath, "Container work path must not be null.");
 49  7
         Validate.notEmpty(contextPath, "Context path must not be empty.");
 50  7
         Validate.notNull(mode, "Operational mode must not be null.");
 51  7
         Validate.notNull(warPath, "War path must not be null.");
 52  
 
 53  7
         this.baseUri = baseUri;
 54  7
         this.containerClass = containerClass;
 55  7
         this.containerWorkPath = containerWorkPath;
 56  7
         this.contextPath = contextPath;
 57  7
         this.mode = mode;
 58  7
         this.port = port;
 59  7
         this.warPath = warPath;
 60  7
     }
 61  
 
 62  
     public String getBaseUri() {
 63  9
         return baseUri;
 64  
     }
 65  
 
 66  
     public Class<?> getContainerClass() {
 67  5
         return containerClass;
 68  
     }
 69  
 
 70  
     public String getContainerWorkPath() {
 71  5
         return containerWorkPath;
 72  
     }
 73  
 
 74  
     public String getContextPath() {
 75  9
         return contextPath;
 76  
     }
 77  
 
 78  
     public OperationalMode getMode() {
 79  15
         return mode;
 80  
     }
 81  
 
 82  
     public int getPort() {
 83  14
         return port;
 84  
     }
 85  
 
 86  
     public String getWarPath() {
 87  5
         return warPath;
 88  
     }
 89  
 }