Bug #91 (closed)
Opened 18 years ago
Closed 18 years ago
Property names and bean lookups should not be raw strings
Reported by: | anonymous | Owned by: | jamoore |
---|---|---|---|
Priority: | trivial | Cc: | |
Sprint: | n.a. | ||
Total Remaining Time: | n.a. |
Description (last modified by jmoore)
Configuration property names such as:
- hibernate.connection.url
- server.port
- renderService
- ...
should be available somewhere for static checking. This need not necessarily be a single interface, but rather in some sensible location.
There is a similar need for looking up services by name.
Change History (6)
comment:1 Changed 18 years ago by jmoore
- Status changed from new to assigned
comment:2 Changed 18 years ago by jmoore
- Component changed from API to Configuration
- Keywords set to spring
- Milestone set to Unscheduled
- Version changed from 3.0-M1 to 3.0-M2
An idea coming from #183 for solving this involves moving all (or at least most) to similar classes (Login,Server,OMEDirectory,...) and using these within the configuration files (pseudo-Spring markup):
<bean id="defaultProperties" class="..."> <bean class="ome.config.Login"/> <bean class="ome.config.Server"/> </bean> <bean id="nonDefaultProperties" class="..."> <bean class="ome.config.Login"> <arg>${myName}</arg> <arg>${myPassword}</arg> </bean> <bean class="ome.config.Server"/> </bean> Another option would be to move all config to the DB (except for that needed to access the DB).
comment:3 Changed 18 years ago by jmoore
- Milestone changed from Unscheduled to 3.0-M3
Scheduling for the next milestone because of issues like that fixed in r750.
comment:4 Changed 18 years ago by jmoore
- Description modified (diff)
- Summary changed from Property names should be available as fields to Property names and bean lookups should not be raw strings
r766 introduces several new fixes for this. In general, everyone should avoid looking up services (or really anything) directly from an OmeroContext and especially from the global, static OmeroContext.
Now several methods rather than taking strings take generic service interfaces if the form:
public <T extends ServiceInterface> T lookup(Class<T> klass);
This is achieved by all service beans being named "<prefix>:<interface>" where prefix is currently "managed" or "internal". There are also two ServiceFactory subclasses (InternalServiceFactory and ManagedServiceFactory) which will only return the respective services.
comment:5 Changed 18 years ago by jmoore
comment:6 Changed 18 years ago by jmoore
- Keywords changed from spring to spring, iteration5
- Resolution set to fixed
- Status changed from assigned to closed
Closing this. Particular values should iterface-ized, but we don't need to keep this ticket running until then.
This has happened partially with r704. (Login.java) but will need to be extended. Especially ServiceFactory.java suffers from this. A better technique would possibly be to consistently use interface names (Class.getName()) with a prefix:
This could then be internalized as: