0001: package org.apache.axis2.description;
0002:
0003: import org.apache.axiom.om.OMAbstractFactory;
0004: import org.apache.axiom.om.OMAttribute;
0005: import org.apache.axiom.om.OMElement;
0006: import org.apache.axiom.om.OMFactory;
0007: import org.apache.axiom.om.OMNamespace;
0008: import org.apache.axiom.om.OMNode;
0009: import org.apache.axis2.addressing.AddressingConstants;
0010: import org.apache.axis2.engine.AxisConfiguration;
0011: import org.apache.axis2.namespace.Constants;
0012: import org.apache.axis2.util.ExternalPolicySerializer;
0013: import org.apache.axis2.util.PolicyUtil;
0014: import org.apache.axis2.util.XMLUtils;
0015: import org.apache.axis2.util.WSDLSerializationUtil;
0016: import org.apache.axis2.util.JavaUtils;
0017: import org.apache.axis2.wsdl.SOAPHeaderMessage;
0018: import org.apache.axis2.wsdl.WSDLConstants;
0019: import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
0020: import org.apache.neethi.Policy;
0021: import org.apache.neethi.PolicyComponent;
0022: import org.apache.neethi.PolicyReference;
0023: import org.apache.neethi.PolicyRegistry;
0024: import org.apache.ws.commons.schema.XmlSchema;
0025:
0026: import javax.xml.namespace.QName;
0027: import java.io.StringReader;
0028: import java.io.StringWriter;
0029: import java.net.URI;
0030: import java.util.ArrayList;
0031: import java.util.HashMap;
0032: import java.util.HashSet;
0033: import java.util.Iterator;
0034: import java.util.Map;
0035:
0036: /*
0037: * Copyright 2004,2005 The Apache Software Foundation.
0038: *
0039: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
0040: * use this file except in compliance with the License. You may obtain a copy of
0041: * the License at
0042: *
0043: * http://www.apache.org/licenses/LICENSE-2.0
0044: *
0045: * Unless required by applicable law or agreed to in writing, software
0046: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
0047: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
0048: * License for the specific language governing permissions and limitations under
0049: * the License.
0050: *
0051: *
0052: */
0053:
0054: public class AxisService2WSDL11 implements Java2WSDLConstants {
0055:
0056: private AxisService axisService;
0057:
0058: private String[] serviceEndpointURLs;
0059:
0060: private String targetNamespace;
0061:
0062: private OMElement definition;
0063:
0064: private OMNamespace soap;
0065:
0066: private OMNamespace soap12;
0067:
0068: private OMNamespace http;
0069:
0070: private OMNamespace mime;
0071:
0072: private OMNamespace tns;
0073:
0074: private OMNamespace wsdl;
0075:
0076: private OMNamespace wsaw;
0077:
0078: private String style = DOCUMENT;
0079:
0080: private String use = LITERAL;
0081:
0082: private HashMap policiesInDefinitions;
0083:
0084: private ExternalPolicySerializer serializer;
0085:
0086: private HashMap messagesMap;
0087:
0088: public AxisService2WSDL11(AxisService service) throws Exception {
0089: this .axisService = service;
0090:
0091: // the EPR list of AxisService contains REST EPRs as well. Those REST EPRs will be used to generated HTTPBinding
0092: // and rest of the EPRs will be used to generate SOAP 1.1 and 1.2 bindings. Let's first initialize those set of
0093: // EPRs now to be used later, especially when we generate the WSDL.
0094: serviceEndpointURLs = service.getEPRs();
0095: if (serviceEndpointURLs == null) {
0096: Map endpointMap = service.getEndpoints();
0097: if (endpointMap.size() > 0) {
0098: Iterator endpointItr = endpointMap.values().iterator();
0099: if (endpointItr.hasNext()) {
0100: AxisEndpoint endpoint = (AxisEndpoint) endpointItr
0101: .next();
0102: serviceEndpointURLs = new String[] { endpoint
0103: .getEndpointURL() };
0104: }
0105:
0106: } else {
0107: serviceEndpointURLs = new String[] { service
0108: .getEndpointName() };
0109: }
0110: }
0111:
0112: this .targetNamespace = service.getTargetNamespace();
0113:
0114: serializer = new ExternalPolicySerializer();
0115: // CHECKME check whether service.getAxisConfiguration() return null ???
0116:
0117: AxisConfiguration configuration = service
0118: .getAxisConfiguration();
0119: if (configuration != null) {
0120: serializer.setAssertionsToFilter(configuration
0121: .getLocalPolicyAssertions());
0122: }
0123:
0124: }
0125:
0126: public OMElement generateOM() throws Exception {
0127:
0128: OMFactory fac = OMAbstractFactory.getOMFactory();
0129: wsdl = fac.createOMNamespace(WSDL_NAMESPACE,
0130: DEFAULT_WSDL_NAMESPACE_PREFIX);
0131: OMElement ele = fac.createOMElement("definitions", wsdl);
0132: setDefinitionElement(ele);
0133:
0134: policiesInDefinitions = new HashMap();
0135:
0136: Map namespaceMap = axisService.getNamespaceMap();
0137: if (namespaceMap == null)
0138: namespaceMap = new HashMap();
0139:
0140: WSDLSerializationUtil.populateNamespaces(ele, namespaceMap);
0141: soap = ele.declareNamespace(URI_WSDL11_SOAP, SOAP11_PREFIX);
0142: soap12 = ele.declareNamespace(URI_WSDL12_SOAP, SOAP12_PREFIX);
0143: http = ele.declareNamespace(HTTP_NAMESPACE, HTTP_PREFIX);
0144: mime = ele.declareNamespace(MIME_NAMESPACE, MIME_PREFIX);
0145: wsaw = ele.declareNamespace(
0146: AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
0147: String prefix = WSDLSerializationUtil.getPrefix(axisService
0148: .getTargetNamespace(), namespaceMap);
0149: if (prefix == null || "".equals(prefix)) {
0150: prefix = DEFAULT_TARGET_NAMESPACE_PREFIX;
0151: }
0152:
0153: namespaceMap.put(prefix, axisService.getTargetNamespace());
0154: tns = ele.declareNamespace(axisService.getTargetNamespace(),
0155: prefix);
0156:
0157: boolean disableREST = false;
0158: Parameter disableRESTParameter = axisService
0159: .getParameter(org.apache.axis2.Constants.Configuration.DISABLE_REST);
0160: if (disableRESTParameter != null
0161: && JavaUtils.isTrueExplicitly(disableRESTParameter
0162: .getValue())) {
0163: disableREST = true;
0164: }
0165:
0166: // adding documentation element
0167: // <documentation><b>NEW!</b> This method accepts an ISBN
0168: // string and returns <b>Amazon.co.uk</b> Sales Rank for
0169: // that book.</documentation>
0170: WSDLSerializationUtil.addWSDLDocumentationElement(axisService,
0171: ele, fac, wsdl);
0172:
0173: ele.addAttribute("targetNamespace", axisService
0174: .getTargetNamespace(), null);
0175: OMElement wsdlTypes = fac.createOMElement("types", wsdl);
0176: ele.addChild(wsdlTypes);
0177:
0178: // populate the schema mappings
0179: axisService.populateSchemaMappings();
0180:
0181: ArrayList schemas = axisService.getSchema();
0182: for (int i = 0; i < schemas.size(); i++) {
0183: StringWriter writer = new StringWriter();
0184:
0185: // XmlSchema schema = (XmlSchema) schemas.get(i);
0186: XmlSchema schema = axisService.getSchema(i);
0187:
0188: String targetNamespace = schema.getTargetNamespace();
0189: if (!Constants.NS_URI_XML.equals(targetNamespace)) {
0190: schema.write(writer);
0191: String schemaString = writer.toString();
0192: if (!"".equals(schemaString)) {
0193: wsdlTypes.addChild(XMLUtils.toOM(new StringReader(
0194: schemaString)));
0195: }
0196: }
0197: }
0198: generateMessages(fac, ele);
0199: generatePortType(fac, ele);
0200: generateSOAP11Binding(fac, ele);
0201: generateSOAP12Binding(fac, ele);
0202: if (!disableREST) {
0203: generateHTTPBinding(fac, ele);
0204: }
0205:
0206: generateService(fac, ele, disableREST);
0207: addPoliciesToDefinitionElement(policiesInDefinitions.values()
0208: .iterator(), definition);
0209:
0210: return ele;
0211: }
0212:
0213: private void generateMessages(OMFactory fac, OMElement defintions) {
0214: HashSet faultMessageNames = new HashSet();
0215: messagesMap = new HashMap();
0216:
0217: Iterator operations = axisService.getOperations();
0218: while (operations.hasNext()) {
0219: AxisOperation axisOperation = (AxisOperation) operations
0220: .next();
0221: if (axisOperation.isControlOperation()) {
0222: continue;
0223: }
0224: String MEP = axisOperation.getMessageExchangePattern();
0225: if (WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP)
0226: || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT
0227: .equals(MEP)
0228: || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN
0229: .equals(MEP)
0230: || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY
0231: .equals(MEP)
0232: || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY
0233: .equals(MEP)
0234: || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) {
0235: AxisMessage inaxisMessage = axisOperation
0236: .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
0237: if (inaxisMessage != null) {
0238: writeMessage(inaxisMessage, fac, defintions);
0239: generateHeaderMessages(inaxisMessage, fac,
0240: defintions);
0241: }
0242: }
0243:
0244: if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(MEP)
0245: || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN
0246: .equals(MEP)
0247: || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT
0248: .equals(MEP)
0249: || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY
0250: .equals(MEP)
0251: || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY
0252: .equals(MEP)
0253: || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) {
0254: AxisMessage outAxisMessage = axisOperation
0255: .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
0256: if (outAxisMessage != null) {
0257: writeMessage(outAxisMessage, fac, defintions);
0258: generateHeaderMessages(outAxisMessage, fac,
0259: defintions);
0260: }
0261: }
0262:
0263: // generate fault Messages
0264: ArrayList faultyMessages = axisOperation.getFaultMessages();
0265: if (faultyMessages != null) {
0266: for (int i = 0; i < faultyMessages.size(); i++) {
0267: AxisMessage axisMessage = (AxisMessage) faultyMessages
0268: .get(i);
0269: String name = axisMessage.getName();
0270: if (faultMessageNames.add(name)) {
0271: writeMessage(axisMessage, fac, defintions);
0272: generateHeaderMessages(axisMessage, fac,
0273: defintions);
0274: }
0275: }
0276: }
0277: }
0278: }
0279:
0280: private void generateHeaderMessages(AxisMessage axismessage,
0281: OMFactory fac, OMElement defintions) {
0282: ArrayList extList = axismessage.getSoapHeaders();
0283: for (int i = 0; i < extList.size(); i++) {
0284: SOAPHeaderMessage header = (SOAPHeaderMessage) extList
0285: .get(i);
0286: OMElement messageElement = fac.createOMElement(
0287: MESSAGE_LOCAL_NAME, wsdl);
0288: messageElement.addAttribute(ATTRIBUTE_NAME, header
0289: .getMessage().getLocalPart(), null);
0290: defintions.addChild(messageElement);
0291: OMElement messagePart = fac.createOMElement(
0292: PART_ATTRIBUTE_NAME, wsdl);
0293: messageElement.addChild(messagePart);
0294: messagePart.addAttribute(ATTRIBUTE_NAME, header.part(),
0295: null);
0296: if (header.getElement() == null) {
0297: throw new RuntimeException(ELEMENT_ATTRIBUTE_NAME
0298: + " is null for " + header.getMessage());
0299: }
0300: messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
0301: WSDLSerializationUtil.getPrefix(header.getElement()
0302: .getNamespaceURI(), axisService
0303: .getNamespaceMap())
0304: + ":" + header.getElement().getLocalPart(),
0305: null);
0306: }
0307: }
0308:
0309: private void writeMessage(AxisMessage axismessage, OMFactory fac,
0310: OMElement defintions) {
0311: if (messagesMap.get(axismessage.getName()) == null) {
0312: messagesMap.put(axismessage.getName(), axismessage);
0313: QName schemaElementName = axismessage.getElementQName();
0314: OMElement messageElement = fac.createOMElement(
0315: MESSAGE_LOCAL_NAME, wsdl);
0316: messageElement.addAttribute(ATTRIBUTE_NAME, axismessage
0317: .getName(), null);
0318: defintions.addChild(messageElement);
0319: if (schemaElementName != null) {
0320: OMElement messagePart = fac.createOMElement(
0321: PART_ATTRIBUTE_NAME, wsdl);
0322: messageElement.addChild(messagePart);
0323: if (axismessage.getMessagePartName() != null) {
0324: messagePart.addAttribute(ATTRIBUTE_NAME,
0325: axismessage.getMessagePartName(), null);
0326: } else {
0327: messagePart.addAttribute(ATTRIBUTE_NAME,
0328: axismessage.getPartName(), null);
0329: }
0330: messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
0331: WSDLSerializationUtil.getPrefix(
0332: schemaElementName.getNamespaceURI(),
0333: axisService.getNamespaceMap())
0334: + ":"
0335: + schemaElementName.getLocalPart(),
0336: null);
0337: }
0338: }
0339:
0340: }
0341:
0342: /**
0343: * Builds the <portType> element in the passed WSDL definition. When this returns
0344: * successfully, there will be a new child element under definitons for the portType.
0345: *
0346: * @param fac the active OMFactory
0347: * @param defintions the WSDL <definitions> element
0348: * @throws Exception if there's a problem
0349: */
0350: private void generatePortType(OMFactory fac, OMElement defintions)
0351: throws Exception {
0352: OMElement portType = fac.createOMElement(PORT_TYPE_LOCAL_NAME,
0353: wsdl);
0354: defintions.addChild(portType);
0355:
0356: portType.addAttribute(ATTRIBUTE_NAME, axisService.getName()
0357: + PORT_TYPE_SUFFIX, null);
0358:
0359: addPolicyAsExtAttribute(PolicyInclude.PORT_TYPE_POLICY,
0360: axisService.getPolicyInclude(), portType, fac);
0361: for (Iterator operations = axisService.getOperations(); operations
0362: .hasNext();) {
0363: AxisOperation axisOperation = (AxisOperation) operations
0364: .next();
0365: if (axisOperation.isControlOperation()
0366: || axisOperation.getName() == null) {
0367: continue;
0368: }
0369: String operationName = axisOperation.getName()
0370: .getLocalPart();
0371: OMElement operation = fac.createOMElement(
0372: OPERATION_LOCAL_NAME, wsdl);
0373: WSDLSerializationUtil.addWSDLDocumentationElement(
0374: axisOperation, operation, fac, wsdl);
0375: portType.addChild(operation);
0376: operation.addAttribute(ATTRIBUTE_NAME, operationName, null);
0377: addPolicyAsExtElement(PolicyInclude.OPERATION_POLICY,
0378: axisOperation.getPolicyInclude(), operation);
0379:
0380: String MEP = axisOperation.getMessageExchangePattern();
0381: if (WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP)
0382: || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT
0383: .equals(MEP)
0384: || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN
0385: .equals(MEP)
0386: || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY
0387: .equals(MEP)
0388: || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY
0389: .equals(MEP)
0390: || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) {
0391: AxisMessage inaxisMessage = axisOperation
0392: .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
0393: if (inaxisMessage != null) {
0394: OMElement input = fac.createOMElement(
0395: IN_PUT_LOCAL_NAME, wsdl);
0396: WSDLSerializationUtil.addWSDLDocumentationElement(
0397: inaxisMessage, input, fac, wsdl);
0398: input.addAttribute(MESSAGE_LOCAL_NAME, tns
0399: .getPrefix()
0400: + ":" + inaxisMessage.getName(), null);
0401: addPolicyAsExtElement(PolicyInclude.INPUT_POLICY,
0402: inaxisMessage.getPolicyInclude(), input);
0403: WSDLSerializationUtil.addWSAWActionAttribute(input,
0404: axisOperation.getInputAction(), wsaw);
0405: operation.addChild(input);
0406: }
0407: }
0408:
0409: if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(MEP)
0410: || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN
0411: .equals(MEP)
0412: || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT
0413: .equals(MEP)
0414: || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY
0415: .equals(MEP)
0416: || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY
0417: .equals(MEP)
0418: || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) {
0419: AxisMessage outAxisMessage = axisOperation
0420: .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
0421: if (outAxisMessage != null) {
0422: OMElement output = fac.createOMElement(
0423: OUT_PUT_LOCAL_NAME, wsdl);
0424: WSDLSerializationUtil.addWSDLDocumentationElement(
0425: outAxisMessage, output, fac, wsdl);
0426: output.addAttribute(MESSAGE_LOCAL_NAME, tns
0427: .getPrefix()
0428: + ":" + outAxisMessage.getName(), null);
0429: addPolicyAsExtElement(PolicyInclude.OUTPUT_POLICY,
0430: outAxisMessage.getPolicyInclude(), output);
0431: WSDLSerializationUtil.addWSAWActionAttribute(
0432: output, axisOperation.getOutputAction(),
0433: wsaw);
0434: operation.addChild(output);
0435: }
0436: }
0437:
0438: // generate fault Messages
0439: ArrayList faultMessages = axisOperation.getFaultMessages();
0440: if (faultMessages != null) {
0441: for (int i = 0; i < faultMessages.size(); i++) {
0442: AxisMessage faultyMessage = (AxisMessage) faultMessages
0443: .get(i);
0444: OMElement fault = fac.createOMElement(
0445: FAULT_LOCAL_NAME, wsdl);
0446: WSDLSerializationUtil.addWSDLDocumentationElement(
0447: faultyMessage, fault, fac, wsdl);
0448: fault.addAttribute(MESSAGE_LOCAL_NAME, tns
0449: .getPrefix()
0450: + ":" + faultyMessage.getName(), null);
0451: fault.addAttribute(ATTRIBUTE_NAME, faultyMessage
0452: .getName(), null);
0453: WSDLSerializationUtil.addWSAWActionAttribute(fault,
0454: axisOperation.getFaultAction(faultyMessage
0455: .getName()), wsaw);
0456: // TODO add policies for fault messages
0457: operation.addChild(fault);
0458: }
0459: }
0460:
0461: }
0462: }
0463:
0464: /**
0465: * Generate the WSDL <service> element
0466: *
0467: * @param fac the active OMFactory
0468: * @param defintions the WSDL <definitions> element under which to put the service
0469: * @param disableREST if false, generate REST binding, if true, don't
0470: * @throws Exception if there's a problem
0471: */
0472: public void generateService(OMFactory fac, OMElement defintions,
0473: boolean disableREST) throws Exception {
0474: OMElement service = fac.createOMElement(SERVICE_LOCAL_NAME,
0475: wsdl);
0476: defintions.addChild(service);
0477: service.addAttribute(ATTRIBUTE_NAME, axisService.getName(),
0478: null);
0479: generateSOAP11Ports(fac, service);
0480: generateSOAP12Ports(fac, service);
0481:
0482: addPolicyAsExtElement(PolicyInclude.SERVICE_POLICY, axisService
0483: .getPolicyInclude(), service);
0484: if (!disableREST) {
0485: generateHTTPPorts(fac, service);
0486: }
0487: }
0488:
0489: private void generateSOAP11Ports(OMFactory fac, OMElement service)
0490: throws Exception {
0491: for (int i = 0; i < serviceEndpointURLs.length; i++) {
0492: String urlString = serviceEndpointURLs[i];
0493: if (urlString != null) {
0494: String protocol = new URI(urlString).getScheme();
0495: OMElement port = fac.createOMElement(PORT, wsdl);
0496: service.addChild(port);
0497: String name = axisService.getName() + SOAP11PORT
0498: + ((protocol == null) ? "" : "_" + protocol);
0499: if (i > 0) {
0500: name += i;
0501: }
0502: port.addAttribute(ATTRIBUTE_NAME, name, null);
0503: port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix()
0504: + ":" + axisService.getName()
0505: + BINDING_NAME_SUFFIX, null);
0506: WSDLSerializationUtil.addExtensionElement(fac, port,
0507: SOAP_ADDRESS, LOCATION, urlString, soap);
0508:
0509: addPolicyAsExtElement(PolicyInclude.PORT_POLICY,
0510: axisService.getPolicyInclude(), port);
0511: }
0512: }
0513:
0514: }
0515:
0516: private void generateHTTPPorts(OMFactory fac, OMElement service)
0517: throws Exception {
0518: for (int i = 0; i < serviceEndpointURLs.length; i++) {
0519: String urlString = serviceEndpointURLs[i];
0520: if (urlString != null && urlString.startsWith("http")) {
0521: OMElement port = fac.createOMElement(PORT, wsdl);
0522: service.addChild(port);
0523: String name = axisService.getName() + HTTP_PORT;
0524: if (i > 0) {
0525: name += i;
0526: }
0527: port.addAttribute(ATTRIBUTE_NAME, name, null);
0528: port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix()
0529: + ":" + axisService.getName() + HTTP_BINDING,
0530: null);
0531: OMElement extElement = fac.createOMElement("address",
0532: http);
0533: port.addChild(extElement);
0534: // urlString = urlString.replaceAll(servicePath, "rest");
0535: extElement.addAttribute("location", urlString, null);
0536: }
0537: }
0538: }
0539:
0540: private void generateSOAP12Ports(OMFactory fac, OMElement service)
0541: throws Exception {
0542: for (int i = 0; i < serviceEndpointURLs.length; i++) {
0543: String urlString = serviceEndpointURLs[i];
0544: if (urlString != null) {
0545: String protocol = new URI(urlString).getScheme();
0546: OMElement port = fac.createOMElement(PORT, wsdl);
0547: service.addChild(port);
0548: String name = axisService.getName() + SOAP12PORT
0549: + ((protocol == null) ? "" : "_" + protocol);
0550: if (i > 0) {
0551: name += i;
0552: }
0553: port.addAttribute(ATTRIBUTE_NAME, name, null);
0554: port.addAttribute(BINDING_LOCAL_NAME, tns.getPrefix()
0555: + ":" + axisService.getName()
0556: + SOAP12BINDING_NAME_SUFFIX, null);
0557: WSDLSerializationUtil.addExtensionElement(fac, port,
0558: SOAP_ADDRESS, LOCATION, urlString, soap12);
0559:
0560: addPolicyAsExtElement(PolicyInclude.PORT_POLICY,
0561: axisService.getPolicyInclude(), port);
0562: }
0563: }
0564: }
0565:
0566: /**
0567: * Generate the <binding> for SOAP 1.1 underneath the passed definitions
0568: *
0569: * @param fac the active OMFactory
0570: * @param defintions the WSDL <definitions> element under which to put the binding
0571: * @throws Exception if there's a problem
0572: */
0573: private void generateSOAP11Binding(OMFactory fac,
0574: OMElement defintions) throws Exception {
0575: OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME,
0576: wsdl);
0577: defintions.addChild(binding);
0578: binding.addAttribute(ATTRIBUTE_NAME, axisService.getName()
0579: + BINDING_NAME_SUFFIX, null);
0580: binding.addAttribute("type", tns.getPrefix() + ":"
0581: + axisService.getName() + PORT_TYPE_SUFFIX, null);
0582:
0583: addPolicyAsExtElement(PolicyInclude.AXIS_SERVICE_POLICY,
0584: axisService.getPolicyInclude(), binding);
0585: addPolicyAsExtElement(PolicyInclude.BINDING_POLICY, axisService
0586: .getPolicyInclude(), binding);
0587:
0588: // Adding ext elements
0589: addExtensionElement(fac, binding, BINDING_LOCAL_NAME,
0590: TRANSPORT, TRANSPORT_URI, STYLE, style, soap);
0591:
0592: // Add WS-Addressing UsingAddressing element if appropriate
0593: // SHOULD be on the binding element per the specification
0594: if (axisService.getWSAddressingFlag().equals(
0595: AddressingConstants.ADDRESSING_OPTIONAL)) {
0596: WSDLSerializationUtil.addExtensionElement(fac, binding,
0597: AddressingConstants.USING_ADDRESSING,
0598: DEFAULT_WSDL_NAMESPACE_PREFIX + ":required",
0599: "true", wsaw);
0600: } else if (axisService.getWSAddressingFlag().equals(
0601: AddressingConstants.ADDRESSING_REQUIRED)) {
0602: WSDLSerializationUtil.addExtensionElement(fac, binding,
0603: AddressingConstants.USING_ADDRESSING,
0604: DEFAULT_WSDL_NAMESPACE_PREFIX + ":required",
0605: "true", wsaw);
0606: }
0607:
0608: for (Iterator operations = axisService.getOperations(); operations
0609: .hasNext();) {
0610: AxisOperation axisOperation = (AxisOperation) operations
0611: .next();
0612: if (axisOperation.isControlOperation()
0613: || axisOperation.getName() == null) {
0614: continue;
0615: }
0616: String operationName = axisOperation.getName()
0617: .getLocalPart();
0618: OMElement operation = fac.createOMElement(
0619: OPERATION_LOCAL_NAME, wsdl);
0620: binding.addChild(operation);
0621: String soapAction = axisOperation.getSoapAction();
0622: if (soapAction == null) {
0623: soapAction = "";
0624: }
0625: addExtensionElement(fac, operation, OPERATION_LOCAL_NAME,
0626: SOAP_ACTION, soapAction, STYLE, style, soap);
0627:
0628: addPolicyAsExtElement(
0629: PolicyInclude.BINDING_OPERATION_POLICY,
0630: axisOperation.getPolicyInclude(), operation);
0631: addPolicyAsExtElement(PolicyInclude.AXIS_OPERATION_POLICY,
0632: axisOperation.getPolicyInclude(), operation);
0633:
0634: String MEP = axisOperation.getMessageExchangePattern();
0635:
0636: if (WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP)
0637: || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT
0638: .equals(MEP)
0639: || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN
0640: .equals(MEP)
0641: || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY
0642: .equals(MEP)
0643: || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY
0644: .equals(MEP)
0645: || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) {
0646: AxisMessage inaxisMessage = axisOperation
0647: .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
0648: if (inaxisMessage != null) {
0649: operation.addAttribute(ATTRIBUTE_NAME,
0650: operationName, null);
0651: OMElement input = fac.createOMElement(
0652: IN_PUT_LOCAL_NAME, wsdl);
0653: addExtensionElement(fac, input, SOAP_BODY,
0654: SOAP_USE, use, null, targetNamespace, soap);
0655: addPolicyAsExtElement(
0656: PolicyInclude.BINDING_INPUT_POLICY,
0657: inaxisMessage.getPolicyInclude(), input);
0658: operation.addChild(input);
0659: writeSoapHeaders(inaxisMessage, fac, input, soap);
0660: }
0661: }
0662:
0663: if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(MEP)
0664: || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN
0665: .equals(MEP)
0666: || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT
0667: .equals(MEP)
0668: || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY
0669: .equals(MEP)
0670: || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY
0671: .equals(MEP)
0672: || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) {
0673: AxisMessage outAxisMessage = axisOperation
0674: .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
0675: if (outAxisMessage != null) {
0676: OMElement output = fac.createOMElement(
0677: OUT_PUT_LOCAL_NAME, wsdl);
0678: addExtensionElement(fac, output, SOAP_BODY,
0679: SOAP_USE, use, null, targetNamespace, soap);
0680: addPolicyAsExtElement(
0681: PolicyInclude.BINDING_OUTPUT_POLICY,
0682: outAxisMessage.getPolicyInclude(), output);
0683: operation.addChild(output);
0684: writeSoapHeaders(outAxisMessage, fac, output, soap);
0685: }
0686: }
0687:
0688: // generate fault Messages
0689: ArrayList faultyMessages = axisOperation.getFaultMessages();
0690: if (faultyMessages != null) {
0691: for (int i = 0; i < faultyMessages.size(); i++) {
0692: AxisMessage faultyMessage = (AxisMessage) faultyMessages
0693: .get(i);
0694: OMElement fault = fac.createOMElement(
0695: FAULT_LOCAL_NAME, wsdl);
0696: addExtensionElement(fac, fault, FAULT_LOCAL_NAME,
0697: SOAP_USE, use, ATTRIBUTE_NAME,
0698: faultyMessage.getName(), soap);
0699: fault.addAttribute(ATTRIBUTE_NAME, faultyMessage
0700: .getName(), null);
0701: // TODO adding policies for fault messages
0702: operation.addChild(fault);
0703: writeSoapHeaders(faultyMessage, fac, fault, soap);
0704: }
0705: }
0706: }
0707:
0708: }
0709:
0710: /**
0711: * Generate the <binding> for SOAP 1.2 underneath the passed definitions
0712: *
0713: * @param fac the active OMFactory
0714: * @param defintions the WSDL <definitions> element under which to put the binding
0715: * @throws Exception if there's a problem
0716: */
0717: private void generateSOAP12Binding(OMFactory fac,
0718: OMElement defintions) throws Exception {
0719: OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME,
0720: wsdl);
0721: defintions.addChild(binding);
0722: binding.addAttribute(ATTRIBUTE_NAME, axisService.getName()
0723: + SOAP12BINDING_NAME_SUFFIX, null);
0724: binding.addAttribute("type", tns.getPrefix() + ":"
0725: + axisService.getName() + PORT_TYPE_SUFFIX, null);
0726:
0727: addPolicyAsExtElement(PolicyInclude.AXIS_SERVICE_POLICY,
0728: axisService.getPolicyInclude(), binding);
0729: addPolicyAsExtElement(PolicyInclude.BINDING_POLICY, axisService
0730: .getPolicyInclude(), binding);
0731:
0732: // Adding ext elements
0733: addExtensionElement(fac, binding, BINDING_LOCAL_NAME,
0734: TRANSPORT, TRANSPORT_URI, STYLE, style, soap12);
0735:
0736: // Add WS-Addressing UsingAddressing element if appropriate
0737: // SHOULD be on the binding element per the specification
0738: if (axisService.getWSAddressingFlag().equals(
0739: AddressingConstants.ADDRESSING_OPTIONAL)) {
0740: WSDLSerializationUtil.addExtensionElement(fac, binding,
0741: AddressingConstants.USING_ADDRESSING,
0742: DEFAULT_WSDL_NAMESPACE_PREFIX + ":required",
0743: "true", wsaw);
0744: } else if (axisService.getWSAddressingFlag().equals(
0745: AddressingConstants.ADDRESSING_REQUIRED)) {
0746: WSDLSerializationUtil.addExtensionElement(fac, binding,
0747: AddressingConstants.USING_ADDRESSING,
0748: DEFAULT_WSDL_NAMESPACE_PREFIX + ":required",
0749: "true", wsaw);
0750: }
0751:
0752: for (Iterator operations = axisService.getOperations(); operations
0753: .hasNext();) {
0754: AxisOperation axisOperation = (AxisOperation) operations
0755: .next();
0756: if (axisOperation.isControlOperation()
0757: || axisOperation.getName() == null) {
0758: continue;
0759: }
0760: String opeartionName = axisOperation.getName()
0761: .getLocalPart();
0762: OMElement operation = fac.createOMElement(
0763: OPERATION_LOCAL_NAME, wsdl);
0764: binding.addChild(operation);
0765: String soapAction = axisOperation.getSoapAction();
0766: if (soapAction == null) {
0767: soapAction = "";
0768: }
0769: addExtensionElement(fac, operation, OPERATION_LOCAL_NAME,
0770: SOAP_ACTION, soapAction, STYLE, style, soap12);
0771:
0772: addPolicyAsExtElement(
0773: PolicyInclude.BINDING_OPERATION_POLICY,
0774: axisOperation.getPolicyInclude(), operation);
0775: addPolicyAsExtElement(PolicyInclude.AXIS_OPERATION_POLICY,
0776: axisOperation.getPolicyInclude(), operation);
0777:
0778: String MEP = axisOperation.getMessageExchangePattern();
0779:
0780: if (WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP)
0781: || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT
0782: .equals(MEP)
0783: || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN
0784: .equals(MEP)
0785: || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY
0786: .equals(MEP)
0787: || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY
0788: .equals(MEP)
0789: || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) {
0790: AxisMessage inaxisMessage = axisOperation
0791: .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
0792: if (inaxisMessage != null) {
0793: operation.addAttribute(ATTRIBUTE_NAME,
0794: opeartionName, null);
0795: OMElement input = fac.createOMElement(
0796: IN_PUT_LOCAL_NAME, wsdl);
0797: addExtensionElement(fac, input, SOAP_BODY,
0798: SOAP_USE, use, null, targetNamespace,
0799: soap12);
0800: addPolicyAsExtElement(
0801: PolicyInclude.BINDING_INPUT_POLICY,
0802: inaxisMessage.getPolicyInclude(), input);
0803: operation.addChild(input);
0804: writeSoapHeaders(inaxisMessage, fac, input, soap12);
0805: }
0806: }
0807:
0808: if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(MEP)
0809: || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN
0810: .equals(MEP)
0811: || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT
0812: .equals(MEP)
0813: || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY
0814: .equals(MEP)
0815: || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY
0816: .equals(MEP)
0817: || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) {
0818: AxisMessage outAxisMessage = axisOperation
0819: .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
0820: if (outAxisMessage != null) {
0821: OMElement output = fac.createOMElement(
0822: OUT_PUT_LOCAL_NAME, wsdl);
0823: addExtensionElement(fac, output, SOAP_BODY,
0824: SOAP_USE, use, null, targetNamespace,
0825: soap12);
0826: addPolicyAsExtElement(
0827: PolicyInclude.BINDING_OUTPUT_POLICY,
0828: outAxisMessage.getPolicyInclude(), output);
0829: operation.addChild(output);
0830: writeSoapHeaders(outAxisMessage, fac, output,
0831: soap12);
0832: }
0833: }
0834:
0835: // generate fault Messages
0836: ArrayList faultyMessages = axisOperation.getFaultMessages();
0837: if (faultyMessages != null) {
0838: for (int i = 0; i < faultyMessages.size(); i++) {
0839: AxisMessage faultyMessage = (AxisMessage) faultyMessages
0840: .get(i);
0841: OMElement fault = fac.createOMElement(
0842: FAULT_LOCAL_NAME, wsdl);
0843: addExtensionElement(fac, fault, FAULT_LOCAL_NAME,
0844: SOAP_USE, use, ATTRIBUTE_NAME,
0845: faultyMessage.getName(), soap12);
0846: fault.addAttribute(ATTRIBUTE_NAME, faultyMessage
0847: .getName(), null);
0848: // add policies for fault messages
0849: operation.addChild(fault);
0850: writeSoapHeaders(faultyMessage, fac, fault, soap12);
0851: }
0852: }
0853: }
0854: }
0855:
0856: private void generateHTTPBinding(OMFactory fac, OMElement defintions)
0857: throws Exception {
0858: OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME,
0859: wsdl);
0860: defintions.addChild(binding);
0861: binding.addAttribute(ATTRIBUTE_NAME, axisService.getName()
0862: + HTTP_BINDING, null);
0863: binding.addAttribute("type", tns.getPrefix() + ":"
0864: + axisService.getName() + PORT_TYPE_SUFFIX, null);
0865:
0866: // Adding ext elements
0867: OMElement httpBinding = fac.createOMElement("binding", http);
0868: binding.addChild(httpBinding);
0869: httpBinding.addAttribute("verb", "POST", null);
0870:
0871: for (Iterator operations = axisService.getOperations(); operations
0872: .hasNext();) {
0873: AxisOperation axisOperation = (AxisOperation) operations
0874: .next();
0875: if (axisOperation.isControlOperation()
0876: || axisOperation.getName() == null) {
0877: continue;
0878: }
0879: String opeartionName = axisOperation.getName()
0880: .getLocalPart();
0881: OMElement operation = fac.createOMElement(
0882: OPERATION_LOCAL_NAME, wsdl);
0883: binding.addChild(operation);
0884:
0885: OMElement httpOperation = fac.createOMElement("operation",
0886: http);
0887: operation.addChild(httpOperation);
0888: httpOperation.addAttribute("location", axisService
0889: .getName()
0890: + "/" + axisOperation.getName().getLocalPart(),
0891: null);
0892:
0893: String MEP = axisOperation.getMessageExchangePattern();
0894:
0895: if (WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP)
0896: || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT
0897: .equals(MEP)
0898: || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN
0899: .equals(MEP)
0900: || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY
0901: .equals(MEP)
0902: || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY
0903: .equals(MEP)
0904: || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) {
0905: AxisMessage inaxisMessage = axisOperation
0906: .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
0907: if (inaxisMessage != null) {
0908: operation.addAttribute(ATTRIBUTE_NAME,
0909: opeartionName, null);
0910: OMElement input = fac.createOMElement(
0911: IN_PUT_LOCAL_NAME, wsdl);
0912: OMElement inputelement = fac.createOMElement(
0913: "content", mime);
0914: input.addChild(inputelement);
0915: inputelement.addAttribute("type", "text/xml", null);
0916: inputelement.addAttribute("part", axisOperation
0917: .getName().getLocalPart(), null);
0918: operation.addChild(input);
0919: }
0920: }
0921:
0922: if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(MEP)
0923: || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN
0924: .equals(MEP)
0925: || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT
0926: .equals(MEP)
0927: || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY
0928: .equals(MEP)
0929: || WSDL2Constants.MEP_URI_IN_OUT.equals(MEP)) {
0930: AxisMessage outAxisMessage = axisOperation
0931: .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
0932: if (outAxisMessage != null) {
0933: OMElement output = fac.createOMElement(
0934: OUT_PUT_LOCAL_NAME, wsdl);
0935: OMElement outElement = fac.createOMElement(
0936: "content", mime);
0937: outElement.addChild(outElement);
0938: outElement.addAttribute("type", "text/xml", null);
0939: outElement.addAttribute("part", axisOperation
0940: .getName().getLocalPart(), null);
0941: output.addChild(outElement);
0942: operation.addChild(output);
0943: }
0944: }
0945: }
0946: }
0947:
0948: private void writeSoapHeaders(AxisMessage inaxisMessage,
0949: OMFactory fac, OMElement input, OMNamespace soapNameSpace)
0950: throws Exception {
0951: ArrayList extElementList;
0952: extElementList = inaxisMessage.getSoapHeaders();
0953: if (extElementList != null) {
0954: Iterator elements = extElementList.iterator();
0955: while (elements.hasNext()) {
0956: SOAPHeaderMessage soapheader = (SOAPHeaderMessage) elements
0957: .next();
0958: addSOAPHeader(fac, input, soapheader, soapNameSpace);
0959: }
0960: }
0961: }
0962:
0963: private void addExtensionElement(OMFactory fac, OMElement element,
0964: String name, String att1Name, String att1Value,
0965: String att2Name, String att2Value, OMNamespace soapNameSpace) {
0966: OMElement soapbinding = fac
0967: .createOMElement(name, soapNameSpace);
0968: element.addChild(soapbinding);
0969: soapbinding.addAttribute(att1Name, att1Value, null);
0970: if (att2Name != null) {
0971: soapbinding.addAttribute(att2Name, att2Value, null);
0972: }
0973: }
0974:
0975: private void setDefinitionElement(OMElement defintion) {
0976: this .definition = defintion;
0977: }
0978:
0979: private void addSOAPHeader(OMFactory fac, OMElement element,
0980: SOAPHeaderMessage header, OMNamespace soapNameSpace) {
0981: OMElement extElement = fac.createOMElement("header",
0982: soapNameSpace);
0983: element.addChild(extElement);
0984: String use = header.getUse();
0985: if (use != null) {
0986: extElement.addAttribute("use", use, null);
0987: }
0988: if (header.part() != null) {
0989: extElement.addAttribute("part", header.part(), null);
0990: }
0991: if (header.getMessage() != null) {
0992: extElement.addAttribute("message", WSDLSerializationUtil
0993: .getPrefix(targetNamespace, axisService
0994: .getNamespaceMap())
0995: + ":" + header.getMessage().getLocalPart(), null);
0996: }
0997: }
0998:
0999: private void addPolicyAsExtElement(int type,
1000: PolicyInclude policyInclude, OMElement element)
1001: throws Exception {
1002: ArrayList elementList = policyInclude.getPolicyElements(type);
1003:
1004: for (Iterator iterator = elementList.iterator(); iterator
1005: .hasNext();) {
1006: Object policyElement = iterator.next();
1007:
1008: if (policyElement instanceof Policy) {
1009: element.addChild(PolicyUtil
1010: .getPolicyComponentAsOMElement(
1011: (PolicyComponent) policyElement,
1012: serializer));
1013:
1014: } else if (policyElement instanceof PolicyReference) {
1015: element
1016: .addChild(PolicyUtil
1017: .getPolicyComponentAsOMElement((PolicyComponent) policyElement));
1018:
1019: PolicyRegistry reg = policyInclude.getPolicyRegistry();
1020: String key = ((PolicyReference) policyElement).getURI();
1021:
1022: if (key.startsWith("#")) {
1023: key = key.substring(key.indexOf("#") + 1);
1024: }
1025:
1026: Policy p = reg.lookup(key);
1027:
1028: if (p == null) {
1029: throw new Exception("Policy not found for uri : "
1030: + key);
1031: }
1032:
1033: addPolicyToDefinitionElement(key, p);
1034: }
1035: }
1036: }
1037:
1038: private void addPolicyAsExtAttribute(int type,
1039: PolicyInclude policyInclude, OMElement element,
1040: OMFactory factory) throws Exception {
1041:
1042: ArrayList elementList = policyInclude.getPolicyElements(type);
1043: ArrayList policyURIs = new ArrayList();
1044:
1045: for (Iterator iterator = elementList.iterator(); iterator
1046: .hasNext();) {
1047: Object policyElement = iterator.next();
1048: String key;
1049:
1050: if (policyElement instanceof Policy) {
1051: Policy p = (Policy) policyElement;
1052:
1053: if (p.getId() != null) {
1054: key = "#" + p.getId();
1055: } else if (p.getName() != null) {
1056: key = p.getName();
1057: } else {
1058: throw new RuntimeException(
1059: "Can't add the Policy as an extensibility attribute since it doesn't have a id or a name attribute");
1060: }
1061:
1062: policyURIs.add(key);
1063: addPolicyToDefinitionElement(key, p);
1064:
1065: } else {
1066: String uri = ((PolicyReference) policyElement).getURI();
1067: PolicyRegistry registry = policyInclude
1068: .getPolicyRegistry();
1069:
1070: if (uri.startsWith("#")) {
1071: key = uri.substring(uri.indexOf('#') + 1);
1072: } else {
1073: key = uri;
1074: }
1075:
1076: Policy p = registry.lookup(key);
1077:
1078: if (p == null) {
1079: throw new RuntimeException("Cannot resolve " + uri
1080: + " to a Policy");
1081: }
1082: addPolicyToDefinitionElement(key, p);
1083: }
1084: }
1085:
1086: if (!policyURIs.isEmpty()) {
1087: String value = null;
1088:
1089: /*
1090: * We need to create a String that is like 'uri1 uri2 .." to set as
1091: * the value of the wsp:PolicyURIs attribute.
1092: */
1093: for (Iterator iterator = policyURIs.iterator(); iterator
1094: .hasNext();) {
1095: String uri = (String) iterator.next();
1096: value = (value == null) ? uri : " " + uri;
1097: }
1098:
1099: OMNamespace ns = factory.createOMNamespace(
1100: org.apache.neethi.Constants.URI_POLICY_NS,
1101: org.apache.neethi.Constants.ATTR_WSP);
1102: OMAttribute URIs = factory.createOMAttribute("PolicyURIs",
1103: ns, value);
1104: element.addAttribute(URIs);
1105: }
1106: }
1107:
1108: private void addPoliciesToDefinitionElement(Iterator iterator,
1109: OMElement definitionElement) throws Exception {
1110: Policy policy;
1111: OMElement policyElement;
1112: OMNode firstChild;
1113:
1114: for (; iterator.hasNext();) {
1115: policy = (Policy) iterator.next();
1116: policyElement = PolicyUtil.getPolicyComponentAsOMElement(
1117: policy, serializer);
1118:
1119: firstChild = definition.getFirstOMChild();
1120:
1121: if (firstChild != null) {
1122: firstChild.insertSiblingBefore(policyElement);
1123: } else {
1124: definitionElement.addChild(policyElement);
1125: }
1126: }
1127: }
1128:
1129: private void addPolicyToDefinitionElement(String key, Policy policy) {
1130: policiesInDefinitions.put(key, policy);
1131: }
1132:
1133: public String getStyle() {
1134: return style;
1135: }
1136:
1137: public void setStyle(String style) {
1138: this .style = style;
1139: }
1140:
1141: public String getUse() {
1142: return use;
1143: }
1144:
1145: public void setUse(String use) {
1146: this.use = use;
1147: }
1148: }
|