Package fr.dyade.aaa.agent.conf

Examples of fr.dyade.aaa.agent.conf.A3CMLServer


   * be up, then it initializes all <code>AgentServer</code> structures from
   * the <code>A3CMLConfig</code> ones. In particular the servers array is
   * initialized.
   */
  private static void configure() throws Exception {
    A3CMLServer root = getConfig().getServer(serverId, clusterId);
    //Allocates the temporary descriptors hashtable for each server.
    servers = new ServersHT();
    // Initialized the descriptor of current server in order to permit
    // Channel and Engine initialization.
    ServerDesc local = new ServerDesc(root.sid, root.name, root.hostname, -1);
    servers.put(local);

    // Parse configuration in order to fix route related to the
    // current server
    getConfig().configure(root);

    // Creates all the local MessageConsumer.
    createConsumers(root);
   
    for (Enumeration s = getConfig().servers.elements();
         s.hasMoreElements();) {
      A3CMLServer server = (A3CMLServer) s.nextElement();
      if (server.sid == root.sid) continue;

      ServerDesc desc = createServerDesc(server);
      addServerDesc(desc);
    }

    // for clusters
    for (Enumeration c = getConfig().clusters.elements();
         c.hasMoreElements();) {
      A3CMLCluster cluster = (A3CMLCluster) c.nextElement();

      for (Enumeration s = cluster.servers.elements();
           s.hasMoreElements();) {
        A3CMLServer server = (A3CMLServer) s.nextElement();
        if (server.sid == root.sid) continue;

        ServerDesc desc = servers.get(server.sid);
        if (desc == null) {
          desc = createServerDesc(server);
View Full Code Here


    // For each server set the gateway to the real next destination of
    // messages; if the server is directly accessible: itself.
    if ((desc.gateway == -1) || (desc.gateway == server.sid)) {
      desc.gateway = server.sid;
      desc.updateSockAddr(desc.getHostname(), server.port);  
      A3CMLServer current = getConfig().getServer(getServerId(),getClusterId());
      if (current.containsNat(server.sid)) {
        A3CMLNat nat = current.getNat(server.sid);
        desc.updateSockAddr(nat.host, nat.port);
        if (logmon.isLoggable(BasicLevel.DEBUG))
          logmon.log(BasicLevel.DEBUG, getName() + " : NAT sDesc = " + desc);
      }
    }
View Full Code Here

          logmon.log(BasicLevel.DEBUG,
                     getName() + " : Adds global property: " + p.name + " = " + p.value);
      }
    }

    A3CMLServer server = null;
    if (cid != NULL_ID) {
      A3CMLCluster cluster = null;
      cluster = a3config.getCluster(sid);

      // add cluster properties
View Full Code Here

        if (a3config == null) {
          // 3rd, Generate A3CMLConfig base.
          logmon.log(BasicLevel.WARN, "Generate default configuration");
          A3CMLDomain d = new A3CMLDomain(ADMIN_DOMAIN, SimpleNetwork.class.getName());
          A3CMLServer s = new A3CMLServer((short) 0, ADMIN_SERVER, "localhost");
          s.networks.addElement(new A3CMLNetwork(ADMIN_DOMAIN, 27300));
          d.addServer(s);
          a3config = new A3CMLConfig();
          a3config.addDomain(d);
          a3config.addServer(s);
View Full Code Here

      throw new Exception("Server not found: " + routerId);
   
    // Update the configuration (can't fail)
    A3CMLDomain domain = new A3CMLDomain(domainName, network);
    a3cmlConfig.addDomain(domain);
    A3CMLServer a3cmlServer = a3cmlConfig.getServer((short) routerId);
    domain.addServer(a3cmlServer);
    A3CMLNetwork a3cmlNetwork = new A3CMLNetwork(domainName, port);
    a3cmlServer.addNetwork(a3cmlNetwork);

    A3CMLServer root = a3cmlConfig.getServer(AgentServer.getServerId());
    a3cmlConfig.configure(root);

    boolean res = false;
    if (routerId == AgentServer.getServerId()) {
      // Create and start the run-time entities (may fail)
View Full Code Here

    // can't be removed. The servers belonging to the domain must
    // first be removed.
    if (domain.servers.size() > 1)
      throw new Exception("Can't remove domain: it contains more than one server.");

    A3CMLServer router = null;   
    if (domain.servers.size() == 1) {
      router = (A3CMLServer) domain.servers.elementAt(0);
    }
   
    // Update the configuration and the run-time entities
    // at the same time (can't fail)
    a3cmlConfig.removeDomain(domainName);
   
    if (router != null) {
      router.removeNetwork(domainName);
    }

    A3CMLServer root = a3cmlConfig.getServer(AgentServer.getServerId());
    a3cmlConfig.configure(root);

    boolean res = false;
    if (router != null &&
        router.sid == AgentServer.getServerId()) {
View Full Code Here

    if (a3cmlConfig.servers.get(new Integer(sid)) != null)
      throw new ServerIdAlreadyUsedException("Server id already used: " + sid);
   
    A3CMLDomain domain = a3cmlConfig.getDomain(domainName);
   
    A3CMLServer server = new A3CMLServer((short)sid, name, hostName);
    a3cmlConfig.addServer(server);

    A3CMLNetwork network = new A3CMLNetwork(domainName, port);
    server.addNetwork(network);
    domain.addServer(server);
    server.domain = domainName;

    A3CMLServer root = a3cmlConfig.getServer(AgentServer.getServerId());
    a3cmlConfig.configure(root);
   
    // Adds the server in the configuration structure
   
    ServerDesc desc = new ServerDesc((short)sid, name, hostName, -1);
View Full Code Here

      logger.log(BasicLevel.DEBUG,
                 "ServerConfigHelper.removeServer(" +
                 sid + ')');
    if (sid != AgentServer.getServerId()) {
      A3CMLConfig a3cmlConfig = AgentServer.getConfig();
      A3CMLServer a3cmlServer = a3cmlConfig.getServer((short)sid);
     
      if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log(BasicLevel.DEBUG,
                 " -> server.networks = " + a3cmlServer.networks);

      // Check that the server doesn't belong to more than one
      // domain.
      if (a3cmlServer.networks.size() > 1)
        throw new Exception(
          "Can't remove server: it belongs to more than one domain.");

      a3cmlConfig.removeServer((short)sid);
     
      A3CMLServer root = a3cmlConfig.getServer(AgentServer.getServerId());
      a3cmlConfig.configure(root);
     
      ServerDesc servDesc =
        AgentServer.removeServerDesc((short)sid);
     
View Full Code Here

    throws Exception {
    if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log(BasicLevel.DEBUG,
                 "ServerConfigHelper.addService(" + sid + ',' + className + ',' + args + ')');
    A3CMLConfig a3cmlConfig = AgentServer.getConfig();
    A3CMLServer a3cmlServer = a3cmlConfig.getServer((short)sid);
    A3CMLService a3cmlService = new A3CMLService(className, args);
    a3cmlServer.addService(a3cmlService);
   
    if (sid == AgentServer.getServerId()) {
      try {
        ServiceManager.register(className, args);
        ServiceDesc desc = (ServiceDesc) ServiceManager.manager.registry.get(className);
        if (! desc.running) {
          ServiceManager.start(desc);
        }
      } catch (Exception exc) {
        a3cmlServer.removeService(className);
      }
    }

    if (autoCommit) commit();
  }
View Full Code Here

    if (logger.isLoggable(BasicLevel.DEBUG))
      logger.log(BasicLevel.DEBUG,
                 "ServerConfigHelper.addService(" +
                 sid + ',' + className + ')');
    A3CMLConfig a3cmlConfig = AgentServer.getConfig();
    A3CMLServer a3cmlServer = a3cmlConfig.getServer((short)sid);
   
    if (sid == AgentServer.getServerId()) {
      ServiceManager.stop(className);
    }

    a3cmlServer.removeService(className);

    if (autoCommit) commit();
  }
View Full Code Here

TOP

Related Classes of fr.dyade.aaa.agent.conf.A3CMLServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.