You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by df...@apache.org on 2021/04/09 20:12:21 UTC
[activemq-nms-openwire-generator] 16/32: Clean up the generated to
String methods for the commands to make the logging easier to read.
This is an automated email from the ASF dual-hosted git repository.
dfoulks pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq-nms-openwire-generator.git
commit 33428d8bd942858fcd24016ac61f0be36e49c410
Author: Timothy A. Bish <ta...@apache.org>
AuthorDate: Wed Dec 16 23:34:54 2009 +0000
Clean up the generated to String methods for the commands to make the logging easier to read.
---
.../tool/commands/CommandClassGenerator.java | 9 ++++++--
.../tool/commands/ConnectionIdGenerator.java | 6 +++++
.../tool/commands/ConsumerIdGenerator.java | 4 ++++
.../tool/commands/LocalTransactionIdGenerator.java | 27 ++++++++++++++++++++++
.../tool/commands/ProducerIdGenerator.java | 4 ++++
.../openwire/tool/commands/SessionIdGenerator.java | 4 ++++
6 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
index 0ca7efc..a768d95 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/CommandClassGenerator.java
@@ -207,12 +207,17 @@ public class CommandClassGenerator extends CommandCodeGenerator {
protected void generateToStringBody( PrintWriter out ) {
- out.println(" return GetType().Name + \"[\" + ");
+ out.println(" return GetType().Name + \"[ \" + ");
+
+ if( getBaseClassName().equals( "BaseCommand" ) ) {
+ out.println(" \"commandId = \" + this.CommandId + \" \" + " );
+ out.println(" \"responseRequired = \" + this.ResponseRequired + \" \" + " );
+ }
for( JProperty property : getProperties() ) {
String name = property.getSimpleName();
- out.println(" \"" + name + "=\" + " + name + " + " );
+ out.println(" \"" + name + " = \" + " + name + " + \" \" + " );
}
out.println(" \"]\";");
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionIdGenerator.java
index e8b1111..ef7d07e 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionIdGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConnectionIdGenerator.java
@@ -18,6 +18,8 @@ package org.apache.activemq.nms.openwire.tool.commands;
import java.io.PrintWriter;
+import org.codehaus.jam.JProperty;
+
public class ConnectionIdGenerator extends CommandClassGenerator {
protected void generateConstructors( PrintWriter out ) {
@@ -43,4 +45,8 @@ public class ConnectionIdGenerator extends CommandClassGenerator {
super.generateConstructors(out);
}
+
+ protected void generateToStringBody( PrintWriter out ) {
+ out.println(" return this.value;");
+ }
}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java
index dd0f666..036649d 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ConsumerIdGenerator.java
@@ -37,6 +37,10 @@ public class ConsumerIdGenerator extends CommandClassGenerator {
super.generateConstructors(out);
}
+ protected void generateToStringBody( PrintWriter out ) {
+ out.println(" return this.connectionId + \":\" + this.sessionId + \":\" + this.value;");
+ }
+
protected void generateProperties( PrintWriter out ) {
out.println(" private SessionId parentId = null;");
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/LocalTransactionIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/LocalTransactionIdGenerator.java
new file mode 100644
index 0000000..515e5a7
--- /dev/null
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/LocalTransactionIdGenerator.java
@@ -0,0 +1,27 @@
+/**
+ * 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.activemq.nms.openwire.tool.commands;
+
+import java.io.PrintWriter;
+
+public class LocalTransactionIdGenerator extends CommandClassGenerator {
+
+ protected void generateToStringBody( PrintWriter out ) {
+ out.println(" return this.connectionId + \":\" + this.value;");
+ }
+
+}
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java
index 0093505..8851735 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/ProducerIdGenerator.java
@@ -56,6 +56,10 @@ public class ProducerIdGenerator extends CommandClassGenerator {
super.generateProperties(out);
}
+ protected void generateToStringBody( PrintWriter out ) {
+ out.println(" return this.connectionId + \":\" + this.sessionId + \":\" + this.value;");
+ }
+
protected void generateAdditonalMembers( PrintWriter out ) {
out.println(" public SessionId ParentId");
out.println(" {");
diff --git a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionIdGenerator.java b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionIdGenerator.java
index 17b2b35..e957b61 100644
--- a/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionIdGenerator.java
+++ b/src/main/java/org/apache/activemq/nms/openwire/tool/commands/SessionIdGenerator.java
@@ -56,6 +56,10 @@ public class SessionIdGenerator extends CommandClassGenerator {
super.generateProperties(out);
}
+ protected void generateToStringBody( PrintWriter out ) {
+ out.println(" return this.connectionId + \":\" + this.value;");
+ }
+
protected void generateAdditonalMembers( PrintWriter out ) {
out.println(" public ConnectionId ParentId");
out.println(" {");