slarson / wholebrain

Automatically exported from code.google.com/p/wholebrain
0 stars 0 forks source link

Improvement for initial client file download #531

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This is based on a disussion yesterday afternoon with Stephen, Chris, Jesus, 
and Dave.

The purpose is to (possibly) improve client startup by allowing the client to 
quickly determine exactly which tangibles will be initially visible.

The code described here has been committed to svn and a WBC server implementing 
this code is running on drlittle.ucsd.edu:8182.

It can be demonstrated with a browser like this:
http://drlittle.ucsd.edu:8182/initialtangibleids/zebra/default
and 
http://drlittle.ucsd.edu:8182/initialtangibleids/mouse-allen/default

The pattern is
http://drlittle.ucsd.edu:8182/initialtangibleids/{modeId}/{userId}

These (hard-coded for now) values define currently acceptable values for modeId 
and userId:
    private final String MODE_IDS = 
        "mouse-allen, mouse-wax, macaque, wilke, zebra";
    private final String USER_IDS = 
        "default";
    private final String DEFAULT_MODE_ID = "mouse-allen";
    private final String DEFAULT_USER_ID = "default";

The "modes" are a new creation that came out of our meeting. Each mode is 
defined by a set of constituent layers as shown here:
    private final String MOUSE_ALLEN_LAYERS = "baldwin, default, gwv9h, retin";
    private final String MOUSE_WAX_LAYERS = "baldwin, default, retin, waxhm";
    private final String MACAQUE_LAYERS = "macaq";
    private final String WILKE_LAYERS = "baldwin, default, gwv9h, retin, wilke";
    private final String ZEBRA_LAYERS = "zebra";
These are also hard-coded for now but can easily be switched to the 
wbcserver.properties file when confirmed in testing.

When
http://drlittle.ucsd.edu:8182/initialtangibleids/zebra/default
is run. Here are some debug log messages:
--100909 21:31:11 DEBUG server.resource.InitialTangibleIdsResource [Thread-10]:
 InitialTangiblesResource instantiated, method: GET, modeId: zebra, userId: default.
--100909 21:31:11 DEBUG server.resource.InitialTangibleIdsResource [Thread-10]:
 visibleLayerIds size: 8
--100909 21:31:11 DEBUG server.resource.InitialTangibleIdsResource [Thread-10]:
 Filtered visibleLayerIds size: 1
--100909 21:31:11 DEBUG server.resource.InitialTangibleIdsResource [Thread-10]:
 layerTangibleIds size: 14 <--- zebra layer
--100909 21:31:11 DEBUG server.resource.InitialTangibleIdsResource [Thread-10]:
 modeTangibleIds size: 14
--100909 21:31:11 DEBUG server.resource.InitialTangibleIdsResource [Thread-10]:
 invisibleTangibleIds size: 3392
--100909 21:31:11 DEBUG server.resource.InitialTangibleIdsResource [Thread-10]:
 visibleIds: 14, invisibleIds: 0, totalIds: 14

and 
http://drlittle.ucsd.edu:8182/initialtangibleids/mouse-allen/default
--100909 21:33:08 DEBUG server.resource.InitialTangibleIdsResource [Thread-15]:
 InitialTangiblesResource instantiated, method: GET, modeId: mouse-allen, userId: default.
--100909 21:33:08 DEBUG server.resource.InitialTangibleIdsResource [Thread-15]:
 visibleLayerIds size: 8
--100909 21:33:08 DEBUG server.resource.InitialTangibleIdsResource [Thread-15]:
 Filtered visibleLayerIds size: 4
--100909 21:33:08 DEBUG server.resource.InitialTangibleIdsResource [Thread-15]:
 layerTangibleIds size: 3630  <--- this and next 3 are baldwin, default, gwv9h, retin layers
--100909 21:33:08 DEBUG server.resource.InitialTangibleIdsResource [Thread-15]:
 layerTangibleIds size: 6
--100909 21:33:08 DEBUG server.resource.InitialTangibleIdsResource [Thread-15]:
 layerTangibleIds size: 179
--100909 21:33:08 DEBUG server.resource.InitialTangibleIdsResource [Thread-15]:
 layerTangibleIds size: 26
--100909 21:33:08 DEBUG server.resource.InitialTangibleIdsResource [Thread-15]:
 modeTangibleIds size: 3841
--100909 21:33:08 DEBUG server.resource.InitialTangibleIdsResource [Thread-15]:
 invisibleTangibleIds size: 3392
--100909 21:33:09 DEBUG server.resource.InitialTangibleIdsResource [Thread-15]:
 visibleIds: 455, invisibleIds: 3386, totalIds: 3841

I will leave this running on drlittle.ucsd.edu

Original issue reported on code.google.com by davlit0...@gmail.com on 10 Sep 2010 at 4:51

GoogleCodeExporter commented 9 years ago
This has been refined based on discussion with Chris. Now called "initial 
state". Server responses are cached on the server so the reply to client will 
be very fast.

Sample HTTP GET (from client):
http://<host:port>/initialState/{modeid}/{userId}
http://drlittle.ucsd.edu:8182/initialState/zebra/default

Sample response from server:
<ns5:InitialState user="default" mode="zebra" ...>
    <VisibleTangibles>
        <TangibleState ...>
            ...
        </TangibleState>
        ...
    </VisibleTangibles>
    <InvisibleTangible>
        <TangibleState ...>
            ...
        </TangibleState>
        ...
    </InvisibleTangible>
    <DataWrappers>
        <DataWrapper ...>
            ...
        </DataWrapper>
        ...
    </DataWrappers>
</ns5:InitialState>

Original comment by davlit0...@gmail.com on 7 Oct 2010 at 6:16