[Registry-dev] svn commit r6655 - in trunk/registry/java/modules: core core/conf core/src/main/java/org/wso2/registry core/src/main/java/org/wso2/registry/i18n core/src/main/java/org/wso2/registry/servlet core/src/main/resources core/src/main/resources/org core/src/main/resources/org/wso2 core/src/main/resources/org/wso2/registry core/src/main/resources/org/wso2/registry/i18n webapps webapps/conf

svn at wso2.org svn at wso2.org
Tue Aug 28 23:53:03 PDT 2007


Author: deepal
Date: Tue Aug 28 23:52:44 2007
New Revision: 6655

Added:
   trunk/registry/java/modules/core/src/main/resources/
   trunk/registry/java/modules/core/src/main/resources/org/
   trunk/registry/java/modules/core/src/main/resources/org/wso2/
   trunk/registry/java/modules/core/src/main/resources/org/wso2/registry/
   trunk/registry/java/modules/core/src/main/resources/org/wso2/registry/i18n/
   trunk/registry/java/modules/core/src/main/resources/org/wso2/registry/i18n/resource.properties
Removed:
   trunk/registry/java/modules/core/src/main/java/org/wso2/registry/i18n/resource.properties
Modified:
   trunk/registry/java/modules/core/conf/log4j.properties
   trunk/registry/java/modules/core/pom.xml
   trunk/registry/java/modules/core/src/main/java/org/wso2/registry/Constants.java
   trunk/registry/java/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java
   trunk/registry/java/modules/webapps/conf/web.xml
   trunk/registry/java/modules/webapps/pom.xml
Log:
getting RegistryServlet working
- adding log properties and message properties 

Modified: trunk/registry/java/modules/core/conf/log4j.properties
==============================================================================
--- trunk/registry/java/modules/core/conf/log4j.properties	(original)
+++ trunk/registry/java/modules/core/conf/log4j.properties	Tue Aug 28 23:52:44 2007
@@ -18,7 +18,7 @@
 #
 
 # Set root category priority to INFO and its only appender to CONSOLE.
-log4j.rootCategory=DEBUG, CONSOLE
+log4j.rootCategory=INFO, CONSOLE
 #log4j.rootCategory=INFO, CONSOLE, LOGFILE
 
 # Set the enterprise logger priority to FATAL

Modified: trunk/registry/java/modules/core/pom.xml
==============================================================================
--- trunk/registry/java/modules/core/pom.xml	(original)
+++ trunk/registry/java/modules/core/pom.xml	Tue Aug 28 23:52:44 2007
@@ -12,6 +12,11 @@
     <packaging>jar</packaging>
     <name>WSO2 Registry - Core</name>
     <build>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>

Modified: trunk/registry/java/modules/core/src/main/java/org/wso2/registry/Constants.java
==============================================================================
--- trunk/registry/java/modules/core/src/main/java/org/wso2/registry/Constants.java	(original)
+++ trunk/registry/java/modules/core/src/main/java/org/wso2/registry/Constants.java	Tue Aug 28 23:52:44 2007
@@ -25,6 +25,8 @@
     public static final String PATH_SEPARATOR = "/";
 
     public static final String TAG_PROPERTY = "tag";
+    
+    public static final String REGISTRY_ENGINE = "RegistryEngine";
 
 
 }

Modified: trunk/registry/java/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java
==============================================================================
--- trunk/registry/java/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java	(original)
+++ trunk/registry/java/modules/core/src/main/java/org/wso2/registry/servlet/RegistryServlet.java	Tue Aug 28 23:52:44 2007
@@ -19,42 +19,78 @@
 
 package org.wso2.registry.servlet;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.registry.Constants;
 import org.wso2.registry.Registry;
 import org.wso2.registry.RegistryProvider;
 import org.wso2.registry.engine.RegistryEngine2;
