/** * Check the configuration * * @throws Exception for any error */ public void create() throws Exception { if (classLoading == null) throw new DeploymentException("Classloading has not been configured"); }
/** * Rethrow a throwable as a deployment exception if it isn't already. * * @param message the message * @param t the throwable * @return never * @throws DeploymentException always */ public static DeploymentException rethrowAsDeploymentException(String message, Throwable t) throws DeploymentException { if (t instanceof DeploymentException) throw (DeploymentException) t; else throw new DeploymentException(message, t); }
private Class<?> getManagedBeanClass(ClassLoader cl, ManagedBeanMetaData managedBean) throws DeploymentException { String klass = managedBean.getManagedBeanClass(); try { return cl.loadClass(klass); } catch (ClassNotFoundException cnfe) { throw new DeploymentException(cnfe); } }
public DeploymentUnit getDeploymentUnit(String name, boolean errorNotFound) throws DeploymentException { DeploymentUnit unit = getDeploymentUnit(name); if (errorNotFound && unit == null) throw new DeploymentException("Unit " + name + " not found"); return unit; }
public DeploymentContext getDeploymentContext(String name, boolean errorNotFound) throws DeploymentException { DeploymentContext context = getDeploymentContext(name); if (errorNotFound && context == null) throw new DeploymentException("Context " + name + " not found"); return context; }
@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()); } }
public void visit(DeploymentUnit unit) throws DeploymentException { if (unit.isTopLevel()) { try { Context javaComp = getJavaComp(unit); javaComp.unbind("BeanManager"); _logger.debug("CDI BeanManager successfully unbound from JNDI (java:comp) for SwitchYard deployment '" + unit.getName() + "'."); } catch (NamingException e) { throw new DeploymentException("Error unbinding BeanManager.", e); } } }
public void visit(DeploymentUnit unit) throws DeploymentException { try { if (hasJndiBoundBeanManager(unit)) { String path = JndiUtils.getJndiSubcontexPathForBeanManager(moduleInformer, unit); Context subcontext = (Context) rootContext.lookup(path); subcontext.unbind("BeanManager"); rootContext.destroySubcontext(path); } } catch (NamingException e) { throw new DeploymentException(e); } }
@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()); } }
/** * 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); }
public void visit(DeploymentUnit unit) throws DeploymentException { if (unit.isTopLevel()) { Context javaComp = getJavaComp(unit); try { Reference reference = new Reference("javax.enterprise.inject.spi.BeanManager", "org.jboss.weld.integration.deployer.jndi.JBossBeanManagerObjectFactory", null); reference.add(new StringRefAddr("id", IdFactory.getIdFromClassLoader(unit.getClassLoader()))); javaComp.bind("BeanManager", reference); _logger.debug("CDI BeanManager successfully bound into JNDI (java:comp) for SwitchYard deployment '" + unit.getName() + "'."); } catch (NamingException e) { throw new DeploymentException("Error binding BeanManager.", e); } } }
protected void startService() throws Exception { AdminObjectMetaData aomd = retrieveAdminObjectMetaData(); if (aomd == null) throw new DeploymentException("No admin object metadata type=" + type + " ra=" + rarName); Object adminObject = createAdminObject(aomd); bind(adminObject); }
@Override public void deploy(VFSDeploymentUnit unit, SwitchYardMetaData metaData) throws DeploymentException { try { parseSwitchYardConfig(metaData); _log.debug("Successfully parsed SwitchYard configuration for deployment unit '" + unit.getName() + "'."); } catch (IOException ioe) { throw new DeploymentException(ioe); } BeanMetaData beanMetaData = createBeanMetaData(unit, metaData); unit.addAttachment(BeanMetaData.class, beanMetaData); }
@Override protected void internalDeploy(DeploymentUnit unit) throws DeploymentException { Ejb3Deployment ejb3Deployment = unit.getAttachment(Ejb3Deployment.class); try { // start the deployment ejb3Deployment.start(); } catch (Exception e) { throw new DeploymentException("Error starting Ejb3Deployment: " + ejb3Deployment.getName(), e); } }
/** * 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); }
public void build(DeploymentUnit unit, Set<String> outputs, Map<String, ManagedObject> managedObjects) throws DeploymentException { JBossWebMetaData meta = unit.getAttachment(JBossWebMetaData.class); if (meta == null) return; ManagedObject mo = ManagedObjectFactory.getInstance().createManagedObject(ContextMO.class); if (mo == null) throw new DeploymentException("could not create managed object"); mo.getProperty("contextRoot").setValue(SimpleValueSupport.wrap(meta.getContextRoot())); managedObjects.put("ContextMO", mo); }
protected ValueMetaData createValidationServices(DeploymentUnit unit) throws DeploymentException { Object validatorFactory = unit.getAttachment(DeployersUtils.JAVAX_VALIDATION_VALIDATOR_FACTORY); if (validatorFactory == null && isValidationFactoryRequired(unit)) { throw new DeploymentException("Missing ValidatorFactory attachment in deployment: " + unit); } String beanName = unit.getName() + "_JBossValidationServices"; BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(beanName, "org.jboss.weld.integration.validation.JBossValidationServices"); unit.addAttachment(beanName + "_" + BeanMetaData.class.getSimpleName(), builder.getBeanMetaData()); builder.addConstructorParameter(DeployersUtils.JAVAX_VALIDATION_VALIDATOR_FACTORY, validatorFactory); return builder.createInject(beanName); }
public void deploy(DeploymentUnit unit) throws DeploymentException { if(!ignoreDeployment(unit) && isWebServiceDeployment(unit)) { super.deploy(unit); // Calls create Deployment dep = unit.getAttachment(Deployment.class); if(null==dep || DeploymentState.CREATED != dep.getState()) throw new DeploymentException("Create step failed"); // execute the 'start' step getWsfRuntime().start(dep); } } }
public void deploy(DeploymentUnit unit) throws DeploymentException { if(!ignoreDeployment(unit) && isWebServiceDeployment(unit)) { super.deploy(unit); // Calls create Deployment dep = unit.getAttachment(Deployment.class); boolean expectedState = DeploymentState.CREATED == dep.getState() || DeploymentState.STARTED == dep.getState(); if (null == dep || !expectedState) throw new DeploymentException("Create step failed"); // execute the 'start' step getWsfRuntime().start(dep); } } }
public void deployInternal(DeploymentUnit unit, BootstrapInfo info) throws DeploymentException { if (info.getEjbServices() == null) throw new DeploymentException("Missing ejb services value: " + unit); if (isRelevant(unit) == false) return; BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(DeployersUtils.getDeploymentBeanName(unit), getDeploymentClass().getName()); buildDeployment(unit, info, builder); info.setDeployment(builder.createInject(DeployersUtils.getDeploymentBeanName(unit))); unit.addAttachment(DeployersUtils.getDeploymentAttachmentName(unit), builder.getBeanMetaData(), BeanMetaData.class); }