diff options
author | slewis | 2009-02-20 06:34:30 +0000 |
---|---|---|
committer | slewis | 2009-02-20 06:34:30 +0000 |
commit | b6825d239121344b3381cccf78b2e9dea265f776 (patch) | |
tree | 4d0add415a6c0dfb1391715a810895bc163d1eb7 | |
parent | 5f85584bbac2c2db591c03b1e12bae9c77c4a05d (diff) | |
download | org.eclipse.ecf-b6825d239121344b3381cccf78b2e9dea265f776.tar.gz org.eclipse.ecf-b6825d239121344b3381cccf78b2e9dea265f776.tar.xz org.eclipse.ecf-b6825d239121344b3381cccf78b2e9dea265f776.zip |
Added find hook implementation class
2 files changed, 43 insertions, 0 deletions
diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/Activator.java b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/Activator.java index 1601ca781..e3214d012 100644 --- a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/Activator.java +++ b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/Activator.java @@ -15,6 +15,7 @@ import org.eclipse.ecf.core.IContainerManager; import org.eclipse.ecf.osgi.services.distribution.ServiceConstants; import org.osgi.framework.*; import org.osgi.framework.hooks.service.EventHook; +import org.osgi.framework.hooks.service.FindHook; import org.osgi.service.distribution.DistributionProvider; import org.osgi.util.tracker.ServiceTracker; @@ -27,6 +28,7 @@ public class Activator implements BundleActivator { private ServiceRegistration eventHookRegistration; private ServiceRegistration distributionProviderRegistration; + private ServiceRegistration listenerHookRegistration; private DistributionProviderImpl distributionProvider; @@ -60,6 +62,10 @@ public class Activator implements BundleActivator { final ECFEventHookImpl hook = new ECFEventHookImpl(distributionProvider); this.eventHookRegistration = this.context.registerService( EventHook.class.getName(), hook, null); + + final FindHook findHook = new ECFFindHookImpl(distributionProvider); + this.listenerHookRegistration = this.context.registerService( + FindHook.class.getName(), findHook, null); // register all existing services which have the marker property try { final ServiceReference[] refs = this.context @@ -95,6 +101,10 @@ public class Activator implements BundleActivator { this.eventHookRegistration.unregister(); this.eventHookRegistration = null; } + if (this.listenerHookRegistration != null) { + this.listenerHookRegistration.unregister(); + this.listenerHookRegistration = null; + } } private void removeDistributionProvider() { diff --git a/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/ECFFindHookImpl.java b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/ECFFindHookImpl.java new file mode 100644 index 000000000..8ee3f10ef --- /dev/null +++ b/compendium/bundles/org.eclipse.ecf.osgi.services.distribution/src/org/eclipse/ecf/internal/osgi/services/distribution/ECFFindHookImpl.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2009 EclipseSource and others. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * EclipseSource - initial API and implementation + ******************************************************************************/ +package org.eclipse.ecf.internal.osgi.services.distribution; + +import java.util.Collection; +import org.eclipse.ecf.core.util.Trace; +import org.osgi.framework.BundleContext; +import org.osgi.framework.hooks.service.FindHook; + +public class ECFFindHookImpl implements FindHook { + + private final DistributionProviderImpl distributionProvider; + + public ECFFindHookImpl(DistributionProviderImpl distributionProvider) { + this.distributionProvider = distributionProvider; + } + + public void find(BundleContext context, String name, String filter, + boolean allServices, Collection references) { + Trace.entering(Activator.PLUGIN_ID, DebugOptions.FINDHOOKDEBUG, this + .getClass(), "find", new Object[] { + context.getBundle().getSymbolicName(), name, filter, + new Boolean(allServices), references }); + } + +} |