Source Code Cross Referenced for ConnectorImpl.java in  » IDE-Eclipse » jdt » org » eclipse » jdi » internal » connect » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Eclipse » jdt » org.eclipse.jdi.internal.connect 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2007 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         * 
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *     Ivan Popov - Bug 184211: JDI connectors throw NullPointerException if used separately
011:         *     			from Eclipse
012:         *******************************************************************************/package org.eclipse.jdi.internal.connect;
013:
014:        import java.io.IOException;
015:        import java.util.List;
016:
017:        import org.eclipse.jdi.Bootstrap;
018:        import org.eclipse.jdi.internal.VirtualMachineImpl;
019:        import org.eclipse.jdi.internal.VirtualMachineManagerImpl;
020:
021:        import com.sun.jdi.VirtualMachine;
022:        import com.sun.jdi.connect.Connector;
023:        import com.sun.jdi.connect.Transport;
024:        import com.sun.jdi.connect.spi.Connection;
025:
026:        /**
027:         * this class implements the corresponding interfaces
028:         * declared by the JDI specification. See the com.sun.jdi package
029:         * for more information.
030:         *
031:         */
032:        public abstract class ConnectorImpl implements  Connector {
033:            /** Virtual machine manager that created this connector. */
034:            private VirtualMachineManagerImpl fVirtualMachineManager;
035:
036:            /** Transport that is used for communication. */
037:            protected Transport fTransport;
038:            /** Virtual Machine that is connected. */
039:            protected VirtualMachineImpl fVirtualMachine;
040:
041:            /**
042:             * Creates a new Connector.
043:             */
044:            public ConnectorImpl(VirtualMachineManagerImpl virtualMachineManager) {
045:                fVirtualMachineManager = virtualMachineManager;
046:            }
047:
048:            /**
049:             * @return Returns Virtual Machine Manager.
050:             */
051:            public VirtualMachineManagerImpl virtualMachineManager() {
052:                return fVirtualMachineManager;
053:            }
054:
055:            /**
056:             * @return Returns Virtual Machine Manager.
057:             */
058:            public VirtualMachineImpl virtualMachine() {
059:                return fVirtualMachine;
060:            }
061:
062:            /**
063:             * @return Returns a human-readable description of this connector and its purpose.
064:             */
065:            public abstract String description();
066:
067:            /**
068:             * @return Returns a short identifier for the connector.
069:             */
070:            public abstract String name();
071:
072:            /**
073:             * Assigns Transport.
074:             */
075:            /*package*/void setTransport(Transport transport) {
076:                fTransport = transport;
077:            }
078:
079:            /**
080:             * @return Returns the transport mechanism used by this connector to establish connections with a target VM.
081:             */
082:            public Transport transport() {
083:                return fTransport;
084:            }
085:
086:            /**
087:             * Closes connection with Virtual Machine.
088:             */
089:            /*package*/synchronized void close() {
090:                virtualMachineManager().removeConnectedVM(fVirtualMachine);
091:            }
092:
093:            /**
094:             * @return Returns a connected Virtual Machine.
095:             */
096:            protected VirtualMachine establishedConnection(Connection connection)
097:                    throws IOException {
098:                fVirtualMachine = (VirtualMachineImpl) Bootstrap
099:                        .virtualMachineManager().createVirtualMachine(
100:                                connection);
101:                return fVirtualMachine;
102:            }
103:
104:            /**
105:             * Argument class for arguments that are used to establish a connection.
106:             */
107:            public abstract class ArgumentImpl implements 
108:                    com.sun.jdi.connect.Connector.Argument {
109:                private String fName;
110:                private String fDescription;
111:                private String fLabel;
112:                private boolean fMustSpecify;
113:
114:                protected ArgumentImpl(String name, String description,
115:                        String label, boolean mustSpecify) {
116:                    fName = name;
117:                    fLabel = label;
118:                    fDescription = description;
119:                    fMustSpecify = mustSpecify;
120:                }
121:
122:                public String name() {
123:                    return fName;
124:                }
125:
126:                public String description() {
127:                    return fDescription;
128:                }
129:
130:                public String label() {
131:                    return fLabel;
132:                }
133:
134:                public boolean mustSpecify() {
135:                    return fMustSpecify;
136:                }
137:
138:                public abstract String value();
139:
140:                public abstract void setValue(String value);
141:
142:                public abstract boolean isValid(String value);
143:
144:                public abstract String toString();
145:            }
146:
147:            public class StringArgumentImpl extends ArgumentImpl implements 
148:                    com.sun.jdi.connect.Connector.StringArgument {
149:                private static final long serialVersionUID = 6009335074727417445L;
150:
151:                private String fValue;
152:
153:                protected StringArgumentImpl(String name, String description,
154:                        String label, boolean mustSpecify) {
155:                    super (name, description, label, mustSpecify);
156:                }
157:
158:                public String value() {
159:                    return fValue;
160:                }
161:
162:                public void setValue(String value) {
163:                    fValue = value;
164:                }
165:
166:                public boolean isValid(String value) {
167:                    return true;
168:                }
169:
170:                public String toString() {
171:                    return fValue;
172:                }
173:
174:            }
175:
176:            public class IntegerArgumentImpl extends ArgumentImpl implements 
177:                    com.sun.jdi.connect.Connector.IntegerArgument {
178:                private static final long serialVersionUID = 6009335074727417445L;
179:                private Integer fValue;
180:                private int fMin;
181:                private int fMax;
182:
183:                protected IntegerArgumentImpl(String name, String description,
184:                        String label, boolean mustSpecify, int min, int max) {
185:                    super (name, description, label, mustSpecify);
186:                    fMin = min;
187:                    fMax = max;
188:                }
189:
190:                public String value() {
191:                    return (fValue == null) ? null : fValue.toString();
192:                }
193:
194:                public void setValue(String value) {
195:                    fValue = new Integer(value);
196:                }
197:
198:                public boolean isValid(String value) {
199:                    Integer val;
200:                    try {
201:                        val = new Integer(value);
202:                    } catch (NumberFormatException e) {
203:                        return false;
204:                    }
205:                    return isValid(val.intValue());
206:                }
207:
208:                public String toString() {
209:                    return value();
210:                }
211:
212:                public int intValue() {
213:                    return fValue.intValue();
214:                }
215:
216:                public void setValue(int value) {
217:                    fValue = new Integer(value);
218:                }
219:
220:                public int min() {
221:                    return fMin;
222:                }
223:
224:                public int max() {
225:                    return fMax;
226:                }
227:
228:                public boolean isValid(int value) {
229:                    return fMin <= value && value <= fMax;
230:                }
231:
232:                public String stringValueOf(int value) {
233:                    return new Integer(value).toString();
234:                }
235:            }
236:
237:            public class BooleanArgumentImpl extends ArgumentImpl implements 
238:                    com.sun.jdi.connect.Connector.BooleanArgument {
239:                private static final long serialVersionUID = 6009335074727417445L;
240:                private Boolean fValue;
241:
242:                protected BooleanArgumentImpl(String name, String description,
243:                        String label, boolean mustSpecify) {
244:                    super (name, description, label, mustSpecify);
245:                }
246:
247:                public String value() {
248:                    return (fValue == null) ? null : fValue.toString();
249:                }
250:
251:                public void setValue(String value) {
252:                    fValue = Boolean.valueOf(value);
253:                }
254:
255:                public boolean isValid(String value) {
256:                    return true;
257:                }
258:
259:                public String toString() {
260:                    return value();
261:                }
262:
263:                public boolean booleanValue() {
264:                    return fValue.booleanValue();
265:                }
266:
267:                public void setValue(boolean value) {
268:                    fValue = Boolean.valueOf(value);
269:                }
270:
271:                public String stringValueOf(boolean value) {
272:                    return Boolean.valueOf(value).toString();
273:                }
274:            }
275:
276:            public class SelectedArgumentImpl extends StringArgumentImpl
277:                    implements  com.sun.jdi.connect.Connector.SelectedArgument {
278:                private static final long serialVersionUID = 6009335074727417445L;
279:                private List fChoices;
280:
281:                protected SelectedArgumentImpl(String name, String description,
282:                        String label, boolean mustSpecify, List choices) {
283:                    super (name, description, label, mustSpecify);
284:                    fChoices = choices;
285:                }
286:
287:                public List choices() {
288:                    return fChoices;
289:                }
290:
291:                public boolean isValid(java.lang.String value) {
292:                    return fChoices.contains(value);
293:                }
294:            }
295:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.