1 package remote
.service
.motedata
.client
;
3 import java
.util
.Hashtable
;
4 import diku
.distlab
.remote
.motedata
.*;
5 import remote
.motecontrol
.client
.Session
;
7 public class MoteDataWrapper
{
8 private static MoteDataServiceLocator motedataLocator
= new MoteDataServiceLocator();
10 private static SimpleTable moteList
= null;
11 private static SimpleTableWrapper moteTable
= null;
12 private static Hashtable moteIndex
= null;
13 private static Session session
= null;
15 public static Table
getMoteTable() {
16 if (moteTable
== null)
18 moteTable
= new SimpleTableWrapper(getMoteList());
23 public static Hashtable
getMoteIndex() {
27 public static void updateMoteList() {
30 moteList
= motedataLocator
.getmotedata().getMoteData(session
.getSessionId());
31 ((SimpleTableWrapper
)getMoteTable()).updateTable(moteList
);
32 moteIndex
= createIndex(moteList
,0);
40 private static SimpleTable
getMoteList()
46 moteList
= motedataLocator
.getmotedata().getMoteData(session
.getSessionId());
56 static Hashtable
createIndex(SimpleTable table
, int col
)
58 Hashtable index
= new Hashtable();
59 for (int i
= 0 ; i
< table
.getData().length
; i
++ )
61 index
.put(table
.getData()[i
][col
], table
.getData()[i
]);
66 public static void setSession(Session session
) {
67 MoteDataWrapper
.session
= session
;
68 String url
="http://"+session
.getServerConnection().getConnectionInfo().getServerName()+":8080/axis/services/motedata";
69 motedataLocator
.setmotedataEndpointAddress(url
);