/** * Get the names from deployments. * * @param deployments the deployments * @return depolyment names */ protected static String[] getDeploymentNames(Deployment... deployments) { if (deployments == null) throw new IllegalArgumentException("Null deployments"); String[] names = new String[deployments.length]; for(int i = 0; i < deployments.length; i++) { if (deployments[i] == null) throw new IllegalArgumentException("Null deployment: " + i); names[i] = deployments[i].getName(); } return names; }
/** * 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(), ""); }
/** * 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(), ""); }
/** * Remove a deployment by name * * @param deployment thedeployment * @param addToUndeploy should we add to undeploy collection * @return false when the context was previously unknown * @throws DeploymentException for any error */ protected boolean removeDeployment(Deployment deployment, boolean addToUndeploy) throws DeploymentException { if (deployment == null) throw new DeploymentException("Null deployment"); return removeDeployment(deployment.getName(), addToUndeploy); }
@Override protected void determineStructure(Deployment deployment, StructureMetaData structure) throws Exception { if (deployment instanceof VFSDeployment == false) throw new DeploymentException("Structure can only be determined for VFSDeployments " + deployment); VFSDeployment vfsDeployment = (VFSDeployment) deployment; VirtualFile root = vfsDeployment.getRoot(); if (root == null) throw new IllegalStateException("Deployment has no root " + deployment); if (doDetermineStructure(root, null, root, structure) == false) throw new DeploymentException("No deployer recognised the structure of " + deployment.getName()); } }
@Override protected void determineStructure(Deployment deployment, StructureMetaData structure) throws Exception { if (deployment instanceof VFSDeployment == false) throw new DeploymentException("Structure can only be determined for VFSDeployments " + deployment); VFSDeployment vfsDeployment = (VFSDeployment) deployment; VirtualFile root = vfsDeployment.getRoot(); if (root == null) throw new IllegalStateException("Deployment has no root " + deployment); StructureContext context = new StructureContext(root, structure, this); if (doDetermineStructure(context) == false) throw new DeploymentException("No deployer recognised the structure of " + deployment.getName()); } }
deploymentsMissingDeployer.add(context.getName());
private String getPersistenceUnitBeanName() { // TODO: check assumption earlier String contextName = (String) context.getName(); DeploymentUnit deploymentUnit = null; for(Deployment deployment : mainDeployer.getTopLevel()) { String name = deployment.getName(); deploymentUnit = mainDeployerStructure.getDeploymentUnit(name); if(deploymentUnit == null) continue; deploymentUnit = findBean(deploymentUnit, contextName); if(deploymentUnit != null) break; } // TODO: this requires a bit more explaining if(deploymentUnit == null) throw new IllegalStateException("@PersistenceUnit can only be used within a regular deployment unit"); String persistenceUnitBeanName = resolver.resolvePersistenceUnitSupplier(deploymentUnit, persistenceUnitName); return persistenceUnitBeanName; }
DeploymentContext context = getDeploymentContext(deployments[i].getName(), true); deployers.process(Collections.singletonList(context), null); contexts[i] = context;
throw new DeploymentException("The main deployer is shutdown"); String name = deployment.getName(); log.debug("Add deployment: " + name);
protected DeploymentContext createRootDeploymentContext(Deployment deployment, StructureMetaData metaData) throws Exception { if (deployment instanceof VFSDeployment) { VFSDeployment vfsDeployment = (VFSDeployment) deployment; String name = deployment.getName(); String simpleName = deployment.getSimpleName(); VirtualFile root = applyModification(vfsDeployment.getRoot(), metaData.getContext("")); if (name == null) { return new AbstractVFSDeploymentContext(root, ""); } else { if (simpleName == null) return new AbstractVFSDeploymentContext(name, name, root, ""); else return new AbstractVFSDeploymentContext(name, simpleName, root, ""); } } return super.createRootDeploymentContext(deployment); }
public ServiceEndpointReference deploy(EndpointMetaData metaData, Class<?> providerImpl, URL serviceUrl, final ClassLoader classLoader, File warArchive, ServerConfig serverConfig) throws Exception { Deployment deployment = createVFSDeployment(warArchive); // Classloading ClassLoaderFactory clf = new DelegatingClassLoaderFactory(classLoader); // WebMetaData String[] webContext = deriveWebContextFromServiceUrl(serviceUrl); WebMetaDataFactory wmdFactory = new WebMetaDataFactory( metaData.getEndpointId(), webContext[0], webContext[1], providerImpl.getName() ); MutableAttachments mutableAttachments = (MutableAttachments)deployment.getPredeterminedManagedObjects(); // Applies to in memory only. Not used with VFS underneath //mutableAttachments.addAttachment(StructureMetaData.class, new StructureMetaDataImpl()); mutableAttachments.addAttachment(ClassLoaderFactory.class, clf); mutableAttachments.addAttachment(JBossWebMetaData.class, wmdFactory.createWebMetaData(classLoader)); mutableAttachments.addAttachment(DeploymentUnitFilter.class, new RiftsawWSDeploymentUnitFilter()); getMainDeployer().deploy(deployment); ServiceEndpointReference ref = new ServiceEndpointReference( metaData.getEndpointId(), serviceUrl, deployment.getName(), warArchive.getAbsolutePath() ); //ref.setArchiveLocation(warArchive.getAbsolutePath()); return(ref); }