< prev index next >

src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/server/WSEndpoint.java

Print this page




 456      * This is used by the Web Service Configuration Management system so that it
 457      * closes the MOM before it creates a new WSEndpoint.  Then it calls dispose
 458      * on the existing endpoint and then installs the new endpoint.
 459      * The call to dispose also calls closeManagedObjectManager, but is a noop
 460      * if that method has already been called.
 461      */
 462     public abstract void closeManagedObjectManager();
 463 
 464     /**
 465      * This is only needed to expose info for monitoring.
 466      */
 467     public abstract @NotNull ServerTubeAssemblerContext getAssemblerContext();
 468 
 469     /**
 470      * Creates an endpoint from deployment or programmatic configuration
 471      *
 472      * <p>
 473      * This method works like the following:
 474      * <ol>
 475      * <li>{@link ServiceDefinition} is modeleed from the given SEI type.
 476      * <li>{@link Invoker} that always serves <tt>implementationObject</tt> will be used.
 477      * </ol>
 478      * @param implType
 479      *      Endpoint class(not SEI). Enpoint class must have @WebService or @WebServiceProvider
 480      *      annotation.
 481      * @param processHandlerAnnotation
 482      *      Flag to control processing of @HandlerChain on Impl class
 483      *      if true, processes @HandlerChain on Impl
 484      *      if false, DD might have set HandlerChain no need to parse.
 485      * @param invoker
 486      *      Pass an object to invoke the actual endpoint object. If it is null, a default
 487      *      invoker is created using {@link InstanceResolver#createDefault}. Appservers
 488      *      could create its own invoker to do additional functions like transactions,
 489      *      invoking the endpoint through proxy etc.
 490      * @param serviceName
 491      *      Optional service name(may be from DD) to override the one given by the
 492      *      implementation class. If it is null, it will be derived from annotations.
 493      * @param portName
 494      *      Optional port name(may be from DD) to override the one given by the
 495      *      implementation class. If it is null, it will be derived from annotations.
 496      * @param container


 504      *
 505      * TODO: DD has a configuration for MTOM threshold.
 506      * Maybe we need something more generic so that other technologies
 507      * like Tango can get information from DD.
 508      *
 509      * TODO: does it really make sense for this to take EntityResolver?
 510      * Given that all metadata has to be given as a list anyway.
 511      *
 512      * @param primaryWsdl
 513      *      The {@link ServiceDefinition#getPrimary() primary} WSDL.
 514      *      If null, it'll be generated based on the SEI (if this is an SEI)
 515      *      or no WSDL is associated (if it's a provider.)
 516      *      TODO: shouldn't the implementation find this from the metadata list?
 517      * @param metadata
 518      *      Other documents that become {@link SDDocument}s. Can be null.
 519      * @param resolver
 520      *      Optional resolver used to de-reference resources referenced from
 521      *      WSDL. Must be null if the {@code url} is null.
 522      * @param isTransportSynchronous
 523      *      If the caller knows that the returned {@link WSEndpoint} is going to be
 524      *      used by a synchronous-only transport, then it may pass in <tt>true</tt>
 525      *      to allow the callee to perform an optimization based on that knowledge
 526      *      (since often synchronous version is cheaper than an asynchronous version.)
 527      *      This value is visible from {@link ServerTubeAssemblerContext#isSynchronous()}.
 528      *
 529      * @return newly constructed {@link WSEndpoint}.
 530      * @throws WebServiceException
 531      *      if the endpoint set up fails.
 532      */
 533     public static <T> WSEndpoint<T> create(
 534             @NotNull Class<T> implType,
 535             boolean processHandlerAnnotation,
 536             @Nullable Invoker invoker,
 537             @Nullable QName serviceName,
 538             @Nullable QName portName,
 539             @Nullable Container container,
 540             @Nullable WSBinding binding,
 541             @Nullable SDDocumentSource primaryWsdl,
 542             @Nullable Collection<? extends SDDocumentSource> metadata,
 543             @Nullable EntityResolver resolver,
 544             boolean isTransportSynchronous) {


 566         final Iterator<ManagedEndpointFactory> managementFactories = ServiceFinder.find(ManagedEndpointFactory.class).iterator();
 567         if (managementFactories.hasNext()) {
 568             final ManagedEndpointFactory managementFactory = managementFactories.next();
 569             final EndpointCreationAttributes attributes = new EndpointCreationAttributes(
 570                     processHandlerAnnotation, invoker, resolver, isTransportSynchronous);
 571 
 572             WSEndpoint<T> managedEndpoint = managementFactory.createEndpoint(endpoint, attributes);
 573 
 574             if (endpoint.getAssemblerContext().getTerminalTube() instanceof EndpointAwareTube) {
 575                 ((EndpointAwareTube)endpoint.getAssemblerContext().getTerminalTube()).setEndpoint(managedEndpoint);
 576             }
 577 
 578             return managedEndpoint;
 579         }
 580 
 581 
 582         return endpoint;
 583     }
 584 
 585     /**
 586      * Deprecated version that assumes <tt>isTransportSynchronous==false</tt>
 587      */
 588     @Deprecated
 589     public static <T> WSEndpoint<T> create(
 590         @NotNull Class<T> implType,
 591         boolean processHandlerAnnotation,
 592         @Nullable Invoker invoker,
 593         @Nullable QName serviceName,
 594         @Nullable QName portName,
 595         @Nullable Container container,
 596         @Nullable WSBinding binding,
 597         @Nullable SDDocumentSource primaryWsdl,
 598         @Nullable Collection<? extends SDDocumentSource> metadata,
 599         @Nullable EntityResolver resolver) {
 600         return create(implType,processHandlerAnnotation,invoker,serviceName,portName,container,binding,primaryWsdl,metadata,resolver,false);
 601     }
 602 
 603 
 604     /**
 605      * The same as
 606      * {@link #create(Class, boolean, Invoker, QName, QName, Container, WSBinding, SDDocumentSource, Collection, EntityResolver)}
 607      * except that this version takes an url of the <tt>jax-ws-catalog.xml</tt>.
 608      *
 609      * @param catalogUrl
 610      *      if not null, an {@link EntityResolver} is created from it and used.
 611      *      otherwise no resolution will be performed.
 612      */
 613     public static <T> WSEndpoint<T> create(
 614         @NotNull Class<T> implType,
 615         boolean processHandlerAnnotation,
 616         @Nullable Invoker invoker,
 617         @Nullable QName serviceName,
 618         @Nullable QName portName,
 619         @Nullable Container container,
 620         @Nullable WSBinding binding,
 621         @Nullable SDDocumentSource primaryWsdl,
 622         @Nullable Collection<? extends SDDocumentSource> metadata,
 623         @Nullable URL catalogUrl) {
 624         return create(
 625             implType,processHandlerAnnotation,invoker,serviceName,portName,container,binding,primaryWsdl,metadata,
 626             XmlUtil.createEntityResolver(catalogUrl),false);
 627     }




 456      * This is used by the Web Service Configuration Management system so that it
 457      * closes the MOM before it creates a new WSEndpoint.  Then it calls dispose
 458      * on the existing endpoint and then installs the new endpoint.
 459      * The call to dispose also calls closeManagedObjectManager, but is a noop
 460      * if that method has already been called.
 461      */
 462     public abstract void closeManagedObjectManager();
 463 
 464     /**
 465      * This is only needed to expose info for monitoring.
 466      */
 467     public abstract @NotNull ServerTubeAssemblerContext getAssemblerContext();
 468 
 469     /**
 470      * Creates an endpoint from deployment or programmatic configuration
 471      *
 472      * <p>
 473      * This method works like the following:
 474      * <ol>
 475      * <li>{@link ServiceDefinition} is modeleed from the given SEI type.
 476      * <li>{@link Invoker} that always serves {@code implementationObject} will be used.
 477      * </ol>
 478      * @param implType
 479      *      Endpoint class(not SEI). Enpoint class must have @WebService or @WebServiceProvider
 480      *      annotation.
 481      * @param processHandlerAnnotation
 482      *      Flag to control processing of @HandlerChain on Impl class
 483      *      if true, processes @HandlerChain on Impl
 484      *      if false, DD might have set HandlerChain no need to parse.
 485      * @param invoker
 486      *      Pass an object to invoke the actual endpoint object. If it is null, a default
 487      *      invoker is created using {@link InstanceResolver#createDefault}. Appservers
 488      *      could create its own invoker to do additional functions like transactions,
 489      *      invoking the endpoint through proxy etc.
 490      * @param serviceName
 491      *      Optional service name(may be from DD) to override the one given by the
 492      *      implementation class. If it is null, it will be derived from annotations.
 493      * @param portName
 494      *      Optional port name(may be from DD) to override the one given by the
 495      *      implementation class. If it is null, it will be derived from annotations.
 496      * @param container


 504      *
 505      * TODO: DD has a configuration for MTOM threshold.
 506      * Maybe we need something more generic so that other technologies
 507      * like Tango can get information from DD.
 508      *
 509      * TODO: does it really make sense for this to take EntityResolver?
 510      * Given that all metadata has to be given as a list anyway.
 511      *
 512      * @param primaryWsdl
 513      *      The {@link ServiceDefinition#getPrimary() primary} WSDL.
 514      *      If null, it'll be generated based on the SEI (if this is an SEI)
 515      *      or no WSDL is associated (if it's a provider.)
 516      *      TODO: shouldn't the implementation find this from the metadata list?
 517      * @param metadata
 518      *      Other documents that become {@link SDDocument}s. Can be null.
 519      * @param resolver
 520      *      Optional resolver used to de-reference resources referenced from
 521      *      WSDL. Must be null if the {@code url} is null.
 522      * @param isTransportSynchronous
 523      *      If the caller knows that the returned {@link WSEndpoint} is going to be
 524      *      used by a synchronous-only transport, then it may pass in {@code true}
 525      *      to allow the callee to perform an optimization based on that knowledge
 526      *      (since often synchronous version is cheaper than an asynchronous version.)
 527      *      This value is visible from {@link ServerTubeAssemblerContext#isSynchronous()}.
 528      *
 529      * @return newly constructed {@link WSEndpoint}.
 530      * @throws WebServiceException
 531      *      if the endpoint set up fails.
 532      */
 533     public static <T> WSEndpoint<T> create(
 534             @NotNull Class<T> implType,
 535             boolean processHandlerAnnotation,
 536             @Nullable Invoker invoker,
 537             @Nullable QName serviceName,
 538             @Nullable QName portName,
 539             @Nullable Container container,
 540             @Nullable WSBinding binding,
 541             @Nullable SDDocumentSource primaryWsdl,
 542             @Nullable Collection<? extends SDDocumentSource> metadata,
 543             @Nullable EntityResolver resolver,
 544             boolean isTransportSynchronous) {


 566         final Iterator<ManagedEndpointFactory> managementFactories = ServiceFinder.find(ManagedEndpointFactory.class).iterator();
 567         if (managementFactories.hasNext()) {
 568             final ManagedEndpointFactory managementFactory = managementFactories.next();
 569             final EndpointCreationAttributes attributes = new EndpointCreationAttributes(
 570                     processHandlerAnnotation, invoker, resolver, isTransportSynchronous);
 571 
 572             WSEndpoint<T> managedEndpoint = managementFactory.createEndpoint(endpoint, attributes);
 573 
 574             if (endpoint.getAssemblerContext().getTerminalTube() instanceof EndpointAwareTube) {
 575                 ((EndpointAwareTube)endpoint.getAssemblerContext().getTerminalTube()).setEndpoint(managedEndpoint);
 576             }
 577 
 578             return managedEndpoint;
 579         }
 580 
 581 
 582         return endpoint;
 583     }
 584 
 585     /**
 586      * Deprecated version that assumes {@code isTransportSynchronous==false}
 587      */
 588     @Deprecated
 589     public static <T> WSEndpoint<T> create(
 590         @NotNull Class<T> implType,
 591         boolean processHandlerAnnotation,
 592         @Nullable Invoker invoker,
 593         @Nullable QName serviceName,
 594         @Nullable QName portName,
 595         @Nullable Container container,
 596         @Nullable WSBinding binding,
 597         @Nullable SDDocumentSource primaryWsdl,
 598         @Nullable Collection<? extends SDDocumentSource> metadata,
 599         @Nullable EntityResolver resolver) {
 600         return create(implType,processHandlerAnnotation,invoker,serviceName,portName,container,binding,primaryWsdl,metadata,resolver,false);
 601     }
 602 
 603 
 604     /**
 605      * The same as
 606      * {@link #create(Class, boolean, Invoker, QName, QName, Container, WSBinding, SDDocumentSource, Collection, EntityResolver)}
 607      * except that this version takes an url of the {@code jax-ws-catalog.xml}.
 608      *
 609      * @param catalogUrl
 610      *      if not null, an {@link EntityResolver} is created from it and used.
 611      *      otherwise no resolution will be performed.
 612      */
 613     public static <T> WSEndpoint<T> create(
 614         @NotNull Class<T> implType,
 615         boolean processHandlerAnnotation,
 616         @Nullable Invoker invoker,
 617         @Nullable QName serviceName,
 618         @Nullable QName portName,
 619         @Nullable Container container,
 620         @Nullable WSBinding binding,
 621         @Nullable SDDocumentSource primaryWsdl,
 622         @Nullable Collection<? extends SDDocumentSource> metadata,
 623         @Nullable URL catalogUrl) {
 624         return create(
 625             implType,processHandlerAnnotation,invoker,serviceName,portName,container,binding,primaryWsdl,metadata,
 626             XmlUtil.createEntityResolver(catalogUrl),false);
 627     }


< prev index next >