Package de.iritgo.aktera.core.exception

Examples of de.iritgo.aktera.core.exception.NestedException


    buildConfigs();

    if (roleConfig == null)
    {
      throw new NestedException("Role configuration is null");
    }

    if (logConfig == null)
    {
      throw new NestedException("Log configuration is null");
    }

    if (systemConfig == null)
    {
      throw new NestedException("System configuration is null");
    }

    if (instrConfig == null)
    {
      throw new NestedException("Instrumentation configuration is null");
    }

    DefaultContext c = new DefaultContext();
    String contextPath = System.getProperty(CONFIG_PROPERTY) + System.getProperty("file.separator") + "..";

    c.put("current-dir", contextPath);
    c.put(ContextManagerConstants.THREAD_TIMEOUT, new Long(1000));
    c.put(ContextManagerConstants.THREADS_CPU, new Integer(2));
    c.put(ContextManagerConstants.CONTEXT_DIRECTORY, new File(contextPath));
    c.put(ContextManagerConstants.WORK_DIRECTORY, new File(contextPath + "/tmp"));

    ClassLoader loader = Thread.currentThread().getContextClassLoader();

    c.put(ClassLoader.class.getName(), loader);
    c.put(ContextManagerConstants.PARAMETERS, new Parameters());
    c.put(ContextManagerConstants.CONTAINER_CLASS, KeelContainer.class);
    c.put(ContextManagerConstants.LOGGER_MANAGER_CONFIGURATION, logConfig);
    c.put(ContextManagerConstants.CONFIGURATION, systemConfig);
    c.put(ContextManagerConstants.INSTRUMENT_MANAGER_CONFIGURATION, instrConfig);
    c.put(ContextManagerConstants.LOG_CATEGORY, "keel");

    c.put("keel.config.roles", roleConfig);
    c.put("keel.config.system", systemConfig);
    c.put("keel.config.log", logConfig);
    c.put("keel.config.instr", instrConfig);
    c.put("keel.config.spring.file", springFileConfig.toArray(new String[]
    {}));
    c.put("keel.config.spring.classpath", springClasspathConfig.toArray(new String[]
    {}));
    c.put("keel.config.hibernate", hibernateConfig.toArray(new String[]
    {}));

    /*
     * Set the context for the getLoggerManager() calls below to work
     * we'll set the context again later
     */
    setContext(c);

    /*
     * Create a custom meta-info manager. This gets around the fact
     * that keel-server needs its own sandboxed classpath, which
     * KeelURLClassloader provides for classes. But,
     * java.lang.Classpath doesn't let one override the fact that
     * resources gotten via the load.getResources() is always looked up
     * from the parent loader in addition to the current loader.
     */
    final MetaInfoManager metaManager = createMetaManager(loader);

    c.put(MetaInfoManager.ROLE, metaManager);
    /*
     * Put a logger manager in the Context. NOTE: getLoggerManager()
     * needs a context set in the first place
     */
    c.put(LoggerManager.ROLE, getLoggerManager());
    c.put("keel.loggerManager", getLoggerManager());
    setContext(c);

    /*
     * So far we have been using the primordial logger since the logger
     * config hadn't been read and we did not have enough context. Now
     * we do, so create a proper logger
     */
    try
    {
      logger = getLoggerManager().getLoggerForCategory("keel.container");
    }
    catch (Exception e)
    {
      getLogger().debug("Cannot create Keel logger, using defult logger", e);
    }

    c.put(LifecycleExtensionManager.ROLE, createLifeCycleExtensionManager(c));
    setContext(c);

    /*
     * Create the container
     */
    DefaultContainerManager containerManager = null;

    try
    {
      containerManager = new DefaultContainerManager(context);

      if (containerManager instanceof Initializable)
      {
        ((Initializable) containerManager).initialize();
      }
    }
    catch (ClassNotFoundException e)
    {
      getLogger().error("Error loading KeelContainer class", e);
      throw new NestedException(e);
    }
    catch (Exception e)
    {
      getLogger().error("Error initializing Container Manager", e);
      throw new NestedException(e);
    }

    try
    {
      setProperties(System.getProperty(CONFIG_PROPERTY));
    }
    catch (Exception e)
    {
      throw new NestedException(e);
    }

    return containerManager;
  }
