Package org.impalaframework.module

Examples of org.impalaframework.module.RuntimeModule


    /*
     * ******************* InternalOperationsFacade methods * **************************
     */

    public RuntimeModule getRuntimeModule(String moduleName) {
        final RuntimeModule runtimeModule = getModuleStateHolder().getModule(moduleName);
       
        if (runtimeModule == null) {
            throw new NoServiceException("No module named '" + moduleName + "' has been loaded");
        }
       
View Full Code Here


       
        for (int i = 0; i < dependencies.size(); i++) {
           
            final ModuleDefinition moduleDefinition = dependencies.get(i);
            final String currentName = moduleDefinition.getName();
            final RuntimeModule runtimeModule = graphModuleStateHolder.getModule(currentName);
            if (runtimeModule instanceof SpringRuntimeModule) {
                SpringRuntimeModule spr = (SpringRuntimeModule) runtimeModule;
                applicationContexts.add(spr.getApplicationContext());
            }
        }
View Full Code Here

  protected abstract String getMethodName(CommandState commandState, Class<?> testClass);

  private ClassLoader getTestClassLoader(String testClassName) {
    String currentDirectoryName = getCurrentDirectoryName(true);

    RuntimeModule runtimeModule = null;

    try {
      if (currentDirectoryName != null && !InteractiveCommandUtils.isRootProject(currentDirectoryName)) {
        runtimeModule = Impala.getRuntimeModule(currentDirectoryName);
      }
      else {
        runtimeModule = Impala.getRootRuntimeModule();
      }
    }
    catch (RuntimeException e) {
      System.out.println("No module loaded for current directory: " + currentDirectoryName);
      runtimeModule = Impala.getRootRuntimeModule();
    }

    ClassLoader parentClassLoader = null;

    if (runtimeModule != null)
      parentClassLoader = runtimeModule.getClassLoader();
    else
      parentClassLoader = ClassUtils.getDefaultClassLoader();
   
    ClassLoader testClassLoader = getTestClassLoader(parentClassLoader, testClassName);
    return testClassLoader;
View Full Code Here

        final ClassLoaderRegistry classLoaderRegistry = application.getClassLoaderRegistry();
       
        try {
            beforeModuleLoads(definition);
           
            RuntimeModule runtimeModule;
            try {
                runtimeModule = doLoadModule(application, definition);
            }
            catch (RuntimeException e) {
                classLoaderRegistry.removeClassLoader(definition.getName());
                throw e;
            }
           
            Assert.notNull(classLoaderRegistry);
           
            final String moduleName = definition.getName();
            //note that GraphClassLoaderFactory will also populate the ClassLoaderRegistry, hence, this check
            if (!classLoaderRegistry.hasClassLoaderFor(moduleName)) {
                classLoaderRegistry.addClassLoader(moduleName, runtimeModule.getClassLoader());
               
                if (logger.isDebugEnabled()) {
                    logger.debug("Added new class loader " + ObjectUtils.identityToString(runtimeModule.getClassLoader())
                            + " to class loader registry for module: " + moduleName);
                }
            }
           
            return runtimeModule;
View Full Code Here

        if (moduleStateHolder.getModule(moduleName) == null) {

            ModuleRuntime moduleRuntime = getModuleRuntime(currentDefinition);
           
            try {
                RuntimeModule runtimeModule = moduleRuntime.loadRuntimeModule(application, currentDefinition);
                moduleStateHolder.putModule(moduleName, runtimeModule);
            }
            catch (Throwable e) {
               
                try {
View Full Code Here

        boolean success = true;

        final ModuleStateHolder moduleStateHolder = application.getModuleStateHolder();
       
        RuntimeModule runtimeModule = moduleStateHolder.removeModule(moduleDefinition);
        if (runtimeModule != null) {
            try {
                ModuleRuntime moduleRuntime = getModuleRuntime(currentDefinition);
                moduleRuntime.closeModule(application, runtimeModule);
            }
View Full Code Here

           
            ModuleManagementFacade moduleManagementFacade = WebServletUtils.getModuleManagementFacade(servletContext);
            if (moduleManagementFacade != null) {
               
                Application application = moduleManagementFacade.getApplicationManager().getApplication(applicationId);
                RuntimeModule currentModuleContext = application.getModuleStateHolder().getModule(moduleName);
               
                if (currentModuleContext != null) {
                    return new StateProtectingHttpSession(session, webAttributeQualifier, applicationId, moduleName, currentModuleContext.getClassLoader());
                } else {
                    logger.warn("No module application context associated with module: " + moduleName + ". Using unwrapped session");
                    return session;
                }
            }
View Full Code Here

    /**
     * Gets the {@link RuntimeModule} associated with the root module
     */
    public RuntimeModule getRootRuntimeModule() {
        RuntimeModule runtimeModule = getModuleStateHolder().getRootModule();
        if (runtimeModule == null) {
            throw new NoServiceException("No root application has been loaded");
        }
        return runtimeModule;
    }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public <T extends Object> T getBean(String beanName, Class<T> t) {
       
        RuntimeModule runtimeModule = getRootRuntimeModule();
        return (T) checkBeanType(runtimeModule, beanName, t);
    }
View Full Code Here

    }
   
    @SuppressWarnings("unchecked")
    public <T extends Object> T getModuleBean(String moduleName, String beanName, Class<T> t) {
       
        RuntimeModule runtimeModule = getRuntimeModule(moduleName);
        return (T) checkBeanType(runtimeModule, beanName, t);
    }
View Full Code Here

TOP

Related Classes of org.impalaframework.module.RuntimeModule

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.