1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.ws.metadata.wsdl;
// $Id: WSDLBinding.java 3217 2007-05-23 14:51:22Z palin $
import java.io.Serializable;
import java.util.ArrayList;
import javax.xml.namespace.QName;
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
/**
* A Binding component describes a concrete message format and transmission protocol which may be used
* to define an endpoint (see 2.14 Endpoint [p.62] ). That is, a Binding component defines the
* implementation details necessary to accessing the service.
*
* @author Thomas.Diesler@jboss.org
* @author <a href="jason.greene@jboss.com">Jason T. Greene</a>
* @since 10-Oct-2004
*/
public class WSDLBinding extends Extendable implements Serializable
{
private static final long serialVersionUID = -7699953670233209811L;
// provide logging
private static final Logger log = Logger.getLogger(WSDLBinding.class);
// The parent WSDL definitions element.
private final WSDLDefinitions wsdlDefinitions;
private final QName name;
/** The OPTIONAL interface attribute information item refers, by QName, to an Interface component. */
private QName interfaceName;
/** The REQUIRED type attribute information item identifies the kind of binding details contained in the Binding
* component. See wsdl20-bindings for valid values. */
private String type;
/** The set of Binding Fault components corresponding to the fault element
* information items in [children], if any.*/
private ArrayList<WSDLBindingFault> faults = new ArrayList<WSDLBindingFault>();
/** The set of Binding Operation components corresponding to the operation element
* information items in [children], if any.*/
private ArrayList<WSDLBindingOperation> operations = new ArrayList<WSDLBindingOperation>();
public WSDLBinding(WSDLDefinitions wsdlDefinitions, QName name)
{
this.wsdlDefinitions = wsdlDefinitions;
this.name = name;
}
public WSDLDefinitions getWsdlDefinitions()
{
return wsdlDefinitions;
}
public QName getName()
{
return name;
}
public QName getInterfaceName()
{
return interfaceName;
}
public void setInterfaceName(QName interfaceName)
{
log.trace("setInterfaceName: " + name);
this.interfaceName = interfaceName;
}
public WSDLInterface getInterface()
{
WSDLInterface wsdlInterface = wsdlDefinitions.getInterface(interfaceName);
if (wsdlInterface == null)
throw new WSException("Cannot get interface for name: " + interfaceName);
return wsdlInterface;
}
public String getType()
{
return type;
}
public void setType(String type)
{
this.type = type;
}
public WSDLBindingFault[] getFaults()
{
WSDLBindingFault[] arr = new WSDLBindingFault[faults.size()];
faults.toArray(arr);
return arr;
}
public void addFault(WSDLBindingFault fault)
{
faults.add(fault);
}
public WSDLBindingOperation[] getOperations()
{
WSDLBindingOperation[] arr = new WSDLBindingOperation[operations.size()];
operations.toArray(arr);
return arr;
}
public WSDLBindingOperation getOperationByRef(QName qname)
{
WSDLBindingOperation wsdlBindingOperation = null;
for (WSDLBindingOperation aux : operations)
{
if (aux.getRef().equals(qname))
{
if (wsdlBindingOperation != null)
log.warn("Multiple binding operations reference: " + qname);
wsdlBindingOperation = aux;
}
}
if (wsdlBindingOperation == null)
log.warn("Cannot obtain binding operation for ref: " + qname);
return wsdlBindingOperation;
}
public void addOperation(WSDLBindingOperation operation)
{
operations.add(operation);
}
}
|