01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package javax.sql.rowset.serial;
19:
20: import java.io.Serializable;
21: import java.net.MalformedURLException;
22: import java.net.URL;
23:
24: import org.apache.harmony.sql.internal.nls.Messages;
25:
26: public class SerialDatalink implements Serializable, Cloneable {
27: private static final long serialVersionUID = 2826907821828733626L;
28:
29: private URL url;
30:
31: @SuppressWarnings("unused")
32: // Required by serialized form
33: private int baseType;
34:
35: @SuppressWarnings("unused")
36: // Required by serialized form
37: private String baseTypeName;
38:
39: /**
40: * Constructor.
41: *
42: * @param url
43: * The URL to link to.
44: * @throws SerialException
45: * if <code>url</code> is null
46: */
47: public SerialDatalink(URL url) throws SerialException {
48: if (url == null) {
49: throw new SerialException(Messages.getString("sql.12")); //$NON-NLS-1$
50: }
51: this .url = url;
52: }
53:
54: /**
55: * Gets a copied url object of this SerialDatalink object.
56: *
57: * @return a url object in the java programming language which represents
58: * this SerialDatalink object.
59: * @throws SerialException
60: * if <code>url</code> can not be copied.
61: */
62: public URL getDatalink() throws SerialException {
63: URL copyUrl;
64: try {
65: copyUrl = new URL(url.toString());
66: } catch (MalformedURLException e) {
67: throw new SerialException();
68: }
69: return copyUrl;
70: }
71: }
|