exfex-cvs-commit Mailing List for Extended Form of examination (Page 4)
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-11-01 20:12:45
|
Update of /cvsroot/exfex/exfex/source/exfex/common/remote/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17952/source/exfex/common/remote/pluginsystem Modified Files: IRemotePluginManager.java Log Message: methods signature changed, documentation updated Index: IRemotePluginManager.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/remote/pluginsystem/IRemotePluginManager.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IRemotePluginManager.java 19 Oct 2005 19:24:00 -0000 1.4 --- IRemotePluginManager.java 1 Nov 2005 20:12:37 -0000 1.5 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.5 2005/11/01 20:12:37 mstsxfx + * methods signature changed, documentation updated + * * Revision 1.4 2005/10/19 19:24:00 mstsxfx * readyPlugins and pendingPlugins method return value changed *************** *** 19,22 **** --- 22,26 ---- package exfex.common.remote.pluginsystem; + import java.io.Serializable; import java.rmi.Remote; import java.rmi.RemoteException; *************** *** 34,42 **** /** Plugin manager remote interface. * ! * This interface is inteded for remote (client) use. Each method has * {@link exfex.common.remote.security.IRemoteIdentity} parameter to be able to ! * check caller permisions to the operation. Just administrator of the system ! * should be enabled to use these methods. If caller (defined by its id) is ! * not allowed to perform operation PluginSecurityException is thrown. * <br> * Extends IRemoteFileTransfer interface to enable clients uploading of plugins. --- 38,84 ---- /** Plugin manager remote interface. * ! * This interface is intended for remote (client) use. Each method has * {@link exfex.common.remote.security.IRemoteIdentity} parameter to be able to ! * check caller permisions to the operation. Each method has described ! * capability needed to identity be authorized for operation. See implementator ! * documentation for what has to be fulfilled to have such capabilities. ! * <br> ! * Instance of this type should be registered to the naming service to be ! * accessible from remote side. ! * <pre> ! * // Exampe of registering remote plugin manager view to the Naming service ! * ! * // After some plugin with IRemotePluginManagerFactory is load, we can get ! * // this type instance (lets assume that plugin has RemoteView name) ! * IRemotePluginManagerFactory plugin=(IRemotePluginManagerFactory) ! * PluginManager.getByName( ! * IRemotePluginManagerFactory.class, ! * "RemoteView" ! * ); ! * IRemotePluginManager remoteView=plugin.remoteView(); ! * ! * // now we have instance of remote view to the PluginManager, so we can ! * // register it to the Naming service (used by RMI mechanism). ! * // After registration, remote view can be accessible throught RMI on ! * // localhost (standard RMI port 1099) as PluginSystem service ! * // Note that naming service need RMI registry to run. ! * // We are using rebind, because we want replace previous registration ! * ! * Naming.rebind("rmi://localhost/PluginSystem",remoteView); ! * ! * ! * // Client usage example ! * // User wants to get remote view to the PluginManager ! * ! * // Gets service from serveraddr with PluginSystem name using Naming ! * IRemotePluginManager plgSys=(IRemotePluginManager) ! * Naming.lookup( ! * serveraddr, ! * "PluginSystem" ! * ); ! * ! * // Now you can use all methods and use return values as described in this ! * // interface documentation ! * </pre> * <br> * Extends IRemoteFileTransfer interface to enable clients uploading of plugins. *************** *** 52,64 **** * </pre> * * @author msts */ ! public interface IRemotePluginManager extends Remote, IRemoteFileTransfer { ! /** Returns all registered (ready to use) plugins. * * Changes to this list takes no effect to the manager's list. * * @param id Identity of the caller caller. * @return Array of ready plugins types and names pairs. * @throws RemoteException If problem during RMI call occures. --- 94,120 ---- * </pre> * + * @see SecurityManager * @author msts */ ! public interface IRemotePluginManager extends Remote, IRemoteFileTransfer, Serializable { ! /** Returns all registered (ready to use) plugin type and name pairs ! * compatieble with typeMask. * + * Ask for PluginManager readyList (list of all registered plugins) and + * uses typeMask as filter - all returned plugins are compatible with + * given type. If <code>IPlugin.class</code> is given, then all ready + * plugins are returned. <code>null</code> parameter is treated same as + * <code>IPlugin.class</code>. To avoid misusing of plugins, just type + * and name are returned. + * <br> * Changes to this list takes no effect to the manager's list. + * <p> + * <b>Security restrictions</b>: Just identities with + * <code>PLUGIN_VIEWER</code> should be granted to use this method and + * all others should be denied (exception PluginSecurityException called) * * @param id Identity of the caller caller. + * @param typeMask Type compatibility restriction. * @return Array of ready plugins types and names pairs. * @throws RemoteException If problem during RMI call occures. *************** *** 66,77 **** * operation. */ ! public Pair<Class<? extends IPlugin>, String>[] readyPlugins(IRemoteIdentity id) throws RemoteException, PluginSecurityException; ! /** Returns all plugins waiting for dependencies. ! * * Returns copy of plugins names waiting in depList. * * @param id Identity of the caller. * @return Array of plugins types and names pairs. * @throws RemoteException If problem during RMI call occures. --- 122,148 ---- * operation. */ ! public Pair<Class<? extends IPlugin>, String>[] readyPlugins(IRemoteIdentity id, Class<?> typeMask) throws RemoteException, PluginSecurityException; ! /** Returns all plugin type and name pairs waiting for dependencies with ! * typeMask type criteria. ! * ! * Ask for PluginManager depList (list of all pending - waiting for ! * resolving or dependencies - plugins) and uses typeMask as filter - ! * all returned plugins are compatible with given type. If ! * <code>IPlugin.class</code> is given, then all ready plugins are ! * returned. <code>null</code> parameter is treated same as ! * <code>IPlugin.class</code>. To avoid misusing of plugins, just type ! * and name are returned. ! * <br> * Returns copy of plugins names waiting in depList. + * <p> + * <b>Security restrictions</b>: Just identities with + * <code>PLUGIN_VIEWER</code> capability should be granted to use this + * method and all others should be denied (exception + * PluginSecurityException called) * * @param id Identity of the caller. + * @param typeMask Type compatibility restriction. * @return Array of plugins types and names pairs. * @throws RemoteException If problem during RMI call occures. *************** *** 79,83 **** * operation. */ ! public Pair<Class<? extends IPlugin>, String>[] pendingPlugins(IRemoteIdentity id) throws RemoteException, PluginSecurityException; --- 150,154 ---- * operation. */ ! public Pair<Class<? extends IPlugin>, String>[] pendingPlugins(IRemoteIdentity id, Class<?> typeMask) throws RemoteException, PluginSecurityException; *************** *** 87,93 **** * should be just security wraper for * {@link exfex.common.pluginsystem.IAcceptPlugin#getByIface(Class)} ! * method and performs id authorization checks. Security mechanism ! * should guarantee that only remote services should be returned ! * (those which extends Remote interface). * @param id Identity of the caller. * @param plgType Type of the plugin. --- 158,170 ---- * should be just security wraper for * {@link exfex.common.pluginsystem.IAcceptPlugin#getByIface(Class)} ! * method and performs id authorization checks. ! * <p> ! * <b>Security restrictions</b>: Just identities with ! * <code>PLUGIN_MANIPULATOR</code> capability should be granted to use ! * this method and all others should be denied (exception ! * PluginSecurityException called). Security mechanism should also ! * guarantee that only plugins implementing IRemote interface should be ! * returned. ! * * @param id Identity of the caller. * @param plgType Type of the plugin. *************** *** 107,113 **** * should be just security wraper for * {@link exfex.common.pluginsystem.IAcceptPlugin#getByName(Class, String)} ! * method and performs id authorization checks. Security mechanism ! * should guarantee that only remote servic should be returned ! * (those which extends Remote interface). * @param id Identity of the caller. * @param plgType Type of the plugin. --- 184,196 ---- * should be just security wraper for * {@link exfex.common.pluginsystem.IAcceptPlugin#getByName(Class, String)} ! * method and performs id authorization checks. ! * <p> ! * <b>Security restrictions</b>: Just identities with ! * <code>PLUGIN_MANIPULATOR</code> capability should be granted to use ! * this method and all others should be denied (exception ! * PluginSecurityException called). Security mechanism should also ! * guarantee that only plugin implementing IRemote interface should be ! * returned. ! * * @param id Identity of the caller. * @param plgType Type of the plugin. *************** *** 128,132 **** * Method will process names from given array until fetch fail or * all names are processed. All successfuly fetched plugins are inserted ! * to the scheduled. * * @param id Identity of the caller. --- 211,220 ---- * Method will process names from given array until fetch fail or * all names are processed. All successfuly fetched plugins are inserted ! * to the scheduled. ! * <p> ! * <b>Security restrictions</b>: Just identities with ! * <code>PLUGIN_ADMIN</code> capability should be granted to use this ! * method and all others should be denied (exception ! * PluginSecurityException called) * * @param id Identity of the caller. *************** *** 161,168 **** * Try to load maximum from scheduled plugins. Some of them * may fail because of unsufficient dependencies. If you want to ! * schedule plugin for loaduse schedule method. If any problems because ! * of dependencies or conflicts occures, implementator is responsible ! * for restoring its last consistent state. ! * * @see PluginManager#solveDependencies * @param id Identity of the caller. --- 249,261 ---- * Try to load maximum from scheduled plugins. Some of them * may fail because of unsufficient dependencies. If you want to ! * schedule plugin for load use <code>schedule</code> method. If any ! * problems because of dependencies or conflicts occures, implementator ! * is responsible for restoring its last consistent state. ! * <p> ! * <b>Security restrictions</b>: Just identities with ! * <code>PLUGIN_ADMIN</code> capability should be granted to use this ! * method and all others should be denied (exception ! * PluginSecurityException called) ! * * @see PluginManager#solveDependencies * @param id Identity of the caller. *************** *** 180,184 **** * * Unregister plugin with given type and name from system. ! * * @param id Identity of the caller. * @param type Type of the plugin. --- 273,282 ---- * * Unregister plugin with given type and name from system. ! * <p> ! * <b>Security restrictions</b>: Just identities with ! * <code>PLUGIN_ADMIN</code> capability should be granted to use this ! * method and all others should be denied (exception ! * PluginSecurityException called) ! * * @param id Identity of the caller. * @param type Type of the plugin. |
From: Michal H. <ms...@us...> - 2005-11-01 20:11:08
|
Update of /cvsroot/exfex/exfex/source/exfex/common/remote/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17573/source/exfex/common/remote/pluginsystem Modified Files: IRemotePluginManagerFactory.java Log Message: plugin implements IRemote doc updated Index: IRemotePluginManagerFactory.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/remote/pluginsystem/IRemotePluginManagerFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IRemotePluginManagerFactory.java 18 Oct 2005 17:48:10 -0000 1.1 --- IRemotePluginManagerFactory.java 1 Nov 2005 20:10:59 -0000 1.2 *************** *** 3,6 **** --- 3,10 ---- * * $Log$ + * Revision 1.2 2005/11/01 20:10:59 mstsxfx + * plugin implements IRemote + * doc updated + * * Revision 1.1 2005/10/18 17:48:10 mstsxfx * remote plugin manager view plugin interface *************** *** 10,13 **** --- 14,18 ---- import exfex.common.pluginsystem.IPlugin; + import exfex.common.remote.IRemote; /** Interface for plugins factories for remote PluginManager view. *************** *** 15,29 **** * Plugins produce IRemotePluginManager instances used for remote view to the * local PluginManager instance. Created (by get {@link #remoteView()} method) ! * instance (remote objects) should perform security and authorization checking. ! * <br> ! * This plugin is local (not intended for remote invocation). Remote view ! * (produced by plugin) has to be registered to the Naming service to be ! * accessible as remote (RMI) service. This can be done automaticaly in ! * <code>regiterMe</code> method, but it's not very recomended, because it can ! * lead to service name clashing (Read documentation of plugin for details of ! * concrete using and registration process). * <br> * It's strongly recomeneded, that this factory would return always the same * instance (maintained object of this plugin follows singleton pattern). * * @see exfex.common.remote.pluginsystem.IRemotePluginManager --- 20,33 ---- * Plugins produce IRemotePluginManager instances used for remote view to the * local PluginManager instance. Created (by get {@link #remoteView()} method) ! * instance (remote object) should perform security and authorization checking. * <br> * It's strongly recomeneded, that this factory would return always the same * instance (maintained object of this plugin follows singleton pattern). + * <br> + * It implements IRemote interface so it can be returned to the remote side. + * Make sure that plugin instance doesn't keep reference to any local objects + * (PluginManager e.g.) to avoid problems described in + * {@link exfex.common.pluginsystem.IPlugin} documentation section Plugin + * writing rules and remote using. * * @see exfex.common.remote.pluginsystem.IRemotePluginManager *************** *** 35,39 **** * @author msts */ ! public interface IRemotePluginManagerFactory extends IPlugin { /** Returns instance of remote view to the PluginManager. --- 39,43 ---- * @author msts */ ! public interface IRemotePluginManagerFactory extends IPlugin, IRemote { /** Returns instance of remote view to the PluginManager. |
From: Michal H. <ms...@us...> - 2005-11-01 20:09:59
|
Update of /cvsroot/exfex/exfex/source/exfex/common/remote/security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17036/source/exfex/common/remote/security Modified Files: IRemoteIdentity.java Log Message: serializable added Index: IRemoteIdentity.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/remote/security/IRemoteIdentity.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IRemoteIdentity.java 14 Oct 2005 17:35:17 -0000 1.1 --- IRemoteIdentity.java 1 Nov 2005 20:09:50 -0000 1.2 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.2 2005/11/01 20:09:50 mstsxfx + * serializable added + * * Revision 1.1 2005/10/14 17:35:17 mstsxfx * remote identity interface *************** *** 9,25 **** package exfex.common.remote.security; import java.rmi.Remote; import java.rmi.RemoteException; /** Identity interface for remote use. ! * This interface is inteted to be remote part of user identity used for ! * security managing in the system. It just can tell information about user Id ! * and checkSum (used to verify correctness of whole identity). * Generating of Id and checkSum is opaque for clients and identities generated ! * be them should be recognized and marked as non valid. * <br> ! * Clients obtain and uses instance (better said remote reference) of this type * to give information about themselfs when using server services. Server will ! * check identity and determine if such identity has permissions for desired * action on service. * --- 12,32 ---- package exfex.common.remote.security; + import java.io.Serializable; import java.rmi.Remote; import java.rmi.RemoteException; /** Identity interface for remote use. ! * This interface is intended to be remote part of user identity used for ! * security managing in the system. It can tell just information about identity ! * Id and checkSum (used to verify correctness of whole identity). * Generating of Id and checkSum is opaque for clients and identities generated ! * be them should be recognized and marked as non valid. This is basic concept ! * of security management. Algorithm of checkSum can be known to public but ! * it has to be secure inspite of that (it can use some only server known ! * information e.g.). * <br> ! * Clients obtain and uses instance (better said remote reference) of identity * to give information about themselfs when using server services. Server will ! * check identity and determine if such identity is authorized for desired * action on service. * *************** *** 29,40 **** * </pre> * ! * @see exfex.common.security.IIdentity For more information. * @author msts */ ! public interface IRemoteIdentity extends Remote { /** Returns identificator of the identity. * ! * @see exfex.common.security.IIdentity For more information. * * @return Identity identificator. --- 36,47 ---- * </pre> * ! * @see exfex.common.security.Identity For more information. * @author msts */ ! public interface IRemoteIdentity extends Remote, Serializable { /** Returns identificator of the identity. * ! * @see exfex.common.security.Identity For more information. * * @return Identity identificator. *************** *** 48,52 **** * so this should avoid identity hacking. * ! * @see exfex.common.security.IIdentity For more information. * @return Checksum of the identity as byte array. * @throws RemoteException --- 55,59 ---- * so this should avoid identity hacking. * ! * @see exfex.common.security.Identity For more information. * @return Checksum of the identity as byte array. * @throws RemoteException |
From: Michal H. <ms...@us...> - 2005-11-01 20:08:53
|
Update of /cvsroot/exfex/exfex/source/exfex/common/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16752/source/exfex/common/remote Added Files: IRemote.java Log Message: marker for plugins which can be returned to remote clients --- NEW FILE: IRemote.java --- /* * $RCSfile: IRemote.java,v $ * * $Log: IRemote.java,v $ * Revision 1.1 2005/11/01 20:08:45 mstsxfx * marker for plugins which can be returned to remote clients * */ package exfex.common.remote; import java.io.Serializable; /** Interface marker that implementator can be returned to the remote client. * * This interface doesn't declare any methods and should be used in type * definition which can be returned to remote client using RMI mechanism. * It doesn't extend Remote interface because it is not intended to be remote * serverice interface. Classes that wants to be used as such services, has to * implement Remote interface. This is just for convenience where checking * has to be performed what should be returned and what shouldn't. * Only interface which is extended is Serializable, because such plugins can * be returned using RMI and so they has to be serializable. * <br> * Typical usage can be seen in <ceode>IRemotePluginManager.getByIface</code> * method, which returns just plugins which implements at least this interface. * Such plugins creates remote instances or are remote instances itself and so * it is good to return them. Client shouldn't be able to get arbitrary plugin * from manager, because this could be misused. * * <p> * <pre> * Changes: * 19.10.2005 msts - created * </pre> * * @author msts */ public interface IRemote extends Serializable { } |
From: Michal H. <ms...@us...> - 2005-10-19 19:29:06
|
Update of /cvsroot/exfex/exfex/source/exfex/common/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3455/source/exfex/common/utils Modified Files: State.java Log Message: implements Serializable Index: State.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/utils/State.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** State.java 18 Oct 2005 17:45:56 -0000 1.4 --- State.java 19 Oct 2005 19:28:52 -0000 1.5 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.5 2005/10/19 19:28:52 mstsxfx + * implements Serializable + * * Revision 1.4 2005/10/18 17:45:56 mstsxfx * doc update *************** *** 19,22 **** --- 22,27 ---- package exfex.common.utils; + import java.io.Serializable; + /** State keeper generic class. * *************** *** 35,40 **** * @author msts */ ! public class State<T extends CloneAble> { /** State of the state object.*/ private T state=null; --- 40,46 ---- * @author msts */ ! public class State<T extends CloneAble> implements Serializable { + private static final long serialVersionUID = 1L; /** State of the state object.*/ private T state=null; |
From: Michal H. <ms...@us...> - 2005-10-19 19:27:35
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3026/source/exfex/common/pluginsystem Modified Files: PluginManager.java Log Message: getPlugin method added Index: PluginManager.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/PluginManager.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** PluginManager.java 18 Oct 2005 17:53:23 -0000 1.21 --- PluginManager.java 19 Oct 2005 19:27:26 -0000 1.22 *************** *** 6,9 **** --- 6,12 ---- * * $Log$ + * Revision 1.22 2005/10/19 19:27:26 mstsxfx + * getPlugin method added + * * Revision 1.21 2005/10/18 17:53:23 mstsxfx * logs added *************** *** 444,447 **** --- 447,479 ---- //================ + /** Returnes plugin by type and name. + * Searches readyList and depList (in this order) and returns first + * found returns. Type has to be same (using + * {@link PluginComparator#areIfaceSame(Class, Class)} method). + * + * @param type Plugin type. + * @param name Plugin name. + * @return Plugin instance. + * @throws PluginException if such plugin is not found. + */ + public IPlugin getPlugin(Class<? extends IPlugin> type, String name) + throws PluginException + { + IPlugin plugin=null; + + // at first starts with readyList + // if not found, search in depList, if also not found, throws + // the exception + plugin=readyList.searchExact(type,name); + if(plugin==null) + { + plugin=depList.searchExact(type,name); + if(plugin==null) + throw new PluginException("Plugin with type="+type+" and name=\""+name+"\" not found."); + } + + return plugin; + } + /** Schedules plugin for loading. * |
From: Michal H. <ms...@us...> - 2005-10-19 19:26:48
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2809/source/exfex/common/pluginsystem Modified Files: PluginList.java Log Message: code cleanup Index: PluginList.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/PluginList.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PluginList.java 19 Oct 2005 18:25:52 -0000 1.14 --- PluginList.java 19 Oct 2005 19:26:39 -0000 1.15 *************** *** 6,9 **** --- 6,12 ---- * * $Log$ + * Revision 1.15 2005/10/19 19:26:39 mstsxfx + * code cleanup + * * Revision 1.14 2005/10/19 18:25:52 mstsxfx * searchExact with type and name parameters added *************** *** 50,54 **** import java.io.Serializable; - import java.util.Comparator; import java.util.LinkedList; import java.util.List; --- 53,56 ---- |
From: Michal H. <ms...@us...> - 2005-10-19 19:25:46
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2620/source/exfex/common/pluginsystem Modified Files: DependencyMap.java Log Message: code cleanup Index: DependencyMap.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/DependencyMap.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** DependencyMap.java 17 Oct 2005 18:31:38 -0000 1.15 --- DependencyMap.java 19 Oct 2005 19:25:37 -0000 1.16 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.16 2005/10/19 19:25:37 mstsxfx + * code cleanup + * * Revision 1.15 2005/10/17 18:31:38 mstsxfx * Hashtable replaced by HashMap + code changes *************** *** 42,46 **** import java.io.Serializable; import java.util.HashMap; - import java.util.Hashtable; import java.util.LinkedList; import java.util.List; --- 45,48 ---- |
From: Michal H. <ms...@us...> - 2005-10-19 19:24:55
|
Update of /cvsroot/exfex/exfex/source/exfex/common/plugins/remote/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2355/source/exfex/common/plugins/remote/pluginsystem Modified Files: BasicRemotePluginManager.java Log Message: synch with interface changes getByName and getByIface returns just Remote plugins Index: BasicRemotePluginManager.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/plugins/remote/pluginsystem/BasicRemotePluginManager.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BasicRemotePluginManager.java 18 Oct 2005 17:54:41 -0000 1.1 --- BasicRemotePluginManager.java 19 Oct 2005 19:24:47 -0000 1.2 *************** *** 3,6 **** --- 3,10 ---- * * $Log$ + * Revision 1.2 2005/10/19 19:24:47 mstsxfx + * synch with interface changes + * getByName and getByIface returns just Remote plugins + * * Revision 1.1 2005/10/18 17:54:41 mstsxfx * plugin for remote view of plugin manager + helper class *************** *** 14,17 **** --- 18,22 ---- import java.io.File; import java.io.IOException; + import java.rmi.Remote; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; *************** *** 19,22 **** --- 24,28 ---- import exfex.common.pluginsystem.IPlugin; + import exfex.common.pluginsystem.PluginComparator; import exfex.common.pluginsystem.PluginException; import exfex.common.pluginsystem.PluginLoadException; *************** *** 25,28 **** --- 31,35 ---- import exfex.common.remote.pluginsystem.IRemotePluginManager; import exfex.common.remote.security.IRemoteIdentity; + import exfex.common.utils.Pair; /** Remote view of the PluginManager. *************** *** 88,128 **** /** Returns all registered (ready to use) plugins. * ! * TODO id and security layer. * * Calls {@link exfex.common.pluginsystem.PluginManager#readyPlugins()} ! * method after security checks. * <br> * Changes to this list takes no effect to the manager's list. * * @param id Identity of the caller caller. ! * @return List of ready plugins. * @throws RemoteException If problem during RMI call occures. * @throws PluginSecurityException if unauthorized id requieres this * operation. */ ! synchronized public List<IPlugin> readyPlugins(IRemoteIdentity id) throws RemoteException,PluginSecurityException//{{{ { // FIXME id integrity and authorization check ! return manager.readyPlugins(); }//}}} /** Returns all plugins waiting for dependencies. * ! * TODO id and security layer. ! * Returns copy of depList (list of schedulled plugins). Changes to this ! * list takes no effect to manager's list. * * @param id Identity of the caller. ! * @return List of not registered plugins. * @throws RemoteException If problem during RMI call occures. * @throws PluginSecurityException if unauthorized id requieres this * operation. */ ! synchronized public List<IPlugin> pendingPlugins(IRemoteIdentity id) throws RemoteException,PluginSecurityException//{{{ { // FIXME id integrity and authorization check ! return manager.pendingPlugins(); }//}}} --- 95,157 ---- /** Returns all registered (ready to use) plugins. * ! * TODO id and security layer.(each valid id can ask for this) * * Calls {@link exfex.common.pluginsystem.PluginManager#readyPlugins()} ! * method after security checks and uses plugins to create plugins type ! * name pairs array. * <br> * Changes to this list takes no effect to the manager's list. * * @param id Identity of the caller caller. ! * @return List of ready plugins names. * @throws RemoteException If problem during RMI call occures. * @throws PluginSecurityException if unauthorized id requieres this * operation. */ ! synchronized public Pair<Class<? extends IPlugin>, String>[] readyPlugins(IRemoteIdentity id) throws RemoteException,PluginSecurityException//{{{ { // FIXME id integrity and authorization check ! ! // copies names of plugins ! List<IPlugin> plugins=manager.readyPlugins(); ! // FIXME why cannot Use generict after new ! Pair<Class<? extends IPlugin>, String> names[]=new Pair[plugins.size()]; ! ! int i=0; ! for(IPlugin p: plugins) ! names[i++]=new Pair<Class<? extends IPlugin>, String> ! (p.getClass(),new String(p.getName())); ! ! return names; }//}}} /** Returns all plugins waiting for dependencies. * ! * TODO id and security layer (each valid id can ask for this). ! * ! * Returns plugins name, type pairs which are waiting in depList. * * @param id Identity of the caller. ! * @return Array of plugin type and name pairs. * @throws RemoteException If problem during RMI call occures. * @throws PluginSecurityException if unauthorized id requieres this * operation. */ ! synchronized public Pair<Class<? extends IPlugin>, String>[] pendingPlugins(IRemoteIdentity id) throws RemoteException,PluginSecurityException//{{{ { // FIXME id integrity and authorization check ! List<IPlugin> plugins=manager.pendingPlugins(); ! ! // FIXME why cannot Use generict after new ! Pair<Class<? extends IPlugin>, String> names[]=new Pair[plugins.size()]; ! ! int i=0; ! for(IPlugin p: plugins) ! names[i++]=new Pair<Class<? extends IPlugin>, String> ! (p.getClass(),new String(p.getName())); ! ! return names; }//}}} *************** *** 213,221 **** * TODO id and security layer. * ! * Delegates all work to the {@link PluginManager#remove(IPlugin)} * method. * * @param id Identity of the caller. ! * @param plugin Plugin to remove. * @throws PluginException If plugin error occures (see getMessage for * more info) --- 242,252 ---- * TODO id and security layer. * ! * Gets plugin with given type and name (using {@link} ) and ! * delegates all work to the {@link PluginManager#remove(IPlugin)} * method. * * @param id Identity of the caller. ! * @param type Plugin type. ! * @param name Plugin name. * @throws PluginException If plugin error occures (see getMessage for * more info) *************** *** 224,234 **** * @throws RemoteException if RMI error occures during operation. */ ! public synchronized void purge(IRemoteIdentity id, IPlugin plugin) throws PluginException, PluginSecurityException, RemoteException//{{{ { // FIXME id check manager.remove(plugin); - }//}}} --- 255,267 ---- * @throws RemoteException if RMI error occures during operation. */ ! public synchronized void purge( IRemoteIdentity id, ! Class<? extends IPlugin> type, ! String name) throws PluginException, PluginSecurityException, RemoteException//{{{ { // FIXME id check + IPlugin plugin=manager.getPlugin(type, name); manager.remove(plugin); }//}}} *************** *** 242,246 **** * Delegates all work to the * {@link exfex.common.pluginsystem.IAcceptPlugin#getByIface(Class)} ! * method. * * @param id Identity of the caller. --- 275,279 ---- * Delegates all work to the * {@link exfex.common.pluginsystem.IAcceptPlugin#getByIface(Class)} ! * method. Only plugins implementing Remote interface are returned. * * @param id Identity of the caller. *************** *** 256,260 **** { // FIXME security ! return manager.getByIface(plgType).toList(); } --- 289,294 ---- { // FIXME security ! if(!PluginComparator.isCompatible(Remote.class,plgType)) ! throw new PluginException(new String("Given plugin Type="+plgType)+" is not remote"); return manager.getByIface(plgType).toList(); } *************** *** 269,273 **** * Delegates all work to the * {@link exfex.common.pluginsystem.IAcceptPlugin#getByName(Class, String)} ! * method. * * @param id Identity of the caller. --- 303,307 ---- * Delegates all work to the * {@link exfex.common.pluginsystem.IAcceptPlugin#getByName(Class, String)} ! * method. Only plugins implementing Remote interface are returned. * * @param id Identity of the caller. *************** *** 283,287 **** { // FIXME security ! return manager.getByName(plgType, name); } --- 317,322 ---- { // FIXME security ! if(!PluginComparator.isCompatible(Remote.class,plgType)) ! throw new PluginException(new String("Given plugin Type="+plgType)+" is not remote"); return manager.getByName(plgType, name); } |
From: Michal H. <ms...@us...> - 2005-10-19 19:24:13
|
Update of /cvsroot/exfex/exfex/source/exfex/common/remote/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2100/source/exfex/common/remote/pluginsystem Modified Files: IRemotePluginManager.java Log Message: readyPlugins and pendingPlugins method return value changed putge signature changed - plugin type replaced by type and name parameters Index: IRemotePluginManager.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/remote/pluginsystem/IRemotePluginManager.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IRemotePluginManager.java 17 Oct 2005 19:54:31 -0000 1.3 --- IRemotePluginManager.java 19 Oct 2005 19:24:00 -0000 1.4 *************** *** 3,6 **** --- 3,10 ---- * * $Log$ + * Revision 1.4 2005/10/19 19:24:00 mstsxfx + * readyPlugins and pendingPlugins method return value changed + * putge signature changed - plugin type replaced by type and name parameters + * * Revision 1.3 2005/10/17 19:54:31 mstsxfx * local PluginManager view separated from remote view *************** *** 26,29 **** --- 30,34 ---- import exfex.common.remote.security.IRemoteIdentity; import exfex.common.remote.utils.IRemoteFileTransfer; + import exfex.common.utils.Pair; /** Plugin manager remote interface. *************** *** 56,79 **** * * @param id Identity of the caller caller. ! * @return List of ready plugins. * @throws RemoteException If problem during RMI call occures. * @throws PluginSecurityException if unauthorized id requieres this * operation. */ ! public List<IPlugin> readyPlugins(IRemoteIdentity id) throws RemoteException, PluginSecurityException; /** Returns all plugins waiting for dependencies. * ! * Returns copy of depList. Changes to this list takes no effect to ! * manager's list. * * @param id Identity of the caller. ! * @return List of not registered plugins. * @throws RemoteException If problem during RMI call occures. * @throws PluginSecurityException if unauthorized id requieres this * operation. */ ! public List<IPlugin> pendingPlugins(IRemoteIdentity id) throws RemoteException, PluginSecurityException; --- 61,83 ---- * * @param id Identity of the caller caller. ! * @return Array of ready plugins types and names pairs. * @throws RemoteException If problem during RMI call occures. * @throws PluginSecurityException if unauthorized id requieres this * operation. */ ! public Pair<Class<? extends IPlugin>, String>[] readyPlugins(IRemoteIdentity id) throws RemoteException, PluginSecurityException; /** Returns all plugins waiting for dependencies. * ! * Returns copy of plugins names waiting in depList. * * @param id Identity of the caller. ! * @return Array of plugins types and names pairs. * @throws RemoteException If problem during RMI call occures. * @throws PluginSecurityException if unauthorized id requieres this * operation. */ ! public Pair<Class<? extends IPlugin>, String>[] pendingPlugins(IRemoteIdentity id) throws RemoteException, PluginSecurityException; *************** *** 175,182 **** /** Get plugin out of the system. * ! * Unregister plugin from system. * * @param id Identity of the caller. ! * @param plugin Plugin to remove. * @throws PluginException If plugin error occures (see getMessage for * more info) --- 179,187 ---- /** Get plugin out of the system. * ! * Unregister plugin with given type and name from system. * * @param id Identity of the caller. ! * @param type Type of the plugin. ! * @param name Name of the plugin. * @throws PluginException If plugin error occures (see getMessage for * more info) *************** *** 185,189 **** * @throws RemoteException if RMI error occures during operation. */ ! public void purge(IRemoteIdentity id, IPlugin plugin) throws PluginException, PluginSecurityException, RemoteException; } --- 190,194 ---- * @throws RemoteException if RMI error occures during operation. */ ! public void purge(IRemoteIdentity id, Class<? extends IPlugin> type, String name) throws PluginException, PluginSecurityException, RemoteException; } |
From: Michal H. <ms...@us...> - 2005-10-19 19:04:38
|
Update of /cvsroot/exfex/exfex/source/exfex/common/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29728/source/exfex/common/utils Removed Files: JButtonCaster.java ICaster.java Log Message: removed from CVS --- ICaster.java DELETED --- --- JButtonCaster.java DELETED --- |
From: Michal H. <ms...@us...> - 2005-10-19 19:03:57
|
Update of /cvsroot/exfex/exfex/source/exfex/common/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29516/source/exfex/common/utils Modified Files: Pair.java Triplet.java Log Message: implements Serializable Index: Pair.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/utils/Pair.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Pair.java 29 Sep 2005 17:54:30 -0000 1.2 --- Pair.java 19 Oct 2005 19:03:49 -0000 1.3 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.3 2005/10/19 19:03:49 mstsxfx + * implements Serializable + * * Revision 1.2 2005/09/29 17:54:30 mstsxfx * equals and hashCode implemented *************** *** 12,15 **** --- 15,20 ---- package exfex.common.utils; + import java.io.Serializable; + /** Generic pair class. * *************** *** 25,32 **** * @param <S> Type of first field. * @param <T> Type of second field. ! * @author cz2p10d4 */ ! public class Pair<S, T> { /** First data field. */ private S first; --- 30,39 ---- * @param <S> Type of first field. * @param <T> Type of second field. ! * @author msts */ ! public class Pair<S, T> implements Serializable { + private static final long serialVersionUID = 1L; + /** First data field. */ private S first; Index: Triplet.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/utils/Triplet.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Triplet.java 28 Sep 2005 19:21:01 -0000 1.2 --- Triplet.java 19 Oct 2005 19:03:49 -0000 1.3 *************** *** 1,4 **** --- 1,6 ---- package exfex.common.utils; + import java.io.Serializable; + /** Generic triplet class. * *************** *** 24,29 **** * @author msts */ ! public class Triplet<S,T,U> { /** * First value of the triple with generic S type. --- 26,32 ---- * @author msts */ ! public class Triplet<S,T,U> implements Serializable { + private static final long serialVersionUID = 1L; /** * First value of the triple with generic S type. |
From: Michal H. <ms...@us...> - 2005-10-19 18:26:27
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20596/source/exfex/common/pluginsystem Modified Files: PluginList.java Log Message: searchExact with type and name parameters added Index: PluginList.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/PluginList.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PluginList.java 17 Oct 2005 18:39:01 -0000 1.13 --- PluginList.java 19 Oct 2005 18:25:52 -0000 1.14 *************** *** 6,9 **** --- 6,12 ---- * * $Log$ + * Revision 1.14 2005/10/19 18:25:52 mstsxfx + * searchExact with type and name parameters added + * * Revision 1.13 2005/10/17 18:39:01 mstsxfx * implements Serializable *************** *** 47,50 **** --- 50,54 ---- import java.io.Serializable; + import java.util.Comparator; import java.util.LinkedList; import java.util.List; *************** *** 371,377 **** }//}}} ! /** Searches plugin with consideration to the type and name. * ! * Uses getIndex method to find plugin. This is just wraper. * * @param plugin Plugin to search. --- 375,382 ---- }//}}} ! /** Searches plugin with consideration to the type and name of given ! * plugin. * ! * Uses {@link #searchExact(Class, String)} method. * * @param plugin Plugin to search. *************** *** 384,395 **** return null; ! int index=getIndex(plugin); ! if(index>=0) { ! IPlugin result=list.get(index); ! return result; } return null; ! }//}}} /** Makes copy of the list and returns as List object. --- 389,419 ---- return null; ! return searchExact(plugin.getClass(), plugin.getName()); ! }//}}} ! ! /** Searches plugin with given type and name. ! * ! * @param type Plugin type. ! * @param name Plugin name. ! * @return Plugin instance if found or null otherwise. ! */ ! synchronized public IPlugin searchExact(Class<? extends IPlugin> type, String name) ! { ! if(type==null || name==null) ! return null; ! ! // searches list ! for(IPlugin p : list) { ! // chesks name first for optimization (comparing type is ! // much harder ! if( p.getName().equals(name) && ! PluginComparator.areIfaceSame(p.getClass(),type) ! ) ! return p; } + return null; ! } /** Makes copy of the list and returns as List object. |
From: Michal H. <ms...@us...> - 2005-10-19 17:38:40
|
Update of /cvsroot/exfex/exfex/source/exfex/common/remote/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9457/source/exfex/common/remote/pluginsystem Removed Files: RemotePluginManager.java Log Message: moved to exfex.common.plugins.remote.pluginsystem package --- RemotePluginManager.java DELETED --- |
From: Michal H. <ms...@us...> - 2005-10-19 17:37:47
|
Update of /cvsroot/exfex/exfex/source/exfex/common/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9331/source/exfex/common/plugins Removed Files: BasicSessionFactory.java DisplayManager.java SessionManager.java Log Message: moved to exfex.common.plugins.displaysystem package --- DisplayManager.java DELETED --- --- BasicSessionFactory.java DELETED --- --- SessionManager.java DELETED --- |
From: Michal H. <ms...@us...> - 2005-10-19 17:37:11
|
Update of /cvsroot/exfex/exfex/source/exfex/common/plugins/display/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9241/source/exfex/common/plugins/display/swing Removed Files: SWINGButtonFactory.java SWINGCheckBoxFactory.java SWINGContainerFactory.java SWINGLabelFactory.java SWINGPrimitivesFactory.java SWINGComboBoxFactory.java Log Message: moved to exfex.common.plugins.displaysystem package --- SWINGCheckBoxFactory.java DELETED --- --- SWINGContainerFactory.java DELETED --- --- SWINGComboBoxFactory.java DELETED --- --- SWINGLabelFactory.java DELETED --- --- SWINGButtonFactory.java DELETED --- --- SWINGPrimitivesFactory.java DELETED --- |
From: Michal H. <ms...@us...> - 2005-10-18 18:02:06
|
Update of /cvsroot/exfex/exfex/source/exfex/common/displaysystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16016/source/exfex/common/displaysystem Added Files: package.html Log Message: package info --- NEW FILE: package.html --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head> </head> <body bgcolor="white"> Basic package for display system. <h2>Package Specification</h2> This package contains all classes and interfaces for display system. <br> Display system includes everythnig needed to produce gui output (GUI primitives such as buttons, input boxes, etc; session system, event handling mechanism). </body> </html> |
From: Michal H. <ms...@us...> - 2005-10-18 18:01:50
|
Update of /cvsroot/exfex/exfex/source/exfex/common/displaysystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15940/source/exfex/common/displaysystem Modified Files: ISessionManager.java Log Message: doc updated api organized Index: ISessionManager.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/displaysystem/ISessionManager.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ISessionManager.java 30 Sep 2005 18:24:16 -0000 1.4 --- ISessionManager.java 18 Oct 2005 18:01:40 -0000 1.5 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.5 2005/10/18 18:01:40 mstsxfx + * doc updated api organized + * * Revision 1.4 2005/09/30 18:24:16 mstsxfx * doc update *************** *** 25,52 **** import exfex.common.pluginsystem.IPlugin; import exfex.common.pluginsystem.PluginException; - import exfex.common.security.IIdentity; /** Interface for Session manager. ! * * Interface for plugins that want to be Session managers. ! * <h3>Responsibilies</h3> ! * Implementators have to keep tree of all active sessions (created by ! * registerSession and execSession methods). All active sessions can be found ! * out with getActive method. ! * Active session can be destroyed by killSession method (this should cause ! * killing of all session's children). To find out all sessions factories ! * (plugins that implements ISessionFactory) use getSessionFactories method. * <br> * SessionManager should log all importat information using SESSMNG_LOGGER. - * * <h3>Usage</h3> - * Instance of this manager can be get from getInstance method. * <ul> * <li><u>For plugins</u> - Each session is product of plugin with ! * ISessionFactory type and as such it has to register itself to the manager. * Plugins can register themselves using standard IAcceptPlugin interface ! * (attach and dettach methods). Plugins are supposed to be factories that ! * produces ISession instances (using getSession method). * <br> * NOTE: Don't mess plugin registration with session registration. Plugin --- 28,53 ---- import exfex.common.pluginsystem.IPlugin; import exfex.common.pluginsystem.PluginException; /** Interface for Session manager. ! * * Interface for plugins that want to be Session managers. ! * <h3>Overview</h3> ! * Session Manager is plugin intended for creating and managing all sessions in ! * the system. This involves creating root sessions and subsessions, killing ! * existing sessions and providing information about existing sessions. ! * It also collects all plugins for session creating. As a manager ! * SessionManagers should registers to the PluginManager. * <br> * SessionManager should log all importat information using SESSMNG_LOGGER. * <h3>Usage</h3> * <ul> * <li><u>For plugins</u> - Each session is product of plugin with ! * ISessionFactory type and so correxponding plugin has to register itself to ! * the SessionManager instance. Plugins should use ISessionManager as its ! * dependency. * Plugins can register themselves using standard IAcceptPlugin interface ! * (<code>attach</code> and <code>dettach</code> methods). Plugins are supposed ! * to be factories that produces ISession instances (using getSession method). * <br> * NOTE: Don't mess plugin registration with session registration. Plugin *************** *** 54,109 **** * process of creating session from session factory. * <li><u>For clients</u> - Clients can use this manager to register (using ! * registerSession method), execute (using execSession method) and kill sessions ! * (using killSession method). It can also list registered sessions (using ! * getActive method). When creating new session, you will need factory ! * (plugin) that creates session instance. To get all available factories use ! * getSessionFactories method. To terminate session use killSession method. ! * <pre> ! * // Example how to create session, let's say login session (terminology ! * // doesn't (and won't) be same in the real system. ! * ! * // gets all factories for loggin ! * List<ISessionFactory> SessionManager.getSessionFactories(ILoginSession.class) ! * ! * // choose one that is good ! * ISessionFactory choosedFactory=... ! * ! * // creates top level session ! * ISession=SessionManager.registerSession(myId, choosedFactory); ! * ! * </pre> * </ul> * * <h3>Session's creation process</h3> ! * Sessions can be created in two ways. Using registerSession you will create ! * top level session. This sessions are intended to be root of all sessions ! * needed to acomplish certain task (e.g. editor gui). ! * Second way is to execute session from existing one using execSession. This ! * method will create a child session. This is regular session with following ! * restrictions: * <ul> * <li>If parent session terminates all children (recursively) have * to terminate too. ! * <li>getActive will return only top level sessions. All child session can ! * be listed from SessionNode class (which is returned in list by getActive ! * method) * </ul> * Both methods return new session. This object is local for caller (usualy * client program) and he can use session as he needs. Session is started * (this means at least initialization work and starting event dispatcher - more ! * actions depends on session implementation) by start method. You can give ! * parameters to the method in main method style (array of parameters). Please ! * read documentation on each session plugin for parameters details. * - * <h3>Security</h3> - * It is quite obvious, that session creation is restricted. All method that - * create or give information about active sessions have id paramter, which - * identifies caller. SessionManager keeps logic, who can create which sessions. - * TODO cooperation with SecurityManager description and example. - * * * <pre> ! * Changes: ! * 20.8.2005 msts - created * </pre> * --- 55,92 ---- * process of creating session from session factory. * <li><u>For clients</u> - Clients can use this manager to register (using ! * <code>registerSession</code> method), execute (using <code>execSession</code> ! * method) and kill sessions (using <code>killSession</code> method). ! * List of all registered sessions is returned by <code>getActive</code> method. ! * When creating new session, plugin that creates such session has to be ! * suplied. All such (registered) plugins can be obtained using ! * <code>getSessionFactories</code> method. * </ul> * * <h3>Session's creation process</h3> ! * Sessions can be created in two ways. Using <code>registerSession</code> you ! * will create top level session. This sessions are intended to be root of all ! * sessions needed to acomplish certain task (e.g. editor gui). ! * Second way is to execute session from existing one using ! * <code>execSession</code>. This method will create a child session. This is ! * regular session with following restrictions: * <ul> * <li>If parent session terminates all children (recursively) have * to terminate too. ! * <li><code>getActive</code> will return only top level sessions. All child ! * session can be listed from SessionNode class (which is returned in list by ! * getActive method) * </ul> * Both methods return new session. This object is local for caller (usualy * client program) and he can use session as he needs. Session is started * (this means at least initialization work and starting event dispatcher - more ! * actions depends on session implementation) by <code>start</code> method. You ! * can give parameters to the method in main method style (array of parameters). ! * Please read documentation on each session plugin for parameters details. * * * <pre> ! * ! * Changes: ! * 20.8.2005 msts - created * </pre> * *************** *** 113,119 **** public interface ISessionManager extends IPlugin,IAcceptPlugin { ! /** Returns all first level sessions. * ! * Returns all sessions created by registerSession method. * <p> * NOTE: All returned sessions was registered in the moment of method --- 96,102 ---- public interface ISessionManager extends IPlugin,IAcceptPlugin { ! /** Returns all top level sessions. * ! * Returns all sessions created by <code>registerSession</code> method. * <p> * NOTE: All returned sessions was registered in the moment of method *************** *** 122,178 **** * rely and make critical operations on returned values. * - * TODO: consider id and capabilities, exceptions - * - * @param id Identification object of caller. * @return Array of session objects. */ ! public ISession [] getActive(IIdentity id); /** Registers new session. * * Creates new session using sessionplugin (calls ! * sessionplugin.getSession method) and insert it to the sessions tree. ! * This is the way how to create root (top level) sessions. ! * When session is created, sets its sessionManager and pluginManager ! * fields and finaly session's parent (to null) and state (to CREATED). ! * ! * <p> ! * TODO: consider id and capabilities, exceptions * - * @param id Identification object of caller. * @param sessionplugin Plugin (factory) for session. * @return new session. */ ! public ISession registerSession(IIdentity id, ISessionFactory sessionplugin); /** Register new subsession. * * This method will create new subsession of given session using ! * sessionplugin (calls sessionplugin.getSession method) and insert ! * new session to the session tree (as a child of the session). ! * This is the way how to create gui subprocess. ! * When session is created, sets session's SessionManager, pluginManager ! * and session's parent (to session) and state (to CREATED). * - * <p> - * TODO: consider id and capabilities, exceptions - * - * @see IPlugin#getInstance - * @param id Identification object of caller. * @param session Parent session. * @param sessionplugin Plugin (factory) for session. * @return new session. */ ! public ISession execSession(IIdentity id, ISession session, ISessionFactory sessionplugin); /** Kills given session. * ! * Destroy given session. * Session can be destroyed in two ways: * <ul> * <li>By session itself (e.g. when Session wants to finish, it will ! * call its kill method). Session's kill method is responsible for ! * cleaning up (destroying gui and so on), setting session's state ! * to FINISH and call this method. * <li>By someone else (e.g. system is shuting down and Session manager * wants to kill all sessions). In such situation session's state is --- 105,146 ---- * rely and make critical operations on returned values. * * @return Array of session objects. */ ! public ISession [] getActive(); /** Registers new session. * * Creates new session using sessionplugin (calls ! * <code>sessionplugin.getSession</code> method) and insert it to the ! * sessions tree. This is the way how to create root (top level) ! * sessions. * * @param sessionplugin Plugin (factory) for session. * @return new session. */ ! public ISession registerSession(ISessionFactory sessionplugin); /** Register new subsession. * * This method will create new subsession of given session using ! * sessionplugin (calls <code>sessionplugin.getSession</code> method) ! * and insert new session to the session tree (as a child of the ! * session). This is the way how to create gui subprocess. * * @param session Parent session. * @param sessionplugin Plugin (factory) for session. * @return new session. */ ! public ISession execSession(ISession session, ISessionFactory sessionplugin); /** Kills given session. * ! * Destroyes given session. * Session can be destroyed in two ways: * <ul> * <li>By session itself (e.g. when Session wants to finish, it will ! * call its <code>kill</code> method). Session's <code>kill</code> ! * method is responsible for cleaning up (destroying gui and so on), ! * setting session's state to FINISH and call this method. * <li>By someone else (e.g. system is shuting down and Session manager * wants to kill all sessions). In such situation session's state is *************** *** 186,200 **** * closed too. * <p> ! * NOTE: don't use children kill method, becase it can call killSession ! * method! Rather use child close method. ! * ! * <p> ! * TODO: consider id and capabilities, exceptions ! * ! * @see ISession#kill ! * @param id Identification object of caller. ! * @param session Session to kill. */ ! public void killSession(IIdentity id, ISession session); /** Returns all plugins that can create session object. --- 154,163 ---- * closed too. * <p> ! * NOTE: don't use children kill method, because it can call killSession ! * method! Use rather child's close method. ! * ! * @param session Session to kill. */ ! public void killSession(ISession session); /** Returns all plugins that can create session object. *************** *** 202,210 **** * Asks IAcceptPlugin interface for all plugins with ISessionFactory * type. ! * * @return Returnes all factories (plugins) for sessions. * @throws PluginException if no session factory is registered. */ ! public List<ISessionFactory> getSessionFactories()throws PluginException; } --- 165,175 ---- * Asks IAcceptPlugin interface for all plugins with ISessionFactory * type. ! * * @return Returnes all factories (plugins) for sessions. * @throws PluginException if no session factory is registered. */ ! public List<ISessionFactory> getSessionFactories() ! throws PluginException; ! } |
From: Michal H. <ms...@us...> - 2005-10-18 18:00:19
|
Update of /cvsroot/exfex/exfex/source/exfex/common/displaysystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15429/source/exfex/common/displaysystem Modified Files: IDisplayManager.java Log Message: code reorganized Index: IDisplayManager.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/displaysystem/IDisplayManager.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IDisplayManager.java 15 Sep 2005 18:11:02 -0000 1.5 --- IDisplayManager.java 18 Oct 2005 18:00:10 -0000 1.6 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.6 2005/10/18 18:00:10 mstsxfx + * code reorganized + * * Revision 1.5 2005/09/15 18:11:02 mstsxfx * documentation corrected *************** *** 25,30 **** package exfex.common.displaysystem; ! import java.util.*; ! import exfex.common.pluginsystem.*; --- 28,36 ---- package exfex.common.displaysystem; ! import java.util.List; ! ! import exfex.common.pluginsystem.IAcceptPlugin; ! import exfex.common.pluginsystem.IPlugin; ! import exfex.common.pluginsystem.PluginException; |
From: Michal H. <ms...@us...> - 2005-10-18 17:59:06
|
Update of /cvsroot/exfex/exfex/source/exfex/common/plugins/displaysystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14919/source/exfex/common/plugins/displaysystem Added Files: DisplayManager.java SessionManager.java BasicSessionFactory.java Log Message: plugins moved to displaysystem package --- NEW FILE: DisplayManager.java --- /* * $RCSfile: DisplayManager.java,v $ * * $Log: DisplayManager.java,v $ * Revision 1.1 2005/10/18 17:58:52 mstsxfx * plugins moved to displaysystem package * * Revision 1.4 2005/10/13 18:22:05 mstsxfx * documentation * * Revision 1.3 2005/09/30 18:34:34 mstsxfx * update for IPlugin interface change * * Revision 1.2 2005/09/15 18:11:02 mstsxfx * documentation corrected * som code fixing * * Revision 1.1 2005/09/04 18:56:23 mstsxfx * Display manager created * * */ package exfex.common.plugins.displaysystem; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; import exfex.common.displaysystem.IButtonFactory; import exfex.common.displaysystem.IDisplayManager; import exfex.common.displaysystem.ILabelFactory; import exfex.common.displaysystem.IPrimitivesFactory; import exfex.common.pluginsystem.AcceptPlugin; import exfex.common.pluginsystem.IAcceptPlugin; import exfex.common.pluginsystem.IContext; import exfex.common.pluginsystem.IPlugin; import exfex.common.pluginsystem.IPluginPolicy; import exfex.common.pluginsystem.IPluginStrategy; import exfex.common.pluginsystem.PluginException; import exfex.common.pluginsystem.PluginList; import exfex.common.pluginsystem.PluginManager; /** Plugin for display manager. * * Display manager plugin. This plugin is manager so it can be used target of * other plugins' registration. To do so, extends AcceptPlugin class. * * <br><b>Plugin Name</b>: "StandardDisplayManager" * <br><b>Special notes</b>: * <ul> * <li>Synchronized to be used in multithread environment. * <li>Doesn't use RMI and id security controll - can be used for pure editor * purposes (this behaviour is planed to be changed). * </ul> */ @IPluginPolicy( replaceStrategy=IPluginStrategy.Type.ATLEAST, version=1, author="msts", description="Default display manager to collect all graphic"+ "related stuff. It is intended just for local usage." ) public class DisplayManager extends AcceptPlugin implements IDisplayManager { private static final long serialVersionUID = 1L; /** Manager where to register this plugin. */ IAcceptPlugin manager=PluginManager.getInstance(); /** Instance of display manager. * * This class is supposed to be singleton manager, so instance is * created in the plugin fetching and it's static. * Use getInstance to get reference. */ static private IDisplayManager instance=new DisplayManager(); /** Plugin's name. */ static private String name="StandardDisplayManager"; // IDisplayManager implemetation /** Returns all button plugins. */ synchronized public List<IButtonFactory> getButtons()throws PluginException//{{{ { // Makes copy of returned list from getByIface List<IButtonFactory> list=new LinkedList<IButtonFactory>(); PluginList plglist=getByIface(IButtonFactory.class); ListIterator<IPlugin> iter=plglist.listIterator(); while(iter.hasNext()) { IPlugin plg=iter.next(); list.add((IButtonFactory)plg); } return (list.size()>0)?list:null; }//}}} /** Returns all label plugins. */ synchronized public List<ILabelFactory> getLabels()throws PluginException //{{{ { // Makes copy of returned list from getByIface List<ILabelFactory> list=new LinkedList<ILabelFactory>(); PluginList plglist=getByIface(ILabelFactory.class); ListIterator<IPlugin> iter=plglist.listIterator(); while(iter.hasNext()) { IPlugin plg=iter.next(); list.add((ILabelFactory)plg); } return (list.size()>0)?list:null; }//}}} /** Returnes list of all PrimitivesFactory implementators. */ synchronized public List<IPrimitivesFactory> getPrimitivesFactory()throws PluginException //{{{ { // Makes copy of returned list from getByIface List<IPrimitivesFactory> list=new LinkedList<IPrimitivesFactory>(); PluginList plglist=getByIface(IPrimitivesFactory.class); ListIterator<IPlugin> iter=plglist.listIterator(); while(iter.hasNext()) { IPlugin plg=iter.next(); list.add((IPrimitivesFactory)plg); } return (list.size()>0)?list:null; }//}}} /** Returns implementator of PrimitivesFactory (plugin) with given name. * * Tries to find IPrimitivesFactory implementator (plugin) with given * name. * * @param name Name of the plugin. * @return PrimitivesFactory implementator or null if no such exists. */ synchronized public IPrimitivesFactory getPrimitiveFactory(String name)throws PluginException { return (IPrimitivesFactory)getByName(IPrimitivesFactory.class,name); } // IPlugin interface implementation /** Returns plugin name. */ public String getName() { return name; } /** Returns plugins manager. */ public IAcceptPlugin getManager() { return manager; } /** Returns instance of manager. * * Returns singleton instance of the manager. * <p> * NOTE: Ignores context parameter. * * @param context Context of instancing. * @return SessionManager instance. */ public Object getInstance(IContext context) { return instance; } /** Plugin Registration method. * * Registers this manager to the plugin manager. */ public void registerMe()throws PluginException { manager.attach(this); } /** Plugin un registration method. * * Unregisters this manager from the plugin manager. */ public void unRegisterMe() { try { manager.dettach(this); }catch(Exception e) { /* Should'n happen * TODO: handle */ } } /** This class has no dependencies and so doesn't need to implement * this method. */ public void dependencyNotify() { // TODO reconsider if this can't be used for distribution of // notify to all registered when something has changed outside // of this manager } } --- NEW FILE: BasicSessionFactory.java --- package exfex.common.plugins.displaysystem; import exfex.common.displaysystem.IEvent; import exfex.common.displaysystem.ISession; import exfex.common.displaysystem.ISessionFactory; import exfex.common.displaysystem.ISessionManager; import exfex.common.displaysystem.SessionState; import exfex.common.pluginsystem.IAcceptPlugin; import exfex.common.pluginsystem.IContext; import exfex.common.pluginsystem.IInject; import exfex.common.pluginsystem.PluginException; import exfex.common.pluginsystem.PluginManager; /** Session object. * * Iplementation of example session. TODO remove from CVS * * <br> * NOTICE: not for casual usage, just as illustration. * * * @author msts */ class BasicSession implements ISession//{{{ { private SessionState state=SessionState.NONE; private String name="Basic Session"; private ISessionManager manager=null; private PluginManager plgsys=null; private ISession parentSession=null; private String title=null; /** Default constructor. */ public BasicSession() { } public void setSessionManager(ISessionManager manager) { if(state.ordinal()==SessionState.NONE.ordinal()) this.manager=manager; else System.out.println("setSessionManager error (bad state="+state+")"); } public void setPluginManager(PluginManager manager) { if(state.ordinal()==SessionState.NONE.ordinal()) plgsys=manager; else System.out.println("setPluginManager error (bad state="+state+")"); } public void setParentSession(ISession parent) { if(state.ordinal()==SessionState.NONE.ordinal()) this.parentSession=parent; else System.out.println("setParentSession error (bad state="+state+")"); } public void setState(SessionState state) { if(this.state.ordinal()!=SessionState.FINISH.ordinal()) this.state=state; else System.out.println("Set state error (bad state="+state+")"); } public void start(String[] args) { if(state.ordinal()==SessionState.CREATED.ordinal() || state.ordinal()==SessionState.CLOSED.ordinal()) { if(args!=null && args.length>0) title=args[0]; System.out.println("Session \""+name+"\" title="+title+" created"); }else System.out.println("Session creation error (bad state="+state+")"); } public void kill() { if(state.ordinal()==SessionState.NONE.ordinal()) { System.out.println("kill error (bad state="+state+")"); return; } if (state.ordinal()!=SessionState.FINISH.ordinal()) { close(); System.out.println("Session \""+name+"\" title="+title+" killed"); setState(SessionState.FINISH); System.out.println("calling killsession state="+state); try { manager.killSession(this); }catch(Exception e) { // TODO } } } public void close() { if(state.ordinal()==SessionState.NONE.ordinal() || state.ordinal()==SessionState.FINISH.ordinal()) { System.out.println("close error (bad state="+state+")"); return; } if(state.ordinal()==SessionState.CLOSED.ordinal()) return; System.out.println("Session \""+name+"\" title="+title+" closed"); setState(SessionState.CLOSED); } public void sendEvent(IEvent event) { if(state.ordinal()==SessionState.INITIALIZED.ordinal()) System.out.println("Event recieved"); else System.out.println("sendEvent error (bad state="+state+")"); } public SessionState getState() { return state; } public ISession getParentSession() { return parentSession; } }//}}} /** Session plugin. * * Example of SessionFactory plugin. * * * NOTE: This is just example for ilustrative purposes. * * * @author msts */ public class BasicSessionFactory implements ISessionFactory { private String PluginName=new String("BasicSession"); @IInject() private ISessionManager manager; // Implementation IPlugin public String getName() { return PluginName; } public Object getInstance(IContext context) { return new BasicSession(); } public void registerMe()throws PluginException { manager.attach(this); } public void unRegisterMe() { try { manager.dettach(this); }catch (Exception e) { } } public IAcceptPlugin getManager() { return (IAcceptPlugin)manager; } public ISession getSession(IContext context) { return (ISession)getInstance(context); } public void dependencyNotify() { } } --- NEW FILE: SessionManager.java --- /* * $RCSfile: SessionManager.java,v $ * * $Log: SessionManager.java,v $ * Revision 1.1 2005/10/18 17:58:52 mstsxfx * plugins moved to displaysystem package * * Revision 1.6 2005/09/30 18:34:34 mstsxfx * update for IPlugin interface change * * Revision 1.5 2005/09/15 18:11:02 mstsxfx * documentation corrected * som code fixing * * Revision 1.4 2005/09/04 18:57:39 mstsxfx * Documentation * * Revision 1.3 2005/08/31 18:09:24 mstsxfx * ready for testing * * Revision 1.2 2005/08/27 09:41:08 mstsxfx * documentation * */ package exfex.common.plugins.displaysystem; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; import exfex.common.displaysystem.ISession; import exfex.common.displaysystem.ISessionFactory; import exfex.common.displaysystem.ISessionManager; import exfex.common.displaysystem.SessionNode; import exfex.common.displaysystem.SessionState; import exfex.common.logging.ILogger; import exfex.common.logging.LogManager; import exfex.common.pluginsystem.AcceptPlugin; import exfex.common.pluginsystem.IAcceptPlugin; import exfex.common.pluginsystem.IContext; import exfex.common.pluginsystem.IPlugin; import exfex.common.pluginsystem.IPluginPolicy; import exfex.common.pluginsystem.IPluginStrategy; import exfex.common.pluginsystem.PluginException; import exfex.common.pluginsystem.PluginList; import exfex.common.pluginsystem.PluginManager; /** Plugin for Session manager. * * This class implements ISessionManager interface. It can be target of plugin * registerMe method because it's manager (extends AcceptPlugin class). * Instance of this type can be used just localy. To act as remote service, * use some wraping object with IRemoteSessionManager type (product of * IRemoteSessionManagerFactory type). * * <br><b>Plugin Name</b>: "BasicSessionManager" * <br><b>Depends</b>: No dependencies * * <br><b>Special notes</b>: * <ul> * <li>Synchronized to be used in multithread environment. * <li>Registers to the PluginManager. * <li>Uses logger with SESSMNG_LOGGER name. * <li>Always returns same instance when getInstance is called (with * ISessionManager type). * </ul> * * <pre> * * Changes: * 18.10.2005 msts - rewriten - no dependency needed, name changed * 22.8.2005 msts - created * </pre> * * * @author msts */ @IPluginPolicy( replaceStrategy=IPluginStrategy.Type.ATLEAST, version=1, author="msts", description="Default session manager to manage all sessions"+ "It is intended for local usage." ) public class SessionManager extends AcceptPlugin implements ISessionManager { private static final long serialVersionUID = 1L; /** List of all toplevel sessions. * * This list contains all top level session (those created by * registerSession method). Each session is encapsulate by SessionNode * class. This class contains session refernce and all children (also * SessionNode instances). * To get copy of this list use getActive method. * * @see SessionManager#getActive * @see SessionNode */ LinkedList<SessionNode> rootSessions=new LinkedList<SessionNode>(); /** SessionManager will register to the PluginManager. */ private PluginManager manager=PluginManager.getInstance(); /** Instance of session manager. * * This class is supposed to be singleton manager, so instance is * created in the plugin fetching and it's static. * Use getInstance to get reference. */ static private ISessionManager instance=new SessionManager(); /** Plugin name. */ static private String name="BasicSessionManager"; /** Logger name. * * FIXME set in constructor. */ static private String logName="SESSMNG_LOGGER"; /** Default constructor. * * TODO initialization from setting manager. */ public SessionManager() { } // SessionManager interface implementation /** Returns active top level sessions. * * Returns all registerd top level sessions. * * @return Array of sessions. */ synchronized public ISession [] getActive()//{{{ { ISession [] result=new ISession[rootSessions.size()]; int i=0; for(SessionNode node : rootSessions ) result[i]=node.getSession(); return result; }//}}} /** Registers new toplevel session. * * Creates new session from plugin factory (given as parameter) and * registers new toplevel session and inserts it to the rootSessions * list. Sets session's state (to the CREATED value), parent session * (to null), session manager (to this) and plugin manager (to * PluginManager.getInstance()). * * @param sessionplugin Plugin for session creation. * @return Created session. */ synchronized public ISession registerSession(ISessionFactory sessionplugin)//{{{ { log(ILogger.Level.NOTICE,"Registering new top level session from factory="+sessionplugin); // context is ignored here ISession result=sessionplugin.getSession(null); log(ILogger.Level.DEBUG,this+".registerSession Session created "+result); // Initialize Session result.setParentSession(null); result.setSessionManager(this); result.setPluginManager(PluginManager.getInstance()); result.setState(SessionState.CREATED); // Create session node and insert it to the rootSessions list. rootSessions.add(new SessionNode(result)); log(ILogger.Level.INFO,"Session "+result+" inserted to the Session tree (root session). Root sessions count="+rootSessions.size()); return result; }//}}} /** Creates new child session. * * Creates new subsession of given session. To the same as * registerSession exept it won't add new session to the rootSessions * list and set session parent to the session (parameter) value. * * @param session Parent session. * @param sessionplugin Plugin for session creation. * @return Created session. */ synchronized public ISession execSession(ISession session, ISessionFactory sessionplugin)//{{{ { log(ILogger.Level.NOTICE,"Registering new sub session from factory="+sessionplugin+" parent="+session); // Find parent node SessionNode node=find(null,session); if(node==null) { // parent is not registered in session tree log(ILogger.Level.ERROR,this+".execSession parent="+session+" is not registered"); return null; } // TODO what with context ISession result=sessionplugin.getSession(null); log(ILogger.Level.DEBUG,this+".execSession Session created "+result); // Initialize Session result.setParentSession(session); result.setSessionManager(this); result.setPluginManager(PluginManager.getInstance()); result.setState(SessionState.CREATED); // register session as a child of the node node.addChild(new SessionNode(result)); log(ILogger.Level.INFO,"Session "+result+" inserted to the Session tree. Parent="+session+" subsessions count="+node.getChildren().size()); // inserts result to the session's node return result; }//}}} /** Returns all sessions' factories. * * Return all factories (ISessionFactory typed plugins) which are registered on * this manager. * * @return list of all registered plugin factories. * @throws PluginException If no session factory is registered on this * manager. */ synchronized public List<ISessionFactory> getSessionFactories() throws PluginException//{{{ { // gets all ISessionFactory typed plugins PluginList sessions=getByIface(ISessionFactory.class); // makes copy of the list to prevent changes LinkedList<ISessionFactory> result=new LinkedList<ISessionFactory>(); ListIterator<IPlugin> iter=sessions.listIterator(); while(iter.hasNext()) { IPlugin p=iter.next(); result.add((ISessionFactory)p); } return result; }//}}} /** Kills session. * * Kills given session. If session's state is FINISH kills all * children sessions and after that removes session from session's * tree. If the session state is different, calls session.kill * and returns immediately after (this method will be called from * session.kill). * * @param session Session to kill. */ synchronized public void killSession(ISession session)//{{{ { // Test session's state to find out is session is ready to // be removed from session tree (iff state is FINISH) if(session.getState()!=SessionState.FINISH) { // External request for session kill, so prepare // session for kill (calls kill on it). // This method will call killSession, so we have // nothing to do after kill retunrs. session.kill(); return; } // Session is ready to be removed from session tree // state is FINISH // We got here from ISession.kill method log(ILogger.Level.NOTICE,"Kill request for "+session+" state="+session.getState()); // look for session starting from rootSessions for(SessionNode root : rootSessions) { SessionNode node=find(root,session); if(node!=null) { // Node was found and so try to kill all children log(ILogger.Level.DEBUG,this+".killSession Session node found "+node); // TODO consider id // kill all children List<SessionNode> children=node.getChildren(); if(children!=null) { // Children found, we have to kill'em // all log(ILogger.Level.DEBUG,this+".killSession Closing "+session+" "+children.size()+" children session(s)"); for(SessionNode child: children) killChildren(child); log(ILogger.Level.DEBUG,this+".killSession "+session+"'s children closed"); } // finds parent node (if top level, parent is // null) to be able to remove session from session // tree ISession parentSession=session.getParentSession(); SessionNode parent=(parentSession==null)?null:find(null,parentSession); remove(parent, node); log(ILogger.Level.NOTICE,"Session "+session+" removed from session tree."); return; } } // Unable to find session node log(ILogger.Level.ERROR,this+".killSession Unable to find "+session+" in session tree"); }//}}} // IPlugin interface implementation /** Returns plugin name. */ public String getName() { return name; } /** Returns plugins manager. */ public IAcceptPlugin getManager() { return manager; } /** Returns instance of manager. * * Returns singleton instance of the manager. * <br> * NOTE: Ignores context parameter. * * @param context Context of instancing. * @return SessionManager instance. */ public Object getInstance(IContext context) { return (ISessionManager)instance; } /** Plugin Registration method. * * Registers this manager to the plugin manager. */ public void registerMe()throws PluginException { log(ILogger.Level.INFO,"Registering "+this+" session manager to the "+manager); manager.attach(this); } /** Plugin un registration method. * * Unregisters this manager from the plugin manager. * TODO finish all active sessions. */ public void unRegisterMe() { log(ILogger.Level.INFO,"Unregistering "+this+" session manager from "+manager); try { manager.dettach(this); }catch(Exception e) { /* Should'n happen * TODO: handle */ } } /** Method is not implemented yet. */ public void dependencyNotify() { } // helper methods /** Helper logging method. * * @param level Message priority. * @param msg Message to log. */ @Override protected void log(ILogger.Level level,String msg) { LogManager.getInstance().getLogger(logName).log(level,msg); } /** Helper kill method. * * Recursively closes all children of given root session node. * * @param root Root node for session. */ protected void killChildren(SessionNode root)//{{{ { // Kills root session node's session log(ILogger.Level.INFO,"Closing sub session "+root.getSession()+" parent="+root.getSession().getParentSession()); root.getSession().close(); if(root.getChildren()!=null) { // Subsession has following sub sessions // starts recursion log(ILogger.Level.DEBUG,this+".killChildren Closing "+root.getSession()+" "+root.getChildren().size()+" children sessions"); for(SessionNode node : root.getChildren()) killChildren(node); log(ILogger.Level.DEBUG,this+".killChildren "+root.getSession()+"'s children closed"); } log(ILogger.Level.INFO,"Sub session "+root.getSession()+" closed"); }//}}} /** Helper method to find session node in session tree. * * Returns session node from session tree for session. Search starts * from root node. If root node is null, starts from rootSessions list. * Method is recursive (calls to children if necessery) and recursion * stops either if root equals with session or all children return with * null. * * @param root Root node where to start search. * @param session Session to find. * @return Session node for session or null if no session node for * session exists in session tree. */ protected SessionNode find(SessionNode root,ISession session)//{{{ { List<SessionNode> list; if(root==null) { // Starts from rootSessions list=(List<SessionNode>)rootSessions; }else { // We are in subsession // try if root is session's node if(root.getSession()==session) { return root; } // root is not session's node and search all its // children list=root.getChildren(); } // no descendants if(list==null) return null; // Try to search in all from list recursively for (SessionNode node : list) { // Look in node subtree SessionNode result=find(node,session); if(result!=null) { return result; } } // No node found return null; }//}}} /** Helper method to remove session node from session tree. * * Removes session node from root session node children list. If root * is null, removes session from rootSessions. * * @param parent Root node. * @param child Session node to remove. */ protected void remove(SessionNode parent,SessionNode child)//{{{ { if(parent==null) { // We want to remove child from rootSessions // because it is top level session node rootSessions.remove(parent); return; } // We want to remove subsession parent.removeChild(child); }//}}} } |
From: Michal H. <ms...@us...> - 2005-10-18 17:58:22
|
Update of /cvsroot/exfex/exfex/source/exfex/common/plugins/displaysystem/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14786/source/exfex/common/plugins/displaysystem/swing Added Files: SWINGContainerFactory.java SWINGCheckBoxFactory.java SWINGPrimitivesFactory.java SWINGButtonFactory.java SWINGLabelFactory.java SWINGComboBoxFactory.java Log Message: display package renamed to displatsystem --- NEW FILE: SWINGCheckBoxFactory.java --- /* * $RCSfile: SWINGCheckBoxFactory.java,v $ * * $Log: SWINGCheckBoxFactory.java,v $ * Revision 1.1 2005/10/18 17:58:12 mstsxfx * display package renamed to displatsystem * * Revision 1.6 2005/10/13 18:21:40 mstsxfx * documentation * * Revision 1.4 2005/10/08 17:25:43 pecixfx * *** empty log message *** * * Revision 1.3 2005/10/08 16:57:20 pecixfx * *** empty log message *** * * Revision 1.2 2005/10/08 15:15:40 pecixfx * update of SWINGCheckBoxFactory class and SWINGCheckBox class * almost all interface metods implemented * */ package exfex.common.plugins.displaysystem.swing; import java.util.Properties; import javax.swing.JCheckBox; import exfex.common.displaysystem.ICheckBox; import exfex.common.displaysystem.ICheckBoxFactory; import exfex.common.displaysystem.IDisplayManager; import exfex.common.pluginsystem.*; class SWINGCheckBox implements ICheckBox { JCheckBox checkBox; public void display() { checkBox.setVisible(true); } public void hide() { checkBox.setVisible(false); } public void enable() { checkBox.setEnabled(true); } public void disable() { checkBox.setEnabled(false); } public boolean isFocused() { return checkBox.hasFocus(); } public void focus() { checkBox.requestFocus(); } public void releaseFocus() { //TODO: implement release focus } public String getText() { return checkBox.getText(); } public String setText(String text) { String oldText = getText(); checkBox.setText(text); return oldText; } public <T> T getGui(Class<T> clazz) { return clazz.cast(checkBox); } public void setSize(int width, int height) { checkBox.setSize(width,height); } public void resize(int dWidth, int dHeight) { checkBox.setSize(checkBox.getWidth()+dWidth,checkBox.getHeight()+dHeight); } public void setHeigth(int height) { checkBox.setSize(checkBox.getWidth(),height); } public int getHeight() { return checkBox.getHeight(); } public void setWidth(int width) { checkBox.setSize(width,checkBox.getHeight()); } public int getWidth() { return checkBox.getWidth(); } } /** * <br><b>Plugin Name</b>: "SWINGCheckBox" * <br><b>Depends</b>: * <ul> * <li>DisplayManager - with no strategy * </ul> * <br><b>Special notes</b>: * <ul> * <li>Returned button is JCheckBox from javax.swing * <li>Registers itself to the DisplayManager * </ul> * * @author bossek * */ public class SWINGCheckBoxFactory implements ICheckBoxFactory { private String PluginName = new String("SWINGCheckBox"); @IInject() private IDisplayManager manager; public ICheckBox getCheckBox(IContext context) { ICheckBox checkBox = (ICheckBox)getInstance(null); //gets context properties and if null, immediately returns Properties prop=context.getContext(); if(prop==null) return checkBox; //TODO: set properties to object. Usefull property setter not exits yet return checkBox; } public String getName() { return PluginName; } public Object getInstance(IContext context) { return new SWINGCheckBox(); } public void registerMe() throws PluginException { try { manager.attach(this); } catch (Exception e) { //TODO: handle this exception } } public void unRegisterMe() { try { manager.dettach(this); } catch (Exception e) { //TODO: handle this exception } } public IAcceptPlugin getManager() { return (IAcceptPlugin)manager; } public void dependencyNotify() { // TODO Auto-generated method stub } } --- NEW FILE: SWINGContainerFactory.java --- package exfex.common.plugins.displaysystem.swing; import java.util.ArrayList; import java.util.Collection; import javax.swing.JComponent; import javax.swing.JPanel; import exfex.common.displaysystem.IContainer; import exfex.common.displaysystem.IContainerFactory; import exfex.common.displaysystem.IDisplayManager; import exfex.common.displaysystem.IWindow; import exfex.common.pluginsystem.IAcceptPlugin; import exfex.common.pluginsystem.IContext; import exfex.common.pluginsystem.IInject; import exfex.common.pluginsystem.PluginException; class SWINGContainer implements IContainer { JComponent container = new JPanel(); Collection<IWindow> components = new ArrayList<IWindow>(); public void add(IWindow component) { components.add(component); container.add(component.getGui(JComponent.class)); } public void del(IWindow component) { container.remove(component.getGui(JComponent.class)); components.remove(component); } public void display() { container.setVisible(true); } public void hide() { container.setVisible(false); } public void enable() { container.setEnabled(true); } public void disable() { container.setEnabled(false); } public <T> T getGui(Class<T> clazz) { return clazz.cast(container); } public IWindow[] getComponents() { return components.toArray(new IWindow[components.size()]); } } /** * <br><b>Plugin Name</b>: "SWINGContainers" * <br><b>Depends</b>: * <ul> * <li>DisplayManager - with no strategy * </ul> * <br><b>Special notes</b>: * <ul> * <li>Returned button is JPanel from javax.swing * <li>Registers itself to the DisplayManager * </ul> * * @author bossek * */ public class SWINGContainerFactory implements IContainerFactory { private final String name = "SWINGContainers"; @IInject() private IDisplayManager manager; public IContainer getContainer(IContext context) throws PluginException { return (IContainer) getInstance(context); } public String getName() { return name; } public Object getInstance(IContext context) { return new SWINGContainer(); } public void registerMe() throws PluginException { manager.attach(this); } public void unRegisterMe() { try { manager.dettach(this); } catch (PluginException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public IAcceptPlugin getManager() { return manager; } public void dependencyNotify() { } } --- NEW FILE: SWINGComboBoxFactory.java --- /** * $RCSfile: SWINGComboBoxFactory.java,v $ * * $Log: SWINGComboBoxFactory.java,v $ * Revision 1.1 2005/10/18 17:58:12 mstsxfx * display package renamed to displatsystem * * Revision 1.8 2005/10/13 18:21:40 mstsxfx * documentation * * Revision 1.6 2005/10/08 17:57:17 mstsxfx * update * * Revision 1.5 2005/10/08 17:48:05 pecixfx * First "complete" release from ComboBoxFactory * * Revision 1.4 2005/10/08 17:33:17 pecixfx * *** empty log message *** * * Revision 1.3 2005/10/08 17:07:18 pecixfx * *** empty log message *** * * Revision 1.2 2005/10/08 16:59:13 mstsxfx * update * * Revision 1.1 2005/10/08 15:40:32 pecixfx * ComboBox inerface and class * ComboBoxFactory interface and class * */ package exfex.common.plugins.displaysystem.swing; import java.util.Properties; import javax.swing.JComboBox; import exfex.common.displaysystem.IComboBox; import exfex.common.displaysystem.IComboBoxFactory; import exfex.common.displaysystem.IDisplayManager; import exfex.common.pluginsystem.IAcceptPlugin; import exfex.common.pluginsystem.IContext; import exfex.common.pluginsystem.IInject; import exfex.common.pluginsystem.PluginException; /**TODO: build comment * * <p> * <pre> * Changes: * </pre> * * @author peci */ class SWINGComboBox implements IComboBox { JComboBox comboBox; public SWINGComboBox() { comboBox=new JComboBox(); } /** * @inheritDoc */ public void display() { comboBox.setVisible(true); } /** * @inheritDoc */ public void hide() { comboBox.setVisible(false); } /** * @inheritDoc */ public void enable() { comboBox.setEnabled(true); } /** * @inheritDoc */ public void disable() { comboBox.setEnabled(false); } /** * @inheritDoc */ public String getText() { return comboBox.getToolTipText(); } /** * @inheritDoc */ public String setText(String text) { String oldText = getText(); comboBox.setToolTipText(text); return oldText; } /** * @inheritDoc */ public boolean isFocused() { return comboBox.hasFocus(); } /** * @inheritDoc */ public void focus() { comboBox.requestFocus(); } /** * @inheritDoc */ public void releaseFocus() { // TODO Auto-generated method stub } /** * @inheritDoc */ public int getHeight() { return comboBox.getHeight(); } /** * @inheritDoc */ public int getWidth() { return comboBox.getWidth(); } /** * @inheritDoc */ public void resize(int dWidth, int dHeight) { comboBox.setSize(comboBox.getWidth()+dWidth, comboBox.getHeight()+dHeight); } /** * @inheritDoc */ public void setHeigth(int height) { comboBox.setSize(comboBox.getWidth(), height); } /** * @inheritDoc */ public void setSize(int width, int height) { comboBox.setSize(width, height); } /** * @inheritDoc */ public void setWidth(int width) { comboBox.setSize(width, comboBox.getHeight()); } /** * @inheritDoc */ public <T> T getGui(Class<T> clazz) { return clazz.cast(comboBox); } } /** * <br><b>Plugin Name</b>: "SWINGComboBox" * <br><b>Depends</b>: * <ul> * <li>DisplayManager - with no strategy * </ul> * <br><b>Special notes</b>: * <ul> * <li>Returned combobox is JComboBox from javax.swing * <li>Registers itself to the DisplayManager * </ul> * * * <p> * <pre> * Changes: * </pre> * * @author peci */ public class SWINGComboBoxFactory implements IComboBoxFactory { private String PluginName = new String("SWINGComboBox"); @IInject() private IDisplayManager manager; public IComboBox getComboBox(IContext context) { //TODO: tuhle opicarnu budeme muset vymyslet jinak IComboBox comboBox = (IComboBox)getInstance(null); // gets context properties and if null, immediately returns Properties prop=context.getContext(); if(prop==null) return comboBox; //TODO: set properties return comboBox; } public String getName() { return PluginName; } public Object getInstance(IContext context) { return new SWINGComboBox(); } public void registerMe() throws PluginException { try { manager.attach(this); } catch (Exception e) { //TODO:handle this exception } } public void unRegisterMe() { try { manager.dettach(this); } catch (Exception e) { //TODO:handle this exception } } public IAcceptPlugin getManager() { return (IAcceptPlugin)manager; } public void dependencyNotify() { // TODO Auto-generated method stub } } --- NEW FILE: SWINGLabelFactory.java --- /* * $RCSfile: SWINGLabelFactory.java,v $ * * $Log: SWINGLabelFactory.java,v $ * Revision 1.1 2005/10/18 17:58:12 mstsxfx * display package renamed to displatsystem * * Revision 1.4 2005/10/13 18:21:40 mstsxfx * documentation * * Revision 1.3 2005/10/08 17:57:17 mstsxfx * update * * Revision 1.2 2005/10/08 16:09:18 mstsxfx * interfaces implementation * * Revision 1.1 2005/10/08 14:56:50 bossek * reforma * * Revision 1.4 2005/10/08 14:50:10 mstsxfx * implementing new interfaces on primitives * * Revision 1.3 2005/09/30 18:34:34 mstsxfx * update for IPlugin interface change * * Revision 1.2 2005/09/15 18:11:02 mstsxfx * documentation corrected * som code fixing * * Revision 1.1 2005/09/04 18:55:47 mstsxfx * Created simple and ilustrative SWING primitive plugin * * */ package exfex.common.plugins.displaysystem.swing; import javax.swing.JLabel; import exfex.common.displaysystem.IDisplayManager; import exfex.common.displaysystem.ILabel; import exfex.common.displaysystem.ILabelFactory; import exfex.common.pluginsystem.IAcceptPlugin; import exfex.common.pluginsystem.IContext; import exfex.common.pluginsystem.IInject; /** SWING label object. */ class SWINGLabel implements ILabel //{{{ { JLabel label; public SWINGLabel() { label=new JLabel(); } public String setText(String text) { String old=getText(); label.setText(text); return old; } public String getText() { return label.getText(); } public void display() { label.setVisible(true); } public void hide() { label.setVisible(false); } public void enable() { label.setEnabled(true); } public void disable() { label.setEnabled(false); } /** Sets new size from parameters. */ public void resize(int dWidth, int dHeight) { label.setSize(dWidth, dHeight); } /** Changes width and heigth according given differences. * * Given parameters are added to the actual numbers. */ public void setSize(int width, int height) { label.setSize(label.getWidth()+width, label.getHeight()+height); } /** * @inheritDoc */ public <T> T getGui(Class<T> clazz) { return clazz.cast(label); } /** * @inheritDoc */ public int getHeight() { return label.getHeight(); } /** * @inheritDoc */ public int getWidth() { return label.getWidth(); } /** * @inheritDoc */ public void setHeigth(int height) { label.setSize(label.getWidth(), height); } /** * @inheritDoc */ public void setWidth(int width) { label.setSize(width, label.getHeight()); } }//}}} /** SWING label plugin. * * Factory to produce standard Swing labels. * * <br><b>Plugin Name</b>: "SWINGLabel" * <br><b>Special notes</b>: * <ul> * <li>Returned label is JLabel from javax.swing * <li>Registers itself to DisplayManager * </ul> * * <pre> * Changes: * 4.9.2005 msts - created * </pre> * * @author msts */ public class SWINGLabelFactory implements ILabelFactory { /** Plugin name. */ private String PluginName=new String("SWINGLabel"); /** Display manager dependency. * * This plugin registers itself to DisplayManager, so marks it * as dependency. It won't need to ask PluginManager for DisplayManager * instance. */ @IInject() private IDisplayManager manager; // Implementation IPlugin /** Returns plugin name. */ public String getName() { return PluginName; } /** Returns new instance of label. * * This is low level method and shouldn't be called. Rather use getLabel * method instead. * * <br> * NOTE: Doesn't use context parameter. * * @return label cast to Object. */ public Object getInstance(IContext context) { return new SWINGLabel(); } /** Registers plugin to DisplayManager. */ public void registerMe() { try { manager.attach(this); }catch(Exception e) { /* Should'n happen * TODO: handle */ } } /** Unregister plugin from DisplayManager. */ public void unRegisterMe() { try { manager.dettach(this); }catch(Exception e) { /* Should'n happen * TODO: handle */ } } /** Returns plugin's manager. */ public IAcceptPlugin getManager() { return (IAcceptPlugin)manager; } /** Creates SWINGLabel object. * * Creates new SWING label using getInstance method. * * @return ILabel instance. */ public ILabel getLabel(IContext context) { return (ILabel)getInstance(context); } public void dependencyNotify() { } } --- NEW FILE: SWINGButtonFactory.java --- /* * $RCSfile: SWINGButtonFactory.java,v $ * * $Log: SWINGButtonFactory.java,v $ * Revision 1.1 2005/10/18 17:58:12 mstsxfx * display package renamed to displatsystem * * Revision 1.5 2005/10/13 18:21:40 mstsxfx * documentation * * Revision 1.3 2005/10/08 17:57:17 mstsxfx * update * * Revision 1.2 2005/10/08 16:09:18 mstsxfx * interfaces implementation * * Revision 1.1 2005/10/08 14:56:50 bossek * reforma * * Revision 1.4 2005/10/08 14:50:10 mstsxfx * implementing new interfaces on primitives * * Revision 1.3 2005/09/30 18:34:34 mstsxfx * update for IPlugin interface change * * Revision 1.2 2005/09/15 18:11:02 mstsxfx * documentation corrected * som code fixing * * Revision 1.1 2005/09/04 18:55:47 mstsxfx * Created simple and ilustrative SWING primitive plugin * * */ package exfex.common.plugins.displaysystem.swing; import java.util.Properties; import javax.swing.JButton; import exfex.common.displaysystem.IButton; import exfex.common.displaysystem.IButtonFactory; import exfex.common.displaysystem.IDisplayManager; import exfex.common.pluginsystem.IAcceptPlugin; import exfex.common.pluginsystem.IContext; import exfex.common.pluginsystem.IInject; /** SWING button object. */ class SWINGButton implements IButton //{{{ { JButton button; public SWINGButton() { button=new JButton(); } public String setText(String text) { String old=getText(); button.setText(text); return old; } public String getText() { return button.getText(); } public void display() { button.setVisible(true); } public void hide() { button.setVisible(false); } public void enable() { button.setEnabled(true); } public void disable() { button.setEnabled(false); } public <T> T getGui(Class<T> clazz) { return clazz.cast(button); } /* (non-Javadoc) * @see exfex.common.displaysystem.IFocusAble#focus() */ public void focus() { //TODO } /* (non-Javadoc) * @see exfex.common.displaysystem.IFocusAble#isFocused() */ public boolean isFocused() { return button.hasFocus(); } /* (non-Javadoc) * @see exfex.common.displaysystem.IFocusAble#releaseFocus() */ public void releaseFocus() { // TODO } /** Returns it's button state. * Properties instance containes just BUTTON key vith value of current * button pressed state (false if not pressed). */ public Properties getState() { Properties state=new Properties(); // FIXME: set current state state.setProperty("BUTTON", "FALSE"); return state; } /* (non-Javadoc) * @see exfex.common.displaysystem.IStateFull#setState(java.util.Properties) */ public void setState(Properties state) { // TODO implement } /** Sets size of the button. * * @param width Width of the button. * @param dHeight Height of the button. */ public void setSize(int width, int dHeight) { button.setSize(width, dHeight); } /** Resizes button size according given values. * Given parameters are added to the current values. * * @param dWidth Change in width. * @param dHeight Change in heigth. */ public void reSize(int dWidth, int dHeight) { button.setSize(button.getWidth()+dWidth, button.getHeight()+dHeight); } /** Returns height of the button. */ public int getHeight() { return button.getHeight(); } /** Returns width of the button. */ public int getWidth() { return button.getWidth(); } /** * @inheritDoc */ public void resize(int dWidth, int dHeight) { // TODO Auto-generated method stub } /** Sets new height. * * @param height New height. */ public void setHeigth(int height) { button.setSize(button.getWidth(), height); } /** Sets width. * * @param width New width. */ public void setWidth(int width) { button.setSize(width, button.getHeight()); } }//}}} /** SWING button plugin. * * Factory to produce standard Swing buttons. * * <br><b>Plugin Name</b>: "SWINGButton" * <br><b>Depends</b>: * <ul> * <li>DisplayManager - with no strategy * </ul> * <br><b>Special notes</b>: * <ul> * <li>Returned button is JButton from javax.swing * <li>Registers itself to the DisplayManager * </ul> * * <pre> * Changes: * 4.9.2005 msts - created * </pre> * * * @author msts */ public class SWINGButtonFactory implements IButtonFactory { private String PluginName=new String("SWINGButton"); @IInject() private IDisplayManager manager; // Implementation IPlugin /** Returns plugin's name. */ public String getName() { return PluginName; } /** Returnes new button instance. * * Creates new default SWINGButton instance. * * <br> * NOTE: Ignores context parameter. * * @return SWINGButton instance. */ public Object getInstance(IContext context) { return new SWINGButton(); } /** Registers itself to DisplayManager. */ public void registerMe() { try { manager.attach(this); }catch(Exception e) { /* Should'n happen * TODO: handle */ } } /** Unregister itself from DisplayManager. */ public void unRegisterMe() { try { manager.dettach(this); }catch(Exception e) { /* Should'n happen * TODO: handle */ } } /** Returns manager (DisplayManager) instance. */ public IAcceptPlugin getManager() { return (IAcceptPlugin)manager; } /** Creates new button. * * Wraper for getInstance method to return directly cased button. * */ public IButton getButton(IContext context) { return (IButton)getInstance(context); } public void dependencyNotify() { } } --- NEW FILE: SWINGPrimitivesFactory.java --- /* * $RCSfile: SWINGPrimitivesFactory.java,v $ * * $Log: SWINGPrimitivesFactory.java,v $ * Revision 1.1 2005/10/18 17:58:12 mstsxfx * display package renamed to displatsystem * * Revision 1.4 2005/10/13 18:21:40 mstsxfx * documentation * * Revision 1.2 2005/10/08 17:57:17 mstsxfx * update * * Revision 1.1 2005/10/08 14:56:50 bossek * reforma * * Revision 1.3 2005/09/30 18:34:34 mstsxfx * update for IPlugin interface change * * Revision 1.2 2005/09/15 18:11:02 mstsxfx * documentation corrected * som code fixing * * Revision 1.1 2005/09/04 18:55:47 mstsxfx * Created simple and ilustrative SWING primitive plugin * * */ package exfex.common.plugins.displaysystem.swing; import java.util.Enumeration; import java.util.Properties; import exfex.common.displaysystem.IButton; import exfex.common.displaysystem.IButtonFactory; import exfex.common.displaysystem.ICheckBox; import exfex.common.displaysystem.ICheckBoxFactory; import exfex.common.displaysystem.IComboBox; import exfex.common.displaysystem.IComboBoxFactory; import exfex.common.displaysystem.IContainer; import exfex.common.displaysystem.IContainerFactory; import exfex.common.displaysystem.IDisplayManager; import exfex.common.displaysystem.ILabel; import exfex.common.displaysystem.ILabelFactory; import exfex.common.displaysystem.IPrimitivesFactory; import exfex.common.pluginsystem.Context; import exfex.common.pluginsystem.IAcceptPlugin; import exfex.common.pluginsystem.IContext; import exfex.common.pluginsystem.IInject; import exfex.common.pluginsystem.PluginException; /** Plugin for SWING primitives creation. * * This plugin should be used by clients to create primitives of simple SWING * type. * All methods for creation have genereal form get{Primitive} * (us concrete primitive name - such as Button, Label - instead {Primitive}. * * <br><b>Plugin Name</b>: "SWINGPrimitivesFactory" * <br><b>Depends</b>: * <ul> * <li>DisplayManager - with no strategy * </ul> * <br><b>Special notes</b>: * <ul> * <li>All methods can throw an exception, if primitive's plugin is not * registered. * <li>Supposed to be local (not RMI) object returned by DisplayManager. * </ul> * * <pre> * Changes: * 4.9.2005 msts - created * </pre> * * @author msts */ public class SWINGPrimitivesFactory implements IPrimitivesFactory { /** Manager, where this plugin is registered. * * This plugin such as all graphics registers itself to the * DisplayManager instance. This field is filled in registerMe method. */ @IInject() IDisplayManager manager; /** Plugin name. */ static private String name="SWINGPrimitivesFactory"; /** Factory to create SWING labels. * * This field is assigned on demand. Gets it from display manager. */ private ILabelFactory labelFactory; /** Factory to create check boxes. * * This field is assigned on demand. Gets it from display manager. */ private ICheckBoxFactory checkBoxFactory; /** Factory to create SWING buttons. * * This field is assigned on demand. Gets it from display manager. */ private IButtonFactory buttonFactory; /** Factory to create SWING combo boxes. * * This field is assigned on demand. Gets it from display manager. */ private IComboBoxFactory comboBoxFactory; /** Factory to create SWING containers. * * This field is assigned on demand. Gets it from display manager. */ private IContainerFactory containerFactory; // IPrimitivesFactory implementation /** Creates SWING button and initialize it according setting. * * Creates new SWING button. Initialize it according given setting. * Following keys (from property object) are interpreted: * <ul> * <li>TEXT - sets text (property value) of the button * </ul> * * @param setting Setting object. */ public IButton getButton(Properties setting)throws PluginException//{{{ { IButton result; // get button factory from display manager if not set yet if(buttonFactory==null) buttonFactory=(IButtonFactory)manager.getByName(IButtonFactory.class,"SWINGButton"); result=buttonFactory.getButton(null); if(setting!=null) { // perform setting according given from parameter Enumeration<?> names=setting.propertyNames(); while(names.hasMoreElements()) { String name=(String)names.nextElement(); // sets button according setting if(name.equals("TEXT")) { result.setText(setting.getProperty(name)); continue; } } } return result; }//}}} /** Creates SWING label and initialize it according setting. * * Creates new SWING label. Initialize it according given setting. * Following keys (from property object) are interpreted: * <ul> * <li>TEXT - sets text (property value) of the label * </ul> * * @param setting Setting object. */ public ILabel getLabel(Properties setting)throws PluginException//{{{ { ILabel result=null; // get label factory from display manager if not set yet if(labelFactory==null) { labelFactory=(ILabelFactory)manager.getByName(ILabelFactory.class,"SWINGLabel"); if(labelFactory==null) { // Unable to find SWING label factory return null; } result=labelFactory.getLabel(new Context(setting)); } return result; }//}}} public ICheckBox getCheckBox(Properties setting) throws PluginException { ICheckBox result=null; // get label factory from display manager if not set yet if(checkBoxFactory==null) { checkBoxFactory=(ICheckBoxFactory)manager.getByName(ICheckBoxFactory.class,"SWINGCheckBox"); if(checkBoxFactory==null) { // Unable to find SWING label factory return null; } result=checkBoxFactory.getCheckBox(new Context(setting)); } return result; } /** Gets Swing Combo Box. */ public IComboBox getComboBox(Properties setting) throws PluginException { IComboBox result=null; // get comboBox factory from display manager if not set yet if(comboBoxFactory==null) { comboBoxFactory=(IComboBoxFactory)manager.getByName(IComboBoxFactory.class,"SWINGComboBox"); if(comboBoxFactory==null) { // Unable to find SWING comboBox factory return null; } result=comboBoxFactory.getComboBox(new Context(setting)); } return result; } /** Gets Swing Container. */ public IContainer getContainer(Properties setting) throws PluginException { IContainer result=null; // get container factory from display manager if not set yet if(containerFactory==null) { containerFactory=(IContainerFactory)manager.getByName(IContainerFactory.class,"SWINGContainers"); if(containerFactory==null) { // Unable to find SWING container factory return null; } result=containerFactory.getContainer(new Context(setting)); } return result; } // IPlugin interface implementation /** Returns plugin name. */ public String getName() { return name; } /** Returns plugin's manager. */ public IAcceptPlugin getManager() { return manager; } /** Returns instance of manager. * * Returns new instance of this class. * <p> * NOTE: Ignores context parameter. * * @param context Context of instancing. * @return SessionManager instance. */ public Object getInstance(IContext context) { return new SWINGPrimitivesFactory(); } /** Plugin Registration method. * * Registers this manager to the plugin manager. */ public void registerMe() { try { manager.attach(this); }catch(Exception e) { /* Should'n happen * TODO: handle */ } } /** Plugin un registration method. * * Unregisters this manager from the plugin manager. */ public void unRegisterMe() { try { manager.dettach(this); }catch(Exception e) { /* Should'n happen * TODO: handle */ } } public void dependencyNotify() { } } |
From: Michal H. <ms...@us...> - 2005-10-18 17:55:59
|
Update of /cvsroot/exfex/exfex/source/exfex/common/plugins/remote/displaysystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14183/source/exfex/common/plugins/remote/displaysystem Added Files: BasicRemoteSessionManagerFactory.java BasicRemoteSessionManager.java Log Message: remote view session manager plugin + helper class --- NEW FILE: BasicRemoteSessionManagerFactory.java --- /* * $RCSfile: BasicRemoteSessionManagerFactory.java,v $ * * $Log: BasicRemoteSessionManagerFactory.java,v $ * Revision 1.1 2005/10/18 17:55:21 mstsxfx * remote view session manager plugin + helper class * */ package exfex.common.plugins.remote.displaysystem; import java.util.Properties; import exfex.common.displaysystem.ISessionManager; import exfex.common.pluginsystem.AbstractPlugin; import exfex.common.pluginsystem.Context; import exfex.common.pluginsystem.IContext; import exfex.common.pluginsystem.PluginManager; import exfex.common.remote.displaysystem.IRemoteSessionManager; import exfex.common.remote.displaysystem.IRemoteSessionManagerFactory; /** Plugin for creating remote session manager view instance. * * This plugin creates instances of BasicRemoteSessionManager * class which is used as remote view to the SessionManager instance. Instances * should be created by <code>remoteView</code> method which gets manager name * as paramter. * <p> * <br><b>Plugin Name</b>: "BasicRemoteSessionManager" * <br><b>Special notes</b>: * <ul> * <li> Registers itself to the PluginManager. * <li> Needs BasicRemoteSessionManager class which is not plugin, but can't be * in this file because of class access public modificator. * <li> Produces BasicRemoteSessionManager instances according SessionManager * name. * <li> Doesn't register created instance to the Naming service, so it can be * accessed as service until regstering (see example at the bottom). * <li> <code>getInstance</code> respectively <code>remoteView</code> can return * with null, if BasicRemoteSessionManager can't be created. * </ul> * * <pre> * // Using plugin BasicRemoteSessionManagerFactory gets remote session manager * // view. NOTE that we doesn't catch exceptions which has to be done in real * // world application * IRemoteSessionManagerFactory plugin=PluginManager.getByName( * IRemoteSessionManagerFactory.class, * "BasicRemoteSessionManager"); * // Now we get remote view of manager from plugin. * IRemoteSessionManager remoteView=plugin.remoteView(); * * // bind remoteView instance with the server_name host on port as * // SessionManager service. Using Naming.lookup can be found there. * Naming.rebind("rmi://{server_name}{:port}/SessionManager", manager); * </pre> * <p> * <pre> * Changes: * 18.10.2005 msts - created * </pre> * * @author msts */ public class BasicRemoteSessionManagerFactory extends AbstractPlugin implements IRemoteSessionManagerFactory { private static final long serialVersionUID = 1L; /** This plugin will register to the PluginManager. */ private PluginManager manager=PluginManager.getInstance(); /** Initializating constructor. * * Calls sepertype constructor with plugin name parameter and sets * manager. */ public BasicRemoteSessionManagerFactory() { super(new String("BasicRemoteSessionManager")); setManager(manager); } /** Creates instance of BasicRemoteSessionManager type according * context. * * This method shouldn't be used directly. Clients should rather use * {@link #remoteView(String)} method. * * @param context Context fro creation. Just value with NAME key is used * to find SessionManager with value name. Doesn't check if parameter is * null. * * @return BasicRemoteSessionManager instance or null if SessionManager * couldn't be found or BasicRemoteSessionManager can't be created. */ @Override public Object getInstance(IContext context) { String name=context.getContext().getProperty("NAME"); BasicRemoteSessionManager result=null; if(name!=null) { try { // gets sessionManager from registered on // plugin manager according name ISessionManager sessionMng=(ISessionManager) manager.getByName( ISessionManager.class, name); // creates result from returned plugin result=new BasicRemoteSessionManager( (ISessionManager) sessionMng.getInstance(null)); }catch(Exception e) { // TODO handle - log } } return result; } /** Creates IRemoteSessionManager instance from session manager with * given name. * * Creates context for <code>getInstance</code> method containing name. * @param managerName SessionManager plugin name. * * @return IRemoteSessionManager instance or null if given name is null, * session manager plugin with given name doesn't exist or * BasicRemoteSessionManager instance can't be created. */ public IRemoteSessionManager remoteView(String managerName) { if(managerName==null) return null; // creates context Properties prop=new Properties(); prop.put("NAME",managerName); IContext context=new Context(prop); // creates instance using context return (IRemoteSessionManager)getInstance(context); } } --- NEW FILE: BasicRemoteSessionManager.java --- /* * $RCSfile: BasicRemoteSessionManager.java,v $ * * $Log: BasicRemoteSessionManager.java,v $ * Revision 1.1 2005/10/18 17:55:21 mstsxfx * remote view session manager plugin + helper class * */ package exfex.common.plugins.remote.displaysystem; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; import java.util.List; import exfex.common.displaysystem.ISession; import exfex.common.displaysystem.ISessionFactory; import exfex.common.displaysystem.ISessionManager; import exfex.common.pluginsystem.PluginException; import exfex.common.pluginsystem.PluginSecurityException; import exfex.common.remote.displaysystem.IRemoteSessionManager; import exfex.common.remote.security.IRemoteIdentity; import exfex.common.security.IIdentity; /** Remote view of a SessionManager. * * This class is adapter for ISessionManager type used by * {@link exfex.common.remote.displaysystem.IRemoteSessionManagerFactory} * plugin and it creates secure service to control plugin system. Each method * accepts identity parameter to perform security checking for authorization of * given identity for operation. If identity is authorized, delegates operation * to the local SessionManager set in constructor. * <br> * Extends UnicastRemoteObject to behave as RMI object (it can be used as remote * object using RMI mechanism). This instance should be registered by Naming * service to be accessible remotly as service. * <br> * This class is not plugin but it is used by BasicRemoteSessionManagerFactory * plugin. * <p> * <pre> * Changes: * 18.10.2005 msts - created * </pre> * * @author msts */ public class BasicRemoteSessionManager extends UnicastRemoteObject implements IRemoteSessionManager { private static final long serialVersionUID = 1L; /** Local view of the session manager. * All operations are delegated to this instance. */ private final ISessionManager localView; /** Constructor without intialization. * This constructor is disabled to avoid uninitialized class creation. * */ private BasicRemoteSessionManager()throws RemoteException { localView=null; } /** Initializating constructor. * * Calls supertype constructor without parameters and sets localView * field instance from given parameter. * * @param localView Local view to the SessionManager. * @throws RemoteException if unable to initialize UnicastRemoteObject. * @throws NullPointerException If localView parameter is null. */ public BasicRemoteSessionManager(ISessionManager localView) throws RemoteException, NullPointerException { super(); if(localView==null) throw new NullPointerException(new String("Given localView is null")); this.localView=localView; } /** Returns actives top level sessions. * * TODO id and security layer. * * Delegates operation to the localView instance using * {@link ISessionManager#getActive()} method. * * @param id Caller identificator. * @return Array of sessions. * @throws RemoteException If problem during RMI call occures. * @throws PluginSecurityException if unauthorized id requieres this * operation. */ synchronized public ISession [] getActive(IRemoteIdentity id) throws RemoteException, PluginSecurityException//{{{ { // TODO security return localView.getActive(); }//}}} /** Registers new toplevel session. * * TODO id and security layer. * * Delegates operation to the localView instance using * {@link ISessionManager#registerSession(ISessionFactory)} method. * * @param id Caller identificator. * @param sessionplugin Plugin for session creation. * @return Created session. * @throws RemoteException If problem during RMI call occures. * @throws PluginSecurityException if unauthorized id requieres this * operation. */ synchronized public ISession registerSession(IRemoteIdentity id, ISessionFactory sessionplugin) throws RemoteException, PluginSecurityException//{{{ { // TODO security return localView.registerSession(sessionplugin); }//}}} /** Creates new child session. * * TODO id and security layer. * * Delegates operation to the localView instance using * {@link ISessionManager#execSession(ISession, ISessionFactory)} * method. * * @param id Caller identificator. * @param session Parent session. * @param sessionplugin Plugin for session creation. * @return Created session. * @throws RemoteException If problem during RMI call occures. * @throws PluginSecurityException if unauthorized id requieres this * operation. */ synchronized public ISession execSession(IIdentity id, ISession session, ISessionFactory sessionplugin) throws RemoteException, PluginSecurityException//{{{ { // FIXME security return localView.execSession(session, sessionplugin); }//}}} /** Returns all sessions' factories. * * TODO id and security layer. * * Delegates operation to the localView instance using * {@link ISessionManager#getSessionFactories()} method. * * @param id Caller identificator. * @return list of all registered plugin factories. * @throws PluginException If no session factory is registered on this * manager. * @throws RemoteException If problem during RMI call occures. * @throws PluginSecurityException if unauthorized id requieres this * operation. */ synchronized public List<ISessionFactory> getSessionFactories(IRemoteIdentity id) throws PluginException, RemoteException, PluginSecurityException//{{{ { // FIXME security return localView.getSessionFactories(); }//}}} /** Kills session. * * TODO id and security layer. * * Delegates operation to the localView instance using * {@link ISessionManager#killSession(ISession)} method. * * @param id Caller identificator. * @param session Session to kill. * @throws RemoteException If problem during RMI call occures. * @throws PluginSecurityException if unauthorized id requieres this * operation. */ synchronized public void killSession(IIdentity id, ISession session) throws RemoteException, PluginSecurityException//{{{ { // FIXME security localView.killSession(session); }//}}} } |
From: Michal H. <ms...@us...> - 2005-10-18 17:55:24
|
Update of /cvsroot/exfex/exfex/source/exfex/common/plugins/remote/displaysystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14127/source/exfex/common/plugins/remote/displaysystem Log Message: Directory /cvsroot/exfex/exfex/source/exfex/common/plugins/remote/displaysystem added to the repository |
From: Michal H. <ms...@us...> - 2005-10-18 17:54:49
|
Update of /cvsroot/exfex/exfex/source/exfex/common/plugins/remote/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13990/source/exfex/common/plugins/remote/pluginsystem Added Files: BasicRemotePluginManager.java BasicRemotePluginManagerFactory.java Log Message: plugin for remote view of plugin manager + helper class --- NEW FILE: BasicRemotePluginManagerFactory.java --- /* * $RCSfile: BasicRemotePluginManagerFactory.java,v $ * * $Log: BasicRemotePluginManagerFactory.java,v $ * Revision 1.1 2005/10/18 17:54:41 mstsxfx * plugin for remote view of plugin manager + helper class * */ package exfex.common.plugins.remote.pluginsystem; import exfex.common.pluginsystem.AbstractPlugin; import exfex.common.pluginsystem.IContext; import exfex.common.pluginsystem.IPluginPolicy; import exfex.common.pluginsystem.IPluginStrategy; import exfex.common.pluginsystem.PluginManager; import exfex.common.remote.pluginsystem.IRemotePluginManager; import exfex.common.remote.pluginsystem.IRemotePluginManagerFactory; /** Plugin for creating remote plugin manager view instance. * * This plugin creates and holds instance of BasicRemotePluginManager * class which is used as remote view to the PluginManager instance. Instance * is created when first asked by <code>getInstance</code> or * <code>remoteView</code> methods. It follows singleton design pattern, so each * time the same instance is returned. * <p> * <br><b>Plugin Name</b>: "BasicRemotePluginManager" * <br><b>Special notes</b>: * <ul> * <li> Registers itself to the PluginManager. * <li> Needs BasicRemotePluginManager class which is not plugin, but can't be * in this file because of class access public modificator. * <li> Produces BasicRemotePluginManager instance (each time same). * <li> Doesn't register created instance to the Naming service, so it can be * accessed as service until regstering (see example at the bottom). * <li> <code>getInstance</code> respectively <code>remoteView</code> can return * with null, if BasicRemotePluginManager can't be created. * </ul> * * <pre> * // Using plugin BasicRemotePluginManagerFactory gets remote plugin manager * // view. NOTE that we doesn't catch exceptions which has to be done in real * // world application * IRemotePluginManagerFactory plugin=PluginManager.getByName( * IRemotePluginManagerFactory.class, * "BasicRemotePluginManager"); * // Now we get remote view of manager from plugin. * IRemotePluginManager remoteView=plugin.remoteView(); * * // bind remoteView instance with the server_name host on port as * // PluginManager service. Using Naming.lookup can be found there. * Naming.rebind("rmi://{server_name}{:port}/PluginManager", manager); * </pre> * <p> * <pre> * Changes: * 18.10.2005 msts - created * </pre> * * @author msts */ @IPluginPolicy( replaceStrategy=IPluginStrategy.Type.ATLEAST, version=1, author="msts", description="Basic plugin for creating remote PluginManager" + "view to enable remote manipulating plugin system."+ "To work properly this plugin needs also "+ "BasicRemotePluginManager class in same package.") public class BasicRemotePluginManagerFactory extends AbstractPlugin implements IRemotePluginManagerFactory { private static final long serialVersionUID = 1L; /** Manager local view instance. * We will register on this manager. */ private PluginManager manager=PluginManager.getInstance(); /** Remote view of the PluginManager created from local view. * */ private IRemotePluginManager remoteView=null; /** Initializating constructor. * Calls supertype constructor with name parameter and sets manager on * the supertype. * */ public BasicRemotePluginManagerFactory() { super(new String("BasicRemotePluginManager")); setManager(manager); } /** Returns instance of BasicRemotePluginManager class. * * If remoteView field is null, creates new instance, otherwise returns * each time same instance. * <br> * TODO handle situation when instance can't be created. * * @param context This parameter is ignored. * @return BasicRemotePluginManager instance or null if not able to * create. */ @Override public Object getInstance(IContext context) { if (remoteView==null) { try { remoteView=(IRemotePluginManager)new BasicRemotePluginManager(manager); }catch(Exception e) { // TODO handle - log information } } return remoteView; } /** Calls getInstance and cast result to IRemotePluginManager. * @return IRemotePluginManager instance or null, if not able to create * instance. */ public IRemotePluginManager remoteView() { return (IRemotePluginManager)getInstance(null); } } --- NEW FILE: BasicRemotePluginManager.java --- /* * $RCSfile: BasicRemotePluginManager.java,v $ * * $Log: BasicRemotePluginManager.java,v $ * Revision 1.1 2005/10/18 17:54:41 mstsxfx * plugin for remote view of plugin manager + helper class * * Revision 1.1 2005/10/17 19:47:55 mstsxfx * remote view of the PluginManager * */ package exfex.common.plugins.remote.pluginsystem; import java.io.File; import java.io.IOException; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; import java.util.List; import exfex.common.pluginsystem.IPlugin; import exfex.common.pluginsystem.PluginException; import exfex.common.pluginsystem.PluginLoadException; import exfex.common.pluginsystem.PluginManager; import exfex.common.pluginsystem.PluginSecurityException; import exfex.common.remote.pluginsystem.IRemotePluginManager; import exfex.common.remote.security.IRemoteIdentity; /** Remote view of the PluginManager. * * This class is adapter for PluginManager used by * {@link exfex.common.plugins.remote.pluginsystem.BasicRemotePluginManagerFactory} * plugin and it creates secure service to control plugin system. Each method * accepts identity parameter to perform security checking for authorization of * given identity for operation. If identity is authorized, delegates operation * to the local PluginManager. * <br> * Extends UnicastRemoteObject to behave as RMI object (it can be used as remote * object using RMI mechanism). This instance should be registered by Naming * service to be remotly accessible. * * <p> * <pre> * Changes: * 17.10.2005 msts - created * </pre> * * @author msts */ public class BasicRemotePluginManager extends UnicastRemoteObject implements IRemotePluginManager { private static final long serialVersionUID = 1L; /** Delagated PluginManager. * Value is intialized in constructor. */ private final PluginManager manager; /** Constructor without initialization. * This constructor is forbiden because we wants full control upon * intialization. * */ private BasicRemotePluginManager()throws RemoteException { manager=null; } /** Initializing constructor. * * Calls supertype constructor without parameters and intialize manager * field. * * @param localView Instance of local view of the manager. * @throws RemoteException If UnicastRemoteObject constructors fails. * @throws NullPointerException if given view is null. */ public BasicRemotePluginManager(PluginManager localView) throws RemoteException, NullPointerException { super(); if(localView==null) throw new NullPointerException(new String("Given localView is null")); this.manager=localView; } /** Returns all registered (ready to use) plugins. * * TODO id and security layer. * * Calls {@link exfex.common.pluginsystem.PluginManager#readyPlugins()} * method after security checks. * <br> * Changes to this list takes no effect to the manager's list. * * @param id Identity of the caller caller. * @return List of ready plugins. * @throws RemoteException If problem during RMI call occures. * @throws PluginSecurityException if unauthorized id requieres this * operation. */ synchronized public List<IPlugin> readyPlugins(IRemoteIdentity id) throws RemoteException,PluginSecurityException//{{{ { // FIXME id integrity and authorization check return manager.readyPlugins(); }//}}} /** Returns all plugins waiting for dependencies. * * TODO id and security layer. * Returns copy of depList (list of schedulled plugins). Changes to this * list takes no effect to manager's list. * * @param id Identity of the caller. * @return List of not registered plugins. * @throws RemoteException If problem during RMI call occures. * @throws PluginSecurityException if unauthorized id requieres this * operation. */ synchronized public List<IPlugin> pendingPlugins(IRemoteIdentity id) throws RemoteException,PluginSecurityException//{{{ { // FIXME id integrity and authorization check return manager.pendingPlugins(); }//}}} /** Uploads plugin to the hierarchy. * TODO */ public void uploadFile(IRemoteIdentity id, File file, String location) throws RemoteException, IOException { // FIXME id integrity and authorization check // TODO implement } /** Schedules plugin for loading. * * TODO id and security layer. * * Calls {@link PluginManager#schedule(String[])} method for rest of the * job. * * @param id Identity of the caller. * @param plugnames Plugins to schedule. * @throws PluginLoadException if fetch method failes. * @throws PluginSecurityException if given identity is not authorized * to perform operation. * @throws RemoteException if RMI error occures during operation. */ synchronized public void schedule(IRemoteIdentity id, String[] plugnames) throws PluginLoadException, PluginSecurityException, RemoteException { // it's not an error, to get null list, it means that nothing // should be done if(plugnames==null) return; // FIXME id check manager.schedule(plugnames); } /** Try to to load plugin. * * TODO id and security layer. * * Calls {@link PluginManager#loadTest(String)} method for rest of the * job. * * @param id Identity of the caller. * @param plugin plugin to load. * @return true if plugin can be immediately, false otherwise. * @throws PluginSecurityException if given identity is not authorized * to perform operation. * @throws RemoteException if RMI error occures during operation. */ synchronized public boolean loadTest(IRemoteIdentity id, String plugin) throws PluginSecurityException, RemoteException { // FIXME id check return manager.loadTest(plugin); } /** Load schedulled plugins. * * TODO id and security layer. * * Calls {@link PluginManager#load()} method for rest of the job. * * @see PluginManager#solveDependencies * @param id Identity of the caller. * @throws PluginLoadException if critical error occures during plugin * dependencies resolving. * @throws PluginSecurityException if given identity is not authorized * to perform operation. * @throws RemoteException if RMI error occures during operation. * */ public synchronized void load(IRemoteIdentity id) throws PluginLoadException, PluginSecurityException, RemoteException //{{{ { // FIXME id check manager.load(); }//}}} /** Get plugin out of the system. * * TODO id and security layer. * * Delegates all work to the {@link PluginManager#remove(IPlugin)} * method. * * @param id Identity of the caller. * @param plugin Plugin to remove. * @throws PluginException If plugin error occures (see getMessage for * more info) * @throws PluginSecurityException if given identity is not authorized * to perform operation. * @throws RemoteException if RMI error occures during operation. */ public synchronized void purge(IRemoteIdentity id, IPlugin plugin) throws PluginException, PluginSecurityException, RemoteException//{{{ { // FIXME id check manager.remove(plugin); }//}}} /** Retuns all plugins registered in the PluginManager compatible with * given type. * * TODO id and security layer. Enables just plugins that are type * compatible with Remote interface to gurantee just remote services * as return value. * * Delegates all work to the * {@link exfex.common.pluginsystem.IAcceptPlugin#getByIface(Class)} * method. * * @param id Identity of the caller. * @param plgType * @throws PluginException If plugin error occures (see getMessage for * more info) * @throws PluginSecurityException if given identity is not authorized * to perform operation. * @throws RemoteException if RMI error occures during operation. */ public List<IPlugin> getByIface(IRemoteIdentity id, Class<?> plgType) throws PluginException, RemoteException, PluginSecurityException { // FIXME security return manager.getByIface(plgType).toList(); } /** Retuns plugin regitered in the PluginManager with the given name and * type. * * TODO id and security layer. Enables just plugin that is type * compatible with Remote interface to gurantee just remote services * as return value. * * Delegates all work to the * {@link exfex.common.pluginsystem.IAcceptPlugin#getByName(Class, String)} * method. * * @param id Identity of the caller. * @param plgType Plugin type. * @param name Plugin name. * @throws PluginException If plugin error occures (see getMessage for * more info) * @throws PluginSecurityException if given identity is not authorized * to perform operation. * @throws RemoteException if RMI error occures during operation. */ public IPlugin getByName(IRemoteIdentity id, Class<?> plgType, String name) throws PluginException, RemoteException, PluginSecurityException { // FIXME security return manager.getByName(plgType, name); } } |
From: Michal H. <ms...@us...> - 2005-10-18 17:54:43
|
Update of /cvsroot/exfex/exfex/source/exfex/common/plugins/remote/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13924/source/exfex/common/plugins/remote/pluginsystem Log Message: Directory /cvsroot/exfex/exfex/source/exfex/common/plugins/remote/pluginsystem added to the repository |