You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2007/03/22 14:15:14 UTC
svn commit: r521253 [6/10] - in /incubator/qpid/branches/java.multi_version:
./ gentools/src/org/apache/qpid/gentools/ gentools/templ.cpp/
gentools/templ.cpp/class/ gentools/templ.cpp/field/
gentools/templ.cpp/method/ gentools/templ.cpp/model/ gentools...
Modified: incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/LanguageConverter.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/LanguageConverter.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/LanguageConverter.java (original)
+++ incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/LanguageConverter.java Thu Mar 22 06:14:42 2007
@@ -22,18 +22,21 @@
public interface LanguageConverter
{
- public void setDomainMap(AmqpDomainMap domainMap);
- public AmqpDomainMap getDomainMap();
- public void setConstantSet(AmqpConstantSet constantSet);
- public AmqpConstantSet getConstantSet();
-
- public void setModel(AmqpModel model);
- public AmqpModel getModel();
-
- public String prepareClassName(String className);
- public String prepareMethodName(String methodName);
- public String prepareDomainName(String domainName);
- public String getDomainType(String domainName, AmqpVersion version) throws AmqpTypeMappingException;
- public String getGeneratedType(String domainName, AmqpVersion version) throws AmqpTypeMappingException;
+// public AmqpDomainMap getDomainMap();
+// public AmqpConstantSet getConstantSet();
+// public AmqpModel getModel();
+
+ //
+ public String prepareClassName(String className);
+
+ public String prepareMethodName(String methodName);
+
+ public String prepareDomainName(String domainName);
+
+ public String getDomainType(String domainName, AmqpVersion version);
+
+ public String getGeneratedType(String domainName, AmqpVersion version);
+
+ public String prepareConstantName(String constantName);
}
Modified: incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/Main.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/Main.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/Main.java (original)
+++ incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/Main.java Thu Mar 22 06:14:42 2007
@@ -20,143 +20,149 @@
*/
package org.apache.qpid.gentools;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
+import org.apache.velocity.app.Velocity;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Properties;
public class Main
{
- private static final String defaultOutDir = ".." + Utils.fileSeparator + "gen";
- private static final String defaultCppTemplateDir = ".." + Utils.fileSeparator + "templ.cpp";
- private static final String defaultDotnetTemplateDir = ".." + Utils.fileSeparator + "templ.net";
- private static final String defaultJavaTemplateDir = ".." + Utils.fileSeparator + "templ.java";
-
- private enum GeneratorLangEnum { CPP, DOTNET, JAVA }
-
- private DocumentBuilder docBuilder;
- private AmqpVersionSet versionSet;
- private Generator generator;
- private AmqpConstantSet constants;
- private AmqpDomainMap domainMap;
- private AmqpModel model;
-
+ private static final String DEFAULT_OUTPUT_DIR = ".." + Utils.FILE_SEPARATOR + "gen";
+ private static final String DEFAULT_TEMPLATE_DIR_BASE = ".." + Utils.FILE_SEPARATOR;
+
+ private enum GeneratedLanguage
+ {
+ CPP(".cpp", CppGenerator.getFactory()),
+ DOTNET(".net", DotnetGenerator.getFactory()),
+ JAVA(".java", JavaGenerator.getFactory());
+
+ private final String _suffix;
+ private final Generator.Factory _factory;
+
+
+ private final String _defaultTemplateDirectory;
+
+ GeneratedLanguage(String suffix, Generator.Factory factory)
+ {
+ _suffix = suffix;
+ _factory = factory;
+ _defaultTemplateDirectory = DEFAULT_TEMPLATE_DIR_BASE + "templ" + _suffix;
+ }
+
+ public String getSuffix()
+ {
+ return _suffix;
+ }
+
+ public Generator newGenerator()
+ {
+ return _factory.newInstance();
+ }
+
+ public String getDefaultTemplateDirectory()
+ {
+ return _defaultTemplateDirectory;
+ }
+ }
+
+ private Generator generator;
+
private String outDir;
private String tmplDir;
- private GeneratorLangEnum generatorLang;
+ private GeneratedLanguage _generatorLang;
private ArrayList<String> xmlFiles;
- private File[] modelTemplateFiles;
- private File[] classTemplateFiles;
- private File[] methodTemplateFiles;
- private File[] fieldTemplateFiles;
-
- public Main() throws ParserConfigurationException
- {
- docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- versionSet = new AmqpVersionSet();
+
+ public Main()
+ {
xmlFiles = new ArrayList<String>();
- }
-
- public void run(String[] args)
- throws IOException,
- SAXException,
- AmqpParseException,
- AmqpTypeMappingException,
- AmqpTemplateException,
- TargetDirectoryException,
- IllegalAccessException,
- InvocationTargetException
- {
- modelTemplateFiles = new File[]{};
- classTemplateFiles = new File[]{};
- methodTemplateFiles = new File[]{};
- fieldTemplateFiles = new File[]{};
-
+ }
+
+ public void run(String[] args)
+ throws Exception,
+ SAXException,
+ AmqpParseException,
+ AmqpTypeMappingException,
+ AmqpTemplateException,
+ TargetDirectoryException,
+ IllegalAccessException,
+ InvocationTargetException, ParserConfigurationException
+ {
+
// 0. Initialize
- outDir = defaultOutDir;
+ outDir = DEFAULT_OUTPUT_DIR;
tmplDir = null;
- generatorLang = GeneratorLangEnum.CPP; // Default generation language
+ _generatorLang = GeneratedLanguage.CPP; // Default generation language
xmlFiles.clear();
processArgs(args);
- switch (generatorLang)
+
+ if (tmplDir == null)
{
- case JAVA:
- prepareJava();
- break;
- case DOTNET:
- prepareDotnet();
- break;
- default:
- prepareCpp();
+ tmplDir = _generatorLang.getDefaultTemplateDirectory();
}
- if (modelTemplateFiles.length == 0 && classTemplateFiles.length == 0 &&
- methodTemplateFiles.length == 0 && fieldTemplateFiles.length == 0)
- System.err.println(" WARNING: No template files.");
-
- // 1. Suck in all the XML spec files provided on the command line
+
+ generator = _generatorLang.newGenerator();
+ generator.setTemplateDirectory(tmplDir);
+ generator.setOutputDirectory(outDir);
+
+ // 1. Suck in all the XML spec files provided on the command line
analyzeXML();
-
- // 2. Load up all templates
- try
- {
- generator.initializeTemplates(modelTemplateFiles, classTemplateFiles,
- methodTemplateFiles, fieldTemplateFiles);
- }
- catch (FileNotFoundException e)
- {
- System.err.println("Error: Unable to load template file (check -t option on command-line):");
- System.err.println(e.getMessage());
- return;
- }
-
- // 3. Generate output
- generator.generate(new File(outDir));
-
- System.out.println("Files generated: " + generator.getNumberGeneratedFiles());
- System.out.println("Done.");
- }
+
+ Properties p = new Properties();
+ p.setProperty("file.resource.loader.path", tmplDir);
+
+ Velocity.init(p);
+
+ // 2. Load up all templates
+ generator.initializeTemplates();
+
+ // 3. Generate output
+ generator.generate();
+
+ System.out.println("Files generated: " + generator.getNumberGeneratedFiles());
+ System.out.println("Done.");
+ }
private void processArgs(String[] args)
{
// Crude but simple...
- for (int i=0; i<args.length; i++)
+ for (int i = 0; i < args.length; i++)
{
String arg = args[i];
if (arg.charAt(0) == '-')
{
switch (arg.charAt(1))
{
- case 'c':
- case 'C':
- generatorLang = GeneratorLangEnum.CPP;
+ case'c':
+ case'C':
+ _generatorLang = GeneratedLanguage.CPP;
break;
- case 'j':
- case 'J':
- generatorLang = GeneratorLangEnum.JAVA;
+ case'j':
+ case'J':
+ _generatorLang = GeneratedLanguage.JAVA;
break;
- case 'n':
- case 'N':
- generatorLang = GeneratorLangEnum.DOTNET;
+ case'n':
+ case'N':
+ _generatorLang = GeneratedLanguage.DOTNET;
break;
- case 'o':
- case 'O':
+ case'o':
+ case'O':
if (++i < args.length)
{
outDir = args[i];
}
- break;
- case 't':
- case 'T':
+ break;
+ case't':
+ case'T':
if (++i < args.length)
{
tmplDir = args[i];
@@ -170,87 +176,12 @@
}
}
}
-
- private void prepareJava()
- {
- if (tmplDir == null)
- tmplDir = defaultJavaTemplateDir;
- System.out.println("Java generation mode.");
- generator = new JavaGenerator(versionSet);
- constants = new AmqpConstantSet(generator);
- domainMap = new AmqpDomainMap(generator);
- model = new AmqpModel(generator);
- modelTemplateFiles = new File[]
- {
- new File(tmplDir + Utils.fileSeparator + "MethodRegistryClass.tmpl"),
- new File(tmplDir + Utils.fileSeparator + "AmqpConstantsClass.tmpl"),
- new File(tmplDir + Utils.fileSeparator + "ProtocolVersionListClass.tmpl")
- };
- classTemplateFiles = new File[]
- {
-// new File(tmplDir + Utils.fileSeparator + "PropertyContentHeaderClass.tmpl")
- };
- methodTemplateFiles = new File[]
- {
- new File(tmplDir + Utils.fileSeparator + "MethodBodyClass.tmpl")
- };
- }
-
- private void prepareDotnet()
- {
- if (tmplDir == null)
- tmplDir = defaultDotnetTemplateDir;
- System.out.println(".NET generation mode.");
- generator = new DotnetGenerator(versionSet);
- constants = new AmqpConstantSet(generator);
- domainMap = new AmqpDomainMap(generator);
- model = new AmqpModel(generator);
- // TODO: Add templated that should be handled in here...
- modelTemplateFiles = new File[]
- {
-// new File(tmplDir + Utils.fileSeparator + "XXXClass.tmpl"),
- };
- classTemplateFiles = new File[]
- {
-// new File(tmplDir + Utils.fileSeparator + "XXXClass.tmpl"),
- };
- methodTemplateFiles = new File[]
- {
-// new File(tmplDir + Utils.fileSeparator + "XXXClass.tmpl"),
- };
- }
-
- private void prepareCpp()
- {
- if (tmplDir == null)
- tmplDir = defaultCppTemplateDir;
- System.out.println("C++ generation mode.");
- generator = new CppGenerator(versionSet);
- constants = new AmqpConstantSet(generator);
- domainMap = new AmqpDomainMap(generator);
- model = new AmqpModel(generator);
- modelTemplateFiles = new File[]
- {
- new File(tmplDir + Utils.fileSeparator + "AMQP_ServerOperations.h.tmpl"),
- new File(tmplDir + Utils.fileSeparator + "AMQP_ClientOperations.h.tmpl"),
- new File(tmplDir + Utils.fileSeparator + "AMQP_ServerProxy.h.tmpl"),
- new File(tmplDir + Utils.fileSeparator + "AMQP_ClientProxy.h.tmpl"),
- new File(tmplDir + Utils.fileSeparator + "AMQP_ServerProxy.cpp.tmpl"),
- new File(tmplDir + Utils.fileSeparator + "AMQP_ClientProxy.cpp.tmpl"),
- new File(tmplDir + Utils.fileSeparator + "AMQP_Constants.h.tmpl"),
- new File(tmplDir + Utils.fileSeparator + "AMQP_MethodVersionMap.h.tmpl"),
- new File(tmplDir + Utils.fileSeparator + "AMQP_MethodVersionMap.cpp.tmpl"),
- new File(tmplDir + Utils.fileSeparator + "AMQP_HighestVersion.h.tmpl")
- };
- methodTemplateFiles = new File[]
- {
- new File(tmplDir + Utils.fileSeparator + "MethodBodyClass.h.tmpl")
- };
- }
private void analyzeXML()
- throws IOException, SAXException, AmqpParseException, AmqpTypeMappingException
+ throws IOException, SAXException, AmqpParseException, AmqpTypeMappingException, ParserConfigurationException
{
+ DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+
System.out.println("XML files: " + xmlFiles);
for (String filename : xmlFiles)
{
@@ -261,25 +192,21 @@
System.out.print(" \"" + filename + "\":");
Document doc = docBuilder.parse(new File(filename));
Node amqpNode = Utils.findChild(doc, Utils.ELEMENT_AMQP);
-
+
// 1b. Extract version (major and minor) from the XML file
int major = Utils.getNamedIntegerAttribute(amqpNode, Utils.ATTRIBUTE_MAJOR);
int minor = Utils.getNamedIntegerAttribute(amqpNode, Utils.ATTRIBUTE_MINOR);
AmqpVersion version = new AmqpVersion(major, minor);
System.out.println(" Found version " + version.toString() + ".");
- versionSet.add(version);
-
- // 1c. Extract domains
- constants.addFromNode(amqpNode, 0, version);
-
- // 1d. Extract domains
- domainMap.addFromNode(amqpNode, 0, version);
-
- // 1e. Extract class/method/field heirarchy
- model.addFromNode(amqpNode, 0, version);
+ generator.addVersion(version);
+ generator.addFromNode(amqpNode, version);
+
+
}
else
+ {
System.err.println("ERROR: AMQP XML file \"" + filename + "\" not found.");
+ }
}
// *** DEBUG INFO *** Uncomment bits from this block to see lots of stuff....
// System.out.println();
@@ -296,58 +223,79 @@
// System.out.println("*** End debug output ***");
// System.out.println();
}
-
- public static void main(String[] args)
- {
- int exitCode = 1;
- // TODO: This is a simple and klunky way of hangling command-line args, and could be improved upon.
- if (args.length < 2)
- {
- usage();
- }
- else
- {
- try
- {
- new Main().run(args);
- exitCode = 0;
- }
- catch (IOException e) { e.printStackTrace(); }
- catch (ParserConfigurationException e) { e.printStackTrace(); }
- catch (SAXException e) { e.printStackTrace(); }
- catch (AmqpParseException e) { e.printStackTrace(); }
- catch (AmqpTypeMappingException e) { e.printStackTrace(); }
- catch (AmqpTemplateException e) { e.printStackTrace(); }
- catch (TargetDirectoryException e) { e.printStackTrace(); }
- catch (IllegalAccessException e) { e.printStackTrace(); }
- catch (InvocationTargetException e) { e.printStackTrace(); }
- }
- System.exit(exitCode);
- }
-
- public static void usage()
- {
- System.out.println("AMQP XML generator v.0.0");
- System.out.println("Usage: Main -c|-j [-o outDir] [-t tmplDir] XMLfile [XMLfile ...]");
- System.out.println(" where -c: Generate C++.");
- System.out.println(" -j: Generate Java.");
- System.out.println(" -n: Generate .NET.");
- System.out.println(" -o outDir: Use outDir as the output dir (default=\"" + defaultOutDir + "\").");
+
+ public static void main(String[] args)
+ {
+ int exitCode = 1;
+ // TODO: This is a simple and klunky way of hangling command-line args, and could be improved upon.
+ if (args.length < 2)
+ {
+ usage();
+ }
+ else
+ {
+ try
+ {
+ new Main().run(args);
+ exitCode = 0;
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ catch (ParserConfigurationException e)
+ {
+ e.printStackTrace();
+ }
+ catch (SAXException e)
+ {
+ e.printStackTrace();
+ }
+ catch (AmqpParseException e)
+ {
+ e.printStackTrace();
+ }
+ catch (AmqpTypeMappingException e)
+ {
+ e.printStackTrace();
+ }
+ catch (AmqpTemplateException e)
+ {
+ e.printStackTrace();
+ }
+ catch (TargetDirectoryException e)
+ {
+ e.printStackTrace();
+ }
+ catch (IllegalAccessException e)
+ {
+ e.printStackTrace();
+ }
+ catch (InvocationTargetException e)
+ {
+ e.printStackTrace();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ System.exit(exitCode);
+ }
+
+ public static void usage()
+ {
+ System.out.println("AMQP XML generator v.0.0");
+ System.out.println("Usage: Main -c|-j [-o outDir] [-t tmplDir] XMLfile [XMLfile ...]");
+ System.out.println(" where -c: Generate C++.");
+ System.out.println(" -j: Generate Java.");
+ System.out.println(" -n: Generate .NET.");
+ System.out.println(" -o outDir: Use outDir as the output dir (default=\"" + DEFAULT_OUTPUT_DIR + "\").");
System.out.println(" -t tmplDir: Find templates in tmplDir.");
- System.out.println(" Defaults: \"" + defaultCppTemplateDir + "\" for C++;");
- System.out.println(" \"" + defaultJavaTemplateDir + "\" for java.");
- System.out.println(" XMLfile is a space-separated list of AMQP XML files to be parsed.");
- }
-
- public static String ListTemplateList(File[] list)
- {
- StringBuffer sb = new StringBuffer();
- for (int i=0; i<list.length; i++)
- {
- if (i != 0)
- sb.append(", ");
- sb.append(list[i].getName());
- }
- return sb.toString();
- }
+ System.out.println(" Defaults: \"" + GeneratedLanguage.CPP.getDefaultTemplateDirectory() + "\" for C++;");
+ System.out.println(" \"" + GeneratedLanguage.JAVA.getDefaultTemplateDirectory() + "\" for java.;");
+ System.out.println(" \"" + GeneratedLanguage.DOTNET.getDefaultTemplateDirectory() + "\" for .NET.");
+ System.out.println(" XMLfile is a space-separated list of AMQP XML files to be parsed.");
+ }
+
}
Modified: incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/NodeAware.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/NodeAware.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/NodeAware.java (original)
+++ incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/NodeAware.java Thu Mar 22 06:14:42 2007
@@ -24,23 +24,24 @@
/**
* @author kpvdr
- * Interface allowing the addition of elements from a node in the
- * DOM of the AMQP specification. It is used by each of the model
- * elements in a recursive fashion to build the model.
+ * Interface allowing the addition of elements from a node in the
+ * DOM of the AMQP specification. It is used by each of the model
+ * elements in a recursive fashion to build the model.
*/
public interface NodeAware
{
- /**
- * Add a model element from the current DOM node. All model elements must implement
- * this interface. If the node contains children that are also a part of the model,
- * then this method is called on new instances of those model elements.
- * @param n Node from which the current model element is to be added.
- * @param o Ordinal value of the current model elemet.
- * @param v Verion of the DOM from which the node comes.
- * @throws AmqpParseException
- * @throws AmqpTypeMappingException
- * @returns true if a node was added, false if not
- */
- public boolean addFromNode(Node n, int o, AmqpVersion v)
- throws AmqpParseException, AmqpTypeMappingException;
+ /**
+ * Add a model element from the current DOM node. All model elements must implement
+ * this interface. If the node contains children that are also a part of the model,
+ * then this method is called on new instances of those model elements.
+ *
+ * @param n Node from which the current model element is to be added.
+ * @param o Ordinal value of the current model elemet.
+ * @param v Verion of the DOM from which the node comes.
+ * @throws AmqpParseException
+ * @throws AmqpTypeMappingException
+ * @returns true if a node was added, false if not
+ */
+ public boolean addFromNode(Node n, int o, AmqpVersion v)
+ throws AmqpParseException, AmqpTypeMappingException;
}
Modified: incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/Printable.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/Printable.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/Printable.java (original)
+++ incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/Printable.java Thu Mar 22 06:14:42 2007
@@ -24,5 +24,5 @@
public interface Printable
{
- public void print(PrintStream out, int marginSize, int tabSize);
+ public void print(PrintStream out, int marginSize, int tabSize);
}
Modified: incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/TargetDirectoryException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/TargetDirectoryException.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/TargetDirectoryException.java (original)
+++ incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/TargetDirectoryException.java Thu Mar 22 06:14:42 2007
@@ -21,10 +21,10 @@
package org.apache.qpid.gentools;
@SuppressWarnings("serial")
-public class TargetDirectoryException extends Exception
+public class TargetDirectoryException extends RuntimeException
{
- public TargetDirectoryException(String msg)
- {
- super(msg);
- }
+ public TargetDirectoryException(String msg)
+ {
+ super(msg);
+ }
}
Modified: incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/Utils.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/Utils.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/Utils.java (original)
+++ incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/Utils.java Thu Mar 22 06:14:42 2007
@@ -21,103 +21,114 @@
package org.apache.qpid.gentools;
import org.w3c.dom.Attr;
-//import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public class Utils
{
- public final static String fileSeparator = System.getProperty("file.separator");
- public final static String lineSeparator = System.getProperty("line.separator");
-
- public final static String ATTRIBUTE_NAME = "name";
- public final static String ATTRIBUTE_MAJOR = "major";
- public final static String ATTRIBUTE_MINOR = "minor";
- public final static String ATTRIBUTE_INDEX = "index";
- public final static String ATTRIBUTE_LABEL = "label";
- public final static String ATTRIBUTE_SYNCHRONOUS = "synchronous";
- public final static String ATTRIBUTE_CONTENT = "content";
- public final static String ATTRIBUTE_HANDLER = "handler";
- public final static String ATTRIBUTE_DOMAIN = "domain";
+ public final static String FILE_SEPARATOR = System.getProperty("file.separator");
+ public final static String LINE_SEPARATOR = System.getProperty("line.separator");
+
+ public final static String ATTRIBUTE_NAME = "name";
+ public final static String ATTRIBUTE_MAJOR = "major";
+ public final static String ATTRIBUTE_MINOR = "minor";
+ public final static String ATTRIBUTE_INDEX = "index";
+ public final static String ATTRIBUTE_LABEL = "label";
+ public final static String ATTRIBUTE_SYNCHRONOUS = "synchronous";
+ public final static String ATTRIBUTE_CONTENT = "content";
+ public final static String ATTRIBUTE_HANDLER = "handler";
+ public final static String ATTRIBUTE_DOMAIN = "domain";
public final static String ATTRIBUTE_VALUE = "value";
- public final static String ATTRIBUTE_TYPE = "type"; // For compatibility with AMQP 8.0
-
- public final static String ELEMENT_AMQP = "amqp";
- public final static String ELEMENT_CHASSIS = "chassis";
- public final static String ELEMENT_CLASS = "class";
- public final static String ELEMENT_CODEGEN = "codegen";
+ public final static String ATTRIBUTE_TYPE = "type"; // For compatibility with AMQP 8.0
+
+ public final static String ELEMENT_AMQP = "amqp";
+ public final static String ELEMENT_CHASSIS = "chassis";
+ public final static String ELEMENT_CLASS = "class";
+ public final static String ELEMENT_CODEGEN = "codegen";
public final static String ELEMENT_CONSTANT = "constant";
- public final static String ELEMENT_DOMAIN = "domain";
- public final static String ELEMENT_METHOD = "method";
- public final static String ELEMENT_FIELD = "field";
- public final static String ELEMENT_VERSION = "version";
-
- // Attribute functions
-
- public static String getNamedAttribute(Node n, String attrName) throws AmqpParseException
- {
- NamedNodeMap nnm = n.getAttributes();
- if (nnm == null)
- throw new AmqpParseException("Node \"" + n.getNodeName() + "\" has no attributes.");
- Attr a = (Attr)nnm.getNamedItem(attrName);
- if (a == null)
- throw new AmqpParseException("Node \"" + n.getNodeName() + "\" has no attribute \"" + attrName + "\".");
- return a.getNodeValue();
- }
-
- public static int getNamedIntegerAttribute(Node n, String attrName) throws AmqpParseException
- {
- return Integer.parseInt(getNamedAttribute(n, attrName));
- }
-
- // Element functions
-
- public static Node findChild(Node n, String eltName) throws AmqpParseException
- {
- NodeList nl = n.getChildNodes();
- for (int i=0; i<nl.getLength(); i++)
- {
- Node cn = nl.item(i);
- if (cn.getNodeName().compareTo(eltName) == 0)
- return cn;
- }
- throw new AmqpParseException("Node \"" + n.getNodeName() +
- "\" does not contain child element \"" + eltName + "\".");
- }
-
- // String functions
-
- public static String firstUpper(String str)
- {
- if (!Character.isLowerCase(str.charAt(0)))
- return str;
- StringBuffer sb = new StringBuffer(str);
- sb.setCharAt(0, Character.toUpperCase(str.charAt(0)));
- return sb.toString();
- }
-
- public static String firstLower(String str)
- {
- if (!Character.isUpperCase(str.charAt(0)))
- return str;
- StringBuffer sb = new StringBuffer(str);
- sb.setCharAt(0, Character.toLowerCase(str.charAt(0)));
- return sb.toString();
- }
-
- public static String createSpaces(int cnt)
- {
- StringBuffer sb = new StringBuffer();
- for (int i=0; i<cnt; i++)
- sb.append(' ');
- return sb.toString();
- }
-
+ public final static String ELEMENT_DOMAIN = "domain";
+ public final static String ELEMENT_METHOD = "method";
+ public final static String ELEMENT_FIELD = "field";
+ public final static String ELEMENT_VERSION = "version";
+
+ // Attribute functions
+
+ public static String getNamedAttribute(Node n, String attrName) throws AmqpParseException
+ {
+ NamedNodeMap nnm = n.getAttributes();
+ if (nnm == null)
+ {
+ throw new AmqpParseException("Node \"" + n.getNodeName() + "\" has no attributes.");
+ }
+ Attr a = (Attr) nnm.getNamedItem(attrName);
+ if (a == null)
+ {
+ throw new AmqpParseException("Node \"" + n.getNodeName() + "\" has no attribute \"" + attrName + "\".");
+ }
+ return a.getNodeValue();
+ }
+
+ public static int getNamedIntegerAttribute(Node n, String attrName) throws AmqpParseException
+ {
+ return Integer.parseInt(getNamedAttribute(n, attrName));
+ }
+
+ // Element functions
+
+ public static Node findChild(Node n, String eltName) throws AmqpParseException
+ {
+ NodeList nl = n.getChildNodes();
+ for (int i = 0; i < nl.getLength(); i++)
+ {
+ Node cn = nl.item(i);
+ if (cn.getNodeName().compareTo(eltName) == 0)
+ {
+ return cn;
+ }
+ }
+ throw new AmqpParseException("Node \"" + n.getNodeName() +
+ "\" does not contain child element \"" + eltName + "\".");
+ }
+
+ // String functions
+
+ public static String firstUpper(String str)
+ {
+ if (!Character.isLetter(str.charAt(0)) || !Character.isLowerCase(str.charAt(0)))
+ {
+ return str;
+ }
+ StringBuffer sb = new StringBuffer(str);
+ sb.setCharAt(0, Character.toUpperCase(str.charAt(0)));
+ return sb.toString();
+ }
+
+ public static String firstLower(String str)
+ {
+ if (!Character.isUpperCase(str.charAt(0)))
+ {
+ return str;
+ }
+ StringBuffer sb = new StringBuffer(str);
+ sb.setCharAt(0, Character.toLowerCase(str.charAt(0)));
+ return sb.toString();
+ }
+
+ public static String createSpaces(int cnt)
+ {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < cnt; i++)
+ {
+ sb.append(' ');
+ }
+ return sb.toString();
+ }
+
public static boolean containsOnlyDigits(String str)
{
boolean foundNonDigit = false;
- for (int i=0; i<str.length() && !foundNonDigit; i++)
+ for (int i = 0; i < str.length() && !foundNonDigit; i++)
{
if (!Character.isDigit(str.charAt(i)))
{
@@ -126,12 +137,12 @@
}
return !foundNonDigit;
}
-
+
public static boolean containsOnlyDigitsAndDecimal(String str)
{
boolean foundNonDigit = false;
int decimalCntr = 0;
- for (int i=0; i<str.length() && !foundNonDigit && decimalCntr<2; i++)
+ for (int i = 0; i < str.length() && !foundNonDigit && decimalCntr < 2; i++)
{
char ch = str.charAt(i);
if (!(Character.isDigit(ch) || ch == '.'))
@@ -139,8 +150,10 @@
foundNonDigit = true;
}
else if (ch == '.')
+ {
decimalCntr++;
+ }
}
- return !foundNonDigit && decimalCntr<2;
+ return !foundNonDigit && decimalCntr < 2;
}
}
Modified: incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/VersionConsistencyCheck.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/VersionConsistencyCheck.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/VersionConsistencyCheck.java (original)
+++ incubator/qpid/branches/java.multi_version/gentools/src/org/apache/qpid/gentools/VersionConsistencyCheck.java Thu Mar 22 06:14:42 2007
@@ -22,5 +22,5 @@
public interface VersionConsistencyCheck
{
- public boolean isVersionConsistent(AmqpVersionSet globalVersionSet);
+ public boolean isVersionConsistent(AmqpVersionSet globalVersionSet);
}
Added: incubator/qpid/branches/java.multi_version/gentools/templ.java/model/ProtocolVersionListClass.vm
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/gentools/templ.java/model/ProtocolVersionListClass.vm?view=auto&rev=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/gentools/templ.java/model/ProtocolVersionListClass.vm (added)
+++ incubator/qpid/branches/java.multi_version/gentools/templ.java/model/ProtocolVersionListClass.vm Thu Mar 22 06:14:42 2007
@@ -0,0 +1,148 @@
+#set( $filename = "ProtocolVersion.java" )
+/*
+*
+* 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.
+*
+*/
+
+/*
+* This file is auto-generated by $generator - do not modify.
+* Supported AMQP versions:
+#foreach( $version in $model.getVersionSet() )
+* $version.getMajor()-$version.getMinor()
+#end
+*/
+
+package org.apache.qpid.framing;
+
+import java.util.SortedSet;
+import java.util.Collections;
+import java.util.TreeSet;
+
+
+public class ProtocolVersion implements Comparable
+{
+ private final byte _majorVersion;
+ private final byte _minorVersion;
+
+
+ public ProtocolVersion(byte majorVersion, byte minorVersion)
+ {
+ _majorVersion = majorVersion;
+ _minorVersion = minorVersion;
+ }
+
+ public byte getMajorVersion()
+ {
+ return _majorVersion;
+ }
+
+ public byte getMinorVersion()
+ {
+ return _minorVersion;
+ }
+
+
+ public int compareTo(Object o)
+ {
+ ProtocolVersion pv = (ProtocolVersion) o;
+
+ /*
+ * 0-8 has it's major and minor numbers the wrong way round (it's actually 8-0)...
+ * so we need to deal with that case specially
+ */
+
+ if((_majorVersion == (byte) 8) && (_minorVersion == (byte) 0))
+ {
+ ProtocolVersion fixedThis = new ProtocolVersion(_minorVersion, _majorVersion);
+ return fixedThis.compareTo(pv);
+ }
+
+ if((pv.getMajorVersion() == (byte) 8) && (pv.getMinorVersion() == (byte) 0))
+ {
+ ProtocolVersion fixedOther = new ProtocolVersion(pv.getMinorVersion(), pv.getMajorVersion());
+ return this.compareTo(fixedOther);
+ }
+
+ if(_majorVersion > pv.getMajorVersion())
+ {
+ return 1;
+ }
+ else if(_majorVersion < pv.getMajorVersion())
+ {
+ return -1;
+ }
+ else if(_minorVersion > pv.getMinorVersion())
+ {
+ return 1;
+ }
+ else if(getMinorVersion() < pv.getMinorVersion())
+ {
+ return -1;
+ }
+ else
+ {
+ return 0;
+ }
+
+ }
+
+ public boolean equals(Object o)
+ {
+ return o != null && (o == this || (compareTo(o) == 0));
+ }
+
+ public int hashCode()
+ {
+ return (0xFF & (int)_minorVersion) | ((0xFF & (int)_majorVersion) << 8);
+ }
+
+
+ public boolean isSupported()
+ {
+ return _supportedVersions.contains(this);
+ }
+
+ public static ProtocolVersion getLatestSupportedVersion()
+ {
+ return _supportedVersions.last();
+ }
+
+ private static final SortedSet<ProtocolVersion> _supportedVersions;
+
+ static
+ {
+ SortedSet<ProtocolVersion> versions = new TreeSet<ProtocolVersion>();
+
+#foreach( $version in $model.getVersionSet() )
+ versions.add(new ProtocolVersion((byte)$version.getMajor(),(byte)$version.getMinor()));
+#end
+ _supportedVersions = Collections.unmodifiableSortedSet(versions);
+ }
+
+
+ public static SortedSet<ProtocolVersion> getSupportedProtocolVersions()
+ {
+ return _supportedVersions;
+ }
+
+
+
+
+
+}
Added: incubator/qpid/branches/java.multi_version/gentools/templ.java/model/version/AmqpConstantsClass.vm
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/gentools/templ.java/model/version/AmqpConstantsClass.vm?view=auto&rev=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/gentools/templ.java/model/version/AmqpConstantsClass.vm (added)
+++ incubator/qpid/branches/java.multi_version/gentools/templ.java/model/version/AmqpConstantsClass.vm Thu Mar 22 06:14:42 2007
@@ -0,0 +1,37 @@
+&{AmqpConstants.java}
+/*
+ *
+ * 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.
+ *
+ */
+
+/*
+ * This file is auto-generated by ${GENERATOR} - do not modify.
+ * Supported AMQP versions:
+%{VLIST} * ${major}-${minor}
+ */
+
+package org.apache.qpid.framing;
+
+class AmqpConstants
+{
+ // Constant getValue methods
+
+%{TLIST} ${const_get_method}
+
+}
Added: incubator/qpid/branches/java.multi_version/gentools/templ.java/model/version/MethodRegistryClass.vm
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/gentools/templ.java/model/version/MethodRegistryClass.vm?view=auto&rev=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/gentools/templ.java/model/version/MethodRegistryClass.vm (added)
+++ incubator/qpid/branches/java.multi_version/gentools/templ.java/model/version/MethodRegistryClass.vm Thu Mar 22 06:14:42 2007
@@ -0,0 +1,136 @@
+#set( $filename = "amqp_$version.getMajor()_$version.getMinor()/MethodRegistry_${version.getMajor()}_${version.getMinor()}.java")
+/*
+ *
+ * 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.
+ *
+ */
+
+/*
+ * This file is auto-generated by $generator - do not modify.
+ * Supported AMQP version:
+ * $version.getMajor()-$version.getMinor()
+ */
+
+package org.apache.qpid.framing.amqp_${version.getMajor()}_${version.getMinor()};
+
+import org.apache.qpid.framing.AMQMethodBodyInstanceFactory;
+import org.apache.qpid.framing.AMQFrameDecodingException;
+import org.apache.qpid.framing.AMQMethodBody;
+import org.apache.qpid.framing.MethodRegistry;
+import org.apache.qpid.framing.ProtocolVersion;
+
+
+import org.apache.log4j.Logger;
+import org.apache.mina.common.ByteBuffer;
+
+public class MethodRegistry_$version.getMajor()_$version.getMinor() extends MethodRegistry
+{
+
+ private static final Logger _log = Logger.getLogger(MethodRegistry.class);
+
+#set( $specificModel = $model.asSingleVersionModel() )
+
+
+
+ private final AMQMethodBodyInstanceFactory[][] _factories = new AMQMethodBodyInstanceFactory[$specificModel.getMaximumClassId()+1][];
+
+ public MethodRegistry_$version.getMajor()_$version.getMinor()()
+ {
+ this(new ProtocolVersion((byte)$version.getMajor(),(byte)$version.getMinor()));
+ }
+
+ public MethodRegistry_$version.getMajor()_$version.getMinor()(ProtocolVersion pv)
+ {
+ super(pv);
+#foreach( $amqpClass in $specificModel.getClassList() )
+#set( $amqpClassNameFirstChar = $amqpClass.getName().substring(0,1) )
+#set( $amqpClassNameFirstCharU = $amqpClassNameFirstChar.toUpperCase() )
+#set( $amqpClassNameUpperCamel = "$amqpClassNameFirstCharU$amqpClass.getName().substring(1)" )
+
+
+
+ // Register method body instance factories for the $amqpClassNameUpperCamel class.
+
+ _factories[$amqpClass.getClassId()] = new AMQMethodBodyInstanceFactory[$amqpClass.getMaximumMethodId()+1];
+
+#foreach( $amqpMethod in $amqpClass.getMethodList() )
+#set( $amqpMethodNameFirstChar = $amqpMethod.getName().substring(0,1) )
+#set( $amqpMethodNameFirstCharU = $amqpMethodNameFirstChar.toUpperCase() )
+#set( $amqpMethodNameUpperCamel = "$amqpMethodNameFirstCharU$amqpMethod.getName().substring(1)" )
+ _factories[$amqpClass.getClassId()][$amqpMethod.getMethodId()] = ${amqpClassNameUpperCamel}${amqpMethodNameUpperCamel}BodyImpl.getFactory();
+#end
+
+#end
+
+
+ }
+
+
+ public AMQMethodBody convertToBody(ByteBuffer in, long size)
+ throws AMQFrameDecodingException
+ {
+ int classId = in.getUnsignedShort();
+ int methodId = in.getUnsignedShort();
+
+ AMQMethodBodyInstanceFactory bodyFactory;
+ try
+ {
+ bodyFactory = _factories[classId][methodId];
+ }
+ catch(NullPointerException e)
+ {
+ throw new AMQFrameDecodingException(_log,
+ "Class " + classId + " unknown in AMQP version $version.getMajor()-$version.getMinor()"
+ + " (while trying to decode class " + classId + " method " + methodId + ".");
+ }
+ catch(IndexOutOfBoundsException e)
+ {
+ if(classId >= _factories.length)
+ {
+ throw new AMQFrameDecodingException(_log,
+ "Class " + classId + " unknown in AMQP version $version.getMajor()-$version.getMinor()"
+ + " (while trying to decode class " + classId + " method " + methodId + ".");
+
+ }
+ else
+ {
+ throw new AMQFrameDecodingException(_log,
+ "Method " + methodId + " unknown in AMQP version $version.getMajor()-$version.getMinor()"
+ + " (while trying to decode class " + classId + " method " + methodId + ".");
+
+ }
+ }
+
+
+ if (bodyFactory == null)
+ {
+ throw new AMQFrameDecodingException(_log,
+ "Method " + methodId + " unknown in AMQP version $version.getMajor()-$version.getMinor()"
+ + " (while trying to decode class " + classId + " method " + methodId + ".");
+ }
+
+
+ return bodyFactory.newInstance(in, size);
+
+
+ }
+
+
+
+
+}
Modified: incubator/qpid/branches/java.multi_version/java/broker/bin/qpid-server-bdb.bat
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/bin/qpid-server-bdb.bat?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/bin/qpid-server-bdb.bat (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/bin/qpid-server-bdb.bat Thu Mar 22 06:14:42 2007
@@ -1,3 +1,3 @@
-set BDBSTORE_HOME=c:\qpid\trunk\java\bdbstore
+set BDBSTORE_HOME=c:\qpid-bdb\bdbstore
set QPID_MODULE_JARS=%BDBSTORE_HOME%\target\qpid-bdbstore-1.0-incubating-M2-SNAPSHOT.jar;%BDBSTORE_HOME%\lib\bdb\je-3.1.0.jar
.\qpid-server.bat
Modified: incubator/qpid/branches/java.multi_version/java/broker/distribution/src/main/assembly/broker-bin-tests.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/distribution/src/main/assembly/broker-bin-tests.xml?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/distribution/src/main/assembly/broker-bin-tests.xml (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/distribution/src/main/assembly/broker-bin-tests.xml Thu Mar 22 06:14:42 2007
@@ -92,7 +92,7 @@
<source>../../common/bin/qpid-run</source>
<outputDirectory>qpid-${qpid.version}/bin</outputDirectory>
<destName>qpid-run</destName>
- <fileMode>493</fileMode>
+ <fileMode>473</fileMode>
</file>
<!-- Common Configuration -->
Modified: incubator/qpid/branches/java.multi_version/java/broker/etc/config.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/etc/config.xml?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/etc/config.xml (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/etc/config.xml Thu Mar 22 06:14:42 2007
@@ -89,8 +89,8 @@
<name>localhost</name>
<localhost>
<store>
- <!-- <class>org.apache.qpid.server.store.berkeleydb.BDBMessageStore</class> -->
- <class>org.apache.qpid.server.store.MemoryMessageStore</class>
+ <class>org.apache.qpid.server.store.berkeleydb.BDBMessageStore</class>
+ <!--<class>org.apache.qpid.server.store.MemoryMessageStore</class>-->
<environment-path>localhost-store</environment-path>
</store>
</localhost>
@@ -101,7 +101,9 @@
<development>
<store>
<class>org.apache.qpid.server.store.MemoryMessageStore</class>
- </store>
+ <!--<class>org.apache.qpid.server.store.berkeleydb.BDBMessageStore</class>-->
+ <environment-path>development-store</environment-path>
+ </store>
</development>
</virtualhost>
@@ -110,7 +112,10 @@
<test>
<store>
<class>org.apache.qpid.server.store.MemoryMessageStore</class>
- </store>
+ <!--<class>org.apache.qpid.server.store.berkeleydb.BDBMessageStore</class>-->
+ <environment-path>test-store</environment-path>
+
+ </store>
</test>
</virtualhost>
Modified: incubator/qpid/branches/java.multi_version/java/broker/etc/log4j.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/etc/log4j.xml?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/etc/log4j.xml (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/etc/log4j.xml Thu Mar 22 06:14:42 2007
@@ -36,20 +36,22 @@
<param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
</layout>
</appender>
-
- <!--<category name="org.apache.qpid.server.store">
+ <!--
+ <category name="org.apache.qpid.server.store.StoreContext">
<priority value="debug"/>
</category>
-
- <category name="org.apache.qpid.server.queue">
+ -->
+ <!--<category name="org.apache.qpid.server.queue.AMQMessage">
<priority value="debug"/>
</category>
-
- <category name="org.apache.qpid.server.txn">
+ -->
+ <!--
+ <category name="org.apache.qpid.server.store.berkeleydb.BDBMessageStore">
<priority value="debug"/>
- </category>-->
+ </category>
+ -->
<root>
- <priority value="info"/>
+ <priority value="${AMQJ_LOGGING_LEVEL}"/>
<appender-ref ref="STDOUT"/>
<appender-ref ref="FileAppender"/>
</root>
Modified: incubator/qpid/branches/java.multi_version/java/broker/etc/virtualhosts.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/etc/virtualhosts.xml?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/etc/virtualhosts.xml (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/etc/virtualhosts.xml Thu Mar 22 06:14:42 2007
@@ -27,8 +27,13 @@
<exchanges>
<exchange>
<type>direct</type>
+
<name>test.direct</name>
- <durable>true</durable>
+ <test>
+ <direct>
+ <durable>true</durable>
+ </direct>
+ </test>
</exchange>
<exchange>
<type>topic</type>
@@ -40,7 +45,7 @@
<maximumQueueDepth>4235264</maximumQueueDepth> <!-- 4Mb -->
<maximumMessageSize>2117632</maximumMessageSize> <!-- 2Mb -->
<maximumMessageAge>600000</maximumMessageAge> <!-- 10 mins -->
-
+ <durable>true</durable>
<queue>
<name>queue</name>
</queue>
Modified: incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicAckMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicAckMethodHandler.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicAckMethodHandler.java (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicAckMethodHandler.java Thu Mar 22 06:14:42 2007
@@ -61,6 +61,6 @@
}
// this method throws an AMQException if the delivery tag is not known
- channel.acknowledgeMessage(body.deliveryTag, body.multiple);
+ channel.acknowledgeMessage(body.getDeliveryTag(), body.getMultiple());
}
}
Modified: incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicCancelMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicCancelMethodHandler.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicCancelMethodHandler.java (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicCancelMethodHandler.java Thu Mar 22 06:14:42 2007
@@ -55,15 +55,15 @@
throw body.getChannelNotFoundException(evt.getChannelId());
}
- channel.unsubscribeConsumer(protocolSession, body.consumerTag);
- if (!body.nowait)
+ channel.unsubscribeConsumer(protocolSession, body.getConsumerTag());
+ if (!body.getNowait())
{
// AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
// TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
// Be aware of possible changes to parameter order as versions change.
final AMQFrame responseFrame = BasicCancelOkBody.createAMQFrame(evt.getChannelId(),
(byte) 8, (byte) 0, // AMQP version (major, minor)
- body.consumerTag); // consumerTag
+ body.getConsumerTag()); // consumerTag
protocolSession.writeFrame(responseFrame);
}
}
Modified: incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicConsumeMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicConsumeMethodHandler.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicConsumeMethodHandler.java (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicConsumeMethodHandler.java Thu Mar 22 06:14:42 2007
@@ -68,14 +68,14 @@
else
{
- AMQQueue queue = body.queue == null ? channel.getDefaultQueue() : vHost.getQueueRegistry().getQueue(body.queue);
+ AMQQueue queue = body.getQueue() == null ? channel.getDefaultQueue() : vHost.getQueueRegistry().getQueue(body.getQueue());
if (queue == null)
{
- _log.info("No queue for '" + body.queue + "'");
- if (body.queue != null)
+ _log.info("No queue for '" + body.getQueue() + "'");
+ if (body.getQueue() != null)
{
- String msg = "No such queue, '" + body.queue + "'";
+ String msg = "No such queue, '" + body.getQueue() + "'";
throw body.getChannelException(AMQConstant.NOT_FOUND, msg);
}
else
@@ -88,9 +88,9 @@
{
try
{
- AMQShortString consumerTag = channel.subscribeToQueue(body.consumerTag, queue, session, !body.noAck,
- body.arguments, body.noLocal, body.exclusive);
- if (!body.nowait)
+ AMQShortString consumerTag = channel.subscribeToQueue(body.getConsumerTag(), queue, session, !body.getNoAck(),
+ body.getArguments(), body.getNoLocal(), body.getExclusive());
+ if (!body.getNowait())
{
// AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
// TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
@@ -110,9 +110,9 @@
}
catch (ConsumerTagNotUniqueException e)
{
- AMQShortString msg = new AMQShortString("Non-unique consumer tag, '" + body.consumerTag + "'");
+ AMQShortString msg = new AMQShortString("Non-unique consumer tag, '" + body.getConsumerTag() + "'");
throw body.getConnectionException(AMQConstant.NOT_ALLOWED,
- "Non-unique consumer tag, '" + body.consumerTag + "'");
+ "Non-unique consumer tag, '" + body.getConsumerTag() + "'");
}
catch (AMQQueue.ExistingExclusiveSubscription e)
{
Modified: incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicGetMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicGetMethodHandler.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicGetMethodHandler.java (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicGetMethodHandler.java Thu Mar 22 06:14:42 2007
@@ -43,15 +43,15 @@
}
else
{
- AMQQueue queue = body.queue == null ? channel.getDefaultQueue() : vHost.getQueueRegistry().getQueue(body.queue);
+ AMQQueue queue = body.getQueue() == null ? channel.getDefaultQueue() : vHost.getQueueRegistry().getQueue(body.getQueue());
if (queue == null)
{
- _log.info("No queue for '" + body.queue + "'");
- if(body.queue!=null)
+ _log.info("No queue for '" + body.getQueue() + "'");
+ if(body.getQueue()!=null)
{
throw body.getConnectionException(AMQConstant.NOT_FOUND,
- "No such queue, '" + body.queue + "'");
+ "No such queue, '" + body.getQueue() + "'");
}
else
{
@@ -61,7 +61,7 @@
}
else
{
- if(!queue.performGet(session, channel, !body.noAck))
+ if(!queue.performGet(session, channel, !body.getNoAck()))
{
Modified: incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicPublishMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicPublishMethodHandler.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicPublishMethodHandler.java (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicPublishMethodHandler.java Thu Mar 22 06:14:42 2007
@@ -24,6 +24,7 @@
import org.apache.qpid.AMQException;
import org.apache.qpid.exchange.ExchangeDefaults;
import org.apache.qpid.framing.BasicPublishBody;
+import org.apache.qpid.framing.AMQShortString;
import org.apache.qpid.protocol.AMQMethodEvent;
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.server.AMQChannel;
@@ -61,14 +62,15 @@
_log.debug("Publish received on channel " + evt.getChannelId());
}
+ AMQShortString exchangeName = body.getExchange();
// TODO: check the delivery tag field details - is it unique across the broker or per subscriber?
- if (body.exchange == null)
+ if (exchangeName == null)
{
- body.exchange = ExchangeDefaults.DEFAULT_EXCHANGE_NAME;
+ exchangeName = ExchangeDefaults.DEFAULT_EXCHANGE_NAME;
}
VirtualHost vHost = session.getVirtualHost();
- Exchange e = vHost.getExchangeRegistry().getExchange(body.exchange);
+ Exchange e = vHost.getExchangeRegistry().getExchange(exchangeName);
// if the exchange does not exist we raise a channel exception
if (e == null)
{
Modified: incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicQosHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicQosHandler.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicQosHandler.java (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicQosHandler.java Thu Mar 22 06:14:42 2007
@@ -47,8 +47,8 @@
throw evt.getMethod().getChannelNotFoundException(evt.getChannelId());
}
- channel.setPrefetchCount(evt.getMethod().prefetchCount);
- channel.setPrefetchSize(evt.getMethod().prefetchSize);
+ channel.setPrefetchCount(evt.getMethod().getPrefetchCount());
+ channel.setPrefetchSize(evt.getMethod().getPrefetchSize());
// AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
// TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
Modified: incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRecoverMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRecoverMethodHandler.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRecoverMethodHandler.java (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRecoverMethodHandler.java Thu Mar 22 06:14:42 2007
@@ -54,7 +54,7 @@
throw body.getChannelNotFoundException(evt.getChannelId());
}
- channel.resend(session, body.requeue);
+ channel.resend(session, body.getRequeue());
// AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
// TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
Modified: incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRejectMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRejectMethodHandler.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRejectMethodHandler.java (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/BasicRejectMethodHandler.java Thu Mar 22 06:14:42 2007
@@ -49,10 +49,10 @@
{
AMQProtocolSession session = stateManager.getProtocolSession();
- _logger.info("FIXME: Rejecting:" + evt.getMethod().deliveryTag + ": Requeue:" + evt.getMethod().requeue);
+ _logger.info("FIXME: Rejecting:" + evt.getMethod().getDeliveryTag() + ": Requeue:" + evt.getMethod().getRequeue());
int channelId = evt.getChannelId();
- UnacknowledgedMessage message = session.getChannel(channelId).getUnacknowledgedMessageMap().get(evt.getMethod().deliveryTag);
+ UnacknowledgedMessage message = session.getChannel(channelId).getUnacknowledgedMessageMap().get(evt.getMethod().getDeliveryTag());
_logger.info("Need to reject message:" + message);
// if (evt.getMethod().requeue)
Modified: incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelCloseHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelCloseHandler.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelCloseHandler.java (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelCloseHandler.java Thu Mar 22 06:14:42 2007
@@ -51,8 +51,8 @@
{
AMQProtocolSession session = stateManager.getProtocolSession();
ChannelCloseBody body = evt.getMethod();
- _logger.info("Received channel close for id " + evt.getChannelId() + " citing class " + body.classId +
- " and method " + body.methodId);
+ _logger.info("Received channel close for id " + evt.getChannelId() + " citing class " + body.getClassId() +
+ " and method " + body.getMethodId());
int channelId = evt.getChannelId();
AMQChannel channel = session.getChannel(channelId);
Modified: incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelFlowHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelFlowHandler.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelFlowHandler.java (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelFlowHandler.java Thu Mar 22 06:14:42 2007
@@ -58,15 +58,15 @@
throw body.getChannelNotFoundException(evt.getChannelId());
}
- channel.setSuspended(!body.active);
- _logger.debug("Channel.Flow for channel " + evt.getChannelId() + ", active=" + body.active);
+ channel.setSuspended(!body.getActive());
+ _logger.debug("Channel.Flow for channel " + evt.getChannelId() + ", active=" + body.getActive());
// AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
// TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
// Be aware of possible changes to parameter order as versions change.
AMQFrame response = ChannelFlowOkBody.createAMQFrame(evt.getChannelId(),
(byte)8, (byte)0, // AMQP version (major, minor)
- body.active); // active
+ body.getActive()); // active
session.writeFrame(response);
}
}
Modified: incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelOpenHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelOpenHandler.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelOpenHandler.java (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ChannelOpenHandler.java Thu Mar 22 06:14:42 2007
@@ -24,6 +24,7 @@
import org.apache.qpid.framing.AMQFrame;
import org.apache.qpid.framing.ChannelOpenBody;
import org.apache.qpid.framing.ChannelOpenOkBody;
+import org.apache.qpid.framing.amqp_8_0.ChannelOpenOkBodyImpl;
import org.apache.qpid.protocol.AMQMethodEvent;
import org.apache.qpid.server.AMQChannel;
import org.apache.qpid.server.protocol.AMQProtocolSession;
@@ -52,10 +53,15 @@
final AMQChannel channel = new AMQChannel(session,evt.getChannelId(), virtualHost.getMessageStore(),
virtualHost.getExchangeRegistry());
session.addChannel(channel);
- // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
- // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
- // Be aware of possible changes to parameter order as versions change.
- AMQFrame response = ChannelOpenOkBody.createAMQFrame(evt.getChannelId(), (byte)8, (byte)0);
- session.writeFrame(response);
+
+ ChannelOpenOkBody channelOpenOkBody = createChannelOpenOkBody();
+
+
+ session.writeFrame(new AMQFrame(evt.getChannelId(), channelOpenOkBody));
+ }
+
+ private ChannelOpenOkBody createChannelOpenOkBody()
+ {
+ return new ChannelOpenOkBodyImpl();
}
}
Modified: incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionCloseMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionCloseMethodHandler.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionCloseMethodHandler.java (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionCloseMethodHandler.java Thu Mar 22 06:14:42 2007
@@ -49,8 +49,8 @@
{
AMQProtocolSession session = stateManager.getProtocolSession();
final ConnectionCloseBody body = evt.getMethod();
- _logger.info("ConnectionClose received with reply code/reply text " + body.replyCode + "/" +
- body.replyText + " for " + session);
+ _logger.info("ConnectionClose received with reply code/reply text " + body.getReplyCode() + "/" +
+ body.getReplyText() + " for " + session);
try
{
session.closeSession();
Modified: incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionOpenMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionOpenMethodHandler.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionOpenMethodHandler.java (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionOpenMethodHandler.java Thu Mar 22 06:14:42 2007
@@ -58,13 +58,13 @@
//ignore leading '/'
String virtualHostName;
- if((body.virtualHost != null) && body.virtualHost.charAt(0) == '/')
+ if((body.getVirtualHost() != null) && body.getVirtualHost().charAt(0) == '/')
{
- virtualHostName = new StringBuilder(body.virtualHost.subSequence(1,body.virtualHost.length())).toString();
+ virtualHostName = new StringBuilder(body.getVirtualHost().subSequence(1,body.getVirtualHost().length())).toString();
}
else
{
- virtualHostName = body.virtualHost == null ? null : String.valueOf(body.virtualHost);
+ virtualHostName = body.getVirtualHost() == null ? null : String.valueOf(body.getVirtualHost());
}
VirtualHost virtualHost = stateManager.getVirtualHostRegistry().getVirtualHost(virtualHostName);
@@ -90,7 +90,7 @@
// Be aware of possible changes to parameter order as versions change.
AMQFrame response = ConnectionOpenOkBody.createAMQFrame((short)0,
(byte)8, (byte)0, // AMQP version (major, minor)
- body.virtualHost);
+ body.getVirtualHost());
stateManager.changeState(AMQState.CONNECTION_OPEN);
session.writeFrame(response);
}
Modified: incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionSecureOkMethodHandler.java Thu Mar 22 06:14:42 2007
@@ -30,6 +30,10 @@
import org.apache.qpid.framing.ConnectionSecureBody;
import org.apache.qpid.framing.ConnectionSecureOkBody;
import org.apache.qpid.framing.ConnectionTuneBody;
+import org.apache.qpid.framing.amqp_8_0.ConnectionCloseBodyImpl;
+import org.apache.qpid.framing.amqp_8_0.ConnectionSecureOkBodyImpl;
+import org.apache.qpid.framing.amqp_8_0.ConnectionTuneBodyImpl;
+import org.apache.qpid.framing.amqp_8_0.ConnectionSecureBodyImpl;
import org.apache.qpid.protocol.AMQConstant;
import org.apache.qpid.protocol.AMQMethodEvent;
import org.apache.qpid.server.protocol.AMQProtocolSession;
@@ -68,7 +72,7 @@
throw new AMQException("No SASL context set up in session");
}
- AuthenticationResult authResult = authMgr.authenticate(ss, body.response);
+ AuthenticationResult authResult = authMgr.authenticate(ss, body.getResponse());
switch (authResult.status)
{
case ERROR:
@@ -76,44 +80,32 @@
// throw new AMQException(AMQConstant.NOT_ALLOWED.getCode(), AMQConstant.NOT_ALLOWED.getName());
_logger.info("Authentication failed");
stateManager.changeState(AMQState.CONNECTION_CLOSING);
- // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
- // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
- // Be aware of possible changes to parameter order as versions change.
- AMQFrame close = ConnectionCloseBody.createAMQFrame(0,
- (byte)8, (byte)0, // AMQP version (major, minor)
- ConnectionCloseBody.getClazz((byte)8, (byte)0), // classId
- ConnectionCloseBody.getMethod((byte)8, (byte)0), // methodId
- AMQConstant.NOT_ALLOWED.getCode(), // replyCode
- AMQConstant.NOT_ALLOWED.getName()); // replyText
- session.writeFrame(close);
+
+ ConnectionCloseBody closeBody =
+ new ConnectionCloseBodyImpl(AMQConstant.NOT_ALLOWED.getCode(), // replyCode
+ AMQConstant.NOT_ALLOWED.getName(), // replyText)
+ ConnectionSecureOkBodyImpl.CLASS_ID, // classId
+ ConnectionSecureOkBodyImpl.METHOD_ID); // methodId
+
+ session.writeFrame(new AMQFrame(0,closeBody));
disposeSaslServer(session);
break;
case SUCCESS:
_logger.info("Connected as: " + ss.getAuthorizationID());
stateManager.changeState(AMQState.CONNECTION_NOT_TUNED);
- // TODO: Check the value of channelMax here: This should be the max
- // value of a 2-byte unsigned integer (as channel is only 2 bytes on the wire),
- // not Integer.MAX_VALUE (which is signed 4 bytes).
- // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
- // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
- // Be aware of possible changes to parameter order as versions change.
- AMQFrame tune = ConnectionTuneBody.createAMQFrame(0,
- (byte)8, (byte)0, // AMQP version (major, minor)
- Integer.MAX_VALUE, // channelMax
- ConnectionStartOkMethodHandler.getConfiguredFrameSize(), // frameMax
- HeartbeatConfig.getInstance().getDelay()); // heartbeat
- session.writeFrame(tune);
+
+ ConnectionTuneBody tuneBody =
+ new ConnectionTuneBodyImpl(ConnectionStartOkMethodHandler.getConfiguredMaxChannels(),
+ ConnectionStartOkMethodHandler.getConfiguredFrameSize(),
+ HeartbeatConfig.getInstance().getDelay());
+ session.writeFrame(new AMQFrame(0,tuneBody));
disposeSaslServer(session);
break;
case CONTINUE:
stateManager.changeState(AMQState.CONNECTION_NOT_AUTH);
- // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
- // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
- // Be aware of possible changes to parameter order as versions change.
- AMQFrame challenge = ConnectionSecureBody.createAMQFrame(0,
- (byte)8, (byte)0, // AMQP version (major, minor)
- authResult.challenge); // challenge
- session.writeFrame(challenge);
+ ConnectionSecureBody secureBody =
+ new ConnectionSecureBodyImpl(authResult.challenge);
+ session.writeFrame(new AMQFrame(0,secureBody));
}
}
Modified: incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionStartOkMethodHandler.java Thu Mar 22 06:14:42 2007
@@ -48,6 +48,7 @@
private static ConnectionStartOkMethodHandler _instance = new ConnectionStartOkMethodHandler();
private static final int DEFAULT_FRAME_SIZE = 65536;
+ private static final int DEFAULT_CHANNEL_MAX = 65536;
public static StateAwareMethodListener<ConnectionStartOkBody> getInstance()
{
@@ -62,23 +63,23 @@
{
AMQProtocolSession session = stateManager.getProtocolSession();
final ConnectionStartOkBody body = evt.getMethod();
- _logger.info("SASL Mechanism selected: " + body.mechanism);
- _logger.info("Locale selected: " + body.locale);
+ _logger.info("SASL Mechanism selected: " + body.getMechanism());
+ _logger.info("Locale selected: " + body.getLocale());
AuthenticationManager authMgr = ApplicationRegistry.getInstance().getAuthenticationManager();
SaslServer ss = null;
try
{
- ss = authMgr.createSaslServer(String.valueOf(body.mechanism), session.getLocalFQDN());
+ ss = authMgr.createSaslServer(String.valueOf(body.getMechanism()), session.getLocalFQDN());
session.setSaslServer(ss);
- AuthenticationResult authResult = authMgr.authenticate(ss, body.response);
+ AuthenticationResult authResult = authMgr.authenticate(ss, body.getResponse());
//save clientProperties
if (session.getClientProperties() == null)
{
- session.setClientProperties(body.clientProperties);
+ session.setClientProperties(body.getClientProperties());
}
switch (authResult.status)
@@ -140,6 +141,15 @@
final int framesize = config.getInt("advanced.framesize", DEFAULT_FRAME_SIZE);
_logger.info("Framesize set to " + framesize);
return framesize;
+ }
+
+
+ static int getConfiguredMaxChannels()
+ {
+ final Configuration config = ApplicationRegistry.getInstance().getConfiguration();
+ final int maxChannels = config.getInt("advanced.maxchannels", DEFAULT_CHANNEL_MAX);
+ _logger.info("Max Channels set to " + maxChannels);
+ return maxChannels;
}
}
Modified: incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionTuneOkMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionTuneOkMethodHandler.java?view=diff&rev=521253&r1=511387&r2=521253
==============================================================================
--- incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionTuneOkMethodHandler.java (original)
+++ incubator/qpid/branches/java.multi_version/java/broker/src/main/java/org/apache/qpid/server/handler/ConnectionTuneOkMethodHandler.java Thu Mar 22 06:14:42 2007
@@ -49,6 +49,6 @@
_logger.debug(body);
}
stateManager.changeState(AMQState.CONNECTION_NOT_OPENED);
- session.initHeartbeats(body.heartbeat);
+ session.initHeartbeats(body.getHeartbeat());
}
}