1 package at.ac.tuwien.sbc.valesriegler.group;
3 import java.io.Serializable;
4 import java.rmi.server.Operation;
5 import java.util.ArrayList;
8 import javax.management.Notification;
9 import javax.management.NotificationListener;
10 import javax.swing.SwingUtilities;
12 import org.mozartspaces.core.CapiUtil;
13 import org.mozartspaces.core.Entry;
15 import at.ac.tuwien.sbc.valesriegler.common.Util;
16 import at.ac.tuwien.sbc.valesriegler.group.gui.GroupOverviewModel;
17 import at.ac.tuwien.sbc.valesriegler.group.jms.JMSGroupConnector;
18 import at.ac.tuwien.sbc.valesriegler.types.GroupData;
19 import at.ac.tuwien.sbc.valesriegler.xvsm.XVSMConnector;
22 * The Main class of the Group component.
24 * Start the communication and the group GUI:
26 * @author Gregor Riegler <gregor DOT riegler AT gmail DOT com>
30 public class GroupAgent {
33 public static GroupAgent groupAgent;
34 private GroupOverviewModel groupModel;
35 private AbstractGroupConnector groupconn;
36 private XVSMConnector xvsm;
38 public static void main(String[] args) {
39 // TODO: use jms and xvsm manager here.
40 groupAgent = new GroupAgent(new JMSGroupConnector());
42 SwingUtilities.invokeLater(new GroupGUI());
45 public GroupAgent(JMSGroupConnector groupconn) {
46 groupModel = new GroupOverviewModel();
48 this.groupconn = groupconn;
52 xvsm = new XVSMConnector();
53 xvsm.initSpaceCommunication();
54 xvsm.useGroupsContainer();
59 public static GroupAgent getInstance() {
63 public AbstractGroupConnector getGroupcomm() {
67 public GroupOverviewModel getGroupModel() {
71 public void onGroupsCreated(List<Group> newGroups) {
73 List<GroupData> groupData = new ArrayList<>();
75 for (Group group : newGroups) {
76 groupData.add(group.getGroupData());
78 xvsm.createGroups(groupData);