KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > aspects > distribution > bootstrap > DistBootstrap


1 /*
2   Copyright (C) 2001 Renaud Pawlak <renaud@aopsys.com>
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU Lesser General Public License as
6   published by the Free Software Foundation; either version 2 of the
7   License, or (at your option) any later version.
8
9   This program 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
12   GNU Lesser General Public License for more details.
13
14   You should have received a copy of the GNU Lesser Generaly Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

17
18 package org.objectweb.jac.aspects.distribution.bootstrap;
19
20 import org.apache.log4j.Logger;
21 import org.objectweb.jac.aspects.distribution.consistency.*;
22 import org.objectweb.jac.core.*;
23 import org.objectweb.jac.core.dist.*;
24 import org.objectweb.jac.util.Log;
25
26 /**
27  * The following class bootstraps the Jac distributed system. */

28
29 public class DistBootstrap {
30     static Logger logger = Logger.getLogger("dist");
31
32     /**
33      * This method is the entry point for a Jac application launched
34      * with the -D option. */

35
36     public static void main( String JavaDoc[] args ) throws Throwable JavaDoc {
37         logger.debug("bootstrapping the distributed system");
38
39         Topology.get().bootstrapFlag = true;
40         logger.debug("local container is "+Distd.getLocalContainerName());
41         Topology.get().addContainer(Distd.getLocalContainerName());
42
43         logger.debug("topology is "+Topology.get());
44
45         // installation of a strong consistency protocol on all
46
// the system objects
47

48         logger.debug("installing consistency protocols");
49
50         ConsistencyWrapper.wrap((Wrappee)ApplicationRepository.get(),
51                                 StrongPushConsistencyWrapper.class,
52                                 null,
53                                 new String JavaDoc[] { "addApplication",
54                                                "extend",
55                                                "unextend" },
56                                 null,
57                                 ".*");
58
59         ConsistencyWrapper.wrap(
60             (Wrappee)Topology.get(),
61             StrongPushConsistencyWrapper.class,
62             null,
63             new String JavaDoc[] { "addContainer(org.objectweb.jac.core.dist.RemoteContainer)",
64                            "removeContainer" },
65             null,
66             ".*");
67
68         Topology.get().bootstrapFlag = false;
69         logger.debug("end of bootstrap");
70     }
71
72 }
73
Popular Tags