Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 7640 invoked from network); 10 Oct 2008 17:30:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Oct 2008 17:30:50 -0000 Received: (qmail 55322 invoked by uid 500); 10 Oct 2008 17:30:48 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 55286 invoked by uid 500); 10 Oct 2008 17:30:48 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 55277 invoked by uid 99); 10 Oct 2008 17:30:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Oct 2008 10:30:48 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Oct 2008 17:29:52 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 600B12388961; Fri, 10 Oct 2008 10:29:58 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r703527 - in /geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main: java/org/apache/geronimo/gshell/commands/log4j/ resources/META-INF/spring/ resources/org/apache/geronimo/gshell/commands/log4j/ Date: Fri, 10 Oct 2008 17:29:57 -0000 To: scm@geronimo.apache.org From: jdillon@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081010172958.600B12388961@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jdillon Date: Fri Oct 10 10:29:57 2008 New Revision: 703527 URL: http://svn.apache.org/viewvc?rev=703527&view=rev Log: Add new commands Added: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/LoggersAction.java (with props) geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/MdcAction.java (with props) geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/NdcAction.java (with props) geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/LoggersAction.properties (contents, props changed) - copied, changed from r703515, geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/LoggerAction.properties geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/MdcAction.properties (with props) geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/NdcAction.properties (with props) Modified: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/META-INF/spring/components.xml Added: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/LoggersAction.java URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/LoggersAction.java?rev=703527&view=auto ============================================================================== --- geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/LoggersAction.java (added) +++ geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/LoggersAction.java Fri Oct 10 10:29:57 2008 @@ -0,0 +1,51 @@ +/* + * 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.commands.log4j; + +import org.apache.geronimo.gshell.command.CommandAction; +import org.apache.geronimo.gshell.command.CommandContext; +import org.apache.geronimo.gshell.io.IO; +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; + +import java.util.Enumeration; + +/** + * Display all loggers. + * + * @version $Rev$ $Date$ + */ +public class LoggersAction + implements CommandAction +{ + public Object execute(final CommandContext context) throws Exception { + assert context != null; + IO io = context.getIo(); + + Enumeration n = LogManager.getCurrentLoggers(); + + while (n.hasMoreElements()) { + Logger logger = (Logger)n.nextElement(); + io.info("{}={}", logger.getName(), logger.getLevel()); + } + + return Result.SUCCESS; + } +} \ No newline at end of file Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/LoggersAction.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/LoggersAction.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/LoggersAction.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/MdcAction.java URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/MdcAction.java?rev=703527&view=auto ============================================================================== --- geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/MdcAction.java (added) +++ geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/MdcAction.java Fri Oct 10 10:29:57 2008 @@ -0,0 +1,72 @@ +/* + * 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.commands.log4j; + +import org.apache.geronimo.gshell.command.CommandAction; +import org.apache.geronimo.gshell.command.CommandContext; +import org.apache.geronimo.gshell.io.IO; +import org.apache.geronimo.gshell.clp.Argument; +import org.apache.geronimo.gshell.clp.Option; +import org.apache.log4j.MDC; + +import java.util.Map; + +/** + * Manage the {@link MDC} for the current thread. + * + * @version $Rev$ $Date$ + */ +public class MdcAction + implements CommandAction +{ + @Option(name="-r", aliases={"--remove"}) + private boolean remove; + + @Argument(index=0) + private String name; + + @Argument(index=1) + private Object value; + + public Object execute(final CommandContext context) throws Exception { + assert context != null; + IO io = context.getIo(); + + if (remove) { + MDC.remove(name); + } + else if (name != null && value != null) { + MDC.put(name, value); + } + else if (name != null) { + io.info("{}", MDC.get(name)); + } + else { + Map map = MDC.getContext(); + if (map != null) { + for (Object key : map.keySet()) { + io.info("{}={}", key, map.get(key)); + } + } + } + + return Result.SUCCESS; + } +} \ No newline at end of file Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/MdcAction.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/MdcAction.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/MdcAction.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/NdcAction.java URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/NdcAction.java?rev=703527&view=auto ============================================================================== --- geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/NdcAction.java (added) +++ geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/NdcAction.java Fri Oct 10 10:29:57 2008 @@ -0,0 +1,72 @@ +/* + * 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.commands.log4j; + +import org.apache.geronimo.gshell.command.CommandAction; +import org.apache.geronimo.gshell.command.CommandContext; +import org.apache.geronimo.gshell.io.IO; +import org.apache.geronimo.gshell.clp.Argument; +import org.apache.log4j.NDC; + +/** + * Manage the {@link NDC} for the current thread. + * + * @version $Rev$ $Date$ + */ +public class NdcAction + implements CommandAction +{ + private enum Type + { + PUSH, + POP, + PEEK + } + + @Argument(index=0, required=true) + private Type operation; + + @Argument(index=1) + private String arg; + + public Object execute(final CommandContext context) throws Exception { + assert context != null; + IO io = context.getIo(); + + switch (operation) { + case PUSH: + if (arg == null) { + throw new RuntimeException("Missing required argument"); + } + NDC.push(arg); + break; + + case POP: + io.info("{}", NDC.pop()); + break; + + case PEEK: + io.info("{}", NDC.peek()); + break; + } + + return Result.SUCCESS; + } +} \ No newline at end of file Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/NdcAction.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/NdcAction.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/java/org/apache/geronimo/gshell/commands/log4j/NdcAction.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/META-INF/spring/components.xml URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/META-INF/spring/components.xml?rev=703527&r1=703526&r2=703527&view=diff ============================================================================== --- geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/META-INF/spring/components.xml (original) +++ geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/META-INF/spring/components.xml Fri Oct 10 10:29:57 2008 @@ -32,6 +32,18 @@ + + + + + + + + + + + + Copied: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/LoggersAction.properties (from r703515, geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/LoggerAction.properties) URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/LoggersAction.properties?p2=geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/LoggersAction.properties&p1=geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/LoggerAction.properties&r1=703515&r2=703527&rev=703527&view=diff ============================================================================== --- geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/LoggerAction.properties (original) +++ geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/LoggersAction.properties Fri Oct 10 10:29:57 2008 @@ -21,13 +21,7 @@ ## $Rev$ $Date$ ## -command.description=Get or set a loggers level. - -command.argument.loggerName=Logger name to query/modify -command.argument.loggerName.token=LOGGER - -command.argument.levelName=Level to set logger at -command.argument.levelName.token=LEVEL +command.description=List all configured loggers. command.manual=\ - TODO: logger manual \ No newline at end of file + TODO: loggers manual \ No newline at end of file Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/LoggersAction.properties ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/LoggersAction.properties ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/LoggersAction.properties ------------------------------------------------------------------------------ svn:mergeinfo = Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/LoggersAction.properties ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/MdcAction.properties URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/MdcAction.properties?rev=703527&view=auto ============================================================================== --- geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/MdcAction.properties (added) +++ geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/MdcAction.properties Fri Oct 10 10:29:57 2008 @@ -0,0 +1,35 @@ +## +## 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. +## + +## +## $Rev$ $Date$ +## + +command.description=Manage the MDC for the current thread. + +command.option.remove=Remove the context for NAME + +command.argument.name=Context name +command.argument.name.token=NAME + +command.argument.value=Context value +command.argument.value.token=VALUE + +command.manual=\ + TODO: mdc manual \ No newline at end of file Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/MdcAction.properties ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/MdcAction.properties ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/MdcAction.properties ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/NdcAction.properties URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/NdcAction.properties?rev=703527&view=auto ============================================================================== --- geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/NdcAction.properties (added) +++ geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/NdcAction.properties Fri Oct 10 10:29:57 2008 @@ -0,0 +1,33 @@ +## +## 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. +## + +## +## $Rev$ $Date$ +## + +command.description=Manage the NDC for the current thread. + +command.argument.operation=Stack operation: PUSH, POP, PEEK +command.argument.name.token=OPERATION + +command.argument.arg=Pop argument value +command.argument.arg.token=VALUE + +command.manual=\ + TODO: ndc manual \ No newline at end of file Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/NdcAction.properties ------------------------------------------------------------------------------ svn:eol-style = native Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/NdcAction.properties ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Propchange: geronimo/gshell/trunk/gshell-commands/gshell-log4j/src/main/resources/org/apache/geronimo/gshell/commands/log4j/NdcAction.properties ------------------------------------------------------------------------------ svn:mime-type = text/plain