Package org.osgi.service.discovery

Examples of org.osgi.service.discovery.ServiceEndpointDescription


            }           
        };

        Map<String, Object> props = new HashMap<String, Object>();
        props.put("osgi.remote.requires.intents", "A");
        ServiceEndpointDescription sd =
            new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
       
        List<String> effectiveIntents =
            Arrays.asList(p.applyIntents(dswContext, callingContext, features, factory, sd));
        assertEquals(3, effectiveIntents.size());
View Full Code Here


    }
       
    protected void processNotification(DiscoveredServiceNotification notification,
                                       BundleContext requestingContext) {
           
        ServiceEndpointDescription sd =
            notification.getServiceEndpointDescription();
        if ((sd.getProperty(Constants.EXPORTED_INTERFACES) == null) &&
            (sd.getProperty(Constants.EXPORTED_INTERFACES_OLD) == null)) {
            return;
        }
           
        ConfigurationTypeHandler handler =
            ServiceHookUtils.getHandler(getContext(), sd, getDistributionProvider(), getHandlerProperties());
View Full Code Here

            }           
        };

        Map<String, Object> props = new HashMap<String, Object>();
        props.put("osgi.remote.requires.intents", "A SOAP.1_2");
        ServiceEndpointDescription sd =
            new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
       
        List<String> effectiveIntents =
            Arrays.asList(p.applyIntents(dswContext, callingContext, features, factory, sd));
        assertEquals(2, effectiveIntents.size());
View Full Code Here

        DistributionProviderImpl dp = new DistributionProviderImpl(dswContext);

        Map<String, Object> props = new HashMap<String, Object>();
        props.put("osgi.remote.requires.intents", requestedIntents);
        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
       
        PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext, dp, handlerProps) {
            @Override
            IntentMap getIntentMap(BundleContext ctx) {
                if (ctx == callingContext) {
View Full Code Here

       
        DistributionProviderImpl dp = new DistributionProviderImpl(dswContext);

        Map<String, Object> props = new HashMap<String, Object>();
        props.put("osgi.remote.requires.intents", "B A");
        ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(Arrays.asList(String.class.getName()), props);
       
        PojoConfigurationTypeHandler p = new PojoConfigurationTypeHandler(dswContext, dp, handlerProps) {
            @Override
            IntentMap getIntentMap(BundleContext ctx) {
                if (ctx == callingContext) {
View Full Code Here

            public Object answer() throws Throwable {
                return props.get(EasyMock.getCurrentArguments()[0]);
            }           
        }).anyTimes();
        BundleContext callingContext = EasyMock.createNiceMock(BundleContext.class);
        ServiceEndpointDescription sd = TestUtils.mockServiceDescription("Foo");
        EasyMock.replay(sr);
        EasyMock.replay(callingContext);
        EasyMock.replay(sd);

        p.createServer(sr, dswContext, callingContext, sd, String.class, myService);
View Full Code Here

            public Object answer() throws Throwable {
                return props.get(EasyMock.getCurrentArguments()[0]);
            }           
        }).anyTimes();
        BundleContext callingContext = EasyMock.createNiceMock(BundleContext.class);
        ServiceEndpointDescription sd = TestUtils.mockServiceDescription("Foo");
        EasyMock.replay(sr);
        EasyMock.replay(callingContext);
        EasyMock.replay(sd);

        try {
View Full Code Here

        }
    }

    private class DiscoveryCallback implements DiscoveredServiceTracker {
        public void serviceChanged(DiscoveredServiceNotification notification) {
            ServiceEndpointDescription notified =
                notification.getServiceEndpointDescription();
            switch (notification.getType()) {

            case AVAILABLE:
               LOG.info("Notified - AVAILABLE: "
                         + notified.getProvidedInterfaces()
                         + " endpoint id: "
                         + notification.getServiceEndpointDescription().getProperty(ENDPOINT_ID));
                processNotification(notification, getContext());
                break;

            case UNAVAILABLE:
                LOG.info("Notified - UNAVAILABLE: " + notified.getProvidedInterfaces()
                         + notified.getProvidedInterfaces()
                         + " endpoint id: "
                         + notification.getServiceEndpointDescription().getProperty(ENDPOINT_ID));
                unCacheEndpointId(notified);
                break;

            case MODIFIED:
                LOG.info("Notified - MODIFIED: " + notified.getProvidedInterfaces());
                // we don't currently use this notification, but we could do
                // so to allow to support transparent service re-location
                break;
            }
        }
View Full Code Here

    public void doTestGetPublishableInterfaces(Object requested,
                                               String[] actual,
                                               String[] expected)
        throws Exception {
        ServiceEndpointDescription sd =
            EasyMock.createMock(ServiceEndpointDescription.class);
        ServiceReference sref = EasyMock.createMock(ServiceReference.class);
        EasyMock.expect(sd.getProperty("service.exported.interfaces")).andReturn(requested);
        EasyMock.expect(sd.getProperty("osgi.remote.interfaces")).andReturn(null);
        EasyMock.expect(sref.getProperty(org.osgi.framework.Constants.OBJECTCLASS)).andReturn(actual);
        EasyMock.replay(sd);
        EasyMock.replay(sref);
       
        String[] ret = OsgiUtils.getPublishableInterfaces(sd, sref);
View Full Code Here

            }).anyTimes();
        EasyMock.expect(sr.getBundle()).andReturn(b).anyTimes();
        EasyMock.replay(sr);
       
        // Actual test starts here
        ServiceEndpointDescription sd = OsgiUtils.getRemoteReference(sr, true);
        assertEquals("*", sd.getProperties().get("osgi.remote.interfaces"));
        assertEquals("jaxb", sd.getProperties().get(Constants.WS_DATABINDING_PROP_KEY));
       
        EasyMock.verify(sr);
    }
View Full Code Here

TOP

Related Classes of org.osgi.service.discovery.ServiceEndpointDescription

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.