View Full Code Here


    {
      rm.configure(roleConfig);
    }
    catch (ConfigurationException e)
    {
      throw new NestedException("Error configuring role manager", e);
    }

    final KeelMetaInfoManager metaManager = new KeelMetaInfoManager(new Role2MetaInfoManager(rm), loader);

    metaManager.enableLogging(getLoggerManager().getLoggerForCategory("system.meta"));

    try
    {
      metaManager.initialize();
    }
    catch (Exception e)
    {
      throw new NestedException("Error initializing meta manager", e);
    }

    utilRoleManager = rm;
    utilMetaInfoManager = metaManager;
View Full Code Here

    {
      scanDir(System.getProperty(CONFIG_PROPERTY));
    }
    catch (Exception ee)
    {
      throw new NestedException("Exception scanning configuration directory '"
              + System.getProperty("keel.config.dir") + "'", ee);
    }

    writeMergedConfig();
  }
View Full Code Here

    File dirFile = new File(dirToUse);

    if (! dirFile.isDirectory())
    {
      throw new NestedException(dirToUse + "' is not a directory.");
    }

    String[] dir = dirFile.list();

    if (dir == null)
    {
      throw new NestedException("Null array reading directory " + " of " + dirToUse);
    }

    String oneFileName = null;
    DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
View Full Code Here

      String configSet = System.getProperty("keel.config.dir");

      if (configSet == null)
      {
        throw new NestedException("System property keel.config.dir must be set - or specified in web.xml");
      }

      String totalConfig = session.getServletContext().getInitParameter("jms-config");

      if (totalConfig == null)
      {
        /* Use default configuration */
        totalConfig = new String("rmi://localhost:1099/JndiServer");
      }

      StringTokenizer stk = new StringTokenizer(totalConfig, "|");

      while (stk.hasMoreTokens())
      {
        stk.nextToken();

        int clientId = myClients.size() + 1;

        /* Determine from configuration what client to use */
        String clientClass = session.getServletContext().getInitParameter("jms-client");

        if (clientClass == null)
        {
          clientClass = "de.iritgo.aktera.comm.openjms.clients.KeelJmsClientOpenJMS";
          log.info("No jms-client parameter supplied - using default OpenJMS client");
        }

        KeelClient oneClient = null;

        try
        {
          oneClient = (KeelClient) Class.forName(clientClass).newInstance();
        }
        catch (Exception e)
        {
          throw new NestedException(e);
        }

        oneClient.setId(clientId);
        log.info("Configuring Client " + clientId);

        myClients.add(oneClient);
      }
    }

    if (myClients.size() == 0)
    {
      throw new NestedException("No clients configured");
    }

    /* Return the first available client */
    return (KeelClient) myClients.get(0);
  }
View Full Code Here

      return sha.digest(inputData);
    }
    catch (NoSuchAlgorithmException ex)
    {
      throw new NestedException("Error loading SHA Algorithm.", ex);
    }
  }
