예제 #1
0
  /** Tries to load the class specified otherwise defaults to null */
  public Map<String, CacheManagerPeerListener> createCachePeerListeners() {
    String className = null;
    Map<String, CacheManagerPeerListener> cacheManagerPeerListeners =
        new HashMap<String, CacheManagerPeerListener>();
    List<FactoryConfiguration> cacheManagerPeerListenerFactoryConfigurations =
        configuration.getCacheManagerPeerListenerFactoryConfigurations();
    boolean first = true;
    for (FactoryConfiguration factoryConfiguration :
        cacheManagerPeerListenerFactoryConfigurations) {

      if (factoryConfiguration != null) {
        className = factoryConfiguration.getFullyQualifiedClassPath();
      }
      if (className == null) {
        LOG.fine(
            "No CachePeerListenerFactoryConfiguration specified. Not configuring a CacheManagerPeerListener.");
        return null;
      } else {
        CacheManagerPeerListenerFactory cacheManagerPeerListenerFactory =
            (CacheManagerPeerListenerFactory) ClassLoaderUtil.createNewInstance(className);
        Properties properties =
            PropertyUtil.parseProperties(
                factoryConfiguration.getProperties(), factoryConfiguration.getPropertySeparator());
        CacheManagerPeerListener cacheManagerPeerListener =
            cacheManagerPeerListenerFactory.createCachePeerListener(cacheManager, properties);
        cacheManagerPeerListeners.put(
            cacheManagerPeerListener.getScheme(), cacheManagerPeerListener);
      }
    }
    return cacheManagerPeerListeners;
  }