Examples of ApplicationContextConfiguration


Examples of org.eclipse.gemini.blueprint.extender.support.ApplicationContextConfiguration

     * https://bugs.eclipse.org/bugs/show_bug.cgi?id=379384
     *
     * UPDATE: This issue still seems to occur with Blueprint 1.0.2.RELEASE. Since Dynamic Extensions de-emphasizes
     * the direct use of OSGi anyway, Blueprint configuration will definitely not be supported.
     */
    final ApplicationContextConfiguration config = new ApplicationContextConfiguration(bundle);
    String[] configurationLocations = null;
    if (config.isSpringPoweredBundle()) {
      configurationLocations = config.getConfigurationLocations();
    }
    if ((configurationLocations == null || configurationLocations.length == 0)
        && isAlfrescoDynamicExtension(bundle) == false) {
      return null;
    }
    if (isAlfrescoDynamicExtension(bundle)) {
      uninstallBundlesWithDuplicateSymbolicName(bundleContext);
    }
    final DynamicExtensionsApplicationContext applicationContext = new DynamicExtensionsApplicationContext(
        configurationLocations, getHostApplicationContext(bundleContext));
    applicationContext.setBundleContext(bundleContext);

    final DefaultContextClassLoaderProvider contextClassLoaderProvider = new DefaultContextClassLoaderProvider();
    contextClassLoaderProvider.setBeanClassLoader(ApplicationContext.class.getClassLoader());
    applicationContext.setContextClassLoaderProvider(contextClassLoaderProvider);

    applicationContext.setPublishContextAsService(config.isPublishContextAsService());

    return applicationContext;

  }
View Full Code Here

Examples of org.springframework.osgi.extender.support.ApplicationContextConfiguration

    // executor used for creating the appCtx
    // chosen based on the sync/async configuration
    TaskExecutor executor = null;

    ApplicationContextConfiguration config = new ApplicationContextConfiguration(bundle);

    String creationType;

    // synch/asynch context creation
    if (config.isCreateAsynchronously()) {
      // for the async stuff use the executor
      executor = taskExecutor;
      creationType = "Asynchronous";
    }
    else {
      // for the sync stuff, use this thread
      executor = sameThreadTaskExecutor;
      creationType = "Synchronous";
    }

    if (debug) {
      log.debug(creationType + " context creation for bundle " + bundleString);
    }

    // wait/no wait for dependencies behaviour
    if (config.isWaitForDependencies()) {
      DependencyWaiterApplicationContextExecutor appCtxExecutor = new DependencyWaiterApplicationContextExecutor(
        localApplicationContext, !config.isCreateAsynchronously(),
        extenderConfiguration.getDependencyFactories());

      appCtxExecutor.setTimeout(config.getTimeout());
      appCtxExecutor.setWatchdog(timer);
      appCtxExecutor.setTaskExecutor(executor);
      appCtxExecutor.setMonitoringCounter(contextsStarted);
      // set events publisher
      appCtxExecutor.setDelegatedMulticaster(this.multicaster);
View Full Code Here

Examples of org.springframework.osgi.extender.support.ApplicationContextConfiguration

    // executor used for creating the appCtx
    // chosen based on the sync/async configuration
    TaskExecutor executor = null;

    ApplicationContextConfiguration config = new ApplicationContextConfiguration(bundle);

    String creationType;

    // synch/asynch context creation
    if (config.isCreateAsynchronously()) {
      // for the async stuff use the executor
      executor = taskExecutor;
      creationType = "Asynchronous";
    }
    else {
      // for the sync stuff, use this thread
      executor = sameThreadTaskExecutor;
      creationType = "Synchronous";
    }

    if (debug) {
      log.debug(creationType + " context creation for bundle " + bundleString);
    }

    // wait/no wait for dependencies behaviour
    if (config.isWaitForDependencies()) {
      DependencyWaiterApplicationContextExecutor appCtxExecutor = new DependencyWaiterApplicationContextExecutor(
        localApplicationContext, !config.isCreateAsynchronously(),
        extenderConfiguration.getDependencyFactories());

      long timeout;
      // check whether a timeout has been defined

      if (ConfigUtils.isDirectiveDefined(bundle.getHeaders(), ConfigUtils.DIRECTIVE_TIMEOUT)) {
        timeout = config.getTimeout();
        if (debug)
          log.debug("Setting bundle-defined, wait-for-dependencies timeout value=" + timeout
              + " ms, for bundle " + bundleString);

      }
      else {
        timeout = extenderConfiguration.getDependencyWaitTime();
        if (debug)
          log.debug("Setting globally defined wait-for-dependencies timeout value=" + timeout
              + " ms, for bundle " + bundleString);
      }

      appCtxExecutor.setTimeout(config.getTimeout());

      appCtxExecutor.setWatchdog(timer);
      appCtxExecutor.setTaskExecutor(executor);
      appCtxExecutor.setMonitoringCounter(contextsStarted);
      // set events publisher
View Full Code Here

Examples of org.springframework.osgi.extender.support.ApplicationContextConfiguration

      "file://META-INF/spring/context-two.xml" };

  public void testBundleWithNoHeaderAndNoMetaInfSpringResourcesIsNotSpringPowered() {
    EntryLookupControllingMockBundle aBundle = new EntryLookupControllingMockBundle(null);
    aBundle.setResultsToReturnOnNextCallToFindEntries(null);
    ApplicationContextConfiguration config = new ApplicationContextConfiguration(aBundle);
    assertFalse("bundle is not spring powered", config.isSpringPoweredBundle());
  }
View Full Code Here

Examples of org.springframework.osgi.extender.support.ApplicationContextConfiguration

  }

  public void testBundleWithSpringResourcesAndNoHeaderIsSpringPowered() {
    EntryLookupControllingMockBundle aBundle = new RepeatingEntryLookupControllingMockBundle(null);
    aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
    ApplicationContextConfiguration config = new ApplicationContextConfiguration(aBundle);
    assertTrue("bundle is spring powered", config.isSpringPoweredBundle());
  }
