0N/A/*
2362N/A * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.sql.rowset.serial;
0N/A
0N/Aimport java.sql.*;
0N/Aimport java.io.*;
0N/Aimport java.net.URL;
0N/A
0N/A
0N/A/**
0N/A * A serialized mapping in the Java programming language of an SQL
0N/A * <code>DATALINK</code> value. A <code>DATALINK</code> value
0N/A * references a file outside of the underlying data source that the
0N/A * data source manages.
0N/A * <P>
0N/A * <code>RowSet</code> implementations can use the method <code>RowSet.getURL</code>
0N/A * to retrieve a <code>java.net.URL</code> object, which can be used
0N/A * to manipulate the external data.
0N/A * <pre>
0N/A * java.net.URL url = rowset.getURL(1);
0N/A * </pre>
0N/A */
0N/Apublic class SerialDatalink implements Serializable, Cloneable {
0N/A
0N/A /**
0N/A * The extracted URL field retrieved from the DATALINK field.
0N/A * @serial
0N/A */
0N/A private URL url;
0N/A
0N/A /**
0N/A * The SQL type of the elements in this <code>SerialDatalink</code>
0N/A * object. The type is expressed as one of the contants from the
0N/A * class <code>java.sql.Types</code>.
0N/A * @serial
0N/A */
0N/A private int baseType;
0N/A
0N/A /**
0N/A * The type name used by the DBMS for the elements in the SQL
0N/A * <code>DATALINK</code> value that this SerialDatalink object
0N/A * represents.
0N/A * @serial
0N/A */
0N/A private String baseTypeName;
0N/A
0N/A /**
0N/A * Constructs a new <code>SerialDatalink</code> object from the given
0N/A * <code>java.net.URL</code> object.
0N/A * <P>
0N/A * @throws SerialException if url parameter is a null
0N/A */
0N/A public SerialDatalink(URL url) throws SerialException {
0N/A if (url == null) {
0N/A throw new SerialException("Cannot serialize empty URL instance");
0N/A }
0N/A this.url = url;
0N/A }
0N/A
0N/A /**
0N/A * Returns a new URL that is a copy of this <code>SerialDatalink</code>
0N/A * object.
0N/A *
0N/A * @return a copy of this <code>SerialDatalink</code> object as a
0N/A * <code>URL</code> object in the Java programming language.
0N/A * @throws SerialException if the <code>URL</code> object cannot be de-serialized
0N/A */
0N/A public URL getDatalink() throws SerialException {
0N/A
0N/A URL aURL = null;
0N/A
0N/A try {
0N/A aURL = new URL((this.url).toString());
0N/A } catch (java.net.MalformedURLException e) {
0N/A throw new SerialException("MalformedURLException: " + e.getMessage());
0N/A }
0N/A return aURL;
0N/A }
0N/A
0N/A
0N/A /**
0N/A * The identifier that assists in the serialization of this <code>SerialDatalink</code>
0N/A * object.
0N/A */
0N/A static final long serialVersionUID = 2826907821828733626L;
0N/A}