From 73e8d8342662a791ae9402b247062d958130ab80 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Fri, 31 Jul 2015 15:26:06 +0200 Subject: [PATCH] =?utf8?q?Added=20README=20file=20+=20ignored=20some=20str?= =?utf8?q?ings=20(no=20logic=20change).=20Signed-off-by:Roland=20H=C3=A4de?= =?utf8?q?r=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Addressbook/README.txt | 30 +++++++++++ .../addressbook/BaseFrameworkSystem.java | 50 +++++++++---------- 2 files changed, 55 insertions(+), 25 deletions(-) create mode 100644 Addressbook/README.txt diff --git a/Addressbook/README.txt b/Addressbook/README.txt new file mode 100644 index 0000000..20590e3 --- /dev/null +++ b/Addressbook/README.txt @@ -0,0 +1,30 @@ +How to launch: +============== + +1) Build it: (you need ant tools) +ant jar + +2) Go to dist folder and create "data": +cd dist +mkdir data + +3) Launch it +$ java -jar Addressbook.jar + +4) The GUI can also be launched: +$ java -jar Addressbook.jar -gui + +If you got an exception, maybe you bumbed into a stub method (unfinished). To reduce possibilities of +crashes try the usual approach: + +$ java -ea -jar Addressbook.jar -gui + +Please report any errors back to me. And yes, not all is finished. :) + +The file config.properties will be created on first run for you. After that you +can customize it. Supported database backends are: + +base64csv - The default backend, BASE64-encoded CSV strings +mysql - The unfinished MySQL backend + +Good luck! diff --git a/Addressbook/src/org/mxchange/addressbook/BaseFrameworkSystem.java b/Addressbook/src/org/mxchange/addressbook/BaseFrameworkSystem.java index 92fe258..8032445 100644 --- a/Addressbook/src/org/mxchange/addressbook/BaseFrameworkSystem.java +++ b/Addressbook/src/org/mxchange/addressbook/BaseFrameworkSystem.java @@ -130,7 +130,7 @@ public class BaseFrameworkSystem implements FrameworkInterface { */ @Override public Object getValueFromColumn (final String columnName) { - throw new UnsupportedOperationException(MessageFormat.format("Not implemented. columnName={0}", columnName)); + throw new UnsupportedOperationException(MessageFormat.format("Not implemented. columnName={0}", columnName)); //NOI18N } /** @@ -143,7 +143,7 @@ public class BaseFrameworkSystem implements FrameworkInterface { @SuppressWarnings ("unchecked") private Class getClassFromTarget (final FrameworkInterface instance, final String targetClass) { // Trace message - this.getLogger().debug(MessageFormat.format("instance={0},targetClass={1}", instance, targetClass)); + this.getLogger().debug(MessageFormat.format("instance={0},targetClass={1}", instance, targetClass)); //NOI18N // Instance reflaction of this class Class c = instance.getClass(); @@ -151,14 +151,14 @@ public class BaseFrameworkSystem implements FrameworkInterface { // Analyze class while (!targetClass.equals(c.getSimpleName())) { // Debug message - this.getLogger().debug("c=" + c.getSimpleName()); + this.getLogger().debug(MessageFormat.format("c={0}", c.getSimpleName())); //NOI18N // Get super class (causes unchecked warning) c = (Class) c.getSuperclass(); } // Trace message - this.getLogger().trace(MessageFormat.format("c={0} - EXIT!", c)); + this.getLogger().trace(MessageFormat.format("c={0} - EXIT!", c)); //NOI18N // Return it return c; @@ -174,7 +174,7 @@ public class BaseFrameworkSystem implements FrameworkInterface { */ private Method getMethodFromName (final FrameworkInterface instance, final String targetClass, final String methodName) { // Trace messahe - this.getLogger().trace(MessageFormat.format("targetClass={0},methodName={1}", targetClass, methodName)); + this.getLogger().trace(MessageFormat.format("targetClass={0},methodName={1}", targetClass, methodName)); //NOI18N // Get target class instance Class c = this.getClassFromTarget(instance, targetClass); @@ -194,10 +194,10 @@ public class BaseFrameworkSystem implements FrameworkInterface { } // Assert on field - assert (method instanceof Method) : "method is not a Method instance"; + assert (method instanceof Method) : "method is not a Method instance"; //NOI18N // Trace message - this.getLogger().trace(MessageFormat.format("method={0} - EXIT!", method)); + this.getLogger().trace(MessageFormat.format("method={0} - EXIT!", method)); //NOI18N // Return it return method; @@ -283,7 +283,7 @@ public class BaseFrameworkSystem implements FrameworkInterface { @Override public boolean isValueEqual (final String columnName, final boolean bool) { // Not implemented - throw new UnsupportedOperationException(MessageFormat.format("Not implemented. columnName={0},bool={1}", columnName, bool)); + throw new UnsupportedOperationException(MessageFormat.format("Not implemented. columnName={0},bool={1}", columnName, bool)); //NOI18N } /** @@ -387,13 +387,13 @@ public class BaseFrameworkSystem implements FrameworkInterface { */ protected String convertColumnNameToAttribute (final String columnName) { // Trace message - this.getLogger().trace(MessageFormat.format("columnName={0} - CALLED!", columnName)); + this.getLogger().trace(MessageFormat.format("columnName={0} - CALLED!", columnName)); //NOI18N // First all lower case String lower = columnName.toLowerCase(); // Then split on "_" - StringTokenizer tokenizer = new StringTokenizer(lower, "_"); + StringTokenizer tokenizer = new StringTokenizer(lower, "_"); //NOI18N // Resulting string StringBuilder builder = new StringBuilder(tokenizer.countTokens()); @@ -421,7 +421,7 @@ public class BaseFrameworkSystem implements FrameworkInterface { } // Trace message - this.getLogger().trace(MessageFormat.format("builder={0} - EXIT!", builder)); + this.getLogger().trace(MessageFormat.format("builder={0} - EXIT!", builder)); //NOI18N // Return result return builder.toString(); @@ -437,10 +437,10 @@ public class BaseFrameworkSystem implements FrameworkInterface { */ protected String convertColumnNameToGetterMethod (final String columnName, boolean isBool) { // Trace message - this.getLogger().trace(MessageFormat.format("columnName={0} - CALLED!", columnName)); + this.getLogger().trace(MessageFormat.format("columnName={0} - CALLED!", columnName)); //NOI18N // Then split on "_" - StringTokenizer tokenizer = new StringTokenizer(columnName, "_"); + StringTokenizer tokenizer = new StringTokenizer(columnName, "_"); //NOI18N // Resulting string StringBuilder builder = new StringBuilder(tokenizer.countTokens()); @@ -448,10 +448,10 @@ public class BaseFrameworkSystem implements FrameworkInterface { // Is it boolean? if (isBool) { // Append "is" - builder.append("is"); + builder.append("is"); //NOI18N } else { // Append "get" - builder.append("get"); + builder.append("get"); //NOI18N } // Walk through all @@ -460,7 +460,7 @@ public class BaseFrameworkSystem implements FrameworkInterface { String token = tokenizer.nextToken(); // Debug message - this.getLogger().debug(MessageFormat.format("token={0}", token)); + this.getLogger().debug(MessageFormat.format("token={0}", token)); //NOI18N // Make it upper-case char c = token.charAt(0); @@ -471,7 +471,7 @@ public class BaseFrameworkSystem implements FrameworkInterface { } // Trace message - this.getLogger().trace(MessageFormat.format("builder={0} - EXIT!", builder)); + this.getLogger().trace(MessageFormat.format("builder={0} - EXIT!", builder)); //NOI18N // Return result return builder.toString(); @@ -487,7 +487,7 @@ public class BaseFrameworkSystem implements FrameworkInterface { */ protected boolean getBooleanField (final FrameworkInterface instance, final String targetClass, final String methodName) { // Trace messahe - this.getLogger().trace(MessageFormat.format("targetClass={0},methodName={1}", targetClass, methodName)); + this.getLogger().trace(MessageFormat.format("targetClass={0},methodName={1}", targetClass, methodName)); //NOI18N // Get method instance Method method = this.getMethodFromName(instance, targetClass, methodName); @@ -522,7 +522,7 @@ public class BaseFrameworkSystem implements FrameworkInterface { */ protected Object getField (final FrameworkInterface instance, final String targetClass, final String methodName) { // Trace messahe - this.getLogger().trace(MessageFormat.format("targetClass={0},methodName={1}", targetClass, methodName)); + this.getLogger().trace(MessageFormat.format("targetClass={0},methodName={1}", targetClass, methodName)); //NOI18N // Get method to call Method method = this.getMethodFromName(instance, targetClass, methodName); @@ -612,7 +612,7 @@ public class BaseFrameworkSystem implements FrameworkInterface { */ protected String[] getArrayFromString (final String str, final String delimiter, final int size) { // Trace message - this.getLogger().trace(MessageFormat.format("str={0},delimiter={1},size={2} - CALLED!", str, delimiter, size)); + this.getLogger().trace(MessageFormat.format("str={0},delimiter={1},size={2} - CALLED!", str, delimiter, size)); //NOI18N // Get tokenizer StringTokenizer tokenizer = new StringTokenizer(str, delimiter); @@ -627,14 +627,14 @@ public class BaseFrameworkSystem implements FrameworkInterface { tokens[index] = tokenizer.nextToken(); // Debug message - this.getLogger().debug(MessageFormat.format("Token at index{0}: {1}", index, tokens[1])); + this.getLogger().debug(MessageFormat.format("Token at index{0}: {1}", index, tokens[1])); //NOI18N // Increment index index++; } // Trace message - this.getLogger().trace(MessageFormat.format("tokens({0})={1} - EXIT!", tokens.length, Arrays.toString(tokens))); + this.getLogger().trace(MessageFormat.format("tokens({0})={1} - EXIT!", tokens.length, Arrays.toString(tokens))); //NOI18N // Return it return tokens; @@ -650,7 +650,7 @@ public class BaseFrameworkSystem implements FrameworkInterface { */ protected boolean isBooleanField (final FrameworkInterface instance, final String targetClass, final String columnName) { // Trace message - this.getLogger().trace(MessageFormat.format("instance={0},targetCLass={1},columnName={2} - CALLED!", instance, targetClass, columnName)); + this.getLogger().trace(MessageFormat.format("instance={0},targetCLass={1},columnName={2} - CALLED!", instance, targetClass, columnName)); //NOI18N // Convert column name to getter name (boolean) String methodName = this.convertColumnNameToGetterMethod(columnName, true); @@ -666,7 +666,7 @@ public class BaseFrameworkSystem implements FrameworkInterface { Method method = c.getDeclaredMethod(methodName, new Class[0]); } catch (final NoSuchMethodException ex) { // Debug message - this.getLogger().debug(MessageFormat.format("Method {0} does not exist, field {1} cannot be boolean: {2}", methodName, columnName, ex)); + this.getLogger().debug(MessageFormat.format("Method {0} does not exist, field {1} cannot be boolean: {2}", methodName, columnName, ex)); //NOI18N // Not found isBool = false; @@ -676,7 +676,7 @@ public class BaseFrameworkSystem implements FrameworkInterface { } // Trace message - this.getLogger().trace(MessageFormat.format("isBool={0} - EXIT!", isBool)); + this.getLogger().trace(MessageFormat.format("isBool={0} - EXIT!", isBool)); //NOI18N // Return result return isBool; -- 2.39.5