Source Code Cross Referenced for SocketAdapter.java in  » Groupware » Data-share » org » datashare » 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 » Groupware » Data share » org.datashare 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* ----- BEGIN LICENSE BLOCK -----
002:         * Version: MPL 1.1
003:         *
004:         * The contents of this file are subject to the Mozilla Public License Version
005:         * 1.1 (the "License"); you may not use this file except in compliance with
006:         * the License. You may obtain a copy of the License at
007:         * http://www.mozilla.org/MPL/
008:         *
009:         * Software distributed under the License is distributed on an "AS IS" basis,
010:         * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
011:         * for the specific language governing rights and limitations under the
012:         * License.
013:         *
014:         * The Original Code is the DataShare server.
015:         *
016:         * The Initial Developer of the Original Code is
017:         * Ball Aerospace & Technologies Corp, Fairborn, Ohio
018:         * Portions created by the Initial Developer are Copyright (C) 2001
019:         * the Initial Developer. All Rights Reserved.
020:         *
021:         * Contributor(s): Charles Wood <cwood@ball.com>
022:         *
023:         * ----- END LICENSE BLOCK ----- */
024:        /* RCS $Id: SocketAdapter.java,v 1.3 2002/02/04 19:34:57 lizellaman Exp $
025:         * $Log: SocketAdapter.java,v $
026:         * Revision 1.3  2002/02/04 19:34:57  lizellaman
027:         * correct spelling of privilege
028:         *
029:         * Revision 1.2  2002/01/29 20:50:17  lizellaman
030:         * Added LoggingInterface, modified the PropertiesInterface implementation
031:         *
032:         * Revision 1.1.1.1  2001/10/23 13:37:18  lizellaman
033:         * initial sourceforge release
034:         *
035:         */
036:
037:        package org.datashare;
038:
039:        import java.net.InetAddress;
040:        import org.datashare.objects.DataShareObject;
041:        import java.util.Date;
042:        import java.util.GregorianCalendar;
043:
044:        /**
045:         * @date March 01, 2001
046:         */
047:        public abstract class SocketAdapter {
048:            protected String clientKey = ""; // unique string for this sockets client
049:            protected String clientClass = "";
050:            protected boolean admin = false; // set to true if  this client has admin privileges
051:            private boolean active = false;
052:            protected String keyValue = ""; // uniqe string for this socket
053:            protected InetAddress remoteIP = null;
054:            protected int remotePort;
055:            protected InetAddress localIP = null;
056:            protected int localPort;
057:            protected DataReceiverInterface dri = null;
058:            private Date creationDate = null;
059:
060:            /**
061:             * constructor for abstract class
062:             */
063:            SocketAdapter() {
064:                creationDate = new GregorianCalendar().getTime();
065:            }
066:
067:            /**
068:             * call this method when data is to be sent over this connection,
069:             * this will buffer the data and schedule it for transmission
070:             */
071:            abstract void sendData(DataShareObject dsObject);
072:
073:            /**
074:             * this is the method that actually sends the data
075:             */
076:            abstract void xmitData(DataShareObject dsObject);
077:
078:            /**
079:             * returns the type for this instance, should come from the selections in ChannelDescription class
080:             */
081:            abstract int getType();
082:
083:            /**
084:             * close the socket, stop any threads, and inform the server
085:             */
086:            abstract void close();
087:
088:            /**
089:             * returns the data/time this socket was established
090:             */
091:            Date getCreationDate() {
092:                return creationDate;
093:            }
094:
095:            /**
096:             * retrieves this sockets client key
097:             */
098:            String getClientKey() {
099:                return clientKey;
100:            }
101:
102:            /**
103:             * sets the clientKey (if param is not blank)
104:             */
105:            void setClientKey(String clientKey) {
106:                if (!clientKey.equals(""))
107:                    this .clientKey = clientKey;
108:            }
109:
110:            /**
111:             * retrieves this sockets client class
112:             */
113:            String getClientClass() {
114:                return clientClass;
115:            }
116:
117:            /**
118:             * sets the clientClass (if param is not blank)
119:             */
120:            void setClientClass(String clientClass) {
121:                if (!clientClass.equals(""))
122:                    this .clientClass = clientClass;
123:            }
124:
125:            /**
126:             * returns true if client has provided its clientKey (so we know who this connection is for)
127:             */
128:            boolean getActive() {
129:                return active;
130:            }
131:
132:            /**
133:             * set to true if the client has sent its client key for this connection
134:             */
135:            void setActive(boolean active) {
136:                SessionUtilities.getLoggingInterface().debugMsg(
137:                        SessionUtilities.getLoggingInterface().DEBUG,
138:                        SessionUtilities.getLoggingInterface().NETWORK,
139:                        "Setting SocketAdapter.active to "
140:                                + (active ? "true" : "false") + " for "
141:                                + this .getKeyValue());
142:                this .active = active;
143:            }
144:
145:            /**
146:             * set to true if the client has admin privileges
147:             */
148:            void setAdmin(boolean admin) {
149:                this .admin = admin;
150:            }
151:
152:            /**
153:             * returns true if client has admin privileges, default if false
154:             */
155:            boolean getAdmin() {
156:                return admin;
157:            }
158:
159:            /**
160:             * retrieves this sockets key
161:             */
162:            String getKeyValue() {
163:                return keyValue;
164:            }
165:
166:            /**
167:             * sets the keyValue (but only if the parameter is not blank)
168:             */
169:            void setKeyValue(String keyValue) {
170:                if (!keyValue.equals(""))
171:                    this .keyValue = keyValue;
172:            }
173:
174:            /**
175:             * retrieves the remote IP address for this connection
176:             */
177:            InetAddress getRemoteIP() {
178:                return remoteIP;
179:            }
180:
181:            /**
182:             * sets the remote IP for this connection
183:             */
184:            void setRemoteIP(InetAddress remoteIP) {
185:                this .remoteIP = remoteIP;
186:            }
187:
188:            /**
189:             * retrieves the local address for this connection
190:             */
191:            InetAddress getLocalIP() {
192:                return localIP;
193:            }
194:
195:            /**
196:             * sets the local IP for this connection
197:             */
198:            void setLocalIP(InetAddress localIP) {
199:                this .localIP = localIP;
200:            }
201:
202:            /**
203:             * retrieves the remote port for this connection
204:             */
205:            int getRemotePort() {
206:                return remotePort;
207:            }
208:
209:            /**
210:             * sets the remote port for this connection
211:             */
212:            void setRemotePort(int remotePort) {
213:                this .remotePort = remotePort;
214:            }
215:
216:            /**
217:             * retrieves the local port for this connection
218:             */
219:            int getLocalPort() {
220:                return localPort;
221:            }
222:
223:            /**
224:             * sets the local port for this connection
225:             */
226:            void setLocalPort(int localPort) {
227:                this.localPort = localPort;
228:            }
229:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.