Ignore:
Timestamp:
07/06/13 03:51:11 (11 years ago)
Author:
psniegowski
Message:

HIGHLIGHTS:

  • add proper exception passing between communication sides:

if exception occur during handling client request, it is
automatically passed as comment to error response.

it may be used to snoop communication between peers

  • fix algorithm choosing text controls in GUI
  • allow GUI testing in virtual frame buffer (xvfb)

FEST had some problem with xvfb but workaround was found

supports tab-completion based on requests history

CHANGELOG:
Further improve handling of exceptions in GUI.

Add StatusBar? implementing ExceptionResultHandler?.

Make completion processing asynchronous.

Minor changes.

Improve completion in console.

Improve history in InteractiveConsole?.

First working version of DirectConsole?.

Minor changes.

Make Connection.address non final.

It is more suitable to use in configuration.

Improvement of consoles.

Improve PopupMenu? and closing of FrameJoinable?.

Fix BrowserTest?.

Found bug with FEST running under xvfb.

JButtonFixture.click() is not working under xvfb.
GuiTest? has wrapper which uses JButton.doClick() directly.

Store CompositeParam? param in TreeNode?.

Simplify ClientSideManagedConnection? connecting.

There is now connectedFunctor needed, ApplicationRequests? can be
send right after creation. They are buffered until the version
and features are negotiated.

Narow down interface of ClientSideManagedConnection?.

Allow that connection specialization send only
ApplicationRequests?.

Improve policy of text control choosing.

Change name of Genotype in BrowserTest?.

Make BrowserTest? change name of Genotype.

Minor change.

First working draft of TrackConsole?.

Simplify Consoles.

More improvements with gui joinables.

Unify initialization on gui joinables.

More rework of Frame based entities.

Refactorize structure of JFrames based entities.

Extract GuiTest? from BrowserBaseTest?.

Reorganize Console classes structure.

Add Collection view to JoinableCollection?.

Configure timeout in testing.

Minor changes.

Rework connections hierarchy.

Add Mode to the get operation.

Make get and set in Tree take PrimitiveParam?.

Unify naming of operations.

Make RunAt? use the given ExceptionHandler?.

It wraps the virtual runAt() method call with
try-catch passing exception to handler.

Force RunAt? to include ExceptionHandler?.

Improve ClientAtServer?.

Minor change.

Another sweep with FindBugs?.

Rename Instance to Tree.

Minor changes.

Minor changes.

Further clarify semantics of Futures.

Add FutureHandler?.

FutureHandler? is refinement of Future, that proxifies
exception handling to ExceptionResultHandler? given
at construction time.

Remove StateFunctor? (use Future<Void> instead).

Make Connection use Future<Void>.

Unparametrize *ResponseFuture?.

Remove StateCallback? not needed anymore.

Distinguish between sides of ResponseFuture?.

Base ResponseCallback? on Future (now ResponseFuture?).

Make asynchronous store taking Future for flags.

