Source code: demo/tucson/chat/ChatRoom.java
1 /*
2 * Chat TuCSoN Demo - Copyright (C) 2001 deis.unibo.it
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 package demo.tucson.chat;
19
20 import alice.logictuple.*;
21 import alice.infrastructure.Tucson;
22 import alice.tucson.*;
23
24 /**
25 * The Chat Room setups the tuple centre,
26 * with proper specification.
27 *
28 * @author Alessandro Ricci
29 *
30 */
31 public class ChatRoom {
32
33 public static void main (String args[]) throws Exception {
34 if (args.length!=1){
35 System.err.println("args: < TuCSon node (host name) where installing the chat room>");
36 System.exit(-1);
37 }
38 TupleCentreId tid=new TupleCentreId("chat_room",args[0]);
39 try {
40 Tucson.setSpec(tid,new LogicTuple(alice.util.Tools.loadText("demo/tucson/chat/chat_spec.rsp")));
41 System.out.println("ok.");
42 } catch (Exception ex){
43 System.err.println("invalid TuCSoN node.");
44 System.exit(-1);
45 }
46 }
47 }