protected void init(VFSDeploymentUnit unit, TldMetaData metaData, VirtualFile file) throws Exception { unit.addAttachment(TldMetaData.class.getName() + ":" + file.getPathNameRelativeTo(unit.getRoot()), metaData, getOutput()); }
public void deploy(VFSDeploymentUnit unit, JBossWebMetaData deployment) throws DeploymentException { VirtualFile facesConfigXml = unit.getMetaDataFile("faces-config.xml"); if (facesConfigXml != null) { // TODO - Pete or Stan } } }
@Override public void undeploy(VFSDeploymentUnit unit) { log.debug("Removing dynamic class root for " + unit.getName()); try { unit.removeAttachment(DYNAMIC_CLASS_URL_KEY, URL.class); VirtualFile classes = unit.removeAttachment(DYNAMIC_CLASS_KEY, VirtualFile.class); if (classes != null) { unit.removeClassPath(classes); } } finally { try { Closeable closeable = unit.removeAttachment(MOUNT_HANDLE_KEY, Closeable.class); if (closeable != null) { closeable.close(); } } catch (Exception e) { log.warn("Error deleting dynamic class root for " + unit.getName(), e); } } }
public static boolean isEJBDeployment(VFSDeploymentUnit du) { // TODO: this is temporary EJB3 logic Boolean ignoreMe = du.getAttachment(IGNORE_ME_NAME, Boolean.class); if(ignoreMe != null && ignoreMe) return false; boolean ejbxml = du.getMetaDataFile("ejb-jar.xml") != null; boolean jbossxml = du.getMetaDataFile("jboss.xml") != null; return ejbxml || jbossxml; }
/** * Returns true if this <code>unit</code> represents an .ear deployment * * @param unit * @return */ private boolean isEar(VFSDeploymentUnit unit) { return unit.getSimpleName().endsWith(".ear") || unit.getAttachment(JBossAppMetaData.class) != null; } }
public String createHostName(VFSDeploymentUnit unit) { StringBuilder builder = new StringBuilder(prefix); VFSDeploymentUnit vdu = unit; while (vdu != null) { builder.append("-").append(vdu.getSimpleName()); vdu = vdu.getParent(); } return builder.toString(); }
public void deploy(VFSDeploymentUnit unit, JBossClientMetaData metaData) throws DeploymentException log.debug("deploy " + unit.getName()); List<VirtualFile> classPath = unit.getClassPath(); ArrayList<String> cpURIs = new ArrayList<String>(); for(VirtualFile vf : classPath) VFSDeploymentUnit earUnit = unit.getParent(); if(earUnit != null) JBossAppMetaData earMD = earUnit.getAttachment(JBossAppMetaData.class); if(earMD != null) VirtualFile earRoot = earUnit.getRoot(); ClientENCInjectionContainer container = new ClientENCInjectionContainer(unit, metaData, mainClass, appClientName, unit.getClassLoader(), encCtx, persistenceUnitDependencyResolver); unit.addAttachment(ClientENCInjectionContainer.class, container); JBoss5DeploymentUnit ejb3Unit = new JBoss5DeploymentUnit(unit); getKernelAbstraction().install(container.getObjectName().getCanonicalName(), log.error("Could not deploy " + unit.getName(), e); undeploy(unit, metaData); throw new DeploymentException("Could not deploy " + unit.getName(), e);
log.debug("Verifying " + unit.getRoot().toURL()); verifier.verify(unit.getRoot().toURL(), legacyMD, unit.getClassLoader()); throw new DeploymentException("Failed to create EJB module " + unit.getName() + ": malformed EjbModule name", e); HashSet<String> beanDepends = new HashSet<String>(); VFSDeploymentUnit topUnit = unit.getTopLevel(); Map<String, ContainerDependencyMetaData> endpoints = (Map<String, ContainerDependencyMetaData>) topUnit.getAttachment(MappedReferenceMetaDataResolverDeployer.ENDPOINT_MAP_KEY); if(endpoints == null) log.warn(unit+" has no ContainerDependencyMetaData attachment"); String vfsPath = unit.getRelativePath(); ArrayList<BeanMetaData> mcBeanMD = new ArrayList<BeanMetaData>(); while( beansIter.hasNext() ) unit.addAttachment("EjbServiceMetaData", ejbModule, ServiceMetaData.class); unit.addAttachment(KernelDeployment.class, akd); // TODO -- where is this used? As this might override any parsed KD instance unit.addAttachment("EJB.callByValue", Boolean.TRUE, Boolean.class); unit.addAttachment("EJB.unauthenticatedIdentity", this.unauthenticatedIdentity, String.class); unit.addAttachment("EJB.securityContextClassName", securityContextClassName, String.class); unit.addAttachment("EJB.defaultSecurityDomain", defaultSecurityDomain, String.class);
protected void deployJsr77(MBeanServer server, VFSDeploymentUnit unit, JBossAppMetaData metaData) throws Throwable { ObjectName jsr77Name = J2EEApplication.create(server, unit.getSimpleName(), unit.getRoot().toURL()); if (jsr77Name != null) { putObjectName(unit, J2EEApplication.class.getName(), jsr77Name); log.debug("Created J2EEApplication: " + jsr77Name); } }
VirtualFile root = vfsUnit.getRoot(); final URL expandedWarURL = root.getPhysicalFile().toURI().toURL(); if (warPathName.endsWith("/") == false) warPathName += "/"; List<VirtualFile> classpathVFs = vfsUnit.getClassPath(); if (classpathVFs != null) VirtualFile altDD = vfsUnit.getMetaDataFile(altDDPath); if (altDD == null) VFSDeploymentUnit topUnit = vfsUnit.getTopLevel(); if (topUnit == unit) throw new DeploymentException("Unable to resolve " + altDDPath + " as WEB-INF path"); altDD = topUnit.getFile(altDDPath); if (altDD == null) throw new DeploymentException("Unable to resolve " + altDDPath + " as a deployment path");
EjbJarMetaData ejbJarMetaData = unit.getAttachment(EjbJarMetaData.class); if(ejbJarMetaData != null && ejbJarMetaData instanceof EjbJar3xMetaData) WebMetaData webMetaData = unit.getAttachment(WebMetaData.class); if(webMetaData != null) ApplicationClientMetaData clientMetaData = unit.getAttachment(ApplicationClientMetaData.class); if(clientMetaData != null) isComplete |= clientMetaData.isMetadataComplete(); String symbolicName = (String) unit.getAttachment("org.jboss.osgi.bundle.symbolic.name"); isComplete |= (symbolicName != null); VirtualFile root = unit.getRoot(); if(root.isLeaf()) return; List<VirtualFile> classpath = unit.getClassPath(); if(classpath == null || classpath.isEmpty()) return;
.getRoot()); + vfsDU.getSimpleName() + " right now. Waiting for Container to start."); waitingList.add(deployableUnitURL); logger.error("Failure while deploying " + vfsDU.getName(), e);
public VirtualFile getRoot() { return delegate.getRoot(); }
/** * Process the * * @param unit the unit * @throws DeploymentException for any error */ protected void deploy(VFSDeploymentUnit unit) throws DeploymentException { if (!unit.getSimpleName().endsWith(".war")) { return; } VirtualFile root = unit.getRoot(); if(root.isFile()) return; List<VirtualFile> classpath = unit.getClassPath(); if(classpath == null || classpath.isEmpty()) return; if (log.isTraceEnabled()) log.trace("Deploying annotations for unit: " + unit + ", classpath: " + classpath); try { processMetaData(unit, classpath); } catch (Exception e) { throw DeploymentException.rethrowAsDeploymentException("Cannot process metadata", e); } }
String name = deploymentUnit.getName(); if (name.endsWith("/")) Boolean flag = unit.getAttachment("EJB.callByValue", Boolean.class); DeploymentUnit temp = unit; while (flag == null && temp != null) String unauthenticatedPrincipal = unit.getAttachment("EJB.unauthenticatedIdentity", String.class); if (unauthenticatedPrincipal == null) unauthenticatedPrincipal = unit.getAttachment("EAR.unauthenticatedIdentity", String.class); metaData.getJBossMetaData().setUnauthenticatedPrincipal(unauthenticatedPrincipal); if (unit.getAttachment(ApplicationMetaData.class) == null) unit.addAttachment(ApplicationMetaData.class, metaData);
String archives = path.getArchives(); log.debugf("Processing classpath: %1s codebase=%2s archives=%3s", unit.getName(), codebase, archives); VirtualFile codebaseFile = unit.getRoot(); if (".".equals(codebase) == false) throw new DeploymentException("No default codebase root for " + codebase + " in " + unit.getName()); URL codeBaseURL = new URL(defaultCodeBaseRoot, codebase); codebaseFile = VFS.getChild(codeBaseURL); throw new DeploymentException("Cannot use classpath without a root: " + unit.getName()); log.debugf("Using codebase as classpath: %1s", unit.getName()); unit.prependClassPath(classpath);
/** * Entry point for handling a VFSDeploymentUnit. * * @param unit the current deployment unit * @throws DeploymentException for any error */ public void deploy(VFSDeploymentUnit unit) throws DeploymentException { VirtualFile root = unit.getRoot(); String relativePath = unit.getRelativePath(); VirtualFile ear = unit.getFile(relativePath); if (ear == null) throw new DeploymentException("No such ear file, relative path: '" + relativePath + "', root: " + root); deploy(unit, root, ear); }
protected EarMetaData parse(VFSDeploymentUnit unit, VirtualFile file, EarMetaData root) throws Exception List<DeploymentUnit> children = unit.getChildren(); ModulesMetaData modules = ear.getModules(); if(children != null && modules != null) if(module != null && module.getAlternativeDD() != null) VirtualFile altDDFile = unit.getRoot().getChild(module.getAlternativeDD()); if(altDDFile == null) throw new IllegalStateException("Failed to locate alternative DD '" + module.getAlternativeDD() + "' in " + unit.getRoot().getPathName()); attachmentName = "org.jboss.resource.metadata.ConnectorMetaData"; else throw new IllegalStateException("Expected module types in an EAR are ejb, web, java and connector but got " + module.getType() + " for " + child.getName() + " in " + unit.getName());
protected RARDeploymentMetaData mergeMetaData(VFSDeploymentUnit unit, Map<Class<?>, List<Object>> metadata) throws Exception { RARDeploymentMetaData deployment = new RARDeploymentMetaData(); ConnectorMetaData cmd = getInstance(metadata, ConnectorMetaData.class); if (cmd != null) deployment.setConnectorMetaData(cmd); JBossRAMetaData jrmd = getInstance(metadata, JBossRAMetaData.class); if (jrmd != null) deployment.setRaXmlMetaData(jrmd); VFSDeploymentUnit parent = unit.getParent(); String name = unit.getSimpleName(); if (parent != null) name = parent.getSimpleName() + "#" + name; VirtualFile file = unit.getMetaDataFile(jeeSpecRarDD); deployment.getConnectorMetaData().setURL(file.toURL()); metaDataRepository.addConnectorMetaData(name, deployment.getConnectorMetaData()); return deployment; }