Ignore:
Timestamp:
07/12/13 23:41:06 (11 years ago)
Author:
psniegowski
Message:

HIGHLIGHTS:

  • add <include/> to configuration
  • add side notes to tree
    • used to store arbitrary information alongside the tree structure
  • migrate to log4j2
    • supports lazy string evaluation of passed arguments
  • improve GUI tree
    • it stays in synchronization with actual state (even in high load test scenario)
  • improve panel management in GUI
  • make loading objects in GUI more lazy
  • offload parsing to connection receiver thread
    • info parsing
    • first step of objects parsing
  • fix connection parsing bug (eof in long values)
  • support zero-arguments procedure in table view

CHANGELOG:
Implement procedure calls from table view.

Refactorization around procedures in tables.

Add table editor for buttons.

Render buttons in the the list view.

Further improve Columns.

Add Column class for TableModel?.

Accept also non-arguments ProcedureParams? in tableView.

Increase maximal TextAreaControl? size.

Add tooltip to ProcedureControl?.

Fix bug of interpreting eofs in long values by connection reader.

Further rework connection parsing.

Simplify client connection processing.

Test ListChange? modification.

Test ListChange? events with java server.

Add TestChild?.

Fix bug with fast deregistering when connecting to running server.

Another minor refactorization in TreeOperations?.

Fix bug in SimpleAbstractAccess? loading routine.

Another minor improvement.

Minor change.

Make reading of List objects two-phase.

Another minor change.

Dispatch parsing into receiver thread.

Another step.

Enclose passing value in ObjectParam? case in closure.

Minor step.

Minor change on way to offload parsing.

Temporarily comment out single ValueParam? get.

It will be generalized to multi ValueParam?.

Process info in receiver thread.

Add DispatchingExceptionHandler?.

Make waits in browser test longer.

Use FETCHED_MARK.

It is honored in GUI, where it used to decide whether to get values

after user action.

It is set in standard algorithm for processing fetched values.

Add remove operation to side notes.

Make loading more lazy.

Improve loading policy.

On node choose load itself, on node expansion, load children.

Minor improvement.

Fix bug with panel interleaving.

Minor improvements.

Improve panel management.

More cleaning around panels.

Reorganize panels.

Further improve tree.

Fix bug in TreeModel?.

Remove children from TreeNode?.

Implement TreeNode? hashCode and equals.

Make TreeNode? delegate equals and hashcode to internal reference.

Move listeners from TreeNode? to side notes.

Store path.textual as a side note.

Side note params instead of accesses for objects.

More refactorizations.

In TreeNode? bindAccess based on side notes.

Minor step.

Hide createAccess.

Rename AccessInterface? to Access.

Minor changes.

Several improvements in high load scenarios.

Change semantics of ArrayListAccess?.set(index, null);

It now removes the element, making list shorter
(it was set to null before).

Add path remove handler.

Handle exceptions in Connection.

Update .gitignore

Configure logging to file.

Move registration to TreeModel?.

Further refactorization.

Minor refactorization.

Minor improvements.

Use specialized event also for Modify action of ListChange?.

Use remove events.

Use the insertion events for tree.

Further improve tree refreshing.

Further improve reacting on events in GUI.

Fix problem with not adding objects on addition list change.

Migrate to log4j lazy String construction interface.

Migrate imports to log4j2.

Drop dependency on adapter to version 1.2.

Switch log4j implementation to log4j2.

Add dirty mark to the NodeAtFrame?.

Make selecting in AccessInterfaces? type safe.

Ignore containers size settings in Model and Genotype.

Use tree side notes to remember local changes and panels.

Add sideNotes to tree.

They will be used to store various accompanying information
right in the tree.

Use ReferenceIdentityMap? from apache in TreeNode?.

It suits the need perfectly (weak semantics on both key and value).

Make ArrayListParam? do not react size changes.

Guard in TableModel? before not yet loaded objects.

Add <include/> clause and AutoInjector?.