+import org.wso2.registry.i18n.Messages;
 import org.wso2.registry.inmemory.InMemoryRegistryProvider;
 
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.ServletException;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.Map;
-import java.util.List;
-import java.util.ArrayList;
+import java.util.MissingResourceException;
 
 /**
  * Servlet for providing REST API for the registry.
  */
 public class RegistryServlet extends HttpServlet {
 
+    private static final Log log = LogFactory.getLog(RegistryServlet.class);
+    protected transient ServletConfig servletConfig;
+
     private Registry registry = null;
     private ActionProcessor[] actionProcessors = null;
 
     public void init(ServletConfig config) throws ServletException {
         super.init(config);
-
         RegistryProvider provider = new InMemoryRegistryProvider();
         registry = new RegistryEngine2(provider);
-
+        config.getServletContext().setAttribute(Constants.REGISTRY_ENGINE, registry);
+        try {
+            log.info(Messages.getMessage("server.initalized"));
+        } catch (MissingResourceException e) {
+            e.printStackTrace();  
+        }
+        System.out.println("*************************************Started*************************************");
         // todo: initialize the action processors
     }
 
+    public void init() throws ServletException {
+        if (this.servletConfig != null) {
+            init(this.servletConfig);
+        }
+    }
+
+
+    protected void doPost(HttpServletRequest httpServletRequest,
+                          HttpServletResponse httpServletResponse)
+            throws ServletException, IOException {
+        super.doPost(httpServletRequest, httpServletResponse);
+    }
+
+    protected void doPut(HttpServletRequest httpServletRequest,
+                         HttpServletResponse httpServletResponse)
+            throws ServletException, IOException {
+        super.doPut(httpServletRequest, httpServletResponse);
+    }
+
+    protected void doDelete(HttpServletRequest httpServletRequest,
+                            HttpServletResponse httpServletResponse)
+            throws ServletException, IOException {
+        super.doDelete(httpServletRequest, httpServletResponse);
+    }
+
     protected void doGet(HttpServletRequest request,
-                         HttpServletResponse response) throws ServletException, IOException {
+                         HttpServletResponse response)
+            throws ServletException, IOException {
 
         try {
             PrintWriter out = response.getWriter();
@@ -74,7 +110,8 @@
 
 
         } catch (IOException e) {
-            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+            //TODO : need to log the correct message
+            log.debug(e.getMessage());
         }
     }
 

Added: trunk/registry/java/modules/core/src/main/resources/org/wso2/registry/i18n/resource.properties
==============================================================================
--- (empty file)
+++ trunk/registry/java/modules/core/src/main/resources/org/wso2/registry/i18n/resource.properties	Tue Aug 28 23:52:44 2007
@@ -0,0 +1,43 @@
+#
+# 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.
+#
+
+# Translation instructions.
+# 1.  Each message line is of the form key=value.
+#     Translate the value, DO NOT translate the key.
+# 2.  The messages may contain arguments that will be filled in
+#     by the runtime.  These are of the form: {0}, {1}, etc.
+#     These must appear as is in the message, though the order
+#     may be changed to support proper language syntax.
+# 3.  If a single quote character is to appear in the resulting
+#     message, it must appear in this file as two consecutive
+#     single quote characters.
+# 4.  Lines beginning with "#" (like this one) are comment lines
+#     and may contain translation instructions.  They need not be
+#     translated unless your translated file, rather than this file,
+#     will serve as a base for other translators.
+#
+# Do not remove the following comment line. It is a variable used by a translation tool.
+# NLS_MESSAGEFORMAT_VAR
+
+#############################################################################
+# DO NOT TOUCH THESE PROPERTIES - THEY ARE AUTOMATICALLY UPDATED BY THE BUILD
+# PROCESS.
+builtOn=Built on @TODAY@
+#############################################################################
+server.initalized=RegistryEngine inialized
\ No newline at end of file

Modified: trunk/registry/java/modules/webapps/conf/web.xml
==============================================================================
--- trunk/registry/java/modules/webapps/conf/web.xml	(original)
+++ trunk/registry/java/modules/webapps/conf/web.xml	Tue Aug 28 23:52:44 2007
@@ -1,21 +1,29 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-
+<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
     <display-name>WSO2 Registry</display-name>
+    <servlet>
+        <servlet-name>RegistryServlet</servlet-name>
+        <servlet-class>org.wso2.registry.servlet.RegistryServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+     <servlet-mapping>
+        <servlet-name>RegistryServlet</servlet-name>
+        <url-pattern>/registry</url-pattern>
+    </servlet-mapping>
 
     <filter>
         <filter-name>struts2</filter-name>
         <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
     </filter>
-
     <filter-mapping>
         <filter-name>struts2</filter-name>
         <url-pattern>/*</url-pattern>
     </filter-mapping>
-
     <welcome-file-list>
       <welcome-file>index.jsp</welcome-file>
       <welcome-file>index.html</welcome-file>
-      <welcome-file>/axis2-web/index.jsp</welcome-file>
     </welcome-file-list>
 </web-app>

Modified: trunk/registry/java/modules/webapps/pom.xml
==============================================================================
--- trunk/registry/java/modules/webapps/pom.xml	(original)
+++ trunk/registry/java/modules/webapps/pom.xml	Tue Aug 28 23:52:44 2007
@@ -49,6 +49,13 @@
                                 <include>web.xml</include>
                             </includes>
                         </resource>
+                         <resource>
+                            <directory>${basedir}/../core/conf</directory>
+                            <targetPath>WEB-INF/classes</targetPath>
+                            <includes>
+                                <include>*.properties</include>
+                            </includes>
+                        </resource>
                     </webResources>
                 </configuration>
             </plugin>



More information about the Registry-dev mailing list