History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/com/sun/tools/jdi/SocketAttachingConnector.java (1 of 18352 files). Show all

Unified · Split

java/pkg/com/sun/tools/jdi/SocketAttachingConnector.java+100−0
@@ -0,0 +1,100 @@
1+/*
2+ * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
3+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+ *
5+ * This code is free software; you can redistribute it and/or modify it
6+ * under the terms of the GNU General Public License version 2 only, as
7+ * published by the Free Software Foundation. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle in the LICENSE file that accompanied this code.
10+ *
11+ * This code is distributed in the hope that it will be useful, but WITHOUT
12+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+ * version 2 for more details (a copy is included in the LICENSE file that
15+ * accompanied this code).
16+ *
17+ * You should have received a copy of the GNU General Public License version
18+ * 2 along with this work; if not, write to the Free Software Foundation,
19+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+ *
21+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+package com.sun.tools.jdi;
26+
27+import com.sun.jdi.VirtualMachine;
28+import com.sun.jdi.connect.*;
29+import com.sun.jdi.connect.spi.*;
30+import java.util.Map;
31+import java.util.HashMap;
32+import java.io.IOException;
33+import java.net.InetAddress;
34+import java.net.UnknownHostException;
35+
36+/*
37+ * An AttachingConnector that uses the SocketTransportService
38+ */
39+public class SocketAttachingConnector extends GenericAttachingConnector {
40+
41+ static final String ARG_PORT = "port";
42+ static final String ARG_HOST = "hostname";
43+
44+ public SocketAttachingConnector() {
45+ super(new SocketTransportService());
46+
47+ String defaultHostName;
48+ try {
49+ defaultHostName = InetAddress.getLocalHost().getHostName();
50+ } catch (UnknownHostException e) {
51+ defaultHostName = "";
52+ }
53+
54+ addStringArgument(
55+ ARG_HOST,
56+ getString("socket_attaching.host.label"),
57+ getString("socket_attaching.host"),
58+ defaultHostName,
59+ false);
60+
61+ addIntegerArgument(
62+ ARG_PORT,
63+ getString("socket_attaching.port.label"),
64+ getString("socket_attaching.port"),
65+ "",
66+ true,
67+ 0, Integer.MAX_VALUE);
68+
69+ transport = new Transport() {
70+ public String name() {
71+ return "dt_socket"; // for compatability reasons
72+ }
73+ };
74+
75+ }
76+
77+ /*
78+ * Create an "address" from the hostname and port connector
79+ * arguments and attach to the target VM.
80+ */
81+ public VirtualMachine
82+ attach(Map<String,? extends Connector.Argument> arguments)
83+ throws IOException, IllegalConnectorArgumentsException
84+ {
85+ String host = argument(ARG_HOST, arguments).value();
86+ if (host.length() > 0) {
87+ host = host + ":";
88+ }
89+ String address = host + argument(ARG_PORT, arguments).value();
90+ return super.attach(address, arguments);
91+ }
92+
93+ public String name() {
94+ return "com.sun.jdi.SocketAttach";
95+ }
96+
97+ public String description() {
98+ return getString("socket_attaching.description");
99+ }
100+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t