Author: ulhume
Date: 2008-08-31 03:07:29 +0200 (Sun, 31 Aug 2008)
New Revision: 1659
Modified:
software_suite_v2/software/tools/tuxdroid-gadget-java-kit/trunk/tuxdroid-gadget-java-kit/.classpath
software_suite_v2/software/tools/tuxdroid-gadget-java-kit/trunk/tuxdroid-gadget-java-kit/project.xml
software_suite_v2/software/tools/tuxdroid-gadget-java-kit/trunk/tuxdroid-gadget-java-kit/sources/com/kysoh/tuxdroid/gadget/framework/gadget/SimpleGadget.java
Log:
Removed Karma-lab Commons dependency
Modified:
software_suite_v2/software/tools/tuxdroid-gadget-java-kit/trunk/tuxdroid-gadget-java-kit/.classpath
===================================================================
---
software_suite_v2/software/tools/tuxdroid-gadget-java-kit/trunk/tuxdroid-gadget-java-kit/.classpath
2008-08-30 23:49:35 UTC (rev 1658)
+++
software_suite_v2/software/tools/tuxdroid-gadget-java-kit/trunk/tuxdroid-gadget-java-kit/.classpath
2008-08-31 01:07:29 UTC (rev 1659)
@@ -2,6 +2,5 @@
<classpath>
<classpathentry kind="src" path="sources"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry combineaccessrules="false" kind="src"
path="/karmalab-commons"/>
<classpathentry kind="output" path="targets/eclipse"/>
</classpath>
Modified:
software_suite_v2/software/tools/tuxdroid-gadget-java-kit/trunk/tuxdroid-gadget-java-kit/project.xml
===================================================================
---
software_suite_v2/software/tools/tuxdroid-gadget-java-kit/trunk/tuxdroid-gadget-java-kit/project.xml
2008-08-30 23:49:35 UTC (rev 1658)
+++
software_suite_v2/software/tools/tuxdroid-gadget-java-kit/trunk/tuxdroid-gadget-java-kit/project.xml
2008-08-31 01:07:29 UTC (rev 1659)
@@ -10,10 +10,9 @@
<version>0.1</version>
<dependencies>
<dependency>
- <id>karmalab-commons</id>
- <groupId>net.karmaLab</groupId>
- <artifactId>karmalab-commons</artifactId>
- <version>1.2</version>
+ <groupId>com.kysoh</groupId>
+ <artifactId>nop</artifactId>
+ <version>0.1</version>
</dependency>
</dependencies>
<repositories>
Modified:
software_suite_v2/software/tools/tuxdroid-gadget-java-kit/trunk/tuxdroid-gadget-java-kit/sources/com/kysoh/tuxdroid/gadget/framework/gadget/SimpleGadget.java
===================================================================
---
software_suite_v2/software/tools/tuxdroid-gadget-java-kit/trunk/tuxdroid-gadget-java-kit/sources/com/kysoh/tuxdroid/gadget/framework/gadget/SimpleGadget.java
2008-08-30 23:49:35 UTC (rev 1658)
+++
software_suite_v2/software/tools/tuxdroid-gadget-java-kit/trunk/tuxdroid-gadget-java-kit/sources/com/kysoh/tuxdroid/gadget/framework/gadget/SimpleGadget.java
2008-08-31 01:07:29 UTC (rev 1659)
@@ -25,15 +25,9 @@
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;
+import java.lang.reflect.Field;
import java.util.Map;
-import net.karmaLab.beans.BeanProxyFactory;
-import net.karmaLab.beans.BeanReflectiveProxy;
-import net.karmaLab.beans.converters.AbstractStringConverter;
-import net.karmaLab.beans.converters.ConvertionException;
-import net.karmaLab.beans.converters.StringConverters;
-import net.karmaLab.beans.property.BeanProperty;
-
/**
* This class is the base class helper for builder java gadgets.
*
@@ -97,22 +91,32 @@
String stringValue = environement.get(key);
key =
key.substring(ENVIRONEMENT_PREFIX.length());
throwTrace(" " + key + ":" + stringValue);
- BeanReflectiveProxy proxy =
BeanProxyFactory.defaultFactory().build(configuration.getClass());
- BeanProperty property = proxy.getProperty(key);
- if (property == null) {
- throw new SimpleGadgetException("No
property (getter/setter) found for parameter '" + key + "'");
+ Field field;
+ try {
+ field =
configuration.getClass().getField(key);
+ } catch (SecurityException e) {
+ throw new
SimpleGadgetException("Internal error while acessing '" + key + "' field.");
+ } catch (NoSuchFieldException e1) {
+ throw new SimpleGadgetException("Unable
to find '" + key + "' field.");
}
- AbstractStringConverter converter =
StringConverters.instance().get(property.getType());
- if (converter == null) {
- throw new SimpleGadgetException("Unable
to find conversion for : " + property.getType());
- }
- Object value;
+ field.setAccessible(true);
try {
- value = converter.toObject(stringValue,
property.getType());
- } catch (ConvertionException e) {
+ if (field.getType() == String.class) {
+ field.set(configuration,
stringValue);
+ } else if (field.getType() == int.class
|| field.getType() == Integer.class) {
+ field.set(configuration,
Integer.parseInt(stringValue));
+ } else if (field.getType() ==
double.class || field.getType() == Double.class) {
+ field.set(configuration,
Double.parseDouble(stringValue));
+ } else if (field.getType() ==
boolean.class || field.getType() == Boolean.class) {
+ field.set(configuration,
Boolean.parseBoolean(stringValue));
+ } else if
(field.getType().getSuperclass() == Enum.class) {
+ field.set(configuration,
Boolean.parseBoolean(stringValue));
+ } else {
+ throw new
SimpleGadgetException("Unable to find conversion for : " + field.getType());
+ }
+ } catch (Exception e) {
throw new SimpleGadgetException(e);
}
- property.set(configuration, value);
}
}
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn