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/Registry.java

    r87 r88  
    44
    55import com.framsticks.params.annotations.FramsClassAnnotation;
     6import com.framsticks.util.DoubleMap;
     7import com.framsticks.util.FramsticksException;
    68
    7 import java.util.Collections;
    8 import java.util.HashMap;
    9 import java.util.HashSet;
    10 import java.util.Map;
    119import java.util.Set;
    1210
     
    1614public class Registry {
    1715        private static final Logger log = Logger.getLogger(Registry.class.getName());
    18 
    19         public static class DoubleSet<K1, K2, V> {
    20                 protected final Map<K1, V> byId = new HashMap<>();
    21                 protected final Map<K2, V> byName = new HashMap<>();
    22                 protected final Set<V> values = new HashSet<>();
    23 
    24                 public int size() {
    25                         return values.size();
    26                 }
    27 
    28                 public void put(K1 id, K2 name, V value) {
    29                         values.add(value);
    30                         if (id != null) {
    31                                 byId.put(id, value);
    32                         }
    33                         if (name != null) {
    34                                 byName.put(name, value);
    35                         }
    36                 }
    37 
    38                 public boolean containsValue(V value) {
    39                         return values.contains(value);
    40 
    41                 }
    42 
    43                 public boolean containsKey(String identifier) {
    44                         return byId.containsKey(identifier) || byName.containsKey(identifier);
    45                 }
    46 
    47                 public V get(String identifier) {
    48                         if (byId.containsKey(identifier)) {
    49                                 return byId.get(identifier);
    50                         }
    51                         if (byName.containsKey(identifier)) {
    52                                 return byName.get(identifier);
    53                         }
    54                         return null;
    55                 }
    56 
    57                 public Set<V> getValues() {
    58                         return Collections.unmodifiableSet(values);
    59                 }
    60         }
    6116
    6217        // protected void internalRegisterClass(FramsClass framsClass, @Nullable Class<?> javaClass) {
     
    7126        //      }
    7227        // }
    73         protected final DoubleSet<String, String, Class<?>> javaClasses = new DoubleSet<>();
    74         protected final DoubleSet<String, String, FramsClass> framsClasses = new DoubleSet<>();
     28        protected final DoubleMap<String, Class<?>> javaClasses = new DoubleMap<>();
     29        protected final DoubleMap<String, FramsClass> framsClasses = new DoubleMap<>();
    7530
    7631        public void registerReflectedClass(String name, String id, Class<?> reflectedClass) {
     
    7833        }
    7934
     35        public Registry registerAndBuild(Class<?> reflectedClass) {
     36                register(reflectedClass);
     37                putInfoIntoCache(FramsClass.build().forClass(reflectedClass));
     38                return this;
     39        }
     40
    8041        public Registry register(Class<?> reflectedClass) {
    8142                FramsClassAnnotation a = reflectedClass.getAnnotation(FramsClassAnnotation.class);
    8243                if (a == null) {
    83                         log.error("class is not annotated: " + reflectedClass);
    84                         return this;
     44                        throw new FramsticksException().msg("class is not annotated").arg("class", reflectedClass);
    8545                }
    8646
    8747                registerReflectedClass(FramsClassBuilder.getName(a, reflectedClass), FramsClassBuilder.getId(a, reflectedClass), reflectedClass);
    88 
    8948                return this;
    9049        }
    9150
    9251        public AccessInterface createAccess(String name, FramsClass framsClass) throws ConstructionException {
    93                 assert framsClasses.containsValue(framsClass);
     52                // assert framsClasses.containsValue(framsClass);
    9453                if (javaClasses.containsKey(name)) {
    9554                        return new ReflectionAccess(javaClasses.get(name), framsClass);
Note: See TracChangeset for help on using the changeset viewer.