KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2   Renaud Pawlak, pawlak@cnam.fr, CEDRIC Laboratory, Paris, France.
3   Lionel Seinturier, Lionel.Seinturier@lip6.fr, LIP6, Paris, France.
4
5   JAC-Core is free software. You can redistribute it and/or modify it
6   under the terms of the GNU Library General Public License as
7   published by the Free Software Foundation.
8   
9   JAC-Core is distributed in the hope that it will be useful, but
10   WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13   This work uses the Javassist system - Copyright (c) 1999-2000
14   Shigeru Chiba, University of Tsukuba, Japan. All Rights Reserved. */

15
16 package org.objectweb.jac.aspects.distribution.bootstrap;
17
18 import org.objectweb.jac.core.*;
19 import org.objectweb.jac.core.dist.*;
20 import org.objectweb.jac.aspects.distribution.consistency.*;
21
22 /**
23  * The following class binds a new Jac client to a Jac distributed system. */

24
25 public class BindClient {
26
27    /**
28     * This method is the entry point for a Jac application launched
29     * with the -C option. */

30
31    public static void main( String JavaDoc[] args ) throws Throwable JavaDoc {
32
33       System.out.println(
34          "--- Binding to the distributed namespace and aspect-space ---" );
35       System.out.println(
36          "--- Topology is " + Topology.get() + " ---" );
37
38       /** We suppose that the Jac reference server is running on s0. */
39       Topology.get().addContainer ( RemoteContainer.resolve ( "s0" ) );
40       ((ACManager)ACManager.get()).registering = true;
41       Consistency.bindToDistObj( "JAC_ac_manager", (Wrappee) ACManager.get() );
42       Consistency.bindToDistObj( "JAC_topology", (Wrappee) Topology.get() );
43       Consistency.bindToDistObj( "JAC_application_repository",
44                                  (Wrappee) ApplicationRepository.get() );
45       Topology.get().addContainer ( RemoteContainer.resolve ( args[0] ) );
46       ((ACManager)ACManager.get()).registering = false;
47
48       System.out.println(
49          "--- End of binding ---" );
50       System.out.println(
51          "--- New topology is " + Topology.get() + " ---" );
52
53    }
54
55 }
56
57
58
59
60
61
Popular Tags