You can subscribe to this list here.
2005 |
Jan
|
Feb
(14) |
Mar
|
Apr
(4) |
May
(57) |
Jun
(14) |
Jul
(15) |
Aug
(5) |
Sep
(29) |
Oct
(13) |
Nov
(44) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(14) |
Feb
(78) |
Mar
(55) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
(12) |
Dec
(9) |
2007 |
Jan
(21) |
Feb
(67) |
Mar
(39) |
Apr
(28) |
May
(7) |
Jun
|
Jul
(6) |
Aug
(2) |
Sep
(1) |
Oct
(18) |
Nov
(8) |
Dec
(11) |
2008 |
Jan
(16) |
Feb
(12) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <fle...@us...> - 2006-11-12 12:40:45
|
Revision: 483 http://svn.sourceforge.net/magicmap/?rev=483&view=rev Author: flederohr Date: 2006-11-12 04:36:33 -0800 (Sun, 12 Nov 2006) Log Message: ----------- new jpox in server (unfinished) Modified Paths: -------------- branches/newjpox/magicmapserver/.classpath branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/AccessPoint.java branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Client.java branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/GeoPosition.java branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/GridField.java branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Hardware.java branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Location.java branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Map.java branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Position.java branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/ScanResult.java branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Session.java branches/newjpox/magicmapserver/src/net/sf/magicmap/server/Init.java branches/newjpox/magicmapserver/src/net/sf/magicmap/server/facade/PositionFacade.java Added Paths: ----------- branches/newjpox/magicmapserver/dblayer/lib/jdo2-api-2.0.jar branches/newjpox/magicmapserver/dblayer/lib/jpox-1.1.3.jar branches/newjpox/magicmapserver/dblayer/lib/jpox-enhancer-1.1.3.jar branches/newjpox/magicmapserver/web/WEB-INF/lib/jdo2-api-2.0.jar branches/newjpox/magicmapserver/web/WEB-INF/lib/jpox-1.1.3.jar Removed Paths: ------------- branches/newjpox/magicmapserver/dblayer/lib/jpox-1.1.0-beta-1.jar branches/newjpox/magicmapserver/dblayer/lib/jpox-enhancer-1.1.0-beta-1.jar branches/newjpox/magicmapserver/web/WEB-INF/lib/jpox-20041204.032009.jar Modified: branches/newjpox/magicmapserver/.classpath =================================================================== --- branches/newjpox/magicmapserver/.classpath 2006-11-12 12:24:19 UTC (rev 482) +++ branches/newjpox/magicmapserver/.classpath 2006-11-12 12:36:33 UTC (rev 483) @@ -1,13 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> - <classpathentry output="dblayer/bin" kind="src" path="dblayer/src"/> + <classpathentry kind="src" output="dblayer/bin" path="dblayer/src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="lib" path="web/WEB-INF/lib/log4j-1.2.8.jar"/> - <classpathentry kind="lib" path="web/WEB-INF/lib/jpox-20041204.032009.jar"/> <classpathentry kind="lib" path="web/WEB-INF/lib/magicmap-db-layer.jar"/> <classpathentry kind="lib" path="lib.dev/jasper-runtime.jar"/> <classpathentry kind="lib" path="lib.dev/jsp-api.jar"/> <classpathentry kind="lib" path="lib.dev/servlet-api.jar"/> + <classpathentry kind="lib" path="web/WEB-INF/lib/jpox-1.1.3.jar"/> + <classpathentry kind="lib" path="web/WEB-INF/lib/jdo2-api-2.0.jar"/> <classpathentry kind="output" path="web/WEB-INF/classes"/> </classpath> Added: branches/newjpox/magicmapserver/dblayer/lib/jdo2-api-2.0.jar =================================================================== (Binary files differ) Property changes on: branches/newjpox/magicmapserver/dblayer/lib/jdo2-api-2.0.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Deleted: branches/newjpox/magicmapserver/dblayer/lib/jpox-1.1.0-beta-1.jar =================================================================== (Binary files differ) Added: branches/newjpox/magicmapserver/dblayer/lib/jpox-1.1.3.jar =================================================================== (Binary files differ) Property changes on: branches/newjpox/magicmapserver/dblayer/lib/jpox-1.1.3.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Deleted: branches/newjpox/magicmapserver/dblayer/lib/jpox-enhancer-1.1.0-beta-1.jar =================================================================== (Binary files differ) Added: branches/newjpox/magicmapserver/dblayer/lib/jpox-enhancer-1.1.3.jar =================================================================== (Binary files differ) Property changes on: branches/newjpox/magicmapserver/dblayer/lib/jpox-enhancer-1.1.3.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/AccessPoint.java =================================================================== --- branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/AccessPoint.java 2006-11-12 12:24:19 UTC (rev 482) +++ branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/AccessPoint.java 2006-11-12 12:36:33 UTC (rev 483) @@ -12,12 +12,6 @@ * vendor-name="jpox" * key="table-name" * value="accesspoint" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="use-poid-generator" - * value="true" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="poid-class-generator" - * value="org.jpox.poid.SequenceTablePoidGenerator" */ public class AccessPoint { @@ -34,6 +28,7 @@ * @jdo.field * persistence-modifier="persistent" * primary-key="true" + * value-strategy="true" */ long id; @@ -89,7 +84,7 @@ * persistence-modifier="persistent" * collection-type="collection" * element-type="ScanResult" - * dependent="true" + * dependent-element="true" * mapped-by="accessPoint" **/ Collection scanResults = new HashSet(); @@ -101,7 +96,7 @@ * persistence-modifier="persistent" * collection-type="collection" * element-type="Position" - * dependent="true" + * dependent-element="true" * mapped-by="accessPoint" */ Collection positions = new HashSet(); Modified: branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Client.java =================================================================== --- branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Client.java 2006-11-12 12:24:19 UTC (rev 482) +++ branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Client.java 2006-11-12 12:36:33 UTC (rev 483) @@ -16,12 +16,6 @@ * vendor-name="jpox" * key="table-name" * value="client" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="use-poid-generator" - * value="true" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="poid-class-generator" - * value="org.jpox.poid.SequenceTablePoidGenerator" */ public class Client { @@ -38,6 +32,7 @@ * @jdo.field * persistence-modifier="persistent" * primary-key="true" + * value-strategy="true" */ long id; @@ -88,7 +83,7 @@ * persistence-modifier="persistent" * collection-type="collection" * element-type="ScanResult" - * dependent="true" + * dependent-element="true" * mapped-by="client" */ Collection scanResults = new HashSet(); @@ -100,7 +95,7 @@ * persistence-modifier="persistent" * collection-type="collection" * element-type="Position" - * dependent="true" + * dependent-element="true" * mapped-by="client" */ Collection positions = new HashSet(); Modified: branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/GeoPosition.java =================================================================== --- branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/GeoPosition.java 2006-11-12 12:24:19 UTC (rev 482) +++ branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/GeoPosition.java 2006-11-12 12:36:33 UTC (rev 483) @@ -10,12 +10,6 @@ * vendor-name="jpox" * key="table-name" * value="geoposition" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="use-poid-generator" - * value="true" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="poid-class-generator" - * value="org.jpox.poid.SequenceTablePoidGenerator" */ public class GeoPosition { @@ -32,6 +26,7 @@ * @jdo.field * persistence-modifier="persistent" * primary-key="true" + * value-strategy="true" */ long id; Modified: branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/GridField.java =================================================================== --- branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/GridField.java 2006-11-12 12:24:19 UTC (rev 482) +++ branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/GridField.java 2006-11-12 12:36:33 UTC (rev 483) @@ -17,12 +17,6 @@ * vendor-name="jpox" * key="table-name" * value="gridfield" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="use-poid-generator" - * value="true" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="poid-class-generator" - * value="org.jpox.poid.SequenceTablePoidGenerator" */ public class GridField { @@ -39,6 +33,7 @@ * @jdo.field * persistence-modifier="persistent" * primary-key="true" + * value-strategy="true" */ long id; Modified: branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Hardware.java =================================================================== --- branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Hardware.java 2006-11-12 12:24:19 UTC (rev 482) +++ branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Hardware.java 2006-11-12 12:36:33 UTC (rev 483) @@ -17,12 +17,6 @@ * vendor-name="jpox" * key="table-name" * value="hardware" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="use-poid-generator" - * value="true" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="poid-class-generator" - * value="org.jpox.poid.SequenceTablePoidGenerator" */ public class Hardware { @@ -39,6 +33,7 @@ * @jdo.field * persistence-modifier="persistent" * primary-key="true" + * value-strategy="true" */ long id; Modified: branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Location.java =================================================================== --- branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Location.java 2006-11-12 12:24:19 UTC (rev 482) +++ branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Location.java 2006-11-12 12:36:33 UTC (rev 483) @@ -19,12 +19,6 @@ * vendor-name="jpox" * key="table-name" * value="location" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="use-poid-generator" - * value="true" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="poid-class-generator" - * value="org.jpox.poid.SequenceTablePoidGenerator" */ public class Location { @@ -40,6 +34,7 @@ * @jdo.field * persistence-modifier="persistent" * primary-key="true" + * value-strategy="true" */ long id; Modified: branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Map.java =================================================================== --- branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Map.java 2006-11-12 12:24:19 UTC (rev 482) +++ branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Map.java 2006-11-12 12:36:33 UTC (rev 483) @@ -16,13 +16,6 @@ * vendor-name="jpox" * key="table-name" * value="map" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="use-poid-generator" - * value="true" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="poid-class-generator" - * value="org.jpox.poid.SequenceTablePoidGenerator" - * */ public class Map { @@ -38,6 +31,7 @@ * @jdo.field * persistence-modifier="persistent" * primary-key="true" + * value-strategy="true" */ long id; @@ -104,7 +98,7 @@ * persistence-modifier="persistent" * collection-type="collection" * element-type="GridField" - * dependent="true" + * dependent-element="true" * mapped-by="map" **/ Collection gridFields = new HashSet(); @@ -116,7 +110,7 @@ * persistence-modifier="persistent" * collection-type="collection" * element-type="Position" - * dependent="true" + * dependent-element="true" * mapped-by="map" **/ Collection positions = new HashSet(); @@ -128,7 +122,7 @@ * persistence-modifier="persistent" * collection-type="collection" * element-type="GeoPosition" - * dependent="true" + * dependent-element="true" * mapped-by="map" **/ Collection geoPositions = new HashSet(); Modified: branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Position.java =================================================================== --- branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Position.java 2006-11-12 12:24:19 UTC (rev 482) +++ branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Position.java 2006-11-12 12:36:33 UTC (rev 483) @@ -15,12 +15,6 @@ * vendor-name="jpox" * key="table-name" * value="position" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="use-poid-generator" - * value="true" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="poid-class-generator" - * value="org.jpox.poid.SequenceTablePoidGenerator" */ public class Position { @@ -37,6 +31,7 @@ * @jdo.field * persistence-modifier="persistent" * primary-key="true" + * value-strategy="true" */ long id; Modified: branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/ScanResult.java =================================================================== --- branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/ScanResult.java 2006-11-12 12:24:19 UTC (rev 482) +++ branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/ScanResult.java 2006-11-12 12:36:33 UTC (rev 483) @@ -19,12 +19,6 @@ * vendor-name="jpox" * key="table-name" * value="scanresult" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="use-poid-generator" - * value="true" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="poid-class-generator" - * value="org.jpox.poid.SequenceTablePoidGenerator" */ public class ScanResult { @@ -41,6 +35,7 @@ * @jdo.field * persistence-modifier="persistent" * primary-key="true" + * value-strategy="true" */ long id; Modified: branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Session.java =================================================================== --- branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Session.java 2006-11-12 12:24:19 UTC (rev 482) +++ branches/newjpox/magicmapserver/dblayer/src/net/sf/magicmap/db/Session.java 2006-11-12 12:36:33 UTC (rev 483) @@ -14,12 +14,6 @@ * vendor-name="jpox" * key="table-name" * value="session" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="use-poid-generator" - * value="true" - * @jdo.class-vendor-extension - * vendor-name="jpox" key="poid-class-generator" - * value="org.jpox.poid.SequenceTablePoidGenerator" */ public class Session { @@ -36,6 +30,7 @@ * @jdo.field * persistence-modifier="persistent" * primary-key="true" + * value-strategy="true" */ long id; Modified: branches/newjpox/magicmapserver/src/net/sf/magicmap/server/Init.java =================================================================== --- branches/newjpox/magicmapserver/src/net/sf/magicmap/server/Init.java 2006-11-12 12:24:19 UTC (rev 482) +++ branches/newjpox/magicmapserver/src/net/sf/magicmap/server/Init.java 2006-11-12 12:36:33 UTC (rev 483) @@ -49,7 +49,7 @@ properties.setProperty("javax.jdo.option.RestoreValues", "true"); properties.setProperty("org.jpox.cache.level2", "true"); - properties.setProperty("org.jpox.poid.generatorClass", "org.jpox.poid.SequenceTablePoidGenerator"); + properties.setProperty("org.jpox.poid.generatorClass", "org.jpox.store.rdbms.poid.SequenceTablePoidGenerator"); JDOUtil.pmfactory = JDOHelper.getPersistenceManagerFactory(properties); PersistenceManager pm = JDOUtil.pmfactory.getPersistenceManager(); Modified: branches/newjpox/magicmapserver/src/net/sf/magicmap/server/facade/PositionFacade.java =================================================================== --- branches/newjpox/magicmapserver/src/net/sf/magicmap/server/facade/PositionFacade.java 2006-11-12 12:24:19 UTC (rev 482) +++ branches/newjpox/magicmapserver/src/net/sf/magicmap/server/facade/PositionFacade.java 2006-11-12 12:36:33 UTC (rev 483) @@ -15,6 +15,7 @@ import net.sf.magicmap.db.AccessPoint; import net.sf.magicmap.db.Client; import net.sf.magicmap.db.Map; +import net.sf.magicmap.db.Position; import net.sf.magicmap.db.Session; import net.sf.magicmap.server.cache.PositionCache; import net.sf.magicmap.server.dto.AccessPointDTO; @@ -101,6 +102,18 @@ pos.setPosY(positionY); pos.setPosZ(positionZ); PositionCache.getPositionCache().createOrUpdatePosition(map, pos, client.getMac()); + +// Position position = checkPosition(positionName, map, pm); +// if (position == null){ +// position = new Position(map, positionX, positionY, positionZ, positionName); +// pm.makePersistent(position); +// } +// position.setDeleted(false); +// position.setPosX(positionX); +// position.setPosY(positionY); +// position.setFixed(fixed); +// +// setNewSignalCharacter(character, pm, client, position); } /** Added: branches/newjpox/magicmapserver/web/WEB-INF/lib/jdo2-api-2.0.jar =================================================================== (Binary files differ) Property changes on: branches/newjpox/magicmapserver/web/WEB-INF/lib/jdo2-api-2.0.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: branches/newjpox/magicmapserver/web/WEB-INF/lib/jpox-1.1.3.jar =================================================================== (Binary files differ) Property changes on: branches/newjpox/magicmapserver/web/WEB-INF/lib/jpox-1.1.3.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Deleted: branches/newjpox/magicmapserver/web/WEB-INF/lib/jpox-20041204.032009.jar =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fle...@us...> - 2006-11-12 12:24:31
|
Revision: 482 http://svn.sourceforge.net/magicmap/?rev=482&view=rev Author: flederohr Date: 2006-11-12 04:24:19 -0800 (Sun, 12 Nov 2006) Log Message: ----------- Added Paths: ----------- branches/newjpox/magicmapserver/ Copied: branches/newjpox/magicmapserver (from rev 481, trunk/magicmapserver) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fle...@us...> - 2006-11-12 12:24:29
|
Revision: 481 http://svn.sourceforge.net/magicmap/?rev=481&view=rev Author: flederohr Date: 2006-11-12 04:23:58 -0800 (Sun, 12 Nov 2006) Log Message: ----------- Prepare destination for the branch operation Added Paths: ----------- branches/newjpox/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fle...@us...> - 2006-11-12 12:22:43
|
Revision: 480 http://svn.sourceforge.net/magicmap/?rev=480&view=rev Author: flederohr Date: 2006-11-12 04:22:37 -0800 (Sun, 12 Nov 2006) Log Message: ----------- Removed Paths: ------------- branches/newjpox/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fle...@us...> - 2006-11-12 12:20:48
|
Revision: 479 http://svn.sourceforge.net/magicmap/?rev=479&view=rev Author: flederohr Date: 2006-11-12 04:20:15 -0800 (Sun, 12 Nov 2006) Log Message: ----------- Added Paths: ----------- branches/newjpox/ Copied: branches/newjpox (from rev 478, trunk/magicmapserver) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jan...@us...> - 2006-11-07 19:48:59
|
Revision: 478 http://svn.sourceforge.net/magicmap/?rev=478&view=rev Author: jan_fride Date: 2006-11-07 11:48:12 -0800 (Tue, 07 Nov 2006) Log Message: ----------- Plugin erweitert (hashcode, equals und os) Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginLoader.java trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginManager.java trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginRepository.java Modified: trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginLoader.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginLoader.java 2006-11-07 18:53:59 UTC (rev 477) +++ trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginLoader.java 2006-11-07 19:48:12 UTC (rev 478) @@ -22,117 +22,104 @@ */ public class PluginLoader extends URLClassLoader implements Iterable<IPlugin> { - private static final Log log = LogFactory.getLog(PluginLoader.class); - private final List<IPlugin> pluginList = new LinkedList<IPlugin>(); + private static final Log log = LogFactory.getLog(PluginLoader.class); - /** - * - * @param pluginPath - */ - public PluginLoader(URL[] pluginPath) { - super(pluginPath); - } + /** + * List of all loaded plugins. + */ + private final List<IPlugin> pluginList = new LinkedList<IPlugin>(); - public int getNumberOfPlugins(){ - return this.pluginList.size(); - } + /** + * + * @param pluginPath + */ + public PluginLoader(URL[] pluginPath) { + super(pluginPath); + } - public Iterator<IPlugin> iterator(){ - return this.pluginList.iterator(); - } + /** + * The number of loaded plugins + * @return + */ + public int getNumberOfPlugins(){ + return this.pluginList.size(); + } - /** - * Durchsucht alle URLS nach Plugins. und liefert die Klassen. - * - */ - public void loadPlugins(){ - PluginLoader.log.info("Loading plugins:"); - URL[] urLs = super.getURLs(); - for (URL url : urLs) - try { + /** + * + * @return + */ + public Iterator<IPlugin> iterator(){ + return this.pluginList.iterator(); + } - loadPlugins(url); - } catch (IOException e) { - e.printStackTrace(); - } catch (URISyntaxException e) { - e.printStackTrace(); - } - } + /** + * Durchsucht alle URLS nach Plugins. und liefert die Klassen. + * + */ + public void loadPlugins(){ + PluginLoader.log.info("Loading plugins:"); + URL[] urLs = super.getURLs(); + for (URL url : urLs){ + try { + loadPlugins(url); + } catch (Exception e) { + log.info("Error loading Plugins in: " + url); + log.info("Error loading Plugins reason;" + e); + } + } + } - /** - * - * @param url - * @throws IOException - * @throws URISyntaxException - */ - private void loadPlugins(URL url) throws IOException, URISyntaxException{ - PluginLoader.log.info("Loading plugins in '" + url.toString() + "'"); - File dir = new File(url.toURI()); - if (dir.isDirectory()) { - String[] jars = dir.list(new FilenameFilter() { + /** + * + * @param url + * @throws IOException + * @throws URISyntaxException + */ + private void loadPlugins(URL url) throws IOException, URISyntaxException{ + PluginLoader.log.info("Loading plugins in '" + url.toString() + "'"); + File dir = new File(url.toURI()); + if (dir.isDirectory()) { + String[] jars = dir.list(new FilenameFilter() { - public boolean accept(File dir, String name){ - return name != null && name.endsWith("jar"); - } - }); - for (String jar : jars) - loadPlugins(new URL(url.toString() + "/" + jar)); - } else if (dir.getName().endsWith(".jar")) { - PluginLoader.log.info("Loading jar: " + url.toString()); - try { - loadPlugin(url); - } catch (ClassNotFoundException e) { - PluginLoader.log.warn(e); - } - } - } + public boolean accept(File dir, String name){ + return name != null && name.endsWith("jar"); + } + }); + for (String jar : jars) + loadPlugins(new URL(url.toString() + "/" + jar)); + } else if (dir.getName().endsWith(".jar")) { + PluginLoader.log.info("Loading jar: " + url.toString()); + try { + loadPlugin(url); + } catch (ClassNotFoundException e) { + PluginLoader.log.warn(e); + } + } + } - /** - * L\xE4dt alles aus einer URL. - * @param url - */ - private void loadPlugin(URL url) throws IOException, PluginException, ClassNotFoundException{ - // first. Descriptor laden. - String jarUrl = "jar:" + url.toString() + "!/META-INF/plugin.xml"; - JarURLConnection con = (JarURLConnection) new URL(jarUrl).openConnection(); - PluginDescriptorReader descriptorReader = new PluginDescriptorReader(con.getInputStream()); - IPluginDescriptor descriptor = descriptorReader.getDescriptor(); - String aClass = descriptorReader.getPluginClass(); - addLibs(url); - addURL(new URL(url.toString())); - try { - Class clazz = findClass(aClass); + /** + * L\xE4dt alles aus einer URL. + * @param url + */ + private void loadPlugin(URL url) throws IOException, PluginException, ClassNotFoundException{ + // first. Descriptor laden. + String jarUrl = "jar:" + url.toString() + "!/META-INF/plugin.xml"; + JarURLConnection con = (JarURLConnection) new URL(jarUrl).openConnection(); + PluginDescriptorReader descriptorReader = new PluginDescriptorReader(con.getInputStream()); + IPluginDescriptor descriptor = descriptorReader.getDescriptor(); + String aClass = descriptorReader.getPluginClass(); + + addURL(new URL(url.toString())); + try { + Class clazz = findClass(aClass); - Constructor piConstructor = clazz.getConstructor(new Class[]{IPluginDescriptor.class}); - IPlugin plugin = (IPlugin) piConstructor.newInstance(descriptor); - this.pluginList.add(plugin); - PluginLoader.log.info("Plugin loaded"); - - } catch (Exception nsm) { - PluginLoader.log.warn("Failed to instanciate Plugin " + descriptor.getName() + " -> " + nsm); - - } - } - - //TODOD klappt lkeider nicht wie geplant :-/ - /** - * This does not work! ;-) - * - * @param url - * @throws IOException - */ - private void addLibs(URL url) throws IOException{ - //TODO - // String libUrl = "jar:" + url.toString() + "!/lib/"; - // JarURLConnection con = (JarURLConnection) new URL(libUrl).openConnection(); - // Enumeration<JarEntry> entries = con.getJarFile().entries(); - // while (entries.hasMoreElements()){ - // JarEntry jarEntry = entries.nextElement(); - // if (jarEntry.getName().endsWith(".jar")){ - // String jarUrl = "jar:" + url.toString() + "!/" + jarEntry.getName(); - // log.info("Adding Jar: " + jarUrl); - // super.addURL(new URL(jarUrl)); - // } - // } - } + Constructor piConstructor = clazz.getConstructor(new Class[]{IPluginDescriptor.class}); + IPlugin plugin = (IPlugin) piConstructor.newInstance(descriptor); + this.pluginList.add(plugin); + PluginLoader.log.info("Plugin loaded"); + } catch (Exception nsm) { + PluginLoader.log.warn("Failed to instanciate Plugin " + descriptor.getName() + " -> " + nsm); + } + } } Modified: trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginManager.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginManager.java 2006-11-07 18:53:59 UTC (rev 477) +++ trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginManager.java 2006-11-07 19:48:12 UTC (rev 478) @@ -42,8 +42,8 @@ AvailablePlugins("AVAILABLE_PLUGINS"), InstalledPlugins("INSTALLED_PLUGINS"), PluginDetails("PLUGIN_DETAILS"); - private final String name; + private final String name; private Attributes(String name){ this.name = name; @@ -65,11 +65,6 @@ private final Collection<IPlugin> pluginList = new LinkedList<IPlugin>(); /** - * Listz of available plugins. - */ - private final Collection<IPlugin> availablePluginList = new LinkedList<IPlugin>(); - - /** * Used to find and setup the plugins */ private final Settings settings; @@ -89,7 +84,10 @@ */ private PluginTableModel tableModel; - private URL pluginRepositorie; + /** + * + */ + private PluginRepository repository; /** * @@ -100,18 +98,17 @@ this.settings = settings; this.controller = controller; this.pluginLoader = null; + setup(settings); controller.getMapView().addAncestorListener(new AncestorAdaptor() { - @Override public void ancestorAdded(AncestorEvent event){ - } }); tableModel = new PluginTableModel(this); - pluginRepositorie = new URL("http://butler/magicmap/plugins"); + repository = new PluginRepository(new URL("http://butler/magicmap/plugins")); } @@ -150,7 +147,7 @@ * @param pluginId * @return */ - public IPlugin getPlugin(String groupId, String pluginId){ + public IPlugin getPlugin(String groupId, String pluginId, String version){ if (!this.pluginMap.containsKey(groupId)) return null; if (!this.pluginMap.get(groupId).containsKey(pluginId)) return null; return this.pluginMap.get(groupId).get(pluginId); Modified: trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginRepository.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginRepository.java 2006-11-07 18:53:59 UTC (rev 477) +++ trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginRepository.java 2006-11-07 19:48:12 UTC (rev 478) @@ -10,11 +10,8 @@ import java.util.List; /** - * Created by IntelliJ IDEA. - * User: Jan - * Date: 03.11.2006 - * Time: 15:27:29 - * To change this template use File | Settings | File Templates. + * + * */ public class PluginRepository { private final URL url; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jan...@us...> - 2006-11-07 18:57:23
|
Revision: 477 http://svn.sourceforge.net/magicmap/?rev=477&view=rev Author: jan_fride Date: 2006-11-07 10:53:59 -0800 (Tue, 07 Nov 2006) Log Message: ----------- Plugin erweitert (hashcode, equals und os) Modified Paths: -------------- trunk/magicmapclient/build.xml trunk/magicmapclient/magicmapclient.iml trunk/magicmapclient/src/net/sf/magicmap/artifact/Artifact.java trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Attribute.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Form.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutForm.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutReader.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java trunk/magicmapclient/src/net/sf/magicmap/plugin/AbstractPlugin.java trunk/magicmapclient/src/net/sf/magicmap/plugin/IPluginDescriptor.java trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginException.java trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginLoader.java trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginManager.java trunk/magicmapclient/src/net/sf/magicmap/plugin/SimplePluginDescriptor.java trunk/magicmapclient/src/net/sf/magicmap/plugin/SimpleVendor.java trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginDescriptorView.java trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginTableModel.java trunk/magicmapclient/test/net/sf/magicmap/plugin/DocumentDescriptorReaderTest.java Added Paths: ----------- trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/AbstractForm.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/TabForm.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/VisualList.java trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginRepository.java trunk/magicmapclient/src/net/sf/magicmap/plugin/forms/ trunk/magicmapclient/src/net/sf/magicmap/plugin/forms/PluginsForm.java trunk/magicmapclient/src/net/sf/magicmap/plugin/util/PluginComparator.java trunk/magicmapclient/src/net/sf/magicmap/plugin/util/PluginDescriptorReader.java Removed Paths: ------------- trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/SimpleInfoObjectForm.java trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginDescriptorReader.java trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginListView.java trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginTreeModel.java Modified: trunk/magicmapclient/build.xml =================================================================== --- trunk/magicmapclient/build.xml 2006-10-31 15:55:58 UTC (rev 476) +++ trunk/magicmapclient/build.xml 2006-11-07 18:53:59 UTC (rev 477) @@ -10,7 +10,9 @@ <property name="server" value="../magicmapserver" /> <property name="build" value="build" /> + <property name="build-test" value="build-test" /> <property name="dist" value="dist" /> + <property name="test" value="test" /> <property name="src" value="src" /> <property name="src.gen" value="src-gen" /> <property name="res" value="res" /> @@ -27,8 +29,20 @@ <include name="*.jar" /> </fileset> </path> + <path id="test.classpath"> + <fileset dir="."> + <include name="${jar.name}" /> + </fileset> + <fileset dir="lib"> + <include name="**/*.jar" /> + </fileset> + <!-- use server classes --> + <fileset dir="${server}/dist"> + <include name="*.jar" /> + </fileset> + <pathelement location="${build}"></pathelement> + </path> - <pathconvert property="classpath" pathsep=" " dirsep="/"> <path> <fileset dir="."> @@ -56,12 +70,15 @@ <target name="prepare" depends="clean"> <mkdir dir="${build}" /> + <mkdir dir="${build-test}" /> <mkdir dir="${dist}" /> + <mkdir dir="${test}" /> <mkdir dir="${src.gen}" /> </target> <target name="clean"> <delete dir="${build}" /> + <delete dir="${build-test}" /> <delete dir="${dist}" /> <delete file="${jar.name}" /> <delete dir="${src.gen}" /> @@ -81,6 +98,13 @@ </javac> </target> + <target name="compile-tests" depends="compile"> + <javac destdir="${build-test}" debug="true" deprecation="true" debuglevel="lines,vars,source" fork="true"> + <classpath refid="test.classpath" /> + <src path="${test}" /> + </javac> + </target> + <target name="version" depends="compile"> <tstamp> <format property="build.number" pattern="yyyyMMddHHmm" /> @@ -118,5 +142,10 @@ </java> </target> + <target name="copy-resources"> + <copy todir="build"> + <fileset dir="${res}"></fileset> + </copy> + </target> </project> Modified: trunk/magicmapclient/magicmapclient.iml =================================================================== --- trunk/magicmapclient/magicmapclient.iml 2006-10-31 15:55:58 UTC (rev 476) +++ trunk/magicmapclient/magicmapclient.iml 2006-11-07 18:53:59 UTC (rev 477) @@ -1,283 +1,41 @@ <?xml version="1.0" encoding="UTF-8"?> <module version="4" relativePaths="true" type="JAVA_MODULE"> <component name="ModuleRootManager" /> - <component name="NewModuleRootManager"> + <component name="NewModuleRootManager" inherit-compiler-output="false"> <output url="file://$MODULE_DIR$/build" /> <exclude-output /> <content url="file://$MODULE_DIR$"> <sourceFolder url="file://$MODULE_DIR$/res" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src-gen" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" /> + <excludeFolder url="file://$MODULE_DIR$/.settings" /> + <excludeFolder url="file://$MODULE_DIR$/dist" /> + <excludeFolder url="file://$MODULE_DIR$/inf" /> </content> - <orderEntry type="jdk" jdkName="1.6" /> + <orderEntry type="jdk" jdkName="1.5" jdkType="JavaSDK" /> <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="library" name="Groovy from GroovyJ 0.1.7 (Irida)" level="application" /> - <orderEntry type="library" name="magicmap-server.lib" level="project" /> - <orderEntry type="module-library"> + <orderEntry type="module-library" exported=""> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/wsdl4j.jar!/" /> + <root url="jar://$MODULE_DIR$/magicmap.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> </library> </orderEntry> - <orderEntry type="module-library"> + <orderEntry type="library" exported="" name="client-libs" level="project" /> + <orderEntry type="library" exported="" name="lib-dev" level="project" /> + <orderEntry type="module-library" exported=""> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/commons-discovery.jar!/" /> + <root url="jar://$MODULE_DIR$/../magicmapserver/dist/magicmap-server.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> </library> </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/ostermillerutils_1_05_00.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/jpox-20041204.032009.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/log4j-1.2.8.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/xmlParserAPIs.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/mail.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/xercesImpl.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/saaj.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/forms-1.0.5.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/commons-codec-1.3.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/xml-apis.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/commons-httpclient-3.0-rc3.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/looks-1.2.2.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/RelativeLayout.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/jaxrpc.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/axis.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/activation.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/dom4j-1.6.1.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/jung-1.5.2.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/commons-logging.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/nekohtml.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/concurrent.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/colt.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/jaxen-1.1-beta-9.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/commons-collections-3.1.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/derby.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib-dev/axis-ant.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> - <orderEntry type="module-library"> - <library> - <CLASSES> - <root url="jar://$MODULE_DIR$/lib/foxtrot.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> - </orderEntry> <orderEntryProperties /> - <javadoc-paths> - <root url="file://$MODULE_DIR$/../../../../idea/MagicMap/doc/api" /> - </javadoc-paths> </component> <component name="VcsManagerConfiguration"> <option name="ACTIVE_VCS_NAME" value="svn" /> Modified: trunk/magicmapclient/src/net/sf/magicmap/artifact/Artifact.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/artifact/Artifact.java 2006-10-31 15:55:58 UTC (rev 476) +++ trunk/magicmapclient/src/net/sf/magicmap/artifact/Artifact.java 2006-11-07 18:53:59 UTC (rev 477) @@ -3,32 +3,53 @@ public class Artifact implements IArtifact { - private final String groupid; - private final String artifactid; - private final String version; - private static final ArtifactComparator cmp = new ArtifactComparator(); + private final String groupid; + private final String artifactid; + private final String version; + private static final ArtifactComparator cmp = new ArtifactComparator(); - public Artifact(String groupid, String artifactid, String version) { - this.groupid = groupid; - this.artifactid = artifactid; - this.version = version; + public Artifact(String groupid, String artifactid, String version) { + this.groupid = groupid; + this.artifactid = artifactid; + this.version = version; + } - } + public String getVersion(){ + return this.version; + } - public String getVersion(){ - return this.version; - } + public String getArtifactId(){ + return this.artifactid; + } - public String getArtifactId(){ - return this.artifactid; - } + public String getGroupId(){ + return this.groupid; + } - public String getGroupId(){ - return this.groupid; - } - - public int compareTo(IArtifact o){ - return Artifact.cmp.compare(this, o); - } - + public int compareTo(IArtifact o){ + return Artifact.cmp.compare(this, o); + } + /** + * The same hash as any artifact. + * @return + */ + @Override + public int hashCode() { + int hash = 31; + int hashFactor = 17; + hash += getArtifactId() == null ? 0 : getArtifactId().hashCode() * 17; + hash += getGroupId() == null ? 0 : getGroupId().hashCode() * 17; + hash += getVersion() == null ? 0 : getVersion().hashCode() * 17; + return hash; + } + @Override + public boolean equals(Object obj) { + if (obj instanceof IArtifact) { + IArtifact iArtifact = (IArtifact) obj; + return getArtifactId().equals(iArtifact.getArtifactId()) && + getGroupId().equals(iArtifact.getGroupId()) && + getVersion().equals(iArtifact.getVersion()); + } + return super.equals(obj); + } } Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2006-10-31 15:55:58 UTC (rev 476) +++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2006-11-07 18:53:59 UTC (rev 477) @@ -53,533 +53,539 @@ */ public class Controller implements IController { - private static int numCalled = 0; + private static int numCalled = 0; - /** - * Die Instanz. - */ - private static Controller controller = null; + /** + * Die Instanz. + */ + private static Controller controller = null; - /** - * Das Knotenmodel. - */ - private INodeModel nodeModel; // Model f\xFCr Graphen + /** + * Das Knotenmodel. + */ + private INodeModel nodeModel; // Model f\xFCr Graphen - private MeasurementModel measurementModel; // Model f\xFCr Messungen + private MeasurementModel measurementModel; // Model f\xFCr Messungen - private MeasurementModel measurementModelOther; // Messungen anderen Clients / Orte + private MeasurementModel measurementModelOther; // Messungen anderen Clients / Orte - private ClientNode client; // Ausgezeichneter Knoten + private ClientNode client; // Ausgezeichneter Knoten - private ServerPoller poller; // Server st\xE4ndig nach \xC4nderungen fragen + private ServerPoller poller; // Server st\xE4ndig nach \xC4nderungen fragen - private PollHandler pollhandler; // Klasse zur Verarbeitung der Pollergebnisse + private PollHandler pollhandler; // Klasse zur Verarbeitung der Pollergebnisse - private ServerManager serverManager; // Manager f\xFCr die Verbindung zum Server + private ServerManager serverManager; // Manager f\xFCr die Verbindung zum Server - // private CallbackHandler callbackHandler; // S\xE4mtliche callbacks werden dort behandelt + // private CallbackHandler callbackHandler; // S\xE4mtliche callbacks werden dort behandelt - private MapInfo currentMap; + private MapInfo currentMap; - private OutlineView outlineView; + private OutlineView outlineView; - private ConsoleView consoleView; + private ConsoleView consoleView; - private MapView mapView; + private MapView mapView; - private MeasurementView measurementView; + private MeasurementView measurementView; - private boolean invisble; // Invisible-Modus (keine Daten an Server) + private boolean invisble; // Invisible-Modus (keine Daten an Server) - // pseudo server items - private Collection<InfoObject> infoObjects; + // pseudo server items + private Collection<InfoObject> infoObjects; - private ScannerAllocator scannerAllocator; - private final InfoObjectProviderRegistry infoServiceRegistry; - private final PluginManager pluginManager; + private ScannerAllocator scannerAllocator; + private final InfoObjectProviderRegistry infoServiceRegistry; + private final PluginManager pluginManager; - /** - * Private constructor for singleton instance - */ - private Controller() { - DOMConfigurator.configureAndWatch("log4j.xml"); + /** + * Private constructor for singleton instance + */ + private Controller() { + DOMConfigurator.configureAndWatch("log4j.xml"); - // - // Das Model der Knoten. - // - this.nodeModel = new NodeModel(); + // + // Das Model der Knoten. + // + this.nodeModel = new NodeModel(); - /** - * Messungen f\xFCr den eigenen clienten - */ - this.measurementModel = new MeasurementModel(); + /** + * Messungen f\xFCr den eigenen clienten + */ + this.measurementModel = new MeasurementModel(); - /** - * Messungen f\xFCr alle anderen? - */ - this.measurementModelOther = new MeasurementModel(); + /** + * Messungen f\xFCr alle anderen? + */ + this.measurementModelOther = new MeasurementModel(); - this.scannerAllocator = new ScannerAllocator(); - this.currentMap = null; - this.serverManager = null; + this.scannerAllocator = new ScannerAllocator(); + this.currentMap = null; + this.serverManager = null; - this.pollhandler = new PollHandler(this); + this.pollhandler = new PollHandler(this); - buildViews(); + buildViews(); - // pseudo server items - this.infoObjects = new ArrayList<InfoObject>(); - // initializeScanner(); - this.infoServiceRegistry = new InfoObjectProviderRegistry(this.nodeModel); - PluginHandler.getInstance(); + // pseudo server items + this.infoObjects = new ArrayList<InfoObject>(); + // initializeScanner(); + this.infoServiceRegistry = new InfoObjectProviderRegistry(this.nodeModel); + PluginHandler.getInstance(); - this.pluginManager = new PluginManager(new Settings(), this); + //TODO + try { + this.pluginManager = new PluginManager(new Settings(), this); + } catch (MalformedURLException e) { + throw new RuntimeException(e.getMessage()); + } + } - } + /** + * Getter for client node + * + * @return the client node + */ + public ClientNode getClient(){ + return this.client; + } - /** - * Getter for client node - * - * @return the client node - */ - public ClientNode getClient(){ - return this.client; - } + /** + * Erzeugt die Hauptviews der Anwendung + */ + private void buildViews(){ + this.outlineView = new OutlineView(this.nodeModel); + this.consoleView = new ConsoleView(); + this.mapView = new MapView(this.nodeModel, null); + this.measurementView = new MeasurementView(getMeasurementModel(), this.nodeModel); + // registerMeasurementModelListener(measurementView); + setMeasurementViewLocal(true); + this.nodeModel.addNodeModelListener(this.mapView); + //registerNodeModelListener(outlineView); + } - /** - * Erzeugt die Hauptviews der Anwendung - */ - private void buildViews(){ - this.outlineView = new OutlineView(this.nodeModel); - this.consoleView = new ConsoleView(); - this.mapView = new MapView(this.nodeModel, null); - this.measurementView = new MeasurementView(getMeasurementModel(), this.nodeModel); - // registerMeasurementModelListener(measurementView); - setMeasurementViewLocal(true); - this.nodeModel.addNodeModelListener(this.mapView); - //registerNodeModelListener(outlineView); - } + /** + * Getter for the map view + * + * @return the map view + */ + public MapView getMapView(){ + return this.mapView; + } - /** - * Getter for the map view - * - * @return the map view - */ - public MapView getMapView(){ - return this.mapView; - } + /** + * Getter for the outline view + * + * @return the outline view + */ + public OutlineView getOutlineView(){ + return this.outlineView; + } - /** - * Getter for the outline view - * - * @return the outline view - */ - public OutlineView getOutlineView(){ - return this.outlineView; - } + /** + * Getter for the console view + * + * @return the console view + */ + public ConsoleView getConsoleView(){ + return this.consoleView; + } - /** - * Getter for the console view - * - * @return the console view - */ - public ConsoleView getConsoleView(){ - return this.consoleView; - } + /** + * Getter for the measurement view + * + * @return the measurement view + */ + public MeasurementView getMeasurementView(){ + return this.measurementView; + } - /** - * Getter for the measurement view - * - * @return the measurement view - */ - public MeasurementView getMeasurementView(){ - return this.measurementView; - } + /** + * Provides the singleton controller instance (creates a new one if null) + * + * @return the singleton controller instance + */ + public static Controller getInstance(){ + if (Controller.controller == null) { + ++Controller.numCalled; + Controller.controller = new Controller(); + } + return Controller.controller; + } - /** - * Provides the singleton controller instance (creates a new one if null) - * - * @return the singleton controller instance - */ - public static Controller getInstance(){ - if (Controller.controller == null) { - ++Controller.numCalled; - Controller.controller = new Controller(); - } - return Controller.controller; - } + /** + * Getter for the node model + * + * @return the node model + */ + public INodeModel getNodeModel(){ + return this.nodeModel; + } - /** - * Getter for the node model - * - * @return the node model - */ - public INodeModel getNodeModel(){ - return this.nodeModel; - } + /** + * Baut das MeasurementModelOther neu auf. + * + * @param ap - + * the access point seer node + */ + public void buildOtherMeasurement(AccessPointSeerNode ap){ + System.out.println("Building measurement model..."); + this.measurementModelOther.clear(); + ArrayList aes = ap.getApEdges(); + for (int i = 0; i < aes.size(); i++) { + AccessPointEdge ae = (AccessPointEdge) aes.get(i); + SeenAccessPoint sp = new SeenAccessPoint(ae.getAccessPoint().getMacAddress(), ae.getSignalLevel()); + this.measurementModelOther.addAccessPoint(sp); + } + } - /** - * Baut das MeasurementModelOther neu auf. - * - * @param ap - - * the access point seer node - */ - public void buildOtherMeasurement(AccessPointSeerNode ap){ - System.out.println("Building measurement model..."); - this.measurementModelOther.clear(); - ArrayList aes = ap.getApEdges(); - for (int i = 0; i < aes.size(); i++) { - AccessPointEdge ae = (AccessPointEdge) aes.get(i); - SeenAccessPoint sp = new SeenAccessPoint(ae.getAccessPoint().getMacAddress(), ae.getSignalLevel()); - this.measurementModelOther.addAccessPoint(sp); - } - } + /** + * \xC4nndert die Anzeige des Measurement-Views + * + * @param local + * true, wenn lokale St\xE4rken angezeigt werden sollen + */ + public void setMeasurementViewLocal(boolean local){ + if (local) { + // measurementModelOther.removeMeasurementModelListener(measurementView); + // measurementModel.addMeasurementModelListener(measurementView); + //measurementModel.clear(); + } else { + // measurementModel.removeMeasurementModelListener(measurementView); + // measurementModelOther.addMeasurementModelListener(measurementView); + //measurementModelOther.clear(); + } + } - /** - * \xC4nndert die Anzeige des Measurement-Views - * - * @param local - * true, wenn lokale St\xE4rken angezeigt werden sollen - */ - public void setMeasurementViewLocal(boolean local){ - if (local) { - // measurementModelOther.removeMeasurementModelListener(measurementView); - // measurementModel.addMeasurementModelListener(measurementView); - //measurementModel.clear(); - } else { - // measurementModel.removeMeasurementModelListener(measurementView); - // measurementModelOther.addMeasurementModelListener(measurementView); - //measurementModelOther.clear(); - } - } + /** + * Getter for measurement model + * + * @return the measurement model + */ + public MeasurementModel getMeasurementModel(){ + return this.measurementModel; + } - /** - * Getter for measurement model - * - * @return the measurement model - */ - public MeasurementModel getMeasurementModel(){ - return this.measurementModel; - } + /** + * Gibt an ob verbunden oder nicht verbunden + * + * @return true wenn ja, false sonst + */ + public boolean isConnected(){ + return (this.serverManager != null && this.serverManager.isConnected()); + } - /** - * Gibt an ob verbunden oder nicht verbunden - * - * @return true wenn ja, false sonst - */ - public boolean isConnected(){ - return (this.serverManager != null && this.serverManager.isConnected()); - } + /** + * Liefert Kartenbeschreibung der aktuell geladenen Karte + * + * @return Kartenbeschreibung (MapInfo) oder null, wenn keine Karte aktiv + */ + public MapInfo getCurrentMap(){ + return this.currentMap; + } - /** - * Liefert Kartenbeschreibung der aktuell geladenen Karte - * - * @return Kartenbeschreibung (MapInfo) oder null, wenn keine Karte aktiv - */ - public MapInfo getCurrentMap(){ - return this.currentMap; - } + /** + * Setzt aktuelle Karte und startet dabei das ServerPolling + * + * @param map + */ + public void setCurrentMap(MapInfo map){ + if (isMapLoaded()) closeMap(); + this.currentMap = map; + try { + this.serverManager.reloadMap(); + this.nodeModel.addNode(this.client); + this.mapView.loadMap(map); + } catch (MalformedURLException e) { + System.out.println("Map loading failed." + e.getMessage()); + closeMap(); + } + if (isMapLoaded() && isConnected()) { + this.nodeModel.addNodeModelListener(this.mapView); + this.serverManager.resetTimestamp(); + setMeasurementViewLocal(true); + this.poller.start(); + // initializeScanner(); // Scanner neu initialisieren + this.scannerAllocator.startAllScanner(); + PluginHandler.getInstance().loadMap(); + this.pluginManager.loadMap(); + if (this.currentMap.realheight > 0 && this.currentMap.realwidth > 0) + getMapView().setTitle( + GUIUtils.i18n("map", false) + " - " + this.currentMap.name + " Gr\xF6\xDFe: " + + this.currentMap.realwidth + " X " + this.currentMap.realheight + " cm"); + } + } - /** - * Setzt aktuelle Karte und startet dabei das ServerPolling - * - * @param map - */ - public void setCurrentMap(MapInfo map){ - if (isMapLoaded()) closeMap(); - this.currentMap = map; - try { - this.serverManager.reloadMap(); - this.nodeModel.addNode(this.client); - this.mapView.loadMap(map); - } catch (MalformedURLException e) { - System.out.println("Map loading failed." + e.getMessage()); - closeMap(); - } - if (isMapLoaded() && isConnected()) { - this.nodeModel.addNodeModelListener(this.mapView); - this.serverManager.resetTimestamp(); - setMeasurementViewLocal(true); - this.poller.start(); - // initializeScanner(); // Scanner neu initialisieren - this.scannerAllocator.startAllScanner(); - PluginHandler.getInstance().loadMap(); - this.pluginManager.loadMap(); - if (this.currentMap.realheight > 0 && this.currentMap.realwidth > 0) - getMapView().setTitle( - GUIUtils.i18n("map", false) + " - " + this.currentMap.name + " Gr\xF6\xDFe: " - + this.currentMap.realwidth + " X " + this.currentMap.realheight + " cm"); - } - } + /** + * Restart server poller + */ + public void restartServerPoller(){ + if (isMapLoaded() && isConnected()) { + this.poller.stop(); + this.poller.start(); + } + } - /** - * Restart server poller - */ - public void restartServerPoller(){ - if (isMapLoaded() && isConnected()) { - this.poller.stop(); - this.poller.start(); - } - } + /** + * Check whether map is loaded + * + * @return <code>true</code> if map loaded, <code>false</code> else + */ + public boolean isMapLoaded(){ + return this.currentMap != null; + } - /** - * Check whether map is loaded - * - * @return <code>true</code> if map loaded, <code>false</code> else - */ - public boolean isMapLoaded(){ - return this.currentMap != null; - } + /** + * Schlie\xDFt Karte und beendet Polling vom Server + * + */ + public void closeMap(){ + this.scannerAllocator.stopAllScanner(); + try { + Thread.sleep(1000); + } catch (InterruptedException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + this.currentMap = null; + this.mapView.unloadMap(); + this.serverManager.closeMap(); + this.poller.stop(); + this.nodeModel.clear(); + this.nodeModel.removeNodeModelListener(this.mapView); + // nodeModel.addNode(client); + } - /** - * Schlie\xDFt Karte und beendet Polling vom Server - * - */ - public void closeMap(){ - this.scannerAllocator.stopAllScanner(); - try { - Thread.sleep(1000); - } catch (InterruptedException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - this.currentMap = null; - this.mapView.unloadMap(); - this.serverManager.closeMap(); - this.poller.stop(); - this.nodeModel.clear(); - this.nodeModel.removeNodeModelListener(this.mapView); - // nodeModel.addNode(client); - } + /** + * Liefert X-Position des Clients auf der Karte + * + * @return client x position + */ + public int getClientPosX(){ + return this.mapView.getX(this.client); + } - /** - * Liefert X-Position des Clients auf der Karte - * - * @return client x position - */ - public int getClientPosX(){ - return this.mapView.getX(this.client); - } + /** + * Liefert Y-Position des Clients auf der Karte + * + * @return + */ + public int getClientPosY(){ + return this.mapView.getY(this.client); + } - /** - * Liefert Y-Position des Clients auf der Karte - * - * @return - */ - public int getClientPosY(){ - return this.mapView.getY(this.client); - } + /** + * Liefert Z-Position des Clients + * + * @return + */ + public int getClientPosZ(){ + return this.mapView.getZ(this.client); + } - /** - * Liefert Z-Position des Clients - * - * @return - */ - public int getClientPosZ(){ - return this.mapView.getZ(this.client); - } + /** + * Check for invisibility + * + * @return <code>true</code> if invisible, <code>false</code> else + */ + public boolean isInvisible(){ + return this.invisble; + } - /** - * Check for invisibility - * - * @return <code>true</code> if invisible, <code>false</code> else - */ - public boolean isInvisible(){ - return this.invisble; - } + /** + * Setter for invisibility + * + * @param value - + * boolean value for invisibility + */ + public void setInvisible(boolean value){ + this.invisble = value; + } - /** - * Setter for invisibility - * - * @param value - - * boolean value for invisibility - */ - public void setInvisible(boolean value){ - this.invisble = value; - } + /*************************************************************************** + * + * API f\xFCr die GUI + * + **************************************************************************/ - /*************************************************************************** - * - * API f\xFCr die GUI - * - **************************************************************************/ + public void connect(ServerConnectCallback callback){ + // Wir selber... + this.client = new ClientNode(this.nodeModel); + this.client.setName(Settings.getClientName()); + this.client.setMacAddress(Settings.getClientMAC()); + // this.nodeModel.addNode(client); - public void connect(ServerConnectCallback callback){ - // Wir selber... - this.client = new ClientNode(this.nodeModel); - this.client.setName(Settings.getClientName()); - this.client.setMacAddress(Settings.getClientMAC()); - // this.nodeModel.addNode(client); + if (Settings.isStandAlone()) + this.serverManager = new VirtualServerManager(this); + else + this.serverManager = new SOAPServerManager(this); + // Poller erzeugen (ben\xF6tigt ServerManager) + this.poller = new ServerPoller(this.serverManager, this.pollhandler); + this.serverManager.connect(callback); - if (Settings.isStandAlone()) - this.serverManager = new VirtualServerManager(this); - else - this.serverManager = new SOAPServerManager(this); - // Poller erzeugen (ben\xF6tigt ServerManager) - this.poller = new ServerPoller(this.serverManager, this.pollhandler); - this.serverManager.connect(callback); + // Start all plugins + PluginHandler.getInstance().connect(); + this.pluginManager.connect(); + } - // Start all plugins - PluginHandler.getInstance().connect(); - this.pluginManager.connect(); - } + public void disconnect(ServerDisconnectCallback callback){ + // Stop all plugins + PluginHandler.getInstance().dispose(); + this.pluginManager.dispose(); - public void disconnect(ServerDisconnectCallback callback){ - // Stop all plugins - PluginHandler.getInstance().dispose(); - this.pluginManager.dispose(); + if (isMapLoaded()) closeMap(); - if (isMapLoaded()) closeMap(); + this.serverManager.disconnect(callback); + } - this.serverManager.disconnect(callback); - } + /** + * Erzeugt einen Referenzpunkt auf der aktuellen Karte mit den aktuellen + * Messwerten des Clients mit den angegebenen Koordinaten. + */ + public void createLocation(int x, int y, int z, String name, boolean fixed, CreatePositionCallback callback){ + if (!isConnected() || !isMapLoaded()) + callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen.")); + else + this.serverManager.createLocation(x, y, z, fixed, name, callback); + } - /** - * Erzeugt einen Referenzpunkt auf der aktuellen Karte mit den aktuellen - * Messwerten des Clients mit den angegebenen Koordinaten. - */ - public void createLocation(int x, int y, int z, String name, boolean fixed, CreatePositionCallback callback){ - if (!isConnected() || !isMapLoaded()) - callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen.")); - else - this.serverManager.createLocation(x, y, z, fixed, name, callback); - } + /** + * Erzeugt eine Geokoordinate auf der aktuellen Karte mit den angegebenen + * Koordinaten. + */ + public void createGeoPos(int x, int y, GeoPos geoPos, String mapName, boolean fixed, CreatePositionCallback callback){ + if (!isConnected() || !isMapLoaded()) + callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen.")); + else { + this.serverManager.createGeoPos(x, y, fixed, geoPos, mapName, callback); + this.poller.geomapTimerTask().run(); + } + } - /** - * Erzeugt eine Geokoordinate auf der aktuellen Karte mit den angegebenen - * Koordinaten. - */ - public void createGeoPos(int x, int y, GeoPos geoPos, String mapName, boolean fixed, CreatePositionCallback callback){ - if (!isConnected() || !isMapLoaded()) - callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen.")); - else { - this.serverManager.createGeoPos(x, y, fixed, geoPos, mapName, callback); - this.poller.geomapTimerTask().run(); - } - } + /** + * Creates an InfoObject on the current map with the supplied parameters + * @param x + * @param y + * @param z + * @param infoObject + * @param mapName + * @param fixed + * @param callback + */ + public void createInfoObject(int x, int y, int z, InfoObject infoObject, String mapName, boolean fixed, + CreatePositionCallback callback){ + if (!isConnected() || !isMapLoaded()) + callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen.")); + else { + // serverManager.createInfoObject(x, y, z, fixed, infoObject, + // mapName, callback); + INodeModel model = Controller.getInstance().getNodeModel(); + if (infoObject instanceof InfoObjectNode) { + InfoObjectNode node = (InfoObjectNode) infoObject; + model.addNode(node); + node.setPosition(x, y, z); + node.setFix(false); + System.out.println("Added Info:\n -> " + node.toString()); + } else { + InfoObjectNode node = new InfoObjectNode(model, infoObject); + model.addNode(node); + node.setPosition(x, y, z); + node.setFix(false); + System.out.println("Added Info:\n -> " + node.toString()); + } - /** - * Creates an InfoObject on the current map with the supplied parameters - * - * @param lastX - * @param lastY - * @param infoObject - * @param string - * @param b - * @param panel - */ - public void createInfoObject(int x, int y, int z, InfoObject infoObject, String mapName, boolean fixed, - CreatePositionCallback callback){ - if (!isConnected() || !isMapLoaded()) - callback.positionCreationError(new Exception("Nicht verbunden oder keine Karte geladen.")); - else { - // serverManager.createInfoObject(x, y, z, fixed, infoObject, - // mapName, callback); - INodeModel model = Controller.getInstance().getNodeModel(); - if (infoObject instanceof InfoObjectNode) { - InfoObjectNode node = (InfoObjectNode) infoObject; - model.addNode(node); - node.setPosition(x, y, z); - node.setFix(false); - System.out.println("Added Info:\n -> " + node.toString()); - } else { - InfoObjectNode node = new InfoObjectNode(model, infoObject); - model.addNode(node); - node.setPosition(x, y, z); - node.setFix(false); - System.out.println("Added Info:\n -> " + node.toString()); - } + } + } - } - } + /** + * + * @param name + * @param mapname + * @param callback + */ + public void deletePosition(String name, String mapname, DeletePositionCallback callback){ + Node node = this.nodeModel.findNode(name); + if (node != null) if (node.getId() != -1) + this.serverManager.deletePosition(node.getId(), Controller.getInstance().getCurrentMap().name, callback); + else + System.out.println("Node has no positionId, so its position cannot be deleted."); + } - /** - * Entfernt einen - * - * @param node - */ - public void deletePosition(String name, String mapname, DeletePositionCallback callback){ - Node node = this.nodeModel.findNode(name); - if (node != null) if (node.getId() != -1) - this.serverManager.deletePosition(node.getId(), Controller.getInstance().getCurrentMap().name, callback); - else - System.out.println("Node has no positionId, so its position cannot be deleted."); - } + /** + * + * @param name + * @param string + * @param callback + */ + public void deleteGeoPoint(String name, String string, DeletePositionCallback callback){ + Node node = this.nodeModel.findNode(name); + if (node != null) if (node.getId() != -1) + this.serverManager.deleteGeoPoint(node.getId(), Controller.getInstance().getCurrentMap().name, callback); + else + System.out.println("Node has no positionId, so its position cannot be deleted."); + } - /** - * @param name - * @param string - * @param panel - */ - public void deleteGeoPoint(String name, String string, DeletePositionCallback callback){ - Node node = this.nodeModel.findNode(name); - if (node != null) if (node.getId() != -1) - this.serverManager.deleteGeoPoint(node.getId(), Controller.getInstance().getCurrentMap().name, callback); - else - System.out.println("Node has no positionId, so its position cannot be deleted."); - } + public void setClientPosition(final int x, final int y, final int z, final boolean fixed, final String clientMac, + final PositionCallback callback){ - public void setClientPosition(final int x, final int y, final int z, final boolean fixed, final String clientMac, - final PositionCallback callback){ + this.serverManager.setClientPosition(x, y, z, fixed, clientMac, callback); + } - this.serverManager.setClientPosition(x, y, z, fixed, clientMac, callback); - } + public void setAccessPointPosition(final int x, final int y, final int z, boolean fixed, + final String accessPointMac, final PositionCallback callback){ - public void setAccessPointPosition(final int x, final int y, final int z, boolean fixed, - final String accessPointMac, final PositionCallback callback){ + this.serverManager.setAccessPointPosition(x, y, z, fixed, accessPointMac, callback); + } - this.serverManager.setAccessPointPosition(x, y, z, fixed, accessPointMac, callback); - } + public void setAccessPointHiddenStatus(String accessPointMac, boolean hidden, PositionCallback callback){ - public void setAccessPointHiddenStatus(String accessPointMac, boolean hidden, PositionCallback callback){ + this.serverManager.setAccessPointHiddenStatus(accessPointMac, hidden, callback); + } - this.serverManager.setAccessPointHiddenStatus(accessPointMac, hidden, callback); - } + public void movePosition(final long positionId, final String mapname, final int x, final int y, final int z, + boolean fixed, final MovePositionCallback callback){ - public void movePosition(final long positionId, final String mapname, final int x, final int y, final int z, - boolean fixed, final MovePositionCallback callback){ + this.serverManager.movePosition(positionId, mapname, x, y, z, fixed, callback); + } - this.serverManager.movePosition(positionId, mapname, x, y, z, fixed, callback); - } + /** + * Holt Karte vom Server. Ergebnis via Callback + * + * @param name + * @param callback + */ + public void retrieveMap(String name, MapCallback callback){ + this.serverManager.retrieveMap(name, callback); + getMapView().setTitle(GUIUtils.i18n("map", false) + " - " + name); + } - /** - * Holt Karte vom Server. Ergebnis via Callback - * - * @param name - * @param callback - */ - public void retrieveMap(String name, MapCallback callback){ - this.serverManager.retrieveMap(name, callback); - getMapView().setTitle(GUIUtils.i18n("map", false) + " - " + name); - } + public void retrieveMapNames(MapNamesCallback callback, boolean openMapDialog){ + this.serverManager.retrieveMapNames(callback, openMapDialog); + } - public void retrieveMapNames(MapNamesCallback callback, boolean openMapDialog){ - this.serverManager.retrieveMapNames(callback, openMapDialog); - } + public void createNewMap(final String name, final String URL, final int imageWidth, final int imageHeight, + final int width, final int height, final CreateNewMapCallback callback){ - public void createNewMap(final String name, final String URL, final int imageWidth, final int imageHeight, - final int width, final int height, final CreateNewMapCallback callback){ + this.serverManager.createNewMap(name, URL, imageWidth, imageHeight, width, height, callback); + } - this.serverManager.createNewMap(name, URL, imageWidth, imageHeight, width, height, callback); - } + public Collection<InfoObject> getInfoObjects(){ + return this.infoObjects; + } - public Collection<InfoObject> getInfoObjects(){ - return this.infoObjects; - } + public void handleRoundComplete(AbstractScanner scanner){ + this.scannerAllocator.handleRoundComplete(scanner); + } - public void handleRoundComplete(AbstractScanner scanner){ - this.scannerAllocator.handleRoundComplete(scanner); - } + public void handleScanResult(AbstractScanResult scanResult, AbstractScanner scanner){ + this.scannerAllocator.handleScanResult(scanResult, scanner); + } - public void handleScanResult(AbstractScanResult scanResult, AbstractScanner scanner){ - this.scannerAllocator.handleScanResult(scanResult, scanner); - } + public void addScannerHandler(AbstractScannerHandler handler){ + this.scannerAllocator.addScanResultHandler(handler); + } - public void addScannerHandler(AbstractScannerHandler handler){ - this.scannerAllocator.addScanResultHandler(handler); - } - - public InfoObjectProviderRegistry getInfoProviderRegistry(){ - return this.infoServiceRegistry; - } + public InfoObjectProviderRegistry getInfoProviderRegistry(){ + return this.infoServiceRegistry; + } } Added: trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/AbstractForm.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/AbstractForm.java (rev 0) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/AbstractForm.java 2006-11-07 18:53:59 UTC (rev 477) @@ -0,0 +1,32 @@ +package net.sf.magicmap.client.gui.forms; + +import javax.swing.*; +import java.util.*; + +/** + * Created by IntelliJ IDEA. + * User: Jan + * Date: 03.11.2006 + * Time: 14:18:25 + * To change this template use File | Settings | File Templates. + */ +public abstract class AbstractForm<C> implements Form<C>, Iterable<Attribute<C>>{ + + private final Collection<Attribute<C>> attributes = new LinkedList<Attribute<C>>(); + + public void addAttribute(String attributeName, String className, C constraints) { + this.attributes.add(new Attribute<C>(attributeName, className, constraints)); + } + + public void addLabel(String forAttribute, JComponent component, C constraints) { + this.attributes.add(new Attribute<C>(forAttribute, "", constraints, component)); + } + + public void addForm(Form form, C constraints) { + attributes.add(new Attribute<C>( "", constraints, form)); + } + public Iterator<Attribute<C>> iterator(){ + return attributes.iterator(); + } + +} Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Attribute.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Attribute.java 2006-10-31 15:55:58 UTC (rev 476) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Attribute.java 2006-11-07 18:53:59 UTC (rev 477) @@ -8,61 +8,91 @@ * @see net.sf.magicmap.client.gui.forms.UserInterface * @see net.sf.magicmap.client.gui.forms.Form */ -public final class Attribute { +public class Attribute<C> { - private final String name; - private final String className; - private final Object constrains; - private final JComponent component; + private final String name; + private final String className; + private final C constrains; + private final JComponent component; + private final Form form; - /** - * creates an attribute. - * - * @param name the attributes name - * @param className not used - far later - * @param constrains the layout constraints - */ - public Attribute(String name, String className, Object constrains) { - this(name, className, constrains, null); - } - /** - * Create an Label for an Attribute - * - * @param name the attributes name this label is for - * @param className not used - * @param constrains the layout constraints - * @param component the label. - */ - public Attribute(String name, String className, Object constrains, JComponent component) { - this.name = name; - this.className = className; - this.constrains = constrains; - this.component = component; - } - public String getAttributeName(){ - return this.name; - } + /** + * creates an attribute. + * + * @param name the attributes name + * @param className not used - far later + * @param constrains the layout constraints + */ + public Attribute(String name, String className, C constrains) { + this(name, className, constrains, (JComponent)null); + } - public String getClassName(){ - return this.className; - } + /** + * Create an Label for an Attribute + * + * @param name the attributes name this label is for + * @param className not used + * @param constrains the layout constraints + * @param component the label. + */ + public Attribute(String name, String className, C constrains, JComponent component) { + this.name = name; + this.className = className; + this.constrains = constrains; + this.component = component; + form = null; + } - public Object getConstraints(){ - return this.constrains; - } + /** + * + * @param className + * @param constrains + * @param form + */ + public Attribute(String className, C constrains, Form form) { + this.name = ""; + this.className = className; + this.constrains = constrains; + this.form = form; + this.component = null; + } - public JComponent getComponent(){ - return this.component; - } + public String getAttributeName(){ + return this.name; + } - @Override - public String toString(){ - return ""; - } + public String getClassName(){ + return this.className; + } - public String toXml(){ - return ""; - } + public C getConstraints(){ + return this.constrains; + } + + /** + * Returns the attributes visual proxy. + * @param ui + * @return + */ + public JComponent getComponent(UserInterface ui){ + if (this.component != null) + return this.component; + else if (this.form != null) + return this.form.attatch((ui)); + else return ui.visualProxy(this.name, null); + } + + public Form getForm(){ + return form; + } + @Override + public String toString(){ + return ""; + } + + public String toXml(){ + return ""; + } } Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Form.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Form.java 2006-10-31 15:55:58 UTC (rev 476) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Form.java 2006-11-07 18:53:59 UTC (rev 477) @@ -8,7 +8,7 @@ * * Attribute sind keine Properties..... */ -public interface Form { +public interface Form<C> { /** * @@ -16,7 +16,7 @@ * @param className * @param constraints */ - public void addAttribute(String attributeName, String className, Object constraints); + public void addAttribute(String attributeName, String className, C constraints); /** * @@ -24,11 +24,13 @@ * @param component * @param constraints */ - public void addLabel(String forAttribute, JComponent component, Object constraints); + public void addLabel(String forAttribute, JComponent component, C constraints); - /** + public void addForm(Form form, C constraints); + + /** * Attatch this form to a model. * @param ui */ - public JComponent attatch(UserInterface ui); + public JComponent attatch (UserInterface ui); } Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutForm.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutForm.java 2006-10-31 15:55:58 UTC (rev 476) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutForm.java 2006-11-07 18:53:59 UTC (rev 477) @@ -1,11 +1,9 @@ package net.sf.magicmap.client.gui.forms; -import java.util.Collection; -import java.util.LinkedList; +import javax.swing.*; import javax.swing.JComponent; - import com.jgoodies.forms.builder.PanelBuilder; import com.jgoodies.forms.layout.CellConstraints; import com.jgoodies.forms.layout.FormLayout; @@ -13,67 +11,47 @@ /** * */ -public class FormLayoutForm implements Form, Cloneable { +public class FormLayoutForm extends AbstractForm<CellConstraints>{ - private final FormLayout layout; - private final Collection<Attribute> attributes = new LinkedList<Attribute>(); - private JComponent form = null; - public FormLayoutForm(String colSpecs, String rowSpecs) { - this.layout = new FormLayout(colSpecs, rowSpecs); - } + private final FormLayout layout; + private JComponent form = null; - public FormLayoutForm(FormLayout layout) { - this.layout = layout; - } + public FormLayoutForm(String colSpecs, String rowSpecs) { + this.layout = new FormLayout(colSpecs, rowSpecs); + } - /** - * - * @param attributeName - * @param className - * @param constraints - */ - public void addAttribute(String attributeName, String className, Object constraints){ - this.attributes.add(new Attribute(attributeName, className, constraints)); - } + public FormLayoutForm(FormLayout layout) { + this.layout = layout; + } - /** - * - * @param forAttribute - * @param component - * @param constraints - */ - public void addLabel(String forAttribute, JComponent component, Object constraints){ - this.attributes.add(new Attribute(forAttribute, "", constraints, component)); - } - /** - * - * @param ui - * @return - */ - public JComponent attatch(UserInterface ui){ - PanelBuilder pb = new PanelBuilder(this.layout); - CellConstraints cc = null; + /** + * + * @param ui + * @return + */ + public JComponent attatch(UserInterface ui){ + PanelBuilder pb = new PanelBuilder(this.layout); + CellConstraints cc; - for (Attribute attribute : this.attributes) - if (attribute.getComponent() != null) { - cc = new CellConstraints(attribute.getConstraints().toString()); - pb.add(attribute.getComponent(), cc); - } else { - cc = new CellConstraints(attribute.getConstraints().toString()); - JComponent component = ui.visualProxy(attribute.getAttributeName(), null); - pb.add(component, cc); - } - this.form = pb.getPanel(); - return this.form; - } - - /** - * - * @return - */ - protected final FormLayout getLayout(){ - return this.layout; - } + /** + * + */ + for (Attribute<CellConstraints> attribute : this){ + cc = attribute.getConstraints(); + JComponent c = attribute.getComponent(ui); + pb.add(c,cc); + } + form = pb.getPanel(); + return this.form; + } + /** + * + * @return + */ + protected final FormLayout getLayout(){ + return this.layout; + } } + Modified: trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutReader.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutReader.java 2006-10-31 15:55:58 UTC (rev 476) +++ trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutReader.java 2006-11-07 18:53:59 UTC (rev 477) @@ -17,107 +17,94 @@ import org.dom4j.Element; import org.dom4j.Node; import org.dom4j.io.SAXReader; +import com.jgoodies.forms.layout.CellConstraints; /** */ public class FormLayoutReader { - private Document document; - private ResourceBu... [truncated message content] |
From: <fle...@us...> - 2006-10-31 15:56:39
|
Revision: 476 http://svn.sourceforge.net/magicmap/?rev=476&view=rev Author: flederohr Date: 2006-10-31 07:55:58 -0800 (Tue, 31 Oct 2006) Log Message: ----------- added rollbacks for all transactions and removed extensive logging Modified Paths: -------------- trunk/magicmapserver/.settings/org.eclipse.jdt.ui.prefs trunk/magicmapserver/src/net/sf/magicmap/server/facade/MapFacade.java trunk/magicmapserver/src/net/sf/magicmap/server/facade/PositionFacade.java trunk/magicmapserver/src/net/sf/magicmap/server/facade/SessionFacade.java Modified: trunk/magicmapserver/.settings/org.eclipse.jdt.ui.prefs =================================================================== --- trunk/magicmapserver/.settings/org.eclipse.jdt.ui.prefs 2006-10-31 15:16:30 UTC (rev 475) +++ trunk/magicmapserver/.settings/org.eclipse.jdt.ui.prefs 2006-10-31 15:55:58 UTC (rev 476) @@ -1,6 +1,6 @@ -#Sat Jul 08 14:24:10 CEST 2006 +#Tue Oct 31 14:58:24 CET 2006 eclipse.preferences.version=1 -formatter_profile=_MagicMap Coding Conventions +formatter_profile=_'MagicMap Coding Conventions' formatter_settings_version=10 internal.default.compliance=default org.eclipse.jdt.ui.exception.name=e Modified: trunk/magicmapserver/src/net/sf/magicmap/server/facade/MapFacade.java =================================================================== --- trunk/magicmapserver/src/net/sf/magicmap/server/facade/MapFacade.java 2006-10-31 15:16:30 UTC (rev 475) +++ trunk/magicmapserver/src/net/sf/magicmap/server/facade/MapFacade.java 2006-10-31 15:55:58 UTC (rev 476) @@ -64,6 +64,8 @@ } } JDOUtil.commit(tx); + } catch (Exception e) { + if (tx.isActive()) tx.rollback(); } finally { JDOUtil.closePM(pm); } @@ -171,6 +173,8 @@ ++i; } JDOUtil.commit(tx); + } catch (Exception e) { + if (tx.isActive()) tx.rollback(); } finally { JDOUtil.closePM(pm); } @@ -245,6 +249,7 @@ } JDOUtil.commit(tx); } catch (Exception e) { + if (tx.isActive()) tx.rollback(); e.printStackTrace(); if (e instanceof MapException) { throw (MapException) e; @@ -301,6 +306,7 @@ } JDOUtil.commit(tx); } catch (Exception e) { + if (tx.isActive()) tx.rollback(); e.printStackTrace(); if (e instanceof MapException) { throw (MapException) e; @@ -398,6 +404,7 @@ } JDOUtil.commit(tx); } catch (Exception e) { + if (tx.isActive()) tx.rollback(); e.printStackTrace(); if (e instanceof MapException) { throw (MapException) e; @@ -447,6 +454,7 @@ } tx.commit(); } catch (Exception e) { + if (tx.isActive()) tx.rollback(); e.printStackTrace(); if (e instanceof MapException) { throw (MapException) e; Modified: trunk/magicmapserver/src/net/sf/magicmap/server/facade/PositionFacade.java =================================================================== --- trunk/magicmapserver/src/net/sf/magicmap/server/facade/PositionFacade.java 2006-10-31 15:16:30 UTC (rev 475) +++ trunk/magicmapserver/src/net/sf/magicmap/server/facade/PositionFacade.java 2006-10-31 15:55:58 UTC (rev 476) @@ -10,6 +10,7 @@ import javax.jdo.Extent; import javax.jdo.PersistenceManager; import javax.jdo.Query; +import javax.jdo.Transaction; import net.sf.magicmap.db.AccessPoint; import net.sf.magicmap.db.Client; @@ -38,15 +39,18 @@ SignalCharacterDTO character, String positionName, boolean fixed) throws SessionException, MapException{ this.logger.info("createOrUpdatePosition()"); PersistenceManager pm = null; + Transaction tx = null; try { pm = JDOUtil.pmfactory.getPersistenceManager(); - pm.currentTransaction().begin(); + tx = pm.currentTransaction(); + tx.begin(); createOrUpdatePositionInternal(sessionId, mapName, positionX, positionY, positionZ, character, positionName, fixed, pm); - if (pm.currentTransaction().isActive()) { - pm.currentTransaction().commit(); + if (tx.isActive()) { + tx.commit(); } } catch (Exception e) { + if (tx.isActive()) tx.rollback(); e.printStackTrace(); if (e instanceof MapException) { throw (MapException) e; @@ -97,28 +101,6 @@ pos.setPosY(positionY); pos.setPosZ(positionZ); PositionCache.getPositionCache().createOrUpdatePosition(map, pos, client.getMac()); - - String string; - int i = 0; - try { - FileOutputStream fs = new FileOutputStream(new File("referenzpunkt.txt"), true); - PrintWriter pw = new PrintWriter(fs, true); - while (i < character.getSimpleScanResults().length) { - string = "TimeStamp: " + System.currentTimeMillis() + " SessionID: " + sessionId + " PositionName: " - + positionName + " MapName: " + mapName + " Postition.X " + positionX + " Postition.Y " - + positionY + " Postition.Z " + positionZ + " Fixed: " + fixed + " Character.getMacAP " - + character.getSimpleScanResults()[i].getMacAP() + " Character.LastSeen: " - + character.getSimpleScanResults()[i].getLastSeen() + " Character.noise " - + character.getSimpleScanResults()[i].getNoise() + " Character.SignalLevel: " - + character.getSimpleScanResults()[i].getSignalLevel(); - pw.println(string); - ++i; - } - pw.close(); - fs.close(); - } catch (Exception e) { - e.printStackTrace(); - } } /** @@ -145,7 +127,6 @@ } return result; } catch (Exception e) { - // pm.currentTransaction().rollback(); throw new MapException("", e); } @@ -207,7 +188,6 @@ if (results != null && !results.isEmpty()) { result = (Session) results.iterator().next(); } else { - // pm.currentTransaction().rollback(); throw new SessionException("Session mit der id:" + sessionId + " existiert nicht"); } return result; @@ -233,7 +213,6 @@ if (results != null && !results.isEmpty()) { result = (Client) results.iterator().next(); } else { - // pm.currentTransaction().rollback(); throw new MapException("Client mit der mac-adresse:" + mac + " existiert nicht"); } return result; @@ -249,15 +228,18 @@ this.logger.info("createOrUpdateClientPosition()"); PersistenceManager pm = null; + Transaction tx = null; try { pm = JDOUtil.pmfactory.getPersistenceManager(); - pm.currentTransaction().begin(); + tx = pm.currentTransaction(); + tx.begin(); createOrUpdateClientPositionInternal(sessionId, mapName, positionX, positionY, positionZ, character, clientMac, fixed, pm); - if (pm.currentTransaction().isActive()) { - pm.currentTransaction().commit(); + if (tx.isActive()) { + tx.commit(); } } catch (Exception e) { + if (tx.isActive()) tx.rollback(); e.printStackTrace(); if (e instanceof MapException) { throw (MapException) e; @@ -305,31 +287,6 @@ pos.setPosZ(positionZ); logger.info("inside createOrUpdateClientPositionInternal Z-Koordinate: " + positionZ); PositionCache.getPositionCache().createOrUpdatePosition(map, pos); - - String string; - int i = 0; - try { - FileOutputStream fs = new FileOutputStream(new File("client.txt"), true); - PrintWriter pw = new PrintWriter(fs, true); - if (character.getSimpleScanResults() != null) { - while (i < character.getSimpleScanResults().length) { - string = "TimeStamp: " + System.currentTimeMillis() + " SessionID: " + sessionId + " ClientMAC: " - + clientMac + " MapName: " + mapName + " Postition.X " + positionX + " Postition.Y " - + positionY + " Postition.Y " + positionY + " Postition.Z " + positionZ + " Fixed: " - + fixed + " Character.getMacAP " + character.getSimpleScanResults()[i].getMacAP() - + " Character.LastSeen: " - //+ character.getSimpleScanResults()[i].getLastSeen() + " Character.noise " - + character.getSimpleScanResults()[i].getNoise() + " Character.SignalLevel: " - + character.getSimpleScanResults()[i].getSignalLevel(); - pw.println(string); - ++i; - } - } - pw.close(); - fs.close(); - } catch (Exception e) { - e.printStackTrace(); - } } /* (non-Javadoc) @@ -339,9 +296,11 @@ int positionZ, String accessPointMac, boolean fixed) throws SessionException, MapException{ this.logger.info("createOrUpdateAccessPosition()"); PersistenceManager pm = null; + Transaction tx = null; try { pm = JDOUtil.pmfactory.getPersistenceManager(); - pm.currentTransaction().begin(); + tx = pm.currentTransaction(); + tx.begin(); checkSession(sessionId, pm); Map map = checkMap(mapName, positionX, positionY, pm); AccessPoint ap = findOrCreateAccessPoint(accessPointMac, pm); @@ -360,10 +319,11 @@ pos.setPosY(positionY); pos.setPosZ(positionZ); PositionCache.getPositionCache().createOrUpdatePosition(map, pos); - if (pm.currentTransaction().isActive()) { - pm.currentTransaction().commit(); + if (tx.isActive()) { + tx.commit(); } } catch (Exception e) { + if (tx.isActive()) tx.rollback(); e.printStackTrace(); if (e instanceof MapException) { throw (MapException) e; @@ -385,18 +345,21 @@ int newPositionZ, boolean fixed) throws SessionException, MapException{ this.logger.info("movePosition()"); PersistenceManager pm = null; + Transaction tx = null; try { pm = JDOUtil.pmfactory.getPersistenceManager(); - pm.currentTransaction().begin(); + tx = pm.currentTransaction(); + tx.begin(); checkSession(sessionId, pm); Map map = checkMap(mapname, newPositionX, newPositionY, pm); PositionCache.getPositionCache().movePosition(map, positionId, newPositionX, newPositionY, newPositionZ, fixed); //logger.info("Z-Koord.: " + newPositionZ); - if (pm.currentTransaction().isActive()) { - pm.currentTransaction().commit(); + if (tx.isActive()) { + tx.commit(); } } catch (Exception e) { + if (tx.isActive()) tx.rollback(); e.printStackTrace(); if (e instanceof MapException) { throw (MapException) e; @@ -417,16 +380,19 @@ public void deletePosition(long sessionId, String mapname, long positionId) throws SessionException, MapException{ this.logger.info("deletePosition()"); PersistenceManager pm = null; + Transaction tx = null; try { pm = JDOUtil.pmfactory.getPersistenceManager(); - pm.currentTransaction().begin(); + tx = pm.currentTransaction(); + tx.begin(); checkSession(sessionId, pm); Map map = checkMap(mapname, pm); PositionCache.getPositionCache().removePosition(map, positionId); - if (pm.currentTransaction().isActive()) { - pm.currentTransaction().commit(); + if (tx.isActive()) { + tx.commit(); } } catch (Exception e) { + if (tx.isActive()) tx.rollback(); e.printStackTrace(); if (e instanceof MapException) { throw (MapException) e; @@ -450,19 +416,22 @@ this.logger.info("getPositionsForMapSince() " + timeStamp); PositionDTO[] result = null; PersistenceManager pm = null; + Transaction tx = null; try { pm = JDOUtil.pmfactory.getPersistenceManager(); - pm.currentTransaction().begin(); + tx = pm.currentTransaction(); + tx.begin(); checkSession(sessionId, pm); Map map = checkMap(mapName, pm); result = PositionCache.getPositionCache().getPositionsForMapSince(map, timeStamp, timeflag); for (int i = 0; i < result.length; i++) { logger.info("Z in PositionFacade: " + result[i].getPosZ()); } - if (pm.currentTransaction().isActive()) { - pm.currentTransaction().commit(); + if (tx.isActive()) { + tx.commit(); } } catch (Exception e) { + if (tx.isActive()) tx.rollback(); e.printStackTrace(); if (e instanceof MapException) { throw (MapException) e; @@ -484,20 +453,23 @@ SessionException, RemoteException{ this.logger.info("getPositionsForClientOnMap() "); PersistenceManager pm = null; + Transaction tx = null; String positionResult = null; try { pm = JDOUtil.pmfactory.getPersistenceManager(); - pm.currentTransaction().begin(); + tx = pm.currentTransaction(); + tx.begin(); checkSession(sessionId, pm); Map map = checkMap(mapName, pm); checkClient(clientMac, pm); PositionDTO pos = PositionCache.getPositionCache().getPositionForClientOnMap(map, clientMac); positionResult = String.valueOf(pos.getPosX()) + "#" + String.valueOf(pos.getPosY()) + "#" + String.valueOf(pos.isFixed()); - if (pm.currentTransaction().isActive()) { - pm.currentTransaction().commit(); + if (tx.isActive()) { + tx.commit(); } } catch (Exception e) { + if (tx.isActive()) tx.rollback(); e.printStackTrace(); if (e instanceof MapException) { throw (MapException) e; @@ -517,9 +489,11 @@ throws MapException, SessionException, RemoteException{ this.logger.info("setAccessPointHiddenStatus() "); PersistenceManager pm = null; + Transaction tx = null; try { pm = JDOUtil.pmfactory.getPersistenceManager(); - pm.currentTransaction().begin(); + tx = pm.currentTransaction(); + tx.begin(); checkSession(sessionId, pm); AccessPoint ap = findOrCreateAccessPoint(accessPointMac, pm); ap.setHidden(hidden); @@ -546,8 +520,9 @@ PositionCache.getPositionCache().createOrUpdatePosition(map, pos); } - pm.currentTransaction().commit(); + if (tx.isActive()) tx.commit(); } catch (Exception e) { + if (tx.isActive()) tx.rollback(); e.printStackTrace(); if (e instanceof MapException) { throw (MapException) e; Modified: trunk/magicmapserver/src/net/sf/magicmap/server/facade/SessionFacade.java =================================================================== --- trunk/magicmapserver/src/net/sf/magicmap/server/facade/SessionFacade.java 2006-10-31 15:16:30 UTC (rev 475) +++ trunk/magicmapserver/src/net/sf/magicmap/server/facade/SessionFacade.java 2006-10-31 15:55:58 UTC (rev 476) @@ -86,8 +86,9 @@ result = session.getId(); JDOUtil.commit(tx); } catch (Exception e) { + if (tx.isActive()) + tx.rollback(); this.logger.fatal("Fehler", e); - JDOUtil.rollBack(tx); throw new AuthenticationException(e.getMessage(), e); } finally { JDOUtil.closePM(pm); @@ -149,8 +150,9 @@ pm.deletePersistent(session); JDOUtil.commit(tx); } catch (Exception e) { + if (tx.isActive()) + tx.rollback(); this.logger.fatal("Fehler", e); - JDOUtil.rollBack(tx); throw new AuthenticationException(e.getMessage(), e); } finally { JDOUtil.closePM(pm); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fle...@us...> - 2006-10-31 15:20:42
|
Revision: 475 http://svn.sourceforge.net/magicmap/?rev=475&view=rev Author: flederohr Date: 2006-10-31 07:16:30 -0800 (Tue, 31 Oct 2006) Log Message: ----------- code formatting, organize imports and cleanup Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/artifact/Artifact.java trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactComparator.java trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactRepository.java trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactResolver.java trunk/magicmapclient/src/net/sf/magicmap/artifact/IArtifact.java trunk/magicmapclient/src/net/sf/magicmap/artifact/IConfigureable.java trunk/magicmapclient/src/net/sf/magicmap/artifact/IUniqueIdentity.java trunk/magicmapclient/src/net/sf/magicmap/artifact/IVendor.java trunk/magicmapclient/src/net/sf/magicmap/artifact/UniqeIdComparator.java trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/InfoNodeMetric.java trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeMetricManager.java trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeModelMetric.java trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/distance/DistanceAlgorithm.java trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/distance/MagicDistanceAlgorithm.java trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java trunk/magicmapclient/src/net/sf/magicmap/client/controller/PollHandler.java trunk/magicmapclient/src/net/sf/magicmap/client/controller/SOAPServerManager.java trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerManager.java trunk/magicmapclient/src/net/sf/magicmap/client/controller/ServerPoller.java trunk/magicmapclient/src/net/sf/magicmap/client/controller/VirtualServerManager.java trunk/magicmapclient/src/net/sf/magicmap/client/core/MagicMapApplication.java trunk/magicmapclient/src/net/sf/magicmap/client/delegate/MapDelegate.java trunk/magicmapclient/src/net/sf/magicmap/client/delegate/PositionDelegate.java trunk/magicmapclient/src/net/sf/magicmap/client/delegate/SessionDelegate.java trunk/magicmapclient/src/net/sf/magicmap/client/delegate/exception/ExceptionHandler.java trunk/magicmapclient/src/net/sf/magicmap/client/delegate/interfaces/Closeable.java trunk/magicmapclient/src/net/sf/magicmap/client/delegate/interfaces/MapFacadeInterface.java trunk/magicmapclient/src/net/sf/magicmap/client/delegate/interfaces/PositionFacadeInterface.java trunk/magicmapclient/src/net/sf/magicmap/client/delegate/interfaces/SessionFacadeInterface.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/IMapPanel.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/ISortableTableModel.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/MapPanel.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/PACWGraphDraw.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/StatusPanel.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/ViewTabPanel.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/AboutDialog.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/ConnectServerDialog.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/GeoPosDialog.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/InfoObjectDialog.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/LoadMapDialog.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/NewMapDialog.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/SetProxyDialog.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/dialogs/ViewOptionsDialog.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Attribute.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/CreateInfoObjectForm.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/Form.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutForm.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/FormLayoutReader.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/SimpleInfoObjectForm.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/forms/UserInterface.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/CallbackHandler.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIBuilder.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIConstants.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/GUIUtils.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/ImagePreview.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/MagicAction.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/NodeIcons.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/RelativePanelBuilder.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/utils/ShadowBorder.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/AbstractMapView.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/ConsoleView.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MapView.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementTable.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/MeasurementView.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineTree.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/OutlineView.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/View.java trunk/magicmapclient/src/net/sf/magicmap/client/gui/views/ViewHeader.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/CreateNewMapCallback.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/CreatePositionCallback.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/DeletePositionCallback.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/FetchGeoPointsCallback.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/FetchInfoPointsCallback.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/FetchMapsCallback.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/FetchPositionsCallback.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/LoadMapDialogListener.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MapCallback.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MapNamesCallback.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MapViewListener.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MeasurementModelListener.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/MovePositionCallback.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/NodeModelListener.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/PositionCallback.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/ServerConnectCallback.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/ServerDisconnectCallback.java trunk/magicmapclient/src/net/sf/magicmap/client/interfaces/ServerPollerListener.java trunk/magicmapclient/src/net/sf/magicmap/client/measurement/Constants.java trunk/magicmapclient/src/net/sf/magicmap/client/measurement/MeasurementUtils.java trunk/magicmapclient/src/net/sf/magicmap/client/measurement/ScannerAllocator.java trunk/magicmapclient/src/net/sf/magicmap/client/measurement/WTScanner.java trunk/magicmapclient/src/net/sf/magicmap/client/measurement/interfaces/AbstractScanResult.java trunk/magicmapclient/src/net/sf/magicmap/client/measurement/interfaces/AbstractScanner.java trunk/magicmapclient/src/net/sf/magicmap/client/measurement/interfaces/AbstractScannerHandler.java trunk/magicmapclient/src/net/sf/magicmap/client/meta/MapInfo.java trunk/magicmapclient/src/net/sf/magicmap/client/meta/ServerConnectionInfo.java trunk/magicmapclient/src/net/sf/magicmap/client/model/info/HTMLParser.java trunk/magicmapclient/src/net/sf/magicmap/client/model/info/InfoObjectBuilder.java trunk/magicmapclient/src/net/sf/magicmap/client/model/info/InfoObjectProvider.java trunk/magicmapclient/src/net/sf/magicmap/client/model/info/InfoObjectProviderRegistry.java trunk/magicmapclient/src/net/sf/magicmap/client/model/info/InfoObjectSupport.java trunk/magicmapclient/src/net/sf/magicmap/client/model/info/InfoTagFactory.java trunk/magicmapclient/src/net/sf/magicmap/client/model/info/InfoTagHandler.java trunk/magicmapclient/src/net/sf/magicmap/client/model/info/LoadTask.java trunk/magicmapclient/src/net/sf/magicmap/client/model/info/LoadThread.java trunk/magicmapclient/src/net/sf/magicmap/client/model/info/SimpleInfoObjectProvider.java trunk/magicmapclient/src/net/sf/magicmap/client/model/info/TagHandler.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/INodePlacer.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/NodeUpdateHandler.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/JungNodePlacer.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/LayoutSettings.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/LayoutWorker.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicForceFunction.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLayout.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicLengthFunction.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/MagicRepulsionFunction.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/handler/AccessPointHiddenStateHandler.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/handler/FixStateHandler.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/handler/InfoNodeHandler.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/handler/LabelChangeHandler.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/handler/NodeWithLocationHandler.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/handler/NotSeeAccessPointHandler.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/handler/PositionUpdateHandler.java trunk/magicmapclient/src/net/sf/magicmap/client/model/location/jung/handler/SeeAccessPointHandler.java trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementModel.java trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/MeasurementTableModel.java trunk/magicmapclient/src/net/sf/magicmap/client/model/measurement/SeenAccessPoint.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointEdge.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointNode.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/AccessPointSeerNode.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/ClientNode.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/GeoPos.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/GeoPosNode.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObject.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectNode.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/InfoObjectTag.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/LocationNode.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/MapNode.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/Node.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModelConstants.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModelSelectionEvent.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModelSelectionListener.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/SimpleInfoObject.java trunk/magicmapclient/src/net/sf/magicmap/client/model/outline/OutlineModel.java trunk/magicmapclient/src/net/sf/magicmap/client/model/outline/OutlineTreeNode.java trunk/magicmapclient/src/net/sf/magicmap/client/net/LinuxNetworkInfo.java trunk/magicmapclient/src/net/sf/magicmap/client/net/NetworkInfo.java trunk/magicmapclient/src/net/sf/magicmap/client/net/WindowsNetworkInfo.java trunk/magicmapclient/src/net/sf/magicmap/client/plugin/IClientPlugin.java trunk/magicmapclient/src/net/sf/magicmap/client/plugin/InfoPlugin.java trunk/magicmapclient/src/net/sf/magicmap/client/plugin/PluginHandler.java trunk/magicmapclient/src/net/sf/magicmap/client/plugin/udpscanner/UDPScanner.java trunk/magicmapclient/src/net/sf/magicmap/client/plugin/udpscanner/UDPScannerPlugin.java trunk/magicmapclient/src/net/sf/magicmap/client/plugin/udpscanner/WifiHandler.java trunk/magicmapclient/src/net/sf/magicmap/client/plugin/udpscanner/WifiScanResult.java trunk/magicmapclient/src/net/sf/magicmap/client/utils/AncestorAdaptor.java trunk/magicmapclient/src/net/sf/magicmap/client/utils/ComponentFinder.java trunk/magicmapclient/src/net/sf/magicmap/client/utils/HtmlSaxParser.java trunk/magicmapclient/src/net/sf/magicmap/client/utils/Settings.java trunk/magicmapclient/src/net/sf/magicmap/client/utils/Version.java trunk/magicmapclient/src/net/sf/magicmap/plugin/AbstractPlugin.java trunk/magicmapclient/src/net/sf/magicmap/plugin/IPlugin.java trunk/magicmapclient/src/net/sf/magicmap/plugin/IPluginDescriptor.java trunk/magicmapclient/src/net/sf/magicmap/plugin/InvalidPluginDescriptorException.java trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginDescriptorReader.java trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginException.java trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginLoader.java trunk/magicmapclient/src/net/sf/magicmap/plugin/PluginManager.java trunk/magicmapclient/src/net/sf/magicmap/plugin/SimplePluginDescriptor.java trunk/magicmapclient/src/net/sf/magicmap/plugin/SimpleVendor.java trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/ArtifactRepositoryTableModel.java trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginDescriptorView.java trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginDialog.java trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginListView.java trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginTableModel.java trunk/magicmapclient/src/net/sf/magicmap/plugin/ui/PluginTreeModel.java trunk/magicmapclient/src/net/sf/magicmap/plugin/util/IPluginVF.java trunk/magicmapclient/src/net/sf/magicmap/plugin/util/PluginDescriptorConverter.java Modified: trunk/magicmapclient/src/net/sf/magicmap/artifact/Artifact.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/artifact/Artifact.java 2006-10-29 11:34:35 UTC (rev 474) +++ trunk/magicmapclient/src/net/sf/magicmap/artifact/Artifact.java 2006-10-31 15:16:30 UTC (rev 475) @@ -1,33 +1,34 @@ + package net.sf.magicmap.artifact; - - public class Artifact implements IArtifact { - private final String groupid; - private final String artifactid; - private final String version; + private final String groupid; + private final String artifactid; + private final String version; private static final ArtifactComparator cmp = new ArtifactComparator(); - public Artifact(String groupid, String artifactid, String version){ + + public Artifact(String groupid, String artifactid, String version) { this.groupid = groupid; this.artifactid = artifactid; this.version = version; - + } + public String getVersion(){ - return version; + return this.version; } public String getArtifactId(){ - return artifactid; + return this.artifactid; } public String getGroupId(){ - return groupid; + return this.groupid; } public int compareTo(IArtifact o){ - return cmp.compare(this, o); + return Artifact.cmp.compare(this, o); } } Modified: trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactComparator.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactComparator.java 2006-10-29 11:34:35 UTC (rev 474) +++ trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactComparator.java 2006-10-31 15:16:30 UTC (rev 475) @@ -1,3 +1,4 @@ + package net.sf.magicmap.artifact; import java.util.Comparator; @@ -2,13 +3,9 @@ +public class ArtifactComparator implements Comparator<IArtifact> { - -public class ArtifactComparator implements Comparator<IArtifact>{ - public int compare(IArtifact o1, IArtifact o2){ int i = o1.getGroupId().compareTo(o2.getGroupId()); if (i == 0) { i = o1.getArtifactId().compareTo(o2.getArtifactId()); - if (i == 0){ - return o1.getVersion().compareTo(o2.getVersion()); - } + if (i == 0) return o1.getVersion().compareTo(o2.getVersion()); } Modified: trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactRepository.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactRepository.java 2006-10-29 11:34:35 UTC (rev 474) +++ trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactRepository.java 2006-10-31 15:16:30 UTC (rev 475) @@ -1,22 +1,16 @@ + package net.sf.magicmap.artifact; - import java.io.File; import java.io.IOException; import java.io.InputStream; -import java.net.MalformedURLException; import java.net.URL; -import java.net.URLConnection; -import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList; import java.util.List; -import java.util.jar.JarFile; - import org.apache.log4j.Logger; - /** * Eins zu eins von Maven geklaut. * @author Jan @@ -25,66 +19,68 @@ public class ArtifactRepository { private final IArtifactResolver resolver; - private final Logger log = Logger.getLogger(ArtifactRepository.class); - private final URL baseUrl; - private List<IArtifact> artifacts = new LinkedList<IArtifact>(); - + private final Logger log = Logger.getLogger(ArtifactRepository.class); + private final URL baseUrl; + private List<IArtifact> artifacts = new LinkedList<IArtifact>(); + /** * * @param baseUrl */ - public ArtifactRepository (URL baseUrl){ + public ArtifactRepository(URL baseUrl) { this.baseUrl = baseUrl; resolver = new ArtifactResolver(baseUrl.toString()); } - + /** * * @param artifact * @return */ public InputStream getArtifactJar(IArtifact artifact) throws IOException{ - URL artifactUrl = new URL(baseUrl, - resolver.resolvePath(artifact) + resolver.resolveFile(artifact)); + URL artifactUrl = new URL(baseUrl, resolver.resolvePath(artifact) + resolver.resolveFile(artifact)); return artifactUrl.openStream(); } - + /** * * */ public void loadRepository() throws IOException{ ArtifactLoader loader = new ArtifactLoader(); - artifacts.addAll (loader.getArtifact(baseUrl)); + artifacts.addAll(loader.getArtifact(baseUrl)); for (IArtifact artifact : artifacts) { log.info(resolver.resolvePath(artifact) + resolver.resolveFile(artifact)); } } + public int size(){ return artifacts.size(); } - + public IArtifact get(int index){ return artifacts.get(index); } + /** * * @param args * @throws IOException */ public static void main(String[] args) throws IOException{ - new ArtifactRepository(new File("C:/Dokumente und Einstellungen/Jan/.m2/repository/").toURL()).loadRepository(); + new ArtifactRepository(new File("C:/Dokumente und Einstellungen/Jan/.m2/repository/").toURL()).loadRepository(); } + /** * * @author Jan * */ - public class ArtifactLoader{ - - public Collection<IArtifact> getArtifact(URL url)throws IOException{ - Collection<IArtifact> artifacts =new LinkedList<IArtifact>(); - for(String dir : new File(url.getFile()).list()){ + public class ArtifactLoader { + + public Collection<IArtifact> getArtifact(URL url) throws IOException{ + Collection<IArtifact> artifacts = new LinkedList<IArtifact>(); + for (String dir : new File(url.getFile()).list()) { getArtifact(new URL(baseUrl + dir), artifacts, 1); } return artifacts; @@ -98,15 +94,14 @@ * @throws IOException */ private void getArtifact(URL url, Collection<IArtifact> artifacts, int depth) throws IOException{ - for(String dir : new File(url.getFile()).list()){ - File currentFile = new File(url.getFile() +"/" + dir); - if (currentFile.isFile() && dir.endsWith(".jar")){ + for (String dir : new File(url.getFile()).list()) { + File currentFile = new File(url.getFile() + "/" + dir); + if (currentFile.isFile() && dir.endsWith(".jar")) { final String[] temp = url.getPath().split("/"); artifacts.add(resolver.getArtifact(new URL(url.toString() + "/" + dir))); + } else if (currentFile.isDirectory()) { + getArtifact(new URL(url + "/" + dir), artifacts, depth + 1); } - else if (currentFile.isDirectory()){ - getArtifact(new URL(url + "/" + dir), artifacts, depth+1); - } } } } Modified: trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactResolver.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactResolver.java 2006-10-29 11:34:35 UTC (rev 474) +++ trunk/magicmapclient/src/net/sf/magicmap/artifact/ArtifactResolver.java 2006-10-31 15:16:30 UTC (rev 475) @@ -1,42 +1,40 @@ + package net.sf.magicmap.artifact; import java.net.URL; -import java.util.regex.Pattern; - import org.apache.log4j.Logger; - /** * * @author Jan_fride * */ public class ArtifactResolver implements IArtifactResolver { - + private static final Logger log = Logger.getLogger(ArtifactResolver.class); - private final int prefix; + private final int prefix; - /** * * @param repositories */ - public ArtifactResolver(String url){ - prefix = url.length(); + public ArtifactResolver(String url) { + this.prefix = url.length(); } + /* (non-Javadoc) * @see net.sf.magicmap.artifact.IArtifactResolver#resolvePath(net.sf.magicmap.artifact.IArtifact) */ public String resolvePath(IArtifact artifact){ - StringBuilder builder = new StringBuilder(artifact.getGroupId().replace(".", "/")); - builder.append("/"); - builder.append(artifact.getArtifactId()); - builder.append("/").append(artifact.getVersion()); - builder.append("/"); - return builder.toString(); + StringBuilder builder = new StringBuilder(artifact.getGroupId().replace(".", "/")); + builder.append("/"); + builder.append(artifact.getArtifactId()); + builder.append("/").append(artifact.getVersion()); + builder.append("/"); + return builder.toString(); } - + /* (non-Javadoc) * @see net.sf.magicmap.artifact.IArtifactResolver#resolveFile(net.sf.magicmap.artifact.IArtifact) */ @@ -46,34 +44,31 @@ builder.append(".jar"); return builder.toString(); } - + /* (non-Javadoc) * @see net.sf.magicmap.artifact.IArtifactResolver#getArtifact(java.net.URL) */ public Artifact getArtifact(URL url){ - log.info(url.toString()); - String urlStr = url.toString().substring(prefix); - if (!urlStr.endsWith(".jar")){ - throw new IllegalArgumentException("No path to an artifact: " + url); - } - log.info(urlStr); - String[] path = urlStr.split("/"); - if (path.length < 3) throw new IllegalArgumentException("No path to an artifact: " + url); - int i = path.length-2; - String version = path[i--]; - String artiact = path [i--]; - - StringBuilder b = new StringBuilder(); - boolean first = true; - for (int j =0; j <= i; ++j){ - if (first){ - first = false; - b.append(path[j]); - } - else b.append(".").append(path[j]); - } - - return new Artifact(b.toString(), artiact, version); - + ArtifactResolver.log.info(url.toString()); + String urlStr = url.toString().substring(this.prefix); + if (!urlStr.endsWith(".jar")) throw new IllegalArgumentException("No path to an artifact: " + url); + ArtifactResolver.log.info(urlStr); + String[] path = urlStr.split("/"); + if (path.length < 3) throw new IllegalArgumentException("No path to an artifact: " + url); + int i = path.length - 2; + String version = path[i--]; + String artiact = path[i--]; + + StringBuilder b = new StringBuilder(); + boolean first = true; + for (int j = 0; j <= i; ++j) + if (first) { + first = false; + b.append(path[j]); + } else + b.append(".").append(path[j]); + + return new Artifact(b.toString(), artiact, version); + } } Modified: trunk/magicmapclient/src/net/sf/magicmap/artifact/IArtifact.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/artifact/IArtifact.java 2006-10-29 11:34:35 UTC (rev 474) +++ trunk/magicmapclient/src/net/sf/magicmap/artifact/IArtifact.java 2006-10-31 15:16:30 UTC (rev 475) @@ -1,12 +1,8 @@ + package net.sf.magicmap.artifact; -import java.util.Comparator; - - - - public interface IArtifact extends IUniqueIdentity<IArtifact> { public String getVersion(); - + } Modified: trunk/magicmapclient/src/net/sf/magicmap/artifact/IConfigureable.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/artifact/IConfigureable.java 2006-10-29 11:34:35 UTC (rev 474) +++ trunk/magicmapclient/src/net/sf/magicmap/artifact/IConfigureable.java 2006-10-31 15:16:30 UTC (rev 475) @@ -1,3 +1,4 @@ + package net.sf.magicmap.artifact; import net.sf.magicmap.client.utils.Settings; @@ -6,5 +7,5 @@ */ public interface IConfigureable { - public void setup(Settings settings); + public void setup(Settings settings); } Modified: trunk/magicmapclient/src/net/sf/magicmap/artifact/IUniqueIdentity.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/artifact/IUniqueIdentity.java 2006-10-29 11:34:35 UTC (rev 474) +++ trunk/magicmapclient/src/net/sf/magicmap/artifact/IUniqueIdentity.java 2006-10-31 15:16:30 UTC (rev 475) @@ -1,25 +1,24 @@ + package net.sf.magicmap.artifact; -import java.util.Comparator; - /** * A unique identity consists of a group and an artifact id. * Its more or less the same as a java class - it has a package and * a unique name inside thus package. * */ -public interface IUniqueIdentity<T extends IUniqueIdentity> extends Comparable<T>{ +public interface IUniqueIdentity<T extends IUniqueIdentity> extends Comparable<T> { - /** - * The group this artfact belongs to - * @return die Gruppe des Plugins. - */ - public String getArtifactId(); + /** + * The group this artfact belongs to + * @return die Gruppe des Plugins. + */ + public String getArtifactId(); - /** - * - * @return id des Plugins in seiner Gruppe. - */ - public String getGroupId(); + /** + * + * @return id des Plugins in seiner Gruppe. + */ + public String getGroupId(); } Modified: trunk/magicmapclient/src/net/sf/magicmap/artifact/IVendor.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/artifact/IVendor.java 2006-10-29 11:34:35 UTC (rev 474) +++ trunk/magicmapclient/src/net/sf/magicmap/artifact/IVendor.java 2006-10-31 15:16:30 UTC (rev 475) @@ -1,3 +1,4 @@ + package net.sf.magicmap.artifact; /** @@ -3,8 +4,11 @@ * Beschreibt einen Hersteller. * -*/ + */ public interface IVendor { - public String getName(); - public String getEmail(); - public String getHomePage(); + + public String getName(); + + public String getEmail(); + + public String getHomePage(); } Modified: trunk/magicmapclient/src/net/sf/magicmap/artifact/UniqeIdComparator.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/artifact/UniqeIdComparator.java 2006-10-29 11:34:35 UTC (rev 474) +++ trunk/magicmapclient/src/net/sf/magicmap/artifact/UniqeIdComparator.java 2006-10-31 15:16:30 UTC (rev 475) @@ -1,3 +1,4 @@ + package net.sf.magicmap.artifact; import java.util.Comparator; @@ -2,7 +3,5 @@ +public class UniqeIdComparator implements Comparator<IUniqueIdentity> { - -public class UniqeIdComparator implements Comparator<IUniqueIdentity>{ - - public int compare(IUniqueIdentity o1, IUniqueIdentity o2) { + public int compare(IUniqueIdentity o1, IUniqueIdentity o2){ final int i = o1.getGroupId().compareTo(o2.getGroupId()); Modified: trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/InfoNodeMetric.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/InfoNodeMetric.java 2006-10-29 11:34:35 UTC (rev 474) +++ trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/InfoNodeMetric.java 2006-10-31 15:16:30 UTC (rev 475) @@ -9,31 +9,28 @@ public class InfoNodeMetric implements NodeModelMetric { - public InfoNodeMetric() { + public InfoNodeMetric() { - } + } - public double metric(Node node1, Node node2){ - if (node1 == node2) throw new IllegalArgumentException("Keine Verbindung zwischen dem selben Knoten!"); - if (node1 instanceof InfoObjectNode && node2 instanceof InfoObjectNode){ - InfoObjectNode iNode1 = (InfoObjectNode) node1; - InfoObjectNode iNode2 = (InfoObjectNode) node2; - Set<InfoObjectTag> tagset = iNode2.getTags(); - int commonTags = 0; - double tagCount = (iNode1.getTags().size() + 1) / 2; - for (InfoObjectTag tag : iNode1){ - if (tagset.contains(tag)){ - commonTags++; - } else{ + public double metric(Node node1, Node node2){ + if (node1 == node2) throw new IllegalArgumentException("Keine Verbindung zwischen dem selben Knoten!"); + if (node1 instanceof InfoObjectNode && node2 instanceof InfoObjectNode) { + InfoObjectNode iNode1 = (InfoObjectNode) node1; + InfoObjectNode iNode2 = (InfoObjectNode) node2; + Set<InfoObjectTag> tagset = iNode2.getTags(); + int commonTags = 0; + double tagCount = (iNode1.getTags().size() + 1) / 2; + for (InfoObjectTag tag : iNode1) + if (tagset.contains(tag)) + commonTags++; + else { + } + if (commonTags == 0) return 220.0; + return 120.0 * (tagCount / commonTags); } - } - if (commonTags == 0){ - return 220.0; - } - return 120.0 * (tagCount / (double) commonTags); + return Double.POSITIVE_INFINITY; } - return Double.POSITIVE_INFINITY; - } } Modified: trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java 2006-10-29 11:34:35 UTC (rev 474) +++ trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/MagicMetric.java 2006-10-31 15:16:30 UTC (rev 475) @@ -9,16 +9,16 @@ import java.util.Iterator; import java.util.Set; -import org.apache.log4j.Logger; - import net.sf.magicmap.client.algorithms.distance.MagicDistanceAlgorithm; import net.sf.magicmap.client.measurement.Constants; import net.sf.magicmap.client.measurement.MeasurementUtils; import net.sf.magicmap.client.model.node.AccessPointNode; import net.sf.magicmap.client.model.node.AccessPointSeerNode; import net.sf.magicmap.client.model.node.Node; -import net.sf.magicmap.client.model.node.NodeModel; +import net.sf.magicmap.client.model.node.NodeModelConstants; +import org.apache.log4j.Logger; + /** * Die originale Metrik aus dem Proof-Of-Concept * Tool aus dem NOMANDS-Seminar angepasst auf die @@ -26,7 +26,8 @@ * @author thuebner */ public class MagicMetric implements NodeModelMetric { - private static Logger log = Logger.getLogger(MagicMetric.class); + + private static Logger log = Logger.getLogger(MagicMetric.class); static MagicDistanceAlgorithm mda = new MagicDistanceAlgorithm(); /** @@ -41,12 +42,12 @@ ArrayList aps1 = node1.getSeenAccessPoints(); ArrayList aps2 = node2.getSeenAccessPoints(); -// String aps = ""; -// for (Object apn : aps1){ -// aps += ((AccessPointNode) apn).getMacAddress() + "###"; -// } -// log.warn(aps); - + // String aps = ""; + // for (Object apn : aps1){ + // aps += ((AccessPointNode) apn).getMacAddress() + "###"; + // } + // log.warn(aps); + // F\xFCr alle AccessPoints von Knoten 1 .... for (int i = 0; i < aps1.size(); i++) { AccessPointNode ap1 = (AccessPointNode) aps1.get(i); @@ -61,10 +62,8 @@ break; // Raus... } } - if (!found) { - // For AcesssPoint ap1 aus node1 gab es keine Entsprechung in node2 + if (!found) // For AcesssPoint ap1 aus node1 gab es keine Entsprechung in node2 diff.add(ap1); - } } // In same sind nun alle gemeinsam gesehen APs // In diff sind alle APs die zwar AP1 aber nicht AP2 sieht @@ -88,19 +87,17 @@ */ public double metric(Node node1, Node node2){ - boolean a1 = (node1.getType() == NodeModel.NODETYPE_ACCESSPOINT); - boolean a2 = (node2.getType() == NodeModel.NODETYPE_ACCESSPOINT); - boolean c1 = (node1.getType() == NodeModel.NODETYPE_CLIENT); - boolean c2 = (node2.getType() == NodeModel.NODETYPE_CLIENT); - boolean r1 = (node1.getType() == NodeModel.NODETYPE_LOCATION); - boolean r2 = (node2.getType() == NodeModel.NODETYPE_LOCATION); + boolean a1 = (node1.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT); + boolean a2 = (node2.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT); + boolean c1 = (node1.getType() == NodeModelConstants.NODETYPE_CLIENT); + boolean c2 = (node2.getType() == NodeModelConstants.NODETYPE_CLIENT); + boolean r1 = (node1.getType() == NodeModelConstants.NODETYPE_LOCATION); + boolean r2 = (node2.getType() == NodeModelConstants.NODETYPE_LOCATION); boolean rc1 = (c1 || r1); boolean rc2 = (c2 || r2); - if (a1 && a2) { - // Zwei AccessPoints + if (a1 && a2) // Zwei AccessPoints return Double.POSITIVE_INFINITY; - } if (rc1 && rc2) { // Zwischen zwei Orten/Clients @@ -114,9 +111,7 @@ if (same.size() == 0) return 1000.0; if (same.size() == 1) { - if (diff.size() == 0) { - return 0.0; - } + if (diff.size() == 0) return 0.0; return 1000.0; } @@ -138,7 +133,7 @@ double[] v2 = new double[m]; c = 0; // Verh\xE4ltnisse pro Vektor berechnen - for (int i = 0; i < a.length - 1; ++i) { + for (int i = 0; i < a.length - 1; ++i) for (int j = i + 1; j < a.length; ++j) { v1[c] = a[i] / a[j]; v2[c] = b[i] / b[j]; @@ -147,10 +142,9 @@ v2[c] = b[j] / b[i]; c++; } - } // v1 enth\xE4lt nun Signalverh\xE4ltnisse von ap1 // v2 enth\xE4lt nun Signalverh\xE4ltnisse von ap2 - double distance = mda.distance(v1, v2); + double distance = MagicMetric.mda.distance(v1, v2); // Bestrafung nicht gemeinsam gesehener AccessPoints it = diff.iterator(); Modified: trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeMetricManager.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeMetricManager.java 2006-10-29 11:34:35 UTC (rev 474) +++ trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeMetricManager.java 2006-10-31 15:16:30 UTC (rev 475) @@ -15,38 +15,38 @@ */ public class NodeMetricManager implements NodeModelMetric { - private NodeModelMetric defaultMetric; - private final MultiKeyMap metricMap = new MultiKeyMap(); + private NodeModelMetric defaultMetric; + private final MultiKeyMap metricMap = new MultiKeyMap(); - public NodeMetricManager(NodeModelMetric defaultMetric) { - this.defaultMetric = defaultMetric; - } + public NodeMetricManager(NodeModelMetric defaultMetric) { + this.defaultMetric = defaultMetric; + } - /** - * F\xFCgt eine Metric zu einem Tupel von Knoten hinzu. - * - * @param clazz1 der 1. Knotentyp - * @param clazz2 der 2. Knotentyp - * @param metric die Metric die auf die beiden Knotentypen angewant werden soll. - */ - public final void addMetric(Class clazz1, Class clazz2, NodeModelMetric metric){ - if (metricMap.containsKey(clazz1, clazz2)){ - throw new IllegalArgumentException("Mapping for " + clazz1 + "," + clazz2 + " exists"); + /** + * F\xFCgt eine Metric zu einem Tupel von Knoten hinzu. + * + * @param clazz1 der 1. Knotentyp + * @param clazz2 der 2. Knotentyp + * @param metric die Metric die auf die beiden Knotentypen angewant werden soll. + */ + public final void addMetric(Class clazz1, Class clazz2, NodeModelMetric metric){ + if (metricMap.containsKey(clazz1, clazz2)) { + throw new IllegalArgumentException("Mapping for " + clazz1 + "," + clazz2 + " exists"); + } + metricMap.put(clazz1, clazz2, metric); } - metricMap.put(clazz1, clazz2, metric); - } - public final void removeMetric(Class clazz1, Class clazz2){ - metricMap.remove(clazz1, clazz2); - } + public final void removeMetric(Class clazz1, Class clazz2){ + metricMap.remove(clazz1, clazz2); + } - /** - * - */ - public double metric(Node node1, Node node2){ - NodeModelMetric delegate = (NodeModelMetric) metricMap.get(node1.getClass(), node2.getClass()); - if (delegate == null) return defaultMetric.metric(node1, node2); - return delegate.metric(node1, node2); - } + /** + * + */ + public double metric(Node node1, Node node2){ + NodeModelMetric delegate = (NodeModelMetric) metricMap.get(node1.getClass(), node2.getClass()); + if (delegate == null) return defaultMetric.metric(node1, node2); + return delegate.metric(node1, node2); + } } Modified: trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeModelMetric.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeModelMetric.java 2006-10-29 11:34:35 UTC (rev 474) +++ trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/NodeModelMetric.java 2006-10-31 15:16:30 UTC (rev 475) @@ -21,6 +21,6 @@ * @param node2 zweiter Knoten. * @return den Abstand zwischen den beiden Knoten. */ - public abstract double metric(Node node1, Node node2); + public abstract double metric(Node node1, Node node2); } \ No newline at end of file Modified: trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/distance/DistanceAlgorithm.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/distance/DistanceAlgorithm.java 2006-10-29 11:34:35 UTC (rev 474) +++ trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/distance/DistanceAlgorithm.java 2006-10-31 15:16:30 UTC (rev 475) @@ -11,6 +11,6 @@ */ public interface DistanceAlgorithm { - public double distance(double[] a, double[] b); + public double distance(double[] a, double[] b); } \ No newline at end of file Modified: trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/distance/MagicDistanceAlgorithm.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/distance/MagicDistanceAlgorithm.java 2006-10-29 11:34:35 UTC (rev 474) +++ trunk/magicmapclient/src/net/sf/magicmap/client/algorithms/distance/MagicDistanceAlgorithm.java 2006-10-31 15:16:30 UTC (rev 475) @@ -9,18 +9,16 @@ */ public class MagicDistanceAlgorithm implements DistanceAlgorithm { - /* (non-Javadoc) - * @see net.sf.magicmap.client.algorithms.distance.DistanceAlgorithm#distance(double[], double[]) - */ - public double distance(double[] a, double[] b){ - double result = 0; - for (int i = 0; i < a.length; i++){ - result += Math.abs(a[i] - b[i]);// ?Distanz der einzelnen Arraywerte, aufaddiert und durch die Anzahl dividiert - // -> wahrscheinlich durchschnittliche Entfernung der einzelnen Positionen - + /* (non-Javadoc) + * @see net.sf.magicmap.client.algorithms.distance.DistanceAlgorithm#distance(double[], double[]) + */ + public double distance(double[] a, double[] b){ + double result = 0; + for (int i = 0; i < a.length; i++) + result += Math.abs(a[i] - b[i]);// ?Distanz der einzelnen Arraywerte, aufaddiert und durch die Anzahl dividiert + // -> wahrscheinlich durchschnittliche Entfernung der einzelnen Positionen + result = result / a.length; + return result; } - result = result / (double) a.length; - return result; - } } \ No newline at end of file Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2006-10-29 11:34:35 UTC (rev 474) +++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2006-10-31 15:16:30 UTC (rev 475) @@ -4,17 +4,10 @@ package net.sf.magicmap.client.controller; -import java.io.IOException; -import java.net.InetAddress; import java.net.MalformedURLException; -import java.net.UnknownHostException; import java.util.ArrayList; import java.util.Collection; -import javax.swing.JFrame; -import javax.swing.JScrollPane; -import javax.swing.JTable; - import net.sf.magicmap.client.gui.utils.GUIUtils; import net.sf.magicmap.client.gui.views.ConsoleView; import net.sf.magicmap.client.gui.views.MapView; @@ -25,9 +18,7 @@ import net.sf.magicmap.client.interfaces.DeletePositionCallback; import net.sf.magicmap.client.interfaces.MapCallback; import net.sf.magicmap.client.interfaces.MapNamesCallback; -import net.sf.magicmap.client.interfaces.MeasurementModelListener; import net.sf.magicmap.client.interfaces.MovePositionCallback; -import net.sf.magicmap.client.interfaces.NodeModelListener; import net.sf.magicmap.client.interfaces.PositionCallback; import net.sf.magicmap.client.interfaces.ServerConnectCallback; import net.sf.magicmap.client.interfaces.ServerDisconnectCallback; @@ -36,6 +27,7 @@ import net.sf.magicmap.client.measurement.interfaces.AbstractScanner; import net.sf.magicmap.client.measurement.interfaces.AbstractScannerHandler; import net.sf.magicmap.client.meta.MapInfo; +import net.sf.magicmap.client.model.info.InfoObjectProviderRegistry; import net.sf.magicmap.client.model.measurement.MeasurementModel; import net.sf.magicmap.client.model.measurement.SeenAccessPoint; import net.sf.magicmap.client.model.node.AccessPointEdge; @@ -47,12 +39,9 @@ import net.sf.magicmap.client.model.node.InfoObjectNode; import net.sf.magicmap.client.model.node.Node; import net.sf.magicmap.client.model.node.NodeModel; -import net.sf.magicmap.client.model.info.InfoObjectProviderRegistry; -import net.sf.magicmap.client.net.NetworkInfo; import net.sf.magicmap.client.plugin.PluginHandler; import net.sf.magicmap.client.utils.Settings; import net.sf.magicmap.plugin.PluginManager; -import net.sf.magicmap.plugin.ui.PluginTableModel; import org.apache.log4j.xml.DOMConfigurator; @@ -64,547 +53,533 @@ */ public class Controller implements IController { - private static int numCalled = 0; + private static int numCalled = 0; - /** - * Die Instanz. - */ - private static Controller controller = null; + /** + * Die Instanz. + */ + private static Controller controller = null; - /** - * Das Knotenmodel. - */ - private INodeModel nodeModel; // Model f\xFCr Graphen + /** + * Das Knotenmodel. + */ + private INodeModel nodeModel; // Model f\xFCr Graphen - private MeasurementModel measurementModel; // Model f\xFCr Messungen + private MeasurementModel measurementModel; // Model f\xFCr Messungen - private MeasurementModel measurementModelOther; // Messungen anderen Clients / Orte + private MeasurementModel measurementModelOther; // Messungen anderen Clients / Orte - private ClientNode client; // Ausgezeichneter Knoten + private ClientNode client; // Ausgezeichneter Knoten - private ServerPoller poller; // Server st\xE4ndig nach \xC4nderungen fragen + private ServerPoller poller; // Server st\xE4ndig nach \xC4nderungen fragen - private PollHandler pollhandler; // Klasse zur Verarbeitung der Pollergebnisse + private PollHandler pollhandler; // Klasse zur Verarbeitung der Pollergebnisse - private ServerManager serverManager; // Manager f\xFCr die Verbindung zum Server + private ServerManager serverManager; // Manager f\xFCr die Verbindung zum Server - // private CallbackHandler callbackHandler; // S\xE4mtliche callbacks werden dort behandelt + // private CallbackHandler callbackHandler; // S\xE4mtliche callbacks werden dort behandelt - private MapInfo currentMap; + private MapInfo currentMap; - private OutlineView outlineView; + private OutlineView outlineView; - private ConsoleView consoleView; + private ConsoleView consoleView; - private MapView mapView; + private MapView mapView; - private MeasurementView measurementView; + private MeasurementView measurementView; - private boolean invisble; // Invisible-Modus (keine Daten an Server) + private boolean invisble; // Invisible-Modus (keine Daten an Server) - // pseudo server items - private Collection<InfoObject> infoObjects; + // pseudo server items + private Collection<InfoObject> infoObjects; - private ScannerAllocator scannerAllocator; - private final InfoObjectProviderRegistry infoServiceRegistry; - private final PluginManager pluginManager; + private ScannerAllocator scannerAllocator; + private final InfoObjectProviderRegistry infoServiceRegistry; + private final PluginManager pluginManager; - /** - * Private constructor for singleton instance - */ - private Controller() { - DOMConfigurator.configureAndWatch("log4j.xml"); + /** + * Private constructor for singleton instance + */ + private Controller() { + DOMConfigurator.configureAndWatch("log4j.xml"); - // - // Das Model der Knoten. - // - this.nodeModel = new NodeModel(); + // + // Das Model der Knoten. + // + this.nodeModel = new NodeModel(); /** * Messungen f\xFCr den eigenen clienten */ - this.measurementModel = new MeasurementModel(); + this.measurementModel = new MeasurementModel(); /** * Messungen f\xFCr alle anderen? */ - this.measurementModelOther = new MeasurementModel(); + this.measurementModelOther = new MeasurementModel(); + this.scannerAllocator = new ScannerAllocator(); + this.currentMap = null; + this.serverManager = null; - this.scannerAllocator = new ScannerAllocator(); - this.currentMap = null; - this.serverManager = null; + this.pollhandler = new PollHandler(this); - this.pollhandler = new PollHandler(this); + buildViews(); - buildViews(); + // pseudo server items + this.infoObjects = new ArrayList<InfoObject>(); + // initializeScanner(); + this.infoServiceRegistry = new InfoObjectProviderRegistry(this.nodeModel); + PluginHandler.getInstance(); - // pseudo server items - infoObjects = new ArrayList<InfoObject>(); - // initializeScanner(); - infoServiceRegistry = new InfoObjectProviderRegistry(nodeModel); - PluginHandler.getInstance(); + this.pluginManager = new PluginManager(new Settings(), this); + } - pluginManager = new PluginManager(new Settings(), this); - - } + /** + * Getter for client node + * + * @return the client node + */ + public ClientNode getClient(){ + return this.client; + } - /** - * Getter for client node - * - * @return the client node - */ - public ClientNode getClient(){ - return this.client; - } + /** + * Erzeugt die Hauptviews der Anwendung + */ + private void buildViews(){ + this.outlineView = new OutlineView(this.nodeModel); + this.consoleView = new ConsoleView(); + this.mapView = new MapView(this.nodeModel, null); + this.measurementView = new MeasurementView(getMeasurementModel(), this.nodeModel); + // registerMeasurementModelListener(measurementView); + setMeasurementViewLocal(true); + this.nodeModel.addNodeModelListener(this.mapView); + //registerNodeModelListener(outlineView); + } - /** - * Erzeugt die Hauptviews der Anwendung - */ - private void buildViews(){ - this.outlineView = new OutlineView(nodeModel); - this.consoleView = new ConsoleView(); - this.mapView = new MapView(nodeModel, null); - this.measurementView = new MeasurementView(getMeasurementModel(), nodeModel); - // registerMeasurementModelListener(measurementView); - setMeasurementViewLocal(true); - nodeModel.addNodeModelListener(mapView); - //registerNodeModelListener(outlineView); - } + /** + * Getter for the map view + * + * @return the map view + */ + public MapView getMapView(){ + return this.mapView; + } - /** - * Getter for the map view - * - * @return the map view - */ - public MapView getMapView(){ - return this.mapView; - } + /** + * Getter for the outline view + * + * @return the outline view + */ + public OutlineView getOutlineView(){ + return this.outlineView; + } - /** - * Getter for the outline view - * - * @return the outline view - */ - public OutlineView getOutlineView(){ - return this.outlineView; - } + /** + * Getter for the console view + * + * @return the console view + */ + public ConsoleView getConsoleView(){ + return this.consoleView; + } - /** - * Getter for the console view - * - * @return the console view - */ - public ConsoleView getConsoleView(){ - return this.consoleView; - } + /** + * Getter for the measurement view + * + * @return the measurement view + */ + public MeasurementView getMeasurementView(){ + return this.measurementView; + } - /** - * Getter for the measurement view - * - * @return the measurement view - */ - public MeasurementView getMeasurementView(){ - return this.measurementView; - } + /** + * Provides the singleton controller instance (creates a new one if null) + * + * @return the singleton controller instance + */ + public static Controller getInstance(){ + if (Controller.controller == null) { + ++Controller.numCalled; + Controller.controller = new Controller(); + } + return Controller.controller; + } - /** - * Provides the singleton controller instance (creates a new one if null) - * - * @return the singleton controller instance - */ - public static Controller getInstance(){ - if (controller == null){ - ++numCalled; - controller = new Controller(); - } - return controller; - } + /** + * Getter for the node model + * + * @return the node model + */ + public INodeModel getNodeModel(){ + return this.nodeModel; + } - /** - * Getter for the node model - * - * @return the node model - */ - public INodeModel getNodeModel(){ - return nodeModel; - } + /** + * Baut das MeasurementModelOther neu auf. + * + * @param ap - + * the access point seer node + */ + public void buildOtherMeasurement(AccessPointSeerNode ap){ + System.out.println("Building measurement model..."); + this.measurementModelOther.clear(); + ArrayList aes = ap.getApEdges(); + for (int i = 0; i < aes.size(); i++) { + AccessPointEdge ae = (AccessPointEdge) aes.get(i); + SeenAccessPoint sp = new SeenAccessPoint(ae.getAccessPoint().getMacAddress(), ae.getSignalLevel()); + this.measurementModelOther.addAccessPoint(sp); + } + } - /** - * Baut das MeasurementModelOther neu auf. - * - * @param ap - - * the access point seer node - */ - public void buildOtherMeasurement(AccessPointSeerNode ap){ - System.out.println("Building measurement model..."); - this.measurementModelOther.clear(); - ArrayList aes = ap.getApEdges(); - for (int i = 0; i < aes.size(); i++){ - AccessPointEdge ae = (AccessPointEdge) aes.get(i); - SeenAccessPoint sp = new SeenAccessPoint(ae.getAccessPoint().getMacAddress(), ae.getSignalLevel()); - this.measurementModelOther.addAccessPoint(sp); - } - } + /** + * \xC4nndert die Anzeige des Measurement-Views + * + * @param local + * true, wenn lokale St\xE4rken angezeigt werden sollen + */ + public void setMeasurementViewLocal(boolean local){ + if (local) { + // measurementModelOther.removeMeasurementModelListener(measurementView); + // measurementModel.addMeasurementModelListener(measurementView); + //measurementModel.clear(); + } else { + // measurementModel.removeMeasurementModelListener(measurementView); + // measurementModelOther.addMeasurementModelListener(measurementView); + //measurementModelOther.clear(); + } + } - /** - * \xC4nndert die Anzeige des Measurement-Views - * - * @param local - * true, wenn lokale St\xE4rken angezeigt werden sollen - */ - public void setMeasurementViewLocal(boolean local){ - if (local){ -// measurementModelOther.removeMeasurementModelListener(measurementView); -// measurementModel.addMeasurementModelListener(measurementView); - //measurementModel.clear(); - } else{ -// measurementModel.removeMeasurementModelListener(measurementView); -// measurementModelOther.addMeasurementModelListener(measurementView); - //measurementModelOther.clear(); - } - } + /** + * Getter for measurement model + * + * @return the measurement model + */ + public MeasurementModel getMeasurementModel(){ + return this.measurementModel; + } - /** - * Getter for measurement model - * - * @return the measurement model - */ - public MeasurementModel getMeasurementModel(){ - return measurementModel; - } + /** + * Gibt an ob verbunden oder nicht verbunden + * + * @return true wenn ja, false sonst + */ + public boolean isConnected(){ + return (this.serverManager != null && this.serverManager.isConnected()); + } - /** - * Gibt an ob verbunden oder nicht verbunden - * - * @return true wenn ja, false sonst - */ - public boolean isConnected(){ - return (serverManager != null && serverManager.isConnected()); - } + /** + * Liefert Kartenbeschreibung der aktuell geladenen Karte + * + * @return Kartenbeschreibung (MapInfo) oder null, wenn keine Karte aktiv + */ + public MapInfo getCurrentMap(){ + return this.currentMap; + } - /** - * Liefert Kartenbeschreibung der aktuell geladenen Karte - * - * @return Kartenbeschreibung (MapInfo) oder null, wenn keine Karte aktiv - */ - public MapInfo getCurrentMap(){ - return this.currentMap; - } + /** + * Setzt aktuelle Karte und startet dabei das ServerPolling + * + * @param map + */ + public void setCurrentMap(MapInfo map){ + if (isMapLoaded()) closeMap(); + this.currentMap = map; + try { + this.serverManager.reloadMap(); + this.nodeModel.addNode(this.client); + this.mapView.loadMap(map); + } catch (MalformedURLException e) { + System.out.println("Map loading failed." + e.getMessage()); + closeMap(); + } + if (isMapLoaded() && isConnected()) { + this.nodeModel.addNodeModelListener(this.mapView); + this.serverManager.resetTimestamp(); + setMeasurementViewLocal(true); + this.poller.start(); + // initializeScanner(); // Scanner neu initialisieren + this.scannerAllocator.startAllScanner(); + PluginHandler.getInstance().loadMap(); + this.pluginManager.loadMap(); + if (this.currentMap.realheight > 0 && this.currentMap.realwidth > 0) + getMapView().setTitle( + GUIUtils.i18n("map", false) + " - " + this.currentMap.name + " Gr\xF6\xDFe: " + + this.currentMap.realwidth + " X " + this.currentMap.realheight + " cm"); + } + } - /** - * Setzt aktuelle Karte und startet dabei das ServerPolling - * - * @param map - */ - public void setCurrentMap(MapInfo map){ - if (isMapLoaded()){ - closeMap(); - } - this.currentMap = map; - try{ - serverManager.reloadMap(); - nodeModel.addNode(client); - this.mapView.loadMap(map); - } catch (MalformedURLException e){ - System.out.println("Map loading failed." + e.getMessage()); - closeMap(); - } - if (isMapLoaded() && isConnected()){ - nodeModel.a... [truncated message content] |
From: <Jan...@us...> - 2006-10-29 11:35:07
|
Revision: 474 http://svn.sourceforge.net/magicmap/?rev=474&view=rev Author: Jan_fride Date: 2006-10-29 03:34:35 -0800 (Sun, 29 Oct 2006) Log Message: ----------- Removed unnecessary (un)registerXYZListerner from Controller. Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2006-10-26 14:17:56 UTC (rev 473) +++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java 2006-10-29 11:34:35 UTC (rev 474) @@ -57,8 +57,8 @@ import org.apache.log4j.xml.DOMConfigurator; /** - * Kann \xC4nderungen an View und am Modell vornehmen und zieht alle F\xE4den der - * Anwendung. + * Kann \xC4nderungen an View und am Modell vornehmen und zieht alle F\xE4den + * der Anwendung. * * @author thuebner */ @@ -169,7 +169,7 @@ this.measurementView = new MeasurementView(getMeasurementModel(), nodeModel); // registerMeasurementModelListener(measurementView); setMeasurementViewLocal(true); - registerNodeModelListener(mapView); + nodeModel.addNodeModelListener(mapView); //registerNodeModelListener(outlineView); } @@ -232,46 +232,6 @@ } /** - * Register the node model listener - * - * @param listener - - * the node model listener - */ - public void registerNodeModelListener(NodeModelListener listener){ - nodeModel.addNodeModelListener(listener); - } - - /** - * Unregister the node model listener - * - * @param listener - - * the node model listener - */ - public void unregisterNodeModelListener(NodeModelListener listener){ - nodeModel.removeNodeModelListener(listener); - } - - /** - * Register the measurement model listener - * - * @param listener - * the measurement model listener - */ - public void registerMeasurementModelListener(MeasurementModelListener listener){ - measurementModel.addMeasurementModelListener(listener); - } - - /** - * Unregister the measurement model listener - * - * @param listener - - * the measurement model listener - */ - public void unregisterMeasurementModelListener(MeasurementModelListener listener){ - measurementModel.removeMeasurementModelListener(listener); - } - - /** * Baut das MeasurementModelOther neu auf. * * @param ap - @@ -352,7 +312,7 @@ closeMap(); } if (isMapLoaded() && isConnected()){ - registerNodeModelListener(mapView); + nodeModel.addNodeModelListener(mapView); serverManager.resetTimestamp(); setMeasurementViewLocal(true); poller.start(); @@ -404,7 +364,7 @@ serverManager.closeMap(); poller.stop(); nodeModel.clear(); - unregisterNodeModelListener(mapView); + nodeModel.removeNodeModelListener(mapView); // nodeModel.addNode(client); } Modified: trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java 2006-10-26 14:17:56 UTC (rev 473) +++ trunk/magicmapclient/src/net/sf/magicmap/client/controller/IController.java 2006-10-29 11:34:35 UTC (rev 474) @@ -62,38 +62,6 @@ INodeModel getNodeModel(); /** - * Register the node model listener - * - * @param listener - - * the node model listener - */ - void registerNodeModelListener(NodeModelListener listener); - - /** - * Unregister the node model listener - * - * @param listener - - * the node model listener - */ - void unregisterNodeModelListener(NodeModelListener listener); - - /** - * Register the measurement model listener - * - * @param listener - * the measurement model listener - */ - void registerMeasurementModelListener(MeasurementModelListener listener); - - /** - * Unregister the measurement model listener - * - * @param listener - - * the measurement model listener - */ - void unregisterMeasurementModelListener(MeasurementModelListener listener); - - /** * Baut das MeasurementModelOther neu auf. * * @param ap - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Florian L. <fle...@us...> - 2006-03-29 14:52:56
|
Update of /cvsroot/magicmap/magicmapclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21261 Modified Files: start.sh start.bat Added Files: start_nightly.sh start_nightly.bat Log Message: updated startscripts --- NEW FILE: start_nightly.bat --- java -cp "dist\magicmap.jar;lib\activation.jar;lib\axis.jar;lib\colt.jar;lib\forms-1.0.5.jar;lib\looks-1.2.2.jar;lib\mail.jar;lib\magicmapclient.jar;lib\RelativeLayout.jar;lib\xml-apis.jar;lib\commons-collections-3.1.jar;lib\concurrent.jar;lib\looks-1.2.2.jar;lib\xercesImpl.jar;lib\xmlParserAPIs.jar;lib\wsdl4j.jar;lib\saaj.jar;lib\jaxrpc.jar;lib\commons-logging.jar;lib\commons-discovery.jar;lib\axis.jar;lib\log4j-1.2.8.jar;lib\jung-1.5.2.jar;lib\ostermillerutils_1_05_00.jar;lib\OBIDISC4J.jar" net.sf.magicmap.client.gui.MainGUI --nightly nightly --webservicepath /magicmap_nightly/services/ --- NEW FILE: start_nightly.sh --- #!/bin/sh export CLASSPATH="dist/magicmap.jar:lib/activation.jar:lib/axis.jar:lib/colt.jar:lib/forms-1.0.5.jar:lib/looks-1.2.2.jar:lib/mail.jar:lib/magicmapclient.jar:lib/RelativeLayout.jar:lib/xml-apis.jar:lib/commons-collections-3.1.jar:lib/concurrent.jar:lib/looks-1.2.2.jar:lib/xercesImpl.jar:lib/xmlParserAPIs.jar:lib/wsdl4j.jar:lib/saaj.jar:lib/jaxrpc.jar:lib/commons-logging.jar:lib/commons-discovery.jar:lib/axis.jar:lib/log4j-1.2.8.jar:lib/jung-1.5.2.jar:lib/ostermillerutils_1_05_00.jar:lib/OBIDISC4J.jar" java net.sf.magicmap.client.gui.MainGUI --nightly nightly --webservicepath /magicmap_nightly/services/ Index: start.bat =================================================================== RCS file: /cvsroot/magicmap/magicmapclient/start.bat,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** start.bat 28 Sep 2005 10:33:07 -0000 1.4 --- start.bat 29 Mar 2006 14:52:50 -0000 1.5 *************** *** 1,3 **** ! java -cp "dist\magicmap.jar;lib\activation.jar;lib\axis.jar;lib\colt.jar;lib\forms-1.0.5.jar;lib\looks-1.2.2.jar;lib\mail.jar;lib\magicmapclient.jar;lib\RelativeLayout.jar;lib\xml-apis.jar;lib\commons-collections-3.1.jar;lib\concurrent.jar;lib\looks-1.2.2.jar;lib\xercesImpl.jar;lib\xmlParserAPIs.jar;lib\wsdl4j.jar;lib\saaj.jar;lib\jaxrpc.jar;lib\commons-logging.jar;lib\commons-discovery.jar;lib\axis.jar;lib\log4j-1.2.8.jar;lib\jung-1.5.2.jar;lib\ostermillerutils_1_05_00.jar" net.sf.magicmap.client.gui.MainGUI --- 1,3 ---- ! java -cp "dist\magicmap.jar;lib\activation.jar;lib\axis.jar;lib\colt.jar;lib\forms-1.0.5.jar;lib\looks-1.2.2.jar;lib\mail.jar;lib\magicmapclient.jar;lib\RelativeLayout.jar;lib\xml-apis.jar;lib\commons-collections-3.1.jar;lib\concurrent.jar;lib\looks-1.2.2.jar;lib\xercesImpl.jar;lib\xmlParserAPIs.jar;lib\wsdl4j.jar;lib\saaj.jar;lib\jaxrpc.jar;lib\commons-logging.jar;lib\commons-discovery.jar;lib\axis.jar;lib\log4j-1.2.8.jar;lib\jung-1.5.2.jar;lib\ostermillerutils_1_05_00.jar;lib\OBIDISC4J.jar" net.sf.magicmap.client.gui.MainGUI Index: start.sh =================================================================== RCS file: /cvsroot/magicmap/magicmapclient/start.sh,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** start.sh 28 Sep 2005 10:33:07 -0000 1.4 --- start.sh 29 Mar 2006 14:52:50 -0000 1.5 *************** *** 1,4 **** #!/bin/sh ! export CLASSPATH="dist/magicmap.jar:lib/activation.jar:lib/axis.jar:lib/colt.jar:lib/forms-1.0.5.jar:lib/looks-1.2.2.jar:lib/mail.jar:lib/magicmapclient.jar:lib/RelativeLayout.jar:lib/xml-apis.jar:lib/commons-collections-3.1.jar:lib/concurrent.jar:lib/looks-1.2.2.jar:lib/xercesImpl.jar:lib/xmlParserAPIs.jar:lib/wsdl4j.jar:lib/saaj.jar:lib/jaxrpc.jar:lib/commons-logging.jar:lib/commons-discovery.jar:lib/axis.jar:lib/log4j-1.2.8.jar:lib/jung-1.5.2.jar:lib\ostermillerutils_1_05_00.jar" java net.sf.magicmap.client.gui.MainGUI --- 1,4 ---- #!/bin/sh ! export CLASSPATH="dist/magicmap.jar:lib/activation.jar:lib/axis.jar:lib/colt.jar:lib/forms-1.0.5.jar:lib/looks-1.2.2.jar:lib/mail.jar:lib/magicmapclient.jar:lib/RelativeLayout.jar:lib/xml-apis.jar:lib/commons-collections-3.1.jar:lib/concurrent.jar:lib/looks-1.2.2.jar:lib/xercesImpl.jar:lib/xmlParserAPIs.jar:lib/wsdl4j.jar:lib/saaj.jar:lib/jaxrpc.jar:lib/commons-logging.jar:lib/commons-discovery.jar:lib/axis.jar:lib/log4j-1.2.8.jar:lib/jung-1.5.2.jar:lib/ostermillerutils_1_05_00.jar:lib/OBIDISC4J.jar" java net.sf.magicmap.client.gui.MainGUI |
From: Florian L. <fle...@us...> - 2006-03-29 14:49:57
|
Update of /cvsroot/magicmap/magicmapserver/src/net/sf/magicmap/server/facade In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19173/src/net/sf/magicmap/server/facade Modified Files: PositionFacade2.java Log Message: Index: PositionFacade2.java =================================================================== RCS file: /cvsroot/magicmap/magicmapserver/src/net/sf/magicmap/server/facade/PositionFacade2.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PositionFacade2.java 29 Mar 2006 10:05:43 -0000 1.16 --- PositionFacade2.java 29 Mar 2006 14:49:45 -0000 1.17 *************** *** 2,6 **** --- 2,10 ---- package net.sf.magicmap.server.facade; + import java.io.File; + import java.io.FileOutputStream; import java.io.FileWriter; + import java.io.OutputStream; + import java.io.PrintWriter; import java.rmi.RemoteException; import java.util.Collection; *************** *** 93,114 **** pos.setPosY(positionY); PositionCache.getPositionCache().createOrUpdatePosition(map, pos, client.getMac()); ! ! FileWriter fw; String string; int i = 0; try{ ! fw = new FileWriter("referenzpunkt.txt", true); while (i < character.getSimpleScanResults().length){ ! string = "TimeStamp: " + System.currentTimeMillis() + " SessionID: " + sessionId + " PositionName: " ! + positionName + " MapName: " + mapName + " Postition.X " + positionX + " Postition.Y " + positionY ! + " Fixed: " + fixed + " Character.getMacAP " + character.getSimpleScanResults()[i].getMacAP() ! + " Character.LastSeen: " + character.getSimpleScanResults()[i].getLastSeen() + " Character.noise " ! + character.getSimpleScanResults()[i].getNoise() + " Character.SignalLevel: " ! + character.getSimpleScanResults()[i].getSignalLevel() + " \n"; ! fw.write(string, 0, string.length()); ++i; } ! fw.flush(); ! fw.close(); } catch (Exception e){ e.printStackTrace(); --- 97,123 ---- pos.setPosY(positionY); PositionCache.getPositionCache().createOrUpdatePosition(map, pos, client.getMac()); ! String string; int i = 0; try{ ! FileOutputStream fs = new FileOutputStream(new File("referenzpunkt.txt"), true); ! PrintWriter pw = new PrintWriter(fs,true); while (i < character.getSimpleScanResults().length){ ! string = "TimeStamp: " + System.currentTimeMillis() ! + " SessionID: " + sessionId ! + " PositionName: " + positionName ! + " MapName: " + mapName ! + " Postition.X " + positionX ! + " Postition.Y " + positionY ! + " Fixed: " + fixed ! + " Character.getMacAP " + character.getSimpleScanResults()[i].getMacAP() ! + " Character.LastSeen: " + character.getSimpleScanResults()[i].getLastSeen() ! + " Character.noise " + character.getSimpleScanResults()[i].getNoise() ! + " Character.SignalLevel: " + character.getSimpleScanResults()[i].getSignalLevel(); ! pw.println(string); ++i; } ! pw.close(); ! fs.close(); } catch (Exception e){ e.printStackTrace(); *************** *** 241,244 **** --- 250,254 ---- SignalCharacterDTO character, String clientMac, boolean fixed) throws SessionException, MapException{ this.logger.info("createOrUpdateClientPosition()"); + PersistenceManager pm = null; try{ *************** *** 296,316 **** PositionCache.getPositionCache().createOrUpdatePosition(map, pos); - FileWriter fw; String string; int i = 0; try{ ! fw = new FileWriter("client.txt", true); while (i < character.getSimpleScanResults().length){ ! string = "TimeStamp: " + System.currentTimeMillis() + " SessionID: " + sessionId + " ClientMAC: " + clientMac ! + " MapName: " + mapName + " Postition.X " + positionX + " Postition.Y " + positionY + " Fixed: " + fixed ! + " Character.MacAP " + character.getSimpleScanResults()[i].getMacAP() + " Character.LastSeen: " ! + character.getSimpleScanResults()[i].getLastSeen() + " Character.noise " ! + character.getSimpleScanResults()[i].getNoise() + " Character.SignalLevel: " ! + character.getSimpleScanResults()[i].getSignalLevel() + " \n"; ! fw.write(string, 0, string.length()); ++i; } ! fw.flush(); ! fw.close(); } catch (Exception e){ e.printStackTrace(); --- 306,331 ---- PositionCache.getPositionCache().createOrUpdatePosition(map, pos); String string; int i = 0; try{ ! FileOutputStream fs = new FileOutputStream(new File("client.txt"), true); ! PrintWriter pw = new PrintWriter(fs,true); while (i < character.getSimpleScanResults().length){ ! string = "TimeStamp: " + System.currentTimeMillis() ! + " SessionID: " + sessionId ! + " ClientMAC: " + clientMac ! + " MapName: " + mapName ! + " Postition.X " + positionX ! + " Postition.Y " + positionY ! + " Fixed: " + fixed ! + " Character.getMacAP " + character.getSimpleScanResults()[i].getMacAP() ! + " Character.LastSeen: " + character.getSimpleScanResults()[i].getLastSeen() ! + " Character.noise " + character.getSimpleScanResults()[i].getNoise() ! + " Character.SignalLevel: " + character.getSimpleScanResults()[i].getSignalLevel(); ! pw.println(string); ++i; } ! pw.close(); ! fs.close(); } catch (Exception e){ e.printStackTrace(); *************** *** 501,513 **** pm.currentTransaction().begin(); checkSession(sessionId, pm); ! AccessPoint ap = findOrCreateAccessPoint(accessPointMac, pm); ap.setHidden(hidden); ! Map map = checkMap(mapName, pm); PositionDTO pos = PositionCache.getPositionCache().getPositionForClientOnMap(map, accessPointMac); if (pos != null && pos.getAccessPoint() != null){ ! pos.getAccessPoint().setHidden(hidden); ! PositionCache.getPositionCache().createOrUpdatePosition(map, pos); ! } else{ pos = new PositionDTO(); if (ap != null){ --- 516,528 ---- pm.currentTransaction().begin(); checkSession(sessionId, pm); ! AccessPoint ap = findOrCreateAccessPoint(accessPointMac,pm); ap.setHidden(hidden); ! Map map = checkMap(mapName, pm); PositionDTO pos = PositionCache.getPositionCache().getPositionForClientOnMap(map, accessPointMac); if (pos != null && pos.getAccessPoint() != null){ ! pos.getAccessPoint().setHidden(hidden); ! PositionCache.getPositionCache().createOrUpdatePosition(map, pos); ! }else { pos = new PositionDTO(); if (ap != null){ *************** *** 524,528 **** PositionCache.getPositionCache().createOrUpdatePosition(map, pos); } ! pm.currentTransaction().commit(); } catch (Exception e){ --- 539,543 ---- PositionCache.getPositionCache().createOrUpdatePosition(map, pos); } ! pm.currentTransaction().commit(); } catch (Exception e){ |
From: Johannes Z. <jza...@us...> - 2006-03-29 11:07:31
|
Update of /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9088/src/net/sf/magicmap/client/gui Modified Files: MainGUI.java Log Message: collapse APs and RPs in outline in beginner view Index: MainGUI.java =================================================================== RCS file: /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/gui/MainGUI.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** MainGUI.java 7 Mar 2006 16:11:18 -0000 1.19 --- MainGUI.java 29 Mar 2006 11:07:23 -0000 1.20 *************** *** 412,419 **** --- 412,421 ---- */ mapView.setShowAccessPoints(false); + outlineView.collapseAPs(true); mapView.setShowClients(true); mapView.setShowEdges(false); mapView.setShowEdgesBetweenLocations(false); mapView.setShowLocations(false); + outlineView.collapseRPs(true); mapView.setShowEdgesForSelectedNode(false); *************** *** 436,443 **** --- 438,447 ---- mapView.setShowAccessPoints(true); + outlineView.collapseAPs(false); mapView.setShowClients(true); mapView.setShowEdges(true); mapView.setShowEdgesBetweenLocations(false); mapView.setShowLocations(true); + outlineView.collapseRPs(false); mapView.setShowEdgesForSelectedNode(true); *************** *** 459,466 **** --- 463,472 ---- public void actionPerformed(ActionEvent e) { mapView.setShowAccessPoints(true); + outlineView.collapseAPs(false); mapView.setShowClients(true); mapView.setShowEdges(true); mapView.setShowEdgesBetweenLocations(true); mapView.setShowLocations(true); + outlineView.collapseRPs(false); mapView.setShowEdgesForSelectedNode(false); |
From: Johannes Z. <jza...@us...> - 2006-03-29 11:00:47
|
Update of /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/views In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5207/src/net/sf/magicmap/client/views Modified Files: OutlineView.java Log Message: added functionality to exand or collapse items in outline view Index: OutlineView.java =================================================================== RCS file: /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/views/OutlineView.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** OutlineView.java 2 Mar 2006 21:57:08 -0000 1.11 --- OutlineView.java 29 Mar 2006 11:00:41 -0000 1.12 *************** *** 494,496 **** --- 494,520 ---- } } + + /** + * Collapse or expand APs in Outline + * @param b - true, if APs shall be collapsed + */ + public void collapseAPs(boolean b) { + if (b) { + tree.collapsePath(new TreePath(nodeAccessPoints.getPath())); + } else { + tree.expandPath(new TreePath(nodeAccessPoints.getPath())); + } + } + + /** + * Collapse or expand RPs in Outline + * @param b - true, if RPs shall be collapsed + */ + public void collapseRPs(boolean b) { + if (b) { + tree.collapsePath(new TreePath(nodeLocations.getPath())); + } else { + tree.expandPath(new TreePath(nodeLocations.getPath())); + } + } } |
From: Florian L. <fle...@us...> - 2006-03-29 10:06:19
|
Update of /cvsroot/magicmap/magicmapserver/src/net/sf/magicmap/server/interfaces In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5002/src/net/sf/magicmap/server/interfaces Modified Files: PositionFacadeInterface.java Log Message: Index: PositionFacadeInterface.java =================================================================== RCS file: /cvsroot/magicmap/magicmapserver/src/net/sf/magicmap/server/interfaces/PositionFacadeInterface.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PositionFacadeInterface.java 23 Feb 2006 21:40:35 -0000 1.5 --- PositionFacadeInterface.java 29 Mar 2006 10:06:15 -0000 1.6 *************** *** 104,108 **** * @throws MapException Fehlende Karte */ ! public abstract PositionDTO[] getPositionsForMapSince(long sessionId, String mapName, long timeStamp) throws MapException, SessionException, RemoteException; --- 104,108 ---- * @throws MapException Fehlende Karte */ ! public abstract PositionDTO[] getPositionsForMapSince(long sessionId, String mapName, long timeStamp, boolean timeflag) throws MapException, SessionException, RemoteException; |
From: Florian L. <fle...@us...> - 2006-03-29 10:05:54
|
Update of /cvsroot/magicmap/magicmapserver/src/net/sf/magicmap/server/facade In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4583/src/net/sf/magicmap/server/facade Modified Files: PositionFacade2.java Log Message: Index: PositionFacade2.java =================================================================== RCS file: /cvsroot/magicmap/magicmapserver/src/net/sf/magicmap/server/facade/PositionFacade2.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** PositionFacade2.java 7 Mar 2006 17:24:28 -0000 1.15 --- PositionFacade2.java 29 Mar 2006 10:05:43 -0000 1.16 *************** *** 2,7 **** package net.sf.magicmap.server.facade; - import java.io.FileNotFoundException; - import java.io.FileOutputStream; import java.io.FileWriter; import java.rmi.RemoteException; --- 2,5 ---- *************** *** 27,31 **** import org.apache.log4j.Category; - import org.apache.log4j.FileAppender; public class PositionFacade2 implements PositionFacadeInterface { --- 25,28 ---- *************** *** 96,100 **** pos.setPosY(positionY); PositionCache.getPositionCache().createOrUpdatePosition(map, pos, client.getMac()); ! FileWriter fw; String string; --- 93,97 ---- pos.setPosY(positionY); PositionCache.getPositionCache().createOrUpdatePosition(map, pos, client.getMac()); ! FileWriter fw; String string; *************** *** 103,118 **** fw = new FileWriter("referenzpunkt.txt", true); while (i < character.getSimpleScanResults().length){ ! string = "TimeStamp: " + System.currentTimeMillis() ! + " SessionID: " + sessionId ! + " PositionName: " + positionName ! + " MapName: " + mapName ! + " Postition.X " + positionX ! + " Postition.Y " + positionY ! + " Fixed: " + fixed ! + " Character.getMacAP " + character.getSimpleScanResults()[i].getMacAP() ! + " Character.LastSeen: " + character.getSimpleScanResults()[i].getLastSeen() ! + " Character.noise " + character.getSimpleScanResults()[i].getNoise() ! + " Character.SignalLevel: " + character.getSimpleScanResults()[i].getSignalLevel() ! + " \n"; fw.write(string, 0, string.length()); ++i; --- 100,109 ---- fw = new FileWriter("referenzpunkt.txt", true); while (i < character.getSimpleScanResults().length){ ! string = "TimeStamp: " + System.currentTimeMillis() + " SessionID: " + sessionId + " PositionName: " ! + positionName + " MapName: " + mapName + " Postition.X " + positionX + " Postition.Y " + positionY ! + " Fixed: " + fixed + " Character.getMacAP " + character.getSimpleScanResults()[i].getMacAP() ! + " Character.LastSeen: " + character.getSimpleScanResults()[i].getLastSeen() + " Character.noise " ! + character.getSimpleScanResults()[i].getNoise() + " Character.SignalLevel: " ! + character.getSimpleScanResults()[i].getSignalLevel() + " \n"; fw.write(string, 0, string.length()); ++i; *************** *** 250,254 **** SignalCharacterDTO character, String clientMac, boolean fixed) throws SessionException, MapException{ this.logger.info("createOrUpdateClientPosition()"); - PersistenceManager pm = null; try{ --- 241,244 ---- *************** *** 312,327 **** fw = new FileWriter("client.txt", true); while (i < character.getSimpleScanResults().length){ ! string = "TimeStamp: " + System.currentTimeMillis() ! + " SessionID: " + sessionId ! + " ClientMAC: " + clientMac ! + " MapName: " + mapName ! + " Postition.X " + positionX ! + " Postition.Y " + positionY ! + " Fixed: " + fixed ! + " Character.MacAP " + character.getSimpleScanResults()[i].getMacAP() ! + " Character.LastSeen: " + character.getSimpleScanResults()[i].getLastSeen() ! + " Character.noise " + character.getSimpleScanResults()[i].getNoise() ! + " Character.SignalLevel: " + character.getSimpleScanResults()[i].getSignalLevel() ! + " \n"; fw.write(string, 0, string.length()); ++i; --- 302,311 ---- fw = new FileWriter("client.txt", true); while (i < character.getSimpleScanResults().length){ ! string = "TimeStamp: " + System.currentTimeMillis() + " SessionID: " + sessionId + " ClientMAC: " + clientMac ! + " MapName: " + mapName + " Postition.X " + positionX + " Postition.Y " + positionY + " Fixed: " + fixed ! + " Character.MacAP " + character.getSimpleScanResults()[i].getMacAP() + " Character.LastSeen: " ! + character.getSimpleScanResults()[i].getLastSeen() + " Character.noise " ! + character.getSimpleScanResults()[i].getNoise() + " Character.SignalLevel: " ! + character.getSimpleScanResults()[i].getSignalLevel() + " \n"; fw.write(string, 0, string.length()); ++i; *************** *** 444,449 **** * @see net.sf.magicmap.server.facade.interfaces.PositionFacadeInterface#getPositionsForMapSince(long, java.lang.String, long) */ ! public PositionDTO[] getPositionsForMapSince(long sessionId, String mapName, long timeStamp) throws MapException, ! SessionException{ this.logger.info("getPositionsForMapSince() " + timeStamp); PositionDTO[] result = null; --- 428,433 ---- * @see net.sf.magicmap.server.facade.interfaces.PositionFacadeInterface#getPositionsForMapSince(long, java.lang.String, long) */ ! public PositionDTO[] getPositionsForMapSince(long sessionId, String mapName, long timeStamp, boolean timeflag) ! throws MapException, SessionException{ this.logger.info("getPositionsForMapSince() " + timeStamp); PositionDTO[] result = null; *************** *** 454,458 **** checkSession(sessionId, pm); Map map = checkMap(mapName, pm); ! result = PositionCache.getPositionCache().getPositionsForMapSince(map, timeStamp); if (pm.currentTransaction().isActive()){ pm.currentTransaction().commit(); --- 438,442 ---- checkSession(sessionId, pm); Map map = checkMap(mapName, pm); ! result = PositionCache.getPositionCache().getPositionsForMapSince(map, timeStamp, timeflag); if (pm.currentTransaction().isActive()){ pm.currentTransaction().commit(); *************** *** 517,529 **** pm.currentTransaction().begin(); checkSession(sessionId, pm); ! AccessPoint ap = findOrCreateAccessPoint(accessPointMac,pm); ap.setHidden(hidden); ! Map map = checkMap(mapName, pm); PositionDTO pos = PositionCache.getPositionCache().getPositionForClientOnMap(map, accessPointMac); if (pos != null && pos.getAccessPoint() != null){ ! pos.getAccessPoint().setHidden(hidden); ! PositionCache.getPositionCache().createOrUpdatePosition(map, pos); ! }else { pos = new PositionDTO(); if (ap != null){ --- 501,513 ---- pm.currentTransaction().begin(); checkSession(sessionId, pm); ! AccessPoint ap = findOrCreateAccessPoint(accessPointMac, pm); ap.setHidden(hidden); ! Map map = checkMap(mapName, pm); PositionDTO pos = PositionCache.getPositionCache().getPositionForClientOnMap(map, accessPointMac); if (pos != null && pos.getAccessPoint() != null){ ! pos.getAccessPoint().setHidden(hidden); ! PositionCache.getPositionCache().createOrUpdatePosition(map, pos); ! } else{ pos = new PositionDTO(); if (ap != null){ *************** *** 540,544 **** PositionCache.getPositionCache().createOrUpdatePosition(map, pos); } ! pm.currentTransaction().commit(); } catch (Exception e){ --- 524,528 ---- PositionCache.getPositionCache().createOrUpdatePosition(map, pos); } ! pm.currentTransaction().commit(); } catch (Exception e){ |
From: Florian L. <fle...@us...> - 2006-03-29 09:54:49
|
Update of /cvsroot/magicmap/magicmapserver/src/net/sf/magicmap/server/facade In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30086/src/net/sf/magicmap/server/facade Modified Files: PositionFacade.java Log Message: Index: PositionFacade.java =================================================================== RCS file: /cvsroot/magicmap/magicmapserver/src/net/sf/magicmap/server/facade/PositionFacade.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PositionFacade.java 6 Mar 2006 10:59:03 -0000 1.14 --- PositionFacade.java 29 Mar 2006 09:54:25 -0000 1.15 *************** *** 605,609 **** * @see net.sf.magicmap.server.facade.interfaces.PositionFacadeInterface#getPositionsForMapSince(long, java.lang.String, long) */ ! public PositionDTO[] getPositionsForMapSince(long sessionId, String mapName, long timeStamp) throws MapException, SessionException{ this.logger.info("getPositionsForMapSince() " + timeStamp); --- 605,609 ---- * @see net.sf.magicmap.server.facade.interfaces.PositionFacadeInterface#getPositionsForMapSince(long, java.lang.String, long) */ ! public PositionDTO[] getPositionsForMapSince(long sessionId, String mapName, long timeStamp, boolean timeflag) throws MapException, SessionException{ this.logger.info("getPositionsForMapSince() " + timeStamp); *************** *** 618,622 **** Map map = checkMap(mapName, pm); Extent e = pm.getExtent(Position.class, true); ! String filter = "map == myMap && lastModified > myLastModified"; if (timeStamp == -1){ filter += " && deleted == 0"; --- 618,627 ---- Map map = checkMap(mapName, pm); Extent e = pm.getExtent(Position.class, true); ! String filter; ! if (timeflag) ! filter = "map == myMap && (lastModified > myLastModified || fixed == 1) && deleted == 0"; ! else ! filter = "map == myMap && lastModified > myLastModified"; ! if (timeStamp == -1){ filter += " && deleted == 0"; *************** *** 626,629 **** --- 631,638 ---- query.declareImports("import net.sf.magicmap.db.Map; import java.lang.Long;"); Collection results = null; + if (timeflag) + { + timeStamp = System.currentTimeMillis() - timeStamp; + } results = (Collection) query.execute(map, new Long(timeStamp)); if (results != null){ *************** *** 708,715 **** } this.logger.info("getPositionsForMapSince() - done "); ! PositionDTO[] positions = (PositionDTO[])result.toArray(new PositionDTO[0]); ! if (positions == null) ! positions = new PositionDTO[0]; ! return positions; } --- 717,721 ---- } this.logger.info("getPositionsForMapSince() - done "); ! return (PositionDTO[]) result.toArray(new PositionDTO[0]); } |
From: Florian L. <fle...@us...> - 2006-03-29 09:48:28
|
Update of /cvsroot/magicmap/magicmapserver/src/net/sf/magicmap/server/cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25903/src/net/sf/magicmap/server/cache Modified Files: PositionCache.java Log Message: Index: PositionCache.java =================================================================== RCS file: /cvsroot/magicmap/magicmapserver/src/net/sf/magicmap/server/cache/PositionCache.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PositionCache.java 6 Mar 2006 10:59:03 -0000 1.12 --- PositionCache.java 29 Mar 2006 09:48:03 -0000 1.13 *************** *** 35,43 **** * */ ! private static final long serialVersionUID = 1L; // Sigleton Hashtable private static final PositionCache single_positionCache = new PositionCache(); ! public static PositionCache getPositionCache() { return single_positionCache; } --- 35,43 ---- * */ ! private static final long serialVersionUID = 1L; // Sigleton Hashtable private static final PositionCache single_positionCache = new PositionCache(); ! public static PositionCache getPositionCache(){ return single_positionCache; } *************** *** 47,51 **** } ! private Map checkMap(String mapName, PersistenceManager pm) throws MapException { Map result = null; Collection results; --- 47,51 ---- } ! private Map checkMap(String mapName, PersistenceManager pm) throws MapException{ Map result = null; Collection results; *************** *** 54,60 **** query.declareParameters("java.lang.String myName"); results = (Collection) query.execute(mapName); ! if (results != null && !results.isEmpty()) { result = (Map) results.iterator().next(); ! } else { pm.currentTransaction().rollback(); throw new MapException("Karte mit dem namen:" + mapName + " existiert nicht"); --- 54,60 ---- query.declareParameters("java.lang.String myName"); results = (Collection) query.execute(mapName); ! if (results != null && !results.isEmpty()){ result = (Map) results.iterator().next(); ! } else{ pm.currentTransaction().rollback(); throw new MapException("Karte mit dem namen:" + mapName + " existiert nicht"); *************** *** 63,67 **** } ! private Position checkPosition(String positionName, Map map, PersistenceManager pm) { Position result = null; Collection results; --- 63,67 ---- } ! private Position checkPosition(String positionName, Map map, PersistenceManager pm){ Position result = null; Collection results; *************** *** 71,75 **** query.declareImports("import java.lang.String; import net.sf.magicmap.db.Map;"); results = (Collection) query.execute(positionName, map); ! if (results != null && !results.isEmpty()) { result = (Position) results.iterator().next(); } --- 71,75 ---- query.declareImports("import java.lang.String; import net.sf.magicmap.db.Map;"); results = (Collection) query.execute(positionName, map); ! if (results != null && !results.isEmpty()){ result = (Position) results.iterator().next(); } *************** *** 78,83 **** } ! private Client checkClient(String mac, PersistenceManager pm) throws MapException { ! if (mac == null || "".equals(mac)) { pm.currentTransaction().rollback(); throw new MapException("Client mac darf nicht leer sein"); --- 78,83 ---- } ! private Client checkClient(String mac, PersistenceManager pm) throws MapException{ ! if (mac == null || "".equals(mac)){ pm.currentTransaction().rollback(); throw new MapException("Client mac darf nicht leer sein"); *************** *** 89,95 **** query.declareParameters("java.lang.String myMac"); results = (Collection) query.execute(mac); ! if (results != null && !results.isEmpty()) { result = (Client) results.iterator().next(); ! } else { pm.currentTransaction().rollback(); throw new MapException("Client mit der mac-adresse:" + mac + " existiert nicht"); --- 89,95 ---- query.declareParameters("java.lang.String myMac"); results = (Collection) query.execute(mac); ! if (results != null && !results.isEmpty()){ result = (Client) results.iterator().next(); ! } else{ pm.currentTransaction().rollback(); throw new MapException("Client mit der mac-adresse:" + mac + " existiert nicht"); *************** *** 99,104 **** } ! private AccessPoint findOrCreateAccessPoint(String macAP, PersistenceManager pm) throws MapException { ! try { AccessPoint result = null; Collection results; --- 99,104 ---- } ! private AccessPoint findOrCreateAccessPoint(String macAP, PersistenceManager pm) throws MapException{ ! try{ AccessPoint result = null; Collection results; *************** *** 108,119 **** query.declareImports("import java.lang.String;"); results = (Collection) query.execute(macAP); ! if (results != null && !results.isEmpty()) { result = (AccessPoint) results.iterator().next(); ! } else { result = new AccessPoint(macAP); pm.makePersistent(result); } return result; ! } catch (Exception e) { pm.currentTransaction().rollback(); throw new MapException("", e); --- 108,119 ---- query.declareImports("import java.lang.String;"); results = (Collection) query.execute(macAP); ! if (results != null && !results.isEmpty()){ result = (AccessPoint) results.iterator().next(); ! } else{ result = new AccessPoint(macAP); pm.makePersistent(result); } return result; ! } catch (Exception e){ pm.currentTransaction().rollback(); throw new MapException("", e); *************** *** 122,131 **** private void setNewSignalCharacter(PositionDTO dto, PersistenceManager pm, Client client, Position pos) ! throws MapException { // alle Scanresults dieser Position löschen pm.deletePersistentAll(pos.getScanResults()); SimpleScanResultDTO[] dtos = dto.getCharacter().getSimpleScanResults(); ! if (dtos != null) { ! for (int i = 0; i < dtos.length; i++) { AccessPoint ap = findOrCreateAccessPoint(dtos[i].getMacAP(), pm); //@TODO think about? ap.setSsid(dtos[i].getSsid()); --- 122,131 ---- private void setNewSignalCharacter(PositionDTO dto, PersistenceManager pm, Client client, Position pos) ! throws MapException{ // alle Scanresults dieser Position löschen pm.deletePersistentAll(pos.getScanResults()); SimpleScanResultDTO[] dtos = dto.getCharacter().getSimpleScanResults(); ! if (dtos != null){ ! for (int i = 0; i < dtos.length; i++){ AccessPoint ap = findOrCreateAccessPoint(dtos[i].getMacAP(), pm); //@TODO think about? ap.setSsid(dtos[i].getSsid()); *************** *** 138,146 **** } ! private void writePositionToDB(String mapName, PositionDTO position) { System.out.println("Finalize:writePositionToDB()"); PersistenceManager pm = null; Transaction tx = null; ! try { pm = JDOUtil.pmfactory.getPersistenceManager(); tx = pm.currentTransaction(); --- 138,146 ---- } ! private void writePositionToDB(String mapName, PositionDTO position){ System.out.println("Finalize:writePositionToDB()"); PersistenceManager pm = null; Transaction tx = null; ! try{ pm = JDOUtil.pmfactory.getPersistenceManager(); tx = pm.currentTransaction(); *************** *** 148,152 **** Map map = checkMap(mapName, pm); Position pos = checkPosition(position.getName(), map, pm); ! if (pos == null) { pos = new Position(map, position.getPosX(), position.getPosY(), position.getName()); pm.makePersistent(pos); --- 148,152 ---- Map map = checkMap(mapName, pm); Position pos = checkPosition(position.getName(), map, pm); ! if (pos == null){ pos = new Position(map, position.getPosX(), position.getPosY(), position.getName()); pm.makePersistent(pos); *************** *** 157,168 **** pos.setFixed(position.isFixed()); ! if (position.getClient() != null) { Client client = checkClient(position.getClient().getMac(), pm); ! if (client != null) { pos.setClient(client); setNewSignalCharacter(position, pm, client, pos); } } ! if (position.getAccessPoint() != null) { AccessPoint ap = findOrCreateAccessPoint(position.getAccessPoint().getMac(), pm); pos.setAccessPoint(ap); --- 157,168 ---- pos.setFixed(position.isFixed()); ! if (position.getClient() != null){ Client client = checkClient(position.getClient().getMac(), pm); ! if (client != null){ pos.setClient(client); setNewSignalCharacter(position, pm, client, pos); } } ! if (position.getAccessPoint() != null){ AccessPoint ap = findOrCreateAccessPoint(position.getAccessPoint().getMac(), pm); pos.setAccessPoint(ap); *************** *** 174,181 **** JDOUtil.commit(tx); ! } catch (Exception e) { e.printStackTrace(); ! } finally { ! if (tx.isActive()) { tx.rollback(); } --- 174,181 ---- JDOUtil.commit(tx); ! } catch (Exception e){ e.printStackTrace(); ! } finally{ ! if (tx.isActive()){ tx.rollback(); } *************** *** 185,192 **** } ! private void getDataFromDB() { PersistenceManager pm = null; Transaction tx = null; ! try { pm = JDOUtil.pmfactory.getPersistenceManager(); tx = pm.currentTransaction(); --- 185,192 ---- } ! private void getDataFromDB(){ PersistenceManager pm = null; Transaction tx = null; ! try{ pm = JDOUtil.pmfactory.getPersistenceManager(); tx = pm.currentTransaction(); *************** *** 195,205 **** Query query = pm.newQuery(e); Collection mapResults = (Collection) query.execute(); ! if (mapResults != null) { Iterator it1 = mapResults.iterator(); ! while (it1.hasNext()) { Map map = (Map) it1.next(); addMapHashtable(map); // Positionsdaten für map aus der Datenbank holen ! try { Extent extent = pm.getExtent(Position.class, true); Query posQuery = pm.newQuery(extent, "map == myMap && deleted == 0"); --- 195,205 ---- Query query = pm.newQuery(e); Collection mapResults = (Collection) query.execute(); ! if (mapResults != null){ Iterator it1 = mapResults.iterator(); ! while (it1.hasNext()){ Map map = (Map) it1.next(); addMapHashtable(map); // Positionsdaten für map aus der Datenbank holen ! try{ Extent extent = pm.getExtent(Position.class, true); Query posQuery = pm.newQuery(extent, "map == myMap && deleted == 0"); *************** *** 207,217 **** posQuery.declareImports("import net.sf.magicmap.db.Map"); Collection PositionResults = (Collection) posQuery.execute(map); ! if (PositionResults != null) { Iterator it2 = PositionResults.iterator(); ! while (it2.hasNext()) { Position pos = (Position) it2.next(); PositionDTO dto = new PositionDTO(); AccessPoint ap = pos.getAccessPoint(); ! if (ap != null) { AccessPointDTO apDTO = new AccessPointDTO(); apDTO.setMac(ap.getMac()); --- 207,217 ---- posQuery.declareImports("import net.sf.magicmap.db.Map"); Collection PositionResults = (Collection) posQuery.execute(map); ! if (PositionResults != null){ Iterator it2 = PositionResults.iterator(); ! while (it2.hasNext()){ Position pos = (Position) it2.next(); PositionDTO dto = new PositionDTO(); AccessPoint ap = pos.getAccessPoint(); ! if (ap != null){ AccessPointDTO apDTO = new AccessPointDTO(); apDTO.setMac(ap.getMac()); *************** *** 221,225 **** } Client client = pos.getClient(); ! if (client != null) { ClientDTO clientDTO = new ClientDTO(); clientDTO.setMac(client.getMac()); --- 221,225 ---- } Client client = pos.getClient(); ! if (client != null){ ClientDTO clientDTO = new ClientDTO(); clientDTO.setMac(client.getMac()); *************** *** 243,253 **** // Scanresults holen Collection scanResults = pos.getScanResults(); ! if (scanResults != null) { Iterator scanIt = scanResults.iterator(); ! while (scanIt.hasNext()) { ScanResult sr = (ScanResult) scanIt.next(); Date lastSeen = null; ! if (sr.getScantime() != null) { lastSeen = new Date(sr.getScantime().getTime()); } --- 243,253 ---- // Scanresults holen Collection scanResults = pos.getScanResults(); ! if (scanResults != null){ Iterator scanIt = scanResults.iterator(); ! while (scanIt.hasNext()){ ScanResult sr = (ScanResult) scanIt.next(); Date lastSeen = null; ! if (sr.getScantime() != null){ lastSeen = new Date(sr.getScantime().getTime()); } *************** *** 263,269 **** ArrayList list; ! if (dto.getCharacter().getSimpleScanResults() == null) { list = new ArrayList(); ! } else { list = new ArrayList(Arrays.asList(dto.getCharacter().getSimpleScanResults())); } --- 263,269 ---- ArrayList list; ! if (dto.getCharacter().getSimpleScanResults() == null){ list = new ArrayList(); ! } else{ list = new ArrayList(Arrays.asList(dto.getCharacter().getSimpleScanResults())); } *************** *** 277,281 **** } } ! } catch (Exception ex) { ex.printStackTrace(); } --- 277,281 ---- } } ! } catch (Exception ex){ ex.printStackTrace(); } *************** *** 283,313 **** } JDOUtil.commit(tx); ! } finally { JDOUtil.closePM(pm); } } ! private String getMapString(Map map) { return map.getName() + "#" + map.getImageURL() + "#" + map.getImageHeight().toString() + "#" + map.getImageWidth().toString(); } ! private void addMapHashtable(Map map) { this.put(getMapString(map), new PositionCacheEntry()); } ! private boolean existsMapHashtable(Map map) { return this.containsKey(getMapString(map)); } ! private PositionCacheEntry getMapHashtable(Map map) { return this.get(getMapString(map)); } ! public void createOrUpdatePosition(Map map, PositionDTO position) { System.out.println("enter createOrUpdatePosition()"); if (!existsMapHashtable(map)) addMapHashtable(map); ! if (getMapHashtable(map).existsPosition(position.getName())) { getMapHashtable(map).deletePosition(position.getName()); } --- 283,313 ---- } JDOUtil.commit(tx); ! } finally{ JDOUtil.closePM(pm); } } ! private String getMapString(Map map){ return map.getName() + "#" + map.getImageURL() + "#" + map.getImageHeight().toString() + "#" + map.getImageWidth().toString(); } ! private void addMapHashtable(Map map){ this.put(getMapString(map), new PositionCacheEntry()); } ! private boolean existsMapHashtable(Map map){ return this.containsKey(getMapString(map)); } ! private PositionCacheEntry getMapHashtable(Map map){ return this.get(getMapString(map)); } ! public void createOrUpdatePosition(Map map, PositionDTO position){ System.out.println("enter createOrUpdatePosition()"); if (!existsMapHashtable(map)) addMapHashtable(map); ! if (getMapHashtable(map).existsPosition(position.getName())){ getMapHashtable(map).deletePosition(position.getName()); } *************** *** 315,324 **** } ! public PositionDTO[] getPositionsForMapSince(Map map, Long time) { if (!existsMapHashtable(map)) return new PositionDTO[0]; ! return getMapHashtable(map).getPositionsSince(time); } ! public PositionDTO getPositionForClientOnMap(Map map, String name) { if (!existsMapHashtable(map)) return null; return getMapHashtable(map).getPosition(name); --- 315,324 ---- } ! public PositionDTO[] getPositionsForMapSince(Map map, Long time, boolean timeflag){ if (!existsMapHashtable(map)) return new PositionDTO[0]; ! return getMapHashtable(map).getPositionsSince(time, timeflag); } ! public PositionDTO getPositionForClientOnMap(Map map, String name){ if (!existsMapHashtable(map)) return null; return getMapHashtable(map).getPosition(name); *************** *** 326,356 **** } ! public void movePosition(Map map, Long id, int x, int y, boolean fixed) { ! if (existsMapHashtable(map)) { getMapHashtable(map).movePosition(id, x, y, fixed); } } ! public void removePosition(Map map, Long id) { ! if (existsMapHashtable(map)) { getMapHashtable(map).removePosition(id); } } ! public void removePosition(Map map, String name) { ! if (existsMapHashtable(map)) { getMapHashtable(map).removePosition(name); } } ! public void writeCacheDataToDB() { System.out.println("Begin Schreiben in Datenbank"); ! for (String currentMap : this.keySet()) { PositionCacheEntry posCache = this.get(currentMap); currentMap = currentMap.substring(0, currentMap.indexOf('#')); ! if (posCache != null) { ! PositionDTO[] positions = posCache.getPositionsSince(Long.valueOf(-1)); ! for (int i = 0; i < positions.length; ++i) { writePositionToDB(currentMap, positions[i]); } --- 326,356 ---- } ! public void movePosition(Map map, Long id, int x, int y, boolean fixed){ ! if (existsMapHashtable(map)){ getMapHashtable(map).movePosition(id, x, y, fixed); } } ! public void removePosition(Map map, Long id){ ! if (existsMapHashtable(map)){ getMapHashtable(map).removePosition(id); } } ! public void removePosition(Map map, String name){ ! if (existsMapHashtable(map)){ getMapHashtable(map).removePosition(name); } } ! public void writeCacheDataToDB(){ System.out.println("Begin Schreiben in Datenbank"); ! for (String currentMap : this.keySet()){ PositionCacheEntry posCache = this.get(currentMap); currentMap = currentMap.substring(0, currentMap.indexOf('#')); ! if (posCache != null){ ! PositionDTO[] positions = posCache.getPositionsSince((long)-1,false); ! for (int i = 0; i < positions.length; ++i){ writePositionToDB(currentMap, positions[i]); } *************** *** 397,405 **** } ! protected void removePosition(Long id) { PositionDTO pos = getPosition(id); pos.setDeleted(true); Long time = System.currentTimeMillis(); ! while (timeMap.containsKey(time)) { ++time; } --- 397,405 ---- } ! protected void removePosition(Long id){ PositionDTO pos = getPosition(id); pos.setDeleted(true); Long time = System.currentTimeMillis(); ! while (timeMap.containsKey(time)){ ++time; } *************** *** 408,417 **** } ! protected void removePosition(String name) { PositionDTO pos = getPosition(name); pos.setDeleted(true); Long time = System.currentTimeMillis(); ! while (timeMap.containsKey(time)) { ++time; } --- 408,417 ---- } ! protected void removePosition(String name){ PositionDTO pos = getPosition(name); pos.setDeleted(true); Long time = System.currentTimeMillis(); ! while (timeMap.containsKey(time)){ ++time; } *************** *** 420,426 **** } ! protected void addPosition(PositionDTO position) { Long id = new Long(1); ! while (idHash.containsKey(id)) { ++id; } --- 420,426 ---- } ! protected void addPosition(PositionDTO position){ Long id = new Long(1); ! while (idHash.containsKey(id)){ ++id; } *************** *** 428,432 **** Long time = System.currentTimeMillis(); ! while (timeMap.containsKey(time)) { ++time; } --- 428,432 ---- Long time = System.currentTimeMillis(); ! while (timeMap.containsKey(time)){ ++time; } *************** *** 438,443 **** } ! protected void movePosition(Long id, int x, int y, boolean fixed) { ! if (!idHash.containsKey(id)) { return; } --- 438,443 ---- } ! protected void movePosition(Long id, int x, int y, boolean fixed){ ! if (!idHash.containsKey(id)){ return; } *************** *** 447,451 **** pos.setFixed(fixed); Long time = System.currentTimeMillis(); ! while (timeMap.containsKey(time)) { ++time; } --- 447,451 ---- pos.setFixed(fixed); Long time = System.currentTimeMillis(); ! while (timeMap.containsKey(time)){ ++time; } *************** *** 454,475 **** } ! private void updateTime(Long oldTime, Long time) { timeMap.put(time, timeMap.get(oldTime)); timeMap.remove(oldTime); } ! protected boolean existsPosition(String name) { return positionHash.containsKey(name); } ! protected PositionDTO getPosition(String name) { return positionHash.get(name); } ! protected PositionDTO getPosition(Long id) { return positionHash.get(idHash.get(id)); } ! protected void deletePosition(String name) { timeMap.remove(positionHash.get(name).getLastModified()); idHash.remove(positionHash.get(name).getId()); --- 454,475 ---- } ! private void updateTime(Long oldTime, Long time){ timeMap.put(time, timeMap.get(oldTime)); timeMap.remove(oldTime); } ! protected boolean existsPosition(String name){ return positionHash.containsKey(name); } ! protected PositionDTO getPosition(String name){ return positionHash.get(name); } ! protected PositionDTO getPosition(Long id){ return positionHash.get(idHash.get(id)); } ! protected void deletePosition(String name){ timeMap.remove(positionHash.get(name).getLastModified()); idHash.remove(positionHash.get(name).getId()); *************** *** 477,481 **** } ! protected void deletePosition(Long id) { timeMap.remove(idHash.get(id)); positionHash.remove(idHash.get(id)); --- 477,481 ---- } ! protected void deletePosition(Long id){ timeMap.remove(idHash.get(id)); positionHash.remove(idHash.get(id)); *************** *** 483,499 **** } ! protected PositionDTO[] getPositionsSince(Long time) { System.out.println("enter getPositionsSince()"); ! Collection<String> newPositions = timeMap.tailMap(time).values(); ! System.out.println("Daten in timeMap: " + timeMap.toString()); ! System.out.println("Daten in tailMap: " + newPositions.toString()); ! PositionDTO[] positions = new PositionDTO[newPositions.size()]; ! Iterator it = newPositions.iterator(); ! int i = 0; ! while (it.hasNext()) { ! positions[i++] = getPosition((String) it.next()); } - System.out.println("leaving getPositionsSince()"); - return positions; } } --- 483,515 ---- } ! protected PositionDTO[] getPositionsSince(Long time, boolean timeflag){ System.out.println("enter getPositionsSince()"); ! if (timeflag){ ! Collection<String> newPositions = timeMap.tailMap((long) -1).values(); ! ArrayList<PositionDTO> positions = new ArrayList<PositionDTO>(); ! time = System.currentTimeMillis() - time; ! for ( String posname : newPositions) ! { ! PositionDTO pos = getPosition(posname); ! if (pos.isFixed() || pos.getLastModified() > time) ! { ! positions.add(pos); ! } ! } ! System.out.println("leaving getPositionsSince()"); ! return positions.toArray(new PositionDTO[0]); ! } else{ ! Collection<String> newPositions = timeMap.tailMap(time).values(); ! System.out.println("Daten in timeMap: " + timeMap.toString()); ! System.out.println("Daten in tailMap: " + newPositions.toString()); ! PositionDTO[] positions = new PositionDTO[newPositions.size()]; ! Iterator it = newPositions.iterator(); ! int i = 0; ! while (it.hasNext()){ ! positions[i++] = getPosition((String) it.next()); ! } ! System.out.println("leaving getPositionsSince()"); ! return positions; } } } |
From: Johannes Z. <jza...@us...> - 2006-03-29 09:20:07
|
Update of /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/utils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7881/src/net/sf/magicmap/client/utils Modified Files: Settings.java Log Message: set phl as standard Index: Settings.java =================================================================== RCS file: /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/utils/Settings.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Settings.java 7 Mar 2006 20:50:02 -0000 1.9 --- Settings.java 29 Mar 2006 09:19:59 -0000 1.10 *************** *** 40,46 **** public static String NIGHTLY = ""; ! // public static String hostname = "phl.informatik.hu-berlin.de";public static String ! public static String hostname = "192.168.200.218"; ! public static int port = 8080; --- 40,46 ---- public static String NIGHTLY = ""; ! public static String hostname = "phl.informatik.hu-berlin.de"; ! // public static String hostname = "192.168.200.218"; ! public static int port = 80; *************** *** 102,106 **** public static void setup(String[] args){ Getopt g = new Getopt("magicmapclient", args, optionsStr, longopts); ! int c, tmpval; while ( (c=g.getopt()) != -1) { --- 102,106 ---- public static void setup(String[] args){ Getopt g = new Getopt("magicmapclient", args, optionsStr, longopts); ! int c; while ( (c=g.getopt()) != -1) { |
From: Johannes Z. <jza...@us...> - 2006-03-09 11:47:08
|
Update of /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/controller In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13135/src/net/sf/magicmap/client/controller Modified Files: Controller.java Log Message: 3 sec visible Index: Controller.java =================================================================== RCS file: /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Controller.java 9 Mar 2006 11:41:39 -0000 1.19 --- Controller.java 9 Mar 2006 11:47:04 -0000 1.20 *************** *** 809,813 **** for (int i=0; i<rfidTags.size(); i++) { RFIDTag tag = (RFIDTag) rfidTags.get(i); ! if (timestamp - tag.getTimestamp() > 10000) { getNodeModel().removeNode(getNodeModel().findNode(tag.getUrl())); rfidTags.remove(i); --- 809,813 ---- for (int i=0; i<rfidTags.size(); i++) { RFIDTag tag = (RFIDTag) rfidTags.get(i); ! if (timestamp - tag.getTimestamp() > 3000) { getNodeModel().removeNode(getNodeModel().findNode(tag.getUrl())); rfidTags.remove(i); |
From: Johannes Z. <jza...@us...> - 2006-03-09 11:41:42
|
Update of /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/model/node In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10235/src/net/sf/magicmap/client/model/node Modified Files: RFIDAntenna.java Log Message: rfid enhancement (hacked persistence) Index: RFIDAntenna.java =================================================================== RCS file: /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/model/node/RFIDAntenna.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RFIDAntenna.java 7 Mar 2006 16:11:16 -0000 1.2 --- RFIDAntenna.java 9 Mar 2006 11:41:39 -0000 1.3 *************** *** 4,12 **** package net.sf.magicmap.client.model.node; /** * @author Johannes Zapotoczky (joh...@za...) * */ ! public class RFIDAntenna { private String url; --- 4,14 ---- package net.sf.magicmap.client.model.node; + import java.io.Serializable; + /** * @author Johannes Zapotoczky (joh...@za...) * */ ! public class RFIDAntenna implements Serializable { private String url; *************** *** 16,19 **** --- 18,26 ---- private int y; private String map; + + /* + * only for serialization + */ + public RFIDAntenna() {} /** *************** *** 56,58 **** --- 63,81 ---- } + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public void setX(int x) { + this.x = x; + } + + public void setY(int y) { + this.y = y; + } + } |
From: Johannes Z. <jza...@us...> - 2006-03-09 11:41:42
|
Update of /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/controller/rfid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10235/src/net/sf/magicmap/client/controller/rfid Modified Files: RFIDController.java Added Files: RFIDFileReader.java RFIDWriter.java Log Message: rfid enhancement (hacked persistence) --- NEW FILE: RFIDFileReader.java --- /** * */ package net.sf.magicmap.client.controller.rfid; import java.beans.XMLDecoder; import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Collection; /** * @author Johannes Zapotoczky (joh...@za...) * */ public class RFIDFileReader { public static Collection read(String filename) { ArrayList o; try { XMLDecoder decoder = new XMLDecoder(new BufferedInputStream ( new FileInputStream(filename))); // MyClass is declared in e7 Serializing a Bean to XML o = (ArrayList)decoder.readObject(); decoder.close(); } catch (FileNotFoundException e) { o = new ArrayList(); } return o; } } --- NEW FILE: RFIDWriter.java --- /** * */ package net.sf.magicmap.client.controller.rfid; import java.beans.XMLEncoder; import java.io.BufferedOutputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.util.Collection; import java.util.Iterator; /** * @author Johannes Zapotoczky (joh...@za...) * */ public class RFIDWriter { public static void write (Collection rfidAntennas, String filename) { XMLEncoder encoder; try { encoder = new XMLEncoder(new BufferedOutputStream(new FileOutputStream(filename))); // Iterator antennaIterator = rfidAntennas.iterator(); // while (antennaIterator.hasNext()) { // encoder.writeObject(antennaIterator.next()); // } encoder.writeObject(rfidAntennas); encoder.close(); } catch (FileNotFoundException e) { e.printStackTrace(); System.err.println("error: file not found"); } } } Index: RFIDController.java =================================================================== RCS file: /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/controller/rfid/RFIDController.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RFIDController.java 7 Mar 2006 16:11:16 -0000 1.1 --- RFIDController.java 9 Mar 2006 11:41:39 -0000 1.2 *************** *** 4,7 **** --- 4,9 ---- package net.sf.magicmap.client.controller.rfid; + import java.util.Collection; + import net.sf.magicmap.client.controller.Controller; import de.feig.FeIscListener; *************** *** 21,30 **** RFIDReadThread rfidReadThread; Thread rfidPollingThread; /** * */ ! public RFIDController(FedmIscReader reader) { this.rfidReader = reader; } --- 23,34 ---- RFIDReadThread rfidReadThread; Thread rfidPollingThread; + Collection antennas; /** * */ ! public RFIDController(FedmIscReader reader, Collection antennas) { this.rfidReader = reader; + this.antennas = antennas; } *************** *** 57,64 **** e.printStackTrace(); } return rfidReader.isConnected(); } ! public void disconnect() { if (rfidReader.isConnected()) { try { --- 61,82 ---- e.printStackTrace(); } + + try { + RFIDFileReader.read("rfid-antennas.xml"); + } catch (Exception e) { + e.printStackTrace(); + } + return rfidReader.isConnected(); } ! public void disconnect(Collection rfidAntennas) { ! try { ! if (rfidAntennas.size() > 0) { ! RFIDWriter.write(rfidAntennas, "rfid-antennas.xml"); ! } ! } catch (Exception e) { ! e.printStackTrace(); ! } if (rfidReader.isConnected()) { try { |
From: Johannes Z. <jza...@us...> - 2006-03-09 11:41:42
|
Update of /cvsroot/magicmap/magicmapclient In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10235 Added Files: rfid-antennas.xml Log Message: rfid enhancement (hacked persistence) --- NEW FILE: rfid-antennas.xml --- <?xml version="1.0" encoding="UTF-8"?> <java version="1.5.0_06" class="java.beans.XMLDecoder"> <object class="java.util.ArrayList"> <void method="add"> <object class="net.sf.magicmap.client.model.node.RFIDAntenna"> <void property="antennaId"> <string>01</string> </void> <void property="map"> <string>Detailplan Cebit MagicMap</string> </void> <void property="url"> <string>Antenne 1</string> </void> <void property="x"> <int>17</int> </void> <void property="y"> <int>180</int> </void> </object> </void> <void method="add"> <object class="net.sf.magicmap.client.model.node.RFIDAntenna"> <void property="antennaId"> <string>02</string> </void> <void property="map"> <string>Detailplan Cebit MagicMap</string> </void> <void property="url"> <string>Antenne 2</string> </void> <void property="x"> <int>32</int> </void> <void property="y"> <int>196</int> </void> </object> </void> <void method="add"> <object class="net.sf.magicmap.client.model.node.RFIDAntenna"> <void property="antennaId"> <string>03</string> </void> <void property="map"> <string>Detailplan Cebit MagicMap</string> </void> <void property="url"> <string>Antenne 3</string> </void> <void property="x"> <int>32</int> </void> <void property="y"> <int>348</int> </void> </object> </void> <void method="add"> <object class="net.sf.magicmap.client.model.node.RFIDAntenna"> <void property="antennaId"> <string>04</string> </void> <void property="map"> <string>Detailplan Cebit MagicMap</string> </void> <void property="url"> <string>Antenne 4</string> </void> <void property="x"> <int>29</int> </void> <void property="y"> <int>389</int> </void> </object> </void> </object> </java> |
From: Johannes Z. <jza...@us...> - 2006-03-09 11:41:41
|
Update of /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/controller In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10235/src/net/sf/magicmap/client/controller Modified Files: Controller.java Log Message: rfid enhancement (hacked persistence) Index: Controller.java =================================================================== RCS file: /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Controller.java 9 Mar 2006 09:12:41 -0000 1.18 --- Controller.java 9 Mar 2006 11:41:39 -0000 1.19 *************** *** 15,18 **** --- 15,19 ---- import net.sf.magicmap.client.controller.rfid.RFIDController; + import net.sf.magicmap.client.controller.rfid.RFIDFileReader; import net.sf.magicmap.client.gui.MainGUI; import net.sf.magicmap.client.gui.utils.GUIUtils; *************** *** 423,426 **** --- 424,433 ---- this.poller = new ServerPoller(serverManager, pollhandler); serverManager.connect(callback); + + try { + rfidAntennas = RFIDFileReader.read("rfid-antennas.xml"); + } catch (Exception e) { + e.printStackTrace(); + } } *************** *** 829,833 **** if (rfidController == null) { try { ! rfidController = new RFIDController(new FedmIscReader()); } catch (FedmException e) { System.err.println("error creating RFID controller"); --- 836,840 ---- if (rfidController == null) { try { ! rfidController = new RFIDController(new FedmIscReader(),rfidAntennas); } catch (FedmException e) { System.err.println("error creating RFID controller"); *************** *** 841,847 **** } else { rfidController.deactivatePolling(); ! rfidController.disconnect(); rfidTags.clear(); } } } --- 848,856 ---- } else { rfidController.deactivatePolling(); ! rfidController.disconnect(rfidAntennas); rfidTags.clear(); } + } else { + System.err.println("library missing"); } } |
From: Johannes Z. <jza...@us...> - 2006-03-09 09:12:44
|
Update of /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/controller In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17750/src/net/sf/magicmap/client/controller Modified Files: Controller.java Log Message: small rfid enhancement Index: Controller.java =================================================================== RCS file: /cvsroot/magicmap/magicmapclient/src/net/sf/magicmap/client/controller/Controller.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Controller.java 9 Mar 2006 08:58:34 -0000 1.17 --- Controller.java 9 Mar 2006 09:12:41 -0000 1.18 *************** *** 611,616 **** if (antenna.equals("01")) { if (antenna01 != null) { ! newTag.setX(antenna01.getX()); ! newTag.setY(antenna01.getY()-5); } } else if (antenna.equals("02")) { --- 611,616 ---- if (antenna.equals("01")) { if (antenna01 != null) { ! newTag.setX(antenna01.getX()-5); ! newTag.setY(antenna01.getY()); } } else if (antenna.equals("02")) { |