1 25 26 package org.objectweb.easybeans.deployment; 27 28 import org.objectweb.easybeans.api.EZBArchive; 29 import org.objectweb.easybeans.deployment.annotations.analyzer.AnnotationDeploymentAnalyzer; 30 import org.objectweb.easybeans.deployment.annotations.exceptions.AnalyzerException; 31 import org.objectweb.easybeans.deployment.annotations.exceptions.ResolverException; 32 import org.objectweb.easybeans.deployment.annotations.helper.ResolverHelper; 33 import org.objectweb.easybeans.deployment.annotations.metadata.ClassAnnotationMetadata; 34 import org.objectweb.easybeans.deployment.xml.EJB3DeploymentDesc; 35 import org.objectweb.easybeans.deployment.xml.EJB3DeploymentDescException; 36 import org.objectweb.easybeans.deployment.xml.helper.MetadataMerge; 37 import org.objectweb.easybeans.deployment.xml.struct.EJB3; 38 import org.objectweb.easybeans.log.JLog; 39 import org.objectweb.easybeans.log.JLogFactory; 40 41 46 public class Deployment { 47 48 51 private static JLog logger = JLogFactory.getLog(Deployment.class); 52 53 56 private EZBArchive archive = null; 57 58 61 private AnnotationDeploymentAnalyzer annotationDeploymentAnalyzer = null; 62 63 67 public Deployment(final EZBArchive archive) { 68 this.archive = archive; 69 this.annotationDeploymentAnalyzer = new AnnotationDeploymentAnalyzer(archive); 70 } 71 72 78 @SuppressWarnings ("boxing") 79 public void analyze() throws AnalyzerException, EJB3DeploymentDescException, ResolverException { 80 81 long tAnalyzeStart = System.currentTimeMillis(); 83 annotationDeploymentAnalyzer.analyze(); 84 if (logger.isDebugEnabled()) { 86 long tAnalyzeStartEnd = System.currentTimeMillis(); 87 if (logger.isDebugEnabled()) { 88 logger.debug("Analyze of file {0} took {1} ms.", archive.getName(), (tAnalyzeStartEnd - tAnalyzeStart)); 89 } 90 } 91 92 EJB3 ejb3 = EJB3DeploymentDesc.getEjb3(archive); 94 annotationDeploymentAnalyzer.getEjbJarAnnotationMetadata().setEjb3(ejb3); 95 96 MetadataMerge.merge(annotationDeploymentAnalyzer.getEjbJarAnnotationMetadata()); 98 99 long tResolverStart = System.currentTimeMillis(); 101 ResolverHelper.resolve(annotationDeploymentAnalyzer.getEjbJarAnnotationMetadata()); 102 if (logger.isDebugEnabled()) { 104 long tResolverEnd = System.currentTimeMillis(); 105 if (logger.isDebugEnabled()) { 106 logger.debug("Resolver on metadata from {0} took {1} ms.'", archive.getName(), (tResolverEnd - tResolverStart)); 107 } 108 } 109 110 if (logger.isDebugEnabled()) { 111 for (ClassAnnotationMetadata classAnnotationMetadata : annotationDeploymentAnalyzer 112 .getEjbJarAnnotationMetadata().getClassAnnotationMetadataCollection()) { 113 logger.debug("Result for class = " + classAnnotationMetadata); 114 } 115 } 116 } 117 118 121 public AnnotationDeploymentAnalyzer getAnnotationDeploymentAnalyzer() { 122 return annotationDeploymentAnalyzer; 123 } 124 } 125 | Popular Tags |