@Override public VFSDeploymentContext getTopLevel() { return (VFSDeploymentContext) super.getTopLevel(); }
public void cleanup() { AbstractDeploymentContext.cleanupRepository(this); }
public DeploymentUnit getDeploymentUnit() { if (unit == null) unit = createDeploymentUnit(); return unit; }
public boolean createClassLoader(ClassLoaderFactory factory) throws DeploymentException { if (factory == null) throw new IllegalArgumentException("Null factory"); ClassLoader cl = getClassLoader(); if (cl != null) return false; try { cl = factory.createClassLoader(getDeploymentUnit()); if (cl != null) { setClassLoader(cl); this.classLoaderFactory = factory; } else { // No classloader, use the deployer's classloader setClassLoader(Thread.currentThread().getContextClassLoader()); } } catch (Throwable t) { throw DeploymentException.rethrowAsDeploymentException("Error creating classloader for " + getName(), t); } return true; }
public boolean createClassLoader(ClassLoaderFactory factory) throws DeploymentException { if (factory == null) throw new IllegalArgumentException("Null factory"); ClassLoader cl = getClassLoader(); if (cl != null) return false; try { cl = factory.createClassLoader(this); if (cl != null) { setClassLoader(cl); this.classLoaderFactory = factory; } } catch (Throwable t) { throw DeploymentException.rethrowAsDeploymentException("Error creating classloader for " + getName(), t); } return true; }
public void removeClassLoader() { if (classLoaderFactory == null) return; try { classLoaderFactory.removeClassLoader(getDeploymentUnit()); } catch (Throwable t) { log.warn("Error removing classloader for " + getName(), t); } classLoaderFactory = null; setClassLoader(null); }
public void addComponent(DeploymentContext component) { if (component == null) throw new IllegalArgumentException("Null component"); deployed(); components.add(component); if (server != null) registerMBeans(component, true, true); if (log.isTraceEnabled()) log.trace("Added component " + component.getName() + " to " + getName()); }
public DependencyInfo getDependencyInfo() { ControllerContext controllerContext = getTransientAttachments().getAttachment(ControllerContext.class); if (controllerContext != null) return controllerContext.getDependencyInfo(); else { DeploymentContext parent = getParent(); if (parent == null) throw new IllegalStateException("Deployment ControllerContext has not been set"); return parent.getDependencyInfo(); } }
public ObjectName getObjectName() { if (objectName == null) { String type = "Deployment"; if (getParent() != null) type = "SubDeployment"; if (isComponent()) type = "Component"; String name = getName(); name = name.replace("\"", """); String temp = "jboss.deployment:id=\"" + name + "\",type=" + type; try { objectName = new ObjectName(temp); } catch (MalformedObjectNameException e) { throw new RuntimeException("Error creating object name: " + temp, e); } } return objectName; }
public void removeClassLoader() { if (classLoaderFactory == null) return; try { classLoaderFactory.removeClassLoader(this); } catch (Throwable t) { log.warn("Error removing classloader for " + getName(), t); } classLoaderFactory = null; setClassLoader(null); }
public DeploymentStage getRequiredStage() { DeploymentContext parent = getParent(); if (parent != null) return parent.getRequiredStage(); else return this.requiredStage; }
/** * Create the root deployment context * * @param deployment the deployment * @return the deployment context * @throws Exception for any error */ protected DeploymentContext createRootDeploymentContext(Deployment deployment) throws Exception { return new AbstractDeploymentContext(deployment.getName(), ""); }
public MutableMetaData getMutableMetaData() { return getMutableMetaData(this); }
public MetaData getMetaData() { return AbstractDeploymentContext.getMetaData(this); }
public boolean removeComponent(DeploymentContext component) { if (component == null) throw new IllegalArgumentException("Null component"); if (server != null) unregisterMBeans(component, true, true); List<DeploymentContext> componentComponents = component.getComponents(); if (componentComponents.isEmpty() == false) log.warn("Removing component " + name + " which still has components " + componentComponents); boolean result = components.remove(component); component.cleanup(); if (result && log.isTraceEnabled()) log.trace("Removed component " + component.getName() + " from " + getName()); return result; }
public void setParent(DeploymentContext parent) { if (parent != null && this.parent != null) throw new IllegalStateException("Context already has a parent " + getName()); this.parent = parent; }
public ObjectName getClassLoaderName() { ClassLoader classLoader = getClassLoader(); if (classLoader == null || classLoader instanceof RealClassLoader == false) return null; return ((RealClassLoader) classLoader).getObjectName(); }
public Object getControllerContextName() { ControllerContext controllerContext = getTransientAttachments().getAttachment(ControllerContext.class); if (controllerContext != null) { return controllerContext.getName(); } else { DeploymentContext parent = getParent(); if (parent == null) throw new IllegalStateException("Deployment ControllerContext has not been set"); return parent.getControllerContextName(); } }
public DeploymentContext getTopLevel() { DeploymentContext result = this; DeploymentContext parent = getParent(); while (parent != null) { result = parent; parent = parent.getParent(); } return result; }