AmbientHackystat-ui-wicket

The online User Interface for the Ambient-HackyStat project.

Personals: 

Home

Blog: http://taesup.blogspot.com/

Biography

Projects:

Done:
MyIsern 2.0
AmbientHackyStat
Ambienthackystat-ui-wicket

 In Progress
Inventory Manager

Paperwork: 

 Resume

To fully understand the scope of this project, please visit the  Ambient Devices page.


Introduction

The ambient server, at its current state, can only be run from the command line because it has no user interface. This also creates implications with editing the configuration file for the ambient server.  To edit a configuration file, a user must open the configuration file and edit its contents manually.  Additionally, the ambient server needs to be restarted every time changes are made to a configuration file in order for the changes to take effect.

One of the goals of the project is to simplify the editing of the configuration file for running the ambient server.  With the user interface, we hope to eliminate the editing of a configuration file manually.  We hope to display the configuration file through the user interface and have the user edit the file through the interface.  Additionally, we hope that it will automate the restart process of the ambient server.  This means that the user does not even have to touch the ambient server file as everything should and can be done from the user interface.

History

To implement the user interface, we started with the idea of user Flash and Flex but realized that the framework really wasn't what we needed. Flex and Flash seems to client side software which make it extremely difficult to grab a configuration file from the server, edit that file, and return it to the server without worrying about security issues. 

We then fell back on what we used for the MyIsern project. We decided to use the Stripes Java Framework but found much difficulty in setting up the JSP pages. This did solves our problem of grabbing the configuration file from the server and editing it, because that file never leaves the server. There is also a proper authentication protocol included with Stripes. Eventually we dropped this idea too.

Another group was using the Java Wicket web framework and we decided to give it a try on the encouragement of Prof. Johnson. We found that althrough there was a steep learning curve, and less then three weeks left for the project, this was the best choice for the project. So with three weeks left and the Prof. Project browser project as an example to work off of, we bought a copy of "Pro Wicket" and got to it.

What I worked on

For the course of this project, I worked on the general framework of the project. Although it's nothing that I'm really proud of, I think the user interface gets the job done. I actually have some experience in developing webpages but using Wicket was something completely different. Wicket is made with a Java developer in mind, so it render most of the webpage for you. I'm used to using HTML and CSS so there really wasn't much to edit there, just more code to learn in Wicket.

 I had to learn many of the intricacies of Wicket such as making a table in Wicket using the listView method. Basically you had to get all the items needed for the list, set the list, then populate the table. Here's an example of one of the things I worked on.

Getting the items and setting the list: 



public ChooseTAPTable(String id, String projectName) {
super(id);

project = ProjectBrowserSession.get().getProjectTypeXMLByNameId(projectName);

if (project.getTriggerActionPairs() == null) {
System.out.println("No Trigger Action pairs available.");
}

else {
pairs = project.getTriggerActionPairs().getTriggerActionPair();
setList(pairs);
}

}


Then you had to populate the table: 



protected void populateItem(ListItem item) {
TriggerActionPair pair = (TriggerActionPair) item.getModelObject();
item.add(new Label("TAPName", pair.getId()));
// FOR NOW POINT TO THE SET TRIGGER PAGE BECAUSE WE HAVE NO PAGE TO POINT TO

PageParameters param2 = new PageParameters();
param2.put("projectName", project.getProjectName());
// item.add(new BookmarkablePageLink("NewTAP", NewTAP.class, param2));
param2.put("tapName", pair.getId());
item.add(new BookmarkablePageLink("EditId", EditTAP.class, param2));
item.add(new BookmarkablePageLink("projectLink", ChooseTrigger.class, param2));
item.add(new DeleteTriggerActionPairLink("deleteTriggerActionPair", pair.getId(), project
.getProjectName()));
}

The results:

 As you can see, the code itself is really easy to work with once you've learned the basics. But there is a steep learning curve with actually setting up a page. Also learning to set up a login page was quite difficult to learn but thanks to the examples and Prof Johnson's Project Browser code I was able to understand most of it. 
 
Results

At the end of three weeks, this project is what we came up with. Using the Wicket framework we created a page that will load the configuration page and let you edit the Trigger/Action Pairs according to the user's wishes. We can also save these change back to the configuration page and automatically restart the AmbientServer to work with these changes. There is also a login page for authentication. 

Here's the link to the project home page: http://code.google.com/p/ambienthackystat-ui-wicket