Announcement Announcement Module
Collapse
No announcement yet.
Configuration Context from another locations... Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Configuration Context from another locations...

    Hi All,

    I am in need of retrieving configuration contexts from a network node so I can configure for example ... menu items on the fly...

    Can I do it in current version of RCP?

    Thanks

    Indra

  • #2
    Indra,

    try to use org.springframework.context.access.ContextSingleto nBeanFactoryLocator, or DefaultLocatorFactory in the same package.
    This singletons are intended to instantiate AppCtx using beanRefContext.xml file, where you can specify the real appCtx sources (e.g. http://org.foo/myAppCtx.xml).

    But I think that just for dynamic menu loading is better other solution.
    Use the mentioned ContextSingletonBeanFactoryLocator (or DefaultLocatorFactory) and specify there local appCtx files.

    Create a bean like
    Code:
    pubilc interface MenuSource {
    	MenuItem getMenu();
    	MenuItem getMenu(MenuItem item);
    	MenuItem getMenu(Principal user);
    	...
    }
    
    public class RemoteMenuSource {
    	public MenuItem getMenu() {
    		// call the server to get the menu
    		// using specified remoting service
    	}
    }
    Then let the UI code, which builds the menu, use the MenuSource bean (of course configured by Spring :-). E.g.
    Code:
    public class ApplicationFrame {
    	private MenuSource menuSource;
    	public setMenuSource(MenuSource menuSource) {
    		thie.menuSource = menuSource;
    	}
    
    	...
    
    	public init(...) {
    		MenuItem mainMenu = menuSource.getMenu();
    		...
    	}
    }
    and config it by
    Code:
    	<bean name="menuSource" class="RemoteMenuSource"/>
    	<bean name="applicationFrame" class="ApplicationFrame">
    		<property name="menuSource"><ref bean="menuSource"/></property>
    	</bean>
    Hope this help

    Comment

    Working...
    X