1 21 22 package org.apache.derby.impl.services.monitor; 23 24 import org.apache.derby.iapi.services.monitor.PersistentService; 25 26 import java.util.Properties ; 27 28 31 32 33 class ModuleInstance { 34 35 38 39 42 protected Object instance; 43 44 47 protected String identifier; 48 49 52 protected Object topLevelService; 53 54 57 protected Object service; 58 59 62 63 protected ModuleInstance(Object instance, String identifier, 64 Object service, Object topLevelService) 65 { 66 super(); 67 this.instance = instance; 68 this.identifier = identifier; 69 this.topLevelService = topLevelService; 70 this.service = service; 71 72 } 73 74 protected ModuleInstance(Object instance) { 75 76 this(instance, null, null, null); 77 } 78 79 protected boolean isTypeAndName(PersistentService serviceType, 80 Class factoryInterface, String otherCanonicalName) 81 { 82 if (!factoryInterface.isInstance(instance)) 84 return false; 85 86 if ((serviceType != null) && (otherCanonicalName != null)) 87 return serviceType.isSameService(identifier, otherCanonicalName); 88 89 90 if (otherCanonicalName != null) { 92 if (identifier == null) 93 return false; 94 if (!otherCanonicalName.equals(identifier)) 95 return false; 96 } else if (identifier != null) { 97 return false; 98 } 99 100 return true; 101 } 102 103 protected String getIdentifier() { 104 return identifier; 105 } 106 107 protected Object getTopLevelService() { 108 return topLevelService; 109 } 110 111 protected Object getInstance() { 112 return instance; 113 } 114 } 115 | Popular Tags |