Package org.apache.hivemind.definition

Examples of org.apache.hivemind.definition.ServicePointDefinition


     * the thread is cleaned up. Note: this service should be considered deprecated; use the
     * threaded service model instead.
     */
    private void addThreadLocalStorage(ModuleDefinition md)
    {
        ServicePointDefinition spd = helper.addServicePoint(
                "ThreadLocalStorage",
                ThreadLocalStorage.class.getName());
        helper.addSimpleServiceImplementation(spd, ThreadLocalStorageImpl.class.getName(), ServiceModel.THREADED);
    }
View Full Code Here


     * Stores the locale for the current thread. The default is determined when the Registry is
     * first constructed. This locale is used for any messages.
     */
    private void addThreadLocale(ModuleDefinition md)
    {
        ServicePointDefinition spd = helper.addServicePoint("ThreadLocale", ThreadLocale.class.getName());

        // Define inline implementation constructor
        ImplementationConstructor constructor = new AbstractServiceImplementationConstructor(md.getLocation())
        {

View Full Code Here

    /**
     * A source of event notifications for when the Registry is shutdown.
     */
    private void addShutdownCoordinator(ModuleDefinition md)
    {
        ServicePointDefinition spd = helper.addServicePoint("ShutdownCoordinator", ShutdownCoordinator.class.getName());
        helper.addSimpleServiceImplementation(spd, ShutdownCoordinatorImpl.class.getName(), ServiceModel.SINGLETON);
    }
View Full Code Here

    /**
     * Service that performs eager loading of other services. This service is contributed into the hivemind.Startup configuration.
     */
    private void addEagerLoad(ModuleDefinition md)
    {
        ServicePointDefinition spd = helper.addServicePoint("EagerLoad", Runnable.class.getName());

        // Define inline implementation constructor, that wires the EagerLoad configuration
        ImplementationConstructor constructor = new AbstractServiceImplementationConstructor(md.getLocation())
        {
            public Object constructCoreServiceImplementation(ImplementationConstructionContext context)
View Full Code Here

     * Runnable object or service within as the last step of the Registry construction phase.
     * Note that the execution order is arbitrary and the startup objects are NOT executed in separate threads.
     */
    private void addStartup(ModuleDefinition md)
    {
        ServicePointDefinition spd = helper.addServicePoint("Startup", Runnable.class.getName());

        // Define inline implementation constructor, that wires the Startup configuration
        ImplementationConstructor constructor = new AbstractServiceImplementationConstructor(md.getLocation())
        {
            public Object constructCoreServiceImplementation(ImplementationConstructionContext context)
View Full Code Here

    /**
     * Synthesizes a service interface from an ordinary JavaBean.
     */
    private void addInterfaceSynthesizer(ModuleDefinition md)
    {
        ServicePointDefinition spd = helper.addServicePoint("InterfaceSynthesizer", InterfaceSynthesizer.class.getName());

        // Define inline implementation constructor
        ImplementationConstructor constructor = new AbstractServiceImplementationConstructor(md.getLocation())
        {
            public Object constructCoreServiceImplementation(ImplementationConstructionContext context)
View Full Code Here

    /**
      * Service that wires properties of object with services defined in the registry. 
      */
    private void addAutowiring(ModuleDefinition md)
    {
        ServicePointDefinition spd = helper.addServicePoint("Autowiring", Autowiring.class.getName());

        // Define inline implementation constructor, that wires the AutowiringStrategies configuration
        ImplementationConstructor constructor = new AbstractServiceImplementationConstructor(md.getLocation())
        {
            public Object constructCoreServiceImplementation(ImplementationConstructionContext context)
View Full Code Here

    public SimpleModule()
    {
        super("hivemind.test.services", createLocation(), new DefaultClassResolver(), null);
       
        ModuleDefinitionHelper helper = new ModuleDefinitionHelper(this);
        ServicePointDefinition sp = helper.addServicePoint("Simple", SimpleService.class.getName());
        helper.addSimpleServiceImplementation(sp, SimpleServiceImpl.class.getName(), ServiceModel.SINGLETON);
    }
View Full Code Here

    private Registry createEagerLoadModule(final String serviceModel)
    {
        ModuleDefinitionImpl module = createModuleDefinition("hivemind.test.services");
        ModuleDefinitionHelper helper = new ModuleDefinitionHelper(module);

        ServicePointDefinition sp1 = helper.addServicePoint("Loud", Runnable.class.getName());
        helper.addSimpleServiceImplementation(sp1, LoudRunner.class.getName(), serviceModel);

        // Add service point "Loud" to EagerLoad configuration point
        helper.addContributionDefinition("hivemind.EagerLoad", new Contribution()
        {
View Full Code Here

    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

TOP

Related Classes of org.apache.hivemind.definition.ServicePointDefinition

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.