Source Code Cross Referenced for ChannelDescription.java in  » Groupware » Data-share » org » datashare » objects » 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.objects 
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: ChannelDescription.java,v 1.2 2002/02/04 13:52:48 lizellaman Exp $
025:         * $Log: ChannelDescription.java,v $
026:         * Revision 1.2  2002/02/04 13:52:48  lizellaman
027:         * Remove all references to past product names (or)
028:         * Add PublicAPI for creating Rendezvous Sessions
029:         *
030:         * Revision 1.1.1.1  2001/10/23 13:37:20  lizellaman
031:         * initial sourceforge release
032:         *
033:         */
034:
035:        package org.datashare.objects;
036:
037:        import java.util.Vector;
038:
039:        /**
040:         * Used to describe a Channel that a Client should use to communicate with
041:         * the DataShareServer.  The Channel described is a data channel that the
042:         * DataShareServer will use to exchange data between clients that are connected
043:         * to it.  This object is not sent directly, but instead is sent by the
044:         * DataShareServer over the commandStatusChannel as part of a
045:         * ChannelDescriptionArray object.
046:         *
047:         * @since Version 2
048:         * @author Charles Wood
049:         * @see ChannelDescriptionArray
050:         */
051:        public class ChannelDescription implements  java.io.Serializable {
052:            /**
053:             * this allows us to serialize this class without 'marshalling' errors.
054:             *
055:             */
056:            static final long serialVersionUID = 9030546546411490936L;
057:
058:            // valid values for the 'type' field
059:            /**
060:             * valid value for the 'type' attribute used when the connection is unknown
061:             */
062:            public final static int UNKNOWN = 0;
063:
064:            /**
065:             * valid value for the 'type' attribute, used for TCP type connections
066:             *
067:             */
068:            public final static int TCP = 1;
069:
070:            /**
071:             * valid value for the 'type' attribute, used for UDP type connections
072:             *
073:             */
074:            public final static int UDP = 2;
075:
076:            /**
077:             * valid value for the 'type' attribute, used for Multicast type connections
078:             *
079:             */
080:            public final static int MULTICAST = 3;
081:
082:            /**
083:             * Used when a String representation of the type attribute is desired, the type value
084:             * is the index into this array.
085:             *
086:             */
087:            public static final String[] validTypes = { "Unknown", "TCP",
088:                    "UDP", "MultiCast" };
089:
090:            /**
091:             * Provides the name of this Channel
092:             *
093:             */
094:            public String channelName;
095:
096:            /**
097:             * Provides Clients with the the class used to handle data for this Channel
098:             * (the class of the Rendezvous function), applies only to data channels for Rendezvous Functions,
099:             *  otherwise, not used.  Note that the full package name is required.
100:             *
101:             */
102:            public String channelClass; // class for function that uses this Channel, full package needed
103:
104:            /**
105:             * descriptive comment about the Channel, used for display purposes only
106:             *
107:             */
108:            public String channelDescription;
109:
110:            /**
111:             * describes the type of Channel, valid values are TCP, UDP, and MULTICAST
112:             *
113:             */
114:            public int type; // defined above
115:
116:            /**
117:             * provides the Client with the name of the jar file in which to look for the
118:             * channelClass, used only for Rendezvous functions.
119:             *
120:             */
121:            public String channelJarFileName; // jar file that has classes needed by channelClass
122:
123:            /**
124:             * indicates if DataShareServer is persisting the data in this Channel to EJBs
125:             *
126:             */
127:            public boolean persist; // user will have a chance to change this before creating the Channel
128:
129:            /**
130:             * indicates if this function is allowed to persist data, true indicates that it is,
131:             * false indicates that this function should never save any data (persist will be set to
132:             * false and the user should not be offered the persist data option)
133:             */
134:            public boolean allowPersistSelection = true; // preset to true for backward compatibility
135:
136:            /**
137:             * indicates that the Client should this Channel's checkBox pre-checked in the
138:             * New Session Dialog Frame, indicating a desire to have this type of Channel
139:             * in a Session.  The user has to de-select the check box to avoid putting this
140:             * type of Channel into a Session.
141:             *
142:             */
143:            public boolean selectionPreSet; // if true, the dialog box will have this channel pre-selected
144:
145:            /**
146:             * used to set the delay that the server inserts between each packet sent to a client when
147:             * history has been requested.
148:             */
149:            public int historyDelay = 0;
150:
151:            /**
152:             * used as the count of how many EJBs to retrieve at one time when getting ready to send data
153:             * to clients as history.  A negative, or zero count indicates get next EJB, send it, repeat...
154:             */
155:            public int historyCountInc = 100;
156:
157:            // if persist is true at time of channel closing, and these values are != null, sever will save
158:            // file to DK using these values below to generate the file
159:            /**
160:             * indicates what type of file is generated by the data in this Channel if the
161:             * data is to be archived to DocumentKonnect
162:             *
163:             */
164:            public String mimeType; // the MIME type that the archived data will be save as
165:
166:            /**
167:             * indicates the file extension for the file genererated by the data in this
168:             * Channel if the data is to be archived to DocumentKonnect
169:             *
170:             */
171:            public String fileExtension; // the extension that the file should have, should agree with the MIME type
172:
173:            /**
174:             * Provides the DataShareServer with the the class used to handle data for
175:             * this Channel (the class of the Rendezvous function) when archiving this Channel's
176:             * data to DocumentKonnect.  Note that the full package name is required.
177:             *
178:             */
179:            public String archiveChannelClass; // class that server can use to archive data from this function
180:
181:            /**
182:             * Provides the DataShareServer with the method in the archiveChannelClass
183:             * to call so that the data that was archived to EJBs can be re-processed prior
184:             * to calling the archiveChannelGetDataMethod to create the file for DocumentKonnect.
185:             *
186:             */
187:            public String archiveChannelSetDataMethod; // method in archiveChannelClass that will be called with DataShareObjects
188:
189:            /**
190:             * Provides the DataShareServer with the method to call in the archiveChannelClass
191:             * to genereate the DocumentKonnect file (after all the EJB persisted data has
192:             * been sent to the archiveChannelSetDataMethod).
193:             *
194:             */
195:            public String archiveChannelGetDataMethod; // method in archiveChannelClass that will return byte[] from all the DataShareObjects
196:
197:            /**
198:             * Constructor, should only be used when creating the command status connection.
199:             * The only information needed by a client to create the commandStatus connection
200:             * is the Server IP address and port number.  All other information is set by this
201:             * empty constructor.
202:             */
203:            public ChannelDescription() {
204:                this ("commandStatus", /* channelName */
205:                "", /* channelClass */
206:                "communicates with Server", /* channelDescription */
207:                ChannelDescription.TCP, /* type */
208:                "", /* channelJarFileName, not used for commandStatus channel */
209:                false, /* allowPersistSelection, not used for commandStatus channel */
210:                false, /* persist, do not persist commandStatus data */
211:                false, /* selectionPreset, not used for commandStatus channel */
212:                0, /* historyDelay, not used for commandStatus channel */
213:                0); /* historyCountInc, not used for commandStatus channel */
214:            }
215:
216:            /**
217:             * Constructor, should only be used when creating a single channel (per Session)
218:             * data connection for a non-PpKClient client.  There will be no history available.
219:             * param channelType must be choosen from ChannelDescription.TCP, ChannelDescription.UDP,
220:             * or ChannelDescription.MULTICAST
221:             */
222:            public ChannelDescription(String channelName,
223:                    String channelDescription, int channelType) {
224:                this (channelName, /* channelName */
225:                "", /* channelClass */
226:                channelDescription, /* channelDescription */
227:                channelType, /* type */
228:                "", /* channelJarFileName, not used for commandStatus channel */
229:                false, /* allowPersistSelection, not used for commandStatus channel */
230:                false, /* persist, do not persist commandStatus data */
231:                false, /* selectionPreset, not used for commandStatus channel */
232:                0, /* historyDelay, not used for commandStatus channel */
233:                0); /* historyCountInc, not used for commandStatus channel */
234:            }
235:
236:            /**
237:             * Constructor, describes a Channel that will not be archived
238:             *
239:             * @param channelName sets instance variable channelName
240:             * @param channelClass sets instance variable channelClass
241:             * @param channelDescription sets instance variable channelDescription
242:             * @param type sets instance variable type
243:             * @param channelJarFileName sets instance variable channelJarFileName
244:             * @param allowPersistSelection set instance variable allowPersistSelection
245:             * @param persist sets instance variable persist
246:             * @param selectionPreSet sets instance variable selectionPreSet
247:             * @param historyDelay sets the time to delay between sending packets from history, zero is no delay
248:             * @param historyCountInc set the  number of EJBs to retrieve from history per call to getData()
249:             */
250:            public ChannelDescription(String channelName, String channelClass,
251:                    String channelDescription, int type,
252:                    String channelJarFileName, boolean allowPersistSelection,
253:                    boolean persist, boolean selectionPreSet, int historyDelay,
254:                    int historyCountInc) {
255:                this .channelName = channelName;
256:                this .channelClass = channelClass;
257:                this .channelDescription = channelDescription;
258:                this .type = type;
259:                this .channelJarFileName = channelJarFileName;
260:                this .allowPersistSelection = allowPersistSelection;
261:                this .persist = persist;
262:                this .selectionPreSet = selectionPreSet;
263:                this .historyDelay = historyDelay;
264:                this .historyCountInc = historyCountInc;
265:            }
266:
267:            /**
268:             * Constructor, describes a Channel that will not be archived, differs from the
269:             * previous constructor by using a String for the type parameter
270:             *
271:             * @param channelName sets instance variable channelName
272:             * @param channelClass sets instance variable channelClass
273:             * @param channelDescription sets instance variable channelDescription
274:             * @param type sets instance variable type
275:             * @param channelJarFileName sets instance variable channelJarFileName
276:             * @param allowPersistSelection set instance variable allowPersistSelection
277:             * @param persist sets instance variable persist
278:             * @param selectionPreSet sets instance variable selectionPreSet
279:             * @param historyDelay sets the time to delay between sending packets from history, zero is no delay
280:             * @param historyCountInc set the  number of EJBs to retrieve from history per call to getData()
281:             */
282:            public ChannelDescription(String channelName,
283:                    String channelClass,
284:                    String channelDescription,
285:                    String channelType, // this is the parameter that changed
286:                    String channelJarFileName, boolean allowPersistSelection,
287:                    boolean persist, boolean selectionPreSet, int historyDelay,
288:                    int historyCountInc) {
289:                this (channelName, channelClass, channelDescription,
290:                        convertStringTypeToInt(channelType),
291:                        channelJarFileName, allowPersistSelection, persist,
292:                        selectionPreSet, historyDelay, historyCountInc);
293:            }
294:
295:            /**
296:             * Constructor, describes a Channel that may be archived
297:             *
298:             * @param channelName sets instance variable channelName
299:             * @param channelClass sets instance variable channelClass
300:             * @param channelDescription sets instance variable channelDescription
301:             * @param type sets instance variable type
302:             * @param channelJarFileName sets instance variable channelJarFileName
303:             * @param allowPersistSelection set instance variable allowPersistSelection
304:             * @param persist sets instance variable persist
305:             * @param selectionPreSet sets instance variable selectionPreSet
306:             * @param historyDelay sets the time to delay between sending packets from history, zero is no delay
307:             * @param historyCountInc set the  number of EJBs to retrieve from history per call to getData()
308:             * @param mimeType sets instance variable mimeType
309:             * @param fileExtension sets instance variable fileExtention
310:             * @param archiveChannelClass sets instance variable archiveChannelClass
311:             * @param archiveChannelSetDataMethod sets instance variable archiveChannelSetDataMethod
312:             * @param archiveChannelGetDataMethod set instance variable archiveChannelGetDataMethod
313:             */
314:            public ChannelDescription(String channelName, String channelClass,
315:                    String channelDescription, int type,
316:                    String channelJarFileName, boolean allowPersistSelection,
317:                    boolean persist, boolean selectionPreSet, int historyDelay,
318:                    int historyCountInc, String mimeType, // the MIME type that the archived data will be save as
319:                    String fileExtension, String archiveChannelClass, // class that server can use to archive data from this function
320:                    String archiveChannelSetDataMethod, // method in archiveChannelClass that will be called with DataShareObjects
321:                    String archiveChannelGetDataMethod // method in archiveChannelClass that will return byte[] from all the DataShareObjects
322:            ) {
323:                this (channelName, channelClass, channelDescription, type,
324:                        channelJarFileName, allowPersistSelection, persist,
325:                        selectionPreSet, historyDelay, historyCountInc);
326:                this .mimeType = mimeType;
327:                this .fileExtension = fileExtension;
328:                this .archiveChannelClass = archiveChannelClass;
329:                this .archiveChannelSetDataMethod = archiveChannelSetDataMethod;
330:                this .archiveChannelGetDataMethod = archiveChannelGetDataMethod;
331:            }
332:
333:            /**
334:             * Constructor, describes a Channel that may be archived, uses String for the type parameter
335:             *
336:             * @param channelName sets instance variable channelName
337:             * @param channelClass sets instance variable channelClass
338:             * @param channelDescription sets instance variable channelDescription
339:             * @param type sets instance variable type
340:             * @param channelJarFileName sets instance variable channelJarFileName
341:             * @param allowPersistSelection set instance variable allowPersistSelection
342:             * @param persist sets instance variable persist
343:             * @param selectionPreSet sets instance variable selectionPreSet
344:             * @param historyDelay sets the time to delay between sending packets from history, zero is no delay
345:             * @param historyCountInc set the  number of EJBs to retrieve from history per call to getData()
346:             * @param mimeType sets instance variable mimeType
347:             * @param fileExtension sets instance variable fileExtention
348:             * @param archiveChannelClass sets instance variable archiveChannelClass
349:             * @param archiveChannelSetDataMethod sets instance variable archiveChannelSetDataMethod
350:             * @param archiveChannelGetDataMethod set instance variable archiveChannelGetDataMethod
351:             */
352:            public ChannelDescription(String channelName, String channelClass,
353:                    String channelDescription, String channelType,
354:                    String channelJarFileName, boolean allowPersistSelection,
355:                    boolean persist, boolean selectionPreSet, int historyDelay,
356:                    int historyCountInc, String mimeType, // the MIME type that the archived data will be save as
357:                    String fileExtension, String archiveChannelClass, // class that server can use to archive data from this function
358:                    String archiveChannelSetDataMethod, // method in archiveChannelClass that will be called with DataShareObjects
359:                    String archiveChannelGetDataMethod // method in archiveChannelClass that will return byte[] from all the DataShareObjects
360:            ) {
361:                this (channelName, channelClass, channelDescription,
362:                        convertStringTypeToInt(channelType),
363:                        channelJarFileName, allowPersistSelection, persist,
364:                        selectionPreSet, historyDelay, historyCountInc,
365:                        mimeType, fileExtension, archiveChannelClass,
366:                        archiveChannelSetDataMethod,
367:                        archiveChannelGetDataMethod);
368:            }
369:
370:            /**
371:             * takes the string representation of ChannelType and converts it to the int value
372:             *
373:             * @param channelType can be "TCP","UDP", or "MULTICAST"; case is not important
374:             */
375:            private static int convertStringTypeToInt(String channelType) {
376:                int type = TCP; // default value
377:                for (int x = 0; x < validTypes.length; x++) {
378:                    if (channelType.toLowerCase().equals(
379:                            validTypes[x].toLowerCase())) {
380:                        type = x;
381:                        break;
382:                    }
383:                }
384:
385:                return type;
386:            }
387:
388:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.