src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/VmIdentifier.java
author chegar
Wed, 06 Dec 2017 19:17:07 +0000
changeset 48084 1826a0130c59
parent 47216 71c04702a3d5
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.jvmstat.monitor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.net.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * An abstraction that identifies a target Java Virtual Machine.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * The VmIdentifier, or vmid, provides a convenient string representation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * of the information needed to locate and communicate with a target
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * Java Virtual Machine. The string, based on a {@link URI}, may specify
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * the communications protocol, host name, local vm identifier, and protocol
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * specific information for a target Java Virtual Machine. The format for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * a VmIdentifier string is:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *      [<I>protocol</I>:][<I>//</I>]<I><B>lvmid</B></I>[<I>@hostname</I>][<I>:port</I>][<I>/servername</I>]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * The only required component of this string is the Local Virtual Machine
31061
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    42
 * Identifier, or {@code lvmid}, which uniquely identifies the target
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * Java Virtual Machine on a host. The optional components of the VmIdentifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * include:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * <ul>
31061
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    46
 *   <li>{@code protocol} - The communications protocol. A VmIdentifier
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    47
 *       omitting the protocol must be resolved against a HostIdentifier
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    48
 *       using {@link HostIdentifier#resolve}.
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    49
 *       </li>
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    50
 *   <li>{@code hostname} - A hostname or IP address indicating the target
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    51
 *       host. A VmIdentifier omitting the protocol must be resolved
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    52
 *       against a HostIdentifier using {@link HostIdentifier#resolve}.
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    53
 *       </li>
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    54
 *   <li>{@code port} - The port for the communications protocol.
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    55
 *       Treatment of the {@code port} parameter is implementation
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    56
 *       (protocol) specific. A VmIdentifier omitting the protocol should
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    57
 *       be resolved against a HostIdentifier using
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    58
 *       {@link HostIdentifier#resolve}.
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    59
 *       </li>
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    60
 *   <li>{@code servername} - The treatment of the Path, Query, and
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    61
 *       Fragment components of the VmIdentifier are implementation
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    62
 *       (protocol) dependent. A VmIdentifier omitting the protocol should
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    63
 *       be resolved against a HostIdentifier using
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    64
 *       {@link HostIdentifier#resolve}.
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    65
 *       </li>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * All VmIdentifier instances are constructed as absolute, hierarchical URIs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * The constructors will accept relative (and even some malformed,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * though convenient) URI strings. Such strings are transformed into
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * legitimate, absolute URI strings.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * With the exception of <em>file:</em> based VmIdentifier strings, all
31061
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    74
 * VmIdentifier strings must include a {@code lvmid}. Attempting to construct
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    75
 * a non-file based VmIdentifier that doesn't include a {@code lvmid}
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    76
 * component will result in a {@code MonitorException}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * Here are some examples of VmIdentifier strings.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * <ul>
31061
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    80
 *    <li>Relative URIs
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 *      <ul>
31061
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    82
 *         <li><em>1234</em> - Specifies the Java Virtual Machine
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    83
 *             identified by lvmid <em>1234</em> on an unnamed host.
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    84
 *             This string is transformed into the absolute form
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    85
 *             <em>//1234</em>, which must be resolved against a
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    86
 *             HostIdentifier.
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    87
 *         </li>
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    88
 *         <li><em>1234@hostname</em> - Specifies the Java Virtual
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    89
 *             Machine identified by lvmid <em>1234</em> on host
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    90
 *             <em>hostname</em> with an unnamed protocol.
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    91
 *             This string is transformed into the absolute form
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    92
 *             <em>//1234@hostname</em>, which must be resolved against
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    93
 *             a HostIdentifier.
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    94
 *         </li>
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    95
 *         <li><em>1234@hostname:2099</em> - Specifies the Java Virtual
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    96
 *             Machine identified by lvmid <em>1234</em> on host
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    97
 *             <em>hostname</em> with an unnamed protocol, but with
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    98
 *             port <em>2099</em>. This string is transformed into
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
    99
 *             the absolute form <em>//1234@hostname:2099</em>, which
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   100
 *             must be resolved against a HostIdentifier.
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   101
 *         </li>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 *      </ul>
31061
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   103
 *    </li>
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   104
 *    <li>Absolute URIs
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 *      <ul>
31061
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   106
 *         <li><em>rmi://1234@hostname:2099/remoteobjectname</em> -
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   107
 *             Specifies the Java Virtual Machine identified by lvmid
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   108
 *             <em>1234</em> on host <em>hostname</em> accessed
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   109
 *             using the <em>rmi:</em> protocol through the rmi remote
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   110
 *             object named <em>remoteobjectname</em> as registered with
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   111
 *             the <em>rmiserver</em> on port <em>2099</em> on host
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   112
 *             <em>hostname</em>.
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   113
 *         </li>
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   114
 *         <li><em>file:/path/file</em> - Identifies a Java Virtual Machine
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   115
 *             through accessing a special file based protocol to use as
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   116
 *             the communications mechanism.
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   117
 *         </li>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 *      </ul>
31061
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   119
 *    </li>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 * @see URI
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 * @see HostIdentifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 * @author Brian Doherty
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
public class VmIdentifier {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    private URI uri;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * creates a canonical representation of the uriString. This method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * performs certain translations depending on the type of URI generated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * by the string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    private URI canonicalize(String uriString) throws URISyntaxException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        if (uriString == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            uriString = "local://0@localhost";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            return new URI(uriString);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        URI u = new URI(uriString);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        if (u.isAbsolute()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            if (u.isOpaque()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                 * rmi:1234@hostname/path#fragment converted to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                 * rmi://1234@hostname/path#fragment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                u = new URI(u.getScheme(), "//" + u.getSchemeSpecificPart(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                            u.getFragment());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
             * make the uri absolute, if possible. A relative URI doesn't
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
             * specify the scheme part, so it's safe to prepend a "//" and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
             * try again.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            if (!uriString.startsWith("//")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                if (u.getFragment() == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                    u = new URI("//" + u.getSchemeSpecificPart());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                    u = new URI("//" + u.getSchemeSpecificPart() + "#"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
                                + u.getFragment());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        return u;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * check that the VmIdentifier includes a unique numerical identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * for the target JVM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    private void validate() throws URISyntaxException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        // file:// uri, which is a special case where the lvmid is not required.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        String s = getScheme();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        if ((s != null) && (s.compareTo("file") == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        if (getLocalVmId() == -1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            throw new URISyntaxException(uri.toString(), "Local vmid required");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * Create a VmIdentifier instance from a string value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * @param uriString a string representing a target Java Virtual Machine.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     *                  The syntax of the string must conforms to the rules
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     *                  specified in the class documentation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * @throws URISyntaxException Thrown when the uriString or its canonical
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     *                            form is poorly formed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    public VmIdentifier(String uriString) throws URISyntaxException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        URI u;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            u = canonicalize(uriString);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        } catch (URISyntaxException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
            /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
             * a vmid of the form 1234@hostname:1098 causes an exception,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
             * so try again with a leading "//"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
            if (uriString.startsWith("//")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
                throw e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            u = canonicalize("//"+uriString);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        uri = u;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        // verify that we have a valid lvmid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        validate();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * Create a VmIdentifier instance from a URI object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * @param uri a well formed, absolute URI indicating the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     *            target Java Virtual Machine.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * @throws URISyntaxException Thrown if the URI is missing some
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     *                            required component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    public VmIdentifier(URI uri) throws URISyntaxException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        this.uri = uri;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        validate();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * Return the corresponding HostIdentifier for this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * This method constructs a HostIdentifier object from the VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * If the VmIdentifier is not specific about the protocol or other
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * components of the URI, then the resulting HostIdentifier will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * be constructed based on this missing information. Typically, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * missing components will have result in the HostIdentifier assigning
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * assumed defaults that allow the VmIdentifier to be resolved according
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * to those defaults.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * <p>
31061
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   239
     * For example, a VmIdentifier that specifies only a {@code lvmid}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * will result in a HostIdentifier for <em>localhost</em> utilizing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * the default local protocol, <em>local:</em>. A VmIdentifier that
31061
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   242
     * specifies both a {@code vmid} and a {@code hostname} will result
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * in a HostIdentifier for the specified host with the default remote
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * protocol, <em>rmi:</em>, using the protocol defaults for the
31061
fead7d86d75f 8081517: minor cleanup for docs
avstepan
parents: 25859
diff changeset
   245
     * {@code port} and {@code servername} components.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * @return HostIdentifier - the host identifier for the host containing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     *                          the Java Virtual Machine represented by this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     *                          VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * @throws URISyntaxException Thrown if a bad host URI is constructed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     *                            This exception may get encapsulated into
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     *                            a MonitorException in a future version.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    public HostIdentifier getHostIdentifier() throws URISyntaxException {
24969
afa6934dd8e8 8041679: Replace uses of StringBuffer with StringBuilder within core library classes
psandoz
parents: 5506
diff changeset
   255
        StringBuilder sb = new StringBuilder();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        if (getScheme() != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
            sb.append(getScheme()).append(":");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        sb.append("//").append(getHost());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        if (getPort() != -1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
            sb.append(":").append(getPort());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        if (getPath() != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
            sb.append(getPath());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        return new HostIdentifier(sb.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     * Return the Scheme, or protocol, portion of this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * @return String - the scheme for this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * @see URI#getScheme()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    public String getScheme() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        return uri.getScheme();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * Return the Scheme Specific Part of this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * @return String - the Scheme Specific Part for this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * @see URI#getSchemeSpecificPart()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    public String getSchemeSpecificPart() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        return uri.getSchemeSpecificPart();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * Return the UserInfo part of this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * @return String - the UserInfo part for this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * @see URI#getUserInfo()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    public String getUserInfo() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        return uri.getUserInfo();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * Return the Host part of this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * @return String - the Host part for this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * @see URI#getHost()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    public String getHost() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
        return uri.getHost();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * Return the Port part of this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * @return int - the Port part for this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     * @see URI#getPort()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    public int getPort() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
        return uri.getPort();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * Return the Authority part of this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * @return String - the Authority part for this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * @see URI#getAuthority()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    public String getAuthority() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
        return uri.getAuthority();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * Return the Path part of this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * @return String - the Path part for this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * @see URI#getPath()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    public String getPath() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
        return uri.getPath();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * Return the Query part of this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * @return String - the Query part for this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * @see URI#getQuery()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    public String getQuery() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
        return uri.getQuery();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * Return the Fragment part of this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * @return String - the Fragment part for this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * @see URI#getFragment()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    public String getFragment() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
        return uri.getFragment();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * Return the Local Virtual Machine Identifier for this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * The Local Virtual Machine Identifier is also known as the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * <em>lvmid</em>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * @return int - the lvmid for this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    public int getLocalVmId() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
        int result = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
            if (uri.getUserInfo() == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
                result = Integer.parseInt(uri.getAuthority());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
                result = Integer.parseInt(uri.getUserInfo());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
        } catch (NumberFormatException e) { }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
        return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     * Return the mode indicated in this VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * @return String - the mode string. If no mode is specified, then "r"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     *                  is returned. otherwise, the specified mode is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    public String getMode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
        String query = getQuery();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        if (query != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
            String[] queryArgs = query.split("\\+");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
            for (int i = 0; i < queryArgs.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
                if (queryArgs[i].startsWith("mode=")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
                    int index = queryArgs[i].indexOf('=');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
                    return queryArgs[i].substring(index+1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        return "r";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * Return the URI associated with the VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * @return URI - the URI.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * @see URI
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    public URI getURI() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
        return uri;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * Return the hash code for this VmIdentifier. The hash code is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * identical to the hash code for the contained URI.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * @return int - the hashcode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * @see URI#hashCode()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    public int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
        return uri.hashCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * Test for quality with other objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     * @param object the object to be test for equality.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     * @return boolean - returns true if the given object is of type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     *                   VmIdentifier and its URI field is equal to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     *                   this object's URI field. Otherwise, return false.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * @see URI#equals(Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    public boolean equals(Object object) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        if (object == this) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        if (!(object instanceof VmIdentifier)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        return uri.equals(((VmIdentifier)object).uri);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     * Convert to a string representation. Conversion is identical to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     * calling getURI().toString(). This may change in a future release.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     * @return String - a String representation of the VmIdentifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     * @see URI#toString()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
        return uri.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
}