private void addServletsToContext(ServletContextHandler context)
     throws InstantiationException, IllegalAccessException, ClassNotFoundException, Exception {
   synchronized (servletSpecs) {
     Iterator<ServletSpec> servletsIter = servletSpecs.iterator();
     while (servletsIter.hasNext()) {
       ServletSpec spec = servletsIter.next();
       addServletToContext(context, spec);
     }
   }
 }
  public void commence() {
    Properties properties = System.getProperties();

    // TODO put this in a commence() method, and close stores on conclude().
    startStores(properties);

    // grab the content and definition paths
    // it is possible to have a content stored without a definition and vice versa

    // -mg- not sure this is really necessary. should just hand off to store to try and
    // load and fail silently if path cannot be found
    HashSet<MeemPath> paths = new HashSet<MeemPath>();
    paths.addAll(contentStore.getAllPaths());
    paths.addAll(definitionStore.getAllPaths());

    for (MeemPath meemPath : paths) {
      meemPaths.put(meemPath.getLocation(), meemPath);
    }
  }
  private void addServlet(ServletSpec spec) {
    synchronized (servletSpecs) {
      servletSpecs.add(spec);
      try {
        // TODO make sure context has appropriate settings
        // servletContext.getSessionHandler().getSessionManager().getSessionCookieConfig().setName(name)

        addServletToContext(servletContext, spec);
      } catch (Exception ex) {
        logger.log(Level.INFO, "Could not add servlet", ex);
        lifeCycleControlConduit.vote(meemContext.getWedgeIdentifier(), false);
        return;
      }
    }
  }
  protected void stopServer() {
    if (server != null) {
      try {
        server.stop();
        server = null;
      } catch (Exception ex) {
        logger.log(Level.INFO, "A problem occurred when stopping the server", ex);
      }
    }
    handlerCollection = null;
    servletContext = null;

    servletSpecs.clear();
    resourceSpecs.clear();
  }