exfex-cvs-commit Mailing List for Extended Form of examination (Page 3)
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-27 13:20:45
|
Update of /cvsroot/exfex/exfex/docbook/RemoteSystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27650/docbook/RemoteSystem Added Files: .keep.txt Log Message: directories for docbook documentation --- NEW FILE: .keep.txt --- |
From: Michal H. <ms...@us...> - 2005-11-27 13:20:36
|
Update of /cvsroot/exfex/exfex/docbook/PluginSystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27650/docbook/PluginSystem Added Files: .keep.txt Log Message: directories for docbook documentation --- NEW FILE: .keep.txt --- |
From: Michal H. <ms...@us...> - 2005-11-27 13:20:36
|
Update of /cvsroot/exfex/exfex/docbook/LoggingSystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27650/docbook/LoggingSystem Added Files: .keep.txt Log Message: directories for docbook documentation --- NEW FILE: .keep.txt --- |
From: Michal H. <ms...@us...> - 2005-11-27 13:20:31
|
Update of /cvsroot/exfex/exfex/docbook/RemoteSystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27608/docbook/RemoteSystem Log Message: Directory /cvsroot/exfex/exfex/docbook/RemoteSystem added to the repository |
From: Michal H. <ms...@us...> - 2005-11-27 13:20:31
|
Update of /cvsroot/exfex/exfex/docbook/PluginSystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27608/docbook/PluginSystem Log Message: Directory /cvsroot/exfex/exfex/docbook/PluginSystem added to the repository |
From: Michal H. <ms...@us...> - 2005-11-27 13:20:30
|
Update of /cvsroot/exfex/exfex/docbook/LoggingSystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27608/docbook/LoggingSystem Log Message: Directory /cvsroot/exfex/exfex/docbook/LoggingSystem added to the repository |
From: Michal H. <ms...@us...> - 2005-11-27 13:18:57
|
Update of /cvsroot/exfex/exfex/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27217/doc Added Files: .cvsignore Log Message: doc ignore file for cvs --- NEW FILE: .cvsignore --- exfex index-files resources allclasses-frame.html allclasses-noframe.html constant-values.html deprecated-list.html help-doc.html index.html overview-frame.html overview-summary.html overview-tree.html package-list serialized-form.html stylesheet.css |
Update of /cvsroot/exfex/exfex/docbook/SecuritySystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26677/docbook/SecuritySystem Added Files: identity.png authorization.dia authorization_scenario.dia identity.dia classes_overview.dia authorization_scenario.png authorization.png Log Message: security system schemes --- NEW FILE: authorization_scenario.dia --- (This appears to be a binary file; contents omitted.) --- NEW FILE: authorization.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: authorization_scenario.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: authorization.dia --- (This appears to be a binary file; contents omitted.) --- NEW FILE: identity.dia --- (This appears to be a binary file; contents omitted.) --- NEW FILE: classes_overview.dia --- (This appears to be a binary file; contents omitted.) --- NEW FILE: identity.png --- (This appears to be a binary file; contents omitted.) |
From: Michal H. <ms...@us...> - 2005-11-27 13:15:56
|
Update of /cvsroot/exfex/exfex/docbook/SecuritySystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26658/docbook/SecuritySystem Log Message: Directory /cvsroot/exfex/exfex/docbook/SecuritySystem added to the repository |
From: Michal H. <ms...@us...> - 2005-11-27 13:12:29
|
Update of /cvsroot/exfex/exfex/doc/konvencie In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25939/doc/konvencie Added Files: Plugin.java Log Message: plugin doc template --- NEW FILE: Plugin.java --- /** * $RCSfile: Plugin.java,v $ * * $Log: Plugin.java,v $ * Revision 1.1 2005/11/27 13:12:21 mstsxfx * plugin doc template * */ /** * Factory to produce .... * * <br><b>Plugin Name</b>: "name of the plugin" * <br><b>Depends</b>: * <ul> * <li>dependency1 - some comments * <li>dependency2 - * <li> ... * </ul> * <br><b>Special notes</b>: * <ul> * <li>Returned object is ... * <li>Registers itself to the - manager type * </ul> * * Other comments and notes to use plugin correctly * * <pre> * Changes: * Changes history * </pre> */ public class Plugin { private String name="PluginName" } |
From: Michal H. <ms...@us...> - 2005-11-27 13:11:18
|
Update of /cvsroot/exfex/exfex/source/exfex/common/plugins/remote/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25553/source/exfex/common/plugins/remote/pluginsystem Modified Files: BasicRemotePluginManager.java Log Message: sync with ecurityexception package change Index: BasicRemotePluginManager.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/plugins/remote/pluginsystem/BasicRemotePluginManager.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** BasicRemotePluginManager.java 1 Nov 2005 20:18:58 -0000 1.3 --- BasicRemotePluginManager.java 27 Nov 2005 13:11:07 -0000 1.4 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.4 2005/11/27 13:11:07 mstsxfx + * sync with ecurityexception package change + * * Revision 1.3 2005/11/01 20:18:58 mstsxfx * Sync with interface changes *************** *** 32,36 **** import exfex.common.pluginsystem.PluginLoadException; import exfex.common.pluginsystem.PluginManager; - import exfex.common.pluginsystem.PluginSecurityException; import exfex.common.remote.IRemote; import exfex.common.remote.pluginsystem.IRemotePluginManager; --- 35,38 ---- *************** *** 116,124 **** * @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, Class<?> typeMask) ! throws RemoteException,PluginSecurityException//{{{ { // FIXME id integrity and authorization check --- 118,126 ---- * @return List of ready plugins names. * @throws RemoteException If problem during RMI call occures. ! * @throws SecurityException if unauthorized id requieres this * operation. */ synchronized public Pair<Class<? extends IPlugin>, String>[] readyPlugins(IRemoteIdentity id, Class<?> typeMask) ! throws RemoteException,SecurityException//{{{ { // FIXME id integrity and authorization check *************** *** 144,152 **** * @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, Class<?> typeMask) ! throws RemoteException,PluginSecurityException//{{{ { // FIXME id integrity and authorization check --- 146,154 ---- * @return Array of plugin type and name pairs. * @throws RemoteException If problem during RMI call occures. ! * @throws SecurityException if unauthorized id requieres this * operation. */ synchronized public Pair<Class<? extends IPlugin>, String>[] pendingPlugins(IRemoteIdentity id, Class<?> typeMask) ! throws RemoteException,SecurityException//{{{ { // FIXME id integrity and authorization check *************** *** 176,185 **** * @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 --- 178,187 ---- * @param plugnames Plugins to schedule. * @throws PluginLoadException if fetch method failes. ! * @throws SecurityException 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, SecurityException, RemoteException { // it's not an error, to get null list, it means that nothing *************** *** 203,212 **** * @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 --- 205,214 ---- * @param plugin plugin to load. * @return true if plugin can be immediately, false otherwise. ! * @throws SecurityException 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 SecurityException, RemoteException { // FIXME id check *************** *** 225,229 **** * @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. --- 227,231 ---- * @throws PluginLoadException if critical error occures during plugin * dependencies resolving. ! * @throws SecurityException if given identity is not authorized * to perform operation. * @throws RemoteException if RMI error occures during operation. *************** *** 231,235 **** */ public synchronized void load(IRemoteIdentity id) ! throws PluginLoadException, PluginSecurityException, RemoteException //{{{ { // FIXME id check --- 233,237 ---- */ public synchronized void load(IRemoteIdentity id) ! throws PluginLoadException, SecurityException, RemoteException //{{{ { // FIXME id check *************** *** 252,256 **** * @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. --- 254,258 ---- * @throws PluginException If plugin error occures (see getMessage for * more info) ! * @throws SecurityException if given identity is not authorized * to perform operation. * @throws RemoteException if RMI error occures during operation. *************** *** 259,263 **** Class<? extends IPlugin> type, String name) ! throws PluginException, PluginSecurityException, RemoteException//{{{ { // FIXME id check --- 261,265 ---- Class<? extends IPlugin> type, String name) ! throws PluginException, SecurityException, RemoteException//{{{ { // FIXME id check *************** *** 282,291 **** * @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 --- 284,293 ---- * @throws PluginException If plugin error occures (see getMessage for * more info) ! * @throws SecurityException 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, SecurityException { // FIXME security *************** *** 311,323 **** * @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 if(!PluginComparator.isCompatible(IRemote.class,plgType)) ! throw new PluginException("Given plugin Type="+plgType)+" is not for remote usage."; return manager.getByName(plgType, name); } --- 313,325 ---- * @throws PluginException If plugin error occures (see getMessage for * more info) ! * @throws SecurityException 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, SecurityException { // FIXME security if(!PluginComparator.isCompatible(IRemote.class,plgType)) ! throw new PluginException("Given plugin Type="+plgType+" is not for remote usage."); return manager.getByName(plgType, name); } |
From: Michal H. <ms...@us...> - 2005-11-27 13:10:10
|
Update of /cvsroot/exfex/exfex/source/exfex/common/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24933/source/exfex/common/utils Added Files: IdAssigner.java Base64.java Log Message: new helper classes --- NEW FILE: IdAssigner.java --- /* * $RCSfile: IdAssigner.java,v $ * * $Log: IdAssigner.java,v $ * Revision 1.1 2005/11/27 13:10:01 mstsxfx * new helper classes * */ package exfex.common.utils; import java.util.LinkedList; import java.util.List; /** Helper class for id generating. * * Responsibility of this object is to generate unique id numbers when * {@link #get()} method is called. If some id is not used anymore, * {@link #release(Integer)} method should be called. * <br> * Class is not synchronized and so it has to be synchronized externally. * <p> * <pre> * Changes: * 28.10.2005 msts - created * </pre> * * @author msts */ public class IdAssigner { /** Top value generated so far. */ private Integer top=new Integer(0); /** List of released ids. */ private List<Integer> releaseList=new LinkedList<Integer>(); /** Returns new id. * * <h3>Generating process</h3> * In first step try to reuse released id, this means that it looks to * the <code>releaseList</code> and if it's not empty, gets 1st one and * removes it from the list. This id is returned. * <br> * If unable to reuse id, try to increase top value and returns it. This * may fail, because of overflow. However this shouldn't happen if * ids are released properly. * * @see #release(Integer) * @return New identificator or null if all ids has been generated yet. */ public Integer get() { // at first try to reuse released id if(releaseList.size()>0) return releaseList.remove(0); // if we have consumed all values, return null - THIS SHOULDN'T // happen if(top.intValue()==Integer.MAX_VALUE) return null; // increase top value and returns it Integer id=top.intValue()+1; top=new Integer(id); return id; } /** Releases given id. * * Prepares id for reuse. We want to reuse the oldest released ids, so * id is inserted to the end of the <code>releaseList</code> list. * TODO we could decrease top value if it can be done. * * @param id Id to release. * @see #get() */ public void release(Integer id) { // inserts id to the end of the releaseList releaseList.add(releaseList.size(),id); } } --- NEW FILE: Base64.java --- /* * $RCSfile: Base64.java,v $ * * $Log: Base64.java,v $ * Revision 1.1 2005/11/27 13:10:01 mstsxfx * new helper classes * */ package exfex.common.utils; import java.io.*; /** * This class contains two static methods for Base64 encoding and decoding. * <br> * NOTE: ported from - TODO find out from where * * @author msts */ public class Base64 { /** * Decodes BASE64 encoded string. * @param encoded string * @return decoded data as byte array */ public static byte[] decode(String encoded) { int i; byte output[] = new byte[3]; int state; ByteArrayOutputStream data = new ByteArrayOutputStream(encoded.length()); state = 1; for (i = 0; i < encoded.length(); i++) { byte c; { char alpha = encoded.charAt(i); if (Character.isWhitespace(alpha)) continue; if ((alpha >= 'A') && (alpha <= 'Z')) c = (byte) (alpha - 'A'); else if ((alpha >= 'a') && (alpha <= 'z')) c = (byte) (26 + (alpha - 'a')); else if ((alpha >= '0') && (alpha <= '9')) c = (byte) (52 + (alpha - '0')); else if (alpha == '+') c = 62; else if (alpha == '/') c = 63; else if (alpha == '=') break; // end else return null; // error } switch (state) { case 1 : output[0] = (byte) (c << 2); break; case 2 : output[0] |= (byte) (c >>> 4); output[1] = (byte) ((c & 0x0F) << 4); break; case 3 : output[1] |= (byte) (c >>> 2); output[2] = (byte) ((c & 0x03) << 6); break; case 4 : output[2] |= c; data.write(output, 0, output.length); break; } state = (state < 4 ? state + 1 : 1); } // for if (i < encoded.length()) /* then '=' found, but the end of string */ switch (state) { case 3 : data.write(output, 0, 1); return (encoded.charAt(i) == '=') && (encoded.charAt(i + 1) == '=') ? data.toByteArray() : null; case 4 : data.write(output, 0, 2); return (encoded.charAt(i) == '=') ? data.toByteArray() : null; default : return null; } else return (state == 1 ? data.toByteArray() : null); /* end of string */ } // decode private final static String base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /** * Encodes binary data by BASE64 method. * @param data binary data as byte array * @return encoded data as String */ public static String encode(byte[] data) { char output[] = new char[4]; int state = 1; int restbits = 0; int chunks = 0; StringBuffer encoded = new StringBuffer(); for (int i = 0; i < data.length; i++) { int ic = (data[i] >= 0 ? data[i] : (data[i] & 0x7F) + 128); switch (state) { case 1 : output[0] = base64.charAt(ic >>> 2); restbits = ic & 0x03; break; case 2 : output[1] = base64.charAt((restbits << 4) | (ic >>> 4)); restbits = ic & 0x0F; break; case 3 : output[2] = base64.charAt((restbits << 2) | (ic >>> 6)); output[3] = base64.charAt(ic & 0x3F); encoded.append(output); // keep no more the 76 character per line chunks++; if ((chunks % 19) == 0) encoded.append("\r\n"); break; } state = (state < 3 ? state + 1 : 1); } // for /* final */ switch (state) { case 2 : output[1] = base64.charAt((restbits << 4)); output[2] = output[3] = '='; encoded.append(output); break; case 3 : output[2] = base64.charAt((restbits << 2)); output[3] = '='; encoded.append(output); break; } return encoded.toString(); } // encode() } // Base64 |
From: Michal H. <ms...@us...> - 2005-11-27 13:09:50
|
Update of /cvsroot/exfex/exfex/source/exfex/common/remote/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24759/source/exfex/common/remote/pluginsystem Modified Files: IRemotePluginManager.java Log Message: sync with securityexception package change Index: IRemotePluginManager.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/remote/pluginsystem/IRemotePluginManager.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IRemotePluginManager.java 1 Nov 2005 20:12:37 -0000 1.5 --- IRemotePluginManager.java 27 Nov 2005 13:09:38 -0000 1.6 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.6 2005/11/27 13:09:38 mstsxfx + * sync with securityexception package change + * * Revision 1.5 2005/11/01 20:12:37 mstsxfx * methods signature changed, documentation updated *************** *** 31,35 **** import exfex.common.pluginsystem.PluginLoadException; import exfex.common.pluginsystem.PluginManager; ! import exfex.common.pluginsystem.PluginSecurityException; import exfex.common.remote.security.IRemoteIdentity; import exfex.common.remote.utils.IRemoteFileTransfer; --- 34,38 ---- import exfex.common.pluginsystem.PluginLoadException; import exfex.common.pluginsystem.PluginManager; ! import exfex.common.security.SecurityException; import exfex.common.remote.security.IRemoteIdentity; import exfex.common.remote.utils.IRemoteFileTransfer; *************** *** 113,117 **** * <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. --- 116,120 ---- * <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 SecurityException called) * * @param id Identity of the caller caller. *************** *** 119,127 **** * @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, Class<?> typeMask) ! throws RemoteException, PluginSecurityException; /** Returns all plugin type and name pairs waiting for dependencies with --- 122,130 ---- * @return Array of ready plugins types and names pairs. * @throws RemoteException If problem during RMI call occures. ! * @throws SecurityException if unauthorized id requieres this * operation. */ public Pair<Class<? extends IPlugin>, String>[] readyPlugins(IRemoteIdentity id, Class<?> typeMask) ! throws RemoteException, SecurityException; /** Returns all plugin type and name pairs waiting for dependencies with *************** *** 141,145 **** * <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. --- 144,148 ---- * <code>PLUGIN_VIEWER</code> capability should be granted to use this * method and all others should be denied (exception ! * SecurityException called) * * @param id Identity of the caller. *************** *** 147,155 **** * @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, Class<?> typeMask) ! throws RemoteException, PluginSecurityException; /** Returns plugins by interface. --- 150,158 ---- * @return Array of plugins types and names pairs. * @throws RemoteException If problem during RMI call occures. ! * @throws SecurityException if unauthorized id requieres this * operation. */ public Pair<Class<? extends IPlugin>, String>[] pendingPlugins(IRemoteIdentity id, Class<?> typeMask) ! throws RemoteException, SecurityException; /** Returns plugins by interface. *************** *** 163,167 **** * <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. --- 166,170 ---- * <code>PLUGIN_MANIPULATOR</code> capability should be granted to use * this method and all others should be denied (exception ! * SecurityException called). Security mechanism should also * guarantee that only plugins implementing IRemote interface should be * returned. *************** *** 173,181 **** * on PluginManager. * @throws RemoteException If problem during RMI call occures. ! * @throws PluginSecurityException if unauthorized id requieres this * operation. */ public List<IPlugin> getByIface(IRemoteIdentity id, Class<?> plgType) ! throws PluginException, RemoteException, PluginSecurityException; /** Returns plugin by interface and name. --- 176,184 ---- * on PluginManager. * @throws RemoteException If problem during RMI call occures. ! * @throws SecurityException if unauthorized id requieres this * operation. */ public List<IPlugin> getByIface(IRemoteIdentity id, Class<?> plgType) ! throws PluginException, RemoteException, SecurityException; /** Returns plugin by interface and name. *************** *** 189,193 **** * <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. --- 192,196 ---- * <code>PLUGIN_MANIPULATOR</code> capability should be granted to use * this method and all others should be denied (exception ! * SecurityException called). Security mechanism should also * guarantee that only plugin implementing IRemote interface should be * returned. *************** *** 199,207 **** * @throws PluginException If no given plugin doesn't exist. * @throws RemoteException If problem during RMI call occures. ! * @throws PluginSecurityException if unauthorized id requieres this * operation. */ public IPlugin getByName(IRemoteIdentity id, Class<?> plgType, String name) ! throws PluginException, RemoteException, PluginSecurityException; /** Schedules plugin for loading. --- 202,210 ---- * @throws PluginException If no given plugin doesn't exist. * @throws RemoteException If problem during RMI call occures. ! * @throws SecurityException if unauthorized id requieres this * operation. */ public IPlugin getByName(IRemoteIdentity id, Class<?> plgType, String name) ! throws PluginException, RemoteException, SecurityException; /** Schedules plugin for loading. *************** *** 216,230 **** * <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 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. */ public void schedule(IRemoteIdentity id, String[] plugnames) ! throws PluginLoadException, PluginSecurityException, RemoteException; /** Try to to load plugin. --- 219,233 ---- * <code>PLUGIN_ADMIN</code> capability should be granted to use this * method and all others should be denied (exception ! * SecurityException called) * * @param id Identity of the caller. * @param plugnames Plugins to schedule. * @throws PluginLoadException if fetch method failes. ! * @throws SecurityException if given identity is not authorized * to perform operation. * @throws RemoteException if RMI error occures during operation. */ public void schedule(IRemoteIdentity id, String[] plugnames) ! throws PluginLoadException, SecurityException, RemoteException; /** Try to to load plugin. *************** *** 238,247 **** * @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. */ public boolean loadTest(IRemoteIdentity id, String plugin) ! throws PluginSecurityException, RemoteException; /** Load schedulled plugins. --- 241,250 ---- * @param plugin plugin to load. * @return true if plugin can be immediately, false otherwise. ! * @throws SecurityException if given identity is not authorized * to perform operation. * @throws RemoteException if RMI error occures during operation. */ public boolean loadTest(IRemoteIdentity id, String plugin) ! throws SecurityException, RemoteException; /** Load schedulled plugins. *************** *** 256,260 **** * <code>PLUGIN_ADMIN</code> capability should be granted to use this * method and all others should be denied (exception ! * PluginSecurityException called) * * @see PluginManager#solveDependencies --- 259,263 ---- * <code>PLUGIN_ADMIN</code> capability should be granted to use this * method and all others should be denied (exception ! * SecurityException called) * * @see PluginManager#solveDependencies *************** *** 262,266 **** * @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. --- 265,269 ---- * @throws PluginLoadException if critical error occures during plugin * dependencies resolving. ! * @throws SecurityException if given identity is not authorized * to perform operation. * @throws RemoteException if RMI error occures during operation. *************** *** 268,272 **** */ public void load(IRemoteIdentity id) ! throws PluginLoadException, PluginSecurityException, RemoteException; /** Get plugin out of the system. --- 271,275 ---- */ public void load(IRemoteIdentity id) ! throws PluginLoadException, SecurityException, RemoteException; /** Get plugin out of the system. *************** *** 277,281 **** * <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. --- 280,284 ---- * <code>PLUGIN_ADMIN</code> capability should be granted to use this * method and all others should be denied (exception ! * SecurityException called) * * @param id Identity of the caller. *************** *** 284,292 **** * @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 void purge(IRemoteIdentity id, Class<? extends IPlugin> type, String name) ! throws PluginException, PluginSecurityException, RemoteException; } --- 287,295 ---- * @throws PluginException If plugin error occures (see getMessage for * more info) ! * @throws SecurityException if given identity is not authorized * to perform operation. * @throws RemoteException if RMI error occures during operation. */ public void purge(IRemoteIdentity id, Class<? extends IPlugin> type, String name) ! throws PluginException, SecurityException, RemoteException; } |
From: Michal H. <ms...@us...> - 2005-11-27 13:08:10
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24318/source/exfex/common/pluginsystem Modified Files: IPluginPolicy.java Log Message: remove lock added to the annotation Index: IPluginPolicy.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/IPluginPolicy.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** IPluginPolicy.java 13 Oct 2005 18:29:32 -0000 1.8 --- IPluginPolicy.java 27 Nov 2005 13:07:55 -0000 1.9 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.9 2005/11/27 13:07:55 mstsxfx + * remove lock added to the annotation + * * Revision 1.8 2005/10/13 18:29:32 mstsxfx * documentation update *************** *** 40,49 **** * about plugin. * <br> ! * Example of use is when conflicting situation's occured (Reguest for plugin ! * load, but plugin with the same type and name is already in the system. This ! * situation may be conflict - because new plugin can completly change behaviour ! * and so depedendencies may be broken - or it can be updated when newer and ! * better plugin should replace old one.). In such situation plugin policy of ! * old (registerd in the system) one is considered to solve the situation. * <br> * NOTE: --- 43,53 ---- * about plugin. * <br> ! * Example of use can be shown when conflicting situation's occured (Reguest for ! * plugin load, but plugin with the same type and name is already in the system. ! * This situation may be conflict - because new plugin can completly change ! * behaviour and so depedendencies may be broken - or it can be updated when ! * newer and better plugin should replace old one.). In such situation plugin ! * policy of old (registerd in the system) one is considered to solve the ! * situation. * <br> * NOTE: *************** *** 57,60 **** --- 61,66 ---- * <li>version - Version of plugin (arbitrary number value - higher number * means newer version). + * <li>removeLock - lock preventing from removing from Plugin system. If value + * is true - plugin is protected from removal. * <li>checkSumFile - file name with check sum of class file to check integrity * and authenticity of the plugin. If this is not empty, uses *************** *** 69,72 **** --- 75,80 ---- * * <pre> + * TODO removeEnable flag - to set that plugin can't be removed in runtime + * * Changes: * 26.9.2005 msts - author, licence and description fields. *************** *** 117,120 **** --- 125,139 ---- int version() default 0; + /** Protection from removing flag. + * + * This field doesn't prevent from replacing plugin (even if new one + * has different value of this field. Set to true implies that + * {@link PluginManager#remove(IPlugin)} will fail. + * + * TODO not implemented yet + * @return true if plugin can't be removed or true if it can be removed. + */ + boolean removeLock() default false; + /** File name, where check sum is stored. * |
From: Michal H. <ms...@us...> - 2005-11-27 13:07:14
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24059/source/exfex/common/pluginsystem Removed Files: PluginSecurityException.java Log Message: exception removed to security package --- PluginSecurityException.java DELETED --- |
From: Michal H. <ms...@us...> - 2005-11-27 13:06:47
|
Update of /cvsroot/exfex/exfex/source/exfex/common/plugins/security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23830/source/exfex/common/plugins/security Added Files: PasswordAuthBean.java package.html StandardAuthenticationManager.java StandardAuthenticationFactory.java PasswordAuthVerifier.java PasswordAuth.java Log Message: password authentication plugins --- NEW FILE: StandardAuthenticationFactory.java --- /* * $RCSfile: StandardAuthenticationFactory.java,v $ * * $Log: StandardAuthenticationFactory.java,v $ * Revision 1.1 2005/11/27 13:06:32 mstsxfx * password authentication plugins * */ package exfex.common.plugins.security; import exfex.common.pluginsystem.IAcceptPlugin; import exfex.common.pluginsystem.IContext; import exfex.common.pluginsystem.IInject; import exfex.common.pluginsystem.IPluginStrategy; import exfex.common.pluginsystem.PluginException; import exfex.common.security.IAuthentication; import exfex.common.security.IAuthenticationFactory; import exfex.common.utils.Pair; /** Plugin with standard collection of authentication mechanisms. * * TODO doc * <p> * <pre> * Changes: * 22.11.2005 msts - created * </pre> * * @author msts */ public class StandardAuthenticationFactory implements IAuthenticationFactory { static private final long serialVersionUID = 1L; /** Dependency with manager for this plugin. * * This plugins attaches to the AuthenticationManager specialy to one * with StandardAuthenticationManager name. */ @IInject( strategy = IPluginStrategy.Type.NAMEMATCH, dependencyName="StandardAuthenticationManager") private IAcceptPlugin manager; /** Internal array of available (supported) authentication types. * * This array is only for more convinient adding new supported types. * Rest of the code doesn't have to be changed if new type is added. */ private final Pair available[]= {new Pair<String, IAuthentication>("PASSWD",new PasswordAuth())}; /** Plugin name. */ private String name = "StandardAuthenticationCollection"; /** Creates new instance of given type. * * Supported types: * <ul> * <li>PASSWD - password authentication * </ul> * * NOTE: types are case sensitive. * * @see #getSupportedTypes() * @return authentication instance or null if not supported. */ public IAuthentication getAuthenticationInstance(String type) { // checks for type in local available array. // type safety is ok, because it is final array set by class // maintainer for (int i=0;i<available.length; i++) if(available[i].getFirst().equals(type)) { // correct type found, returns new instance IAuthentication factory=(IAuthentication) available[i].getSecond(); return factory.getInstance(); } return null; } /** Returns all supported types. * * @return array of supported types. */ public String[] getSupportedTypes() { // uses available array String supp[]=new String[available.length]; for(int i=0;i<supp.length;i++) supp[i]=(String)available[i].getFirst(); return supp; } public String getName() { return name; } /** Empty method. * * This methos is not implemented, USE * {@link #getAuthenticationInstance(String)} method instead. * * @return always null. */ public Object getInstance(IContext context) { return null; } /** Attaches to the manager. * * Uses {@link #manager} field filled by Plugin system during dependency * resolving. */ public void registerMe() throws PluginException { manager.attach(this); } /** Cleanup routine. * * Dettach from manager. */ public void unRegisterMe() { try { manager.dettach(this); }catch(PluginException e) { // TODO handle } } /** Returns it's manager instance. */ public IAcceptPlugin getManager() { return manager; } /** Empty method. * * This method is not implemented. */ public void dependencyNotify() { } } --- NEW FILE: StandardAuthenticationManager.java --- /* * $RCSfile: StandardAuthenticationManager.java,v $ * * $Log: StandardAuthenticationManager.java,v $ * Revision 1.1 2005/11/27 13:06:32 mstsxfx * password authentication plugins * */ package exfex.common.plugins.security; import java.util.Collection; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; 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.PluginComparator; import exfex.common.pluginsystem.PluginException; import exfex.common.pluginsystem.PluginList; import exfex.common.pluginsystem.PluginManager; import exfex.common.security.IAuthentication; import exfex.common.security.IAuthenticationBean; import exfex.common.security.IAuthenticationFactory; import exfex.common.security.IAuthenticationManager; import exfex.common.security.IAuthenticationVerifier; import exfex.common.security.UnsupportedAuthTypeException; /** Standard implementation of Authentication manager. * TODO doc * <p> * <pre> * TODO logs * Changes: * 22.11.2005 msts - created * </pre> * * @author msts */ @IPluginPolicy( replaceStrategy = IPluginStrategy.Type.ATLEAST, version = 1, author = "msts", licence = "GPL", description = "Standard implementation of Authentication " + "Manager."+ "\n"+ "TODO") public class StandardAuthenticationManager extends AcceptPlugin implements IAuthenticationManager { static private final long serialVersionUID = 1L; /** Plugin name. */ private String name="StandardAuthenticationManager"; /** Manager instance where this plugin registers. * This manager registers to the PluginManager. */ private IAcceptPlugin manager = PluginManager.getInstance(); /** Shared instance of manager. * This instance is returned by {@link #getInstance(IContext)} method. */ static private StandardAuthenticationManager instance=new StandardAuthenticationManager(); /** Logger name. * TODO set from SettingManager */ private String loggerName = "AUTHMNG_LOGGER"; /** Creates authentication instance if it's supported. * * Goes throught all registered plugins and first, that recognizes * given type is used to create instance. */ public IAuthentication getAuthenticationByType(String type) throws UnsupportedAuthTypeException { try { // gets all available plugins - TODO synch problems PluginList available=getByIface(IAuthenticationFactory.class); ListIterator iter = available.listIterator(); while(iter.hasNext()) { IAuthenticationFactory plug=(IAuthenticationFactory)iter.next(); IAuthentication auth=plug.getAuthenticationInstance(type); if(auth!=null) // first that knows such type is used return auth; } throw new UnsupportedAuthTypeException("Authentication type="+type+" is not supported."); }catch(PluginException e) { throw new UnsupportedAuthTypeException("No authentication available.",e); } } /** Returns all supported types of authentication. * * Asks all plugins for their supported auth. types. * * @return Array with all supported types. */ public String[] getAuthenticationTypes() { List<String> supp=new LinkedList<String>(); // gets all supported and fills supp by supported names try { PluginList avail = getByIface(IAuthenticationFactory.class); ListIterator iter=avail.listIterator(); while(iter.hasNext()) { IAuthenticationFactory auth=(IAuthenticationFactory) iter.next(); try { addFromArray(supp,auth.getSupportedTypes()); }catch(NullPointerException e) { // shouldn't happen, log as warning } } }catch(PluginException e) { // no available plugin, so returns empty array. } // construct return array String suppArray[]=new String[supp.size()]; ListIterator<String> suppIter=supp.listIterator(); for(int i=0;suppIter.hasNext();i++) suppArray[i]=suppIter.next(); return suppArray; } /** Returns AuthenticationBean for given auth. type. * Delegates all the work to the {@link #getAuthenticationByType(String)} * method and returnd just bean from created authentication instance. * * @return AuthenticationBean instance with given type. */ public IAuthenticationBean getAuthenticationBean(String type) throws UnsupportedAuthTypeException { IAuthentication auth=getAuthenticationByType(type); return auth.getAuthBean(); } /** Returns AuthenticationVerifier for given auth. type. * Delegates all the work to the {@link #getAuthenticationByType(String)} * method and returnd just verifier from created authentication instance. * * @return AuthenticationVerifier instance with given type. */ public IAuthenticationVerifier getAuthenticationVerifier(String type) throws UnsupportedAuthTypeException { IAuthentication auth=getAuthenticationByType(type); return auth.getAuthVerifier(); } public String getName() { return name; } /** Returns instanace of this manager. * Follows singleton pattern, so returns each time same instance * (instance is shared by callers). * * @param context This paremeter is ignored. */ public Object getInstance(IContext context) { return instance; } /** Attaches itself to the manager. * Uses private {@link #manager} field. */ public void registerMe() throws PluginException { manager.attach(this); } /** Detaches from its manager. * Uses private {@link #manager} field. */ public void unRegisterMe() { try { manager.dettach(this); }catch(PluginException e) { // TODO handle } } /** Returns its manager. * * @return Manager instance where it is attached. */ public IAcceptPlugin getManager() { // TODO Auto-generated method stub return null; } /** Empty method. */ public void dependencyNotify() { } /** Attaches only IAuthenticationFactory plugins. * Performs check if given plugins is same as {@link IAuthenticationFactory} * and if yes uses inherited attach implementation. (Decorator method) * To compare uses {@link exfex.common.pluginsystem.PluginComparator#isCompatible(Class, IPlugin)} * method. * * @throws PluginException if given plugin is not type compatible with * IAuthenticationFactory or plugin returns null when getSupportedTypes * is called (See exceptopn message). */ @Override public void attach(IPlugin plugin) throws PluginException { // checks plugins type if(!PluginComparator. isCompatible(IAuthenticationFactory.class,plugin)) throw new PluginException("Not supported plugin."); // checks supported types IAuthenticationFactory authPlug=(IAuthenticationFactory)plugin; if(authPlug.getSupportedTypes()==null) throw new PluginException("Wrong plugin implementation"); super.attach(plugin); }; /** Adds all elements from array to the given collection. * * TODO move to some general util class * * @param <T> Type of the elements in collection. * @param coll Collection. It has to be allocated and after call * contains all members from given array. * @param elements Array of elements. * @throws NullPointerException if coll or elements is null. */ static public <T> void addFromArray(Collection<T> coll, T [] elements) throws NullPointerException { if(coll==null || elements==null) throw new NullPointerException( ((coll==null)?"coll ":"")+ ((elements==null)?"elements":"")); // fills with elemets for(T e:elements) coll.add(e); } } --- NEW FILE: PasswordAuthVerifier.java --- /* * $RCSfile: PasswordAuthVerifier.java,v $ * * $Log: PasswordAuthVerifier.java,v $ * Revision 1.1 2005/11/27 13:06:32 mstsxfx * password authentication plugins * */ package exfex.common.plugins.security; import java.security.NoSuchAlgorithmException; import exfex.common.security.AuthenticationException; import exfex.common.security.IAuthenticationBean; import exfex.common.security.IAuthenticationVerifier; import exfex.common.security.UnsupportedAuthTypeException; /** Specialized verifier which compares beans with plain password beans. * * As original (correct) data, uses {@link PasswordAuthBean} with * {@link PasswordAuthBean.Methods#PLAIN} method. * <br> * Responsibility of this class is to compare beans with all supported methods * with one which has <code>PLAIN</code> method. * <br> * Implementation note: because digested password is not possible to change to * plain form, uses {@link DigestVerifier} with original and testing beans * replaced each other. This is correct because they has to be same in both * directions. * <br> * For password conversion uses static methods from {@link PasswordAuthBean} * class. * <p> * <pre> * Changes: * 24.11.2005 msts - created * </pre> * * @author msts */ class PlainVerifier implements IAuthenticationVerifier { /** Original bean with correct data. */ private PasswordAuthBean original; /** Initializating constructor. * * @param original Original bean with * {@link PasswordAuthBean.Methods#PLAIN} method. * @throws UnsupportedAuthTypeException If given bean method is not * <code>PLAIN</code>. */ public PlainVerifier(PasswordAuthBean original) throws UnsupportedAuthTypeException { // checks if bean has correct method if(original.getMethod()!=PasswordAuthBean.Methods.PLAIN) throw new UnsupportedAuthTypeException( "Wrong original bean"); this.original=original; } /** Compares given bean with original one. * * If given bean uses PLAIN method, compares directly. If bean's method * is different, converts it to the PLAIN (if it is possible) and * compares. * <br> * If bean's method is DIGEST, uses {@link DigestVerifier} with given * bean as original and this bean's original uses as parameter to verify. * This is because digest is not possible (or at least shouldn't be) * to convert to original form.This process is correct, because * passwords has to be same. * * @param bean Bean to compare with original. * @return true if given bean is same as original one set in * constructor or false otherwise. * @throws AuthenticationException if uses DigestVerifier and it throws * it. */ public boolean verify(IAuthenticationBean bean) throws AuthenticationException { PasswordAuthBean passwdBean; try { passwdBean=(PasswordAuthBean)bean; }catch(ClassCastException e) { // wrong bean type, answer is false return false; } if(passwdBean.getMethod()==PasswordAuthBean.Methods.DIGEST) { // creates DigestVerifier with bean as original and // this original as parameter DigestVerifier ver=null; try { ver=new DigestVerifier(passwdBean); }catch(Exception e) { // this will never happen } return ver.verify(original); } byte passwd[]=passwdBean.getPasswd(); // conversion to PLAIN method // NOTE: actualy no conversions are needed, because only PLAIN // and DIGEST are supported byte originalPasswd[]=original.getPasswd(); // must have same size if(originalPasswd.length!=passwd.length) return false; // all bytes must be same for(int i=0;i<originalPasswd.length;i++) if(originalPasswd[i]!=passwd[i]) return false; return true; } } /** Specialized verifier which compares beans with digested password beans. * * As original (correct) data, uses {@link PasswordAuthBean} with * {@link PasswordAuthBean.Methods#DIGEST} method. * <br> * Responsibility of this class is to compare beans with all supported methods * with one which has <code>DIGEST</code> method. * <br> * For password conversion uses static methods from {@link PasswordAuthBean} * class. * <p> * <pre> * Changes: * 24.11.2005 msts - created * </pre> * * @author msts */ class DigestVerifier implements IAuthenticationVerifier { /** Original bean with correct data. */ private PasswordAuthBean original; /** Initializating constructor. * * @param original Original bean with * {@link PasswordAuthBean.Methods#DIGEST} method. * @throws UnsupportedAuthTypeException If given bean method is not * <code>DIGEST</code>. */ public DigestVerifier(PasswordAuthBean original) throws UnsupportedAuthTypeException { // checks if bean has correct method if(original.getMethod()!=PasswordAuthBean.Methods.DIGEST) throw new UnsupportedAuthTypeException( "Wrong original bean"); this.original=original; } /** Compares given bean with original one. * * Transforms password from given bean to digest (if necessary) and * compares it with original digested password. * * @param bean Bean to compare with original. * @return true if given bean is same as original one set in * constructor or false otherwise. * @throws AuthenticationException if original contains wrong algorithm * name (which is not supported) or given bean is also digest but with * different algorithm used. */ public boolean verify(IAuthenticationBean bean) throws AuthenticationException { PasswordAuthBean passwdBean; try { passwdBean=(PasswordAuthBean)bean; }catch(ClassCastException e) { // wrong bean type, answer is false return false; } byte [] passwd=passwdBean.getPasswd(); // convert according method // if passwdBean has differenet algorithm, throws exception, // because they can't be compared switch(passwdBean.getMethod()) { case PLAIN: try { passwd=PasswordAuthBean .fromPlainToDigest( passwd, original.getAlgortihm()); }catch (NoSuchAlgorithmException e) { throw new AuthenticationException( "Digest exception",e); } break; case DIGEST: if(!original.getAlgortihm().equalsIgnoreCase( passwdBean.getAlgortihm())) throw new AuthenticationException( "Uncomparable digests:"+ "original="+ original.getAlgortihm()+ " compared="+ passwdBean.getAlgortihm()); } // passwd contains digest with compatible algorithm. byte [] originalPasswd=original.getPasswd(); // must have same size if(originalPasswd.length!=passwd.length) return false; // all bytes must be same for(int i=0;i<originalPasswd.length;i++) if(originalPasswd[i]!=passwd[i]) return false; return true; } } /** Password authentication verifier. * * This implementation can verify * {@link exfex.common.plugins.security.PasswordAuthBean} instances. * See {@link #verify(IAuthenticationBean)} for more information about process * of verification. * <br> * * <p> * <pre> * TODO configuration with password files. * * Changes: * 24.11.2005 msts - created * </pre> * * @author msts */ public class PasswordAuthVerifier implements IAuthenticationVerifier { /** Verifies given bean. * * Verification process: * <ul> * <li>Chcecks bean type and if type is different from <code>PASSWD</code> * throws UnsupportedAuthTypeException. * <li>Try to cast given bean to {@link PasswordAuthBean}. If fail also * throws UnsupportedAuthTypeException. * <li>Calls bean's {@link IAuthenticationBean#check()} method to check * if all implementation specific data are supplied. * <li>Gets original data for user from confiruration (creates own * PasswordAuthBean instance) * <li>Find out method used for password from configuration bean. * According to the method uses specialized verifier and returns its * return value. * </ul> * * @throws UnsupportedAuthTypeException If given bean has not * <code>PASSWD</code> type (returned from * {@link IAuthenticationBean#getType()} method) or bean cannot be cast * to the {@link PasswordAuthBean} type. * * @throws BeanFormatException if bean's check method throws this * exception which means that it doesn't contain all necessary * information. * * @throws AuthenticationException */ public boolean verify(IAuthenticationBean bean) throws AuthenticationException { // checks type, if given bean is null, it will also fail if(!"PASSWD".equals(bean.getType())) throw new UnsupportedAuthTypeException( bean.getType()+ " is not supported."); // gets correct type from general bean PasswordAuthBean passwdBean=null; try { passwdBean=(PasswordAuthBean)bean; }catch(ClassCastException e) { // bad type throw new UnsupportedAuthTypeException( bean.getType()+ " bean id not compatible with supported"+ "one",e); } // check if all data are supplied passwdBean.check(); // gets data from configuration using ???FileParser??? class // creates new bean (original) PasswordAuthBean original=null; // FIXME remove - just for testing original=test(); // according original model type, creates specialized verifier // and returns its return value switch(original.getMethod()) { case PLAIN: PlainVerifier plainVer=new PlainVerifier(original); return plainVer.verify(passwdBean); case DIGEST: DigestVerifier digVer=new DigestVerifier(original); return digVer.verify(passwdBean); } return false; } protected PasswordAuthBean test() { try { PasswordAuthBean ret=new PasswordAuthBean(); ret.setUserName("msts"); ret.setPasswd(PasswordAuthBean.fromPlainToDigest("lllkkk".getBytes("ASCII"),"SHA1")); ret.setAlgortihm("SHA1"); ret.setMethod(PasswordAuthBean.Methods.DIGEST); return ret; }catch(Exception e) { e.printStackTrace(); return null; } } } --- NEW FILE: package.html --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head> </head> <body bgcolor="white"> Package for security plugins. <h2>Package Specification</h2> All plugins implementing interfaces from exfex.common.security package should be here. </body> </html> --- NEW FILE: PasswordAuthBean.java --- /* * $RCSfile: PasswordAuthBean.java,v $ * * $Log: PasswordAuthBean.java,v $ * Revision 1.1 2005/11/27 13:06:32 mstsxfx * password authentication plugins * */ package exfex.common.plugins.security; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import exfex.common.security.AuthenticationException; import exfex.common.security.BeanFormatException; import exfex.common.security.IAuthenticationBean; import exfex.common.utils.Base64; /** Password authentication bean. * * This bean is created by {@link exfex.common.plugins.security.PasswordAuth} * class. It is intended to keep all data for password authentication and logic * for loading and saving its content. * <br> * Bean information: * <ul> * <li> bean's type: <b>PASSWD</b> * <li> persistent format: * <code>PASSWD:user_name:method:method_specific:password</code> * <br> * Where:<br> * <ul> * <li><code>PASSWD</code> is identificator, that following data can be * used by this bean. * <li><code>user_name</code> is user name. * <li><code>method</code> is method used to write password. * <li><code>method_specific</code> specific data for method. * It has format depending on method: * <ul> * <li>with <b>DIGEST</b> method has format * <code>ALG</code> which stands for digest algorithm name. * <li>with <b>PLAIN</b> and <b>BASE64</b> methods has format * <code>encoding</code> which standands for enconding used for * string convertion to the byte array. * </ul> * <li><code>password</code> text representation of password created using * previousmethod field. * </ul> * <li>Additional method: * <ul> * <li>{@link #getAlgortihm()} resp. {@link #setAlgortihm(String)} * <li>{@link #getEncoding()} resp. {@link #setEncoding(String)} * <li>{@link #getMethod()} resp. {@link #setMethod(Methods)} * <li>{@link #getPasswd()}, {@link #getStringPasswd()} resp. * {@link #setPasswd(byte[])}, {@link #setStringPasswd(String, String)}, * {@link #setDigestPasswd(byte[], String)} * </ul> * </ul> * Class is not synchronized and so has to be synchronized externaly if used in * multi-thread environment. * * <p> * <pre> * Changes: * 22.11.2005 msts - created * </pre> * * @author msts */ public class PasswordAuthBean implements IAuthenticationBean { /** Supported methods for this bean. * * Each method defines how is password converted from its original * plain format. To change byte array representation from one method * to another use static methods. * * @see PasswordAuthBean#fromBase642Plain(byte[]) * @see PasswordAuthBean#fromPlain2Base64(String) * @see PasswordAuthBean#fromPlainToDigest(byte[], String) * @author msts */ static public enum Methods { /** Password is in original (text) form. * No changes has been made to it. This option is not secure for * persisting (or send it throught untrusted environment) * because everybody, who can read data, can read password and * misuse it. */ PLAIN, /** Password is not in original form, but it is used its digets * instead. TO be more general, doesn't use concrete digest * mechanism. Concrete algorithm is stored in * <br> * This method is rather safe */ DIGEST }; /** Algorithm name used for specified method. * In this moment it is considered only if {@link Methods#DIGEST} method * is used and stands for digest algorithm. * <br> * Default value is SHA algorithm. */ private String algortihm= "SHA"; /** Method used for password persisting. * This identifies how was created actual form of password from original * one. * <br> * Default value is PLAIN method. */ private Methods method = Methods.PLAIN; /** Encoding name. * This field is used when string representation of password has to be * converted to the byte array. * <br> * Default value is ASCII encoding. */ private String encoding = "ASCII"; /** Type of this bean. * * This bean has PASSWD type. */ static private final String type = "PASSWD"; /** User's name. */ private String userName; /** Byte array representation of Password. * This form of password is created using this {@link #method method}. * Byte array is used primary because of digest methods and to avoid * problems with charsets. To set String password use TODO method */ private byte [] passwd; /** Returns bean type. * This bean will allways return PASSWD string (stored in {@link #type} * field). */ public String getType() { return type; } /** Cleans all sensitive data from bean. * This includes userName and password. * <br> * Note that {@link #check()} will fail on bean which was cleaned. */ public void clean() { setUserName(null); setPasswd(null); } /** Checks bean. * This method should be called always when bean is completed and ready * to be sent back to the system. * <br> * Checking process depends on used method but some parts are incommon. * <ul> * <li> <code>user</code> must be non null and not empty. * <li> <code>password</code> can't be null - empty password is enabled * but not recomended (it is array with 0 lenght). * <li> <code>method</code> has to be non null. * * <ul>Specific checking according used method * <li><b>PLAIN</b> - <code>encoding</code> has to be non null and * not empty. * <li><b>DIGEST</b> - <code>algorithm</code> has to be non null * and not empty. * </ul> * </ul> * * @throws BeanFormatException if at least one field is missing and * exception message contains all missing fields separated by space. */ public void check() throws BeanFormatException { // container for missing fields StringBuffer fields=new StringBuffer(); // General checking if(userName == null || userName.length() == 0) fields.append("userName "); if(passwd == null) fields.append("passwd "); if(method == null) { // if method is not set, specific checking can't be done fields.append("method "); throw new BeanFormatException(fields.toString()); } // specific checking switch(method) { case PLAIN: if(encoding == null || encoding.length() == 0) fields.append("encoding "); break; case DIGEST: if(algortihm == null || algortihm.length() == 0) fields.append("algortihm "); break; } // if fields is not empty, som error occures and so throws // exception if(fields.length()>0) throw new BeanFormatException(fields.toString()); } public String getUserName() { return userName; } public void setUserName(String name) { this.userName=name; } /** Saves bean to the output stream. * TODO */ public void save(OutputStream output) throws IOException { // TODO Auto-generated method stub } /** Loads bean from the input stream. * TODO */ public void load(InputStream input) throws IOException, AuthenticationException { // TODO Auto-generated method stub } // ADITIONAL BEAN'S METHODS //========================== /** Converts string to Base64 byte array representation. * * Creates Base64 representation of given String and converts it to the * byte array. * <br> * This is just helper method, if password contains nonprintable chars * and have to be transfered throught pure text medium (e.g. mail). * * @see exfex.common.utils.Base64 for converting details. * * @param str String to convert. * @return byte array created by converting given string using * Base64 algorithm. */ static public byte [] fromPlain2Base64(String str) { return Base64.decode(str); } /** Converts byte array (in Base64 format) to the String representation. * * This is inverse method to {@link #fromPlain2Base64(String)}. It means * that <code>orig = fromBase642Plain(fromPlain2Base64(orig))</code> * * @see exfex.common.utils.Base64 for converting details. * @param passwd Password Base64 representation in byte array. * @return String representation in String form. */ static public String fromBase642Plain(byte[] passwd) { return Base64.encode(passwd); } /** Creates digest of given byte array. * * Uses MessageDigest from Java standard security package for digest * creation. * * @param passwd Byte array representation of password. * @param alg Digest algorithm name. * @return Byte array which is digest of given passwd. * @throws NoSuchAlgorithmException if given alg is not recognised by * Java Security package. */ static public byte [] fromPlainToDigest(byte[] passwd,String alg) throws NoSuchAlgorithmException { MessageDigest digestAlgorithm=MessageDigest.getInstance(alg); byte checkSum[]=null; digestAlgorithm.reset(); digestAlgorithm.update(passwd); checkSum=digestAlgorithm.digest(); digestAlgorithm.reset(); return checkSum; } /** Returns name of the digest algorithm. * * This method should be used only if method is set to * {@link Methods#DIGEST}. * * @return Returns the algortihm. */ public String getAlgortihm() { return algortihm; } /** Sets name of the digest algorithm. * * This method should be used only if method is set to * {@link Methods#DIGEST} and stands for algorithm used to produce * digest which is in the {@link #passwd} field. * * @param algortihm The algortihm to set. */ public void setAlgortihm(String algortihm) { this.algortihm = algortihm; } /** Returns method used for password. * * This field returns value of {@link #method} field. Verificator has * to check this value to find out how was the password created. * <br> * Default value is PLAIN. * <p> * Lets see following example: * <br> * Client is trying to login, he fills this bean and gives password in * original (text) form. Verifier has to compare it with data from local * (safe) storage. So it will find file (according configuration) and * gets data (also in bean form - using {@link #load(InputStream)} * method). But this password is encrypted - or changed to prevent from * reconstructing of original password. In this situation verifier has * to know methods of both of them to compare them (e.g. change one * given from user to form gotten from configuration). * * @return method name. */ public Methods getMethod() { return method; } /** Sets method which was used to create password representation. * * This method should be called immediately after {@link #setPasswd} is * called and {@link Methods method} used for password transformation * should be supplied. * <br> * Default value is PLAIN. * * @param method Method used for password. */ public void setMethod(Methods method) { this.method = method; } /** Returns password. * * Controlling mechanism has to consider method used for password * transfomation. * * @return Returns the passwd byte array. */ public byte[] getPasswd() { return passwd; } /** Returns string representation of password. * * Uses {@link #passwd} and {@link #encoding} fields to reconstruct * string from byte array internal password representation. * * @return String representation of password or null if password is not * set or encoding is null. * @throws UnsupportedEncodingException If encoding is not supported. */ public String getStringPasswd()throws UnsupportedEncodingException { if(passwd == null || encoding == null) return null; return new String(passwd,encoding); } /** Sets password. * Password is considered to be byte array. * * @param passwd The passwd to set. */ public void setPasswd(byte[] passwd) { this.passwd = passwd; } /** Sets password from String. * * Converts given password using given encoding and sets both passwd and * encoding fields. Finaly sets method to the PLAIN. * <br> * NOTE: doesn't check if given passwd is non null. * <br> * Use this method rathar than specialized methods for setting each * field separately (setPasswd and setMethod). * * @param passwd String representation of password. * @param encoding Enconding to be used for string to byte array * conversion. * @throws UnsupportedEncodingException if given encoding couldn't be * recognized. */ public void setStringPasswd(String passwd, String encoding) throws UnsupportedEncodingException { this.passwd=passwd.getBytes(encoding); this.encoding=encoding; this.method=Methods.PLAIN; } /** Sets password from digested byte array. * * Sets password and algortihm fields according given parameters and * sets method to the DIGEST. * <br> * Use this method rathar than specialized methods for setting each * field separately (setPasswd, setMethod and setAlgortihm). * * @param passwd byte array representation of digested password. * @param alg Digest algorithm name used. */ public void setDigestPasswd(byte[] passwd, String alg) { this.passwd=passwd; this.algortihm=alg; this.method=Methods.DIGEST; } /** Returns encoding name used for string converting to the byte array. * * This method should be used when method is {@link Methods#PLAIN} to * reconstruct correct form of password from byte array to String. * <br> * Default value is ASCII. * * @return Returns the encoding. */ public String getEncoding() { return encoding; } /** Sets encoding used for String password representation to byte array. * Use this method always when following methods {@link Methods#PLAIN} * are used. Use rather {@link #setStringPasswd(String, String)}. * <br> * Default value is ASCII. * * @param encoding The encoding to set. */ public void setEncoding(String encoding) { this.encoding = encoding; } } --- NEW FILE: PasswordAuth.java --- /* * $RCSfile: PasswordAuth.java,v $ * * $Log: PasswordAuth.java,v $ * Revision 1.1 2005/11/27 13:06:32 mstsxfx * password authentication plugins * */ package exfex.common.plugins.security; import exfex.common.security.IAuthentication; import exfex.common.security.IAuthenticationBean; import exfex.common.security.IAuthenticationVerifier; /** Password authentication implementation. * * This class returns bean and verifier for password authentication. * <br> * Use {@link #getInstance()} for instance creation. * <p> * <pre> * Changes: * 22.11.2005 msts - created * </pre> * * @see exfex.common.plugins.security.PasswordAuthBean * @see exfex.common.plugins.security.PasswordAuthVerifier * @author msts */ public class PasswordAuth implements IAuthentication { /** Creates password authentication bean. * * This bean can be verified by verifier returned by this * {@link #getAuthVerifier()} method. * * @return Authentication bean instance. */ public IAuthenticationBean getAuthBean() { return new PasswordAuthBean(); } /** Returns verifier. * This verifier is able to examine and check authentication bean * created by {@link #getAuthBean()} method. * * @return Verifier instance. */ public IAuthenticationVerifier getAuthVerifier() { // TODO maybe some configuration initialization return new PasswordAuthVerifier(); } /** Creates new instance of this class. * * Doesn't perform any initialization, but use this method rather than * new operator to avoid future changes. * */ public IAuthentication getInstance() { return new PasswordAuth(); } } |
From: Michal H. <ms...@us...> - 2005-11-27 13:06:38
|
Update of /cvsroot/exfex/exfex/source/exfex/common/plugins/security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23764/source/exfex/common/plugins/security Log Message: Directory /cvsroot/exfex/exfex/source/exfex/common/plugins/security added to the repository |
Update of /cvsroot/exfex/exfex/source/exfex/common/security In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23089/source/exfex/common/security Modified Files: package.html Added Files: ILocalIdentity.java ISecurityContext.java SecurityException.java IAuthenticationManager.java IDomain.java IAuthenticationVerifier.java Identity.java IResource.java IAuthenticationBean.java IdentityManager.java IAuthentication.java AccountException.java ISecurityData.java ISecurityDataFactory.java IAccountManager.java IAuthorizationManager.java BeanFormatException.java UnsupportedAuthTypeException.java ResourceException.java ICapability.java IAuthenticationFactory.java IUser.java AuthenticationException.java ICapabilityContext.java AccessDeniedException.java DomainException.java Removed Files: IIdentity.java Log Message: security system interfaces and classes --- NEW FILE: AccountException.java --- /* * $RCSfile: AccountException.java,v $ * * $Log: AccountException.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; /** Basci exception used for accounting purposes. * * <p> * <pre> * Changes: * 29.10.2005 msts - created * </pre> * * @author msts */ public class AccountException extends Exception { static private final long serialVersionUID=1L; /** Constructor with reason message. * * @param msg Reason of the exception. */ public AccountException(String msg) { super(msg); } /** Constructor with reason message and cause exception. * * @param msg Reason of the exception. * @param cause Exception witch caused throwing of this exception. */ public AccountException(String msg, Throwable cause) { super(msg,cause); } } --- NEW FILE: AccessDeniedException.java --- /* * $RCSfile: AccessDeniedException.java,v $ * * $Log: AccessDeniedException.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; /** Exception for access denied action. * * When unauthorizedaction is going to be performed or error during * autentification, controling mechanism should throw this exception. * <p> * <pre> * Changes: * 6.10.2005 msts - created * </pre> * * @author msts */ public class AccessDeniedException extends AccountException { static private final long serialVersionUID = 1L; /** Constructor with message. * * @param message Message of the exception. */ public AccessDeniedException(String message) { super(message); } /** Constructor with message and cause. * * @param message Message of the exception. * @param cause Lowlevel exception which caused this exception. */ public AccessDeniedException(String message, Throwable cause) { super(message, cause); } } --- NEW FILE: BeanFormatException.java --- /* * $RCSfile: BeanFormatException.java,v $ * * $Log: BeanFormatException.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; /** Exception for bad bean format. * * This exception is thrown if authentication bean doesn't contain all necessary * data for verifying. * * <p> * <pre> * Changes: * 25.11.2005 msts - created * </pre> * * @author msts */ public class BeanFormatException extends AuthenticationException { static private final long serialVersionUID = 1L; /** Constructor with message. * * @param msg Message of the exception. */ public BeanFormatException(String msg) { super(msg); } /** Constructor with message and cause. * * @param msg Message of the exception. * @param cause Lowlevel exception which caused this exception. */ public BeanFormatException(String msg, Throwable cause) { super(msg, cause); } } --- IIdentity.java DELETED --- --- NEW FILE: ICapabilityContext.java --- /* * $RCSfile: ICapabilityContext.java,v $ * * $Log: ICapabilityContext.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; /** Interface for capabilities context. * * Capabilities uses this context to get special data needed (or helpfull) for * authorization process from capability user. Thi user has to know which * data has or should be filled from concrete capability documentation. * Context data (with exceptio of resource(s)) are stored as kye, value pairs. * Both can be arbitrary objects and to work properly, types defined by * capability should be used (key will be typicaly String object with name * of the value) This is detaily described in capability implementation * documentation. * <br> * Each capability operates upon some resource(s) - it examines authorization * for operation on such resource(s). So resources are almost in all cases * mandatory (unless speciefied differently). Method to set resource * {@link #setResources(IResource[])} uses an array as parameter. This is * primary because one resource whould be too restrictive. * * <p> * <pre> * Changes: * 6.10.2005 msts - created * </pre> * * @author msts */ public interface ICapabilityContext { /** Sets resources for checking. * * All these resources will be examined in authorization process. * @param res Array of resources. */ public void setResources(IResource [] res); /** Returns all resources. * * @return Array of resources. */ public IResource [] getResources(); /** Gets value from context with given key. * * @param key Key for value. * @return Instance of value or null if not found. */ public Object getValue(Object key); /** Sets value associated with given key. * * @param key Key of the value. * @param value New value. * @return Old value instance. Also null can be returned when an old * value was null or key, value pair wasn't in the context. */ public Object setValue(Object key, Object value); } --- NEW FILE: ResourceException.java --- /* * $RCSfile: ResourceException.java,v $ * * $Log: ResourceException.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; /** General exceptio for resources. * * <p> * <pre> * Changes: * 15.11.2005 msts - created * </pre> * * @author msts */ public class ResourceException extends Exception { static private final long serialVersionUID = 1L; /** Constructor with message. * * @param msg Message associated with an exception. */ public ResourceException(String msg) { super(msg); } /** Constructor with message and cause exception. * * @param msg Message associated with an exception. * @param cause Low level exception which caused this exception. */ public ResourceException(String msg, Throwable cause) { super(msg, cause); } } --- NEW FILE: IdentityManager.java --- /* * $RCSfile: IdentityManager.java,v $ * * $Log: IdentityManager.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; import java.util.HashMap; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantReadWriteLock; import exfex.common.logging.ILogger; import exfex.common.logging.LogManager; import exfex.common.remote.security.IRemoteIdentity; import exfex.common.utils.IdAssigner; /** Class responsible for managing Identities. * This class collects all registered Identities in the system. It is intended * for local (from trusted environment) usage. Both remote and local views of * each identity can be return for security purposes. * <br> * All Identities are internally stored in hash map with identity's id as key * and identity instance as value. For key (id) generating, uses IdAssigner * class. * <br> * Class instance can be obtained by static * <br> * Class is synchronized by Read-Write locks and so can be safely used in multi * thread environment. * <p> * <pre> * * Changes: * 28.10.2005 msts - created * </pre> * * @author msts */ public class IdentityManager { /** Map of currently active identities. * Key of the map is id of the identity and value identity instance. */ private HashMap<Integer, Identity> map=new HashMap<Integer, Identity>(); /** Generator for id. */ private IdAssigner idGenerator=new IdAssigner(); /** Read-Write lock for synchronization. */ private final ReentrantReadWriteLock rwLock=new ReentrantReadWriteLock(false); /** Read lock from rwLock.*/ private final Lock rLock=rwLock.readLock(); /** Write lock from rwLock. */ private final Lock wLock=rwLock.writeLock(); /** Singleton instance of this class. */ static private final IdentityManager instance=new IdentityManager(); /** Maximum number of identities, that can be registered. * * TODO sets from setting manager */ private int topLimit=3; /** Name of the digest algorithm used in Identity creation process. * TODO sets from setting manager. */ private String digestAlgName="SHA"; /** Logger name. * TODO sets from setting manager. */ private String logName="IDENTMNG_LOGGER"; /** Constructor. * * This class is intended to be Singleton and so it is not possible to * create instances by new operator. Use {@link #getInstance()} method * if you need to work with this class instance. */ private IdentityManager() { // TODO intialization from setting manager } /** Returns singleton instance of this class. * * @return Instance of this class. */ public static IdentityManager getInstance() { return instance; } /** Creates new Identity and put it to the internal map. * * Doesn't create identity if <code>topLimit</code> of identities has * expired. * * @param profile User profile for new identity. * @return Id of created identity or null if wasn't able to register or * create identity. */ public Integer createIdentity(IUser profile) { if(profile==null) return null; log(ILogger.Level.DEBUG,"IdentityManager.createIdentity Creating identity for user with profile="+profile); // identity count limit has expired if(map.size()==topLimit) { log(ILogger.Level.ERROR,"Unable to create new identity. Limit of identities count ("+topLimit+") has expired."); return null; } // generates id and test if it doesn't clash some id in the map // if id was wrong, try new generation until correct one is // generated or to many cycles (MAX_TRIES is cieling) are done. Integer id=null; int cycle=0; int MAX_TRIES=10; try { // locks for writing wLock.lock(); do { id=idGenerator.get(); if(getFromId(id)!=null) { // id clash log(ILogger.Level.CRIT,"Id generation bug. Generated id ("+id+") already exist."); id=null; } }while(id==null && cycle<MAX_TRIES); // Test if id has been generated if(id==null) { log(ILogger.Level.PANIC,"Unable to generate id for identity for user with profile="+profile); return null; } log(ILogger.Level.DEBUG,"IdentityManager.createIdentity Id for identity created. Value="+id+" tries="+cycle); // create identity instance and puts it to the map with // generated id as the key try { Identity identity=Identity.getIdentity(id,profile,digestAlgName); log(ILogger.Level.INFO,"Identity instance created: "+identity); map.put(id,identity); }catch(Exception e) { // This should never happen. log(ILogger.Level.PANIC,"Unexpected error when creating Identity instance (reason="+e.getMessage()+")"); return null; } log(ILogger.Level.NOTICE,"Identity for user with profile="+profile+" registered with id="+id); return id; }finally { wLock.unlock(); } } /** Removes identity with given id from the manager. * * Removes id from the map and releases it from the idGenerator. * @param id Id to remove. * @return Instance of the identity that was removed or null if not * found or null parameter is given. */ public Identity removeIdentity(Integer id) { if(id==null) return null; try { // locks for writing wLock.lock(); // try to remove from the map Identity result=map.remove(id); idGenerator.release(id); log(ILogger.Level.DEBUG,"IdentityManager.removeIdentity Removing identity with id="+id); if(result!=null) { // TODO if some chaching, remove from cache log(ILogger.Level.NOTICE,"Identity="+result+" removed from the map."); }else log(ILogger.Level.ERROR,"No identity registered with id="+id); return result; }finally { wLock.unlock(); } } /** Returns remote view of the identity with given id. * * @param id Id of the identity. * @return Remote view of the identity or null if doesn't exist in the * map. */ public IRemoteIdentity getRemoteIdentity(Integer id) { return (IRemoteIdentity)getFromId(id); } /** Returns local view of the identity with given id. * * @param id Id of the identity. * @return Local view of the identity or null if doesn't exist in the * map. */ public ILocalIdentity getLocalIdentity(Integer id) { return (ILocalIdentity)getFromId(id); } // Helper methods //================ /** Returns Identity from id. * TODO some kind of caching maybe * * @param id Id of identity. * @return Identity instance if found, null otherwise. */ protected Identity getFromId(Integer id) { if(id==null) return null; try { // lock for reading rLock.lock(); return map.get(id); }finally { rLock.unlock(); } } /** Helper method for logging. * * @param level Message priority. * @param msg Message text. */ protected void log(ILogger.Level level, String msg) { LogManager.getInstance().getLogger(logName).log(level, msg); } } --- NEW FILE: ISecurityData.java --- /* * $RCSfile: ISecurityData.java,v $ * * $Log: ISecurityData.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; /** Interface for implementation independed repository of security data. * * <h3>Overview</h3> * Implementator is intended to collect data needed for authorization evaluation * done in {@link exfex.common.security.IAuthorizationManager} implementator. * <br> * To be independed on concrete model of authorization process, it declares * hierarchy domain model with resources. This model can be adapted to almost * all athorization models (like unix owner, group, other permisions; * hierarchical - military; ACL etc.). Authorization managers can use this class * directly or can create helper adapters for desired model. * See Description part for more information. * <br> * Instance of this type is product of * {@link exfex.common.security.ISecurityDataFactory} plugin. Created instance * is not responsible for its initialization. User (Authorization manager or its * helper adapter; we will use evaluator in further text) is responsible to * understand specific security (persmission) model and initialize this * instance. However AuthorizationManagers are not forced to use this class at * all, it may be helpful, because it poses implementation independed and so one * implementator would be enought (except that we want some better * implementations - with respect to effectivness or speed or whatever). * Advantage is that when it is implemented and has clearly defined rules, * adapters for concrete permission system may be created and so authorization * managers can use just these adapters and doesn't keep much logic inside. * TODO schema * * <h3>Description</h3> * SecurityData are based on Domain model. <b>Domain</b> is intended to be basic * entity which is associated with certain resource (in shared case resources). * Each domain has: * <ul> * <li>Name - string name of domain used basicly to distinguish two domains in * one resource scope (name has to be unique in this scope). * <li>Member set - memebers of domain (this can involve users, groups, etc.). * Member is defined as integral number and evaluator has to maintain mapping to * real persons, groups or whatever. Each member may have defined security * context. * <li>Security context - * {@link exfex.common.security.ISecurityContext restrictions} for domain. These * are used by evaluator as additional data. * <li>Subdomain set - children domains. * </ul> * * <h4>Rules</h4> * {@link exfex.common.security.IResource Resource} mapping to domains is m:n * relation (each resource can have multiple but at least 1 domain and domains * can be shared between resources, but no orphan domain is allowed). * <p> * Semantic of domain is given by evaluator (semantic means how evaluator uses * domain, what is the meaning and role - domain doesn't know anything about it). * Each domain can have its security context defined which can be used by * evaluator for more information about what all members of given domain are * allowed to do. If not specified (null value), evaluator can use full * qualified permissions defined for domain (by its semantic). * <br> * Domain doesn't have to understand details, but keeps this indormation and * returns them on demand. It is not responsible even to check or validate it. * Evaluator is responsible to keep the following rule: * Subdomain is allowed to, maximaly what its parent is allowed to (in top level * domain case - evaluator must provide logic). Maximaly means that it may * be restricted with respect to parent but is not allowed to be able to * anything that its parent is not allowed. Same rule works for each memeber of * domain: member is allowed to everything which its domain is. If user has * defined its security context this can may restrict default permissions (no * context defined means all permissions inherited from domain). * <br> * There are not allowed cycles in subdomains relations (domain's recursive * child is parent of domain is <b>forbidden</b>) and this class is responsible * to keep this invariant. This means that * {@link #associateDomain(IResource, IDomain)} may fail. * <br> * Members of domain are described by unique (in the system scope) number. * Domain doesn't have to know any details. Evaluator knows concrete entity * assigned to this number. * * <h4>Examples</h4> * To be more concrete, here are some examples how existing permission systems * can be defined with security data model. * * <h5>Unix permissions</h5> * Resource have 3 domains: * <ul> * <li>1st with name owner - member(s) is/are user(s) id(s) who owns this * resource (more than one is enhancement comparing to UNIX). Security context * contains <code>READ</code>, <code>WRITE</code>, <code>EXECUTE</code> elements * each with true/false value. * <li>2nd with name groups - member(s) is/are group(s) id(s) which are * associated with resource (more than one is enhancment comparing to UNIX). * Each member has security context which contains <code>READ</code>, * <code>WRITE</code>, <code>EXECUTE</code> elements each with true/false value. * Memebers of group have same permisions as its group. Evaluator has to * define logic which permission to use if user is memeber of multiple groups * and those are in members of this domain. * <li>3rd with name others - Security context contains <code>READ</code>, * <code>WRITE</code>, <code>EXECUTE</code> elements each with true/false value. * And everybody who is not memeber of previous domain has this permissions. * </ul> * Evaluator has to maintain/get user information (id) and groups-members * association (for intialization). * * <h5>ACL</h5> * Access control list are straight forward. Domain is ACL and members are users * (defined by its id). Security context can also be used as enhancement, but * ACL name is enough. Evalutor has to know all ACL and meaning of each with * its members (for intialization). * * <h5>Hierarchy-Military model</h5> * By hierarchy model, we means permission model, where each hierarchy stage is * allowed to perform some set of operation and this set of operations is * subset of superior stage and superset of stage under (similar to charges in * military system). Implementation using SecurityData is also straight forward. * Each resource is associated with predefined domains (each domain stands for * one hierarchy stage) and evaluator knows meaning, authority of each and its * members. Security context doesn't have to be used at all. * * <h5>Access cart model</h5> * By this model, we means permission model, where everbody who owns som public * secret in certain cathegory is allowed to perform an action in this cathegory. * For example, each resource can have 3 domains each with security context * containing <code>KEY</code> with key value: * <ul> * <il>full access - who knows (holds) same key is allowed to make all operations * on the resource. * <il>read only access - who knows (holds) same key is allowed to get all * information about resource (read its content or state or whatever, but is not * allowed to change it) * <il>write only access - who knows (holds) same key is allowed to change * resource's state or contente or whatever (but is not allowed to read changes) * </ul> * * <p> * <pre> * Changes: * 15.11.2005 msts - created * </pre> * * @author msts */ public interface ISecurityData { /** Associate resource with given domain. * * If given resource is not registered yet, it will be registered using * {@link #registerResource(Object, String)} method. * * @param resource Resource instance. * @param dom Domain to be associated. * @throws DomainException If problem occures during creation of * association (there already is such domain, etc.). */ public void associateDomain(IResource resource, IDomain dom) throws DomainException; /** Factory method for domain creation. * * Use this method for domain creation instead of using <code>new</code> * operator if you want to add new domain. * TODO some parameter * @return Domain instance. */ public IDomain createDomain(); /** Returns all domains associated with given resource. * * @param resource Resource instance. * @return An array of domains associated with resource added by * {@link #associateDomain(IResource, IDomain)} method. * @throws ResourceException if resource is not registered. */ public IDomain[] getDomains(IResource resource) throws ResourceException; /** Returns domain with given name associated with given resource. * * @param resource Resource instance. * @param name Domain name. * @return Domain instance. * @throws DomainException If domain is not associated with given * resource. * @throws ResourceException If resource is not registered. */ public IDomain getDomainByName(IResource resource, String name) throws DomainException, ResourceException; /** Destroy association of resource with given domain. * * @param resource Resource instance. * @param dom Domain to release. * @throws DomainException If domain is not associated with given * resource. * @throws ResourceException If resource is not registered. */ public void releaseDomain(IResource resource, IDomain dom) throws DomainException, ResourceException; /** Creates and registers new resource. * * If this method suceede, resource can be used for SecurityData * instance and can be identified by name (returned by * {@link IResource#getName()} method). * There are no restrictions on given object (it can be null). User of * this class has to define logic for it and so use it in defined way. * SecurityData object doesn't use it internally. * * @param object Entity object. * @param name Name that will be used in SecurityData instance. * @return IResource instance. * @throws DomainException if name already exist or any other problem * occures during creation or registration. */ public IResource registerResource(Object object, String name) throws DomainException; /** Removes resource. * * Resource won't be available in futureure unless registerResource or * associateDomain (with this resource) is called again. * @param resource Resource to remove. * @throws ResourceException If given resource is not registered. */ public void removeResource(IResource resource) throws ResourceException; /** Returns all registered resources. * * @return An array of resource instances. */ public IResource[] getResources(); } --- NEW FILE: ISecurityDataFactory.java --- /* * $RCSfile: ISecurityDataFactory.java,v $ * * $Log: ISecurityDataFactory.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; import exfex.common.pluginsystem.IPlugin; /** Interface for plugins for SecurityData creation. * * {@link #getSecurityDataInstance()} instance will create always new instance * of maintained {@link ISecurityData} class. * <br> * Plugin should register to the PluginManager. * <p> * <pre> * Changes: * 15.11.2005 msts - created * </pre> * * @author msts */ public interface ISecurityDataFactory extends IPlugin { /** Creates security data instance. * * This method creates new instance of maintained ISecurityData instance * and returns it. * @return ISecurityData instance. */ public ISecurityData getSecurityDataInstance(); } --- NEW FILE: IUser.java --- /* * $RCSfile: IUser.java,v $ * * $Log: IUser.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; /** Interface for user profile information. * * This interface offers information independed on security system * implementation: * <ul> * <li>name - user name. This is unique in maintainig aplication scope. * <li>UID - user unified identificator. This number is assigned by system when * user account is created. When migrating to the new system, it is very * propable that this number will change while name would keep (if can be * accepted - may fail because of name clash). * <li>profileInfo - additional information for this user. It contains key, * value pairs, where key identifies and value represents this information. * This is used for advanced manipulation with user profile. * </ul> * * <p> * <pre> * Changes: * 27.10.2005 msts - created * </pre> * * @author msts */ public interface IUser { /** Returns user name. * * @return Name of the user. */ public String getName(); /** Returns user identification number. * * Each user has unique identification number assigned when it is c * reated and this number doesn't change during whole user account * exists. * * @return Identification number. */ public Integer getUID(); /** Returns profile information associated with given key. * * @param key Name of the information. * @return Value associated with given key. If given assocociation * doesn't exist, returns null. */ public Object getProfileInfo(String key); /** Sets new value for given key. * * Add or chnage association. * * @param key Name of the information. * @param value Value of the information. * @return Old value of the information (it can be null if either old * value was null or given association didn't exist). */ public Object setProfileInfo(String key, Object value); } --- NEW FILE: IAuthenticationBean.java --- /* * $RCSfile: IAuthenticationBean.java,v $ * * $Log: IAuthenticationBean.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; /** Interface for authentication beans. * * Descendants of this interface should keep authentication specific data * needed to authenticate. To set data, users should use setter methods and * verifier should use getter methods. * <br> * This interface contains: * <ul> * <li>information about authentication type (string name). This information is * used to find proper verifier for this bean. * <li>user info (name) getters/setters method * <li>methods for saving/loading information to/from a stream to be able to * save/get data to/from configuration. * </ul> * User should cast to concrete type or use reflection to set all data. * Basicaly, user has to understand the way (better said information needed for) * to authenticate. On other hand verifier has to know how to use these data * to check if they are correct to confirm authentication process. * <p> * <pre> * Changes: * 16.11.2005 msts - created * </pre> * * @author msts */ public interface IAuthenticationBean { /** Returns type identificator of authentication. * * @return String name of authentication bean. */ public String getType(); /** Safely cleans sensitive data from bean. * * Destroys data from bean to be safely reused by someone else without * risk of leak previeous information. */ public void clean(); /** Checks bean. * * Examines all fields needed for bean to be verifyable. * * @throws BeanFormatException if some field is not set (message of the * exception contains all wong or unset fields separated by spaces. */ public void check()throws BeanFormatException; /** Returns user name. * * @return String with user name. */ public String getUserName(); /** Sets user name. * * @param name User name. */ public void setUserName(String name); /** Stores data to certain stream. * * Data are formated in such way, that {@link #load(InputStream)} can * reconstruct stored bean. * * @param output Stream where to put information from bean. * @throws IOException If problem when writing to stream occures. */ public void save(OutputStream output)throws IOException; /** Reconstructs bean from input stream. * * Reads data from input stream from actual possition and use read * data to fill all specific data of the bean. * * @param input Stream with data for bean. * @throws IOException If problem when reading from stram occures. * @throws AuthenticationException If problem with read data occures * (malformed or not sufficient information) */ public void load(InputStream input) throws IOException,AuthenticationException; } --- NEW FILE: DomainException.java --- /* * $RCSfile: DomainException.java,v $ * * $Log: DomainException.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; /** Class for general domain exception. * * <p> * <pre> * Changes: * 15.11.2005 msts - created * </pre> * * @author msts */ public class DomainException extends Exception { static private final long serialVersionUID = 1L; /** Constructor with message. * * @param msg Message associated with an exception. */ public DomainException(String msg) { super(msg); } /** Constructor with message and cause exception. * * @param msg Message associated with an exception. * @param cause Low level exception which caused this exception. */ public DomainException(String msg, Throwable cause) { super(msg,cause); } } --- NEW FILE: IAuthentication.java --- /* * $RCSfile: IAuthentication.java,v $ * * $Log: IAuthentication.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; /** Interface for authentication purposes. * * This interface provides implementation independed way how to authenticate. * Instance of this type is product of * {@link exfex.common.security.IAuthenticationFactory} plugin. It provides * full information and functionality to perform certain type of athentication. * Each implementator has to provide two views of class instance: * <ul> * <li>{@link exfex.common.security.IAuthenticationBean} as information carier. * <li>{@link exfex.common.security.IAuthenticationVerifier} as control * mechanism. * </ul>. * All instances should be created using {@link #getInstance()} method, because * this knows all details needed for initialization. * <br> * Implementator is responsible to provide all configuration needed for * verifying process. Verifier will use this configuration to get specific data. * <p> * Typical usage is: * <ul> * <li>User that whants to login - asks service (remote account manager view) * for possible authentication types and select one to use. * <li>service will return authentication bean. * <li>client fills data (uses reflection or cast to proper type - this requires * that such type has to be resolvable also on remote host - but this may be * done using specialized gui) and sends them back to the service. * <li>service uses verifier for such authentication method and if verifier * succeede, it will allow login. * </ul> * * <pre> * * Changes: * 29.10.2005 msts - created * </pre> * * @author msts */ public interface IAuthentication { /** Returns authentication bean view. * * Returned bean doesn't contain no information (it is empty and ready * to be used). * * @return Authentization bean instance. */ public IAuthenticationBean getAuthBean(); /** Returns authetication verifier bean. * * Returned verifier is responsible for checking authentication bean * returned from {@link #getAuthBean()} method (but it can be able to * verify more types of beans). * @return Authentication verifier instance. */ public IAuthenticationVerifier getAuthVerifier(); /** Factory method for instancing. * * This method should be used rather than <code>new</code> operator, * because some initialization may be necessary. * @return New instance of this class. */ public IAuthentication getInstance(); } --- NEW FILE: IAuthenticationFactory.java --- /* * $RCSfile: IAuthenticationFactory.java,v $ * * $Log: IAuthenticationFactory.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; import exfex.common.pluginsystem.IPlugin; /** Interface for authentication plugins. * * Implementators creates {@link exfex.common.security.IAuthentication} * instances according authentication types. * Use {@link #getAuthenticationInstance(String)} method to create instance. * <br> * Each plugin is responsible to manage all data needed for verification (e.g. * passwords for each user or keys etc.) of all supported authentication types. * <p> * <pre> * * Changes: * 6.10.2005 msts - created * </pre> * * @author msts */ public interface IAuthenticationFactory extends IPlugin { /** Creates instance of authentication with given type. * * Allways returns new instance. * * @param type Type name of authentication. * @return Instance of authentication class or null if this plugin * doesn't recognise such type. */ public IAuthentication getAuthenticationInstance(String type); /** Returns all types of authentication by this plugin. * * @return An array of authentication types, which will succede in * {@link #getAuthenticationInstance(String)} method. If no type is * supported (this shouldn't happen and Authentication manager shouldn't * allow registration of such plugin), it returns empty array (not null) */ public String[] getSupportedTypes(); } --- NEW FILE: IAuthenticationVerifier.java --- /* * $RCSfile: IAuthenticationVerifier.java,v $ * * $Log: IAuthenticationVerifier.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; /** Interface for authentication verifiers. * * Implementator is responsible to * <ul> * <li>check {@link exfex.common.security.IAuthenticationBean} (if given bean * is supported) * <li>get data needed for checking (e.g. from configuration files - parent * {@link exfex.common.security.IAuthentication} instance is responsible to * set configuration properly). * </ul> * <p> * <pre> * Changes: * 15.11.2005 msts - created * </pre> * * @author msts */ public interface IAuthenticationVerifier { /** Verifies given bean. * * Verifies given bean in implementation specific way according bean * type. Positive return value is anough gaurance, that person (or * service) who filled bean is allowed to login to the system. * <br> * Implementator should use configuration of the system to get source * data needed for verification. * * @param bean Authentication bean to verify. * @return true if given bean is correct to authenticate or false * otherwise. * @throws AuthenticationException if given bean is not supported by * this verifier. */ public boolean verify(IAuthenticationBean bean) throws AuthenticationException; } --- NEW FILE: IDomain.java --- /* * $RCSfile: IDomain.java,v $ * * $Log: IDomain.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; /** Interface for domain. * * See {@link exfex.common.security.ISecurityData} form more information about * domain model and rules for domains. * <br> * Additional and implementation specific note: each implementator has to * override <code>equals</code> and <code>hashCode</code> methods to enable * correct usege in collection classes. Both methods can assume, that name * of the domain is unique. * <p> * <pre> * Changes: * 15.11.2005 msts - created * </pre> * * @author msts */ public interface IDomain { /** Returns domain name. * * Unique name of domain (in resource scope). * @return String represention of domain name. */ public String getName(); /** Sets security context. * * @param context Security context instance. If null, context is * disabled in this domain and full access (defined by authorization * evaluator) for domain is guaranted */ public void setSecurityContext(ISecurityContext context); /** Returns actual security context. * * @return Security context instance set by * {@link #setSecurityContext(ISecurityContext)}. */ public ISecurityContext getSecurityContext(); /** Returns all members of domain. * * @return An array of members integral identificators. */ public Integer[] getMembers(); /** Adds new member. * Sets member specific security context. Authorization evaluator should * be aware of invarian descibed in {@link ISecurityData} - member * context mustn't escalate more permissions than domain's. * Implementator is not responsible for this checking. * Method will fail, if geven id already is registered. * * @param id Member identificator. Must be non null. * @param context Security context. If null, member has fully qualified * perfmisions as this domain (unless specified differently by evaluator). * @return true if added, otherwise false. */ public boolean addMember(Integer id, ISecurityContext context); /** Changes user security context. * * Same as addMemeber with exception, that it will succede also if * given id is already registered. In such situation, it will change * member's security context. * * @param id Member identificator. Must be non null. * @param context Security context. If null, member has fully qualified * perfmisions as this domain (unless specified differently by evaluator). * @return true if changed/added, or false otherwise (id is null). */ public boolean changeMember(Integer id, ISecurityContext context); /** Removes member. * * Checks if given id is registered and if so, removes it from domain. * @param id Member identificator. Must be non null. * @return true if member was removed, or false otherwise. */ public boolean removeMember(Integer id); /** Returns all subdomains. * * @return Array of all registered sub domains. */ public IDomain[] getSubDomains(); /** Adds new sub domain. * * Checks if adding this sub domain would cause cycle (recursive child * of this domain is parent of this domain). * <br> * Sub domain should be initialized, but that is not mandatory. * * @param dom Domain instance. Must be non null. * @return true if succesfull, false otherwise. */ public boolean addSubDomain(IDomain dom); /** Removes sub domain. * * @param name Domain name which is to be removed. * @return domain instance or null if given domain is not direct child * of this domain. */ public IDomain removeSubDomain(String name); /** Examines (recursuvely) if given domain is child of this domain. * * Domain is child if it is non null and one of condition is true: * <ul> * <li>it is direct child * <li>isSubDomain applied to direct subdomains returns true in for at * least one child. * </ul> * * This method can used by {@link #addSubDomain(IDomain)} method to keep * non cycle invariant - cycle won't be created if this domain is not * subDomain of domain which we want to add. * @param dom Domain instance. * @return true if given domain is child of this domain, false otherwise. */ public boolean isSubDomain(IDomain dom); } --- NEW FILE: ISecurityContext.java --- /* * $RCSfile: ISecurityContext.java,v $ * * $Log: ISecurityContext.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; import java.util.NoSuchElementException; /** Interface for implementation independed security context. * * Context is described as string key and <code>V</code> generic type value * pairs. User has to understand this association and use it properly. Value is * generic to provide type clean value returning rather than general arbitrary * Object would do. * <br> * Use {@link #add} and {@link #get} methods to manipulate context. * * <p> * <pre> * Changes: * 15.11.2005 msts - created * </pre> * * @param <V> Generic type of values stored in context. * @author msts */ public interface ISecurityContext<V> { /** Adds key, value pair to the context. * * If given key already is in the context, changes its value. * * @param key Key name. Must be non null. * @param value Value associated with the key. May have null value. * @return Previous associated value (may be null if either key, value * pair wasn't in the map or previous value was null. * @throws NullPointerException if key value is null string. */ public V add(String key, V value)throws NullPointerException; /** Returns value associated with given key. * * @param key Key name. Must be non null. * @return Value instance associated with the key. * @throws NoSuchElementException If key couldn't be found. * @throws NullPointerException if given key is null string. */ public V get(String key); } --- NEW FILE: IResource.java --- /* * $RCSfile: IResource.java,v $ * * $Log: IResource.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; /** Interface for resource which needs authorization. * * Instance of this type is used during authorization process. Authorization * manager plugin holds list of all resources with assigned implementation * specific capabilities information. * <p> * <pre> * Changes: * 30.9.2005 msts - created * </pre> * * @author msts */ public interface IResource { /** Sets resource object. * * @param resorceObject Object to set. */ public void setResource(Object resorceObject); /** Returns resource object. * * @return instance of the resource object. */ public Object getResource(); /** Returnes symbolic resource name. * * @return Name of the resource. */ public String getName(); /** Sets symbolic resource name. * * @param name The name of the resource. */ public void setName(String name); } Index: package.html =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/security/package.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** package.html 18 Oct 2005 17:46:15 -0000 1.1 --- package.html 27 Nov 2005 13:04:45 -0000 1.2 *************** *** 10,16 **** <h2>Package Specification</h2> ! This package contains all classes and interfaces for security system. <br> ! TODO </body> </html> --- 10,38 ---- <h2>Package Specification</h2> ! This package contains definitions of all classes and interfaces for security ! system. It involves: ! <ul> ! <li>Identities management - information about logged users. It is represented ! by IdentityManager class and it is not pluginable. ! <li>Account management - information needed for user management (adding, ! removing users) and login/logout process. ! <li>Authentication management - information and classes for verification data ! for authentication process (methods of login to the system). ! <li>Authorization management - information and classes for authorization ! evalueation for certain resources. To provide implementation independed using ! of these classes, Capability model is used. Each authorization request is ! translated to the set of Capabilities examination upon resources. So subsystem ! which has to be independed on authorization implementation, uses just cap. by ! their names and provide just logic of security, NOT its realization. ! <li>Security data - Domain model used for storage for implementation independed ! security. Concrete security model (UNIX permisions, ACL, hierarchy model) can ! use this storage for permision evaluation. ! </ul> <br> ! ! All parts (with IdentityManager and exception classes) of this package are just ! interfaces for plugins that should implement functionality. These plugins should ! be in exfex.common.plugins.security package. ! </body> </html> --- NEW FILE: IAuthorizationManager.java --- /* * $RCSfile: IAuthorizationManager.java,v $ * * $Log: IAuthorizationManager.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; import exfex.common.pluginsystem.IPlugin; /** Interface for autorization manager plugins. * * <h3>Overview</h3> * Implementator of this inteface manages * <ul> * <li>logic for authorization process (who is allowed to do what). To enable * this, it uses model of {@link exfex.common.security.ICapability capabilities}. * <li>{@link exfex.common.security.IResource resources} for authorization. This * stands for arbitrary named data, which are internally used to associate with * concrete model's security data (such as access permissions etc.) * </ul> * * <h3>Implementation notes</h3> * Plugin should register itself to the PluginManager to be easily accessible. * There are possibility of more than one auth. manager in the system. The * reason is, that each one is specialized. This implies that all users of * manager has to be aware of this and has to know which plugin to use - e.g. * from configuration. Manager keeps data (it is statefull) and so it has to * be aware of this, when new version of plugin is replacing an old version * (e.g. sets its state from replaced version). * * <h4>Resources</h4> * Resources can, but don't have to be real objects. They has to have unique * names on this manager. They don't have to understand anything about security, * but just for situation when the are asked for something they are registered * as Object instances. Capabilities may use this instances internally. * <br> * If no rules are defined for a resource and sombedoy asks for capability on * such resource, answer is implicitly false. * * <h4>Plugin implementation</h4> * Manager should be statefull and persist all of data which are dynamicaly * created. * It is responsible to get all necessery data from configuration during * registration process (e.g. if users are intended to have som associated * groups, it has to be read from group file - analogously to * <code>/etc/group</code> file in UNIX). * <br> * Instancing policy is (in contrast to most other managers) defined. * Implementator may choose (standard) singleton model or creates each time new * instance. Both of them have advantages and disadvantages. Singleton model * has pros that all users of manager has guarance that they are using same * manager and so setting from one subsystem is available to another one. So * global setting and authorization is available. This isn't very suitable when * some subsystem needs to have its own authorization setting - e.g. because of * resource name clashing or different view on permissions. Whatever model is * used, implementator should document it. * <br> * Capabilities are not product of plugin. This is too restrictive in one view, * but brigns design cleanness because each capability has to have access to * authorization (implementation) specific data structure which keeps permission * data (like {@link exfex.common.security.ISecurityData} or adapter upon this * class). So manager is comming with certain set of available capabilities * which are tightly connected to the manager. So each capability correction * requires new manager plugin upload (NOTE this can change in future version * of authtorization system). * <br> * Plugin is intended ONLY for local usage and should be never returned to the * remote side. * * <p> * <pre> * Changes: * 30.9.2005 msts - creted * </pre> * * @author msts */ public interface IAuthorizationManager extends IPlugin { /** Returns capability implementation with given name. * * @param capName Capability name. * @return Instance of the capability. */ public ICapability getCapability(String capName); /** Returns all capabilities implementators. * * @return Array of all capabilities implementators. */ public ICapability [] getCapabilities(); /** Sets given capability for user on resource. * * TODO - descrition and context - maybe move to ICapability for more * convinience. * * @param capName The name of the capability to set. * @param profile User to set this capability. * @param resource Resource */ public void setCapability(String capName, IUser profile, IResource resource); /** Adds resource. * * Add given object to the resource list which can be considered in * authorization process and assiciate it with given name. * * @param res Resource to add. Arbitrary object, that needs to external * authorization. It doesn't know about authorization process, this * logic is made in capability implementation. * @param name Name of the resource. There are no restrictions on value * except, it can't be null and names have to be unique. Value is used * to identify resource. * @return IResource instance if object was registered or null * otherwise. */ public IResource addResource(Object res, String name); /** Removes resource with given name. * * @param name Resource name to remove. * @return Removed resource. */ public IResource removeResource(String name); /** Returns resource instanca according given name. * * @param name Resource name. * @return Resource instance or null if doesn't exist. */ public IResource getResourceByName(String name); /** Returns all registerd resources. * * @return Array of all resources instances. */ public IResource [] getResources(); } --- NEW FILE: IAccountManager.java --- /* * $RCSfile: IAccountManager.java,v $ * * $Log: IAccountManager.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; import exfex.common.pluginsystem.IPlugin; /** Interfaces for account manager plugins. * * Account manager is intended for management of all system accounts and login * facilitity. * This involves: * <ul> * <li>user management - user accounts with information about each (name, * uid - user identificator). This doesn't involve information about what is * user authorized to do. * <li>authentice users - implements login (and logout) method to get access to * the system. Uses {@link exfex.common.security.IAuthenticationManager} for * supported methods of authentication methods and verifiers which can be to * check. * </ul> * Plugin should register itself to the PluginManager. For security reasons * it shouldn't be available to the untrusted (remote) environment and remote * view should be created instead (plugin available to remote side with secure * manipulation with instance of this type). * * <p> * <pre> * Changes: * 29.10.2005 msts - created * </pre> * * @author msts */ public interface IAccountManager extends IPlugin { /** Login given user to the system. * * Checks authentication information (authentication bean) given as * parameter with implementation specific data from configuration. * Bean contains information about its type and user that whant to login. * {@link IAuthenticationManager} can be asked for verifier for this * type of authentication. * <br> * If everything is correct, creates identity for user using * {@link IdentityManager}. This identity is user representation in * system used to verify him. * * @param auth Authentication information for logging. * @return Identity created for given user. After login, user is * recognised by this identity. * @throws AccountException If problem during authentication occures. * This involves bad auth istance according to type or malformed data in * auth instance. * @throws AccessDeniedException If given auth data doesn't match one in the * system (e.g. bad password, user doesn't exist, ...). */ public Identity login(IAuthenticationBean auth) throws AccountException, AccessDeniedException; /** Logs out user with given id (from Identity). * * Destroys all data created in login. * * @param id Identity identificator. * @throws AccountException If given identity is not loged. */ public void logout(Integer id)throws AccountException; /** Adds new user to the system. * * Persist information for login process. After this method, user can * log in using given auth method and data. <code>name</code> must be * unique in the system. * <br> * Implementator should bind user name with UID. * * @param name User name. * @param auth Authentication data for login. * @throws AccountException If given user can't be created (see message * for more information). */ public void addUser(String name, IAuthentication auth) throws AccountException; /** Removes user from the system. * * @param name User name. * @throws AccountException If remove failed (see message for more * information). */ public void removeUser(String name) throws AccountException; /** Gets instance of user profile. * * @param name User name. * @return User profile instance. * @throws AccountException If user doesn't exist in the system. */ public IUser getUserProfile(String name) throws AccountException; /** Returns all users' names in the system. * * @return Array of all users. */ public String [] getUsers(); } --- NEW FILE: SecurityException.java --- /* * $RCSfile: SecurityException.java,v $ * * $Log: SecurityException.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; import exfex.common.pluginsystem.PluginException; /** Security exception. * * Caller of an operation has not permission for the operation. * * <pre> * Changes: * 14.10.2005 msts - created * </pre> * * @author msts */ public class SecurityException extends PluginException { /** Serialization version constant. */ static final long serialVersionUID = 1L; /** Constructor with string message context. * * @param msg Context message of the exception. */ public SecurityException(String msg) { super(msg); } /** Constructor with string message context and low level exception * which caused this exception. * @param msg Context message of the exception. * @param cause Low level exception that caused this exception. */ public SecurityException(String msg, Throwable cause) { super(msg,cause); } } --- NEW FILE: ICapability.java --- /* * $RCSfile: ICapability.java,v $ * * $Log: ICapability.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; /** Interface for capability. * * <h3>Overview</h3> * Capability provides security system independed way how to check and set * authorization for some action on resource. It is part of AuthorizationManager. * <br> * When certain system needs to perform authorization checking - if user can * perform operation on resource - it will ask if user has capability for it. * Capabilities are recognized by their names ({@link #getName()} method). * Implementator of this interface perform all low level checking which are * implementation specific in {@link #hasCapability(IUser)} method. To get * all implementation specific data, uses its AuhtorizationManager which is * responsible for managing this data. This is not standardized and depends on * concrete implementation. * <br> * On other hand, if we want to authorize user in certain context to perform * action on specified resource, we can use {@link #setCapability(IUser)} method * for all implementation specific low level actions. * <br> * All data which Capability instance needs for checking from user side, are * stored in {@link exfex.common.security.ICapabilityContext context}. * Each user of capability has to know how to use capability context. Setting * can vary in each capability. See the documentation of specific capability * (at least resource has to be set in most of capabilities). * * <h3>Capability names</h3> * The name of the capability has to be unique in AuthorizationManager scope and * so it should be used in overriden equals and hashCode methods which should * be implemented in each implementator. * <br> * Name should be logicaly connected to operation that will be allowed when * capability is granted. * * <p> * * <pre> * 14.11.2005 msts - setCapability method added * 30.9.2005 msts - created * </pre> * * @author msts */ public interface ICapability { /** Examines if given user is authorized in given context. * * NOTE that context has to be set before this method is called. * * @see #setContext(ICapabilityContext) * @param profile User profile. * @return true if user is authorized or false otherwise. */ public boolean hasCapability(IUser profile); /** Sets capability for user. * * If this method succede, next call of the hasCapability with same * resp. subset context will return true. Each call will rewrite * previous one, so if context gives wider resp. more restricitve * context, new set wil take effect. * <br> * NOTE that context has to be set before this method is called. * @param profile User profile. * @return true if succede, false otherwise */ public boolean setCapability(IUser profile); /** Sets context for the capability. * * Each context has to specify at least resource which is included * in capability verification resp. setting. * @param context Context. */ public void setContext(ICapabilityContext context); /** Returns actual context. * Changes made to this instance should take effect in capability unless * said differently. * @return Instance of the capability. */ public ICapabilityContext getCapabilityContext(); /** Capability name. * * Capability can be recognized by this name. * @return The name of the capability. */ public String getName(); } --- NEW FILE: UnsupportedAuthTypeException.java --- /* * $RCSfile: UnsupportedAuthTypeException.java,v $ * * $Log: UnsupportedAuthTypeException.java,v $ * Revision 1.1 2005/11/27 13:04:45 mstsxfx * security system interfaces and classes * */ package exfex.common.security; /** Exception for unsupported authentication type. * * ... [truncated message content] |
From: Michal H. <ms...@us...> - 2005-11-01 20:19:34
|
Update of /cvsroot/exfex/exfex/source/exfex/common/plugins/displaysystem/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19790/source/exfex/common/plugins/displaysystem/swing Modified Files: SWINGCheckBoxFactory.java SWINGButtonFactory.java SWINGLabelFactory.java SWINGComboBoxFactory.java Log Message: String code cleanup (doesn't use new String construction) Index: SWINGCheckBoxFactory.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/plugins/displaysystem/swing/SWINGCheckBoxFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SWINGCheckBoxFactory.java 18 Oct 2005 17:58:12 -0000 1.1 --- SWINGCheckBoxFactory.java 1 Nov 2005 20:19:23 -0000 1.2 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.2 2005/11/01 20:19:23 mstsxfx + * String code cleanup (doesn't use new String construction) + * * Revision 1.1 2005/10/18 17:58:12 mstsxfx * display package renamed to displatsystem *************** *** 137,141 **** ! private String PluginName = new String("SWINGCheckBox"); @IInject() --- 140,144 ---- ! private String PluginName = "SWINGCheckBox"; @IInject() Index: SWINGButtonFactory.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/plugins/displaysystem/swing/SWINGButtonFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SWINGButtonFactory.java 18 Oct 2005 17:58:12 -0000 1.1 --- SWINGButtonFactory.java 1 Nov 2005 20:19:23 -0000 1.2 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.2 2005/11/01 20:19:23 mstsxfx + * String code cleanup (doesn't use new String construction) + * * Revision 1.1 2005/10/18 17:58:12 mstsxfx * display package renamed to displatsystem *************** *** 51,54 **** --- 54,60 ---- JButton button; + @IInject + IDisplayManager manager; + public SWINGButton() { *************** *** 234,238 **** public class SWINGButtonFactory implements IButtonFactory { ! private String PluginName=new String("SWINGButton"); @IInject() --- 240,244 ---- public class SWINGButtonFactory implements IButtonFactory { ! private String PluginName="SWINGButton"; @IInject() Index: SWINGLabelFactory.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/plugins/displaysystem/swing/SWINGLabelFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SWINGLabelFactory.java 18 Oct 2005 17:58:12 -0000 1.1 --- SWINGLabelFactory.java 1 Nov 2005 20:19:23 -0000 1.2 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.2 2005/11/01 20:19:23 mstsxfx + * String code cleanup (doesn't use new String construction) + * * Revision 1.1 2005/10/18 17:58:12 mstsxfx * display package renamed to displatsystem *************** *** 173,177 **** { /** Plugin name. */ ! private String PluginName=new String("SWINGLabel"); /** Display manager dependency. --- 176,180 ---- { /** Plugin name. */ ! private String PluginName="SWINGLabel"; /** Display manager dependency. Index: SWINGComboBoxFactory.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/plugins/displaysystem/swing/SWINGComboBoxFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SWINGComboBoxFactory.java 18 Oct 2005 17:58:12 -0000 1.1 --- SWINGComboBoxFactory.java 1 Nov 2005 20:19:23 -0000 1.2 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.2 2005/11/01 20:19:23 mstsxfx + * String code cleanup (doesn't use new String construction) + * * Revision 1.1 2005/10/18 17:58:12 mstsxfx * display package renamed to displatsystem *************** *** 224,228 **** public class SWINGComboBoxFactory implements IComboBoxFactory { ! private String PluginName = new String("SWINGComboBox"); @IInject() --- 227,231 ---- public class SWINGComboBoxFactory implements IComboBoxFactory { ! private String PluginName = "SWINGComboBox"; @IInject() |
From: Michal H. <ms...@us...> - 2005-11-01 20:19:07
|
Update of /cvsroot/exfex/exfex/source/exfex/common/plugins/remote/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19706/source/exfex/common/plugins/remote/pluginsystem Modified Files: BasicRemotePluginManager.java BasicRemotePluginManagerFactory.java Log Message: Sync with interface changes String code cleanup (doesn't use new String construction) Index: BasicRemotePluginManagerFactory.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/plugins/remote/pluginsystem/BasicRemotePluginManagerFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BasicRemotePluginManagerFactory.java 18 Oct 2005 17:54:41 -0000 1.1 --- BasicRemotePluginManagerFactory.java 1 Nov 2005 20:18:58 -0000 1.2 *************** *** 3,6 **** --- 3,10 ---- * * $Log$ + * Revision 1.2 2005/11/01 20:18:58 mstsxfx + * Sync with interface changes + * String code cleanup (doesn't use new String construction) + * * Revision 1.1 2005/10/18 17:54:41 mstsxfx * plugin for remote view of plugin manager + helper class *************** *** 10,16 **** --- 14,22 ---- import exfex.common.pluginsystem.AbstractPlugin; + import exfex.common.pluginsystem.IAcceptPlugin; import exfex.common.pluginsystem.IContext; import exfex.common.pluginsystem.IPluginPolicy; import exfex.common.pluginsystem.IPluginStrategy; + import exfex.common.pluginsystem.PluginException; import exfex.common.pluginsystem.PluginManager; import exfex.common.remote.pluginsystem.IRemotePluginManager; *************** *** 38,41 **** --- 44,49 ---- * <li> <code>getInstance</code> respectively <code>remoteView</code> can return * with null, if BasicRemotePluginManager can't be created. + * <li> Doesn't keep any reference to local objects created outside of this + * class and so can be clearly used for remote sending. * </ul> * *************** *** 69,82 **** "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. * --- 77,85 ---- "To work properly this plugin needs also "+ "BasicRemotePluginManager class in same package.") ! public class BasicRemotePluginManagerFactory implements IRemotePluginManagerFactory { private static final long serialVersionUID = 1L; /** Remote view of the PluginManager created from local view. * *************** *** 84,98 **** 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. * --- 87,137 ---- private IRemotePluginManager remoteView=null; ! private final String name="BasicRemotePluginManager"; ! public BasicRemotePluginManagerFactory() { } + /** This method does nothing. + */ + public void dependencyNotify() + { + } + + /** Returns PluginManager instance (manager of this plugin). + */ + public IAcceptPlugin getManager() + { + return PluginManager.getInstance(); + } + + /** Returns plugin's name. + */ + public String getName() + { + return name; + } + + /** Registers to the PluginManager. + */ + public void registerMe() throws PluginException + { + PluginManager.getInstance().attach(this); + } + + /** Unregisters from system. + */ + public void unRegisterMe() + { + try + { + PluginManager.getInstance().dettach(this); + remoteView=null; + }catch(Exception e) + { + // TODO handle + } + } + /** Returns instance of BasicRemotePluginManager class. * *************** *** 106,110 **** * create. */ - @Override public Object getInstance(IContext context) { --- 145,148 ---- *************** *** 113,117 **** try { ! remoteView=(IRemotePluginManager)new BasicRemotePluginManager(manager); }catch(Exception e) { --- 151,156 ---- try { ! remoteView=new BasicRemotePluginManager( ! PluginManager.getInstance()); }catch(Exception e) { Index: BasicRemotePluginManager.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/plugins/remote/pluginsystem/BasicRemotePluginManager.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BasicRemotePluginManager.java 19 Oct 2005 19:24:47 -0000 1.2 --- BasicRemotePluginManager.java 1 Nov 2005 20:18:58 -0000 1.3 *************** *** 3,6 **** --- 3,10 ---- * * $Log$ + * Revision 1.3 2005/11/01 20:18:58 mstsxfx + * Sync with interface changes + * String code cleanup (doesn't use new String construction) + * * Revision 1.2 2005/10/19 19:24:47 mstsxfx * synch with interface changes *************** *** 18,24 **** import java.io.File; import java.io.IOException; - import java.rmi.Remote; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; import java.util.List; --- 22,28 ---- import java.io.File; import java.io.IOException; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; + import java.util.ArrayList; import java.util.List; *************** *** 29,32 **** --- 33,37 ---- import exfex.common.pluginsystem.PluginManager; import exfex.common.pluginsystem.PluginSecurityException; + import exfex.common.remote.IRemote; import exfex.common.remote.pluginsystem.IRemotePluginManager; import exfex.common.remote.security.IRemoteIdentity; *************** *** 89,93 **** super(); if(localView==null) ! throw new NullPointerException(new String("Given localView is null")); this.manager=localView; } --- 94,98 ---- super(); if(localView==null) ! throw new NullPointerException("Given localView is null"); this.manager=localView; } *************** *** 99,107 **** * 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. --- 104,117 ---- * Calls {@link exfex.common.pluginsystem.PluginManager#readyPlugins()} * method after security checks and uses plugins to create plugins type ! * name pairs array. Just those plugins are in the result which are ! * compatibles with given typeMask type. If typeMask is null, it is ! * treated like <code>IPlugin.class</code> was given (it means, all ! * from list are returned). Uses {@link #matchingPairs(List, Class)} ! * method for selection. * <br> * Changes to this list takes no effect to the manager's list. * * @param id Identity of the caller caller. + * @param typeMask Type compatibility restriction. * @return List of ready plugins names. * @throws RemoteException If problem during RMI call occures. *************** *** 109,113 **** * operation. */ ! synchronized public Pair<Class<? extends IPlugin>, String>[] readyPlugins(IRemoteIdentity id) throws RemoteException,PluginSecurityException//{{{ { --- 119,123 ---- * operation. */ ! synchronized public Pair<Class<? extends IPlugin>, String>[] readyPlugins(IRemoteIdentity id, Class<?> typeMask) throws RemoteException,PluginSecurityException//{{{ { *************** *** 116,128 **** // 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; }//}}} --- 126,130 ---- // copies names of plugins List<IPlugin> plugins=manager.readyPlugins(); ! return matchingPairs(plugins, typeMask); }//}}} *************** *** 132,137 **** --- 134,145 ---- * * Returns plugins name, type pairs which are waiting in depList. + * Just those plugins are in the result which are compatibles with given + * typeMask type. If typeMask is null, it is treated like + * <code>IPlugin.class</code> was given (it means, all from list are + * returned). Uses {@link #matchingPairs(List, Class)} method for + * selection. * * @param id Identity of the caller. + * @param typeMask Type compatibility restriction. * @return Array of plugin type and name pairs. * @throws RemoteException If problem during RMI call occures. *************** *** 139,143 **** * operation. */ ! synchronized public Pair<Class<? extends IPlugin>, String>[] pendingPlugins(IRemoteIdentity id) throws RemoteException,PluginSecurityException//{{{ { --- 147,151 ---- * operation. */ ! synchronized public Pair<Class<? extends IPlugin>, String>[] pendingPlugins(IRemoteIdentity id, Class<?> typeMask) throws RemoteException,PluginSecurityException//{{{ { *************** *** 145,157 **** 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; }//}}} --- 153,157 ---- List<IPlugin> plugins=manager.pendingPlugins(); ! return matchingPairs(plugins, typeMask); }//}}} *************** *** 159,163 **** * TODO */ ! public void uploadFile(IRemoteIdentity id, File file, String location) throws RemoteException, IOException { --- 159,163 ---- * TODO */ ! synchronized public void uploadFile(IRemoteIdentity id, File file, String location) throws RemoteException, IOException { *************** *** 242,246 **** * 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. --- 242,247 ---- * TODO id and security layer. * ! * Gets plugin with given type and name (using ! * {@link PluginManager#getPlugin(Class, String)} method) and * delegates all work to the {@link PluginManager#remove(IPlugin)} * method. *************** *** 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(); } --- 290,295 ---- { // FIXME security ! if(!PluginComparator.isCompatible(IRemote.class,plgType)) ! throw new PluginException("Given plugin Type="+plgType+" is not for remote usage"); return manager.getByIface(plgType).toList(); } *************** *** 317,324 **** { // 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); } } --- 318,364 ---- { // FIXME security ! if(!PluginComparator.isCompatible(IRemote.class,plgType)) ! throw new PluginException("Given plugin Type="+plgType)+" is not for remote usage."; return manager.getByName(plgType, name); } + // HELPER CLASSES + //================ + + /** Creates type name pairs from all plugins with compatible type as + * given typeMask. + * + * @param list List of plugins. + * @param typeMask Type to compare to. Null parameter is treated like + * <code>IPlugin.class</code> was given. + * @return Array of type name pairs with compatible type with typeMask. + */ + protected Pair<Class<? extends IPlugin>, String>[] matchingPairs(List<IPlugin> list, Class<?> typeMask) + { + // create return array with intial list size. + ArrayList<Pair<Class<? extends IPlugin>, String>> names= + new ArrayList<Pair<Class<? extends IPlugin>, String>> + (list.size()); + + // makes alias to null + if(typeMask==null) + typeMask=IPlugin.class; + + // fills arraylist with compatibles pairs + // size counts really inserted pairs + int size=0; + for(IPlugin p: list) + { + if(PluginComparator.isCompatible(typeMask, p)) + { + names.add(new Pair<Class<? extends IPlugin>, String> + (p.getClass(),p.getName())); + size++; + } + } + + // creates array from arraylist + Pair<Class<? extends IPlugin>, String> array[]=new Pair[size]; + return names.toArray(array); + } } |
From: Michal H. <ms...@us...> - 2005-11-01 20:18:14
|
Update of /cvsroot/exfex/exfex/source/exfex/common/plugins/remote In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19444/source/exfex/common/plugins/remote Modified Files: package.html Log Message: documentation update Index: package.html =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/plugins/remote/package.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** package.html 18 Oct 2005 17:47:15 -0000 1.1 --- package.html 1 Nov 2005 20:18:05 -0000 1.2 *************** *** 0 **** --- 1,19 ---- + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> + <html> + <head> + + </head> + <body bgcolor="white"> + + Basic package for remote common plugins. + + <h2>Package Specification</h2> + + This package contains (or should contain) all plugins used for creating of + remote views of local objects. Remote view stands for object using RMI + mechanism delegating all operation to the local instance. To guarantee security + all such object should perform authorization checking. + <br> + All subsystems have its subpackage to keep order in big amount of plugins. + </body> + </html> \ No newline at end of file |
From: Michal H. <ms...@us...> - 2005-11-01 20:17:41
|
Update of /cvsroot/exfex/exfex/source/exfex/common/logging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19279/source/exfex/common/logging Modified Files: LogManager.java Log Message: String code cleanup (doesn't use new String construction) Index: LogManager.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/logging/LogManager.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** LogManager.java 18 Oct 2005 17:43:41 -0000 1.10 --- LogManager.java 1 Nov 2005 20:17:26 -0000 1.11 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.11 2005/11/01 20:17:26 mstsxfx + * String code cleanup (doesn't use new String construction) + * * Revision 1.10 2005/10/18 17:43:41 mstsxfx * unlock in finally block *************** *** 298,302 **** } }else ! abspath=new String(""); stream=descriptorMap.get(abspath); --- 301,305 ---- } }else ! abspath=""; stream=descriptorMap.get(abspath); |
From: Michal H. <ms...@us...> - 2005-11-01 20:16:15
|
Update of /cvsroot/exfex/exfex/source/exfex/common/pluginsystem In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18863/source/exfex/common/pluginsystem Modified Files: VersionRestricted.java DependencySource.java IPlugin.java AcceptPlugin.java TypeRestricted.java ChainedRestricted.java PluginList.java NameRestricted.java AbstractPlugin.java PluginManager.java PluginComparator.java DependencyMap.java Log Message: String code cleanup (doesn't use new String construction) Index: PluginComparator.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/PluginComparator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PluginComparator.java 17 Oct 2005 18:36:54 -0000 1.2 --- PluginComparator.java 1 Nov 2005 20:16:02 -0000 1.3 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.3 2005/11/01 20:16:02 mstsxfx + * String code cleanup (doesn't use new String construction) + * * Revision 1.2 2005/10/17 18:36:54 mstsxfx * isCompatible with 2 types *************** *** 54,57 **** --- 57,61 ---- * proceeding, calls this method recursively to its direct supertype. * To find out super type, uses Class.getSuperclass() method. + * If given type is interface, adds it also to the list. * <br> * This method guaranties that all implemented interfaces of given type, *************** *** 69,73 **** return; ! // get interfaces of type Class ifaces[]=type.getInterfaces(); --- 73,81 ---- return; ! // if type is interface, it is also added ! if(type.isInterface() && !list.contains(type)) ! list.add(type); ! ! // gets interfaces of type Class ifaces[]=type.getInterfaces(); *************** *** 80,84 **** for(Class i : ifaces) { ! list.add(i); getIfaces(i,list); } --- 88,93 ---- for(Class i : ifaces) { ! if(!list.contains(i)) ! list.add(i); getIfaces(i,list); } *************** *** 133,137 **** * * Uses {@link #getIfaces(Class, List)} method to get all implemented ! * interfaces of both given types. * @param type1 Type to compare to. * @param type2 Type to examine. --- 142,150 ---- * * Uses {@link #getIfaces(Class, List)} method to get all implemented ! * interfaces of both given types and compares if type2 implements at ! * least those interfaces from type1. If yes type2 is compatible with ! * type1 (and can stand for it). Uses ! * {@link #areIfaceCompatible(List, List)} method to compare. ! * * @param type1 Type to compare to. * @param type2 Type to examine. *************** *** 141,145 **** static public boolean isCompatible(Class<?> type1, Class<?> type2) { ! return type1.isInstance(type2); } --- 154,166 ---- static public boolean isCompatible(Class<?> type1, Class<?> type2) { ! List<Class<?>> list1=new LinkedList<Class<?>>(); ! List<Class<?>> list2=new LinkedList<Class<?>>(); ! ! // gets all interfaces ! getIfaces(type1,list1); ! getIfaces(type2,list2); ! ! // compares created lists ! return areIfaceCompatible(list1,list2); } Index: AcceptPlugin.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/AcceptPlugin.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** AcceptPlugin.java 17 Oct 2005 18:29:00 -0000 1.14 --- AcceptPlugin.java 1 Nov 2005 20:16:02 -0000 1.15 *************** *** 5,8 **** --- 5,11 ---- * * $Log$ + * Revision 1.15 2005/11/01 20:16:02 mstsxfx + * String code cleanup (doesn't use new String construction) + * * Revision 1.14 2005/10/17 18:29:00 mstsxfx * map mechanism rewritten *************** *** 247,251 **** { if(plugin==null) ! throw new PluginException(new String("Parameters incorrect"),new NullPointerException()); rwl.writeLock().lock(); --- 250,254 ---- { if(plugin==null) ! throw new PluginException("Parameters incorrect",new NullPointerException()); rwl.writeLock().lock(); *************** *** 282,286 **** { log(ILogger.Level.ERROR,"Error during plugin "+plugin+" registration. Reason="+e.getMessage()); ! throw new PluginException(new String("Registration problems"),e); }finally { --- 285,289 ---- { log(ILogger.Level.ERROR,"Error during plugin "+plugin+" registration. Reason="+e.getMessage()); ! throw new PluginException("Registration problems",e); }finally { *************** *** 300,304 **** { if(plugin==null) ! throw new PluginException(new String("Parameters incorect"), new NullPointerException()); rwl.writeLock().lock(); --- 303,307 ---- { if(plugin==null) ! throw new PluginException("Parameters incorect", new NullPointerException()); rwl.writeLock().lock(); *************** *** 310,314 **** PluginType plgt=new PluginType(plugin); if(!map.containsKey(plgt)) ! throw new PluginException(new String("Plugin is not registered")); // get set with all IFace lists --- 313,317 ---- PluginType plgt=new PluginType(plugin); if(!map.containsKey(plgt)) ! throw new PluginException("Plugin is not registered"); // get set with all IFace lists Index: NameRestricted.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/NameRestricted.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NameRestricted.java 29 Sep 2005 17:41:54 -0000 1.2 --- NameRestricted.java 1 Nov 2005 20:16:02 -0000 1.3 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.3 2005/11/01 20:16:02 mstsxfx + * String code cleanup (doesn't use new String construction) + * * Revision 1.2 2005/09/29 17:41:54 mstsxfx * hashCode implemented *************** *** 81,85 **** @Override public String toString() { ! return new String("NameRestricted["+getName()+"]"); } --- 84,88 ---- @Override public String toString() { ! return "NameRestricted["+getName()+"]"; } Index: PluginList.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/PluginList.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** PluginList.java 19 Oct 2005 19:26:39 -0000 1.15 --- PluginList.java 1 Nov 2005 20:16:02 -0000 1.16 *************** *** 6,9 **** --- 6,12 ---- * * $Log$ + * Revision 1.16 2005/11/01 20:16:02 mstsxfx + * String code cleanup (doesn't use new String construction) + * * Revision 1.15 2005/10/19 19:26:39 mstsxfx * code cleanup *************** *** 436,440 **** @Override synchronized public String toString() { ! return new String("Plugin list{"+list.toString()+"}"); } --- 439,443 ---- @Override synchronized public String toString() { ! return "Plugin list{"+list.toString()+"}"; } Index: TypeRestricted.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/TypeRestricted.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TypeRestricted.java 30 Sep 2005 18:33:00 -0000 1.3 --- TypeRestricted.java 1 Nov 2005 20:16:02 -0000 1.4 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.4 2005/11/01 20:16:02 mstsxfx + * String code cleanup (doesn't use new String construction) + * * Revision 1.3 2005/09/30 18:33:00 mstsxfx * uses PluginComparator for plugins type comparing *************** *** 77,81 **** @Override public String toString() { ! return new String("TypeRestricted["+getType()+"]"); } --- 80,84 ---- @Override public String toString() { ! return "TypeRestricted["+getType()+"]"; } Index: ChainedRestricted.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/ChainedRestricted.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ChainedRestricted.java 29 Sep 2005 17:41:15 -0000 1.2 --- ChainedRestricted.java 1 Nov 2005 20:16:02 -0000 1.3 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.3 2005/11/01 20:16:02 mstsxfx + * String code cleanup (doesn't use new String construction) + * * Revision 1.2 2005/09/29 17:41:15 mstsxfx * hashCode implemented *************** *** 166,170 **** @Override public String toString() { ! return new String("ChainedRestricted"+chain); } } --- 169,173 ---- @Override public String toString() { ! return "ChainedRestricted"+chain; } } Index: IPlugin.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/IPlugin.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** IPlugin.java 18 Oct 2005 17:53:39 -0000 1.13 --- IPlugin.java 1 Nov 2005 20:16:02 -0000 1.14 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.14 2005/11/01 20:16:02 mstsxfx + * String code cleanup (doesn't use new String construction) + * * Revision 1.13 2005/10/18 17:53:39 mstsxfx * doc update *************** *** 135,138 **** --- 138,172 ---- * (e.g. Buttons should use IButtonfactory for plugin and IButton for maintained * object). + * <p> + * Plugins are intended primary for internal purposes - local usage - but plugin + * system expects distributed usage. So PluginManager (coordinator of plugin + * system) stands for server side and with little efford, remote view of it + * can be exported ({@link exfex.common.remote.pluginsystem.IRemotePluginManager}). + * This remote view of plugin manager can be used for remote control of the + * plugin system. This usage is obviously restricted. Just methods from + * IRemotePluginManager interface can be used remotely and implementator + * (an instance produced by plugin with IRemotePluginManagerFactory) is + * responsible for authorization checking. + * <br> + * It may be usefull to be able to return copy of a plugin registered in the + * system to the remote side even if plugin is not remote object (remote view + * of local object using RMI). Client side can use such plugin to create remote + * objects (product of the plugin) and use it for its purposes. Such plugins has + * to implement {@link exfex.common.remote.IRemote} interface, which is just + * marker and doesn't imply that such plugin is remote object. It can be just + * returned from remote calls. Be very carefull when implementing such plugins, + * because RMI makes copy of whole plugin instance when sending it to the remote + * client. This implies following risks: + * <ul> + * <li> Big amount of data that are copied - e.g. plugin has reference to the + * PluginManager as private field and so whole PluginManager copy will be copied + * too! + * <li> Security risc - similar as previous scenario - copy of some sensitive + * class is copied (e.g. IdentityManager with all internall data used to + * guarantee secure identity handling). + * </ul> + * NOTE: + * Please see <a href="http://java.sun.com/j2se/1.5.0/docs/guide/rmi/spec/rmiTOC.html">RMI mechanism</a> + * for more details. * * <h3>Dependencies</h3> *************** *** 314,318 **** * @Override String toString() * { ! * return new String("Plugin["+getName()+"]"); * } * } --- 348,352 ---- * @Override String toString() * { ! * return "Plugin["+getName()+"]"; * } * } *************** *** 434,437 **** --- 468,472 ---- * * <pre> + * TODO reconsider Serializable for this interface * * Cahnges: Index: PluginManager.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/PluginManager.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** PluginManager.java 19 Oct 2005 19:27:26 -0000 1.22 --- PluginManager.java 1 Nov 2005 20:16:02 -0000 1.23 *************** *** 6,9 **** --- 6,12 ---- * * $Log$ + * Revision 1.23 2005/11/01 20:16:02 mstsxfx + * String code cleanup (doesn't use new String construction) + * * Revision 1.22 2005/10/19 19:27:26 mstsxfx * getPlugin method added *************** *** 612,616 **** { log(ILogger.Level.CRIT,"Can't save state - possibly bug"); ! throw new PluginLoadException(new String("Can't save manager state"),e); } log(ILogger.Level.DEBUG,"PluginManager.load State of the manager saved: "+this); --- 615,619 ---- { log(ILogger.Level.CRIT,"Can't save state - possibly bug"); ! throw new PluginLoadException("Can't save manager state",e); } log(ILogger.Level.DEBUG,"PluginManager.load State of the manager saved: "+this); *************** *** 732,736 **** // there is cyclic dependency relation. log(ILogger.Level.ERROR,"PluginManager.remove Unable to find plugin "+plugin); ! throw new PluginException(new String("Unable to find plugin")); } if(depList.removePlugin(candidate)) --- 735,739 ---- // there is cyclic dependency relation. log(ILogger.Level.ERROR,"PluginManager.remove Unable to find plugin "+plugin); ! throw new PluginException("Unable to find plugin"); } if(depList.removePlugin(candidate)) *************** *** 767,775 **** @Override public synchronized String toString() { ! return new String( "Plugin System:{\n"+ ! "ready list={"+readyList+"}\n"+ ! "dep list={"+depList+"}\n"+ ! "resolvnig list={"+resolvingList+"}\n"+ ! depMap+"}"); } --- 770,778 ---- @Override public synchronized String toString() { ! return "Plugin System:{\n"+ ! "ready list={"+readyList+"}\n"+ ! "dep list={"+depList+"}\n"+ ! "resolvnig list={"+resolvingList+"}\n"+ ! depMap+"}"; } *************** *** 788,792 **** (PluginList)readyList.clone(), (PluginList)resolvingList.clone(), ! new String(logName), super.getMap(), super.logger); --- 791,795 ---- (PluginList)readyList.clone(), (PluginList)resolvingList.clone(), ! logName, super.getMap(), super.logger); *************** *** 902,912 **** if(policy==null) return null; ! return new String( "PluginPolicy={"+ ! "\nreplaceStrategy="+policy.replaceStrategy()+ ! "\nversion="+policy.version()+ ! "\nChecksum file \""+policy.checkSumFile()+"\" algorithm="+policy.checkSumType()+ ! "\nAuthor="+policy.author()+ ! "\nLicence="+policy.licence()+ ! "\nDescription="+policy.description()+"}"); } --- 905,915 ---- if(policy==null) return null; ! return "PluginPolicy={"+ ! "\nreplaceStrategy="+policy.replaceStrategy()+ ! "\nversion="+policy.version()+ ! "\nChecksum file \""+policy.checkSumFile()+"\" algorithm="+policy.checkSumType()+ ! "\nAuthor="+policy.author()+ ! "\nLicence="+policy.licence()+ ! "\nDescription="+policy.description()+"}"; } *************** *** 1177,1191 **** { log(ILogger.Level.ERROR,"Unable to find "+name+" class"); ! throw new PluginLoadException(new String("Class "+name+" not found"),e); } catch(ClassCastException e) { log(ILogger.Level.ERROR,"Class("+name+") is not plugin."); ! throw new PluginLoadException(new String("Class("+name+") is not correct plugin type"),e); } catch(Throwable e) { log(ILogger.Level.ERROR,"Unexpected error during class ("+name+") fetching (reason="+e.getMessage()+")"); ! throw new PluginLoadException(new String("Error during "+name+" instancing ("+e.getMessage()+")"),e); } --- 1180,1194 ---- { log(ILogger.Level.ERROR,"Unable to find "+name+" class"); ! throw new PluginLoadException("Class "+name+" not found",e); } catch(ClassCastException e) { log(ILogger.Level.ERROR,"Class("+name+") is not plugin."); ! throw new PluginLoadException("Class("+name+") is not correct plugin type",e); } catch(Throwable e) { log(ILogger.Level.ERROR,"Unexpected error during class ("+name+") fetching (reason="+e.getMessage()+")"); ! throw new PluginLoadException("Error during "+name+" instancing ("+e.getMessage()+")",e); } *************** *** 1350,1354 **** { log(ILogger.Level.CRIT,"Can't save state - possibly bug"); ! throw new PluginLoadException(new String("Can't save manager state"),e); } log(ILogger.Level.DEBUG,"PluginManager.solveConflict State of the manager saved: "+this); --- 1353,1357 ---- { log(ILogger.Level.CRIT,"Can't save state - possibly bug"); ! throw new PluginLoadException("Can't save manager state",e); } log(ILogger.Level.DEBUG,"PluginManager.solveConflict State of the manager saved: "+this); *************** *** 1381,1385 **** { log(ILogger.Level.PANIC,"Unexpected error during dependency map consolidation."); ! throw new PluginLoadException(new String("Map consolidation failed. Possibly bug.")); } --- 1384,1388 ---- { log(ILogger.Level.PANIC,"Unexpected error during dependency map consolidation."); ! throw new PluginLoadException("Map consolidation failed. Possibly bug."); } *************** *** 1398,1402 **** // manager log(ILogger.Level.PANIC,"Unable to replace "+newone+" -> "+oldone+" in manager "+manager); ! throw new PluginLoadException(new String("Unable to replace "+newone+" for "+oldone+" in "+manager+" reason="+e.getMessage()),e); } } --- 1401,1405 ---- // manager log(ILogger.Level.PANIC,"Unable to replace "+newone+" -> "+oldone+" in manager "+manager); ! throw new PluginLoadException("Unable to replace "+newone+" for "+oldone+" in "+manager+" reason="+e.getMessage(),e); } } *************** *** 1671,1675 **** // should not happen, THIS IS THE SOURCE OF // EXCEPTION and panic message. ! String message=new String("Dependency injection problem for "+plugin+"."+f.getSecond()+" to the value "+ready+". Reason="+e.getMessage()); log(ILogger.Level.PANIC,"Unexpected error during dependency injection. Exception message "+message); e.printStackTrace(); --- 1674,1678 ---- // should not happen, THIS IS THE SOURCE OF // EXCEPTION and panic message. ! String message="Dependency injection problem for "+plugin+"."+f.getSecond()+" to the value "+ready+". Reason="+e.getMessage(); log(ILogger.Level.PANIC,"Unexpected error during dependency injection. Exception message "+message); e.printStackTrace(); *************** *** 1690,1694 **** log(ILogger.Level.PANIC,"Unexpected error during addDependency; reason="+e.getMessage()+" this is possibly bug!"); e.printStackTrace(); ! String message=new String("Add dependency problem for "+plugin+" reason="+e.getMessage()); throw new PluginLoadException(message,e); } --- 1693,1697 ---- log(ILogger.Level.PANIC,"Unexpected error during addDependency; reason="+e.getMessage()+" this is possibly bug!"); e.printStackTrace(); ! String message="Add dependency problem for "+plugin+" reason="+e.getMessage(); throw new PluginLoadException(message,e); } *************** *** 1715,1719 **** e.printStackTrace(); // throws new exception and uses e's message as reason ! throw new PluginLoadException(new String(plugin+".registerMe failed. Reason="+e.getMessage()),e); } --- 1718,1722 ---- e.printStackTrace(); // throws new exception and uses e's message as reason ! throw new PluginLoadException(plugin+".registerMe failed. Reason="+e.getMessage(),e); } Index: DependencyMap.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/DependencyMap.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** DependencyMap.java 19 Oct 2005 19:25:37 -0000 1.16 --- DependencyMap.java 1 Nov 2005 20:16:02 -0000 1.17 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.17 2005/11/01 20:16:02 mstsxfx + * String code cleanup (doesn't use new String construction) + * * Revision 1.16 2005/10/19 19:25:37 mstsxfx * code cleanup *************** *** 565,569 **** @Override public String toString()//{{{ { ! return new String("DependencyMap{"+map.toString()+"}"); }//}}} --- 568,572 ---- @Override public String toString()//{{{ { ! return "DependencyMap{"+map.toString()+"}"; }//}}} Index: AbstractPlugin.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/AbstractPlugin.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractPlugin.java 13 Oct 2005 18:24:20 -0000 1.1 --- AbstractPlugin.java 1 Nov 2005 20:16:02 -0000 1.2 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.2 2005/11/01 20:16:02 mstsxfx + * String code cleanup (doesn't use new String construction) + * * Revision 1.1 2005/10/13 18:24:20 mstsxfx * basic plugin implementation *************** *** 30,34 **** * { * // intialize AbstractPlugin with manager and plugin name. ! * super(new String("PluginName")); * } * --- 33,37 ---- * { * // intialize AbstractPlugin with manager and plugin name. ! * super("PluginName"); * } * *************** *** 51,55 **** * public FooPlugin() * { ! * super(new String("PluginName")); * setManager(manager); * } --- 54,58 ---- * public FooPlugin() * { ! * super("PluginName"); * setManager(manager); * } Index: VersionRestricted.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/VersionRestricted.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** VersionRestricted.java 29 Sep 2005 17:41:54 -0000 1.2 --- VersionRestricted.java 1 Nov 2005 20:16:02 -0000 1.3 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.3 2005/11/01 20:16:02 mstsxfx + * String code cleanup (doesn't use new String construction) + * * Revision 1.2 2005/09/29 17:41:54 mstsxfx * hashCode implemented *************** *** 122,126 **** @Override public String toString() { ! return new String("VersionRestricted[version="+version+" style="+style+"]"); } --- 125,129 ---- @Override public String toString() { ! return "VersionRestricted[version="+version+" style="+style+"]"; } Index: DependencySource.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/pluginsystem/DependencySource.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DependencySource.java 30 Sep 2005 18:27:21 -0000 1.2 --- DependencySource.java 1 Nov 2005 20:16:02 -0000 1.3 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.3 2005/11/01 20:16:02 mstsxfx + * String code cleanup (doesn't use new String construction) + * * Revision 1.2 2005/09/30 18:27:21 mstsxfx * PluginComparator used to plugin type comparision *************** *** 14,17 **** --- 17,21 ---- package exfex.common.pluginsystem; + import java.io.Serializable; import java.util.List; *************** *** 131,136 **** * @author msts */ ! class DependencySource implements CloneAble { /** List of implementators. * This list contains all implementators of source compatible --- 135,142 ---- * @author msts */ ! class DependencySource implements CloneAble, Serializable { + private static final long serialVersionUID = 1L; + /** List of implementators. * This list contains all implementators of source compatible *************** *** 209,213 **** // check if plug is compatible, if not throws exception if(!compatible(plug)) ! throw new PluginException(new String(plug+" is not compatible with source type "+type)); // creates implementators list this.implList=new PluginList(); --- 215,219 ---- // check if plug is compatible, if not throws exception if(!compatible(plug)) ! throw new PluginException(plug+" is not compatible with source type "+type); // creates implementators list this.implList=new PluginList(); *************** *** 393,397 **** @Override public String toString() { ! return new String("DependencySource{type=["+type+"] impllist=["+implList.toString()+"] restrictions=["+restrictions+"]}"); } --- 399,403 ---- @Override public String toString() { ! return "DependencySource{type=["+type+"] impllist=["+implList.toString()+"] restrictions=["+restrictions+"]}"; } |
From: Michal H. <ms...@us...> - 2005-11-01 20:15:28
|
Update of /cvsroot/exfex/exfex/source/exfex/common/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18770/source/exfex/common/utils Modified Files: Pair.java Triplet.java Log Message: String code cleanup (doesn't use new String) Index: Pair.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/utils/Pair.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Pair.java 19 Oct 2005 19:03:49 -0000 1.3 --- Pair.java 1 Nov 2005 20:15:19 -0000 1.4 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.4 2005/11/01 20:15:19 mstsxfx + * String code cleanup (doesn't use new String) + * * Revision 1.3 2005/10/19 19:03:49 mstsxfx * implements Serializable *************** *** 115,119 **** @Override public String toString() { ! return new String("Pair("+getFirst()+", "+getSecond()+")"); } } --- 118,122 ---- @Override public String toString() { ! return "Pair("+first+", "+second+")"; } } Index: Triplet.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/utils/Triplet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Triplet.java 19 Oct 2005 19:03:49 -0000 1.3 --- Triplet.java 1 Nov 2005 20:15:19 -0000 1.4 *************** *** 140,144 **** @Override public String toString() { ! return new String("Triplet("+first+", "+second+", "+third+")"); } } \ No newline at end of file --- 140,144 ---- @Override public String toString() { ! return "Triplet("+first+", "+second+", "+third+")"; } } \ No newline at end of file |
From: Michal H. <ms...@us...> - 2005-11-01 20:14:16
|
Update of /cvsroot/exfex/exfex/source/exfex/common/remote/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18412/source/exfex/common/remote/utils Modified Files: IRemoteFileTransfer.java Log Message: extends serializable Index: IRemoteFileTransfer.java =================================================================== RCS file: /cvsroot/exfex/exfex/source/exfex/common/remote/utils/IRemoteFileTransfer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IRemoteFileTransfer.java 14 Oct 2005 17:34:37 -0000 1.1 --- IRemoteFileTransfer.java 1 Nov 2005 20:14:04 -0000 1.2 *************** *** 3,6 **** --- 3,9 ---- * * $Log$ + * Revision 1.2 2005/11/01 20:14:04 mstsxfx + * extends serializable + * * Revision 1.1 2005/10/14 17:34:37 mstsxfx * remote interface for file transfer *************** *** 11,14 **** --- 14,18 ---- import java.io.File; import java.io.IOException; + import java.io.Serializable; import java.rmi.Remote; import java.rmi.RemoteException; *************** *** 30,34 **** * @author msts */ ! public interface IRemoteFileTransfer extends Remote { /** Uploads given file to the implementation specific localtion. --- 34,38 ---- * @author msts */ ! public interface IRemoteFileTransfer extends Remote, Serializable { /** Uploads given file to the implementation specific localtion. |