Beispiel #1
0
 /**
  * @param hostname
  * @param port
  * @param name
  * @param keepAlive
  */
 protected void setupServerFromParameters(String hostname, int port, String name, int keepAlive)
     throws IOException, IDCreateException {
   final String hostnamePort = hostname + ":" + port; // $NON-NLS-1$
   synchronized (serverGroups) {
     SSLServerSOContainerGroup serverGroup =
         (SSLServerSOContainerGroup) serverGroups.get(hostnamePort);
     if (serverGroup == null) {
       System.out.println(
           "Putting server " + hostnamePort + " on the air..."); // $NON-NLS-1$ //$NON-NLS-2$
       try {
         serverGroup = new SSLServerSOContainerGroup(hostname, port);
         final String url =
             SSLServerSOContainer.DEFAULT_PROTOCOL
                 + "://" //$NON-NLS-1$
                 + hostnamePort
                 + name;
         // Create
         final SSLServerSOContainer container =
             createServerContainer(url, serverGroup, name, keepAlive);
         // Configure
         configureServerContainer(container);
         // Put on the air
         serverGroup.putOnTheAir();
       } catch (final IOException e) {
         e.printStackTrace(System.err);
         throw e;
       } catch (IDCreateException e) {
         e.printStackTrace(System.err);
         throw e;
       }
       serverGroups.put(hostnamePort, serverGroup);
       System.out.println(
           "SSLGenericServerContainer "
               + hostnamePort
               + " on the air."); //$NON-NLS-1$ //$NON-NLS-2$
     } else {
       System.out.println(
           "SSLGenericServerContainer "
               + hostnamePort //$NON-NLS-1$
               + " already on the air.  No changes made."); //$NON-NLS-1$
     }
   }
 }
Beispiel #2
0
 protected void setupServerFromConfig(List connectors) throws IOException, IDCreateException {
   for (final Iterator i = connectors.iterator(); i.hasNext(); ) {
     final Connector connector = (Connector) i.next();
     final String hostname = connector.getHostname();
     final int port = connector.getPort();
     final String hostnamePort = hostname + ":" + port; // $NON-NLS-1$
     SSLServerSOContainerGroup serverGroup = null;
     synchronized (serverGroups) {
       serverGroup = (SSLServerSOContainerGroup) serverGroups.get(hostnamePort);
       if (serverGroup == null) {
         System.out.println(
             "Putting server " + hostnamePort + " on the air..."); // $NON-NLS-1$ //$NON-NLS-2$
         serverGroup = new SSLServerSOContainerGroup(hostname, port);
         final List groups = connector.getGroups();
         for (final Iterator g = groups.iterator(); g.hasNext(); ) {
           final NamedGroup group = (NamedGroup) g.next();
           // Create
           final SSLServerSOContainer container =
               createServerContainer(
                   group.getIDForGroup(), serverGroup, group.getName(), connector.getTimeout());
           // Configure
           configureServerContainer(container);
         }
         serverGroup.putOnTheAir();
         serverGroups.put(hostnamePort, serverGroup);
         System.out.println(
             "GenericServerContainer "
                 + hostnamePort //$NON-NLS-1$
                 + " on the air."); //$NON-NLS-1$
       } else {
         System.out.println(
             "GenericServerContainer "
                 + hostnamePort //$NON-NLS-1$
                 + " already on the air.  No changes made."); //$NON-NLS-1$
       }
     }
   }
 }
Beispiel #3
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.equinox.app.IApplication#stop()
  */
 public void stop() {
   synchronized (serverGroups) {
     for (final Iterator i = serverGroups.keySet().iterator(); i.hasNext(); ) {
       final SSLServerSOContainerGroup serverGroup =
           (SSLServerSOContainerGroup) serverGroups.get(i.next());
       serverGroup.takeOffTheAir();
       System.out.println(
           "Taking "
               + serverGroup.getName()
               + ":"
               + serverGroup.getPort()
               + " off the air"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
       final Iterator iter = serverGroup.elements();
       for (; iter.hasNext(); ) {
         final SSLServerSOContainer container = (SSLServerSOContainer) iter.next();
         container.dispose();
       }
     }
   }
   serverGroups.clear();
   synchronized (this) {
     this.notify();
   }
 }