Ignore:
Timestamp:
06/30/13 12:48:20 (11 years ago)
Author:
psniegowski
Message:

HIGHLIGHTS:

  • loading f0 schema with XmlLoader?
  • use XmlLoader? to load configuration
  • introduce unified fork-join model of various entities

(Instances, Connections, GUI Frames, etc.),
all those entities clean up gracefully on
shutdown, which may be initialized by user
or by some entity

  • basing on above, simplify several organizing classes

(Observer, main class)

(to host native frams server process from Java level)

CHANGELOG:
Remove redundant Observer class.

Clean up in AbstractJoinable?.

Update ExternalProcess? class to changes in joining model.

Another sweep through code with FindBugs?.

Find bug with not joining RemoteInstance?.

Joining almost works.

Much improved joining model.

More improvement to joining model.

Add logging messages around joinable operations.

Rename methods in AbstractJoinable?.

Improve Joinable.

Rewrite of entity structure.

More simplifications with entities.

Further improve joinables.

Let Frame compose from JFrame instead of inheriting.

Add join classes.

Improvements of closing.

Add Builder interface.

Add FramsServerTest?.xml

FramsServer? may be configured through xml.

Make Framsticks main class an Observer of Entities.

Make Observer a generic type.

Remove variables regarding to removed endpoint.

Simplify observer (remove endpoints).

More changes to Observer and Endpoint.

Minor improvements.

Add OutputListener? to ExternalProcess?.

Improve testing of ExternalProcess?.

Add ExternalProcess? runner.

Rename the Program class to Framsticks.

Migrate Program to use XmlLoader? configuration.

First steps with configuration using XmlLoader?.

Fix several bugs.

Move all f0 classes to apriopriate package.

XmlLoader? is able to load Schema.

XmlLoader? is loading classes and props.

Add GroupBuilder?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • java/main/src/main/java/com/framsticks/params/ReflectionAccess.java

    r87 r88  
    66import java.util.Collections;
    77import java.util.HashMap;
     8import java.util.LinkedList;
     9import java.util.List;
    810import java.util.Map;
    911
     
    3739        public static class Backend {
    3840
    39                 protected static Map<Pair<Class<?>, FramsClass>, Backend> synchronizedCache = Collections.synchronizedMap(new HashMap<Pair<Class<?>, FramsClass>, Backend>());
     41                protected static final Map<Pair<Class<?>, FramsClass>, Backend> synchronizedCache = Collections.synchronizedMap(new HashMap<Pair<Class<?>, FramsClass>, Backend>());
    4042
    4143                public static class ReflectedValueParam {
     
    5355
    5456                protected final Map<ValueParam, ReflectedValueParam> params;
    55                 protected final Map<Class<?>, Method> autoAppendMethods;
     57                protected final List<Method> autoAppendMethods;
    5658
    5759                /**
    5860                 * @param params
    5961                 */
    60                 public Backend(Map<ValueParam, ReflectedValueParam> params, Map<Class<?>, Method> autoAppendMethods) {
     62                public Backend(Map<ValueParam, ReflectedValueParam> params, List<Method> autoAppendMethods) {
    6163                        // this.params = Collections.unmodifiableMap(params);
    6264                        this.params = params;
     
    140142                        }
    141143
    142                         Map<Class<?>, Method> autoAppendMethods = new HashMap<>();
     144                        List<Method> autoAppendMethods = new LinkedList<>();
    143145
    144146                        Class<?> javaClass = reflectedClass;
     
    154156                                                throw new ConstructionException().msg("invalid number of arguments in AutoAppend marked method").arg("method", m).arg("arguments", args.length);
    155157                                        }
    156                                         autoAppendMethods.put(args[0], m);
     158                                        autoAppendMethods.add(m);
    157159                                }
    158160
     
    327329        public boolean tryAutoAppend(Object value) {
    328330                assert object != null;
    329                 for (Map.Entry<Class<?>, Method> a : backend.autoAppendMethods.entrySet()) {
    330                         if (a.getKey().isAssignableFrom(value.getClass())) {
     331                for (Method m : backend.autoAppendMethods) {
     332                        if (m.getParameterTypes()[0].isAssignableFrom(value.getClass())) {
    331333                                try {
    332                                         a.getValue().invoke(object, value);
     334                                        m.invoke(object, value);
    333335                                        return true;
    334                                 } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
    335                                         throw new FramsticksException().msg("failed to auto append").cause(e).arg("value", value).arg("into object", object).arg("with method", a.getValue());
     336                                } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | FramsticksException e) {
     337                                        throw new FramsticksException().msg("failed to auto append").cause(e).arg("value", value).arg("into object", object).arg("with method", m);
    336338                                }
    337339                        }
Note: See TracChangeset for help on using the changeset viewer.