Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 36 package org.ungoverned.oscar; 37 38 import org.osgi.framework.Bundle; 39 import org.osgi.framework.ServiceReference; 40 41 class ServiceReferenceImpl implements ServiceReference 42 { 43 private ServiceRegistrationImpl m_registration = null; 44 private Bundle m_bundle = null; 45 46 public ServiceReferenceImpl(ServiceRegistrationImpl reg, Bundle bundle) 47 { 48 m_registration = reg; 49 m_bundle = bundle; 50 } 51 52 protected ServiceRegistrationImpl getServiceRegistration() 53 { 54 return m_registration; 55 } 56 57 public Object getProperty(String s) 58 { 59 Oscar.debug("ServiceReference.getProperty(\"" + s + "\")"); 60 return m_registration.getProperty(s); 61 } 62 63 public String [] getPropertyKeys() 64 { 65 Oscar.debug("ServiceReference.getPropertyKeys()"); 66 return m_registration.getPropertyKeys(); 67 } 68 69 public Bundle getBundle() 70 { 71 return m_bundle; 72 } 73 74 public Bundle[] getUsingBundles() 75 { 76 return m_registration.getUsingBundles(); 77 } 78 79 public boolean equals(Object obj) 80 { 81 try { 82 ServiceReferenceImpl ref = (ServiceReferenceImpl) obj; 83 return ref.m_registration == m_registration; 84 } catch (ClassCastException ex) { 85 } catch (NullPointerException ex) { 87 } 89 90 return false; 91 } 92 93 public int hashCode() 94 { 95 if (m_registration.getReference() != null) 96 { 97 if (m_registration.getReference() != this) 98 return m_registration.getReference().hashCode(); 99 return super.hashCode(); 100 } 101 return 0; 102 } 103 104 public String toString() 105 { 106 String [] ocs = (String []) getProperty("objectClass"); 107 String oc = "["; 108 for(int i = 0; i < ocs.length; i++) 109 { 110 oc = oc + ocs[i]; 111 if (i < ocs.length - 1) 112 oc = oc + ", "; 113 } 114 oc = oc + "]"; 115 return oc; 116 } 117 }
| Popular Tags
|