Source Code Cross Referenced for Plugin.java in  » Development » Java-Plugin-Framework » org » java » plugin » 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 » Development » Java Plugin Framework » org.java.plugin 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*****************************************************************************
002:         * Java Plug-in Framework (JPF)
003:         * Copyright (C) 2004-2007 Dmitry Olshansky
004:         * 
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2.1 of the License, or (at your option) any later version.
009:         * 
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013:         * Lesser General Public License for more details.
014:         * 
015:         * You should have received a copy of the GNU Lesser General Public
016:         * License along with this library; if not, write to the Free Software
017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018:         *****************************************************************************/package org.java.plugin;
019:
020:        import org.apache.commons.logging.Log;
021:        import org.apache.commons.logging.LogFactory;
022:        import org.java.plugin.registry.PluginDescriptor;
023:
024:        /**
025:         * This is base for "home" class of plug-in runtime. Using this class,
026:         * plug-in code can get access to plug-in framework
027:         * ({@link org.java.plugin.PluginManager manager},
028:         * {@link org.java.plugin.registry.PluginRegistry registry}) which was loaded it.
029:         * It is also used by manager during plug-in life cycle management (activation
030:         * and deactivation).
031:         * <br>
032:         * Plug-in vendor may provide it's own implementation of this class if some
033:         * actions should be performed during plug-in activation/deactivation. When no
034:         * class specified, framework provides default "empty" implementation that does
035:         * nothing when plug-in started and stopped.
036:         * @version $Id$
037:         */
038:        public abstract class Plugin {
039:            /**
040:             * Makes logging service available for descending classes.
041:             */
042:            protected final Log log = LogFactory.getLog(getClass());
043:
044:            private PluginManager manager;
045:            private PluginDescriptor descriptor;
046:            private boolean started;
047:
048:            /**
049:             * @return descriptor of this plug-in
050:             */
051:            public final PluginDescriptor getDescriptor() {
052:                return descriptor;
053:            }
054:
055:            /*
056:             * For internal use only!
057:             */
058:            final void setDescriptor(final PluginDescriptor descr) {
059:                this .descriptor = descr;
060:            }
061:
062:            /**
063:             * @return manager which controls this plug-in
064:             */
065:            public final PluginManager getManager() {
066:                return manager;
067:            }
068:
069:            /*
070:             * For internal use only!
071:             */
072:            final void setManager(final PluginManager aManager) {
073:                this .manager = aManager;
074:            }
075:
076:            /*
077:             * For internal use only!
078:             */
079:            final void start() throws Exception {
080:                if (!started) {
081:                    doStart();
082:                    started = true;
083:                }
084:            }
085:
086:            /*
087:             * For internal use only!
088:             */
089:            final void stop() throws Exception {
090:                if (started) {
091:                    doStop();
092:                    started = false;
093:                }
094:            }
095:
096:            /**
097:             * @return <code>true</code> if this plug-in is in active state
098:             */
099:            public final boolean isActive() {
100:                return started;
101:            }
102:
103:            /**
104:             * This method will be called once during plug-in activation before any
105:             * access to any code from this plug-in.
106:             * @throws Exception if an error has occurred during plug-in start-up
107:             */
108:            protected abstract void doStart() throws Exception;
109:
110:            /**
111:             * This method will be called once during plug-in deactivation. After
112:             * this method call, no other code from this plug-in can be accessed,
113:             * unless {@link #doStart()} method will be called again (but for another
114:             * instance of this class).
115:             * @throws Exception if an error has occurred during plug-in shutdown
116:             */
117:            protected abstract void doStop() throws Exception;
118:
119:            /**
120:             * @see java.lang.Object#toString()
121:             */
122:            @Override
123:            public String toString() {
124:                return "{" + getClass().getName() //$NON-NLS-1$
125:                        + ": manager=" + manager //$NON-NLS-1$
126:                        + ", descriptor=" + descriptor //$NON-NLS-1$
127:                        + "}"; //$NON-NLS-1$
128:            }
129:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.