Package org.impalaframework.facade

Examples of org.impalaframework.facade.ModuleManagementFacade


  }

    void initApplicationContext(BundleContext bundleContext, ApplicationContext applicationContext) {
    
       //TODO introduce constants for bean names
    ModuleManagementFacade facade = ObjectUtils.cast(applicationContext.getBean("moduleManagementFacade"),
        ModuleManagementFacade.class);
   
    if (facade == null) {
      throw new InvalidStateException("Application context '" + applicationContext.getDisplayName()
          + "' does not contain bean named 'moduleManagementFacade'");
View Full Code Here


    @ManagedOperation(description = "Uses the current ModuleDefintitionSource to perform a full reload of the module hierarchy")
    public void reloadModules() {
       
        Assert.notNull(servletContext);

        ModuleManagementFacade facade = getFacade();
        ModuleDefinitionSource source = getSource();
        Application application = getApplication(facade);

        ModuleOperationInput moduleOperationInput = new ModuleOperationInput(source, null, null);
       
        ModuleOperation operation = facade.getModuleOperationRegistry().getOperation(ModuleOperationConstants.ReloadRootModuleOperation);
        operation.execute(application, moduleOperationInput);
    }
View Full Code Here

    @ManagedOperation(description = "Simply unloads all the modules")
    public void unloadModules() {
       
        Assert.notNull(servletContext);

        ModuleManagementFacade facade = getFacade();
        ModuleDefinitionSource source = getSource();
        Application application = getApplication(facade);

        ModuleOperationInput moduleOperationInput = new ModuleOperationInput(source, null, null);
       
        ModuleOperation operation = facade.getModuleOperationRegistry().getOperation(ModuleOperationConstants.CloseRootModuleOperation);
        operation.execute(application, moduleOperationInput);
    }
View Full Code Here

        Application application = applicationManager.getCurrentApplication();
        return application;
    }
   
    private ModuleManagementFacade getFacade() {
        ModuleManagementFacade facade = (ModuleManagementFacade) servletContext
                .getAttribute(WebConstants.IMPALA_FACTORY_ATTRIBUTE);
        if (facade == null) {
            throw new ConfigurationException(
                    "No instance of "
                            + ModuleManagementFacade.class.getName()
View Full Code Here

  @ManagedOperation(description = "Uses the current ModuleDefintitionSource to perform a full reload of the module hierarchy")
  public void reloadModules() {
   
    Assert.notNull(servletContext);

    ModuleManagementFacade factory = (ModuleManagementFacade) servletContext
        .getAttribute(WebConstants.IMPALA_FACTORY_ATTRIBUTE);
    if (factory == null) {
      throw new ConfigurationException(
          "No instance of "
              + ModuleManagementFacade.class.getName()
              + " found. Your context loader needs to be configured to create an instance of this class and attach it to the ServletContext using the attribue WebConstants.IMPALA_FACTORY_ATTRIBUTE");
    }

    ModuleDefinitionSource source = (ModuleDefinitionSource) servletContext
        .getAttribute(WebConstants.MODULE_DEFINITION_SOURCE_ATTRIBUTE);
    if (source == null) {
      throw new ConfigurationException(
          "No instance of "
              + ModuleDefinitionSource.class.getName()
              + " found. Your context loader needs to be configured to create an instance of this class and attach it to the ServletContext using the attribue WebConstants.MODULE_DEFINITION_SOURCE_ATTRIBUTE");

    }

    ModuleOperationInput moduleOperationInput = new ModuleOperationInput(source, null, null);
   
    ModuleOperation operation = factory.getModuleOperationRegistry().getOperation(ModuleOperationConstants.ReloadRootModuleOperation);
    operation.execute(moduleOperationInput);
  }
View Full Code Here

  public void moduleContentsModified(ModuleChangeEvent event) {
    Set<String> modified = getModifiedModules(event);

    if (!modified.isEmpty()) {
      ModuleManagementFacade factory = WebServletUtils.getModuleManagementFacade(servletContext);

      for (String moduleName : modified) {

        logger.info("Processing modified module " + moduleName);

        ModuleOperation operation = factory.getModuleOperationRegistry().getOperation(ModuleOperationConstants.ReloadNamedModuleOperation);
        ModuleOperationInput moduleOperationInput = new ModuleOperationInput(null, null, moduleName);
        operation.execute(moduleOperationInput);
      }
    }
  }
View Full Code Here

        ModuleChangeEvent event = new ModuleChangeEvent(info);
        ServletContext servletContext = createMock(ServletContext.class);
        final WebModuleChangeListener listener = new WebModuleChangeListener();
        listener.setServletContext(servletContext);
        ModuleManagementFacade facade = createMock(ModuleManagementFacade.class);
        ModuleOperationRegistry moduleOperationRegistry = createMock(ModuleOperationRegistry.class);
        ModuleOperation moduleOperation = createMock(ModuleOperation.class);

        expect(servletContext.getAttribute(WebConstants.IMPALA_FACTORY_ATTRIBUTE)).andReturn(facade);
        ApplicationManager applicationManager = TestApplicationManager.newApplicationManager();
        Application application = applicationManager.getCurrentApplication();
       
        expect(facade.getApplicationManager()).andReturn(applicationManager);
        expect(facade.getModuleOperationRegistry()).andReturn(moduleOperationRegistry);
        expect(moduleOperationRegistry.getOperation(ModuleOperationConstants.ReloadNamedModuleOperation)).andReturn(moduleOperation);
        expect(moduleOperation.execute(eq(application), isA(ModuleOperationInput.class))).andReturn(ModuleOperationResult.EMPTY);
       
        replay(servletContext);
        replay(facade);
View Full Code Here

    @Override
    protected RequestModuleMapper newRequestModuleMapper(FilterConfig config) {
        final ServletContext servletContext = config.getServletContext();

        ModuleManagementFacade facade = WebServletUtils.getModuleManagementFacade(servletContext);
        if (facade.containsBean("requestModuleMapper")) {
            return ObjectUtils.cast(facade.getBean("requestModuleMapper"), RequestModuleMapper.class);
        }
        return super.newRequestModuleMapper(config);
    }
View Full Code Here

  public WebApplicationContext createWebApplicationContext() throws BeansException {

    // the superclass closes the modules
    final ServletContext servletContext = servlet.getServletContext();
    ModuleManagementFacade facade = ImpalaServletUtils.getModuleManagementFacade(servletContext);

    if (facade == null) {
      throw new ConfigurationException("Unable to load " + FrameworkServletContextCreator.class.getName()
          + " as no attribute '" + WebConstants.IMPALA_FACTORY_ATTRIBUTE
          + "' has been set up. Have you set up your Impala ContextLoader correctly?");
    }

    final String servletName = servlet.getServletName();
    ModuleStateHolder moduleStateHolder = facade.getModuleStateHolder();
   
    if (!initialized) {
     
      ModuleStateChangeNotifier moduleStateChangeNotifier = facade.getModuleStateChangeNotifier();
      moduleStateChangeNotifier.addListener(new ModuleStateChangeListener() {

        public void moduleStateChanged(ModuleStateHolder moduleStateHolder, ModuleStateChange change) {
          try {
            servlet.init();
View Full Code Here

  HttpSession wrapSession(HttpSession session) {
    if (session == null) {
      return null;
    }
    ModuleManagementFacade moduleManagementFacade = ImpalaServletUtils.getModuleManagementFacade(servletContext);
    if (moduleManagementFacade != null) {
      ConfigurableApplicationContext currentModuleContext = moduleManagementFacade.getModuleStateHolder().getModule(moduleName);
     
      if (currentModuleContext != null) {
        return new ModuleAwareWrapperHttpSession(session, currentModuleContext.getClassLoader());
      } else {
        logger.warn("No module application context associated with module: " + moduleName + ". Using unwrapped session");
View Full Code Here

TOP

Related Classes of org.impalaframework.facade.ModuleManagementFacade

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.