geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r945527 - in /geronimo/server/branches/3.0-M1: framework/configs/j2ee-system/src/main/plan/ framework/modules/geronimo-system/ framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/ plugins/j2ee/j2ee-server/src/...
Date Tue, 18 May 2010 07:49:36 GMT
Author: xuhaihong
Date: Tue May 18 07:49:35 2010
New Revision: 945527

URL: http://svn.apache.org/viewvc?rev=945527&view=rev
Log:
Add a wrapper GBean for SystemLog

Added:
    geronimo/server/branches/3.0-M1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/OSGILogServiceWrapper.java
  (with props)
Modified:
    geronimo/server/branches/3.0-M1/framework/configs/j2ee-system/src/main/plan/plan.xml
    geronimo/server/branches/3.0-M1/framework/modules/geronimo-system/pom.xml
    geronimo/server/branches/3.0-M1/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml
    geronimo/server/branches/3.0-M1/plugins/j2ee/j2ee-server/src/main/plan/plan.xml

Modified: geronimo/server/branches/3.0-M1/framework/configs/j2ee-system/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M1/framework/configs/j2ee-system/src/main/plan/plan.xml?rev=945527&r1=945526&r2=945527&view=diff
==============================================================================
--- geronimo/server/branches/3.0-M1/framework/configs/j2ee-system/src/main/plan/plan.xml (original)
+++ geronimo/server/branches/3.0-M1/framework/configs/j2ee-system/src/main/plan/plan.xml Tue
May 18 07:49:35 2010
@@ -114,17 +114,9 @@ specific services - those should be prov
             <name>ArtifactResolver</name>
         </reference>
     </gbean>
-
-    <!-- Logging service -->
-    <!--
-    <gbean name="Logger" class="org.apache.geronimo.osgi.logging.log4j.Log4jService">
-        <attribute name="configFileName">var/log/server-log4j.properties</attribute>
-        <attribute name="refreshPeriodSeconds">60</attribute>
-        <reference name="ServerInfo">
-            <name>ServerInfo</name>
-        </reference>
-    </gbean>
-    -->
+    
+    <gbean name="Logger" class="org.apache.geronimo.system.logging.OSGILogServiceWrapper">
      
+    </gbean>    
 
     <gbean name="GeronimoOBR" class="org.apache.geronimo.obr.GeronimoOBRGBean">
         <reference name="Repository">

Modified: geronimo/server/branches/3.0-M1/framework/modules/geronimo-system/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M1/framework/modules/geronimo-system/pom.xml?rev=945527&r1=945526&r2=945527&view=diff
==============================================================================
--- geronimo/server/branches/3.0-M1/framework/modules/geronimo-system/pom.xml (original)
+++ geronimo/server/branches/3.0-M1/framework/modules/geronimo-system/pom.xml Tue May 18 07:49:35
2010
@@ -62,6 +62,12 @@
             <artifactId>geronimo-kernel</artifactId>
             <version>${project.version}</version>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.geronimo.framework</groupId>
+            <artifactId>geronimo-pax-logging</artifactId>
+            <version>${project.version}</version>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.geronimo.framework</groupId>

