001: /*
002: * <copyright>
003: *
004: * Copyright 2002-2004 BBNT Solutions, LLC
005: * under sponsorship of the Defense Advanced Research Projects
006: * Agency (DARPA).
007: *
008: * You can redistribute this software and/or modify it under the
009: * terms of the Cougaar Open Source License as published on the
010: * Cougaar Open Source Website (www.cougaar.org).
011: *
012: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
013: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
014: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
015: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
016: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
017: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
018: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
019: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
020: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
021: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
022: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
023: *
024: * </copyright>
025: */
026:
027: package org.cougaar.servicediscovery.description;
028:
029: import org.cougaar.util.log.Logger;
030: import org.cougaar.util.log.Logging;
031:
032: /**
033: * Service binding info for the provider
034: */
035:
036: public class ServiceBinding implements java.io.Serializable {
037: public static final String SOAP_BINDING = "SOAP:Binding";
038: public static final String COUGAAR_BINDING = "COUGAAR:Binding";
039:
040: private static Logger logger = Logging
041: .getLogger(ServiceBinding.class);
042:
043: private String myURI = null;
044: private String myBindingType = null;
045: private String messageAddress = null;
046:
047: public ServiceBinding() {
048: }
049:
050: public ServiceBinding(String uri, String bindingType) {
051: setURI(uri);
052: setBindingType(bindingType);
053: }
054:
055: public ServiceBinding(String uri, String bindingType,
056: String messageAddress) {
057: setURI(uri);
058: setBindingType(bindingType);
059: setMessageAddress(messageAddress);
060: }
061:
062: public String getURI() {
063: return myURI;
064: }
065:
066: public void setURI(String uri) {
067: if (myURI != null) {
068: logger.error("Attempt to reset URI for " + this );
069: } else {
070: myURI = new String(uri);
071: }
072: }
073:
074: public String getBindingType() {
075: return myBindingType;
076: }
077:
078: public void setMessageAddress(String messageAddress) {
079: this .messageAddress = messageAddress;
080: }
081:
082: public String getMessageAddress() {
083: return messageAddress;
084: }
085:
086: public void setBindingType(String bindingType) {
087: if (myBindingType != null) {
088: logger.error("Attempt to reset binding type for " + this );
089: } else {
090: if (!validType(bindingType)) {
091: logger.error("Unrecognized binding type: "
092: + bindingType);
093: }
094: myBindingType = new String(bindingType);
095: }
096: }
097:
098: public static boolean validType(String bindingType) {
099: return ((bindingType.equals(COUGAAR_BINDING)) || (bindingType
100: .equals(SOAP_BINDING)));
101: }
102: }
|