Package org.mobicents.protocols.api

Examples of org.mobicents.protocols.api.Server


    management.setSingleThread(true);
    management.start();
    management.removeAllResourses();

    String[] arr = new String[]{"127.0.0.2", "127.0.0.3"};
    Server server = management.addServer(SERVER_NAME, SERVER_HOST, SERVER_PORT, ipChannelType, true, 5, arr);

    management.startServer(SERVER_NAME);

    assertTrue(server.isStarted());

    management.stop();

    management = new ManagementImpl("ManagementTest");
    // start again
    management.start();

    List<Server> servers = management.getServers();
    assertEquals(1, servers.size());

    server = servers.get(0);
    assertTrue(server.isStarted());

    // Add association
    management.addServerAssociation(CLIENT_HOST, CLIENT_PORT, SERVER_NAME, SERVER_ASSOCIATION_NAME, ipChannelType);

    assertEquals(management.getAssociations().size(), 1);
View Full Code Here


      }
    }

    FastList<Server> tempServers = servers;
    for (FastList.Node<Server> n = tempServers.head(), end = tempServers.tail(); (n = n.getNext()) != end;) {
      Server serverTemp = n.getValue();
      if (serverTemp.isStarted()) {
        try {
          ((ServerImpl) serverTemp).stop();
        } catch (Exception e) {
          logger.error(String.format("Exception while stopping the Server=%s", serverTemp.getName()), e);
        }
      }
    }

    if (this.executorServices != null) {
View Full Code Here

            }     

      this.servers = reader.read(SERVERS, FastList.class);

      for (FastList.Node<Server> n = this.servers.head(), end = this.servers.tail(); (n = n.getNext()) != end;) {
        Server serverTemp = n.getValue();
        ((ServerImpl) serverTemp).setManagement(this);
        if (serverTemp.isStarted()) {
          try {
            ((ServerImpl) serverTemp).start();
          } catch (Exception e) {
            logger.error(String.format("Error while initiating Server=%s", serverTemp.getName()), e);
          }
        }
      }

      this.associations = reader.read(ASSOCIATIONS, AssociationMap.class);
View Full Code Here

      throw new Exception("Server host port cannot be less than 1");
    }

    synchronized (this) {
      for (FastList.Node<Server> n = this.servers.head(), end = this.servers.tail(); (n = n.getNext()) != end;) {
        Server serverTemp = n.getValue();
        if (serverName.equals(serverTemp.getName())) {
          throw new Exception(String.format("Server name=%s already exist", serverName));
        }

        if (hostAddress.equals(serverTemp.getHostAddress()) && port == serverTemp.getHostport()) {
          throw new Exception(String.format("Server name=%s is already bound to %s:%d", serverTemp.getName(), serverTemp.getHostAddress(),
              serverTemp.getHostport()));
        }
      }

      ServerImpl server = new ServerImpl(serverName, hostAddress, port, ipChannelType, acceptAnonymousConnections, maxConcurrentConnectionsCount,
          extraHostAddresses);
View Full Code Here

    if (serverName == null) {
      throw new Exception("Server name cannot be null");
    }

    synchronized (this) {
      Server removeServer = null;
      for (FastList.Node<Server> n = this.servers.head(), end = this.servers.tail(); (n = n.getNext()) != end;) {
        ServerImpl serverTemp = (ServerImpl)n.getValue();

        if (serverName.equals(serverTemp.getName())) {
          if (serverTemp.isStarted()) {
View Full Code Here

      throw new Exception("Server name cannot be null");
    }

    FastList<Server> tempServers = servers;
    for (FastList.Node<Server> n = tempServers.head(), end = tempServers.tail(); (n = n.getNext()) != end;) {
      Server serverTemp = n.getValue();

      if (serverName.equals(serverTemp.getName())) {
        if (serverTemp.isStarted()) {
          throw new Exception(String.format("Server=%s is already started", serverName));
        }
        ((ServerImpl) serverTemp).start();
        this.store();
        return;
View Full Code Here

      throw new Exception("Server name cannot be null");
    }

    FastList<Server> tempServers = servers;
    for (FastList.Node<Server> n = tempServers.head(), end = tempServers.tail(); (n = n.getNext()) != end;) {
      Server serverTemp = n.getValue();

      if (serverName.equals(serverTemp.getName())) {
        ((ServerImpl) serverTemp).stop();
        this.store();
        return;
      }
    }
View Full Code Here

    synchronized (this) {
      if (this.associations.get(assocName) != null) {
        throw new Exception(String.format("Already has association=%s", assocName));
      }

      Server server = null;

      for (FastList.Node<Server> n = this.servers.head(), end = this.servers.tail(); (n = n.getNext()) != end;) {
        Server serverTemp = n.getValue();
        if (serverTemp.getName().equals(serverName)) {
          server = serverTemp;
        }
      }

      if (server == null) {
View Full Code Here

      this.associations = newAssociations;
      // this.associations.remove(assocName);

      if (((AssociationImpl) association).getAssociationType() == AssociationType.SERVER) {
        for (FastList.Node<Server> n = this.servers.head(), end = this.servers.tail(); (n = n.getNext()) != end;) {
          Server serverTemp = n.getValue();
          if (serverTemp.getName().equals(association.getServerName())) {
            FastList<String> newAssociations2 = new FastList<String>();
            newAssociations2.addAll(((ServerImpl) serverTemp).associations);
            newAssociations2.remove(assocName);
            ((ServerImpl) serverTemp).associations = newAssociations2;
            // ((ServerImpl)
View Full Code Here

TOP

Related Classes of org.mobicents.protocols.api.Server

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.