Hi, >> The solution should be compliant with the JCR 2.0 API (specially >> regarding creating Repository objects). > > It can't be compliant, as the repository lifecycle is outside the > scope of JCR 2.0.
Creating the Repository object is specified in the JCR 2.0 API, and I don't see why Jackrabbit can't be compliant. Repository shutdown is not specified in the JCR 2.0 API, however for that we have the Jackrabbit API. The current mechanism is JackrabbitRepository.shutdown(). There is no access control, which is bad. One solution would be: JackrabbitRepository.shutdown(Session s). There are other solutions, but in any case this shouldn't affect how you _get_ the repository object. > You can use the RepositoryFactory to get reference > to a Repository instance, but that API is hardly sufficient for > controlling the lifecycle of the repository. Why? What's the problem? > Think of the complexity of controlling the lifecycle of Derby that > uses the DriverManager API in JDBC to startup and shutdown the > database. Derby is a very bad example: to close a database, you need to call DriverManager.getConnection. It just doesn't make any sense. Other databases provide betters ways. For HSQLDB and H2, you close the database by executing the SQL statement SHUTDOWN. This doesn't even require any new Java API. H2 by default closes the database when the last connection is closed (like TransientRepository), which is not always what you want, but OK. There is also a mechanism to specify a 'close delay'. Regards, Thomas
