Results 1 to 2 of 2

Thread: Configuration Context from another locations...

  1. #1
    Join Date
    Aug 2004
    Location
    Indonesia
    Posts
    1

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Slovakia
    Posts
    6

    Default

    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

Similar Threads

  1. Replies: 2
    Last Post: Oct 13th, 2005, 02:47 PM
  2. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM
  3. Replies: 6
    Last Post: May 8th, 2005, 11:09 AM
  4. Replies: 2
    Last Post: Mar 9th, 2005, 03:43 PM
  5. Replies: 5
    Last Post: Aug 27th, 2004, 07:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •