001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019 package org.apache.hadoop.yarn.api.records;
020
021 import org.apache.hadoop.classification.InterfaceAudience.Public;
022 import org.apache.hadoop.classification.InterfaceStability.Stable;
023 import org.apache.hadoop.yarn.util.Records;
024
025 /**
026 * <p><code>URL</code> represents a serializable {@link java.net.URL}.</p>
027 */
028 @Public
029 @Stable
030 public abstract class URL {
031
032 @Public
033 @Stable
034 public static URL newInstance(String scheme, String host, int port, String file) {
035 URL url = Records.newRecord(URL.class);
036 url.setScheme(scheme);
037 url.setHost(host);
038 url.setPort(port);
039 url.setFile(file);
040 return url;
041 }
042
043 /**
044 * Get the scheme of the URL.
045 * @return scheme of the URL
046 */
047 @Public
048 @Stable
049 public abstract String getScheme();
050
051 /**
052 * Set the scheme of the URL
053 * @param scheme scheme of the URL
054 */
055 @Public
056 @Stable
057 public abstract void setScheme(String scheme);
058
059 /**
060 * Get the user info of the URL.
061 * @return user info of the URL
062 */
063 @Public
064 @Stable
065 public abstract String getUserInfo();
066
067 /**
068 * Set the user info of the URL.
069 * @param userInfo user info of the URL
070 */
071 @Public
072 @Stable
073 public abstract void setUserInfo(String userInfo);
074
075 /**
076 * Get the host of the URL.
077 * @return host of the URL
078 */
079 @Public
080 @Stable
081 public abstract String getHost();
082
083 /**
084 * Set the host of the URL.
085 * @param host host of the URL
086 */
087 @Public
088 @Stable
089 public abstract void setHost(String host);
090
091 /**
092 * Get the port of the URL.
093 * @return port of the URL
094 */
095 @Public
096 @Stable
097 public abstract int getPort();
098
099 /**
100 * Set the port of the URL
101 * @param port port of the URL
102 */
103 @Public
104 @Stable
105 public abstract void setPort(int port);
106
107 /**
108 * Get the file of the URL.
109 * @return file of the URL
110 */
111 @Public
112 @Stable
113 public abstract String getFile();
114
115 /**
116 * Set the file of the URL.
117 * @param file file of the URL
118 */
119 @Public
120 @Stable
121 public abstract void setFile(String file);
122 }