Michael Ralston schrieb: > Should the Item and Policy interfaces extend Transactionable?
It would be even simpler if they just wrote their XML content to a lenya:// source (RepositorySource). > I have problems with some usecase I have created, which involve manipulating > Users and Policies, if the usecase fails the repository nodes are not > committed but the AC changes happen instantly. > > I've done some playing around with this idea before but reversed my changes > as it became a huge change to AccreditableManager, ItemManager and > PolicyManager. > > Basically I had to make sure the RepositorySession was always passed all the > way down to PolicyManager.savePolicy (I know these don't exist in the > interface, I'm implying FilePolicyManager or whatever other implementation > it might be). > > With the repository session present in PolicyManager.savePolicy, the object > is not written but is marked to be written later when the transaction is > committed, as with other repository objects. The > Transactionable.saveTransactionable implemented on the Policy/Item will then > actually do the writing. > > I also don't think that ac Items should be responsible for creating and > saving themselves. Shouldn't their respective managers do this for them? This code is quite old and doesn't use many design patterns. But IMO item.save() is more straigtforward than manager.save(item). I'm not a fan of data objects :) > Eg... UserManager should have a createUser method, this makes it easier to > develop for different AC implementations as the Usecases no longer need to > know which class to instantiate to create a user. That's a good point. Maybe it should be String[] UserManager.getFactoryNames(); User UserManager.createUser(String factoryName) The UserManager would act as a facade to the factory to spare the usecase the factory instantiation. The factory name list could be used to display options on the "create user" screen. But I'm not sure if this is generic enough, since the constructor of the user object might require initial arguments. > Likewise, the User object shouldn't save itself, the UserManager should add > the Transactionable user object to the repository session so it gets saved > when the transaction is committed. That would happen automatically if a repository source is used to store the XML. IMO it's not necessary to add another repository implementation specifically for users. Thanks for your comments! BTW, there's already a closely related enhancement bug: http://issues.apache.org/bugzilla/show_bug.cgi?id=39664 -- Andreas --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
