/[debian]/libjpfcodegen-java/branches/upstream/current/resources/templates/Plugin.vm
ViewVC logotype

Contents of /libjpfcodegen-java/branches/upstream/current/resources/templates/Plugin.vm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1609 - (show annotations)
Sun Mar 1 18:00:34 2009 UTC (12 years, 4 months ago) by gregoa
File size: 2070 byte(s)
[svn-inject] Installing original source of libjpfcodegen-java
1 package $packageName;
2
3 import ${packageName}.generated._$className;
4
5 import org.java.plugin.PluginLifecycleException;
6 import org.java.plugin.PluginManager;
7
8 #if ($doPlugin)
9 /**
10 * Plug-in class for plug-in $id.
11 *
12 * Feel free to modify this file, since only the class _$className
13 * (in the subpackage ${packageName}.generated)
14 * will be overwritten, when you re-run the code generator.
15 */
16 public class $className extends _$className {
17
18 public void doStart(){
19 // TODO: Will be called when plug-in is started.
20 }
21
22 public void doStop(){
23 // TODO: Will be called when plug-in is stopped.
24 }
25
26 /**
27 * Retrieve the Plug-in instance from the given manager.
28 *
29 * @param manager
30 * The manager from which to retrieve the plug-in instance
31 *
32 * @return The requested plug-in or null if not found.
33 */
34 public static $className getInstance(PluginManager manager) {
35 try {
36 return ($className) manager
37 .getPlugin(${className}.getId());
38 } catch (PluginLifecycleException e) {
39 return null;
40 } catch (IllegalArgumentException e) {
41 return null;
42 }
43 }
44 }
45 #else
46 /**
47 * Helper class for plug-in $id.
48 *
49 * Feel free to modify this file, since only the class _$className
50 * (in the subpackage ${packageName}.generated)
51 * will be overwritten, when you re-run the code generator.
52 */
53 public class $className extends _$className {
54
55 /**
56 * Private constructor for singleton pattern.
57 *
58 * Use getInstance instead.
59 */
60 $className(PluginManager manager){
61 super(manager);
62 }
63
64 static $className singleton;
65
66 /**
67 * Retrieve the helper class instance for the given plug-in $id
68 *
69 * @param manager
70 * The manager which manages the plug-in.
71 *
72 * @return The requested helper or null if not found.
73 */
74 public static $className getInstance(PluginManager manager) {
75 if (singleton == null){
76 singleton = new $className(manager);
77 }
78 return singleton;
79 }
80 }
81 #end
82

  ViewVC Help
Powered by ViewVC 1.1.26