Package org.apache.hivemind.definition.impl

Examples of org.apache.hivemind.definition.impl.ModuleDefinitionHelper


{
    public StringHolderModule(String serviceModel)
    {
        super("hivemind.test.services", null, new DefaultClassResolver(), null);
       
        ModuleDefinitionHelper helper = new ModuleDefinitionHelper(this);
        ServicePointDefinition sp = helper.addServicePoint("StringHolder", StringHolder.class.getName());
        helper.addSimpleServiceImplementation(sp, StringHolderImpl.class.getName(), serviceModel);
       
        InterceptorConstructor constructor = new AbstractServiceInterceptorConstructor(getLocation()) {

            public void constructServiceInterceptor(InterceptorStack interceptorStack, Module contributingModule)
            {
                ClassFactory cf = (ClassFactory) contributingModule.getService(ClassFactory.class);
                // Create the interceptor with the LoggingInterceptorClassFactory which is quite uncomfortable
                // in the moment
                LoggingInterceptorClassFactory f = new LoggingInterceptorClassFactory(cf);
                Class interceptorClass = f.constructInterceptorClass(interceptorStack, Collections.EMPTY_LIST);
                Constructor c = interceptorClass.getConstructors()[0];
                Object interceptor;
                try
                {
                    interceptor = c.newInstance(new Object[] { interceptorStack.getServiceLog(), interceptorStack.peek() });
                }
                catch (Exception e) {
                    throw new ApplicationRuntimeException(e);
                }
                interceptorStack.push(interceptor);
            }};
        InterceptorDefinition interceptor = new InterceptorDefinitionImpl(helper.getModule(), "hivemind.LoggingInterceptor", getLocation(), constructor);
        sp.addInterceptor(interceptor);
    }
View Full Code Here


     * Creates a Registry with one module, that defines a Service "Reverser" which is a POJO
     */
    private Registry createRegistryWithPojo(final String serviceModel)
    {
        ModuleDefinitionImpl module = createModuleDefinition("bean");
        ModuleDefinitionHelper helper = new ModuleDefinitionHelper(module);

        ServicePointDefinition sp1 = helper.addServicePoint("Reverser", Reverser.class.getName());
        helper.addSimpleServiceImplementation(sp1, Reverser.class.getName(), serviceModel);

        return buildFrameworkRegistry(module);
    }   
View Full Code Here

TOP

Related Classes of org.apache.hivemind.definition.impl.ModuleDefinitionHelper

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.