View Full Code Here

       */
      buildConfigs();

      if (roleConfig == null)
      {
        throw new NestedException("Role configuration is null");
      }

      if (logConfig == null)
      {
        throw new NestedException("Log configuration is null");
      }

      if (systemConfig == null)
      {
        throw new NestedException("System configuration is null");
      }

      if (instrConfig == null)
      {
        throw new NestedException("Instrumentation configuration is null");
      }

      /*
       * Build the context for the container
       */
      DefaultContext c = new DefaultContext();
      String contextPath = System.getProperty(CONFIG_PROPERTY) + System.getProperty("file.separator") + "..";

      c.put("current-dir", contextPath);
      c.put(ContextManagerConstants.THREAD_TIMEOUT, new Long(1000));
      c.put(ContextManagerConstants.THREADS_CPU, new Integer(2));
      c.put(ContextManagerConstants.CONTEXT_DIRECTORY, new File(contextPath));
      c.put(ContextManagerConstants.WORK_DIRECTORY, new File(contextPath + "/tmp"));

      ClassLoader loader = Thread.currentThread().getContextClassLoader();

      c.put(ClassLoader.class.getName(), loader);
      c.put(ContextManagerConstants.PARAMETERS, new Parameters());
      c.put(ContextManagerConstants.CONTAINER_CLASS, KeelContainer.class);
      c.put(ContextManagerConstants.LOGGER_MANAGER_CONFIGURATION, logConfig);
      c.put(ContextManagerConstants.CONFIGURATION, systemConfig);
      c.put(ContextManagerConstants.INSTRUMENT_MANAGER_CONFIGURATION, instrConfig);
      c.put(ContextManagerConstants.LOG_CATEGORY, "keel");

      /*
       * Set the context for the getLoggerManager() calls below to work
       * we'll set the context again later
       */
      setContext(c);

      /*
       * Create a custom meta-info manager.  This gets around the fact that
       * keel-server needs its own sandboxed classpath, which KeelURLClassloader
       * provides for classes.  But, java.lang.Classpath doesn't let one
       * override the fact that resources gotten via the load.getResources() is
       * always looked up from the parent loader in addition to the current loader.
       */
      final MetaInfoManager metaManager = createMetaManager(loader);

      c.put(MetaInfoManager.ROLE, metaManager);

      /*
       * Put a logger manager in the Context.
       * NOTE: getLoggerManager() needs a context set in the first place
       */
      c.put(LoggerManager.ROLE, getLoggerManager());
      setContext(c);

      /*
       * So far we have been using the primordial logger since
       * the logger config hadn't been read and we did not have
       * enough context.
       * Now we do, so create a proper logger
       */
      try
      {
        logger = getLoggerManager().getLoggerForCategory("keelserver");
      }
      catch (Exception e)
      {
        getLogger().debug("Cannot create Keel logger, using defult logger", e);
      }

      c.put(LifecycleExtensionManager.ROLE, createLifeCycleExtensionManager(c));
      setContext(c);

      /*
       * Create the container
       */
      try
      {
        containerManager = new DefaultContainerManager(context);

        if (containerManager instanceof Initializable)
        {
          ((Initializable) containerManager).initialize();
        }

        myContainer = (KeelContainer) containerManager.getContainer();

        if (myContainer == null)
        {
          throw new NestedException(
                  "Container returned from containerManager was null - unable to initialize. Check log");
        }

        serviceManager = myContainer.getServiceManager();
      }
      catch (ClassNotFoundException e)
      {
        getLogger().error("Error loading KeelContainer class", e);
        throw new NestedException(e);
      }
      catch (Exception e)
      {
        getLogger().error("Error initializing Container Manager", e);
        throw new NestedException(e);
      }

      try
      {
        setProperties(System.getProperty(CONFIG_PROPERTY));
      }
      catch (Exception e)
      {
        throw new NestedException(e);
      }
    }

    return myContainer;
  }
View Full Code Here

    {
      rm.configure(roleConfig);
    }
    catch (ConfigurationException e)
    {
      throw new NestedException("Error configuring role manager", e);
    }

    final KeelMetaInfoManager metaManager = new KeelMetaInfoManager(new Role2MetaInfoManager(rm), loader);

    metaManager.enableLogging(getLoggerManager().getLoggerForCategory("system.meta"));

    try
    {
      metaManager.initialize();
    }
    catch (Exception e)
    {
      throw new NestedException("Error initializing meta manager", e);
    }

    utilRoleManager = rm;
    utilMetaInfoManager = metaManager;
View Full Code Here

      scanDir(System.getProperty(CONFIG_PROPERTY));
      System.err.println("");
    }
    catch (Exception ee)
    {
      throw new NestedException("Exception scanning configuration directory '"
              + System.getProperty("keel.config.dir") + "'", ee);
    }

    try
    {
View Full Code Here

    File dirFile = new File(dirToUse);

    if (! dirFile.isDirectory())
    {
      throw new NestedException(dirToUse + "' is not a directory.");
    }

    String[] dir = dirFile.list();

    if (dir == null)
    {
      throw new NestedException("Null array reading directory " + " of " + dirToUse);
    }

    String oneFileName = null;

    DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
View Full Code Here

TOP

Related Classes of de.iritgo.aktera.core.exception.NestedException

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.