Author: chathura
Date: Fri Feb  8 04:01:48 2008
New Revision: 13473

Log:

 
Fixed minor issue. /system should not be created if it is already there.
Removed the old user guide.



Modified:
   
trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java
   trunk/registry/modules/documentation/xdocs/userguide.xml

Modified: 
trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java
==============================================================================
--- 
trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java
    (original)
+++ 
trunk/registry/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java
    Fri Feb  8 04:01:48 2008
@@ -87,13 +87,13 @@
                     registryContext.getDefaultDataBaseConfiguration();
             String dbType = System.getProperty("in-memory");
             if ((dbType != null && "true".equals(dbType)) ||
-                dbConfiguration.getConfigName().equals("in-memory")) {
+                    dbConfiguration.getConfigName().equals("in-memory")) {
                 registryRealm = new InMemoryRegistryRealm();
                 coreRegistry = new InMemoryJDBCRegistry(registryRealm);
             } else {
                 DataSource dataSource;
                 if (dbConfiguration.getDataSourceName() != null &&
-                    dbConfiguration.getDataSourceName().length() > 0) {
+                        dbConfiguration.getDataSourceName().length() > 0) {
                     try {
                         Context context = new InitialContext();
                         dataSource =
@@ -102,8 +102,8 @@
                     } catch (NamingException e) {
 
                         String msg = "Could not find the specified data source 
named: " +
-                                     dbConfiguration.getDataSourceName() + ". 
Caused by: " +
-                                     e.getMessage();
+                                dbConfiguration.getDataSourceName() + ". 
Caused by: " +
+                                e.getMessage();
                         log.fatal(msg, e);
                         throw new ServletException(msg, e);
                     }
@@ -121,19 +121,22 @@
 
             // create a system registry and put it in the context
             SecureRegistry systemRegistry = new 
SecureRegistry(RegistryConstants.SYSTEM_USER,
-                                                               
RegistryConstants.SYSTEM_PASSWORD,
-                                                               coreRegistry,
-                                                               registryRealm);
+                    RegistryConstants.SYSTEM_PASSWORD,
+                    coreRegistry,
+                    registryRealm);
 
             // create system resources
-            Resource systemCollection = new Resource();
-            systemCollection.setDirectory(true);
-            String systemDesc = "This collection is used to store system data 
of the " +
-                                "WSO2 Registry server. User nor the admins of 
the registry are not expected " +
-                                "to edit any content of this collection. 
Changing content of this collection " +
-                                "may result in unexpected behaviors.";
-            systemCollection.setDescription(systemDesc);
-            systemRegistry.put("/system", systemCollection);
+            if (!systemRegistry.resourceExists("/system")) {
+                
+                Resource systemCollection = new Resource();
+                systemCollection.setDirectory(true);
+                String systemDesc = "This collection is used to store system 
data of the " +
+                        "WSO2 Registry server. User nor the admins of the 
registry are not expected " +
+                        "to edit any content of this collection. Changing 
content of this collection " +
+                        "may result in unexpected behaviors.";
+                systemCollection.setDescription(systemDesc);
+                systemRegistry.put("/system", systemCollection);
+            }
 
             try {
                 AccessControlAdmin ac = registryRealm.getAccessControlAdmin();
@@ -206,8 +209,8 @@
             String path = fileElement.getPath();
             registry.put(path, fileElement);
             
request.getSession().setAttribute(RegistryConstants.STATUS_MESSAGE_NAME,
-                                              "Resource " + path +
-                                              " was successfully added to the 
registry.");
+                    "Resource " + path +
+                            " was successfully added to the registry.");
             response.setContentType("text/html");
             request.getRequestDispatcher(RegistryConstants.RESOURCES_JSP)
                     .forward(request, response);
@@ -216,7 +219,7 @@
 
             e.printStackTrace();
             
request.getSession().setAttribute(RegistryConstants.STATUS_MESSAGE_NAME,
-                                              e.getMessage());
+                    e.getMessage());
             response.setContentType("text/html");
             request.getRequestDispatcher(RegistryConstants.RESOURCES_JSP)
                     .forward(request, response);
@@ -238,11 +241,11 @@
             String path;
 
             if (uri.equals("") || 
uri.endsWith(RegistryConstants.RESOURCES_PATH +
-                                               
RegistryConstants.PATH_SEPARATOR)) {
+                    RegistryConstants.PATH_SEPARATOR)) {
                 path = RegistryConstants.ROOT_PATH;
             } else {
                 path = uri.substring((contextRoot + 
RegistryConstants.PATH_SEPARATOR +
-                                      
RegistryConstants.RESOURCES_PATH).length(), uri.length());
+                        RegistryConstants.RESOURCES_PATH).length(), 
uri.length());
             }
 
             // if user is browsing an old version of the resource, we append 
it to the path, so that

