| Summary: | Repo config logic broken when supportingAudits/Branches props missing | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Caspar D. <caspar_d> | ||||
| Component: | cdo.core | Assignee: | Eike Stepper <stepper> | ||||
| Status: | CLOSED FIXED | QA Contact: | Eike Stepper <stepper> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | stepper | ||||
| Version: | 4.0 | Flags: | caspar_d:
review?
(stepper) |
||||
| Target Milestone: | --- | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Caspar D.
(In reply to comment #0) > The store is created after the repo, Usually the store is created *before* the repository is created. > yet the repo config logic > assumes it can call on the store to obtain the audit/branching support > from the store if the repo config has no properties to that effect. > This gives a NullPointerException from Repository.java:291 or 301 The code assumes that the store is passed into the repo before the properties are injected and that properties are actualley injected at all. This seems indeed strange. I think I changed this in the context of bug 301512 so that the new delegating mapping strategy can decide early which concrete delegate to create. Any suggestions on how to solve this? (In reply to comment #1) > Any suggestions on how to solve this? Let's remove the automagic smartness and throw an exception if the config param is missing from the config file. Patch in a sec. Created attachment 189572 [details]
Patch
Notwithstanding my patch (which does eliminate the problem), I actually think the whole approach is wrong here. Requiring the repo to be passed into the store factory, so that the mappingStrategy can be configured correctly, is like passing a car into a wheel factory so that some bolt can be sized correctly. The way I see it, wheel factories shouldn't require cars to do their job, they should just receive the dimensions of the wheel... I agree. But the repo properties could be passed down. That would eliminate the wrong dependency and still allow a delegating mapping strategy to access the auditing/branching properties ;-) Committed revision 7315: - trunk/plugins/org.eclipse.emf.cdo.server - trunk/plugins/org.eclipse.emf.cdo.server.db - trunk/plugins/org.eclipse.emf.cdo.server.db4o - trunk/plugins/org.eclipse.emf.cdo.server.hibernate - trunk/plugins/org.eclipse.emf.cdo.server.mongodb - trunk/plugins/org.eclipse.emf.cdo.server.objectivity I removed the IIRepository dependency from:
public interface IStoreFactory
{
public String getStoreType();
public IStore createStore(String repositoryName, Map<String, String> repositoryProperties, Element storeConfig);
}
Committed revision 7319: - trunk/plugins/org.eclipse.emf.cdo.server - trunk/plugins/org.eclipse.emf.cdo.tests Available in R20110608-1407 |