You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by Bruno Silva <bs...@maisis.pt> on 2005/03/02 11:51:49 UTC

JDBC Store

Hi,

This week I have been trying to setup a Slide's JDBC store using
PostgresRDBMSAdapter. However, i am far from being successful. I have tried
looking at the source code and it seems to me there are some problems:

1. In org.apache.slide.store.impl.rdbms.PostgresRDBMSAdapter, method
revokePermission(Connection connection, Uri uri, NodePermission permission),
parameter 3 is set twice (maybe a typo?) and revisionNumber is not checked
for nullity which causes a nullpointerexception when revisionNumber is null.
I have sucessfully replaced it by the following code but i'm not really sure
if the query is accurate:

public void revokePermission(
		Connection connection,
		Uri uri,
		NodePermission permission)
		throws ServiceAccessException {
        if (permission == null) return;
		PreparedStatement statement = null;
		try {
			NodeRevisionNumber revisionNumber =
permission.getRevisionNumber();
			String query = "delete from PERMISSIONS where
(OBJECT_ID in (select URI_ID from URI where URI_STRING = ?)) and (SUBJECT_ID
in (select URI_ID from URI where URI_STRING = ?))" +
							"and (ACTION_ID in
(select URI_ID from URI where URI_STRING = ?)) ";
			query += revisionNumber != null ? " and (VERSION_NO
= ?)" : " and (VERSION_NO IS NULL)";
            statement =
				connection.prepareStatement(
					query);
			statement.setString(1, permission.getObjectUri());
			statement.setString(2, permission.getSubjectUri());
			statement.setString(3, permission.getActionUri());
			if (revisionNumber != null)
			    statement.setString(4,
revisionNumber.toString());
			System.out.println(statement.executeUpdate());
		} catch (SQLException e) {
			getLogger().log(e, LOG_CHANNEL, Logger.ERROR);
			throw new ServiceAccessException(service, e);
		} finally {
			close(statement);
		}
	}

2. If I execute an ACL method twice on the same resource, i get a SQL
exception that basically states i'm violating a primary key. The problem is
that it tries to insert the ACL to the permissions table again without
deleting it there violating the primary key. Perhaps the Postgres schema is
not correct, since this problem should not be specific to Postgres as
permissions are granted in StandardRDBMSAdapter?? Has anyone met this
problem as well?

3. Is binding fully supported by JDBC Store?

I'd also like to know if anyone has successfully configured Slide with a
JDBC store and managed to use all DAV methods (especially lock and acl).

Regards,
   Bruno Silva


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org


Re: JDBC Store

Posted by Martin Holz <ho...@fiz-chemie.de>.
"Bruno Silva" <bs...@maisis.pt> writes:

> 1. In org.apache.slide.store.impl.rdbms.PostgresRDBMSAdapter, method
> revokePermission(Connection connection, Uri uri, NodePermission permission),
> parameter 3 is set twice (maybe a typo?) and revisionNumber is not checked
> for nullity which causes a nullpointerexception when revisionNumber is null.
>
Handling of revisionNumber null was removed in revision 1.10, since it
was assumed, that  revisionNumbers are never null. Was this assumption 
wrong?
 

--
Martin Holz     <ho...@fiz-chemie.de>

Produktentwicklung 
FIZ CHEMIE Berlin
Franklinstrasse 11
D-10587 Berlin     


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org