Examples of ServiceRegistryReference


Examples of org.impalaframework.service.ServiceRegistryReference

   *
   * Each time {@link #getTarget()} is called, the object is looked up from the service registry.
   * No cacheing is involved.
   */
  public Object getTarget() throws Exception {
    ServiceRegistryReference reference = getServiceRegistryReference();
    if (reference != null) {
      Object bean = reference.getBean();
      if (bean instanceof FactoryBean) {
        FactoryBean fb = (FactoryBean) bean;
        return fb.getObject();
      }
      return bean;
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryReference

    invokeListeners(event);
  }

  public void remove(Object service) {
   
    ServiceRegistryReference serviceReference = null;
    String beanName = null;
   
    synchronized (registryLock) {
      beanName = entities.remove(service);
      if (beanName != null) {
        serviceReference = services.remove(beanName);
      }
    }

    if (serviceReference != null) {
     
      if (logger.isDebugEnabled())
        logger.debug("Removed from service reference bean '" + beanName
            + "' contributed from module '"
            + serviceReference.getContributingModule() + "'");
     
      ServiceRemovedEvent event = new ServiceRemovedEvent(
          serviceReference);
      invokeListeners(event);
    }
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryReference

  public ServiceRegistryReference getService(String beanName) {
    return services.get(beanName);
  }

  public ServiceRegistryReference getService(String beanName, Class<?> type) {
    ServiceRegistryReference serviceReference = services.get(beanName);

    if (serviceReference != null) {
      Object bean = serviceReference.getBean();
      if (!type.isAssignableFrom(bean.getClass())) {
        throw new InvalidStateException("Service reference bean "
            + bean + " is not assignable from type " + type);
      }
    }
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryReference

    //inform all listeners of service listener event
    for (ServiceRegistryEventListener listener : listeners) {
      listener.handleServiceRegistryEvent(event);
    }
   
    ServiceRegistryReference serviceReference = event.getServiceReference();
    List<String> tags = serviceReference.getTags();

    for (String tag : tags) {
     
      List<ServiceRegistryEventListener> list = null;
      synchronized (taggedListenersLock) {
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryReference

   *
   * Each time {@link #getTarget()} is called, the object is looked up from the service registry.
   * No cacheing is involved.
   */
  public Object getTarget() throws Exception {
    ServiceRegistryReference reference = getServiceRegistryReference();
    if (reference != null) {
      Object bean = reference.getBean();
      if (bean instanceof FactoryBean) {
        FactoryBean fb = (FactoryBean) bean;
        return fb.getObject();
      }
      return bean;
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryReference

  }
 
  /* ******************* Private and package method ******************** */
 
  private void handleEventRemoved(ServiceRegistryEvent event) {
    ServiceRegistryReference ref = event.getServiceReference();
    if (externalContributions.containsValue(ref.getBean())) {
     
      K contributionKeyName = filter.getContributionKeyName(ref);
      V removed = externalContributions.remove(contributionKeyName);
     
      if (logger.isDebugEnabled()) {
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryReference

      }
    }
  }

  private void handleEventAdded(ServiceRegistryEvent event) {
    ServiceRegistryReference ref = event.getServiceReference();
    addService(ref);
  }
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryReference

     
      Thread currentThread = Thread.currentThread();
      ClassLoader existingClassLoader = currentThread.getContextClassLoader();
      try {
        if (setContextClassLoader) {
          ServiceRegistryReference serviceReference = targetSource.getServiceRegistryReference();
          //this will only not be null if the service is removed directly after the hasTargetSource() call
          if (serviceReference != null) {
            currentThread.setContextClassLoader(serviceReference.getBeanClassLoader());
          }
        }
        return invocation.proceed();
       
      } finally {
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryReference

     
      Thread currentThread = Thread.currentThread();
      ClassLoader existingClassLoader = currentThread.getContextClassLoader();
      try {
        if (setContextClassLoader) {
          ServiceRegistryReference serviceReference = targetSource.getServiceRegistryReference();
          //this will only not be null if the service is removed directly after the hasTargetSource() call
          if (serviceReference != null) {
            currentThread.setContextClassLoader(serviceReference.getBeanClassLoader());
          }
        }
        return invocation.proceed();
       
      } finally {
View Full Code Here

Examples of org.impalaframework.service.ServiceRegistryReference

  }
 
  /* ******************* Private and package method ******************** */
 
  private void handleEventRemoved(ServiceRegistryEvent event) {
    ServiceRegistryReference ref = event.getServiceReference();
    if (externalContributions.containsValue(ref.getBean())) {
     
      K contributionKeyName = filter.getContributionKeyName(ref);
      V removed = externalContributions.remove(contributionKeyName);
     
      if (logger.isDebugEnabled()) {
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.