public void loadTipi(TipiContext newContext, String fileName, ExtensionDefinition ed)
      throws IOException, TipiException {
    logger.info("Context: " + newContext + " filename: " + fileName);
    InputStream in = newContext.getTipiResourceStream(fileName);

    if (in != null) {
      newContext.parseStream(in, ed);
      newContext.switchToDefinition("startup");
      in.close();

    } else {
      throw new TipiException("Error loading tipi: " + fileName);
    }
  }
 private Map checkForProperties(TipiContext context, Enumeration e) {
   Map result = new HashMap();
   while (e.hasMoreElements()) {
     String current = (String) e.nextElement();
     if (current.startsWith("-D")) {
       String prop = current.substring(2);
       try {
         StringTokenizer st = new StringTokenizer(prop, "=");
         String name = st.nextToken();
         String value = st.nextToken();
         System.setProperty(name, value);
         result.put(name, value);
       } catch (NoSuchElementException ex) {
         logger.info("Error parsing system property");
       }
     }
     if ("tipidef".equals(current)) {
       tipiDef = myServletConfig.getInitParameter(current);
       logger.info("Startup def: " + tipiDef);
       continue;
     }
     context.setSystemProperty(current, myServletConfig.getInitParameter(current));
   }
   return result;
 }
  public Window init() {
    try {
      startup();
    } catch (IOException e) {
      logger.error("Error: ", e);
    }
    TipiScreen echo = (TipiScreen) context.getDefaultTopLevel();

    TipiFrame w = (TipiFrame) echo.getTipiComponent("init");
    if (w == null) {
      throw new RuntimeException("No toplevel found!");
    }
    echo.setWindow(w.getWindow());
    return w.getWindow();
  }
 public void finalize() {
   if (context != null) {
     context.exit();
   }
 }