ca2longoria / spritely

A reimagining of the unfinished charasprite project, but this time using a preexisting local Java web server, nanohttpd.
Other
0 stars 0 forks source link

Move working image handling from Spritely class to a Session format #7

Closed ca2longoria closed 10 years ago

ca2longoria commented 10 years ago

Summary

Originally, Spritely held the current working image and related data as variables/properties/attributes of its own. In light of the eventual move to multiple running sessions, I created a Session class and added some go-between logic so as to avoid changing too many things at once. Unfortunately, my changes exceeded my capacity to recall what I was doing, and I ended up with a confused garble of mess (still works, though). Now this must be fixed, while maintaining Session usage


Concrete Requirements


Depends On

ca2longoria commented 10 years ago

The three classes in question are:

Before, Spritely stored the single working- BufferedImage and File objects. Server would call on its Spritely instance parent (Spritely.this) to get these objects when necessary.

Now, however, there is the Session class, which has taken responsibility over the ownership of workingImage and workingImageFile, but which is also an instanced subclass of Spritely. Yet, Session still calls on its Spritely parent to pull those image objects.

ca2longoria commented 10 years ago

First, then, let's mock up these objects' current relations to each other.

These are needed by Server... workingImage -> Server workingImageFile -> Server

But Server has to go through... Server <- Spritely <- Session

Additionally, the current Session (there's only one current session object right now, have yet to even move to a multiple session format) is not initialized during Spritely initialization, nor Server initialization, but during the handling of the :heretakethis REST call.

How... obscure...

So we run into a problem here. Where or when should Session be initialized, and where or when should it be assigned the Image file in question?

Oh right, and there's another thing. Inside of Session is an ImageSet object that stores the actual files, which Spritely directly references in its getImageFile method. (Little outline, above, has been updated)

ca2longoria commented 10 years ago

What have I done!?

Oh well, let's get to work.

ca2longoria commented 10 years ago

As noted by GitHub, Issue concerning overlaying organizational structure is #8.

ca2longoria commented 10 years ago

Okay, we're abiding by this: spritely-diagram

ca2longoria commented 10 years ago

There's still some debate on the preferred return types of the Spritely -> SpritelyServerPlugin step. At present, they are Map<String,Object>, but really, that was intended for the SpritelyServerPlugin -> Sever step, except that that was decided on the spot to return as a NanoHTTPD.Response.

ca2longoria commented 10 years ago

That can be a new Refactoring issue. One moment...