Added: geronimo/server/branches/3.0-M1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/OSGILogServiceWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/OSGILogServiceWrapper.java?rev=945527&view=auto
==============================================================================
--- geronimo/server/branches/3.0-M1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/OSGILogServiceWrapper.java
(added)
+++ geronimo/server/branches/3.0-M1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/OSGILogServiceWrapper.java
Tue May 18 07:49:35 2010
@@ -0,0 +1,110 @@
+/**
+ *  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.
+ */
+
+package org.apache.geronimo.system.logging;
+
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.apache.geronimo.logging.SystemLog;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class OSGILogServiceWrapper implements SystemLog, GBeanLifecycle {
+
+    private SystemLog wrappedSystemLog;
+
+    private String filter;
+
+    private BundleContext bundleContext;
+
+    private ServiceReference serviceReference;
+
+    public OSGILogServiceWrapper(@ParamSpecial(type = SpecialAttributeType.bundleContext)
BundleContext bundleContext, @ParamAttribute(name = "filter") String filter) {
+        this.filter = filter;
+        this.bundleContext = bundleContext;
+    }
+
+    @Override
+    public String getConfigFileName() {
+        return wrappedSystemLog.getConfigFileName();
+    }
+
+    @Override
+    public String[] getLogFileNames() {
+        return wrappedSystemLog.getLogFileNames();
+    }
+
+    @Override
+    public SearchResults getMatchingItems(String logFile, Integer firstLine, Integer lastLine,
String minLevel, String regex, int maxResults, boolean includeStackTraces) {
+        return wrappedSystemLog.getMatchingItems(logFile, firstLine, lastLine, minLevel,
regex, maxResults, includeStackTraces);
+    }
+
+    @Override
+    public int getRefreshPeriodSeconds() {
+        return wrappedSystemLog.getRefreshPeriodSeconds();
+    }
+
+    @Override
+    public String getRootLoggerLevel() {
+        return wrappedSystemLog.getRootLoggerLevel();
+    }
+
+    @Override
+    public void setConfigFileName(String fileName) {
+        wrappedSystemLog.setConfigFileName(fileName);
+    }
+
+    @Override
+    public void setRefreshPeriodSeconds(int seconds) {
+        wrappedSystemLog.setRefreshPeriodSeconds(seconds);
+    }
+
+    @Override
+    public void setRootLoggerLevel(String level) {
+        wrappedSystemLog.setRootLoggerLevel(level);
+    }
+
+    @Override
+    public void doFail() {
+        stop();
+    }
+
+    @Override
+    public void doStart() throws Exception {
+        ServiceReference[] serviceReferences = bundleContext.getServiceReferences(SystemLog.class.getName(),
filter);
+        if (serviceReferences != null && serviceReferences.length > 0) {
+            serviceReference = serviceReferences[0];
+            wrappedSystemLog = (SystemLog) bundleContext.getService(serviceReference);
+        }
+    }
+
+    @Override
+    public void doStop() throws Exception {
+        stop();
+    }
+
+    private void stop() {
+        if (serviceReference != null) {
+            bundleContext.ungetService(serviceReference);
+        }
+    }
+}

Propchange: geronimo/server/branches/3.0-M1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/OSGILogServiceWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/branches/3.0-M1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/OSGILogServiceWrapper.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/branches/3.0-M1/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/logging/OSGILogServiceWrapper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/branches/3.0-M1/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M1/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml?rev=945527&r1=945526&r2=945527&view=diff
==============================================================================
--- geronimo/server/branches/3.0-M1/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml
(original)
+++ geronimo/server/branches/3.0-M1/plugins/j2ee/j2ee-server/src/main/history/dependencies.xml
Tue May 18 07:49:35 2010
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<plugin-artifact xmlns:ns2="http://geronimo.apache.org/xml/ns/attributes-1.2" xmlns="http://geronimo.apache.org/xml/ns/plugins-1.3">
+<plugin-artifact xmlns="http://geronimo.apache.org/xml/ns/plugins-1.3" xmlns:ns2="http://geronimo.apache.org/xml/ns/attributes-1.2">
     <module-id>
         <groupId>org.apache.geronimo.configs</groupId>
         <artifactId>j2ee-server</artifactId>

Modified: geronimo/server/branches/3.0-M1/plugins/j2ee/j2ee-server/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-M1/plugins/j2ee/j2ee-server/src/main/plan/plan.xml?rev=945527&r1=945526&r2=945527&view=diff
==============================================================================
--- geronimo/server/branches/3.0-M1/plugins/j2ee/j2ee-server/src/main/plan/plan.xml (original)
+++ geronimo/server/branches/3.0-M1/plugins/j2ee/j2ee-server/src/main/plan/plan.xml Tue May
18 07:49:35 2010
@@ -75,9 +75,9 @@
     </gbean>
 
     <gbean name="JVM" class="org.apache.geronimo.j2ee.management.impl.JVMImpl">
-        <!--<reference name="SystemLog">-->
-            <!--<name>Logger</name>-->
-        <!--</reference>-->
+        <reference name="SystemLog">
+            <name>Logger</name>
+        </reference>
     </gbean>
 
     <gbean name="ServerSystemProperties"



Mime
View raw message