Implement storeValue in ObjectInstance?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • java/main/src/main/java/com/framsticks/core/Path.java

    r96 r97  
    2323        // private final static Logger log = Logger.getLogger(Path.class.getName());
    2424
    25         final Instance instance;
     25        final Tree tree;
    2626        final String textual;
    2727        final LinkedList<Node> nodes;
    2828
    29         protected static Object getKnownChild(Instance instance, AccessInterface access, CompositeParam param) {
     29        protected static Object getKnownChild(Tree tree, AccessInterface access, CompositeParam param) {
    3030                Object child = access.get(param, Object.class);
    3131                if (child == null) {
     
    3333                }
    3434                try {
    35                         instance.prepareAccess(param);
     35                        tree.prepareAccess(param);
    3636                        return child;
    3737                } catch (FramsticksException e) {
     
    4141
    4242        /**
    43          * @param instance
     43         * @param tree
    4444         * @param textual
    4545         * @param nodes
    4646         */
    47         Path(Instance instance, String textual, LinkedList<Node> nodes) {
    48                 this.instance = instance;
     47        Path(Tree tree, String textual, LinkedList<Node> nodes) {
     48                this.tree = tree;
    4949                this.textual = textual;
    5050                this.nodes = nodes;
     
    5353        public Path appendNode(Node node) {
    5454                assert isResolved();
    55                 return new PathBuilder().instance(instance).textual(textual + ((size() == 1) ? "" : "/") + node.getParam().getId()).add(nodes).add(node).finish();
     55                return new PathBuilder().tree(tree).textual(textual + ((size() == 1) ? "" : "/") + node.getParam().getId()).add(nodes).add(node).finish();
    5656        }
    5757
     
    6363        public static class PathBuilder {
    6464
    65                 Instance instance;
     65                Tree tree;
    6666                String textual;
    6767                final LinkedList<Node> nodes = new LinkedList<Node>();
    6868
    6969                public Path finish() {
    70                         assert instance != null;
     70                        assert tree != null;
    7171                        assert textual != null;
    72                         return new Path(instance, textual, nodes);
     72                        return new Path(tree, textual, nodes);
    7373                }
    7474
     
    7777                }
    7878
    79                 public PathBuilder instance(Instance instance) {
    80                         this.instance = instance;
     79                public PathBuilder tree(Tree tree) {
     80                        this.tree = tree;
    8181                        return this;
    8282                }
     
    130130                }
    131131
    132                 public PathBuilder resolve(@Nonnull Instance instance, String textual) {
     132                public PathBuilder resolve(@Nonnull Tree tree, String textual) {
    133133
    134134                        assert nodes.isEmpty();
    135                         assert instance.isActive();
    136                         this.instance = instance;
    137 
    138                         nodes.add(instance.getRoot());
    139                         Node current = instance.getRoot();
     135                        assert tree.isActive();
     136                        this.tree = tree;
     137
     138                        nodes.add(tree.getRoot());
     139                        Node current = tree.getRoot();
    140140
    141141                        StringBuilder b = new StringBuilder();
    142142                        Iterator<String> i = splitPath(textual);
    143143                        while (i.hasNext() && current.getObject() != null) {
    144                                 AccessInterface access = instance.prepareAccess(current.getParam());
     144                                AccessInterface access = tree.prepareAccess(current.getParam());
    145145                                if (access == null) {
    146146                                        break;
     
    155155                                b.append("/").append(e);
    156156                                access.select(current.getObject());
    157                                 current = new Node(c, getKnownChild(instance, access, c));
     157                                current = new Node(c, getKnownChild(tree, access, c));
    158158                                nodes.add(current);
    159159                        }
     
    170170        public Path appendResolution(Object object) {
    171171                assert !isResolved();
    172                 Path result = new PathBuilder().textual(textual).instance(instance).add(nodes).setLast(object).finish();
     172                Path result = new PathBuilder().textual(textual).tree(tree).add(nodes).setLast(object).finish();
    173173                assert size() == result.size();
    174174                return result;
     
    193193
    194194        public String toString() {
    195                 return instance + textual + (!isResolved() ? "!" : "");
     195                return tree + textual + (!isResolved() ? "!" : "");
     196        }
     197
     198        public String getFullTextual() {
     199                return tree.getName() + textual;
    196200        }
    197201
     
    216220        }
    217221
    218         public final @Nonnull Instance getInstance() {
    219                 assert Dispatching.isThreadSafe();
    220                 return instance;
     222        public final @Nonnull Tree getTree() {
     223                assert Dispatching.isThreadSafe();
     224                return tree;
    221225        }
    222226
     
    233237         */
    234238        public Path tryFindResolution() {
    235                 assert instance.isActive();
     239                assert tree.isActive();
    236240                assert !isResolved();
    237241                if (size() == 1) {
    238                         return Path.build().resolve(instance, "/").finish();//appendResolution(instance.root.object);
    239                 }
    240                 Object child = getKnownChild(instance, InstanceUtils.bindAccess(instance, getUnder()), getTop().getParam());
     242                        return Path.build().resolve(tree, "/").finish();
     243                }
     244                Object child = getKnownChild(tree, TreeOperations.bindAccess(tree, getUnder()), getTop().getParam());
    241245                if (child == null) {
    242246                        return this;
     
    247251        public boolean matches(Path p) {
    248252                assert Dispatching.isThreadSafe();
    249                 assert instance == p.instance;
     253                assert tree == p.tree;
    250254                Iterator<Node> a = nodes.iterator();
    251255                Iterator<Node> b = p.nodes.iterator();
     
    264268        }
    265269
    266         public final boolean isOwner(Instance instance) {
    267                 return this.instance == instance;
    268         }
    269 
    270         // public void setInstance(Instance instance) {
    271         //      this.instance = instance;
    272         // }
     270        public final boolean isOwner(Tree tree) {
     271                return this.tree == tree;
     272        }
    273273
    274274        @SuppressWarnings("unchecked")
     
    284284        }
    285285
    286         public static Path to(@Nonnull Instance instance, String textual) {
    287                 return Path.build().resolve(instance, textual).finish();
     286        public static Path to(@Nonnull Tree tree, String textual) {
     287                return Path.build().resolve(tree, textual).finish();
    288288        }
    289289}
Note: See TracChangeset for help on using the changeset viewer.