Package org.osgi.util.tracker

Examples of org.osgi.util.tracker.ServiceTrackerCustomizer


        this.bundleContext = bundleContext;
        this.classLoader = classLoader;

        serviceManager = ServiceManager.getManager();

        tracker = new ServiceTracker(bundleContext, ServerService.class.getName(), new ServiceTrackerCustomizer() {

            public Object addingService(ServiceReference reference) {
                ServerService service = (ServerService) bundleContext.getService(reference);
                return addServerService(service);
            }
View Full Code Here


            // Ignore, if the EventAdmin package is not available, just don't use it
            LOGGER.debug("EventAdmin package is not available, just don't use it");
        }
        this.eventAdminListener = listener;

        this.containerListenerTracker = new ServiceTracker(bundleContext, BlueprintListener.class.getName(), new ServiceTrackerCustomizer() {
            public Object addingService(ServiceReference reference) {
                BlueprintListener listener = (BlueprintListener) bundleContext.getService(reference);

                synchronized (listeners) {
                    sendInitialEvents(listener);
View Full Code Here

            // Ignore, if the EventAdmin package is not available, just don't use it
            LOGGER.debug("EventAdmin package is not available, just don't use it");
        }
        this.eventAdminListener = listener;

        this.containerListenerTracker = new ServiceTracker(bundleContext, BlueprintListener.class.getName(), new ServiceTrackerCustomizer() {
            public Object addingService(ServiceReference reference) {
                BlueprintListener listener = (BlueprintListener) bundleContext.getService(reference);

                synchronized (listeners) {
                    sendInitialEvents(listener);
View Full Code Here

            Constants.OBJECTCLASS,Yard.class.getName(),
            Yard.ID,yardId);
        Filter yardFilter = bundleContext.createFilter(yardFilterString);
       
        yardTracker = new ServiceTracker(
            bundleContext, yardFilter, new ServiceTrackerCustomizer() {
               
                @Override
                public void removedService(ServiceReference reference, Object service) {
                    synchronized (yardReferenceLock) {
                        if(reference.equals(yardReference)){
View Full Code Here

   
    @Activate
    protected void activate(ComponentContext context){
        bc = context.getBundleContext();
        serverTracker = new ServiceTracker(bc, ManagedSolrServer.class.getName(),
            new ServiceTrackerCustomizer() {
                /**
                 * The servers managed by this instance
                 */
                private SortedMap<ServiceReference,ManagedSolrServer> servers =
                        new TreeMap<ServiceReference,ManagedSolrServer>();
View Full Code Here

    /**
     *
     */
    private void openTracker() {
        providersTracker = new ServiceTracker(bundleContext, NamespacePrefixProvider.class.getName(),
            new ServiceTrackerCustomizer() {
           
            @Override
            public void removedService(ServiceReference reference, Object service) {
                bundleContext.ungetService(reference);
                __sortedProviderRef = null;
View Full Code Here

        } catch (InvalidSyntaxException e) {
            throw new ConfigurationException(ENTITYHUB_YARD_ID, "Unable to parse OSGI filter '"
                + filterString + "' for configured Yard id '"+entityhubYardId+"'!",e);
        }
        entityhubYardTracker = new ServiceTracker(context.getBundleContext(), filter,
            new ServiceTrackerCustomizer() {
                final BundleContext bc = context.getBundleContext();
                @Override
                public void removedService(ServiceReference reference, Object service) {
                    if(service.equals(entityhubYard)){
                        entityhubYard = (Yard)entityhubYardTracker.getService();
View Full Code Here

            additionalMappings = null;
        }
        String yardId = OsgiUtils.checkProperty(context.getProperties(), Cache.CACHE_YARD).toString();
        String cacheFilter = String.format("(&(%s=%s)(%s=%s))", Constants.OBJECTCLASS, Yard.class.getName(), Yard.ID, yardId);
        yardTracker = new ServiceTracker(context.getBundleContext(), context.getBundleContext().createFilter(cacheFilter),
            new ServiceTrackerCustomizer() {
            //store the reference to the ComponentContext to avoid NPE if deactivate
            //is called for the CacheComponent
            final ComponentContext cc = context;
            @Override
            public void removedService(ServiceReference reference, Object service) {
View Full Code Here

            entitySearcher = new EntityhubSearcher(bundleContext, 10, this);
        } else {
            entitySearcher = new ReferencedSiteSearcher(bundleContext,siteName,10,this);
        }
        labelTokenizerTracker = new ServiceTracker(bundleContext, LabelTokenizer.class.getName(),
                new ServiceTrackerCustomizer() {
                   
                @Override
                public Object addingService(ServiceReference reference) {
                    Object service = bundleContext.getService(reference);
                    if(service == null){
View Full Code Here

            String cacheFilter =
                    String.format("(&(%s=%s)(%s=%s))", Constants.OBJECTCLASS, Cache.class.getName(),
                        Cache.CACHE_YARD, siteConfiguration.getCacheId());
            cacheTracker = new ServiceTracker(ctx.getBundleContext(),
                ctx.getBundleContext().createFilter( cacheFilter),
                new ServiceTrackerCustomizer() {
                   
                    @Override
                    public void removedService(ServiceReference reference, Object service) {
                        if(service.equals(cache)){
                            cache = (Cache)cacheTracker.getService();
View Full Code Here

TOP

Related Classes of org.osgi.util.tracker.ServiceTrackerCustomizer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.