Hello.
As best as I can tell there are a couple of different conventions for naming
your services:
1. Interface Names
The service is named after the java interface which defines it's contract:
MyService myservice = (MyService) m_manager.lookup("org.proj.MyService");
or
MyService myservice = (MyService)
m_manager.lookup(MyService.class.getName());
(where m_manager = ServiceManager instance)
2. ROLE Names
Similiar to above, but the name itself is defined by a static ROLE variable:
public interface MyService {
public static String ROLE = MyService.class.getName();
}
MyService myservice = (MyService) m_manager.lookup(MyService.ROLE);
3. Descriptive String Names
Some "arbitrary" descriptive string which is defined in a meta-info or roles
file. I've seen this in Merlin and in EOB (in examples):
MyService myservice = (MyService) m_manager.lookup( "MyService" );
Is there a best practice?
It seems to me that (1) is the most commonly used, though I've used the ROLE
method quite a bit myself. (3) doesn't look like a good idea, or is there a
reasonable use case for it?
Did I miss any? Also if I recall, there was a question about why we use Strings
at all instead of Class objects.
Thanks,
jaaron
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]