コード例 #1
0
 /** @see ServiceTracker#removedService(ServiceReference,Object) */
 @Override
 public void removedService(final ServiceReference serviceReference, final Object unpublished) {
   LOGGER.debug("Service removed " + serviceReference);
   super.removedService(serviceReference, unpublished);
   final HttpContextMapping mapping = (HttpContextMapping) unpublished;
   final WebApplication webApplication =
       m_extenderContext.getWebApplication(
           serviceReference.getBundle(), mapping.getHttpContextId());
   webApplication.setHttpContextMapping(null);
 }
コード例 #2
0
 /** @see ServiceTracker#addingService(ServiceReference) */
 @Override
 @SuppressWarnings("unchecked")
 public Object addingService(final ServiceReference serviceReference) {
   LOGGER.debug("Service available " + serviceReference);
   T registered = (T) super.addingService(serviceReference);
   HttpContextMapping mapping = createHttpContextMapping(serviceReference, registered);
   if (mapping != null) {
     final WebApplication webApplication =
         m_extenderContext.getWebApplication(
             serviceReference.getBundle(), mapping.getHttpContextId());
     webApplication.setHttpContextMapping(mapping);
     return mapping;
   } else {
     // if no mapping was created release the service
     super.remove(serviceReference);
     return null;
   }
 }