Package org.springframework.osgi.util.internal

Examples of org.springframework.osgi.util.internal.MapBasedDictionary


   * actual publishing is required or not.
   *
   */
  private void publishContextAsOsgiServiceIfNecessary() {
    if (publishContextAsService && serviceRegistration == null) {
      Dictionary serviceProperties = new MapBasedDictionary();

      customizeApplicationContextServiceProperties((Map) serviceProperties);

      if (logger.isInfoEnabled()) {
        logger.info("Publishing application context as OSGi service with properties " + serviceProperties);
View Full Code Here


      log.warn("The running bean factory cannot support dependencies between beans - importer/exporter dependency cannot be enforced");
    }
  }

  private Dictionary mergeServiceProperties(String beanName) {
    MapBasedDictionary props = new MapBasedDictionary(propertiesResolver.getServiceProperties(beanName));

    props.putAll((Map) props);

    // add service properties
    if (serviceProperties != null)
      props.putAll(serviceProperties);

    if (ranking != 0) {
      props.put(org.osgi.framework.Constants.SERVICE_RANKING, new Integer(ranking));
    }
    return props;
  }
View Full Code Here

  private BundleContext bundleContext;


  public Map getServiceProperties(String beanName) {
    Map p = new MapBasedDictionary();
    p.put(BEAN_NAME_PROPERTY_KEY, beanName);
    String name = getSymbolicName();
    if (StringUtils.hasLength(name)) {
      p.put(Constants.BUNDLE_SYMBOLICNAME, name);
    }
    String version = getBundleVersion();
    if (StringUtils.hasLength(version)) {
      p.put(Constants.BUNDLE_VERSION, version);
    }
    return p;
  }
View Full Code Here

    }

    public void updated(String pid, Dictionary props) throws ConfigurationException {
      if (log.isTraceEnabled())
        log.trace("Configuration [" + pid + "] has been updated with properties " + props);
      createOrUpdate(pid, new MapBasedDictionary(props));
    }
View Full Code Here

    ServiceReference ref = bundleContext.getServiceReference(ConfigurationAdmin.class.getName());
    if (ref != null) {
      ConfigurationAdmin cm = (ConfigurationAdmin) bundleContext.getService(ref);
      if (cm != null) {
        try {
          properties = new MapBasedDictionary(cm.getConfiguration(pid).getProperties());
        }
        catch (IOException ioe) {
          // FIXME: consider adding a custom/different exception
          throw new BeanInitializationException("Cannot retrieve configuration for pid=" + pid, ioe);
        }
View Full Code Here

      if (log.isTraceEnabled())
        log.trace("Configuration [" + pid + "] has been updated with properties " + props);

      synchronized (monitor) {
        // update properties
        properties = new MapBasedDictionary(props);
        // invoke callback
        if (beanManager != null)
          beanManager.updated(properties);
      }
    }
View Full Code Here

    listener.setBindMethod("bind");
    listener.setUnbindMethod("unbind");
    listener.afterPropertiesSet();

    Object service = new Date();
    MapBasedDictionary props = new MapBasedDictionary();

    assertEquals(0, JustListener.BIND_CALLS);
    assertEquals(0, JustListener.UNBIND_CALLS);
    listener.bind(service, props);
View Full Code Here

  }

  public void testInvokeCustomMethodsOnDictMethod() {
    OneDictionaryMethod.INVOCATIONS = 0;
    Map methods = UpdateMethodAdapter.determineUpdateMethod(OneDictionaryMethod.class, "dictMethod");
    UpdateMethodAdapter.invokeCustomMethods(new OneDictionaryMethod(), methods, new MapBasedDictionary());
    assertEquals(1, OneDictionaryMethod.INVOCATIONS);
  }
View Full Code Here

  }

  public void testInvokeCustomMethodsOnBothMethod() {
    BothMethods.INVOCATIONS = 0;
    Map methods = UpdateMethodAdapter.determineUpdateMethod(BothMethods.class, "update");
    UpdateMethodAdapter.invokeCustomMethods(new BothMethods(), methods, new MapBasedDictionary());
    assertEquals(2, BothMethods.INVOCATIONS);
  }
View Full Code Here

  private Dictionary dict;


  protected void setUp() throws Exception {
    dict = new MapBasedDictionary();
  }
View Full Code Here

TOP

Related Classes of org.springframework.osgi.util.internal.MapBasedDictionary

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.