示例#1
0
 /** Publishes the endpoints declared to the provided WSEndpointDeploymentUnit */
 public List<Endpoint> publish(ServiceTarget target, WSEndpointDeploymentUnit unit)
     throws Exception {
   List<DeploymentAspect> aspects = DeploymentAspectsProvider.getSortedDeploymentAspects();
   ClassLoader origClassLoader = SecurityActions.getContextClassLoader();
   Deployment dep = null;
   try {
     SecurityActions.setContextClassLoader(
         ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader());
     WSDeploymentBuilder.getInstance().build(unit);
     dep = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY);
     dep.addAttachment(ServiceTarget.class, target);
     DeploymentAspectManager dam = new DeploymentAspectManagerImpl();
     dam.setDeploymentAspects(aspects);
     dam.deploy(dep);
   } finally {
     if (dep != null) {
       dep.removeAttachment(ServiceTarget.class);
     }
     SecurityActions.setContextClassLoader(origClassLoader);
   }
   Deployment deployment = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY);
   deployment.addAttachment(
       StandardContext.class,
       startWebApp(host, unit)); // TODO simplify and use findChild later in destroy()/stopWebApp()
   return deployment.getService().getEndpoints();
 }
  @Override
  public void start(final Deployment dep) {
    if (WSHelper.isJaxrpcDeployment(dep)) return;

    for (final Endpoint ep : dep.getService().getEndpoints()) {
      setInjectionAwareInstanceProvider(ep);
    }
  }
  /**
   * Creates new Http Web Service endpoint.
   *
   * @param endpointClass endpoint class name
   * @param endpointName endpoint name
   * @param dep deployment
   * @return WS endpoint
   */
  protected final Endpoint newHttpEndpoint(
      final String endpointClass, final String endpointName, final Deployment dep) {
    if (endpointName == null) throw MESSAGES.nullEndpointName();
    if (endpointClass == null) throw MESSAGES.nullEndpointClass();

    final Endpoint endpoint = this.deploymentModelFactory.newHttpEndpoint(endpointClass);
    endpoint.setShortName(endpointName);
    endpoint.setType(endpointType);
    dep.getService().addEndpoint(endpoint);

    return endpoint;
  }