View Full Code Here

Examples of org.springframework.osgi.extender.support.ApplicationContextConfiguration

    Dictionary headers = new Hashtable();
    headers.put("Spring-Context", "META-INF/spring/context.xml");
    EntryLookupControllingMockBundle aBundle = new EntryLookupControllingMockBundle(headers);
    aBundle.setResultsToReturnOnNextCallToFindEntries(null);
    aBundle.setEntryReturnOnNextCallToGetEntry(new URL("file://META-INF/spring/context.xml"));
    ApplicationContextConfiguration config = new ApplicationContextConfiguration(aBundle);
    assertTrue("bundle is spring powered", config.isSpringPoweredBundle());
  }
View Full Code Here

Examples of org.springframework.osgi.extender.support.ApplicationContextConfiguration

  }

  public void testBundleWithNoHeaderShouldWaitFiveMinutes() {
    EntryLookupControllingMockBundle aBundle = new EntryLookupControllingMockBundle(null);
    aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
    ApplicationContextConfiguration config = new ApplicationContextConfiguration(aBundle);
    assertEquals("bundle should timeout in five minutes", new Long(5 * 60 * 1000), new Long(config.getTimeout()));
  }
View Full Code Here

Examples of org.springframework.osgi.extender.support.ApplicationContextConfiguration

  public void testBundleWithWaitFiveSecondWaitForTimeout() {
    Dictionary headers = new Hashtable();
    headers.put("Spring-Context", "*;timeout:=5");
    EntryLookupControllingMockBundle aBundle = new EntryLookupControllingMockBundle(headers);
    aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
    ApplicationContextConfiguration config = new ApplicationContextConfiguration(aBundle);
    assertTrue("bundle should be Spring powered", config.isSpringPoweredBundle());
    assertEquals("bundle should timeout in 5 s", new Long(5 * 1000), new Long(config.getTimeout()));
  }
View Full Code Here

Examples of org.springframework.osgi.extender.support.ApplicationContextConfiguration

    // *;flavour
    Dictionary headers = new Hashtable();
    headers.put("Spring-Context", "*;timeout:=none");
    EntryLookupControllingMockBundle aBundle = new EntryLookupControllingMockBundle(headers);
    aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
    ApplicationContextConfiguration config = new ApplicationContextConfiguration(aBundle);
    assertTrue("bundle should be Spring powered", config.isSpringPoweredBundle());
    assertEquals("bundle should timeout -2 (indicates forever)", new Long(-2), new Long(config.getTimeout()));
  }
View Full Code Here

Examples of org.springframework.osgi.extender.support.ApplicationContextConfiguration

  }

  public void tstConfigLocationsInMetaInfNoHeader() {
    EntryLookupControllingMockBundle aBundle = new EntryLookupControllingMockBundle(null);
    aBundle.setResultsToReturnOnNextCallToFindEntries(META_INF_SPRING_CONTENT);
    ApplicationContextConfiguration config = new ApplicationContextConfiguration(aBundle);
    String[] configFiles = config.getConfigurationLocations();
    assertEquals("0 config files", 0, configFiles.length);
    // assertEquals("bundle-url:file://META-INF/spring/context.xml",
    // configFiles[0]);
    // assertEquals("bundle-url:file://META-INF/spring/context-two.xml",
    // configFiles[1]);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.