001 /* 002 Copyright (C) 2001 Renaud Pawlak <renaud@aopsys.com> 003 004 This program is free software; you can redistribute it and/or modify 005 it under the terms of the GNU Lesser General Public License as 006 published by the Free Software Foundation; either version 2 of the 007 License, or (at your option) any later version. 008 009 This program is distributed in the hope that it will be useful, 010 but WITHOUT ANY WARRANTY; without even the implied warranty of 011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 GNU Lesser General Public License for more details. 013 014 You should have received a copy of the GNU Lesser Generaly Public License 015 along with this program; if not, write to the Free Software 016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 017 018 package org.objectweb.jac.aspects.distribution.bootstrap; 019 020 import org.apache.log4j.Logger; 021 import org.objectweb.jac.aspects.distribution.consistency.*; 022 import org.objectweb.jac.core.*; 023 import org.objectweb.jac.core.dist.*; 024 import org.objectweb.jac.util.Log; 025 026 /** 027 * The following class bootstraps the Jac distributed system. */ 028 029 public class DistBootstrap { 030 static Logger logger = Logger.getLogger("dist"); 031 032 /** 033 * This method is the entry point for a Jac application launched 034 * with the -D option. */ 035 036 public static void main( String[] args ) throws Throwable { 037 logger.debug("bootstrapping the distributed system"); 038 039 Topology.get().bootstrapFlag = true; 040 logger.debug("local container is "+Distd.getLocalContainerName()); 041 Topology.get().addContainer(Distd.getLocalContainerName()); 042 043 logger.debug("topology is "+Topology.get()); 044 045 // installation of a strong consistency protocol on all 046 // the system objects 047 048 logger.debug("installing consistency protocols"); 049 050 ConsistencyWrapper.wrap((Wrappee)ApplicationRepository.get(), 051 StrongPushConsistencyWrapper.class, 052 null, 053 new String[] { "addApplication", 054 "extend", 055 "unextend" }, 056 null, 057 ".*"); 058 059 ConsistencyWrapper.wrap( 060 (Wrappee)Topology.get(), 061 StrongPushConsistencyWrapper.class, 062 null, 063 new String[] { "addContainer(org.objectweb.jac.core.dist.RemoteContainer)", 064 "removeContainer" }, 065 null, 066 ".*"); 067 068 Topology.get().bootstrapFlag = false; 069 logger.debug("end of bootstrap"); 070 } 071 072 }