@Override public void deploy(VFSDeploymentUnit unit, T metaData) throws DeploymentException { if (isIntegrationDeployment(unit)) { try { VirtualFile integration = VFS.getRoot(integrationURL); unit.addClassPath(integration); } catch (IOException e) { throw DeploymentException.rethrowAsDeploymentException("Error adding integration path.", e); } } }
public void deploy(DeploymentUnit unit, TestComponentMetaDataContainer deployment) throws DeploymentException { try { List<TestComponentMetaData> tests = deployment.componentMetaData; if (tests == null || tests.isEmpty()) return; for (TestComponentMetaData test : tests) addTestComponent(unit, test); } catch (Throwable t) { throw DeploymentException.rethrowAsDeploymentException("Error deploying: " + deployment, t); } }
/** * Creates a {@link NoInterfaceViewJNDIBinderFacade} MC bean for the no-interface view represented * by the <code>sessionBeanMetaData</code>. The {@link NoInterfaceViewJNDIBinderFacade} is created * only if the bean is eligible for a no-interface view as defined by the EJB3.1 spec * * <p>The {@link NoInterfaceViewJNDIBinderFacade}, thus created, will be dependent on the {@link * ControllerState#DESCRIBED} state of the container (endpoint) MC bean. This way, we ensure that * this {@link NoInterfaceViewJNDIBinderFacade} will be deployed only after the corresponding * container MC bean moves to {@link ControllerState#DESCRIBED} state. * * @param unit Deployment unit * @param sessionBeanMetaData Session bean metadata * @throws DeploymentException If any exceptions are encountered during processing of the * deployment unit */ private void deploy(DeploymentUnit unit, JBossSessionBean31MetaData sessionBeanMetaData) throws DeploymentException { try { if (!sessionBeanMetaData.isNoInterfaceBean()) { if (logger.isTraceEnabled()) { logger.trace( "Bean class " + sessionBeanMetaData.getEjbClass() + " is not eligible for no-interface view"); } return; } Class<?> beanClass = Class.forName(sessionBeanMetaData.getEjbClass(), false, unit.getClassLoader()); String containerMCBeanName = sessionBeanMetaData.getContainerName(); if (logger.isTraceEnabled()) { logger.trace( "Container name for bean " + sessionBeanMetaData.getEjbName() + " in unit " + unit + " is " + containerMCBeanName); } if (containerMCBeanName == null) { // The container name is set in the metadata only after the creation of the container // However, this deployer does not have an dependency on the creation of a container, // so getting the container name from the bean metadata won't work. Need to do a // different/better way // String containerMCBeanName = sessionBeanMetaData.getContainerName(); containerMCBeanName = getContainerName(unit, sessionBeanMetaData); } // Create the NoInterfaceViewJNDIBinder (MC bean) and add a dependency on the DESCRIBED // state of the container (endpoint) MC bean NoInterfaceViewJNDIBinderFacade noInterfaceViewJNDIBinderFacade = new NoInterfaceViewJNDIBinderFacade(new InitialContext(), beanClass, sessionBeanMetaData); String noInterfaceViewMCBeanName = unit.getName() + "$" + sessionBeanMetaData.getEjbName(); BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder( noInterfaceViewMCBeanName, noInterfaceViewJNDIBinderFacade.getClass().getName()); builder.setConstructorValue(noInterfaceViewJNDIBinderFacade); // add dependency AbstractInjectionValueMetaData injectMetaData = new AbstractInjectionValueMetaData(containerMCBeanName); // EJBTHREE-2166 - Depending on DESCRIBED state and then pushing to INSTALLED // through MC API, won't work. So for now, just depend on INSTALLED state. // injectMetaData.setDependentState(ControllerState.DESCRIBED); injectMetaData.setDependentState(ControllerState.INSTALLED); injectMetaData.setFromContext(FromContext.CONTEXT); // Too bad we have to know the field name. Need to do more research on MC to see if we can // add property metadata based on type instead of field name. builder.addPropertyMetaData("endpointContext", injectMetaData); // Add this as an attachment unit.addAttachment( BeanMetaData.class + ":" + noInterfaceViewMCBeanName, builder.getBeanMetaData()); logger.debug( "No-interface JNDI binder for container " + containerMCBeanName + " has been created and added to the deployment unit " + unit); } catch (Throwable t) { DeploymentException.rethrowAsDeploymentException( "Could not create no-interface view for " + sessionBeanMetaData.getEjbClass() + " in unit " + unit.getName(), t); } }