Author: chathura
Date: Wed Jan 9 22:50:04 2008
New Revision: 12095
Log:
Changed the comment URLs generated by search processors and URL handlers to
match with the URLs defined in the protocol wiki page.
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/queries/SQLQueryProcessor.java
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentCollectionURLHandler.java
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentURLHandler.java
trunk/registry/modules/core/src/test/java/org/wso2/registry/jdbc/JDBCRegistryTest.java
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/queries/SQLQueryProcessor.java
==============================================================================
---
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/queries/SQLQueryProcessor.java
(original)
+++
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/queries/SQLQueryProcessor.java
Wed Jan 9 22:50:04 2008
@@ -148,7 +148,7 @@
path = result.getString(DatabaseConstants.PATH_FIELD);
}
- String commentPath = path + "?comment" + commentID;
+ String commentPath = path + ";comments:" + commentID;
commentPathList.add(commentPath);
}
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentCollectionURLHandler.java
==============================================================================
---
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentCollectionURLHandler.java
(original)
+++
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentCollectionURLHandler.java
Wed Jan 9 22:50:04 2008
@@ -39,7 +39,7 @@
public boolean handleURL(String url, Resource resource) throws
RegistryException {
- String[] parts = url.split("\\?");
+ String[] parts = url.split(";");
if (parts.length != 2) {
return false;
@@ -75,7 +75,7 @@
long[] commentIDs = commentsDAO.getCommentIDs(resourcePath, conn);
List commentPaths = new ArrayList();
for (int i = 0; i < commentIDs.length; i++) {
- String commentPath = resourcePath + "?comment" + commentIDs[i];
+ String commentPath = resourcePath + ";comments:" +
commentIDs[i];
commentPaths.add(commentPath);
}
String[] commentsContent =
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentURLHandler.java
==============================================================================
---
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentURLHandler.java
(original)
+++
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/urlhandlers/CommentURLHandler.java
Wed Jan 9 22:50:04 2008
@@ -47,7 +47,7 @@
*/
public boolean handleURL(String url, Resource resource) throws
RegistryException {
- String[] parts = url.split("\\?");
+ String[] parts = url.split(";");
if (parts.length != 2) {
return false;
@@ -57,11 +57,11 @@
return false;
}
- if (!parts[1].startsWith("comment")) {
+ if (!parts[1].startsWith("comments:")) {
return false;
}
- String commentID = parts[1].substring("comment".length());
+ String commentID = parts[1].substring("comments:".length());
if (!(commentID.length() > 0)) {
return false;
}
Modified:
trunk/registry/modules/core/src/test/java/org/wso2/registry/jdbc/JDBCRegistryTest.java
==============================================================================
---
trunk/registry/modules/core/src/test/java/org/wso2/registry/jdbc/JDBCRegistryTest.java
(original)
+++
trunk/registry/modules/core/src/test/java/org/wso2/registry/jdbc/JDBCRegistryTest.java
Wed Jan 9 22:50:04 2008
@@ -416,7 +416,7 @@
"' is not associated with the artifact /d12/r1",
commentFound);
try {
- Resource commentsResource = registry.get("/d12/r1?comments");
+ Resource commentsResource = registry.get("/d12/r1;comments");
assertTrue("Comment collection resource should be a directory.",
commentsResource.isDirectory());
String[] commentPaths = (String[])commentsResource.getContent();
@@ -434,7 +434,7 @@
} catch (RegistryException e) {
e.printStackTrace();
- fail("Failed to get comments form URL: /d12/r1?comments");
+ fail("Failed to get comments form URL: /d12/r1;comments");
}
try {
@@ -800,7 +800,7 @@
Resource comments = null;
try {
- comments = registry.get("/c1/r1?comments");
+ comments = registry.get("/c1/r1;comments");
} catch (RegistryException e) {
fail("Failed to get comments using URL.");
}
_______________________________________________
Registry-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/registry-dev