From 1fe315346425dcdea73feebd431aba7ae2a75f61 Mon Sep 17 00:00:00 2001
From: Glyn Normington
Date: Tue, 20 Apr 2010 15:38:13 +0100
Subject: [bug 307650] initial check-in from dm Server Virgo medic
0a647883a0176f60d8572f51c7eff591b7e408b6
---
.../ConfigurationPublicationFailedException.java | 30 +++++++
.../virgo/medic/log/DelegatingPrintStream.java | 34 ++++++++
.../org/eclipse/virgo/medic/log/EntryExitTrace.aj | 99 ++++++++++++++++++++++
.../virgo/medic/log/LoggingConfiguration.java | 19 +++++
.../medic/log/LoggingConfigurationPublisher.java | 34 ++++++++
5 files changed, 216 insertions(+)
create mode 100644 org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/ConfigurationPublicationFailedException.java
create mode 100644 org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/DelegatingPrintStream.java
create mode 100644 org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/EntryExitTrace.aj
create mode 100644 org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/LoggingConfiguration.java
create mode 100644 org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/LoggingConfigurationPublisher.java
(limited to 'org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log')
diff --git a/org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/ConfigurationPublicationFailedException.java b/org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/ConfigurationPublicationFailedException.java
new file mode 100644
index 0000000..e2bbf0e
--- /dev/null
+++ b/org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/ConfigurationPublicationFailedException.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.medic.log;
+
+/**
+ * Thrown by {@link LoggingConfigurationPublisher} when a request to publish logging configuration fails.
+ */
+public class ConfigurationPublicationFailedException extends Exception {
+
+ private static final long serialVersionUID = 4317804271280636565L;
+
+ /**
+ * Creates a new exception with the supplied message and cause.
+ *
+ * @param message The exception's message
+ * @param cause The exception's cause
+ */
+ public ConfigurationPublicationFailedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/DelegatingPrintStream.java b/org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/DelegatingPrintStream.java
new file mode 100644
index 0000000..131f597
--- /dev/null
+++ b/org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/DelegatingPrintStream.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.medic.log;
+
+import java.io.PrintStream;
+
+/**
+ * A DelegatingPrintStream
is a {@link PrintStream} implementation that delegates to another
+ * {@link PrintStream} instance and allows the delegate to be changed at runtime.
+ *
printStream
may be
+ * null
to disable delegation.
+ *
+ * @param printStream The delegate, or null
to disable delegation.
+ */
+ void setDelegate(PrintStream printStream);
+}
diff --git a/org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/EntryExitTrace.aj b/org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/EntryExitTrace.aj
new file mode 100644
index 0000000..5e4d2c0
--- /dev/null
+++ b/org.eclipse.virgo.medic/src/main/java/org/eclipse/virgo/medic/log/EntryExitTrace.aj
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 VMware Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VMware Inc. - initial contribution
+ *******************************************************************************/
+
+package org.eclipse.virgo.medic.log;
+
+import org.aspectj.lang.JoinPoint;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An aspect that will advise any method with entry and exit trace logging.
+ *
+ * Concurrent SemanticsLoggingConfigurationPublisher
is used to publish {@link LoggingConfiguration} into the service
+ * registry. LoggingConfiguration
instances in the service registry are referenced by bundles using the
+ * Medic-LoggingConfiguration
manifest header.
+ */
+public interface LoggingConfigurationPublisher {
+
+ /**
+ * Publishes the configuration in the supplied File
as a LoggingConfiguration
instance,
+ * identified with the supplied id. The published configuration can then be referenced by a bundle using the
+ * Medic-LoggingConfiguration
manifest header with a value equal to the supplied id.
+ *
+ * @param configuration The configuration to be published
+ * @param id The identifier to be applied to the configuration when its published
+ *
+ * @throws ConfigurationPublicationFailedException if the publication of the configuration fails
+ */
+ void publishConfiguration(File configuration, String id) throws ConfigurationPublicationFailedException;
+}
--
cgit v1.2.3