Author: deepal
Date: Thu Dec 20 23:04:16 2007
New Revision: 11633

Log:

provide a way to give base uri , so now we do not need to rely on /atom we can 
give anything as the uri and create a remote registry 

Modified:
   
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/AtomRegistry.java
   
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/RemoteRegistry.java
   
trunk/registry/modules/core/src/test/java/org/wso2/registry/app/JettyBasedServerTest.java
   trunk/registry/modules/documentation/pom.xml
   
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/AbstractRegistryAction.java

Modified: 
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/AtomRegistry.java
==============================================================================
--- 
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/AtomRegistry.java
   (original)
+++ 
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/AtomRegistry.java
   Thu Dec 20 23:04:16 2007
@@ -633,6 +633,7 @@
                     RegistryConstants.URL_SEPARATER +
                     RegistryConstants.PARAMETER_TAGS;
             feed.addLink(nodeLink);
+            feed.setUpdated(new Date());
 
             for (int i = 0; i < tags.length; i++) {
                 Tag tag = tags[i];
@@ -752,6 +753,7 @@
             Feed feed = factory.newFeed();
             TaggedResourcePath tagpaths[] = 
registry.getResourcePathsWithTag(tag);
             feed.setId("http://wso2.org/registry/TagPaths";);
+            feed.setUpdated(new Date());
             feed.setTitle("TagPaths for" + tag);
             for (TaggedResourcePath tagPath : tagpaths) {
                 Entry entry = abdera.getFactory().newEntry();

Modified: 
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/RemoteRegistry.java
==============================================================================
--- 
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/RemoteRegistry.java
 (original)
+++ 
trunk/registry/modules/core/src/main/java/org/wso2/registry/app/RemoteRegistry.java
 Thu Dec 20 23:04:16 2007
@@ -41,26 +41,24 @@
 
 public class RemoteRegistry implements Registry {
 
-    private String collectionRoot = "http://localhost:8080/wso2registry/atom";;
+    private String baseURI;
     private Log log = LogFactory.getLog(RemoteRegistry.class);
 
     /**
      * To create a remote registry need to provide a URL of a remote registry 
and the URL should be
-     * something like http://localhost:8080/wso2registry NOTE : Should not 
have "/" after the
-     * wso2registry part
+     * something like http://localhost:8080/wso2registry/atom/r1
      *
-     * @param registryURL : URL to the registry
+     * @param registryURL : URL to the registry ror to the resource
      * @throws RegistryException : If something went wrong
      */
     public RemoteRegistry(URL registryURL) throws RegistryException {
-        String url = registryURL.toString();
-        collectionRoot = url + "/atom";
+        baseURI = registryURL.toString();
     }
 
     public Resource get(String path) throws RegistryException {
         Abdera abdera = new Abdera();
         AbderaClient abderaClient = new AbderaClient(abdera);
-        ClientResponse clientResponse = abderaClient.get(collectionRoot + 
path);
+        ClientResponse clientResponse = abderaClient.get(baseURI + path);
         if (clientResponse.getType() == Response.ResponseType.SERVER_ERROR) {
             throw new 
RegistryException(Messages.getMessage("resource.not.found.warn", path));
         }
@@ -172,7 +170,7 @@
                 entry.setContent((String) content);
             }
         }
-        ClientResponse resp = abderaClient.post(collectionRoot + path, entry);
+        ClientResponse resp = abderaClient.post(baseURI + path, entry);
         if (resp.getType() == Response.ResponseType.SUCCESS) {
             log.info(Messages.getMessage("resource.add", path));
         } else {
@@ -184,7 +182,7 @@
     public void delete(String path) throws RegistryException {
         Abdera abdera = new Abdera();
         AbderaClient abderaClient = new AbderaClient(abdera);
-        ClientResponse resp = abderaClient.delete(collectionRoot + path);
+        ClientResponse resp = abderaClient.delete(baseURI + path);
         if (resp.getType() == Response.ResponseType.SUCCESS) {
             log.info(Messages.getMessage("resource.deleted", path));
         } else {
@@ -196,7 +194,7 @@
     public String[] getVersions(String path) throws RegistryException {
         Abdera abdera = new Abdera();
         AbderaClient abderaClient = new AbderaClient(abdera);
-        ClientResponse clientResponse = abderaClient.get(collectionRoot + path 
+
+        ClientResponse clientResponse = abderaClient.get(baseURI + path +
                 RegistryConstants.URL_SEPARATER +
                 RegistryConstants.PARAMETER_VERSION);
         Document introspection =
@@ -218,7 +216,7 @@
         Abdera abdera = new Abdera();
         AbderaClient abderaClient = new AbderaClient(abdera);
         Entry entry = abdera.getFactory().newEntry();
-        ClientResponse resp = abderaClient.put(collectionRoot + versionPath +
+        ClientResponse resp = abderaClient.put(baseURI + versionPath +
                 RegistryConstants.URL_SEPARATER +
                 RegistryConstants.PARAMETER_RESTORE, entry);
         if (resp.getType() == Response.ResponseType.SUCCESS) {
@@ -234,7 +232,7 @@
         AbderaClient abderaClient = new AbderaClient(abdera);
         Entry entry = abdera.getFactory().newEntry();
         entry.setContent(tag);
-        ClientResponse resp = abderaClient.put(collectionRoot + resourcePath +
+        ClientResponse resp = abderaClient.put(baseURI + resourcePath +
                 RegistryConstants.URL_SEPARATER +
                 RegistryConstants.PARAMETER_TAGS, entry);
         if (resp.getType() == Response.ResponseType.SUCCESS) {
@@ -248,7 +246,7 @@
     public TaggedResourcePath[] getResourcePathsWithTag(String tag) throws 
RegistryException {
         Abdera abdera = new Abdera();
         AbderaClient abderaClient = new AbderaClient(abdera);
-        ClientResponse clientResponse = abderaClient.get(collectionRoot +
+        ClientResponse clientResponse = abderaClient.get(baseURI +
                 RegistryConstants.URL_SEPARATER +
                 RegistryConstants.PARAMETER_TAG_PATHS +
                 ":" + tag);
@@ -273,7 +271,7 @@
     public Tag[] getTags(String resourcePath) throws RegistryException {
         Abdera abdera = new Abdera();
         AbderaClient abderaClient = new AbderaClient(abdera);
-        ClientResponse clientResponse = abderaClient.get(collectionRoot +
+        ClientResponse clientResponse = abderaClient.get(baseURI +
                 resourcePath +
                 RegistryConstants.URL_SEPARATER +
                 RegistryConstants.PARAMETER_TAGS);
@@ -300,7 +298,7 @@
         AbderaClient abderaClient = new AbderaClient(abdera);
         Entry entry = abdera.getFactory().newEntry();
         entry.setContent(tag);
-        ClientResponse resp = abderaClient.put(collectionRoot + path +
+        ClientResponse resp = abderaClient.put(baseURI + path +
                 RegistryConstants.URL_SEPARATER +
                 RegistryConstants.PARAMETER_TAGS_REMOVED, entry);
         if (resp.getType() == Response.ResponseType.SUCCESS) {
@@ -318,7 +316,7 @@
         entry.setUpdated(comment.getCommentedTime());
         entry.addAuthor(comment.getCommentedUser());
         entry.setContent(comment.getCommentText());
-        ClientResponse resp = abderaClient.put(collectionRoot + resourcePath +
+        ClientResponse resp = abderaClient.put(baseURI + resourcePath +
                 RegistryConstants.URL_SEPARATER +
                 RegistryConstants.PARAMETER_COMMENTS, entry);
         if (resp.getType() == Response.ResponseType.SUCCESS) {
@@ -332,7 +330,7 @@
     public Comment[] getComments(String resourcePath) throws RegistryException 
{
         Abdera abdera = new Abdera();
         AbderaClient abderaClient = new AbderaClient(abdera);
-        ClientResponse clientResponse = abderaClient.get(collectionRoot + 
resourcePath +
+        ClientResponse clientResponse = abderaClient.get(baseURI + 
resourcePath +
                 RegistryConstants.URL_SEPARATER +
                 RegistryConstants.PARAMETER_COMMENTS);
         Document introspection =
@@ -361,7 +359,7 @@
         Entry entry = abdera.getFactory().newEntry();
         entry.setContent("" + rating);
         entry.setSummary(RegistryConstants.PARAMETER_RATINGS);
-        ClientResponse resp = abderaClient.put(collectionRoot + resourcePath +
+        ClientResponse resp = abderaClient.put(baseURI + resourcePath +
                 RegistryConstants.URL_SEPARATER +
                 RegistryConstants.PARAMETER_RATINGS, entry);
         if (resp.getType() == Response.ResponseType.SUCCESS) {
@@ -375,7 +373,7 @@
     public float getAverageRating(String resourcePath) throws 
RegistryException {
         Abdera abdera = new Abdera();
         AbderaClient abderaClient = new AbderaClient(abdera);
-        ClientResponse clientResponse = abderaClient.get(collectionRoot + 
resourcePath +
+        ClientResponse clientResponse = abderaClient.get(baseURI + 
resourcePath +
                 RegistryConstants.URL_SEPARATER +
                 RegistryConstants.PARAMETER_AVERAGE_RATINGS);
         Document introspection =
@@ -389,7 +387,7 @@
         Abdera abdera = new Abdera();
         AbderaClient abderaClient = new AbderaClient(abdera);
         ClientResponse clientResponse =
-                abderaClient.get(collectionRoot + path +
+                abderaClient.get(baseURI + path +
                         RegistryConstants.URL_SEPARATER +
                         RegistryConstants.PARAMETER_RATINGS + ":" + userName);
         Document introspection =
@@ -405,7 +403,7 @@
         AbderaClient abderaClient = new AbderaClient(abdera);
         RequestOptions requestOptions = new RequestOptions();
         requestOptions.addHeader("parameters", 
encodeParametesAsString(parameters));
-        ClientResponse resp = abderaClient.get(collectionRoot + path +
+        ClientResponse resp = abderaClient.get(baseURI + path +
                 RegistryConstants.URL_SEPARATER +
                 RegistryConstants.PARAMETER_QUERY, requestOptions);
         Document introspection =
@@ -445,7 +443,7 @@
         requestOptions.addDateHeader("FromDate", from);
         requestOptions.addHeader("Action", "" + action);
         requestOptions.addHeader("Author", userName);
-        ClientResponse resp = abderaClient.get(collectionRoot + resourcePath +
+        ClientResponse resp = abderaClient.get(baseURI + resourcePath +
                 RegistryConstants.URL_SEPARATER +
                 RegistryConstants.PARAMETER_LOGS, requestOptions);
         Document introspection =

Modified: 
trunk/registry/modules/core/src/test/java/org/wso2/registry/app/JettyBasedServerTest.java
==============================================================================
--- 
trunk/registry/modules/core/src/test/java/org/wso2/registry/app/JettyBasedServerTest.java
   (original)
+++ 
trunk/registry/modules/core/src/test/java/org/wso2/registry/app/JettyBasedServerTest.java
   Thu Dec 20 23:04:16 2007
@@ -45,7 +45,7 @@
         try {
             if (registry == null) {
                 initJetty();
-                registry = new RemoteRegistry(new 
URL("http://localhost:8081/wso2registry";));
+                registry = new RemoteRegistry(new 
URL("http://localhost:8081/wso2registry/atom";));
             }
         } catch (Exception e) {
             fail("Failed to initialize the registry.");

Modified: trunk/registry/modules/documentation/pom.xml
==============================================================================
--- trunk/registry/modules/documentation/pom.xml        (original)
+++ trunk/registry/modules/documentation/pom.xml        Thu Dec 20 23:04:16 2007
@@ -173,6 +173,10 @@
             <artifactId>xml-apis</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.apache.ws.commons.schema</groupId>
+            <artifactId>XmlSchema</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.mortbay.jetty</groupId>
             <artifactId>jetty</artifactId>
             <version>6.1.5</version>

Modified: 
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/AbstractRegistryAction.java
==============================================================================
--- 
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/AbstractRegistryAction.java
      (original)
+++ 
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/AbstractRegistryAction.java
      Thu Dec 20 23:04:16 2007
@@ -49,8 +49,8 @@
                         
             ServletContext context =
                     request.getSession().getServletContext();
-            JDBCRegistry jdbcRegistry =
-                    (JDBCRegistry) 
context.getAttribute(RegistryConstants.REGISTRY);
+            Registry jdbcRegistry =
+                    (Registry) 
context.getAttribute(RegistryConstants.REGISTRY);
             RegistryRealm realm = (RegistryRealm) 
request.getSession().getServletContext().
                                         
getAttribute(RegistryConstants.REGISTRY_REALM);
             SecureRegistry secureRegistry = new SecureRegistry(

_______________________________________________
Registry-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/registry-dev

Reply via email to