Ignore:
Timestamp:
07/18/13 23:52:25 (11 years ago)
Author:
psniegowski
Message:

HIGHLIGHTS:

  • add auto loading and saving algorithms between

frams files format and Java classes

  • respect ValueChange? events in GUI (do not reload object)
  • support results of procedures in Java server
  • make Experiment automatically convert between frams file and NetFile? object
  • add MessageLogger? (compatible with original frams server messages)
  • WorkPackageLogic? now validates results, is able to discard them, reschedule

whole package, or only uncomputed remainder

CHANGELOG:
Show just a short description in PrimeExperiment?.

Add primes_changed event to the PrimeExperiment?.

Make WorkPackageLogic? robust to frams server returning invalid results.

Add MessageLogger? to logics.

Add NetFile? interface. Support Messages from server.

Minor changes to connections.

Merge results in the PrimeExperiment?.

More netload class->file conversion to Simulator.

Move netsave parsing to Simulator.

Fix bug with inverted ordering of events firing in Experiment.

Minor changes.

Minor logging changes.

Use AccessOperations?.convert in NetLoadSaveLogic?

NetLoadSaveLogic? now encloses the conversion.

Use more generic AccessOperations? saveAll and loadAll in PrimePackage?.

Add Result class for enclosing of call invocations' results.

Improve feature request handling in Connections.

Use AccessOperations?.convert in RemoteTree? events parsing.

Minor change.

Add some information params to Java server root and CLI objects.

A draft implementation of loadAll algorithm.

That algorithm tries to load objects into a tree structure.

Add AccessOperationsTest? test.

Develop WorkPackageLogic?.

  • add state tracking fields
  • add work package generation

Add utility class SimplePrimitive?.

Meant for Java backend classes, enclose a single primitive value
and set of listeners.

Improve primitive value refresh in GUI.

When ValueChange? found in called event, do not reload whole
object, but only update GUI (no communication is performed).

Use ValueChange? in the TestClass? test.

Minor changes.

Sending all packages in PrimeExperiment? to the frams servers.

Develop AccessOperations?.loadComposites().

Remove addAccess from MultiParamLoader? interface.

There is now no default AccessProvider? in MultiParamLoader?.
User must explicitely set AccessStash? or Registry.

Improve saving algorithms in AccessOperations?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • java/main/src/main/java/com/framsticks/experiment/Simulator.java

    r102 r103  
    44import com.framsticks.communication.queries.NeedFile;
    55import com.framsticks.communication.queries.NeedFileAcceptor;
     6import com.framsticks.core.ListChange;
    67import com.framsticks.core.Path;
    78import com.framsticks.core.Tree;
    89import com.framsticks.core.ValueChange;
     10import com.framsticks.params.AccessOperations;
     11import com.framsticks.params.CastFailure;
    912import com.framsticks.params.EventListener;
    1013import com.framsticks.params.FramsClass;
     
    1215import com.framsticks.params.annotations.FramsClassAnnotation;
    1316import com.framsticks.params.annotations.ParamAnnotation;
     17import com.framsticks.params.types.BooleanParam;
    1418import com.framsticks.params.types.EventParam;
    1519import com.framsticks.params.types.ProcedureParam;
     
    5963                assert experiment.isActive();
    6064
    61                 log.debug("simulator ready {}", this);
     65                log.info("simulator ready {}", this);
    6266
    6367                runningListener = new EventListener<ValueChange>() {
    6468                        @Override
    6569                        public void action(ValueChange argument) {
    66                                 log.debug("running state of {} changed: {}", this, argument);
     70                                try {
     71                                        boolean running = simulatorClass.getParamEntry("running", BooleanParam.class).reassign(argument.value, null).getValue();
     72                                        log.debug("running state of {} changed: {}", Simulator.this, running);
     73                                        if (!running) {
     74                                                Simulator.this.experiment.simulators.fireChildrenChange(Simulator.this, ListChange.Action.Modify, "ready", "stoped");
     75                                        }
     76                                } catch (CastFailure e) {
     77                                        log.error("failure: ", e);
     78                                }
    6779                        }
    6880                };
     
    147159        @ParamAnnotation(paramType = ProcedureParam.class)
    148160        public void start() {
     161                log.debug("starting simulator {}", this);
     162                call(simulatorPath, "start", new Object[] {}, Object.class, FutureHandler.doNothing(Object.class, this));
    149163        }
    150164
    151165        @ParamAnnotation(paramType = ProcedureParam.class)
    152166        public void stop() {
     167                log.debug("stoping simulator {}", this);
    153168        }
    154169
     
    156171        public void abort() {
    157172                assert isActive();
    158                 log.debug("explicitly aborting {}", this);
     173                log.info("explicitly aborting {}", this);
    159174                experiment.removeSimulator(this);
    160175                interruptJoinable();
     
    184199        protected final AtomicInteger netloadIdCounter = new AtomicInteger();
    185200
    186         public void uploadNet(final File file, final Future<Object> future) {
     201        public <N> void netload(final N net, final Future<Object> future) {
    187202                final String netloadId = "NetLoadSaveLogic" + netloadIdCounter.getAndIncrement();
    188203
     204                final File file = AccessOperations.convert(File.class, net, getRemoteTree().getRegistry());
    189205                log.debug("uploading file {} to {} identified by {}", file, simulatorPath, netloadId);
    190206
     
    215231                simulatorPath.getTree().addNeedFileAcceptor(Integer.MIN_VALUE, acceptor.get());
    216232
    217                 call(simulatorPath, getFramsClass(simulatorPath).getParamEntry("netload_id", ProcedureParam.class), new Object[] { netloadId }, new FutureHandler<Object>(future) {
     233                call(simulatorPath, getFramsClass(simulatorPath).getParamEntry("netload_id", ProcedureParam.class), new Object[] { netloadId }, Object.class, new FutureHandler<Object>(future) {
    218234
    219235                        @Override
     
    225241
    226242        }
     243
     244        public <N> void netsave(Class<N> netJavaClass, final Future<N> futureNet) {
     245                call(simulatorPath, getFramsClass(simulatorPath).getParamEntry("netsave", ProcedureParam.class), new Object[] { }, netJavaClass, new FutureHandler<N>(futureNet) {
     246
     247                        @Override
     248                        protected void result(N net) {
     249                                log.debug("download of {} done", net);
     250                                futureNet.pass(net);
     251                        }
     252                });
     253
     254        }
    227255}
Note: See TracChangeset for help on using the changeset viewer.