Author: jboynes
Date: Sat Apr  8 16:02:21 2006
New Revision: 392627

URL: http://svn.apache.org/viewcvs?rev=392627&view=rev
Log:
tidy up monitoring events associated with the general runtime
start to add localized messages for core components

Added:
    
incubator/tuscany/java/sca/core/src/main/resources/org/apache/tuscany/core/MonitorMessages.properties
   (with props)
Removed:
    
incubator/tuscany/java/sca/core/src/main/resources/org/apache/tuscany/core/Messages.properties
Modified:
    
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/client/TuscanyRuntime.java

Modified: 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/client/TuscanyRuntime.java
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/client/TuscanyRuntime.java?rev=392627&r1=392626&r2=392627&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/client/TuscanyRuntime.java
 (original)
+++ 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/client/TuscanyRuntime.java
 Sat Apr  8 16:02:21 2006
@@ -16,7 +16,14 @@
  */
 package org.apache.tuscany.core.client;
 
+import java.util.List;
+
+import org.osoa.sca.ModuleContext;
+import org.osoa.sca.SCA;
+import org.osoa.sca.ServiceRuntimeException;
+
 import org.apache.tuscany.common.monitor.MonitorFactory;
+import org.apache.tuscany.common.monitor.LogLevel;
 import org.apache.tuscany.common.monitor.impl.NullMonitorFactory;
 import org.apache.tuscany.core.builder.ContextFactoryBuilder;
 import org.apache.tuscany.core.builder.impl.DefaultWireBuilder;
@@ -30,11 +37,6 @@
 import org.apache.tuscany.core.runtime.RuntimeContextImpl;
 import org.apache.tuscany.model.assembly.AssemblyModelContext;
 import org.apache.tuscany.model.assembly.ModuleComponent;
-import org.osoa.sca.ModuleContext;
-import org.osoa.sca.SCA;
-import org.osoa.sca.ServiceRuntimeException;
-
-import java.util.List;
 
 /**
  * Create and initialize a Tuscany SCA runtime environment.
@@ -83,7 +85,6 @@
         List<ContextFactoryBuilder> configBuilders = 
BootstrapHelper.getBuilders(monitorFactory);
         runtime = new RuntimeContextImpl(monitorFactory, configBuilders, new 
DefaultWireBuilder());
         runtime.start();
-        monitor.started(runtime);
 
         // Load and start the system configuration
         SystemCompositeContext systemContext = runtime.getSystemContext();
@@ -109,10 +110,10 @@
             moduleContext.fireEvent(EventContext.MODULE_START, null);
             moduleContext.fireEvent(EventContext.REQUEST_START, null);
             moduleContext.fireEvent(EventContext.SESSION_NOTIFY, sessionKey);
-            monitor.started(moduleContext);
+            monitor.moduleStarted(moduleContext.getName());
         } catch (CoreRuntimeException e) {
             setModuleContext(null);
-            monitor.startFailed(moduleContext, e);
+            monitor.moduleStartFailed(moduleContext.getName(), e);
             //FIXME throw a better exception
             throw new ServiceRuntimeException(e);
         }
@@ -128,9 +129,14 @@
         moduleContext.fireEvent(EventContext.SESSION_END, sessionKey);
         moduleContext.fireEvent(EventContext.MODULE_STOP, null);
         moduleContext.stop();
-        monitor.stopped(moduleContext);
+        monitor.moduleStopped(moduleContext.getName());
+    }
+
+    /**
+     * Shut down the Tuscany runtime.
+     */
+    public void shutdown() {
         runtime.stop();
-        monitor.stopped(runtime);
     }
 
     /**
@@ -138,25 +144,28 @@
      */
     public static interface Monitor {
         /**
-         * Event emitted after the runtime has been started.
+         * Event emitted after an application module has been started.
          *
-         * @param ctx the runtime's module component context
+         * @param name the name of the application module
          */
-        void started(CompositeContext ctx);
+        @LogLevel("INFO")
+        void moduleStarted(String name);
 
         /**
-         * Event emitted when an attempt to start the runtime failed.
+         * Event emitted when an attempt to start an application module failed.
          *
-         * @param ctx the runtime's module component context
-         * @param e   the exception that caused the failure
+         * @param name the name of the application module
+         * @param e    the exception that caused the failure
          */
-        void startFailed(CompositeContext ctx, CoreRuntimeException e);
+        @LogLevel("SEVERE")
+        void moduleStartFailed(String name, CoreRuntimeException e);
 
         /**
-         * Event emitted after the runtime has been stopped.
+         * Event emitted after an application module has been stopped.
          *
-         * @param ctx the runtime's module component context
+         * @param name the name of the application module
          */
-        void stopped(CompositeContext ctx);
+        @LogLevel("INFO")
+        void moduleStopped(String name);
     }
 }

Added: 
incubator/tuscany/java/sca/core/src/main/resources/org/apache/tuscany/core/MonitorMessages.properties
URL: 
http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/core/src/main/resources/org/apache/tuscany/core/MonitorMessages.properties?rev=392627&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/core/src/main/resources/org/apache/tuscany/core/MonitorMessages.properties
 (added)
+++ 
incubator/tuscany/java/sca/core/src/main/resources/org/apache/tuscany/core/MonitorMessages.properties
 Sat Apr  8 16:02:21 2006
@@ -0,0 +1,23 @@
+#  Copyright (c) 2006 The Apache Software Foundation or its licensors, as 
applicable.
+#
+#  Licensed 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.
+#
+#  $Rev$ $Date$
+#
+
+org.apache.tuscany.core.client.TuscanyRuntime$Monitor#moduleStarted = Started 
application module [{0}]
+org.apache.tuscany.core.client.TuscanyRuntime$Monitor#moduleStartFailed = 
Fatal exception starting application module [{0}]
+org.apache.tuscany.core.client.TuscanyRuntime$Monitor#moduleStopped = Stopped 
application module [{0}]
+
+org.apache.tuscany.core.loader.impl.StAXLoaderRegistryImpl$Monitor#registeringLoader
 = Registering StAXElementLoader for {0}
+org.apache.tuscany.core.loader.impl.StAXLoaderRegistryImpl$Monitor#elementLoad 
= Processing element {0}
\ No newline at end of file

Propchange: 
incubator/tuscany/java/sca/core/src/main/resources/org/apache/tuscany/core/MonitorMessages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/core/src/main/resources/org/apache/tuscany/core/MonitorMessages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev,Date


Reply via email to