Package org.apache.felix.dm

Examples of org.apache.felix.dm.DependencyService


        Object[] services;
        synchronized (this) {
            services = m_services.toArray();
        }
        for (int i = 0; i < services.length; i++) {
            DependencyService ds = (DependencyService) services[i];
            ds.autoConfig(this);
            if (ds.isInstantiated()) {
                if (invokeChanged(ds, ref, service)) {
                    // The "change" or "swap" callback has been invoked (if not it means that the modified service
                    // is for a lower ranked aspect to which we are not interested in).
                    // Now, propagate (if needed) changed properties to dependency service properties.
                    ds.propagate(this);
                }
            }
        }
    }
View Full Code Here


        synchronized (this) {
            services = m_services.toArray();
        }

        for (int i = 0; i < services.length; i++) {
            DependencyService ds = (DependencyService) services[i];
            if (makeUnavailable) {
                ds.dependencyUnavailable(this);
                // when the dependency is optional or the dependency is instance bound and the component is instantiated (and the dependency is required)
                // then remove is invoked. In other cases the removed has been when the component was unconfigured.
                if (!isRequired() || (ds.isInstantiated() && isInstanceBound())) {
                    invokeRemoved(ds, ref, service);
                }
            } else {
                // Some dependencies are still available: first inject the remaining highest ranked dependency
                // in component class field, if the dependency is configured in autoconfig mode.
                ds.autoConfig(this);
                // Next, invoke "removed" callback. If the dependency is aspect aware, we only invoke removed cb
                // if the removed service is the highest ranked service. Note that if the cb is not called, we don't
                // propagate the remaining dependency properties.
                if (invokeRemoved(ds, ref, service)) {
                    // Finally, since we have lost one dependency, we have to possibly propagate the highest ranked
                    // dependency available.
                    ds.propagate(this);
                }
            }
        }
        // unget what we got in addingService (see ServiceTracker 701.4.1)
        m_context.ungetService(ref);
View Full Code Here

        if (m_isAvailable)
        {
            Object[] services = m_services.toArray();
            for (int i = 0; i < services.length; i++)
            {
                DependencyService ds = (DependencyService) services[i];
                ds.dependencyAvailable(this);
                if (!isRequired())
                {
                    invokeAdded(ds);
                }
            }
        }
        else
        {
            Object[] services = m_services.toArray();
            for (int i = 0; i < services.length; i++)
            {
                DependencyService ds = (DependencyService) services[i];
                ds.dependencyUnavailable(this);
                if (!isRequired())
                {
                    invokeRemoved(ds);
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.felix.dm.DependencyService

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.