exfex-cvs-commit Mailing List for Extended Form of examination (Page 11)
Status: Planning
Brought to you by:
mstsxfx
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(93) |
Oct
(134) |
Nov
(29) |
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(20) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(15) |
Nov
|
Dec
|
From: Michal H. <ms...@us...> - 2005-09-24 12:29:59
|
Update of /cvsroot/exfex/exfex/source/exfex/common/logging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1345/source/exfex/common/logging Modified Files: Logger.java Log Message: setTimeDisplay bug (null handling) corrected Index: Logger.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/logging/Logger.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Logger.java 24 Sep 2005 11:12:23 -0000 1.8 --- Logger.java 24 Sep 2005 12:29:45 -0000 1.9 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.9 2005/09/24 12:29:45 mstsxfx + * setTimeDisplay bug (null handling) corrected + * * Revision 1.8 2005/09/24 11:12:23 mstsxfx * documentation *************** *** 86,92 **** /** Level of logging. * ! * Verbosity filter. */ ! private int logLevel; /** Device to write data. */ --- 89,95 ---- /** Level of logging. * ! * Verbosity filter. Default value is 7 (all messages are displayed). */ ! private int logLevel=7; /** Device to write data. */ *************** *** 130,135 **** public Logger(int level, ILoggerStream output, String pref, String timeformat)//{{{ { ! logLevel=level; ! out=output; setPrefix(pref); setTimeDisplay(timeformat); --- 133,138 ---- public Logger(int level, ILoggerStream output, String pref, String timeformat)//{{{ { ! setOutput(output); ! setLogLevel(level); setPrefix(pref); setTimeDisplay(timeformat); *************** *** 279,284 **** { if(timeformat==null) displayTime=null; ! displayTime=new SimpleDateFormat(timeformat); --- 282,289 ---- { if(timeformat==null) + { displayTime=null; ! return; ! } displayTime=new SimpleDateFormat(timeformat); |
From: Michal H. <ms...@us...> - 2005-09-24 12:06:47
|
Update of /cvsroot/exfex/exfex/source/exfex/common/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30129/source/exfex/common/utils Added Files: State.java Log Message: State generic class --- NEW FILE: State.java --- /** * $RCSfile: State.java,v $ * * $Log: State.java,v $ * Revision 1.1 2005/09/24 12:06:35 mstsxfx * State generic class * */ package exfex.common.utils; /** * * <p> * <pre> * Changes: * 19.9.2005 msts - created * </pre> * * @param <T> Type of the state (it has to be clonable). * @author msts */ public class State<T extends CloneAble> { /** State of the state object.*/ private T state=null; /** Default constructor. * All fields are set to null value. */ public State()//{{{ { }//}}} /** Initializating constructor. * * Cals setState method. * * @param state State - deep copy of object state. */ public State(T state)//{{{ { setState(state); }//}}} /** Returns actual state. * @return Returns the state. */ public T getState()//{{{ { return state; }//}}} /** * @param state The state to set. */ public void setState(T state)//{{{ { this.state = (T)state.clone(); }//}}} } |
From: Michal H. <ms...@us...> - 2005-09-24 12:06:27
|
Update of /cvsroot/exfex/exfex/source/exfex/common/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30012/source/exfex/common/utils Added Files: CloneAble.java Log Message: Wraper for cloning interface --- NEW FILE: CloneAble.java --- /** * $RCSfile: CloneAble.java,v $ * * $Log: CloneAble.java,v $ * Revision 1.1 2005/09/24 12:06:16 mstsxfx * Wraper for cloning interface * */ package exfex.common.utils; /** Interface for cloning. * * This interface extends clasic Cloneable interface, but add public clone * method (which override protected one from Object superclass). * <p> * All classes, that want to be cloneable should implement this interface * rather then just implement Cloneable and put public clone method. * <p> * <pre> * Changes: * 19.9.2005 msts - created * </pre> * * @author msts */ public interface CloneAble extends Cloneable { /** Deep copy maker. * * Copies this object using deep copy of elements, that should be * separeted in clones. Some of the fields may be shared and so * just shallow copy of them is created. * * @return New instance of object. */ @Override public Object clone(); } |
From: Michal H. <ms...@us...> - 2005-09-24 12:05:43
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29898/source/exfex/common/pluginsystem Modified Files: package.html Log Message: update Index: package.html =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/package.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** package.html 15 Sep 2005 18:11:02 -0000 1.1 --- package.html 24 Sep 2005 12:05:36 -0000 1.2 *************** *** 6,15 **** <body bgcolor="white"> <h2>Package Specification</h2> ! ! <h2>Related Documentation</h2> ! </body> </html> --- 6,23 ---- <body bgcolor="white"> + Basic package for plugin system. <h2>Package Specification</h2> ! This package contains all classes and interfaces for plugin system. ! <br> ! Plugin System consist of PluginManager which manages plugins and it's only ! entry point which can be used to insert or remove plugin to the system. ! Package also contain helper classes, such as PluginList, DependencyMap, ! AcceptPlugin. These are not intended to be plugins. ! Finaly there are interfaces for plugins and plugins's strategies and policies. ! <br> ! If you want to create new plugin, this package will be basic one to import. ! See classes and interfaces for more details. </body> </html> |
From: Michal H. <ms...@us...> - 2005-09-24 12:05:09
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29658/source/exfex/common/pluginsystem Modified Files: PluginManager.java Log Message: documentation state management Index: PluginManager.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/PluginManager.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PluginManager.java 18 Sep 2005 19:18:11 -0000 1.13 --- PluginManager.java 24 Sep 2005 12:05:01 -0000 1.14 *************** *** 6,9 **** --- 6,13 ---- * * $Log$ + * Revision 1.14 2005/09/24 12:05:01 mstsxfx + * documentation + * state management + * * Revision 1.13 2005/09/18 19:18:11 mstsxfx * clonable implemented *************** [...1134 lines suppressed...] readyList.addPlugin(plugin); + + // Everything ok return true; }//}}} ! ! /** Wraper method for logging. ! * This method just get logger with logName and gives given parameters ! * to logger's log method. * ! * @param level Priority of message. ! * @param message Message to log. */ ! protected void log(ILogger.Level level,String message) { ! LogManager.getInstance().getLogger(logName).log(level,message); } } |
From: Michal H. <ms...@us...> - 2005-09-24 12:03:24
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29243/source/exfex/common/pluginsystem Modified Files: PluginList.java Log Message: removeExactPlugin documentation update Index: PluginList.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/PluginList.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PluginList.java 18 Sep 2005 19:03:50 -0000 1.8 --- PluginList.java 24 Sep 2005 12:03:16 -0000 1.9 *************** *** 6,9 **** --- 6,13 ---- * * $Log$ + * Revision 1.9 2005/09/24 12:03:16 mstsxfx + * removeExactPlugin + * documentation update + * * Revision 1.8 2005/09/18 19:03:50 mstsxfx * cloneable implemented *************** *** 30,34 **** package exfex.common.pluginsystem; ! import java.util.*; /** Class to store list of plugins. --- 34,42 ---- package exfex.common.pluginsystem; ! import java.util.LinkedList; ! import java.util.List; ! import java.util.ListIterator; ! ! import exfex.common.utils.CloneAble; /** Class to store list of plugins. *************** *** 39,47 **** * removePlugin, pollPlugin, clearPlugins). You can also use static method for * plugins compatibility compare (method isCompatible). Finaly you can search ! * in list. Search can be performed in 2 ways: * <ul> * <li>exact match - consider compatible type and the same name (method * searchExact). * <li>type match - consider compatible type (method searchType) * </ul> * If you need to traverse throught plugins in list, use ListIterator returned --- 47,57 ---- * removePlugin, pollPlugin, clearPlugins). You can also use static method for * plugins compatibility compare (method isCompatible). Finaly you can search ! * in list. Search can be performed in 3 ways: * <ul> * <li>exact match - consider compatible type and the same name (method * searchExact). * <li>type match - consider compatible type (method searchType) + * <li>reference match - consider just reference equality (method + * searchReference) * </ul> * If you need to traverse throught plugins in list, use ListIterator returned *************** *** 54,66 **** * * Changes: * 18.9.2005 msts - clonable implementation * removeExactPlugin method add ! * 14.8.2005 msts - all public methods are synchronized ! * 9.8.2005 msts - created * </pre> * * @author msts */ ! public class PluginList implements Cloneable { /** List where to store plugins. */ --- 64,77 ---- * * Changes: + * 20.9.2005 msts - searchReference, removeExactPlugin * 18.9.2005 msts - clonable implementation * removeExactPlugin method add ! * 14.8.2005 msts - all public methods are synchronized ! * 9.8.2005 msts - created * </pre> * * @author msts */ ! public class PluginList implements CloneAble { /** List where to store plugins. */ *************** *** 171,176 **** * * Replaces original plugin in list for replace. Plugins must ! * be compatible and have the same names (they are the same ! * implementators). * * @param original Original plugin in list. --- 182,187 ---- * * Replaces original plugin in list for replace. Plugins must ! * be type same (using areTypeSame) and have the same names (they are ! * the same implementators). * * @param original Original plugin in list. *************** *** 181,185 **** { // test is pugins have the same type and name ! if(!areCompatibles(original,replace) || ! original.getName().equals(replace.getName())) return false; --- 192,196 ---- { // test is pugins have the same type and name ! if(!areTypeSame(original,replace) || ! original.getName().equals(replace.getName())) return false; *************** *** 231,234 **** --- 242,249 ---- /** Creates and returns iterator on list. * + * NOTE: Changes made in iteration affect internal list. If you want to + * use safe iteration (with no effect to internal list), use toList + * method and obtain it's iterator. + * * @return ListIterator to traverse all plugins. */ *************** *** 266,282 **** }//}}} ! /** Removes plugin by plugin reference. * ! * Search given plugin the list by reference and if found, removes it ! * from the list. This method should be called when we want to remove ! * exact plugin (by reference). * ! * @param plugin Plugin to remove. ! * @return true if removed, false otherwise. */ ! synchronized public boolean removeExactPlugin(IPlugin plugin)//{{{ { if(plugin==null) ! return false; int index=0; --- 281,296 ---- }//}}} ! /** Searches plugin list by reference. * ! * Search given plugin by reference and if found, returns index of ! * plugin in the list. * ! * @param plugin Plugin to find. ! * @return Index of plugin in the list or -1 if not found. */ ! synchronized public int searchReference(IPlugin plugin)//{{{ { if(plugin==null) ! return -1; int index=0; *************** *** 288,297 **** // using index if(p==plugin) ! { ! list.remove(index); ! return true; ! } index++; } return false; }//}}} --- 302,332 ---- // using index if(p==plugin) ! return index; index++; } + + return -1; + }//}}} + + /** Removes plugin by plugin reference. + * + * Search given plugin using searchReference method and if found, + * removes it from the list. This method should be called when we want + * to remove exact plugin (by reference). + * + * @param plugin Plugin to remove. + * @return true if removed, false otherwise. + */ + synchronized public boolean removeExactPlugin(IPlugin plugin)//{{{ + { + if(plugin==null) + return false; + + int index; + if((index=searchReference(plugin))>-1) + { + list.remove(index); + return true; + } return false; }//}}} *************** *** 342,346 **** * * Search plugin in the list and returnes it's index. ! * Plugins are considered if they have same name and are compatible. * * @param plugin Plugin to search. --- 377,382 ---- * * Search plugin in the list and returnes it's index. ! * Plugins are considered same if they have same name and areTypeSame ! * returnes true. * * @param plugin Plugin to search. |
From: Michal H. <ms...@us...> - 2005-09-24 12:01:10
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28669/source/exfex/common/pluginsystem Modified Files: IPluginStrategy.java Log Message: documentation update Index: IPluginStrategy.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/IPluginStrategy.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IPluginStrategy.java 18 Sep 2005 18:59:43 -0000 1.4 --- IPluginStrategy.java 24 Sep 2005 12:01:00 -0000 1.5 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.5 2005/09/24 12:01:00 mstsxfx + * documentation update + * * Revision 1.4 2005/09/18 18:59:43 mstsxfx * new strategy type ATLEAST *************** *** 25,28 **** --- 28,32 ---- * * <pre> + * * Changes: * 13.8.2005 msts - New types *************** *** 30,34 **** * </pre> * ! * @author msts. */ public interface IPluginStrategy --- 34,38 ---- * </pre> * ! * @author msts */ public interface IPluginStrategy *************** *** 36,47 **** /** Defined types of strategy. * ! * Strategy types of the plugin. ! * ! * TODO: detailed description. * ! * @author msts * <pre> * Changes: * </pre> */ public static enum Type{FIRST,LAST,NEWEST,NAMEMATCH,ATLEAST}; --- 40,64 ---- /** Defined types of strategy. * ! * Strategy may be used in many places and so it's hard to define ! * meaning of each one here. ! * <br> ! * General notes: ! * <ul> ! * <li>FIRST - should reflect original or first one usage. ! * <li>LAST - should reflect replace or last one usage. ! * <li>NEWEST - should compare version (or other property with ordering) ! * and select on with highest number ! * <li>NAMEMATCH - should reflect one with given name. ! * <li>ATLEAST - should compare version (or other property with ordering) ! * and select one (or first) with at least given number. ! * </ul> * ! * * <pre> + * * Changes: * </pre> + * + * @author msts */ public static enum Type{FIRST,LAST,NEWEST,NAMEMATCH,ATLEAST}; |
From: Michal H. <ms...@us...> - 2005-09-24 12:00:21
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28469/source/exfex/common/pluginsystem Modified Files: IPluginPolicy.java Log Message: documentation update Index: IPluginPolicy.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/IPluginPolicy.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IPluginPolicy.java 18 Sep 2005 18:58:53 -0000 1.4 --- IPluginPolicy.java 24 Sep 2005 12:00:14 -0000 1.5 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.5 2005/09/24 12:00:14 mstsxfx + * documentation update + * * Revision 1.4 2005/09/18 18:58:53 mstsxfx * documentation to strategies *************** *** 31,35 **** * load, but plugin with the same type and name is already in the system. This * situation may be conflict - because new plugin can completly change behaviour ! * and so depedendencies may be broken - or it can be update when newer and * better plugin should replace old one.). In such situation plugin policy of * old (registerd in the system) one is considered to solve the situation. --- 34,38 ---- * load, but plugin with the same type and name is already in the system. This * situation may be conflict - because new plugin can completly change behaviour ! * and so depedendencies may be broken - or it can be updated when newer and * better plugin should replace old one.). In such situation plugin policy of * old (registerd in the system) one is considered to solve the situation. *************** *** 86,88 **** --- 89,92 ---- */ int version() default 0; + } |
From: Michal H. <ms...@us...> - 2005-09-24 11:52:56
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27429/source/exfex/common/pluginsystem Modified Files: IPlugin.java Log Message: documentation Index: IPlugin.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/IPlugin.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** IPlugin.java 15 Sep 2005 18:11:02 -0000 1.6 --- IPlugin.java 24 Sep 2005 11:52:44 -0000 1.7 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.7 2005/09/24 11:52:44 mstsxfx + * documentation + * * Revision 1.6 2005/09/15 18:11:02 mstsxfx * documentation corrected *************** *** 16,20 **** package exfex.common.pluginsystem; - /** Basic low level plugin interface. * --- 19,22 ---- *************** *** 22,33 **** * are considered to be plugins. * <p> ! * <b>Plugin writing rules</b>: * <br> * Each plugin have to implement this interface otherwise it will be * rejected during loading process. This interface contains all necessery * stuff for plugin registration - registerMe and unRegisterMe methods; * identifying - getName method and instancing - getInstance method. * <p> ! * <b>Registration</b>: * <br> * Put all necessery stuff in registerMe method. At least you should attach your --- 24,177 ---- * are considered to be plugins. * <p> ! * <h2>Plugin writing rules</h2> * <br> + * <h3>General</h3> * Each plugin have to implement this interface otherwise it will be * rejected during loading process. This interface contains all necessery * stuff for plugin registration - registerMe and unRegisterMe methods; * identifying - getName method and instancing - getInstance method. + * <br> + * All methods that should be visible for user should by implemented from + * interface rather than declared without it. Firmly declared method can't + * be recognized in depdendencies relations whereas those from interface + * are used to identify plugin types compatibilities. + * <pre> + * + * Example: + * + * // Not recommended + * public class ButtonFactory implements IPlugin + * { + * //IPlugin implementation + * . + * . + * . + * //end of IPlugin implementation + * + * IButton getButton(IContext context) + * { + * // some code + * } + * } + * + * // Recomended + * public class ButtonFactory implements IButtonFactory + * { + * //IPlugin implementation + * . + * . + * . + * //end of IPlugin implementation + * + * IButton getButton(IContext context) + * { + * // some code + * } + * } + * + * </pre> + * <br> + * <h4>Dependencies</h4> + * Each plugin can have many (but also no) dependencies. Dependency is + * considered to bee each declared field annotated by IInject annotation. + * This annotation can hold information, which plugin to inject to the field by + * conforming strategy. Use interface types rather than concrete types. + * They should be declared as private or protected fields. Inner classes are + * not considered (so annotating fields inside inner class takes no effect). + * Cycles in dependencies are allowed and shouldn't produce any problems. + * Dependencies to the same type as parameter are forbiden. + * <br> + * <h4>Plugin policy</h4> + * Plugin can have defined its policy. This can be done by IPluginPolicy + * annotation of the plugin class. You can define strategy for conflict + * situation or check sum file. If this annotation is not defined, strategy + * is implicitly FIRST (always replace with new version) + * <br> + * NOTE: Plugin also should override toString method to produces human readable + * form for debuging purposes. + * + * <pre> + * Example for simple plugin: + * + * import exfex.common.pluginsystem.*; + * import exfex.common.displaysystem.*; + * + * // maintained object + * class MyMaintainedObject + * { + * // whatever + * } + * + * // plugin object. + * + * // Policy annotation for plugin. + * // strategy says that only newer versions as 100 can replace this plugin + * @ IPluginPolicy(strategy=IPluginStrategy.Type.NEWEST,version=100) + * public class TestPlugin implements IPlugin + * { + * private String name="A"; // This is not dependency + * + * @ Inject + * IDisplayManager manager; // this is dependency that has to have + * // IDisplayManager type and it uses + * // first plugin that implements this + * // interface + * // We use this field as our manager, + * // where to register + * + * @ Inject(strategy=IPluginStrategy.Type.NEWEST) + * IFoo foo; // this is dependency that has to have type IFoo an + * // if more than one compatible plugins exits, it + * // will be the one with the highest version + * + * @ Inject(strategy=IPluginStrategy.Typ.NAMEMATCH,dependencyName="SWINGButton") + * IButton button; // this is dependency that has to have type IButton and + * // implementator plugin has to have name SWINGButton + * + * @ IInject + * TestPluginB b; // THIS IS NOT RECOMENDED if TestClass is concrete type + * + * @ IInject + * TestPluginA a; //THIS IS FORBIDEN + * + * public String getName() + * { + * return name; + * } + * + * public Object getInstance(IContext context) + * { + * // uses context to figure out which or how to create instance + * + * return new MyMaintainedObject(); + * } + * + * public void registerMe() + * { + * // do some intialization work, e.g if plugin needs to set + * // som configuration, creates setting builder and uses + * // SettingManager to build setting + * manager.attach(this); + * } + * + * public void unRegisterMe() + * { + * manager.dettach(this); + * + * // do clean up work + * // e.g. cleanup setting + * } + * + * public IAcceptPlugin getManager() + * { + * return manager; + * } + * + * } + * </pre> + * * <p> ! * <h2>Integration process</h2> ! * <h3>Registration</h3> * <br> * Put all necessery stuff in registerMe method. At least you should attach your *************** *** 35,41 **** * However this step can be done when plugin is ready to work, so all other * intialization is done yet. After attach, plugin can be immediately used. ! * If your plugin is manager it self it should be registered in PluginManager * which can be accesed by static method PluginManager.getInstance(). If you ! * want to register on other manager, there are 2 ways how to get its instance: * <ul> * <li> --- 179,185 ---- * However this step can be done when plugin is ready to work, so all other * intialization is done yet. After attach, plugin can be immediately used. ! * If your plugin is manager it should be registered in PluginManager * which can be accesed by static method PluginManager.getInstance(). If you ! * want to register on other manager, there are 3 ways how to get its instance: * <ul> * <li> *************** *** 47,59 **** * <li> * You can have your manager as dependency and so it will be injected to the ! * annotated field of your plugin class. This way is cleaner and safer, becase ! * you can be sure, that such manager already exists (dependencies are solved). ! * * </ul> ! * When you have your manager, call manager.attach(this) method and you will ! * be registered. * * <p> ! * <b>Instancing</b>: * <br> * Plugin itself is intended to be just factory class. You have to implement --- 191,211 ---- * <li> * You can have your manager as dependency and so it will be injected to the ! * annotated field of your plugin class. This way is cleaner, safer, and ! * recomended because you can be sure, that such manager already exists ! * (dependencies are solved). ! * <li> ! * If desired manager is static in the system, you can use static method ! * getInstance on manager type (as mentioned above in PluginManager context). ! * Following managers are static: PluginManager, LogManager, SettingManager. ! * Note that they ARE NOT registered in PluginManager, because they aren't ! * even plugins. * </ul> ! * When you have your manager instance, call manager.attach(this) method and you ! * will be registered. In extreme situation (critical error) exception can ! * be thrown. This is situation, when plugin can't do anything and so exception ! * should be rethrown. * * <p> ! * <h3>Instancing</h3> * <br> * Plugin itself is intended to be just factory class. You have to implement *************** *** 69,73 **** * * <p> ! * <b>Identity</b>: * <br> * Each plugin is unique by its type and name. If there are more plugins with --- 221,225 ---- * * <p> ! * <h3>Identity</h3> * <br> * Each plugin is unique by its type and name. If there are more plugins with *************** *** 78,84 **** * * <pre> - * TODO shouldn't getInstance return Object instead of IPlugin? * * Cahnges: * 14.8.2005 msts - getInstance changed * 13.8.2005 msts - documentation --- 230,236 ---- * * <pre> * * Cahnges: + * 19.9.2005 msts - documentation and example * 14.8.2005 msts - getInstance changed * 13.8.2005 msts - documentation *************** *** 86,92 **** * </pre> * ! * @see exfex.common.pluginsystem.PluginList#isCompatible(IPlugin, IPlugin) * @see exfex.common.pluginsystem.IAcceptPlugin * @see exfex.common.pluginsystem.IInject * @author msts */ --- 238,246 ---- * </pre> * ! * ! * @see exfex.common.pluginsystem.PluginList#areCompatibles(IPlugin, IPlugin) * @see exfex.common.pluginsystem.IAcceptPlugin * @see exfex.common.pluginsystem.IInject + * @see exfex.common.pluginsystem.IPluginPolicy * @author msts */ *************** *** 126,131 **** /** Registration method. * ! * Method should perform all plugin specific intialization work. ! * This involves: * <ul> * <li>configuration tasks (e.g. creating SettingBuilder for --- 280,286 ---- /** Registration method. * ! * This method is invoced by PluginManager when loading process is ! * almost finished. Method should perform all plugin specific ! * intialization work. This involves: * <ul> * <li>configuration tasks (e.g. creating SettingBuilder for *************** *** 137,150 **** * plugin should keep in mind, that after plugin has attached to manager * it can be immediately used, so it should be completly ready. * * @see exfex.common.pluginsystem.IAcceptPlugin */ ! public void registerMe(); /** Deregistration method. ! * * Clean up method. It has to deatach from manager in first step. * It's called when modul is purged from system. This method should be ! * kind of inversion of registerMe method. */ public void unRegisterMe(); --- 292,317 ---- * plugin should keep in mind, that after plugin has attached to manager * it can be immediately used, so it should be completly ready. + * <p> + * During initialization, plugin has to be aware of fact, that the + * plugin with same type and name, may be load in the system. This can + * happen when plugin is update for older version. + * <p> + * WARNING: This method shouldn't fail, ONLY because of inconsistency + * or critical situation! * + * @see exfex.common.pluginsystem.PluginManager#solveDependencies(IPlugin) * @see exfex.common.pluginsystem.IAcceptPlugin + * @throws PluginException in critical situation. */ ! public void registerMe()throws PluginException; /** Deregistration method. ! * * Clean up method. It has to deatach from manager in first step. * It's called when modul is purged from system. This method should be ! * kind of inversion of registerMe method. It's called by PluginManager ! * when starting to purge plugin. ! * ! * @see exfex.common.pluginsystem.PluginManager#purge(IPlugin) */ public void unRegisterMe(); *************** *** 162,163 **** --- 329,331 ---- public IAcceptPlugin getManager(); } + |
From: Michal H. <ms...@us...> - 2005-09-24 11:52:35
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27387/source/exfex/common/pluginsystem Modified Files: DependencyMap.java Log Message: documentation implementation notes Index: DependencyMap.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/DependencyMap.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** DependencyMap.java 18 Sep 2005 18:51:32 -0000 1.10 --- DependencyMap.java 24 Sep 2005 11:52:22 -0000 1.11 *************** *** 3,6 **** --- 3,10 ---- * * $Log$ + * Revision 1.11 2005/09/24 11:52:22 mstsxfx + * documentation + * implementation notes + * * Revision 1.10 2005/09/18 18:51:32 mstsxfx * cloneable and new methods getSources, getDepended *************** *** 31,47 **** import exfex.common.logging.ILogger; import exfex.common.logging.LogManager; /** Source of dependency class. * * This class holds information about plugin dependency source. This involves ! * Plugin type (more precisly source of dependency type) and all implementators * of this source. This architecture enables to keep dependency relation where ! * many implementators of one plugin type are source of dependency. * Instance of this class is typicaly the key in DependencyMap class. * <p> ! * <b>Usage</b>:<br> * User shouldn't create instance of this class directly. It's created when ! * needed by DependencyMap class. New instance is created when new source of ! * dependency occures (no compatible plugin is source of dependency). * If already exists dependency source with compatible type with new source * of dependency relation, method put have to be called. --- 35,69 ---- import exfex.common.logging.ILogger; import exfex.common.logging.LogManager; + import exfex.common.utils.CloneAble; /** Source of dependency class. * * This class holds information about plugin dependency source. This involves ! * Plugin type (more precisely source of dependency type) and all implementators * of this source. This architecture enables to keep dependency relation where ! * many implementators of one plugin compatible type are source of dependency. ! * Implementator can by any plugin implementing at least those interfaces ! * as source type. ! * <pre> ! * ! * Example: ! * ! * Consider situation: ! * P1 implements IA, IB, IC ! * P2 implements IB, IC ! * P3 implements IC ! * P4 depends on P2 ! * ! * P1 is compatible with P2 ! * P4 is DependencySource type of dependency relation (P2, P4) ! * ! * P1, P2 are compatible with P3 ! * ! * </pre> * Instance of this class is typicaly the key in DependencyMap class. * <p> ! * <h3>Usage</h3> * User shouldn't create instance of this class directly. It's created when ! * needed by DependencyMap class. * If already exists dependency source with compatible type with new source * of dependency relation, method put have to be called. *************** *** 61,66 **** * <pre> * * Changes: ! * 18.9.2005 msts - cloneable implementation * 6.8.2005 msts - created * </pre> --- 83,98 ---- * <pre> * + * TODO: need to examine + * FIXME: already inserted types are not asked when new DependencySource is + * created (so have no chance to put themselfs among compatibles implementators) + * when creating new DependencySource, examine all ready plugins for + * compatibility + * TODO: add mark that source is restricted, and only plugins with certain + * properties are compatible (e.g. name, version restriction), in fact that + * means something like strategy insert to the compatible method + * * Changes: ! * 18.9.2005 msts - cloneable implementation ! * new getSources, getDepended methods * 6.8.2005 msts - created * </pre> *************** *** 68,72 **** * @author msts */ ! class DependencySource implements Cloneable { /** List of implementators. --- 100,104 ---- * @author msts */ ! class DependencySource implements CloneAble { /** List of implementators. *************** *** 88,91 **** --- 120,124 ---- /** Constructor. + * * * Inserts plug to the implList and set source type. This constructor *************** *** 127,131 **** { // plug implementation is not in list yet ! if(implList.addPlugin(plug)) LogManager.getInstance().getLogger("PLUGMNG_LOGGER").log(ILogger.Level.DEBUG,this+".put new implementator - "+plug+" impl count="+implList.size()); }//}}} --- 160,164 ---- { // plug implementation is not in list yet ! if(implList.addPlugin(plug,true)) LogManager.getInstance().getLogger("PLUGMNG_LOGGER").log(ILogger.Level.DEBUG,this+".put new implementator - "+plug+" impl count="+implList.size()); }//}}} *************** *** 145,155 **** if(implList.removePlugin(plug)) LogManager.getInstance().getLogger("PLUGMNG_LOGGER").log(ILogger.Level.DEBUG,this+".release implementator removed - "+plug+" impl count="+implList.size()); ! if(plug==source && implList.size()>0) ! { ! // we are releasing source, so change source field ! // to the first available in the implList ! source=implList.listIterator().next(); ! LogManager.getInstance().getLogger("PLUGMNG_LOGGER").log(ILogger.Level.DEBUG,this+".release changing source field from "+plug+" to "+source); ! } return implList.size()==0; }//}}} --- 178,186 ---- if(implList.removePlugin(plug)) LogManager.getInstance().getLogger("PLUGMNG_LOGGER").log(ILogger.Level.DEBUG,this+".release implementator removed - "+plug+" impl count="+implList.size()); ! // source is created during instantiating and is kept during ! // whole DependencySource life, because its most general type ! // for source (all others have to implement at least it's ! // interfaces. ! return implList.size()==0; }//}}} *************** *** 193,198 **** /** Finds out if plg is compatible with source (of dependency). * ! * Finds out if plg is type compatible (using static isCompatible method ! * from PuginList class) with source field (source of dependency). * * @param plg Plugin. --- 224,229 ---- /** Finds out if plg is compatible with source (of dependency). * ! * Finds out if plg is type compatible (using static areCompatibles ! * method from PuginList class) with source field (source of dependency). * * @param plg Plugin. *************** *** 202,205 **** --- 233,237 ---- public boolean compatible(IPlugin plg)//{{{ { + // plg have to implement at least source's interfaces if(PluginList.areCompatibles(source,plg)) return true; *************** *** 282,294 **** * This class keeps map (Hashtable) between DependencySource objects * and list of depended plugins. ! * DependencySource is object that keeps all implementators of the same type. * List contains all depended plugins on DependencySource type plugin. * <p> ! * <b>Usage</b>: * <ul> * <li>To insert dependency, use addDependency method. It will create ! * new dependency source if no compatible (by type) is in map or ! * call DependencySource.put on existing source and append dependency ! * list of source. * <li>To remove plugin from map there are two ways to accomplish task: * <ul> --- 314,328 ---- * This class keeps map (Hashtable) between DependencySource objects * and list of depended plugins. ! * DependencySource is object that keeps all implementators compatible with ! * its source type. Source type is created when DependencySource object is ! * created and stay same during whole DependencySource life. Compatibility ! * is determined by DependencySource.compatible method. * List contains all depended plugins on DependencySource type plugin. * <p> ! * <h3>Usage</h3> * <ul> * <li>To insert dependency, use addDependency method. It will create ! * new dependency source if no such source is in map or call ! * DependencySource.put on existing source and append dependency list of source. * <li>To remove plugin from map there are two ways to accomplish task: * <ul> *************** *** 323,327 **** * Changes: * ! * TODO: serialization * * 18.9.2005 msts - cloneable implementation --- 357,362 ---- * Changes: * ! * TODO: need to examine ! * TODO: add and rewrite log messages * * 18.9.2005 msts - cloneable implementation *************** *** 331,335 **** * </pre> */ ! public class DependencyMap { /** Map to keep source of dependency and depended plugins. */ --- 366,370 ---- * </pre> */ ! public class DependencyMap implements CloneAble { /** Map to keep source of dependency and depended plugins. */ *************** *** 382,391 **** * new DependencySource object from source plugin and linked list * with one depended member. This is initialization of dependency ! * relation. * <li> ! * there already exists DependencySource object compatible with source ! * plugin. We will call DependencySource.put on it and append it's ! * dependency list (value in map) with depended (using addPlugin method ! * with overwrite flag set to true) * </ul> * --- 417,427 ---- * new DependencySource object from source plugin and linked list * with one depended member. This is initialization of dependency ! * relation. Uses static method PluginList.areTypeSame to source type ! * of each DependencySource to find out if there is one such. * <li> ! * there already exists Dsuch ependencySource object. We will call ! * DependencySource.put on it and append it's dependency list (value in ! * map) with depended (using addPlugin method with overwrite flag set to ! * true) * </ul> * *************** *** 399,412 **** Enumeration<DependencySource> sources=map.keys(); ! // Search all DependencySources LogManager.getInstance().getLogger("PLUGMNG_LOGGER").log(ILogger.Level.INFO,"DependencyMap.addDependency "+source+" <- "+depended); while(sources.hasMoreElements()) { ! // Get element and check if source is compatible DependencySource element=sources.nextElement(); ! if(element.compatible(source)) { ! // Element is compatible, so we will increase ! // it's usage and append depended to the list PluginList deplist=map.get(element); element.put(source); --- 435,450 ---- Enumeration<DependencySource> sources=map.keys(); ! // traverse all map to examine all DependencySources LogManager.getInstance().getLogger("PLUGMNG_LOGGER").log(ILogger.Level.INFO,"DependencyMap.addDependency "+source+" <- "+depended); while(sources.hasMoreElements()) { ! // Get element and check if source and element types ! // are same DependencySource element=sources.nextElement(); ! if(PluginList.areTypeSame(element.getPluginType(),source)) { ! // Element is source type same, so we will ! // increase it's usage and append depended to ! // the list PluginList deplist=map.get(element); element.put(source); *************** *** 427,431 **** * * Goes throught all dependency sources and if plugin type of the ! * source is compatible with plugin, calls DependencySource.put * method. * <p> --- 465,469 ---- * * Goes throught all dependency sources and if plugin type of the ! * source is type compatible with plugin, calls DependencySource.put * method. * <p> *************** *** 448,451 **** --- 486,490 ---- // source source.put(plugin); + LogManager.getInstance().getLogger("PLUGMNG_LOGGER").log(ILogger.Level.DEBUG,this+".putImplementator "+plugin+" compatible with "+source.getPluginType()+" inserted to Dependency source "+source); } } *************** *** 464,467 **** --- 503,510 ---- * DependencySource from map. * <p> + * NOTE: This method should be called until returned value is null, + * because, it'll start in first situation, when no implementators + * are avilable and there can still exist other such sources. + * <br> * NOTE: Situation when source is not compatible with any * DependencySource is not report as error (returns null). *************** *** 510,514 **** LogManager.getInstance().getLogger("PLUGMNG_LOGGER").log(ILogger.Level.DEBUG,"DependencyMap.releaseDependency "+depended+" from "+sourcelist.size()+" sources"); ! // For all sources of dependepcy remove depended from // list. If list become empty, inserts it to the removecand // and after all sources done, removes all sources from --- 553,557 ---- LogManager.getInstance().getLogger("PLUGMNG_LOGGER").log(ILogger.Level.DEBUG,"DependencyMap.releaseDependency "+depended+" from "+sourcelist.size()+" sources"); ! // For all sources of dependepcy removes depended from // list. If list become empty, inserts it to the removecand // and after all sources done, removes all sources from *************** *** 548,552 **** * <ul> * <li>Both plugins have to have same type (have to be interface ! * compatible - uses PluginList.isCompatible static method). If they * aren't returns an error. * <li>If oldone is depednency source, just change implementators. --- 591,595 ---- * <ul> * <li>Both plugins have to have same type (have to be interface ! * compatible - uses PluginList.areTypeSame static method). If they * aren't returns an error. * <li>If oldone is depednency source, just change implementators. *************** *** 574,583 **** { // oldone is inserted in dependency source ! // we will change oldone for newone and exit ! // loop (we assume the each plugin can be in one ! // dependency source) source.changeImplementator(oldone,newone); LogManager.getInstance().getLogger("PLUGMNG_LOGGER").log(ILogger.Level.DEBUG,"DependencyMap.consolidateDependencies changed dependency source "+source); ! break; } } --- 617,624 ---- { // oldone is inserted in dependency source ! // we will change oldone for newone source.changeImplementator(oldone,newone); LogManager.getInstance().getLogger("PLUGMNG_LOGGER").log(ILogger.Level.DEBUG,"DependencyMap.consolidateDependencies changed dependency source "+source); ! } } |
From: Michal H. <ms...@us...> - 2005-09-24 11:47:07
|
Update of /cvsroot/exfex/exfex/source/exfex/common/logging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26269/source/exfex/common/logging Modified Files: NullLogger.java Log Message: synchronized with ILogger interface documentation Index: NullLogger.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/logging/NullLogger.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NullLogger.java 15 Sep 2005 18:11:02 -0000 1.5 --- NullLogger.java 24 Sep 2005 11:46:59 -0000 1.6 *************** *** 3,6 **** --- 3,10 ---- * * $Log$ + * Revision 1.6 2005/09/24 11:46:59 mstsxfx + * synchronized with ILogger interface + * documentation + * * Revision 1.5 2005/09/15 18:11:02 mstsxfx * documentation corrected *************** *** 18,34 **** ! /** Logger with no loging facilities. * ! * This loger is defined because of situation where we want to return ! * empty (null) Loger such as when LogManager can't find proper Loger. ! * User can use LogManager in following way and it's safe:<br> * LogManager.getInstance().getLoger(name).log(...) * <p> ! * NullLoger is singleton so, use getInstance method to acces it. ! * <p> ! * If name is not registered, application will not crash on ! * nullPointerException, because getLoger return NullLoger and we can call ! * log method on it (log will have no efect). ! * * * <pre> --- 22,40 ---- ! /** Logger with no output. * ! * This loger is defined to stand for undefined logger. When users are asking ! * for some logger (by its name), they can't be sure that the logger is ! * registered. To avoid checking of returned value, LogManager uses this logger ! * when not able to find proper one. User can stransparently use<br> ! * <pre> * LogManager.getInstance().getLoger(name).log(...) + * </pre> + * and don't have to be afraid, that NullException will be thrown. If logger + * doesn't exists, simply no output performes. * <p> ! * NullLoger is singleton so, use getInstance method to access it. You can't ! * create instance by new operator. This instance is shared. ! * * * <pre> *************** *** 96,100 **** /** Empty setTimeDisplay method. */ ! public void setTimeDisplay(boolean display) { } --- 102,106 ---- /** Empty setTimeDisplay method. */ ! public void setTimeDisplay(String timeformat) { } |
From: Michal H. <ms...@us...> - 2005-09-24 11:40:33
|
Update of /cvsroot/exfex/exfex/source/exfex/common/logging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24784/source/exfex/common/logging Modified Files: LoggerStream.java Log Message: documentation DataOutputStream replaced by DataOutput Index: LoggerStream.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/logging/LoggerStream.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LoggerStream.java 15 Sep 2005 18:11:02 -0000 1.2 --- LoggerStream.java 24 Sep 2005 11:40:24 -0000 1.3 *************** *** 3,15 **** ! import java.io.DataOutputStream; ! import java.io.IOException; ! /** Low level logger device. ! * ! * Implementator of the ILoggerStream interafce (low level logger device). ! * This class is used to write data given from high level ILogger implementator. * <p> ! * All data are writen to the DataOutputStream created in constructor (or set * by setOutput method. * <br> --- 3,14 ---- ! import java.io.*; ! /** Default ILoggerStream implementation. ! * ! * This class is used to write data given from high level ILogger implementator ! * in system neutral way. * <p> ! * All data are writen to the DataOutput created in constructor (or set * by setOutput method. * <br> *************** *** 19,22 **** --- 18,22 ---- * <pre> * Changes: + * 23.9.2005 msts - DataOutputStream replaced by DataOutput * 5.9.2005 msts - created * </pre> *************** *** 26,42 **** class LoggerStream implements ILoggerStream { ! private DataOutputStream output; private LoggerStream() { } ! /** Constructor from DataOutputStream instance. * ! * Sets output field to given one. * * @param stream Stream where to write. */ ! public LoggerStream(DataOutputStream stream) { output=stream; --- 26,49 ---- class LoggerStream implements ILoggerStream { ! /** Output object. ! * This instance is used to write data. ! */ ! private DataOutput output; + /* Unavailable constructor. + * This constructor is blocked to avoid users to create uninitialized + * logger stream. + */ private LoggerStream() { } ! /** Initializing constructor. * ! * Sets output field to the given one. * * @param stream Stream where to write. */ ! public LoggerStream(DataOutput stream) { output=stream; *************** *** 47,50 **** --- 54,58 ---- * Writes message to the output stream. If no output stream is * specified (output is null), just ignore and does nothing. + * Puts new line character after printed message. * * @param message Message to write. *************** *** 52,60 **** synchronized public void println(String message)//{{{ { // Try to write data to output stream, If exception // just write error message to the standard error output try { ! output.writeBytes(message); }catch(IOException e) { --- 60,72 ---- synchronized public void println(String message)//{{{ { + // no output defined + if(output==null) + return; + // Try to write data to output stream, If exception // just write error message to the standard error output try { ! output.writeBytes(message+"\n"); }catch(IOException e) { *************** *** 69,73 **** * @param stream New output stream. */ ! synchronized public void setOutput(DataOutputStream stream)//{{{ { flush(); --- 81,85 ---- * @param stream New output stream. */ ! synchronized public void setOutput(DataOutput stream)//{{{ { flush(); *************** *** 78,88 **** synchronized public void flush()//{{{ { ! try ! { ! output.flush(); ! }catch(Exception e) ! { ! //FIXME Ignoring now ! } }//}}} } --- 90,95 ---- synchronized public void flush()//{{{ { ! // TODO implement }//}}} + } |
From: Michal H. <ms...@us...> - 2005-09-24 11:34:10
|
Update of /cvsroot/exfex/exfex/source/exfex/common/logging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23671/source/exfex/common/logging Modified Files: ILoggerStream.java Log Message: documentation DataOutputStream replaced be DataOutput Index: ILoggerStream.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/logging/ILoggerStream.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ILoggerStream.java 15 Sep 2005 18:11:02 -0000 1.2 --- ILoggerStream.java 24 Sep 2005 11:34:03 -0000 1.3 *************** *** 1,11 **** package exfex.common.logging; ! import java.io.DataOutputStream; ! /** Public low level logger device interface. * * This interface stands for Low level Logger device. * Implementator of this interface is used by ILogger implementator to write ! * concrete data to logger target. As output uses DataOutputStream, but doesn't * know what kind of device it is. * <p> --- 1,11 ---- package exfex.common.logging; ! import java.io.*; ! /** Low level logger device interface. * * This interface stands for Low level Logger device. * Implementator of this interface is used by ILogger implementator to write ! * concrete data to logger target. As output uses DataOutput, but doesn't * know what kind of device it is. * <p> *************** *** 16,19 **** --- 16,20 ---- * <pre> * Changes: + * 23.9.2005 msts - DataOutputStream changed to the DataOutput * 5.9.2005 msts - created * </pre> *************** *** 34,38 **** * @param stream New stream to set. */ ! public void setOutput(DataOutputStream stream); /** Flushes output. */ --- 35,39 ---- * @param stream New stream to set. */ ! public void setOutput(DataOutput stream); /** Flushes output. */ |
From: Michal H. <ms...@us...> - 2005-09-24 11:29:39
|
Update of /cvsroot/exfex/exfex/source/exfex/common/logging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22990/source/exfex/common/logging Modified Files: ILogger.java Log Message: setTimeDisplay paramter changed to String documentation update Index: ILogger.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/logging/ILogger.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ILogger.java 15 Sep 2005 18:11:02 -0000 1.5 --- ILogger.java 24 Sep 2005 11:29:30 -0000 1.6 *************** *** 3,6 **** --- 3,10 ---- * * $Log$ + * Revision 1.6 2005/09/24 11:29:30 mstsxfx + * setTimeDisplay paramter changed to String + * documentation update + * * Revision 1.5 2005/09/15 18:11:02 mstsxfx * documentation corrected *************** *** 43,53 **** * <li>prefix as string which will starts each string that is logged by logging * low level device. Use setPrefix method. ! * <li>TODO: time format string. Use setTimeDisplay method. * * <pre> - * TODO: change setTimeDisplay to give string format instead of boolean value * * Changes: ! * 24.7.2005 - msts - created * </pre> * --- 47,58 ---- * <li>prefix as string which will starts each string that is logged by logging * low level device. Use setPrefix method. ! * <li>time format string to control how to display time in message. * * <pre> * * Changes: ! * 23.9.2005 msts - setTimeDisplay parameter changed to string (time format ! * string ! * 24.7.2005 msts - created * </pre> * *************** *** 60,64 **** * Levels for for messages priorities. * ! * <br><b>Priorities overview</b>:<br> * <ul> * <li>NONE - never logs, this used just for lower bound representation. --- 65,69 ---- * Levels for for messages priorities. * ! * <h3>Priorities overview</h3> * <ul> * <li>NONE - never logs, this used just for lower bound representation. *************** *** 101,105 **** * the low level logger device. * <p> ! * <b>General logging proces</b>:<br> * Tests if priority of message is lower (number) then logLevel and if * so print message using out stream. --- 106,110 ---- * the low level logger device. * <p> ! * <h3>General logging process</h3> * Tests if priority of message is lower (number) then logLevel and if * so print message using out stream. *************** *** 145,149 **** /** Sets new prefix. * ! * Sets new prefix string. There are no constrains on new value. * * @param pref New prefix string. --- 150,155 ---- /** Sets new prefix. * ! * Sets new prefix string. There are no constrains on new value. If ! * given value is null, displaying of prefix should be disabled. * * @param pref New prefix string. *************** *** 159,172 **** public void flush(); ! /** Sets value of displayTime field. ! * ! * Sets field that controls displaying time in log messages. ! * If the value is true, then whole input is preceeded by ! * actual local time. ! * <p> ! * TODO: change to String which represents time format. * ! * @param display New value of field. */ ! public void setTimeDisplay(boolean display); } --- 165,176 ---- public void flush(); ! /** Creates time formater according given format. * ! * If timeformat is not null, creates new formater for time (class that ! * can format actual time according format string). ! * If parameter is null, time printing should be disabled. ! * ! * @param timeformat New value of timeformat. */ ! public void setTimeDisplay(String timeformat); } |
From: Michal H. <ms...@us...> - 2005-09-24 11:12:35
|
Update of /cvsroot/exfex/exfex/source/exfex/common/logging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20275/source/exfex/common/logging Modified Files: Logger.java Log Message: documentation timeformating rewritten Index: Logger.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/logging/Logger.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Logger.java 15 Sep 2005 18:11:02 -0000 1.7 --- Logger.java 24 Sep 2005 11:12:23 -0000 1.8 *************** *** 3,6 **** --- 3,10 ---- * * $Log$ + * Revision 1.8 2005/09/24 11:12:23 mstsxfx + * documentation + * timeformating rewritten + * * Revision 1.7 2005/09/15 18:11:02 mstsxfx * documentation corrected *************** *** 22,30 **** package exfex.common.logging; ! /** Class for logging information. * * Class for logging stuff. This implementation of ILogger interface is diveded * to 2 layers. High level part controls message filtering according priorities, ! * adds prefix and/or time information. Low level (logger device) is just for * writing to the Data output stream. Low level logger device is represented by * ILoggerStream implementator (given in constructor or setOutput method. --- 26,39 ---- package exfex.common.logging; ! import java.text.DateFormat; ! import java.text.FieldPosition; ! import java.text.SimpleDateFormat; ! import java.util.Date; ! ! /** Default ILogger implementation. * * Class for logging stuff. This implementation of ILogger interface is diveded * to 2 layers. High level part controls message filtering according priorities, ! * adds prefix and time information. Low level (logger device) is just for * writing to the Data output stream. Low level logger device is represented by * ILoggerStream implementator (given in constructor or setOutput method. *************** *** 32,40 **** * <p> * Logger has internal verbosity filter which controls which message should ! * be printed and which supressed. Verbosity filter is represented by logLevel. * Each message given to the log method has priority (given also as parameter). * This priority is compared with internal logLevel (which is set in constructor * or setLogLevel method). If priority is equal or lower than logLevel message ! * is printed using logger device. * <p> * Message priority is represented by ILogger.Level enum. --- 41,49 ---- * <p> * Logger has internal verbosity filter which controls which message should ! * be printed and which suppressed. Verbosity filter is represented by logLevel. * Each message given to the log method has priority (given also as parameter). * This priority is compared with internal logLevel (which is set in constructor * or setLogLevel method). If priority is equal or lower than logLevel message ! * is printed using logger device (highest is DEBUG, lowest is NONE). * <p> * Message priority is represented by ILogger.Level enum. *************** *** 42,47 **** * To provide customizable output, you can define prefix which will be in the * begining of each message. This is set also in constructor. * <p> ! * NOTE: All method are synchrinized so they can be used in multi-threaded * environment. * --- 51,59 ---- * To provide customizable output, you can define prefix which will be in the * begining of each message. This is set also in constructor. + * User can also define time format to control how the time should be formated + * int the message. Use setTimeDisplay method to set format. If format is not + * set, no time is displayed in message. * <p> ! * NOTE: All method are synchronized so they can be used in multi-threaded * environment. * *************** *** 49,52 **** --- 61,65 ---- * <pre> * Changes: + * 23.9.2005 msts - displayTime changed from boolean to TimeFormat * 5.9.2005 msts - reimplemented - devided to 2 layers (high level and * low level logger device. This enables sharing logger *************** *** 86,96 **** private String prefix; ! /** Time flag. ! * ! * This field controls setting of time displaying in message. * ! * TODO: rewrite to time format instead of boolean. */ ! private boolean displayTime=false; /** Standard constructor without parameters. --- 99,108 ---- private String prefix; ! /** Time format class. * ! * This field is used to parse time (when message was asked to log). ! * It is created each time, when setTimeDisplay method is called. */ ! private DateFormat displayTime; /** Standard constructor without parameters. *************** *** 105,138 **** } ! /** Constructor. ! * ! * Sets values of logLevel, out and prefix fields. If output is null ! * reference, out will be set to System.err stream. * * @param level Level of verbosity number. * @param output Output stream. * @param pref Prefix string. * */ ! public Logger(int level, ILoggerStream output, String pref)//{{{ { logLevel=level; out=output; ! ! log(Level.INFO,"Created logger "+this+" with verbosity="+logLevel+" prefix="+prefix); ! prefix=pref; }//}}} ! /** Function for loging. * ! * Specific behaviour: * <br> - * Header has one obligatory part which is string format of priority - * and it's last part ended with one space. If displayTime is true - * then header starts with time string. If prefix is not null, then - * prefix ended with `:' separator follows. * So output will look like:<br> ! * <i>[time][prefix: ]PRIORITY message</i> ! * * @param priority Priority of message. * @param message Message string. --- 117,176 ---- } ! /** Initializing constructor. * + * Sets values of logLevel, out, prefix fields and displayTime. If + * output is null, out will be set to System.err stream. + * * @param level Level of verbosity number. * @param output Output stream. * @param pref Prefix string. + * @param timeformat Time format. * */ ! public Logger(int level, ILoggerStream output, String pref, String timeformat)//{{{ { logLevel=level; out=output; ! setPrefix(pref); ! setTimeDisplay(timeformat); ! log(Level.INFO,"Created logger "+this+" with verbosity="+logLevel+" prefix="+prefix+" time format="+timeformat); }//}}} ! /** Logging method. * ! * Performes priority check as described in {@link ILogger#log(Level, String)} ! * and if message should be printed, it will construct message and ! * sends it to the low level logger device. ! * <p> ! * <h3>Message constructing</h3> ! * Printed message consists of 2 parts: <b>Header</b> and <b>body</b>. ! * <br> ! * Header has one obligatory part which is string representation of ! * the priority and it's last part of the header followed be one space. ! * If displayTime is not null then header starts with time string ! * which depends on format represented by SimpleTimeFormat onject ! * created in setTimeDisplay method from format string. Time string is ! * finished by one space. ! * If prefix string is not null, it will append beggining of the header. ! * End of the prefix is marked by `:' character followed be one space. ! * Finally priority string si appended (everytime). ! * <br> ! * Body is separated from the header by one space. It contains given ! * message. * <br> * So output will look like:<br> ! * <pre> ! * [time ][prefix: ]PRIORITY message ! * </pre> ! * <bre> ! * <p> ! * <b>Parsing note</b>: ! * Time separator is considered to be first space before prefix starts. ! * Prefix separator is consedered to be first `:' after prefix followed ! * by space and priority text. Priority is exactly one word followed by ! * one space. Following part is message text. ! * <br> ! * NOTE: prefix shouldn't contain priority text, neither time string. ! * * @param priority Priority of message. * @param message Message string. *************** *** 148,154 **** if(priority.ordinal()>Level.NONE.ordinal() && priority.ordinal()<=logLevel) { ! // TODO time format & prefix ! String msg=new String(namedPriorities[priority.ordinal()]+" "+message+"\n"); ! out.println(msg); } --- 186,211 ---- if(priority.ordinal()>Level.NONE.ordinal() && priority.ordinal()<=logLevel) { ! StringBuffer buffer=new StringBuffer(); ! // starts with time information (if time formater is not ! // null ! if(displayTime!=null) ! { ! FieldPosition f=new FieldPosition(0); ! buffer=displayTime.format(new Date(),buffer,f); ! buffer.append(" "); ! } ! // prefix part ! if(prefix!=null) ! buffer.append(prefix+": "); ! ! // priority part ! buffer.append(namedPriorities[priority.ordinal()]+" "); ! ! // body of the message (given text) ! buffer.append(message); ! ! // send constructed message to the low level logger ! // device ! out.println(buffer.toString()); } *************** *** 205,213 **** /** Sets value of displayTime field. * @inheritDoc */ ! synchronized public void setTimeDisplay(boolean display)//{{{ { ! displayTime=display; }//}}} } --- 262,286 ---- /** Sets value of displayTime field. + * + * If parameter is not null, creates SimpleDataFormat object with format + * given as parameter. Created object is used to format time + * (displayTime field). + * <br> + * If given parameter is null, sets displayTime to null, what means that + * no time is displayed in the output message. + * <p> + * NOTE: method doesn't perform format correctness, caller should do it. + * + * @see java.text.DateFormat For formating rules. + * * @inheritDoc */ ! synchronized public void setTimeDisplay(String timeformat)//{{{ { ! if(timeformat==null) ! displayTime=null; ! ! ! displayTime=new SimpleDateFormat(timeformat); }//}}} } |
From: Michal H. <ms...@us...> - 2005-09-24 10:53:56
|
Update of /cvsroot/exfex/exfex/source/exfex/common/logging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15515/source/exfex/common/logging Modified Files: Destination.java Log Message: equal method rewriten documentation update Index: Destination.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/logging/Destination.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Destination.java 15 Sep 2005 18:11:02 -0000 1.3 --- Destination.java 24 Sep 2005 10:53:46 -0000 1.4 *************** *** 3,6 **** --- 3,10 ---- * * $Log$ + * Revision 1.4 2005/09/24 10:53:46 mstsxfx + * equal method rewriten + * documentation update + * * Revision 1.3 2005/09/15 18:11:02 mstsxfx * documentation corrected *************** *** 13,19 **** package exfex.common.logging; ! /** Defines named destination. * ! * Class to keep information about destination defined as pair * (name, target). name represents symbolic name of destination and target * stands for name of physical device (e.g. file name). --- 17,23 ---- package exfex.common.logging; ! /** Named destination class. * ! * Class to keep information about abstract destination defined as pair * (name, target). name represents symbolic name of destination and target * stands for name of physical device (e.g. file name). *************** *** 48,52 **** } ! /** Complet constructor. * * Sets name and target fields according parameters. --- 52,56 ---- } ! /** Initialize constructor. * * Sets name and target fields according parameters. *************** *** 107,114 **** }//}}} ! /** * - * TODO: rewrite - * * @param o Object to compare. * @return true if o equals with this instance, otherwise false. --- 111,121 ---- }//}}} ! /** Equality method. ! * ! * Method to compare given object with this instance. Given object can ! * be equal if it's insatnce of Destination class. Two destinations ! * are same iff they have same names and targets (to compare uses ! * String.equal methos). * * @param o Object to compare. * @return true if o equals with this instance, otherwise false. *************** *** 116,120 **** @Override public boolean equals(Object o)//{{{ { ! return o.equals(this); }//}}} } --- 123,133 ---- @Override public boolean equals(Object o)//{{{ { ! if(!(o instanceof Destination)) ! return false; ! Destination dest=(Destination)o; ! ! // Two destinations are same iff names and targets are same ! return name.equals(dest.getName()) && ! target.equals(dest.getTarget()); }//}}} } |
From: Michal H. <ms...@us...> - 2005-09-18 19:21:38
|
Update of /cvsroot/exfex/exfex/source/exfex/common/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16801/source/exfex/common/utils Added Files: Triplet.java Log Message: Helper class for triplets --- NEW FILE: Triplet.java --- package exfex.common.utils; /** Generic triplet class. * * This class is intended to keep 3 (possible type different) types in * one object. * We use it in getDependencies method, which returns all depended type with * their names and annotation objects. * <p> * Fields are called first, second and third. Use get/set methods to controll * their values. * * <pre> * * Changes: * 16.09.2005 msts - created * </pre> * * @param <S> First type of the triple. * @param <T> Second type of the triple. * @param <U> Third type of the triple * * @author msts */ public class Triplet<S,T,U> { /** * First value of the triple with generic S type. */ private S first=null; /** * Second value of the triple with generic T type. */ private T second=null; /** * Third value of the triple with generic U type. */ private U third=null; /** Default constructor. * * This constructor doesn't set any values. Both fields are * initialized to null. */ public Triplet(){}; /** Constructor with initialization values. * * Uses set* methods to set fields. * * @param first Value for first field. * @param second Value for second field. * @param third Value for third field. */ public Triplet(S first, T second, U third) { setFirst(first); setSecond(second); setThird(third); } /** Gets first field value. * @return Returns the first. */ public S getFirst() { return first; } /** Sets first field value. * @param first The first to set. */ public void setFirst(S first) { this.first = first; } /** Returns second value. * @return Returns the second. */ public T getSecond() { return second; } /** Sets second field. * @param second The second to set. */ public void setSecond(T second) { this.second = second; } /** Returns third value. * @return Returns the third. */ public U getThird() { return third; } /** Sets third field. * @param third The third to set. */ public void setThird(U third) { this.third = third; } } |
From: Michal H. <ms...@us...> - 2005-09-18 19:21:01
|
Update of /cvsroot/exfex/exfex/source/exfex/common/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16568/source/exfex/common/utils Added Files: ICaster.java Log Message: removed to new package common.utils --- NEW FILE: ICaster.java --- /** * $RCSfile: ICaster.java,v $ * * $Log: ICaster.java,v $ * Revision 1.1 2005/09/18 19:20:53 mstsxfx * removed to new package common.utils * * Revision 1.1 2005/09/15 18:11:02 mstsxfx * documentation corrected * som code fixing * */ package exfex.common.utils; /** * ICaster to provide typesafe casting. * * This interface is designed to be basic type for type safe casting object. * Implementators are responsible for type depending way cast from given object, * using method cast, or throw ClassCast exception if givem object is not type * compatible. * <p> * Generic declaration garantees code clearness and type safety. Primary usage * is for Primitives object (those which extends IWindow interface) in case when * we need to acces their low level objects. * * * <pre> * Example: * * class JButtonCaster implenets ICaster<JButton> * { * JButton cast(Object o)throws ClassCastException * { * if(o instanceof JButton) * return (JButton)o; * throw new ClassCastException(new String("Incompatible type")); * } * } * . * . * . * * try * { * JButton button=primitive.getGui(new JButtonCaster()); * } catch (Exception e) * { * // handle exception * } * </pre> * * <pre> * TODO: extend IPlugin interface (make plugin-able) * TODO: insert to CVS * * Changes: * 9.9.2005 msts - created * </pre> * * * @param <T> Generic type of caster. * @see exfex.common.displaysystem.IWindow#getGui * @see ICaster#cast * * @author msts * */ public interface ICaster<T> { /** Cast given object to T type. * @param o Instance to cast. * * @return Cast instance with T type. * * @throws ClassCastException if o is not type compatible with T. */ public T cast(Object o)throws ClassCastException; } |
From: Michal H. <ms...@us...> - 2005-09-18 19:20:52
|
Update of /cvsroot/exfex/exfex/source/exfex/common/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16514/source/exfex/common/utils Log Message: Directory /cvsroot/exfex/exfex/source/exfex/common/utils added to the repository |
From: Michal H. <ms...@us...> - 2005-09-18 19:19:56
|
Update of /cvsroot/exfex/exfex/source/exfex/common/displaysystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16221/source/exfex/common/displaysystem Modified Files: IWindow.java Log Message: import included Index: IWindow.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/displaysystem/IWindow.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IWindow.java 15 Sep 2005 18:11:02 -0000 1.4 --- IWindow.java 18 Sep 2005 19:19:45 -0000 1.5 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.5 2005/09/18 19:19:45 mstsxfx + * import included + * * Revision 1.4 2005/09/15 18:11:02 mstsxfx * documentation corrected *************** *** 21,24 **** --- 24,29 ---- package exfex.common.displaysystem; + import exfex.common.utils.ICaster; + /** Basic interface for window. |
From: Michal H. <ms...@us...> - 2005-09-18 19:18:19
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15903/source/exfex/common/pluginsystem Modified Files: PluginManager.java Log Message: clonable implemented internal state methods - saveState, restoreState loadTest method for load simulation conflict situation fully implemented - ready for testing Index: PluginManager.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/PluginManager.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PluginManager.java 15 Sep 2005 18:11:02 -0000 1.12 --- PluginManager.java 18 Sep 2005 19:18:11 -0000 1.13 *************** *** 6,9 **** --- 6,15 ---- * * $Log$ + * Revision 1.13 2005/09/18 19:18:11 mstsxfx + * clonable implemented + * internal state methods - saveState, restoreState + * loadTest method for load simulation + * conflict situation fully implemented - ready for testing + * * Revision 1.12 2005/09/15 18:11:02 mstsxfx [...994 lines suppressed...] + return new PluginManager((DependencyMap)depMap.clone(), (PluginList)depList.clone(), (PluginList)readyList.clone(), (PluginList)resolvingList.clone(), new String(logName)); + } + + /** Restores actual state of plugin manager. + * + * Get previous values from state object and sets fields to their saved + * values. + * <p> + * Sets new values and old are forgotten. + */ + synchronized protected void restoreState() + { + if(savedState==null) + return; + LogManager.getInstance().getLogger(logName).log(ILogger.Level.DEBUG,"PluginManager.restoreState Restoring from actual state "+this+"\nto old state\n"+savedState); + instance=savedState; + LogManager.getInstance().getLogger(logName).log(ILogger.Level.NOTICE,"Restored to saved state."); + } + } |
From: Michal H. <ms...@us...> - 2005-09-18 19:03:57
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12418/source/exfex/common/pluginsystem Modified Files: PluginList.java Log Message: cloneable implemented new method removeExactPlugin Index: PluginList.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/PluginList.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PluginList.java 15 Sep 2005 18:11:02 -0000 1.7 --- PluginList.java 18 Sep 2005 19:03:50 -0000 1.8 *************** *** 6,9 **** --- 6,13 ---- * * $Log$ + * Revision 1.8 2005/09/18 19:03:50 mstsxfx + * cloneable implemented + * new method removeExactPlugin + * * Revision 1.7 2005/09/15 18:11:02 mstsxfx * documentation corrected *************** *** 43,50 **** * If you need to traverse throught plugins in list, use ListIterator returned * with the listIterator method. ! * * * <pre> * Changes: * 14.8.2005 msts - all public methods are synchronized * 9.8.2005 msts - created --- 47,59 ---- * If you need to traverse throught plugins in list, use ListIterator returned * with the listIterator method. ! * <p> ! * Class is clonebale, so if you need to obtain deep copy of the map, use ! * clone method. * * <pre> + * * Changes: + * 18.9.2005 msts - clonable implementation + * removeExactPlugin method add * 14.8.2005 msts - all public methods are synchronized * 9.8.2005 msts - created *************** *** 53,57 **** * @author msts */ ! public class PluginList { /** List where to store plugins. */ --- 62,66 ---- * @author msts */ ! public class PluginList implements Cloneable { /** List where to store plugins. */ *************** *** 68,88 **** } /** Insert plugin to the list. * ! * Inserts plugin to the end of list. If such plugin already exists ! * in the list, it'll not insert it (uses searchExact). * * @param plugin Plugin to insert. * @return true If succesfully inserted to the list, otherwise false. */ ! synchronized public boolean addPlugin(IPlugin plugin)//{{{ { ! if(searchExact(plugin)!=null) return false; ! ! // no such plugin in list, we can insert it to the list list.add(plugin); return true; }//}}} /** Removes plugin from the list. --- 77,148 ---- } + /** Protected constructor with list initiazator. + * + * Initialize list field to the given one (Uses shallow copy). + * This constructor is for clone purposes and it's protected to prepare + * basic cloning capability for childs. Caller should set parameters to + * cloned versions if needs deep copy. + * + * @param list List of plugins. + */ + protected PluginList(List<IPlugin> list) + { + this.list=list; + } + /** Insert plugin to the list. * ! * Inserts plugin to the end of list. According overwrite value: ! * <ul> ! * <li>false - If such plugin already exists in the list, it'll not ! * insert it (uses searchExact). ! * <li>true - Replace possible occurance of same plugin in the list. ! * </ul> * * @param plugin Plugin to insert. + * @param overwrite Sets overwrite mode. * @return true If succesfully inserted to the list, otherwise false. */ ! synchronized public boolean addPlugin(IPlugin plugin, boolean overwrite)//{{{ { ! if(plugin == null) return false; ! ! // perform check for mode and occurance of plugin in the list ! // search only if overwrite is false ! if(!overwrite) ! { ! // We don't want to overwrite, so if plugin (or ! // isTypeSame plugin is in the list, return false ! if(searchExact(plugin)!=null) ! return false; ! // no such plugin in list, we can insert it to the list ! list.add(plugin); ! return true; ! } ! ! // We want to force insert, which means removal of previous ! // with same type and name ! ! // Try to remove, if not member, ignores ! removePlugin(plugin); ! ! // Insert plugin (it will be unique according type and name list.add(plugin); + return true; }//}}} + + /** Helper add method. + * + * Uses addPlugin method with overwrite set to false. + * + * @param plugin Plugin to insert. + * @return true if plugin has been inserted, false otherwise. + */ + synchronized public boolean addPlugin(IPlugin plugin)//{{{ + { + return addPlugin(plugin,false); + }//}}} /** Removes plugin from the list. *************** *** 96,99 **** --- 156,162 ---- synchronized public boolean removePlugin(IPlugin plugin)//{{{ { + if(plugin==null) + return false; + int index=getIndex(plugin); if(index>=0) *************** *** 118,122 **** { // test is pugins have the same type and name ! if(!isCompatible(original,replace) || ! original.getName().equals(replace.getName())) return false; --- 181,185 ---- { // test is pugins have the same type and name ! if(!areCompatibles(original,replace) || ! original.getName().equals(replace.getName())) return false; *************** *** 183,187 **** * @return list of compatibles plugins or null if no compatible found. */ ! synchronized public List<IPlugin> searchType(Class<? extends IPlugin> plugin)//{{{ { // Null plugin is ignored --- 246,250 ---- * @return list of compatibles plugins or null if no compatible found. */ ! synchronized public List<IPlugin> searchType(Class<?> plugin)//{{{ { // Null plugin is ignored *************** *** 203,206 **** --- 266,300 ---- }//}}} + /** Removes plugin by plugin reference. + * + * Search given plugin the list by reference and if found, removes it + * from the list. This method should be called when we want to remove + * exact plugin (by reference). + * + * @param plugin Plugin to remove. + * @return true if removed, false otherwise. + */ + synchronized public boolean removeExactPlugin(IPlugin plugin)//{{{ + { + if(plugin==null) + return false; + + int index=0; + + // traverse list + for(IPlugin p : list) + { + // If referencies are same, removes p from the list + // using index + if(p==plugin) + { + list.remove(index); + return true; + } + index++; + } + return false; + }//}}} + /** Searches plugin with consideration to the name. * *************** *** 213,216 **** --- 307,313 ---- synchronized public IPlugin searchExact(IPlugin plugin)//{{{ { + if(plugin==null) + return null; + int index=getIndex(plugin); if(index>=0) *************** *** 226,229 **** --- 323,329 ---- * Creates new list (LinkedList), copies all plugins from internal list * and returns it as List. + * <p> + * NOTE: changes made to returned list takes no effect to the internall + * list. * * @return List of all plugins. *************** *** 233,236 **** --- 333,341 ---- return new LinkedList<IPlugin>(list); } + + @Override synchronized public String toString() + { + return new String("Plugin list{"+list.toString()+"}"); + } /** Returns index of plugin in list. *************** *** 255,259 **** for(IPlugin plg : list) { ! if(plg.getName().equals(plugin.getName()) && isCompatible(plugin,plg)) return index; --- 360,364 ---- for(IPlugin plg : list) { ! if(plg.getName().equals(plugin.getName()) && areTypeSame(plugin,plg)) return index; *************** *** 298,304 **** * * Compares if plg2 can stand for plg1. It will return true ! * iff plg2 implements all interfaces which implements plg1. * <br> ! * NOTE: It doesn't have to be reflexive relation. * * @param plg1 Plugin. --- 403,411 ---- * * Compares if plg2 can stand for plg1. It will return true ! * iff plg2 implements at least all interfaces which implements plg1 ! * (plg2 can implement more interfaces). * <br> ! * NOTE: if isCompatible(plg1, plg2) && isCompatible(plg2,plg1) then ! * plg1 is type same as plg2 * * @param plg1 Plugin. *************** *** 306,310 **** * @return true if plg2 is compatible with plg1, otherwise false. */ ! static public boolean isCompatible(IPlugin plg1, IPlugin plg2)//{{{ { // null plugins can't be compatible --- 413,417 ---- * @return true if plg2 is compatible with plg1, otherwise false. */ ! static public boolean areCompatibles(IPlugin plg1, IPlugin plg2)//{{{ { // null plugins can't be compatible *************** *** 312,318 **** --- 419,435 ---- return false; + // If plg1 and plg2 are same referencies, they have to be + // compatible + if(plg1==plg2) + return true; + boolean result=false; Class [] plg2ifaces=plg2.getClass().getInterfaces(); + Class [] plg1ifaces=plg1.getClass().getInterfaces(); + // plg2 must have at least plg1 interfaces + if(plg2ifaces.length < plg1ifaces.length) + return false; + // Compare two arrays. Interfaces may be in different // order, so have to do it such way *************** *** 334,336 **** return result; }//}}} ! } --- 451,480 ---- return result; }//}}} ! ! /** Check if plg1 and plg2 are type same. ! * ! * Uses areCompatibles method to determine if areCompatibles(plg1,plg2) ! * and areCompatibles(plg2,plg1). ! * ! * @param plg1 Plugin. ! * @param plg2 Plugin. ! * @return true if plg1 and plg2 implements same interfaces, false ! * otherwise. ! */ ! static public boolean areTypeSame(IPlugin plg1, IPlugin plg2)//{{{ ! { ! // check for mutual compatibility ! return areCompatibles(plg1,plg2) && areCompatibles(plg2,plg1); ! }//}}} ! ! /** Deep copy maker. ! * ! * Creates new instance of PluginList class with deep copy of it's list. ! * ! * @return New instance of PluginList class. ! */ ! @Override public Object clone() ! { ! return new PluginList(new LinkedList<IPlugin>(this.list)); ! } ! } \ No newline at end of file |
From: Michal H. <ms...@us...> - 2005-09-18 18:59:50
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11260/source/exfex/common/pluginsystem Modified Files: IPluginStrategy.java Log Message: new strategy type ATLEAST Index: IPluginStrategy.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/IPluginStrategy.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IPluginStrategy.java 15 Sep 2005 18:11:02 -0000 1.3 --- IPluginStrategy.java 18 Sep 2005 18:59:43 -0000 1.4 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.4 2005/09/18 18:59:43 mstsxfx + * new strategy type ATLEAST + * * Revision 1.3 2005/09/15 18:11:02 mstsxfx * documentation corrected *************** *** 42,46 **** * </pre> */ ! public static enum Type{FIRST,LAST,NEWEST,NAMEMATCH}; /** Returnes type of the strategy. --- 45,49 ---- * </pre> */ ! public static enum Type{FIRST,LAST,NEWEST,NAMEMATCH,ATLEAST}; /** Returnes type of the strategy. |
From: Michal H. <ms...@us...> - 2005-09-18 18:59:02
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11032/source/exfex/common/pluginsystem Modified Files: IPluginPolicy.java Log Message: documentation to strategies Index: IPluginPolicy.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/IPluginPolicy.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IPluginPolicy.java 15 Sep 2005 18:11:02 -0000 1.3 --- IPluginPolicy.java 18 Sep 2005 18:58:53 -0000 1.4 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.4 2005/09/18 18:58:53 mstsxfx + * documentation to strategies + * * Revision 1.3 2005/09/15 18:11:02 mstsxfx * documentation corrected *************** *** 38,42 **** * Fields: * <ul> ! * <li>strategy - Strategy of selection. This field is primary information. * <li>version - Version of plugin (arbitrary number value - higher number * means newer version). --- 41,45 ---- * Fields: * <ul> ! * <li>strategy - Plugin Strategy of selection. * <li>version - Version of plugin (arbitrary number value - higher number * means newer version). *************** *** 50,53 **** --- 53,57 ---- * </pre> * + * @see exfex.common.pluginsystem.PluginManager#solveConflict(IPlugin, IPlugin) * @see exfex.common.pluginsystem.IPluginStrategy * @author msts *************** *** 67,73 **** * <li>LAST - always decide to accept new one and remove the old one. * <li>NEWEST - consider both version fields and select one with higher ! * version number. ! * <li>NAMEMATCH - doesn't make ANY SENSE to use this strategy. ! * <li>TODO ATLEAST * </ul> */ --- 71,80 ---- * <li>LAST - always decide to accept new one and remove the old one. * <li>NEWEST - consider both version fields and select one with higher ! * version number. If new one doesn't have policy annotation ! * keeps and old one. If versions are same, keeps old one to stay. ! * <li>NAMEMATCH - doesn't make ANY SENSE to use this strategy, becuse ! * both have same names. In this situation, old one should be kept. ! * <li>ATLEAST - new one should be choosed iff newone's version is at ! * least old one version. (Similar as NEWEST except equals means newone) * </ul> */ |
From: Michal H. <ms...@us...> - 2005-09-18 18:55:39
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10321/source/exfex/common/pluginsystem Modified Files: IInject.java Log Message: check sum inserted Index: IInject.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/IInject.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IInject.java 15 Sep 2005 18:11:02 -0000 1.5 --- IInject.java 18 Sep 2005 18:55:30 -0000 1.6 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.6 2005/09/18 18:55:30 mstsxfx + * check sum inserted + * * Revision 1.5 2005/09/15 18:11:02 mstsxfx * documentation corrected *************** *** 33,37 **** * type). This strategy controls which one to choose. * <li>dependencyName - contain required name in case NAMEMATCH strategy. ! * <li>checkSumFile - file name that cotains check sum of the plugin. This is * intended for plugin validation. Validator uses checkSumType to determine * algorithm used to create checksum. --- 36,40 ---- * type). This strategy controls which one to choose. * <li>dependencyName - contain required name in case NAMEMATCH strategy. ! * <li>checkSumFile - file name that contains check sum of the plugin. This is * intended for plugin validation. Validator uses checkSumType to determine * algorithm used to create checksum. *************** *** 70,74 **** * IPluginPolicy annotation version field) * <li>NAMEMATCH - Selects one with the name that match given one. ! * <li>TODO ATLEAST * <ul> */ --- 73,77 ---- * IPluginPolicy annotation version field) * <li>NAMEMATCH - Selects one with the name that match given one. ! * <li>ATLEAST - not implemented yet. * <ul> */ *************** *** 80,84 **** String dependencyName() default ""; ! /** File name, where check sum is stored. */ String checkSumFile() default ""; --- 83,92 ---- String dependencyName() default ""; ! /** File name, where check sum is stored. ! * ! * If this field is not empty string, check sum should be testified. ! * ! * @return String representation of file name. ! */ String checkSumFile() default ""; |