Source Code Cross Referenced for Action.java in  » Net » GNetWatch » net » fenyo » gnetwatch » actions » 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 » Net » GNetWatch » net.fenyo.gnetwatch.actions 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * GNetWatch
003:         * Copyright 2006, 2007 Alexandre Fenyo
004:         * gnetwatch@fenyo.net
005:         *
006:         * This file is part of GNetWatch.
007:         *
008:         * GNetWatch is free software; you can redistribute it and/or modify
009:         * it under the terms of the GNU General Public License as published by
010:         * the Free Software Foundation; either version 2 of the License, or
011:         * (at your option) any later version.
012:         *
013:         * GNetWatch is distributed in the hope that it will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016:         * GNU General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU General Public License
019:         * along with GNetWatch; if not, write to the Free Software
020:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
021:         */
022:
023:        package net.fenyo.gnetwatch.actions;
024:
025:        import net.fenyo.gnetwatch.Config;
026:        import net.fenyo.gnetwatch.GeneralException;
027:        import net.fenyo.gnetwatch.activities.Background;
028:        import net.fenyo.gnetwatch.targets.*;
029:        import net.fenyo.gnetwatch.GUI.*;
030:
031:        import java.io.*;
032:        import java.util.Date;
033:
034:        import org.apache.commons.logging.Log;
035:        import org.apache.commons.logging.LogFactory;
036:        import org.eclipse.swt.graphics.Image;
037:
038:        /**
039:         * Action is the base class for any action: ActionFlood, ActionPing, ActionSNMP, etc.
040:         * An action applies an operation to a target and adds events to this target depending
041:         * on the result of the operation and the computed RTT.
042:         * @author Alexandre Fenyo
043:         * @version $Id: Action.java,v 1.20 2007/03/12 05:04:15 fenyo Exp $
044:         */
045:
046:        public class Action extends VisualElement {
047:            private static Log log = LogFactory.getLog(Action.class);
048:
049:            // GUI & Queue threads
050:            // supports any thread
051:            private Target target;
052:            private Background background;
053:
054:            public enum InterruptCause {
055:                timeout, exiting, removed
056:            };
057:
058:            /**
059:             * Constructor.
060:             * @param target target this action works on.
061:             * @param background queue manager by which this action will add events.
062:             */
063:            // GUI thread
064:            protected Action(final Target target, final Background background) {
065:                this .target = target;
066:                this .background = background;
067:                setType("action");
068:            }
069:
070:            /**
071:             * Constructor.
072:             * @param none.
073:             */
074:            // GUI thread
075:            protected Action() {
076:                setType("action");
077:                target = null;
078:                background = null;
079:            }
080:
081:            /**
082:             * Sets the target.
083:             * @param target target.
084:             * @return void.
085:             */
086:            public void setTarget(final Target target) {
087:                this .target = target;
088:            }
089:
090:            /**
091:             * Sets the background manager.
092:             * @param background background manager.
093:             * @return void.
094:             */
095:            public void setBackground(final Background background) {
096:                this .background = background;
097:            }
098:
099:            /**
100:             * Called to inform about the current GUI.
101:             * @param gui current GUI instance.
102:             * @return void.
103:             */
104:            protected void initialize(final GUI gui) {
105:                super .initialize(gui);
106:                if (gui != null)
107:                    setImageExec();
108:            }
109:
110:            /**
111:             * Returns the associated target.
112:             * @param none.
113:             * @return Target associated target.
114:             */
115:            // Queue thread
116:            protected Target getTarget() {
117:                return target;
118:            }
119:
120:            /**
121:             * Returns the preferred queue.
122:             * @param none.
123:             * @return String preferred queue.
124:             */
125:            // any thread
126:            public String getQueueName() {
127:                return "standard";
128:            }
129:
130:            /**
131:             * Returns the timeout associated with this action.
132:             * @param none.
133:             * @return long timeout.
134:             */
135:            // any thread
136:            public long getMaxDelay() {
137:                return 0;
138:            }
139:
140:            /**
141:             * Asks this action to stop rapidely.
142:             * @param cause cause.
143:             * @return void.
144:             * @throws IOException IO exception.
145:             */
146:            // main & Background threads
147:            public void interrupt(final InterruptCause cause)
148:                    throws IOException {
149:            }
150:
151:            /**
152:             * Asks this action to do its job.
153:             * @param none.
154:             * @return void.
155:             * @throws IOException IO exception.
156:             * @throws InterruptedException exception.
157:             */
158:            // Queue thread
159:            public void invoke() throws IOException, InterruptedException {
160:            }
161:
162:            /**
163:             * Checks that another visual element type can be under this one.
164:             * @param visual_element element to check against.
165:             * @return boolean true if this element can be under this action.
166:             */
167:            public boolean canManageThisChild(final VisualElement visual_element) {
168:                return false;
169:            }
170:
171:            /**
172:             * Called when this element is being removed.
173:             * @param none.
174:             * @return void.
175:             */
176:            protected void disposed() {
177:                super .disposed();
178:                try {
179:                    // PB : this.invoke() pourra qd meme etre invoqué 1 fois ou peut meme etre en cours d'invocation
180:                    background.removeActionQueue(this );
181:                } catch (final GeneralException ex) {
182:                    log.error("Exception", ex);
183:                }
184:            }
185:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.