Package org.apache.hivemind.internal

Examples of org.apache.hivemind.internal.ServicePoint


    {
        MockControl moduleControl = newControl(Module.class);
        Module module = (Module) moduleControl.getMock();

        MockControl factoryPointControl = newControl(ServicePoint.class);
        ServicePoint factoryPoint = (ServicePoint) factoryPointControl.getMock();

        MockControl factoryControl = newControl(ServiceImplementationFactory.class);
        ServiceImplementationFactory factory =
            (ServiceImplementationFactory) factoryControl.getMock();

        MockControl pointControl = newControl(ServicePoint.class);
        ServicePoint point = (ServicePoint) pointControl.getMock();

        InvokeFactoryServiceConstructor c = new InvokeFactoryServiceConstructor();

        MockControl errorHandlerControl = newControl(ErrorHandler.class);
        ErrorHandler eh = (ErrorHandler) errorHandlerControl.getMock();

        // Training !

        point.getServiceLog();
        pointControl.setReturnValue(LOG);

        module.getServicePoint("foo.bar.Baz");
        moduleControl.setReturnValue(factoryPoint);

        factoryPoint.getParametersCount();
        factoryPointControl.setReturnValue(Occurances.REQUIRED);

        factoryPoint.getService(ServiceImplementationFactory.class);
        factoryPointControl.setReturnValue(factory);

        factoryPoint.getParametersSchema();
        factoryPointControl.setReturnValue(null);

        module.getErrorHandler();
        moduleControl.setReturnValue(eh);

        String message =
            ImplMessages.wrongNumberOfParameters("foo.bar.Baz", 0, Occurances.REQUIRED);

        eh.error(LOG, message, null, null);

        point.getExtensionPointId();
        pointControl.setReturnValue("bleep.Bloop");

        point.getServiceInterface();
        pointControl.setReturnValue(Runnable.class);

        factory.createCoreServiceImplementation(
            "bleep.Bloop",
            Runnable.class,
View Full Code Here


{

    public void testToString()
    {
        MockControl control = MockControl.createControl(ServicePoint.class);
        ServicePoint mockServicePoint = (ServicePoint) control.getMock();

        new ConfigurationPointDescriptor().toString();
        new ContributionDescriptor().toString();
        new ImplementationDescriptor().toString();
        new CreateInstanceDescriptor().toString();
View Full Code Here

        while (i.hasNext())
        {
            if (following)
                buffer.append(", ");

            ServicePoint p = (ServicePoint) i.next();

            buffer.append(p.getExtensionPointId());

            following = true;
        }

        buffer.append("}");
View Full Code Here

        return classFab.createClass();
    }

    private Class createInnerProxyClass(Class deferredProxyClass)
    {
        ServicePoint servicePoint = getServicePoint();

        Class serviceInterface = servicePoint.getServiceInterface();
        ProxyBuilder builder = new ProxyBuilder("InnerProxy", servicePoint);

        ClassFab classFab = builder.getClassFab();

        classFab.addField("_deferredProxy", deferredProxyClass);
View Full Code Here

    private synchronized void setup()
    {
        if (_factory == null)
        {
            ServicePoint factoryPoint = _contributingModule.getServicePoint(_factoryServiceId);

            _factory =
                (ServiceInterceptorFactory) factoryPoint.getService(
                    ServiceInterceptorFactory.class);

            Schema schema = factoryPoint.getParametersSchema();

            SchemaProcessorImpl processor =
                new SchemaProcessorImpl(
                    _contributingModule.getErrorHandler(),
                    factoryPoint.getServiceLog(),
                    schema);

            processor.process(_parameters, _contributingModule);

            _convertedParameters = processor.getElements();
View Full Code Here

    public void run()
    {
        Iterator i = _servicePoints.iterator();
        while (i.hasNext())
        {
            ServicePoint point = (ServicePoint) i.next();

            point.forceServiceInstantiation();
        }
    }
View Full Code Here

    }

    public void testInvokeFactoryServiceConstructorAccessors()
    {
        Module m = new ModuleImpl();
        ServicePoint sep = new ServicePointImpl();
        List p = new ArrayList();
        InvokeFactoryServiceConstructor c = new InvokeFactoryServiceConstructor();

        c.setContributingModule(m);
        c.setServiceExtensionPoint(sep);
View Full Code Here

    public ServicePoint getServicePoint(String serviceId, Module module)
    {
        checkShutdown();

        ServicePoint result = (ServicePoint) _servicePoints.get(serviceId);

        if (result == null)
            throw new ApplicationRuntimeException(ImplMessages.noSuchServicePoint(serviceId));

        if (!result.visibleToModule(module))
            throw new ApplicationRuntimeException(ImplMessages.serviceNotVisible(serviceId, module));

        return result;
    }
View Full Code Here

        return result;
    }

    public Object getService(String serviceId, Class serviceInterface, Module module)
    {
        ServicePoint point = getServicePoint(serviceId, module);

        return point.getService(serviceInterface);
    }
View Full Code Here

        List servicePoints = (List) _servicePointsByInterfaceClassName.get(key);

        if (servicePoints == null)
            servicePoints = Collections.EMPTY_LIST;

        ServicePoint point = null;
        int count = 0;

        Iterator i = servicePoints.iterator();
        while (i.hasNext())
        {
            ServicePoint sp = (ServicePoint) i.next();

            if (!sp.visibleToModule(module))
                continue;

            point = sp;

            count++;
View Full Code Here

TOP

Related Classes of org.apache.hivemind.internal.ServicePoint

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.