[ome-users] How to access OMERO config via the API?

Harri Jäälinoja harri.jaalinoja at helsinki.fi
Mon Apr 2 17:37:55 BST 2012


Hi,

I am trying to make it possible to configure my NewUserGroupBean 
implementation:
https://gist.github.com/2172934#file_src%2Fhyldap%2Fhy_new_user_group_bean.java

This is what I cut and pasted from elsewhere in the OMERO project:
         ServiceFactory sf = new ServiceFactory();
         IConfig c = sf.getConfigService();
         String hyldapConfig = c.getConfigValue(CONFIGFILE);

But when I try to run it, it goes like this:
org.springframework.beans.factory.access.BootstrapException: Unable to 
return specified BeanFactory instance: factory key [ome.client], from 
group with resource name [classpath*:beanRefContext.xml]; nested 
exception is 
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean 
named 'ome.client' is defined
         at 
org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:409)
         at ome.system.OmeroContext.getInstance(OmeroContext.java:203)
         at ome.system.ServiceFactory.<init>(ServiceFactory.java:81)
         at hyldap.HyNewUserGroupBean.groups(HyNewUserGroupBean.java:59)
         at ome.logic.LdapImpl.handleGroupSpecBean(LdapImpl.java:476)

What is the proper way to access the configuration? My idea is to give 
in OMERO configuration a path to a file that will contain a list of 
allowed group names found in our LDAP and the OMERO group names they 
should be mapped to.

omero config set "hyldap.configFile" "/home/omero/hyldapconfig.txt"

hyldapconfig.txt:
"uid=grp-A91900-bi-vart,ou=alma_workgroups,ou=groups,o=hy","BI-Vartiainen"
"uid=grp-A34520-biu,ou=alma_workgroups,ou=groups,o=hy","BIU"
etc... might make that xml, just to have a ready-made parser to use. In 
the first implementation I hard-coded these in the bean, which is not so 
nice to maintain.

Cheers,
Harri

-- 
__________________________________________________
Harri Jäälinoja
Light Microscopy Unit
Institute of Biotechnology, University of Helsinki
http://www.biocenter.helsinki.fi/bi/lmu/
+358 9 191 59370 fax +358 9 191 59366




More information about the ome-users mailing list