001 /* 002 Renaud Pawlak, pawlak@cnam.fr, CEDRIC Laboratory, Paris, France. 003 Lionel Seinturier, Lionel.Seinturier@lip6.fr, LIP6, Paris, France. 004 005 JAC-Core is free software. You can redistribute it and/or modify it 006 under the terms of the GNU Library General Public License as 007 published by the Free Software Foundation. 008 009 JAC-Core is distributed in the hope that it will be useful, but 010 WITHOUT ANY WARRANTY; without even the implied warranty of 011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 012 013 This work uses the Javassist system - Copyright (c) 1999-2000 014 Shigeru Chiba, University of Tsukuba, Japan. All Rights Reserved. */ 015 016 package org.objectweb.jac.aspects.distribution.bootstrap; 017 018 import org.objectweb.jac.core.*; 019 import org.objectweb.jac.core.dist.*; 020 import org.objectweb.jac.aspects.distribution.consistency.*; 021 022 /** 023 * The following class binds a new Jac client to a Jac distributed system. */ 024 025 public class BindClient { 026 027 /** 028 * This method is the entry point for a Jac application launched 029 * with the -C option. */ 030 031 public static void main( String[] args ) throws Throwable { 032 033 System.out.println( 034 "--- Binding to the distributed namespace and aspect-space ---" ); 035 System.out.println( 036 "--- Topology is " + Topology.get() + " ---" ); 037 038 /** We suppose that the Jac reference server is running on s0. */ 039 Topology.get().addContainer ( RemoteContainer.resolve ( "s0" ) ); 040 ((ACManager)ACManager.get()).registering = true; 041 Consistency.bindToDistObj( "JAC_ac_manager", (Wrappee) ACManager.get() ); 042 Consistency.bindToDistObj( "JAC_topology", (Wrappee) Topology.get() ); 043 Consistency.bindToDistObj( "JAC_application_repository", 044 (Wrappee) ApplicationRepository.get() ); 045 Topology.get().addContainer ( RemoteContainer.resolve ( args[0] ) ); 046 ((ACManager)ACManager.get()).registering = false; 047 048 System.out.println( 049 "--- End of binding ---" ); 050 System.out.println( 051 "--- New topology is " + Topology.get() + " ---" ); 052 053 } 054 055 } 056 057 058 059 060