Extract common columns configuration to separate xml,
that can be included by other configurations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • java/main/src/main/java/com/framsticks/remote/RemoteTree.java

    r99 r100  
    1515import com.framsticks.params.types.EventParam;
    1616import com.framsticks.params.types.ProcedureParam;
     17import com.framsticks.parsers.Loaders;
    1718import com.framsticks.parsers.MultiParamLoader;
    1819import com.framsticks.core.Tree;
    1920import com.framsticks.util.*;
     21import com.framsticks.util.dispatching.AtOnceDispatcher;
    2022import com.framsticks.util.dispatching.Dispatching;
    2123import com.framsticks.util.dispatching.Dispatching.DispatcherWaiter;
     24import com.framsticks.util.dispatching.DispatchingFuture;
     25import com.framsticks.util.dispatching.ExceptionResultHandler;
    2226import com.framsticks.util.dispatching.Future;
    2327import com.framsticks.util.dispatching.FutureHandler;
     
    3438import javax.annotation.Nonnull;
    3539
    36 import org.apache.log4j.Logger;
     40import org.apache.logging.log4j.Logger;
     41import org.apache.logging.log4j.LogManager;
    3742
    3843/**
     
    4247public final class RemoteTree extends AbstractTree implements JoinableParent {
    4348
    44         private final static Logger log = Logger.getLogger(RemoteTree.class);
     49        private final static Logger log = LogManager.getLogger(RemoteTree.class);
    4550
    4651        protected ClientSideManagedConnection connection;
     
    6267        public void setConnection(final ClientSideManagedConnection connection) {
    6368                this.connection = connection;
     69                this.connection.setExceptionHandler(this);
    6470        }
    6571
     
    7480        }
    7581
    76         @Override
    77         public void get(final Path path, final ValueParam param, final Future<Object> future) {
    78                 assert isActive();
    79                 assert param != null;
    80                 // assert path.isResolved();
    81                 //TODO only do that if needed
    82                 connection.send(new GetRequest().field(param.getId()).path(path.getTextual()), this, new ClientSideResponseFuture(future) {
    83                         @Override
    84                         protected void processOk(Response response) {
    85                                 assert isActive();
    86                                 processFetchedValues(path, response.getFiles());
    87                                 future.pass(bindAccess(path.tryResolveIfNeeded()).get(param, Object.class));
    88                         }
    89                 });
    90         }
     82        protected ExceptionResultHandler pathRemoveHandler(final Path path, final ExceptionResultHandler handler) {
     83                return new ExceptionResultHandler() {
     84
     85                        @Override
     86                        public void handle(final FramsticksException exception) {
     87                                Dispatching.dispatchIfNotActive(RemoteTree.this, new RunAt<RemoteTree>(RemoteTree.this) {
     88
     89                                        @Override
     90                                        protected void runAt() {
     91                                                assert path.getTree().isActive();
     92                                                log.info("path is invalid (removing): {}", path);
     93                                                bindAccess(path.getUnder()).set(path.getTop().getParam(), null);
     94                                                handler.handle(exception);
     95                                        }
     96                                });
     97                        }
     98                };
     99        }
     100
     101        // @Override
     102        // public void get(final Path path, final ValueParam param, final Future<Object> future) {
     103        //      assert isActive();
     104        //      assert param != null;
     105        //      // assert path.isResolved();
     106        //      //TODO only do that if needed
     107        //      connection.send(new GetRequest().field(param.getId()).path(path.getTextual()), this, new ClientSideResponseFuture(pathRemoveHandler(path, future)) {
     108        //              @Override
     109        //              protected void processOk(Response response) {
     110        //                      assert isActive();
     111        //                      processFetchedValues(path, response.getFiles());
     112        //                      future.pass(bindAccess(path.tryResolveIfNeeded()).get(param, Object.class));
     113        //              }
     114        //      });
     115        // }
    91116
    92117        protected final Map<String, Set<Future<FramsClass>>> infoRequests = new HashMap<String, Set<Future<FramsClass>>>();
     
    103128                }
    104129
    105                 log.debug("issuing info request for " + name);
     130                log.debug("issuing info request for {}", name);
    106131                final Set<Future<FramsClass>> futures = new HashSet<Future<FramsClass>>();
    107132                futures.add(future);
    108133                infoRequests.put(name, futures);
    109134
    110                 final Future<FramsClass> compositeFuture = new Future<FramsClass>() {
     135                final Future<FramsClass> compositeFuture = DispatchingFuture.create(this, new Future<FramsClass>() {
    111136
    112137                        @Override
     
    122147                        protected void result(FramsClass framsClass) {
    123148                                assert isActive();
     149                                putInfoIntoCache(framsClass);
    124150                                infoRequests.remove(name);
    125151                                for (Future<FramsClass> f : futures) {
     
    127153                                }
    128154                        }
    129                 };
     155                });
    130156
    131157                //TODO: if the info is in the cache, then don't communicate
    132                 connection.send(new InfoRequest().path(path.getTextual()), this, new ClientSideResponseFuture(compositeFuture) {
     158                connection.send(new InfoRequest().path(path.getTextual()), AtOnceDispatcher.getInstance(), new ClientSideResponseFuture(compositeFuture) {
    133159                        @Override
    134160                        protected void processOk(Response response) {
    135                                 assert isActive();
     161                                assert connection.getReceiverDispatcher().isActive();
    136162
    137163                                if (response.getFiles().size() != 1) {
     
    141167                                        throw new FramsticksException().msg("path mismatch").arg("returned path", response.getFiles().get(0).getPath());
    142168                                }
    143                                 FramsClass framsClass = processFetchedInfo(RemoteTree.this, response.getFiles().get(0));
     169                                FramsClass framsClass = Loaders.loadFramsClass(response.getFiles().get(0).getContent());
    144170
    145171                                CompositeParam thisParam = path.getTop().getParam();
     
    155181        public void get(final Path path, final Future<Path> future) {
    156182                assert isActive();
    157 
    158                 log.trace("fetching values for " + path);
    159                 findInfo(path, new FutureHandler<FramsClass>(future) {
     183                final ExceptionResultHandler remover = pathRemoveHandler(path, future);
     184
     185                log.trace("fetching values for {}", path);
     186                findInfo(path, new FutureHandler<FramsClass>(remover) {
    160187                        @Override
    161188                        protected void result(FramsClass result) {
    162189
    163                                 connection.send(new GetRequest().path(path.getTextual()), RemoteTree.this, new ClientSideResponseFuture(future) {
     190                                final Access access = registry.prepareAccess(path.getTop().getParam());
     191                                connection.send(new GetRequest().path(path.getTextual()), AtOnceDispatcher.getInstance(), new ClientSideResponseFuture(remover) {
    164192                                        @Override
    165193                                        protected void processOk(Response response) {
    166                                                 assert isActive();
    167                                                 Path p = path.tryResolveIfNeeded();
    168                                                 processFetchedValues(p, response.getFiles());
    169                                                 future.pass(p.tryResolveIfNeeded().assureResolved());
     194                                                processFetchedValues(path, response.getFiles(), access, future);
    170195                                        }
    171196                                });
     
    179204                final Integer flag = bindAccess(path).set(param, value);
    180205
    181                 log.trace("storing value " + param + " for " + path);
     206                log.trace("storing value {} for {}", param, path);
    182207                //TODO break in passing exception handler is here
    183208                connection.send(new SetRequest().value(value.toString()).field(param.getId()).path(path.getTextual()), this, new ClientSideResponseFuture(future) {
     
    274299                                                        return;
    275300                                                }
    276                                                 AccessInterface access = registry.createAccess(argumentType);
     301                                                Access access = registry.createAccess(argumentType);
    277302                                                Object argument = access.createAccessee();
    278303                                                access.select(argument);
     
    282307                                                A typedArgument = argumentType.cast(argument);
    283308
    284                                                 // log.info("executing event with argument " + argumentType);
     309                                                // log.info("executing event with argument {}", argumentType);
    285310                                                MultiParamLoader loader = new MultiParamLoader();
    286311                                                loader.setNewSource(file.getContent());
    287312                                                loader.addBreakCondition(MultiParamLoader.Status.AfterObject);
    288                                                 loader.addAccessInterface(access);
     313                                                loader.addAccess(access);
    289314                                                loader.go();
    290315
Note: See TracChangeset for help on using the changeset viewer.