/* 141 */ boolean scan = true;
/* */
/* 143 */ UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
/* 144 */ Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
/* 145 */ EarMetaData specMetaData = null;
/* 146 */ JBossAppMetaData appMetaData = null;
/* 147 */ if (applicationXml != null)
/* */ {
/* 149 */ InputStream in = applicationXml.openStream();
/* */ try
/* */ {
/* 152 */ specMetaData = (EarMetaData)unmarshaller.unmarshal(in, this.resolver);
/* */ }
/* */ finally
/* */ {
/* 156 */ in.close();
/* */ }
/* 158 */ scan = false;
/* */ }
/* 160 */ if (jbossAppXml != null)
/* */ {
/* 162 */ InputStream in = jbossAppXml.openStream();
/* */ try
/* */ {
/* 165 */ appMetaData = (JBossAppMetaData)unmarshaller.unmarshal(in, this.resolver);
/* */ }
/* */ finally
/* */ {
/* 169 */ in.close();
/* */ }
/* */ }
/* */
/* 173 */ if (appMetaData == null)
/* */ {
/* 175 */ appMetaData = new JBossAppMetaData();
/* */ }
/* */
/* 178 */ appMetaData.merge(appMetaData, specMetaData);
/* */
/* 181 */ String libDir = appMetaData.getLibraryDirectory() == null ? "lib" : appMetaData.getLibraryDirectory();
/* 182 */ if (trace)
/* 183 */ this.log.trace("Checking for ear lib directory: " + libDir);
/* */ try
/* */ {
/* 186 */ VirtualFile lib = file.findChild(libDir);
/* 187 */ if (lib != null)
/* */ {
/* 189 */ if (trace)
/* 190 */ this.log.trace("Found ear lib directory: " + lib);
/* 191 */ List archives = lib.getChildren(this.earLibFilter);
/* 192 */ for (VirtualFile archive : archives)
/* */ {
/* 194 */ super.addClassPath(root, archive, true, true, context);
/* */ try
/* */ {
/* 198 */ if (archive.findChild("META-INF/persistence.xml") != null)
/* */ {
/* 200 */ this.log.trace(archive.getName() + " in ear lib directory has persistence units");
/* 201 */ if (!deployers.determineStructure(root, file, archive, metaData))
/* */ {
/* 203 */ throw new RuntimeException(archive.getName() + " in lib directory has persistence.xml but is not a recognized deployment, .ear: " + file.getName());
/* */ }
/* */
/* */ }
/* */
/* */ }
/* */ catch (IOException e)
/* */ {
/* 212 */ if (trace) {
/* 213 */ this.log.trace(archive.getPathName() + " does not contain META-INF/persistence.xml");
/* */ }
/* */ }
/* */ }
/* */ }
/* */ }
/* */ catch (IOException ignored)
/* */ {
/* 221 */ if (trace) {
/* 222 */ this.log.trace("Ignoring exception while searching for lib dir", ignored);
/* */ }
/* */ }
/* */
/* 226 */ super.addClassPath(root, file, false, true, context);
/* */
/* 229 */ if (scan)
/* */ {
/* 231 */ scanEar(file, appMetaData);
/* */ }
/* */
/* 235 */ ModulesMetaData modules = appMetaData.getModules();
/* 236 */ if (modules != null) {
/* 237 */ for (ModuleMetaData mod : modules)
/* */ {
/* 239 */ String fileName = mod.getFileName();
/* 240 */ if ((fileName != null) && ((fileName = fileName.trim()).length() > 0))