source: java/main/src/main/java/com/framsticks/params/ListAccess.java @ 96

Last change on this file since 96 was 96, checked in by psniegowski, 11 years ago

HIGHLIGHTS:

  • cleanup Instance management
    • extract Instance interface
    • extract Instance common algorithms to InstanceUtils?
  • fix closing issues: Ctrl+C or window close button

properly shutdown whole program

by Java Framsticks framework

  • fix parsing and printing of all request types
  • hide exception passing in special handle method of closures
    • substantially improve readability of closures
    • basically enable use of exception in asynchronous closures

(thrown exception is transported back to the caller)

  • implement call request on both sides

CHANGELOG:
Further improve calling.

Improve instance calling.

Calling is working on both sides.

Improve exception handling in testing.

Waiters do not supercede other apllication exception being thrown.

Finished parsing and printing of all request types (with tests).

Move implementation and tests of request parsing to Request.

Add tests for Requests.

Improve waits in asynchronours tests.

Extract more algorithms to InstanceUtils?.

Extract Instance.resolve to InstanceUtils?.

Improve naming.

Improve passing exception in InstanceClient?.

Hide calling of passed functor in StateCallback?.

Hide Exception passing in asynchronous closures.

Hide exception passing in Future.

Make ResponseCallback? an abstract class.

Make Future an abstract class.

Minor change.

Move getPath to Path.to()

Move bindAccess to InstanceUtils?.

Extract common things to InstanceUtils?.

Fix synchronization bug in Connection.

Move resolve to InstanceUtils?.

Allow names of Joinable to be dynamic.

Add support for set request server side.

More fixes in communication.

Fix issues with parsing in connection.

Cut new line characters when reading.

More improvements.

Migrate closures to FramsticksException?.

Several changes.

Extract resolveAndFetch to InstanceUtils? algorithms.

Test resolving and fetching.

More fixes with function signature deduction.

Do not print default values in SimpleAbstractAccess?.

Add test of FramsClass? printing.

Improve FramsticksException? messages.

Add explicit dispatcher synchronization feature.

Rework assertions in tests.

Previous solution was not generic enough.

Allow addition of joinables to collection after start.

Extract SimulatorInstance? from RemoteInstance?.

Remove PrivateJoinableCollection?.

Improve connections.

Move shutdown hook to inside the Monitor.

It should work in TestNG tests, but it seems that
hooks are not called.

In ServerTest? client connects to testing server.

Move socket initialization to receiver thread.

Add proper closing on Ctrl+C (don't use signals).

Fix bugs with server accepting connections.

Merge Entity into Joinable.

Reworking ServerInstance?.

Extract more algorithm to InstanceUtils?.

Extract some common functionality from AbstractInstance?.

Functions were placed in InstanceUtils?.

Hide registry of Instance.

Use ValueParam? in Instance interface.

Minor change.

Extract Instance interface.

Old Instance is now AbstractInstance?.

File size: 1.9 KB
Line 
1package com.framsticks.params;
2
3
4
5import static com.framsticks.util.lang.Containers.filterInstanceof;
6
7import com.framsticks.params.types.ProcedureParam;
8
9/**
10 * @author Piotr Sniegowski
11 */
12public abstract class ListAccess implements AccessInterface {
13
14        final AccessInterface elementAccess;
15
16        public ListAccess(AccessInterface elementAccess) {
17                this.elementAccess = elementAccess;
18        }
19
20        // @Override
21        // public Param getGroupMember(int gi, int n) {
22        //      return null;
23        // }
24
25        @Override
26        public void setDefault(boolean numericOnly) {
27        }
28
29        @Override
30        public void setDefault(int i, boolean numericOnly) {
31        }
32
33        @Override
34        public void setMin() {
35        }
36
37        @Override
38        public void setMin(int i) {
39        }
40
41        @Override
42        public void setMax() {
43        }
44
45        @Override
46        public void setMax(int i) {
47        }
48
49        @Override
50        public void copyFrom(AccessInterface src) {
51        }
52
53        @Override
54        public void save(SinkInterface sink) {
55                for (CompositeParam p : filterInstanceof(getParams(), CompositeParam.class)) {
56                        Object child = get(p, Object.class);
57                        //this is probably an assertion
58                        assert child != null;
59                        elementAccess.select(child);
60                        elementAccess.save(sink);
61                }
62        }
63
64        @Override
65        public void load(SourceInterface stream) throws Exception {
66        }
67
68        public AccessInterface getElementAccess() {
69                return elementAccess;
70        }
71
72        public abstract String computeIdentifierFor(Object selected);
73
74        @Override
75        public final FramsClass getFramsClass() {
76                return elementAccess.getFramsClass();
77        }
78
79        //TODO it could actually be used also
80        @Override
81        public void tryAutoAppend(Object object) {
82                throw new InvalidOperationException();
83        }
84
85        @Override
86        public Object call(String id, Object[] arguments) {
87                throw new InvalidOperationException().msg("list access does not support calling methods").arg("id", id);
88        }
89
90        @Override
91        public Object call(ProcedureParam param, Object[] arguments) {
92                throw new InvalidOperationException().msg("list access does not support calling methods").arg("param", param);
93        }
94
95};
Note: See TracBrowser for help on using the repository browser.