001 /*
002 * The MIT License
003 * Copyright (c) 2012 Microsoft Corporation
004 *
005 * Permission is hereby granted, free of charge, to any person obtaining a copy
006 * of this software and associated documentation files (the "Software"), to deal
007 * in the Software without restriction, including without limitation the rights
008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
009 * copies of the Software, and to permit persons to whom the Software is
010 * furnished to do so, subject to the following conditions:
011 *
012 * The above copyright notice and this permission notice shall be included in
013 * all copies or substantial portions of the Software.
014 *
015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
021 * THE SOFTWARE.
022 */
023
024 package microsoft.exchange.webservices.data.autodiscover;
025
026 import microsoft.exchange.webservices.data.core.EwsXmlReader;
027 import microsoft.exchange.webservices.data.core.XmlElementNames;
028 import microsoft.exchange.webservices.data.core.enumeration.misc.XmlNamespace;
029 import microsoft.exchange.webservices.data.security.XmlNodeType;
030
031 /**
032 * Represents the URL of the Exchange web client.
033 */
034 public final class WebClientUrl {
035
036 /**
037 * The authentication methods.
038 */
039 private String authenticationMethods;
040
041 /**
042 * The url.
043 */
044 private String url;
045
046 /**
047 * Initializes a new instance of the <see cref="WebClientUrl"/> class.
048 */
049 private WebClientUrl() {
050 }
051
052 /**
053 * Initializes a new instance of the WebClientUrl class.
054 *
055 * @param authenticationMethods The authentication methods.
056 * @param url The URL.
057 */
058 public WebClientUrl(String authenticationMethods, String url) {
059 this.authenticationMethods = authenticationMethods;
060 this.url = url;
061 }
062
063
064 /**
065 * Loads WebClientUrl instance from XML.
066 *
067 * @param reader The reader.
068 * @return WebClientUrl.
069 * @throws Exception the exception
070 */
071 protected static WebClientUrl loadFromXml(EwsXmlReader reader)
072 throws Exception {
073 WebClientUrl webClientUrl = new WebClientUrl();
074
075 do {
076 reader.read();
077
078 if (reader.getNodeType().getNodeType() == XmlNodeType.START_ELEMENT) {
079 if (reader.getLocalName().equals(
080 XmlElementNames.AuthenticationMethods)) {
081 webClientUrl.setAuthenticationMethods(reader
082 .readElementValue(String.class));
083 } else if (reader.getLocalName().equals(XmlElementNames.Url)) {
084 webClientUrl.setUrl(reader.readElementValue(String.class));
085 }
086 }
087 } while (!reader.isEndElement(XmlNamespace.Autodiscover,
088 XmlElementNames.WebClientUrl));
089
090 return webClientUrl;
091 }
092
093 /**
094 * Gets the authentication methods.
095 *
096 * @return the authentication methods
097 */
098 public String getAuthenticationMethods() {
099 return this.authenticationMethods;
100 }
101
102 /**
103 * Sets the authentication methods.
104 *
105 * @param value the new authentication methods
106 */
107 protected void setAuthenticationMethods(String value) {
108 this.authenticationMethods = value;
109 }
110
111 /**
112 * Gets the URL.
113 *
114 * @return the url
115 */
116 public String getUrl() {
117 return this.url;
118 }
119
120 /**
121 * Sets the url.
122 *
123 * @param value the new url
124 */
125 protected void setUrl(String value) {
126 this.url = value;
127 }
128
129 }