Save This Page
Home » geronimo-2.2-source-release » org.apache.geronimo.jaxws » [javadoc | source]
    1   /**
    2    *  Licensed to the Apache Software Foundation (ASF) under one or more
    3    *  contributor license agreements.  See the NOTICE file distributed with
    4    *  this work for additional information regarding copyright ownership.
    5    *  The ASF licenses this file to You under the Apache License, Version 2.0
    6    *  (the "License"); you may not use this file except in compliance with
    7    *  the License.  You may obtain a copy of the License at
    8    *
    9    *     http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    *  Unless required by applicable law or agreed to in writing, software
   12    *  distributed under the License is distributed on an "AS IS" BASIS,
   13    *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    *  See the License for the specific language governing permissions and
   15    *  limitations under the License.
   16    */
   17   package org.apache.geronimo.jaxws;
   18   
   19   import java.io.Serializable;
   20   import java.io.StringWriter;
   21   
   22   import javax.xml.bind.JAXBContext;
   23   import javax.xml.bind.JAXBElement;
   24   import javax.xml.bind.Marshaller;
   25   import javax.xml.namespace.QName;
   26   
   27   public class PortInfo implements Serializable {
   28   
   29       private String serviceName;
   30   
   31       private String portName;
   32   
   33       private String seiInterfaceName;
   34   
   35       private String wsdlFile;
   36   
   37       private String servletLink;
   38   
   39       private String handlersAsXML;
   40   
   41       private Boolean mtomEnabled;
   42   
   43       private String binding;
   44       
   45       private QName wsdlPort;
   46       
   47       private QName wsdlService;
   48       
   49       private String location;
   50   
   51       public String getPortName() {
   52           return portName;
   53       }
   54   
   55       public void setPortName(String pn) {
   56           portName = pn;
   57       }
   58   
   59       public String getServiceEndpointInterfaceName() {
   60           return seiInterfaceName;
   61       }
   62   
   63       public void setServiceEndpointInterfaceName(String sei) {
   64           seiInterfaceName = sei;
   65       }
   66   
   67       public String getServiceLink() {
   68           return servletLink;
   69       }
   70   
   71       public void setServiceLink(String sl) {
   72           servletLink = sl;
   73       }
   74   
   75       public String getWsdlFile() {
   76           return wsdlFile;
   77       }
   78   
   79       public void setWsdlFile(String wf) {
   80           wsdlFile = wf;
   81       }
   82   
   83       public String getServiceName() {
   84           return serviceName;
   85       }
   86   
   87       public void setServiceName(String sn) {
   88           serviceName = sn;
   89       }
   90   
   91       public void setEnableMTOM(Boolean mtomEnabled) {
   92           this.mtomEnabled = mtomEnabled;
   93       }
   94   
   95       public Boolean isMTOMEnabled() {
   96           return this.mtomEnabled;
   97       }
   98   
   99       public void setProtocolBinding(String binding) {
  100           this.binding = binding;
  101       }
  102   
  103       public String getProtocolBinding() {
  104           return binding;
  105       }
  106   
  107       /*
  108        * This is a bit tricky here since JAXB generated classes are not serializable, 
  109        * so serialize the handler chain to XML and pass it as a String. 
  110        */
  111       
  112       public void setHandlers(Class type, Object handlerChain) throws Exception {
  113           if (handlerChain == null) {
  114               return;
  115           }
  116   
  117           JAXBContext ctx = JAXBContext.newInstance(type);
  118           Marshaller m = ctx.createMarshaller();
  119           StringWriter writer = new StringWriter();
  120           /*
  121            * Since HandlerChainsType is a type, have to wrap it into some element
  122            */
  123           JAXBElement element = 
  124               new JAXBElement(HandlerChainsUtils.HANDLER_CHAINS_QNAME, type, handlerChain);
  125           m.marshal(element, writer);
  126   
  127           this.handlersAsXML = writer.toString();
  128       }
  129   
  130       public <T>T getHandlers(Class<T> type) throws Exception {
  131           return HandlerChainsUtils.toHandlerChains(this.handlersAsXML, type);
  132       }
  133   
  134       public QName getWsdlPort() {
  135           return wsdlPort;
  136       }
  137   
  138       public void setWsdlPort(QName wsdlPort) {
  139           this.wsdlPort = wsdlPort;
  140       }
  141   
  142       public QName getWsdlService() {
  143           return wsdlService;
  144       }
  145   
  146       public void setWsdlService(QName wsdlService) {
  147           this.wsdlService = wsdlService;
  148       }
  149       
  150       public String getLocation() {
  151           return location;
  152       }
  153   
  154       public void setLocation(String location) {
  155           this.location = location;
  156       }
  157       
  158       /*
  159        * private String serviceName; private String portName; private String
  160        * seiInterfaceName; private String wsdlFile; private String servletLink;
  161        */
  162       public String toString() {
  163           return "[" + serviceName + ":" + portName + ":" + seiInterfaceName
  164                   + ":" + wsdlFile + "]";
  165       }
  166   
  167       public String getHandlersAsXML() {
  168           return handlersAsXML;
  169       }
  170   
  171       public void setHandlersAsXML(String handlersAsXML) {
  172           this.handlersAsXML = handlersAsXML;
  173       }
  174   }

Save This Page
Home » geronimo-2.2-source-release » org.apache.geronimo.jaxws » [javadoc | source]