Coverage Report - com.aurea.maven.plugins.sonic.sdm.util.ESBDeploymentModelBuilder
 
Classes in this File Line Coverage Branch Coverage Complexity
ESBDeploymentModelBuilder
0%
0/27
0%
0/6
1.3
 
 1  
 package com.aurea.maven.plugins.sonic.sdm.util;
 2  
 
 3  
 import org.apache.maven.plugin.logging.Log;
 4  
 import org.apache.maven.project.MavenProject;
 5  
 
 6  
 import com.aurea.maven.plugins.sonic.utils.DependencyAnalyzer;
 7  
 
 8  
 public class ESBDeploymentModelBuilder {
 9  
   
 10  
   public static final String XARS_DIR_NAME           = "xars";
 11  
   public static final String SDM_DIR_NAME            = "sdm";
 12  
   public static final String TAILOR_DIR_NAME         = "tailor";
 13  
   public static final String SDM_SNIPPET_DIR_NAME    = "sdm-snippets";
 14  
   public static final String DEFAULT_SDM_HOST_VALUE  = "ESBHost";
 15  
   public static final String DEFAULT_XAR_HOST_VALUE  = "XARHost";
 16  
 
 17  0
   private Log log = null;
 18  0
   private MavenProject project = null;
 19  0
   private DependencyAnalyzer depAnalyzer = null;
 20  0
   private ESBDeploymentModel model = null; 
 21  
     
 22  0
   private ESBModelContribution[] contributions = null;
 23  
   
 24  0
   public ESBDeploymentModelBuilder(MavenProject project, Log log) {
 25  0
     this.project = project;    
 26  0
     this.log = log;
 27  
     
 28  0
     contributions = new ESBModelContribution[] {
 29  
       new XarFileContribution(ESBDeploymentModel.CONTRIB_XAR_FILES, this),
 30  
       new ESBProcessesContribution(ESBDeploymentModel.CONTRIB_PROCESSES, this),
 31  
       new ESBServiceTypesContribution(ESBDeploymentModel.CONTRIB_SERVICETYPES, this),
 32  
       new ESBServicesContribution(ESBDeploymentModel.CONTRIB_SERVICES, this)
 33  
     };
 34  0
   }
 35  
   
 36  
   /**
 37  
    * This will build the ESBDeployment Model after all properties have been injected. This Model 
 38  
    * should be the core source of information for all generators. It can also injected into a
 39  
    * Velocity context.
 40  
    */
 41  
   public ESBDeploymentModel getModel() throws Exception {
 42  0
     getLog().info("Building ESB Deployment Model...");
 43  
     
 44  0
     if (model == null) {
 45  0
       model = new ESBDeploymentModel();
 46  0
       model.setProject(project);
 47  
       
 48  0
       for(ESBModelContribution contrib: contributions) {
 49  0
         model.setModelObject(contrib.getContributionName(), contrib.getContribution());
 50  
       }
 51  
     }
 52  
 
 53  0
     return model;
 54  
   }
 55  
 
 56  
   public DependencyAnalyzer getDepAnalyzer() {
 57  0
     if (depAnalyzer == null) {
 58  0
       depAnalyzer = new DependencyAnalyzer(getDependencyDirectory());
 59  
     }
 60  0
     return depAnalyzer;
 61  
   }
 62  
   
 63  
   /**
 64  
    * @return the build directory (usually /target)
 65  
    */
 66  
   public String getOutputDirectory() {
 67  0
     return project.getBuild().getDirectory();
 68  
   }
 69  
 
 70  
   /**
 71  
    * @return the directory to contain any dependencies
 72  
    */
 73  
   public String getDependencyDirectory() {
 74  0
     return getOutputDirectory() + "/dependency";
 75  
   }
 76  
 
 77  
   /**
 78  
    * @return the directory to contain any dependencies
 79  
    */
 80  
   public String getTestDependencyDirectory() {
 81  0
     return getOutputDirectory() + "/sonicesb/testDependency";
 82  
   }
 83  
 
 84  
   public String getESBVersion() {
 85  0
     return project.getProperties().getProperty("esb.version", "7.6.0");
 86  
   }
 87  
 
 88  
   public String getSDMDir() {
 89  0
     return getOutputDirectory() + "/" + SDM_DIR_NAME;
 90  
   }
 91  
 
 92  
   /**
 93  
    * get the temporary location to use while assembling the Maven package.
 94  
    * 
 95  
    * @return a directory for the package xar
 96  
    */
 97  
   public String getPackageXarDir() {
 98  0
     return getOutputDirectory() + "/sonicesb/packageXar/fileSystem";
 99  
   }
 100  
 
 101  
   public Log getLog() {
 102  0
     return log;
 103  
   }
 104  
 }