Hi Thomas,

Thomas Mueller wrote:
So, you wouldn't have any interface that defines shutdown()? This is
bad because:

- Applications must hardcode a specific class,
org.apache.jackrabbit.core.RepositoryImpl

you have to hard code that in any case, because otherwise you cannot start the repository.

- Applications can only be compatible to one specific implementation
(Jackrabbit, or CRX)
- Wrappers (for example JCRLog) are impossible

why is that an issue? repository construction and destruction is not specified in JSR 170 nor in JSR 283. applications will always have to write implementation specific code to shutdown a repository.

Repository closing can and should be implementation independent. I
know repository creation is not, and that's already bad enough (I hope
this will be fixed in JCR 2.0).

JSR 283 will have a standardized mechanism to 'connect' to a repository. whether that also include repository construction is probably implementation dependent. repository shutdown is not mentioned at all.

Let's compare this to the JDBC API (as an example). An application
that uses the JDBC API can look like this:

1) import java.sql.*;
2) Class.forName(jdbcDriverClassName);
3) Connection conn = DriverManager.getConnection(url, user, password);
4) conn.close();

The application does not have to import any database vendor or version
specific classes. The driver, url, user and password are parameters
(strings). When using newer versions of Java, you don't even need line
2 (drivers are discovered automatically).

When using your approach, it would look like this:

1) import java.sql.*;
2) import com.oracle10.*;
3) OracleConnectionImpl conn = OracleConnectionImpl.create(...);
4) conn.close();

If you switch from Oracle to PostgreSQL, you would have to change the
import statement and recompile the application. Maybe even if you
change from Oracle 10 to Oracle 11 (because you are importing classes
in line 2, not just interfaces). Your have to pass a specific class
(OracleConnectionImpl) in your application if you close the connection
somewhere else.

but this is about getting a connection and closing it again, which is equivalent to obtaining a JCR session and logging out when your done. that's already standardized in JSR 170.

regards
 marcel

Reply via email to