Modified: trunk/registry/modules/documentation/xdocs/userguide.xml
==============================================================================
--- trunk/registry/modules/documentation/xdocs/userguide.xml    (original)
+++ trunk/registry/modules/documentation/xdocs/userguide.xml    Fri Feb  8 
04:01:48 2008
@@ -1,295 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one
-  ~ or more contributor license agreements. See the NOTICE file
-  ~ distributed with this work for additional information
-  ~ regarding copyright ownership. The ASF licenses this file
-  ~ to you under the Apache License, Version 2.0 (the
-  ~ "License"); you may not use this file except in compliance
-  ~ with the License. You may obtain a copy of the License at
-  ~
-  ~ http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing,
-  ~ software distributed under the License is distributed on an
-  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  ~ KIND, either express or implied. See the License for the
-  ~ specific language governing permissions and limitations
-  ~ under the License.
-  -->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
-<html xmlns="http://www.w3.org/1999/xhtml";>
-<head>
-  <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
-  <title>WSO2 Registry- User's Guide</title>
-  <meta name="generator" content="Amaya 9.54, see http://www.w3.org/Amaya/"; />
-</head>
-
-<body>
-<h1>WSO2 Registry - User's Guide</h1>
-
-<p></p>
-
-<h2>Installation</h2>
-
-<p></p>
-
-<p>Check out the WSO2 Registry source from
-https://wso2.org/repos/wso2/trunk/registry. Then build the project by using
-the command "mvn clean install". It will create a zip archive containing the
-binaries and the documentation.</p>
-
-<p>Deploy the &lt;registry-home&gt;/modules/webapps/target/wso2-registry.war
-in a servlet container. In Apache Tomcat, this can be done by copying the
-wso2-registry.war to the &lt;tomcat-home&gt;/webapps directory.</p>
-
-<p>WSO2 Registry will use an in-memory database if a data source is not
-configured in the servlet container. If it is required to use some other
-database than the in-memory database, configure a data source named
-jdbc/WSO2RegistryDB in the servlet container.</p>
-
-<p>Now we are done with the installation.</p>
-
-<p></p>
-
-<h2>Browsing the Registry</h2>
-
-<p></p>
-
-<p>WSO2 Registry provides a Web UI to browse the resources in the registry.
-First sign in as admin user either using the edit UI or the human view UI.
-Open a web browser and point it to the URL
-http://localhost:8080/wso2registry/view (We assume that your servlet
-container runs on port 8080. If it runs on some other port, please replace
-the 8080 with the port used by your servlet container). You will get the
-browse view of the registry. Initially this will be empty as there are no
-resources in the registry at start up. Once you add resources and meta data
-to the registry using the edit UI described in the <a
-href="#editingResources">Adding and editing resource section</a>, you can use
-this UI to view those resources.</p>
-
-<p></p>
-
-<p>Resources in the root collection of the registry will be displayed in the
-home page. Name, average rating, last updated time, author and the
-description will be displayed for each resource. You can view the tags
-associated with resources by clicking on the "tags" link located in the right
-side of each resource row. Similarly the comments can be viewed by clicking
-on the "comments" link located next to the "tags" link. You can browse inside
-the collections by clicking on the name of the collection. Clicking on the
-name of other resources will display the resource content or prompt you to
-download the content depending on the media type.</p>
-
-<p></p>
-
-<h2>Interacting with the Registry using the human friendly UI</h2>
-
-<p></p>
-
-<p>WSO2 Registry provides a sophisticated UI for browing and editing
-resources and for managing other aspects of the Registry in a human friendly
-way. Open a web browser and point it the URL
-http://localhost:8080/wso2registry/admin. You will be prompted for sign in.
-Sign in with the user name "admin" and password "admin". You will be taken
-into the root collection of the Registry. There will be no resources at the
-start up. Now you can use the "Add Resource" and "Add Collection" sections
-located at the right side of the page to add new resources and collections to
-the root collection.</p>
-
-<p></p>
-
-<h3>Adding resources</h3>
-
-<p></p>
-
-<p>In the "Add Resource" section, type the name of the new resource and an
-optional description. Then click the Browse button to select a file to add as
-the resource content. Click Add button to add the new resource. Now you can
-see the newly cerated resource listed in the left side of the page with some
-details. Click details... link to view more details about the new resource.
-Now you can see a list of details about the resource. Note the "/" symbol
-appearing on the top left hand corner of the page. It provides a link to the
-parent collection of this resource. In this case, parent is the root of the
-Registry.</p>
-
-<p></p>
-
-<h3>Rating resources</h3>
-
-<p></p>
-
-<p>Under the "Rate this resource" section type a rating for the resource and
-click Rate button. You can see that the resource's rating value will be
-updated with average rating.</p>
-
-<p></p>
-
-<h3>Tagging resources</h3>
-
-<p></p>
-
-<p>Type the tag string in the text box under the Tags heading. Click Tag
-button. New tag appears under the Tags heading.</p>
-
-<p></p>
-
-<h3>Commenting resources</h3>
-
-<p></p>
-
-<p>Enter the comment text in the text area under the Comments section. Click
-Post comment button. You will see that the new comment will apear along with
-the author and the commented time.</p>
-
-<p></p>
-
-<h3>Adding collections</h3>
-
-<p></p>
-
-<p>Go to the root collection by clicking the "/" symbol on the top left hand
-corner. Type the name of the new collection under the "Add Collection"
-section. Optionally provide a description for the collection. Click Add
-button to create the collection. You will see the newly created collection
-appearing in the left side of the page. You can view and change the
-collection details by clicking on the details... link. You can browse the new
-collection by clicking on the name of the collection.</p>
-
-<p></p>
-
-<h3>Managing users</h3>
-
-<p></p>
-
-<p>Click on the "User Management" link on the top righ hand corner of the
-page. You can see the two built in users named "admin" and "anonymous". To
-add a new user, fill the "Add User" section in the right side of the page and
-click Add button. New user name will appear in the user list. Click on the
-cross sign next to the user name to remove that user.</p>
-
-<p></p>
-
-<h3>Managing permissions</h3>
-
-<p></p>
-
-<p>After you created a new user, click on the details.. link of a resource to
-give permissions for that resource. Under the Assign Permissions section
-select the newly created user. Then click on the permissions checkboxes to
-assign permissions. For example, give Get permission to the collection
-created in the previous step. We have to give the Get permissions for the
-root of the Registry as well. Otherwise, new user will not be able to browse
-the root and therefore will not have access to any resource. When you are
-browsing the root collection, you will see the text "You are browsin the root
-of the Registry. view details..." on the top of the page. Click the view
-details link and assign Get permission for the new user.</p>
-
-<p></p>
-
-<p>Now sign out by clicking the "Sign Out" link of the top right hand corner
-and sign in as the new user. You will see the resource and the collection
-added in previous steps. But details of the resource will be hidden and it
-will be marked as locked.</p>
-
-<p></p>
-
-<h2><a name="editingResources">Adding and Editing Resources</a></h2>
-
-<p></p>
-
-<p>WSO2 Registry provides a simple UI for adding and editing resources,
-comments, tags, etc. This is intended to use only for the testing of the
-registry which will be eventually removed, once an advanced admin UI is
-created. Open a Web browser and point it to the URL
-http://localhost:8080/wso2registry/edit. This will bring up the edit UI.</p>
-
-<p></p>
-
-<h3>Signing in</h3>
-
-<p></p>
-
-<p>Sign in as the admin user by typing the user name "admin" and password
-"admin" in the "Sign in" box and click on "Sign in" button. A message "Signed
-in successfully as admin" will be displayed on the top of the page. If you
-want to sign in as a different user, click on the "Sign out" link and sign-in
-with the required user name.</p>
-
-<p></p>
-
-<h3>Adding Resources</h3>
-
-<p></p>
-
-<p>Type the path of the new resource in the Path field of the "Add resource"
-section. Collections (i.e. directories) in the path may or may not exist in
-the registry. If collections in the typed path does not exist, they will be
-created automatically. Optionally you can give a description for the new
-resource in the Description field. Then select the file to be uploaded as the
-content of the new resource using the Browse button. Click the "Add" button
-to add the new resource. You will get a message "Resource &lt;path&gt; is
-successfully added to the registry" on the top of the page. Now you can view
-the resource using the view UI.</p>
-
-<p></p>
-
-<h3>Creating Collections</h3>
-
-<p></p>
-
-<p>Type the path of the new collection in the Path field of the "Create
-collection" section. Optionally add a description in the Description field.
-Then click the Create Collection button to create the new collection. Similar
-to the add resource operation, all non-existing collections of the given path
-will also be created automatically.</p>
-
-<p></p>
-
-<h3>Tagging Resources</h3>
-
-<p></p>
-
-<p>Type the path of the resource or a collection to be tagged in the Path
-field of the "Add tag" section. Type the tag in the Tag field. Click Add
-button to apply the tag to the given resource. Note that same user cannot tag
-the same resource with the same tag more than once. If it is attempted, an
-error message will be displayed on the top of the page.</p>
-
-<p></p>
-
-<h3>Commenting Resources</h3>
-
-<p></p>
-
-<p>Type the path of a resource in the Path field of the "Post comment"
-section. Type the comment text in the Comment field. Press the Post comment
-button.</p>
-
-<p></p>
-
-<h3>Rate Resources</h3>
-
-<p></p>
-
-<p>Type a path of a resource in the Path field of the"Rate" section. Type the
-rating value in the Rating field. Hit the Rate button to rate the resource.
-Note that a one user can have only one rating for a resource. If a user rated
-the same resource more than once, previous ratings will be overwritten by the
-last rating.</p>
-
-<p></p>
-
-<p></p>
-
-<p></p>
-
-<p></p>
-
-<p></p>
-
-<p></p>
-
-<p></p>
-</body>
-</html>

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

Reply via email to