1 24 package org.objectweb.speedo.usercache.lib; 25 26 import org.objectweb.speedo.usercache.api.UserCache; 27 28 33 public class CompositeUserCache implements UserCache { 34 35 UserCache[] inner; 36 37 40 public CompositeUserCache(UserCache[] inner) { 41 super(); 42 this.inner = inner; 43 } 45 46 public Object bind(Object key, Object oid) { 47 throw new UnsupportedOperationException ("No bind possible on composite user cache"); 48 } 49 public int getId() { 50 throw new UnsupportedOperationException ("No bind possible on composite user cache"); 51 } 52 public String [] getIndexFieldNames() { 53 return inner[0].getIndexFieldNames(); 54 } 55 public String getName() { 56 throw new UnsupportedOperationException ("No bind possible on composite user cache"); 57 } 58 public boolean isActive() { 59 for (int i = 0; i < inner.length; i++) { 60 if (inner[i].isActive()) { 61 return true; 62 } 63 } 64 return false; 65 } 66 public Object lookup(Object key) { 67 for (int i = 0; i < inner.length; i++) { 68 Object res = inner[i].lookup(key); 69 if (res != null) { 70 return res; 71 } 72 } 73 return null; 74 } 75 public Object unbindFromKey(Object key) { 76 for (int i = 0; i < inner.length; i++) { 77 Object res = inner[i].unbindFromKey(key); 78 if (res != null) { 79 return res; 80 } 81 } 82 return null; 83 } 84 public Object unbindFromOID(Object oid) { 85 for (int i = 0; i < inner.length; i++) { 86 Object res = inner[i].unbindFromOID(oid); 87 if (res != null) { 88 return res; 89 } 90 } 91 return null; 92 } 93 } 94 | Popular Tags |