Package org.osgi.framework

Examples of org.osgi.framework.ServiceFactory


        final Dictionary props = new Hashtable();
        props.put(ConsoleConstants.PLUGIN_LABEL, ConsoleConstants.NAME);
        props.put(ConsoleConstants.PLUGIN_TITLE, ConsoleConstants.TITLE);
        props.put(ConsoleConstants.PLUGIN_CATEGORY, ConsoleConstants.WEB_CONSOLE_CATEGORY);
        this.pluginRegistration = btx.registerService(ConsoleConstants.INTERFACE_SERVLET, new ServiceFactory()
        {
            public void ungetService(final Bundle bundle, final ServiceRegistration registration, final Object service)
            {
                // nothing to do
            }
View Full Code Here


    {
        final Dictionary props = new Hashtable();
        props.put(ConsoleConstants.PLUGIN_LABEL, "status-" + desc.getName());
        props.put(ConsoleConstants.PLUGIN_TITLE, desc.getTitle());
        props.put(ConsoleConstants.PLUGIN_CATEGORY, ConsoleConstants.WEB_CONSOLE_CATEGORY);
        return context.registerService(ConsoleConstants.INTERFACE_SERVLET, new ServiceFactory()
        {

            public void ungetService(final Bundle bundle, final ServiceRegistration registration, final Object service)
            {
                // nothing to do
View Full Code Here

            return Collections.unmodifiableMap(appenders);
        }
    }

    private void registerWebConsoleSupport() {
        final ServiceFactory serviceFactory = new PluginServiceFactory();

        Properties pluginProps = new Properties();
        pluginProps.put(Constants.SERVICE_VENDOR, "Apache Software Foundation");
        pluginProps.put(Constants.SERVICE_DESCRIPTION, "Sling Log Support");
        pluginProps.put("felix.webconsole.label", APP_ROOT);
View Full Code Here

        props.put(Constants.SERVICE_DESCRIPTION, "Sling Log Reset Event Handler");
        props.put("event.topics", new String[] {
            RESET_EVENT_TOPIC
        });

        registrations.add(bundleContext.registerService("org.osgi.service.event.EventHandler", new ServiceFactory() {
            private Object instance;

            @Override
            public Object getService(Bundle bundle, ServiceRegistration serviceRegistration) {
                synchronized (this) {
View Full Code Here

     */
    protected final ServiceRegistration registerService() {
        final Dictionary<String, Object> props = getServiceRegistrationProperties();
        final String[] interfaces = getServiceRegistrationInterfaces();

        return componentContext.getBundleContext().registerService(interfaces, new ServiceFactory() {
            public Object getService(Bundle bundle, ServiceRegistration registration) {
                return SlingRepositoryProxyHandler.createProxy(interfaces, AbstractSlingRepository.this, bundle);
            }

            public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
View Full Code Here

        Thread.setDefaultUncaughtExceptionHandler(this);

        // install thread handler shell command
        register(bundleContext,
            new String[] { "org.apache.felix.shell.Command" },
            new ServiceFactory() {

                public void ungetService(final Bundle bundle,
                    final ServiceRegistration reg,
                    final Object consoleObject) {
                    // nothing to do
View Full Code Here

            serviceProps.put(Constants.SERVICE_DESCRIPTION, localContext.getProperties().get(Constants.SERVICE_DESCRIPTION));

            local.commonFactory = new CommonResourceResolverFactoryImpl(this);
            local.commonFactory.activate(localContext.getBundleContext());
            local.factoryRegistration = localContext.getBundleContext().registerService(
                ResourceResolverFactory.class.getName(), new ServiceFactory() {

                    public Object getService(final Bundle bundle, final ServiceRegistration registration) {
                        final ResourceResolverFactoryImpl r = new ResourceResolverFactoryImpl(
                                local.commonFactory, bundle,
                            ResourceResolverFactoryActivator.this.serviceUserMapper);
View Full Code Here

     */
    protected final ServiceRegistration registerService() {
        final Dictionary<String, Object> props = getServiceRegistrationProperties();
        final String[] interfaces = getServiceRegistrationInterfaces();

        return bundleContext.registerService(interfaces, new ServiceFactory() {
            public Object getService(Bundle bundle, ServiceRegistration registration) {
                return AbstractSlingRepositoryManager.this.create(bundle);
            }

            public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
View Full Code Here

    private void activate(BundleContext context,Map<String, Object> config) {
        Properties p = new Properties();
        p.setProperty("filter.scope","REQUEST");
        //The MDC Filter might be running in a non Sling container. Hence to avoid
        //direct dependency on Sling we use a ServiceFactory
        filterReg = context.registerService(Filter.class.getName(),new ServiceFactory() {
            private Object instance;

            public synchronized Object getService(Bundle bundle, ServiceRegistration serviceRegistration) {
                if(instance == null){
                    instance = new SlingMDCFilter();
View Full Code Here

            this.ftpServer = ftpServer;
        } catch (FtpException e) {
            log.error("Cannot start FTP Server", e);
        }

        this.webConsolePlugin = bundleContext.registerService("javax.servlet.Servlet", new ServiceFactory() {

            public Object getService(Bundle bundle, ServiceRegistration registration) {
                final WebConsoleFtpLet tmp = new WebConsoleFtpLet();
                wcPlugin.setDelegatee(tmp);
                return tmp;
View Full Code Here

TOP

Related Classes of org.osgi.framework.ServiceFactory

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.