You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/10/17 20:47:38 UTC
svn commit: r705703 - in /geronimo/gshell/trunk:
gshell-parser/src/test/java/org/apache/geronimo/gshell/parser/
gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/
gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshe...
Author: jdillon
Date: Fri Oct 17 11:47:37 2008
New Revision: 705703
URL: http://svn.apache.org/viewvc?rev=705703&view=rev
Log:
Add logging adapter for ivy
Tidy up some other component logging
Added:
geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/Slf4jMessageLogger.java (with props)
Modified:
geronimo/gshell/trunk/gshell-parser/src/test/java/org/apache/geronimo/gshell/parser/CommandLineParserTest.java
geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/IvyFactoryBean.java
geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerSupport.java
geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/MetaDataRegistryImpl.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginImpl.java
Modified: geronimo/gshell/trunk/gshell-parser/src/test/java/org/apache/geronimo/gshell/parser/CommandLineParserTest.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-parser/src/test/java/org/apache/geronimo/gshell/parser/CommandLineParserTest.java?rev=705703&r1=705702&r2=705703&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-parser/src/test/java/org/apache/geronimo/gshell/parser/CommandLineParserTest.java (original)
+++ geronimo/gshell/trunk/gshell-parser/src/test/java/org/apache/geronimo/gshell/parser/CommandLineParserTest.java Fri Oct 17 11:47:37 2008
@@ -272,10 +272,6 @@
ASTCommandLine cl = parse(input);
assertEquals(2, cl.jjtGetNumChildren());
-
- //
- // TODO: Verify 2 expressions
- //
}
public void testCompoundCommandLine2() throws Exception {
@@ -284,10 +280,6 @@
ASTCommandLine cl = parse(input);
assertEquals(1, cl.jjtGetNumChildren());
-
- //
- // TODO: Verify ...
- //
}
public void testCompoundCommandLine3() throws Exception {
@@ -296,10 +288,6 @@
ASTCommandLine cl = parse(input);
assertEquals(1, cl.jjtGetNumChildren());
-
- //
- // TODO: Verify ...
- //
}
public void testCompoundCommandLine4() throws Exception {
@@ -308,10 +296,6 @@
ASTCommandLine cl = parse(input);
assertEquals(2, cl.jjtGetNumChildren());
-
- //
- // TODO: Verify ...
- //
}
public void testNotCompoundCommandLine1() throws Exception {
@@ -320,10 +304,6 @@
ASTCommandLine cl = parse(input);
assertEquals(1, cl.jjtGetNumChildren());
-
- //
- // TODO: Verify 1 expression
- //
}
public void testProcesses1() throws Exception {
Modified: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/IvyFactoryBean.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/IvyFactoryBean.java?rev=705703&r1=705702&r2=705703&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/IvyFactoryBean.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/IvyFactoryBean.java Fri Oct 17 11:47:37 2008
@@ -19,12 +19,12 @@
package org.apache.geronimo.gshell.ivy;
-import org.springframework.beans.factory.FactoryBean;
import org.apache.ivy.Ivy;
+import org.apache.ivy.core.settings.IvySettings;
import org.apache.ivy.util.Message;
-import org.apache.ivy.util.DefaultMessageLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.FactoryBean;
import java.net.URL;
@@ -53,19 +53,22 @@
}
public Object getObject() throws Exception {
- // FIXME: Install a better logging adapter
- Message.setDefaultLogger(new DefaultMessageLogger(-1)); // Message.MSG_INFO));
-
- Ivy ivy = Ivy.newInstance();
+ Message.setDefaultLogger(new Slf4jMessageLogger());
+
+ IvySettings settings = new IvySettings();
URL url = getSettingsUrl();
log.debug("Settings URL: {}", url);
- ivy.configure(url);
+ settings.load(url);
//
- // TODO: Hook up download monitor
+ // TODO: Need to hook up a TransferListener to show progress, not really sure how to do that with Ivy...
//
- // settings.setVariable("ivy.default.configuration.m2compatible", "true")
+ settings.setVariable("ivy.default.configuration.m2compatible", "true");
+
+ Ivy ivy = Ivy.newInstance(settings);
+
+ log.debug("Ivy: {}", ivy);
return ivy;
}
Added: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/Slf4jMessageLogger.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/Slf4jMessageLogger.java?rev=705703&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/Slf4jMessageLogger.java (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/Slf4jMessageLogger.java Fri Oct 17 11:47:37 2008
@@ -0,0 +1,74 @@
+/*
+ * 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.gshell.ivy;
+
+import org.apache.ivy.Ivy;
+import org.apache.ivy.util.AbstractMessageLogger;
+import org.apache.ivy.util.Message;
+import org.apache.ivy.util.MessageLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Ivy {@link MessageLogger} to SLF4J adapter.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Slf4jMessageLogger
+ extends AbstractMessageLogger
+{
+ private final Logger log = LoggerFactory.getLogger(Ivy.class);
+
+ public void log(final String msg, final int level) {
+ switch (level) {
+ case Message.MSG_ERR:
+ log.error(msg);
+ break;
+
+ case Message.MSG_WARN:
+ log.warn(msg);
+ break;
+
+ case Message.MSG_INFO:
+ log.debug(msg);
+ break;
+
+ case Message.MSG_VERBOSE:
+ case Message.MSG_DEBUG:
+ log.trace(msg);
+ break;
+
+ default:
+ log.error("Unknown level: {}, message: {}", level, msg);
+ }
+ }
+
+ public void rawlog(final String msg, final int level) {
+ log(msg, level);
+ }
+
+ public void doProgress() {
+ // ignore
+ }
+
+ public void doEndProgress(final String msg) {
+ // ignore
+ }
+}
\ No newline at end of file
Propchange: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/Slf4jMessageLogger.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/Slf4jMessageLogger.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/gshell/trunk/gshell-support/gshell-ivy/src/main/java/org/apache/geronimo/gshell/ivy/Slf4jMessageLogger.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerSupport.java?rev=705703&r1=705702&r2=705703&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerSupport.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerSupport.java Fri Oct 17 11:47:37 2008
@@ -84,7 +84,7 @@
assert model != null;
assert output != null;
- log.debug("Marshalling: {}", model);
+ log.trace("Marshalling: {}", model);
createXStream().toXML(model, output);
}
@@ -93,7 +93,7 @@
assert model != null;
assert writer != null;
- log.debug("Marshalling: {}", model);
+ log.trace("Marshalling: {}", model);
createXStream().toXML(model, writer);
}
Modified: geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/MetaDataRegistryImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/MetaDataRegistryImpl.java?rev=705703&r1=705702&r2=705703&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/MetaDataRegistryImpl.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/MetaDataRegistryImpl.java Fri Oct 17 11:47:37 2008
@@ -61,7 +61,7 @@
assert name != null;
assert data != null;
- log.debug("Registering data: {}", name);
+ log.trace("Registering data: {}", name);
if (name.getDepth() > 0) {
MetaData parent = getParentData(name);
@@ -101,7 +101,7 @@
public void removeData(final FileName name) {
assert name != null;
- log.debug("Removing data: {}", name);
+ log.trace("Removing data: {}", name);
MetaData data = getNodes().remove(name);
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java?rev=705703&r1=705702&r2=705703&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-bootstrap/src/main/java/org/apache/geronimo/gshell/wisdom/application/ApplicationManagerImpl.java Fri Oct 17 11:47:37 2008
@@ -24,12 +24,12 @@
import org.apache.geronimo.gshell.application.ApplicationManager;
import org.apache.geronimo.gshell.application.ApplicationSecurityManager;
import org.apache.geronimo.gshell.application.ClassPath;
+import org.apache.geronimo.gshell.application.model.ApplicationModel;
+import org.apache.geronimo.gshell.application.model.Artifact;
import org.apache.geronimo.gshell.application.plugin.PluginManager;
import org.apache.geronimo.gshell.chronos.StopWatch;
import org.apache.geronimo.gshell.event.EventPublisher;
import org.apache.geronimo.gshell.io.Closer;
-import org.apache.geronimo.gshell.application.model.ApplicationModel;
-import org.apache.geronimo.gshell.application.model.Artifact;
import org.apache.geronimo.gshell.shell.Shell;
import org.apache.geronimo.gshell.spring.BeanContainer;
import org.apache.geronimo.gshell.spring.BeanContainerAware;
@@ -165,6 +165,7 @@
Set<Artifact> artifacts = resolveArtifacts(model);
classPath = new ClassPathImpl(artifacts);
log.debug("Saving classpath to cache: {}", file);
+ // noinspection ResultOfMethodCallIgnored
file.getParentFile().mkdirs();
ObjectOutputStream output = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
output.writeObject(classPath);
@@ -190,7 +191,7 @@
Set<Artifact> artifacts = new LinkedHashSet<Artifact>();
ResolveOptions options = new ResolveOptions();
- options.setOutputReport(false);
+ options.setOutputReport(true);
options.setTransitive(true);
options.setArtifactFilter(new ApplicationArtifactFilter());
@@ -223,10 +224,10 @@
resolved.setType(downloadedArtifact.getType());
resolved.setFile(downloadReport.getLocalFile());
artifacts.add(resolved);
-
+
log.debug(" {}", resolved.getId());
}
-
+
return artifacts;
}
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginImpl.java?rev=705703&r1=705702&r2=705703&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/plugin/PluginImpl.java Fri Oct 17 11:47:37 2008
@@ -202,10 +202,10 @@
}
};
- log.debug("Evaluating activation rules");
+ log.trace("Evaluating activation rules");
for (ActivationRule rule : activationRules) {
- log.debug("Evaluating activation rule: {}", rule);
+ log.trace("Evaluating activation rule: {}", rule);
try {
rule.evaluate(context);
@@ -217,14 +217,14 @@
List<ActivationTask> tasks = context.getTasks();
if (tasks.isEmpty()) {
- log.debug("No activation tasks configured in context");
+ log.warn("No activation tasks configured in context");
return;
}
- log.debug("Executing activation tasks");
+ log.trace("Executing activation tasks");
for (ActivationTask task : tasks) {
- log.debug("Executing activation task: {}", task);
+ log.trace("Executing activation task: {}", task);
try {
task.execute();