Examples of ServiceController


Examples of com.logica.mycocktail.controller.ServiceController

    protected final void processRequest(final HttpServletRequest request,
        final HttpServletResponse response)
        throws ServletException, IOException {
       
        String myCocktailPath = Utils.getMyCocktailPath(request);
        ServiceController serviceController = ServiceController.getInstance(myCocktailPath);
       
        Integer mashupId = null;
        String mashupFormat = null;
        String callbackFunction = "callback";
       
        String pathInfo = request.getPathInfo();
        if (pathInfo!= null && pathInfo.length() > 0) {
            pathInfo = pathInfo.substring(1);
            mashupId         = getMashupId(pathInfo);
            mashupFormat     = getMashupFormat(pathInfo);
            callbackFunction = getCallbackFunction(request, pathInfo);
        }
           
        if (mashupId != null) {
            Enumeration<String> en = request.getParameterNames();
            Map<String,String> mashupParams = new HashMap<String,String>();
            while(en.hasMoreElements()) {
                String key = en.nextElement();
                mashupParams.put(key, request.getParameter(key));
            }
           
            String json = serviceController.executeMashup(mashupId, mashupParams);
            StringBuilder result = new StringBuilder();
            if("JSON".equalsIgnoreCase(mashupFormat)) {
                response.setContentType("text/javascript;charset=UTF-8");
                result.append(json);
            } else if("XML".equalsIgnoreCase(mashupFormat)) {
View Full Code Here

Examples of org.apache.felix.ipojo.handlers.providedservice.ProvidedService.ServiceController

                }
            }
            if (update) {
                svc.update();
            }
            ServiceController ctrl = svc.getController(fieldName);
            if (ctrl != null) {
                if (value instanceof Boolean) {
                    ctrl.setValue((Boolean) value);
                } else {
                    warn("Boolean value expected for the service controller " + fieldName);
                }
            }
        }
View Full Code Here

Examples of org.apache.felix.ipojo.handlers.providedservice.ProvidedService.ServiceController

                if (fieldName.equals(prop.getField())) {
                    // Manage the No Value case.
                    return prop.onGet(pojo, fieldName, value);
                }
            }
            ServiceController ctrl = svc.getController(fieldName);
            if (ctrl != null) {
                return ctrl.getValue();
            }
        }
        // Else it is not a property
        return value;
    }
View Full Code Here

Examples of org.apache.felix.ipojo.handlers.providedservice.ProvidedService.ServiceController

                }
            }
            if (update) {
                svc.update();
            }
            ServiceController ctrl = svc.getController(fieldName);
            if (ctrl != null) {
                if (value instanceof Boolean) {
                    ctrl.setValue((Boolean) value);
                } else {
                    warn("Boolean value expected for the service controler " + fieldName);
                }
            }
        }
View Full Code Here

Examples of org.apache.felix.ipojo.handlers.providedservice.ProvidedService.ServiceController

                if (fieldName.equals(prop.getField())) {
                    // Manage the No Value case.
                    return prop.onGet(pojo, fieldName, value);
                }
            }
            ServiceController ctrl = svc.getController(fieldName);
            if (ctrl != null) {
                return new Boolean(ctrl.getValue());
            }
        }
        // Else it is not a property
        return value;
    }
View Full Code Here

Examples of org.apache.felix.ipojo.handlers.providedservice.ProvidedService.ServiceController

                }
            }
            if (update) {
                svc.update();
            }
            ServiceController ctrl = svc.getController(fieldName);
            if (ctrl != null) {
                if (value instanceof Boolean) {
                    ctrl.setValue((Boolean) value);
                } else {
                    warn("Boolean value expected for the service controller " + fieldName);
                }
            }
        }
View Full Code Here

Examples of org.apache.felix.ipojo.handlers.providedservice.ProvidedService.ServiceController

                if (fieldName.equals(prop.getField())) {
                    // Manage the No Value case.
                    return prop.onGet(pojo, fieldName, value);
                }
            }
            ServiceController ctrl = svc.getController(fieldName);
            if (ctrl != null) {
                return ctrl.getValue();
            }
        }
        // Else it is not a property
        return value;
    }
View Full Code Here

Examples of org.jboss.msc.service.ServiceController

    }

    private static InstancesService putIfAbsent(ServiceRegistry registry, ServiceName name, ServiceBuilder builder) throws StartException {
        for (; ; ) {
            try {
                ServiceController sc = registry.getService(name);
                if (sc == null) {
                    sc = builder.install();
                }
                return (InstancesService) sc.getService();
            } catch (DuplicateServiceException ignored) {
            } catch (Exception e) {
                throw new StartException(e);
            }
        }
View Full Code Here

Examples of org.jboss.msc.service.ServiceController

    private static void removeInstance(ServiceRegistry registry, BeanState state, final Class<?> clazz, Object bean) {
        if (clazz == null)
            return;

        ServiceController controller = registry.getService(BeanMetaDataConfig.toInstancesName(clazz, state));
        if (controller != null) {
            InstancesService service = (InstancesService) controller.getService();
            synchronized (clazz) {
                service.instances.remove(bean);
                invokeCallbacks(uncallbacks, state, clazz, bean);
                if (service.instances.isEmpty()) {
                    beans.remove(new TypeBeanStateKey(clazz, state));

                    controller.setMode(ServiceController.Mode.REMOVE);
                }
            }
        }

        removeInstance(registry, state, clazz.getSuperclass(), bean);
View Full Code Here

Examples of org.jboss.msc.service.ServiceController

        Mockito.verify(builder).addDependency(dummyService);
        Mockito.verify(builder).install();

        // Now we're going to check that the service that was created inside aii.update() works correctly...
        // First, mock up a separate ServiceController, specific to the service created in aii.update()
        ServiceController innerController = Mockito.mock(ServiceController.class);
        StartContext context = Mockito.mock(StartContext.class);
        Mockito.when(context.getController()).thenReturn(innerController);
        Assert.assertEquals(1, addedServices.size());

        // Call start() on the service, which should do its work...
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.