3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.opendaylight.controller.clustering.services_implementation.internal;
12 import org.infinispan.notifications.Listener;
13 import org.infinispan.notifications.cachelistener.annotation.CacheEntryCreated;
14 import org.infinispan.notifications.cachelistener.annotation.CacheEntryModified;
15 import org.infinispan.notifications.cachelistener.annotation.CacheEntryRemoved;
16 import org.infinispan.notifications.cachelistener.event.CacheEntryCreatedEvent;
17 import org.infinispan.notifications.cachelistener.event.CacheEntryModifiedEvent;
18 import org.infinispan.notifications.cachelistener.event.CacheEntryRemovedEvent;
19 import org.opendaylight.controller.clustering.services.IGetUpdates;
22 public class CacheListenerContainer {
23 private IGetUpdates toBeUpdated;
24 private String containerName;
25 private String cacheName;
27 public CacheListenerContainer(IGetUpdates i, String containerName,
30 this.containerName = containerName;
31 this.cacheName = cacheName;
34 public IGetUpdates whichListener() {
35 return this.toBeUpdated;
39 public void observeCreate(CacheEntryCreatedEvent<Object, Object> event) {
44 if (this.toBeUpdated != null) {
45 this.toBeUpdated.entryCreated(event.getKey(), this.containerName,
46 this.cacheName, event.isOriginLocal());
51 public void observeModify(CacheEntryModifiedEvent<Object, Object> event) {
56 if (this.toBeUpdated != null) {
57 this.toBeUpdated.entryUpdated(event.getKey(), event.getValue(),
58 this.containerName, this.cacheName, event.isOriginLocal());
63 public void observeRemove(CacheEntryRemovedEvent<Object, Object> event) {
68 if (this.toBeUpdated != null) {
69 this.toBeUpdated.entryDeleted(event.getKey(), this.containerName,
70 this.cacheName, event.isOriginLocal());