Package org.apache.hivemind.internal

Examples of org.apache.hivemind.internal.ServicePoint


        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


    {
        Registry registry = buildFrameworkRegistry("testMBeanRegistry.xml");
        List mBeanList = registry.getConfiguration("hivemind.management.MBeans");

        // Training
        ServicePoint sp1 = ((MBeanRegistrationContribution) mBeanList.get(0)).getServicePoint();
        Object mBean1 = registry.getService("test.management.MBean1", Runnable.class);
        ObjectName on1 = objectNameBuilder.createServiceObjectName(sp1);
        server.registerMBean(mBean1, on1);
        serverControl.setReturnValue(new ObjectInstance(on1, mBean1.getClass().getName()));
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

    public void testServicePointTranslator()
    {
        MockControl control = newControl(Module.class);
        Module m = (Module) control.getMock();

        ServicePoint sp = new ServicePointImpl();

        m.getServicePoint("Fred");
        control.setReturnValue(sp);

        replayControls();

        Translator t = new ServicePointTranslator();

        ServicePoint result = (ServicePoint) t.translate(m, null, "Fred");

        assertSame(sp, result);

        verifyControls();
    }
View Full Code Here

    public ServicePoint getServicePoint(String serviceId)
    {
        checkShutdown();

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

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

        return result;
View Full Code Here

        return result;
    }

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

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

        if (servicePoints.size() > 1)
            throw new ApplicationRuntimeException(
                ImplMessages.multipleServicePointsForInterface(serviceInterface, servicePoints));

        ServicePoint sp = (ServicePoint) servicePoints.get(0);

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

    public boolean containsService(String serviceId, Class serviceInterface)
    {
        checkShutdown();

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

        if (point == null)
            return false;

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

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

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

            ServicePointDefinition spd = factoryPoint.getServicePointDefinition();
            if (!(spd instanceof XmlServicePointDefinitionImpl)) {
                // TODO annotations: Externalize message
                throw new ApplicationRuntimeException("ServicePoint used as InterceptorFactory must be of type XmlServicePointDefinitionImpl");
            }
            XmlServicePointDefinitionImpl xmlServicePoint = (XmlServicePointDefinitionImpl) spd;
            Schema schema = xmlServicePoint.getParametersSchema();
            if (schema != null) {

                SchemaProcessorImpl processor = new SchemaProcessorImpl(factoryPoint.getErrorLog(),
                        schema);
               
                _convertedParameters = constructParametersContainer(schema.getRootElementClassName(), factoryPoint.getModule());
                processor.process(_convertedParameters, _parameters, contributingModule);
            }
        }
    }
View Full Code Here

     * @see org.apache.hivemind.internal.RegistryInfrastructure#getServicePoint(java.lang.String, org.apache.hivemind.internal.Module)
     */
    public ServicePoint getServicePoint(String serviceId, Module module)
    {
        checkShutdown();
        ServicePoint result = (ServicePoint) _servicePoints.get(serviceId);
        if (result == null)
        {
            if (serviceId.indexOf('.') == -1)
            {
                final List possibleMatches = getMatchingServiceIds(serviceId);
                if (!possibleMatches.isEmpty())
                {
                    final StringBuffer sb = new StringBuffer();
                    for (Iterator i = possibleMatches.iterator(); i.hasNext();)
                    {
                        final String matching = (String) i.next();
                        sb.append('\"');
                        sb.append(matching);
                        sb.append('\"');
                        if (i.hasNext())
                        {
                            sb.append(", ");
                        }
                    }
                    throw new ApplicationRuntimeException(ImplMessages.unqualifiedServicePoint(
                            serviceId,
                            sb.toString()));
                }
            }
            throw new ApplicationRuntimeException(ImplMessages.noSuchServicePoint(serviceId));
        }

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

        return result;
    }
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.