diff options
| author | Ted Ross <tross@apache.org> | 2008-09-05 14:11:23 +0000 |
|---|---|---|
| committer | Ted Ross <tross@apache.org> | 2008-09-05 14:11:23 +0000 |
| commit | 67cb9d3c75bada36fae0086a04b6b1e9fc92459f (patch) | |
| tree | cb2a0abae60bcaea0d1a3eac785ef8f6331fd238 /qpid/cpp/managementgen | |
| parent | ab50ded1719791a6958442d3a7f9542488860911 (diff) | |
| download | qpid-python-67cb9d3c75bada36fae0086a04b6b1e9fc92459f.tar.gz | |
QPID-1274 - Improved packaging for management agent and code generation tool
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@692450 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/managementgen')
| -rw-r--r-- | qpid/cpp/managementgen/Makefile.am | 29 | ||||
| -rw-r--r-- | qpid/cpp/managementgen/management-types.xml | 56 | ||||
| -rwxr-xr-x | qpid/cpp/managementgen/qmf-gen (renamed from qpid/cpp/managementgen/main.py) | 24 | ||||
| -rw-r--r-- | qpid/cpp/managementgen/qmf/__init__.py (renamed from qpid/cpp/managementgen/managementgen) | 7 | ||||
| -rwxr-xr-x | qpid/cpp/managementgen/qmf/generate.py (renamed from qpid/cpp/managementgen/generate.py) | 8 | ||||
| -rwxr-xr-x | qpid/cpp/managementgen/qmf/schema.py (renamed from qpid/cpp/managementgen/schema.py) | 0 |
6 files changed, 86 insertions, 38 deletions
diff --git a/qpid/cpp/managementgen/Makefile.am b/qpid/cpp/managementgen/Makefile.am index 993eeb1d20..7a415b4be6 100644 --- a/qpid/cpp/managementgen/Makefile.am +++ b/qpid/cpp/managementgen/Makefile.am @@ -1,8 +1,8 @@ -managementgendir = $(datadir)/managementgen -dist_managementgen_SCRIPTS = \ - main.py -nobase_managementgen_DATA = \ - schema.py generate.py \ +qmfdatadir = $(datadir)/qmf +qmfpythondir = $(pythondir) +dist_bin_SCRIPTS = \ + qmf-gen +nobase_qmfdata_DATA = \ templates/Args.h \ templates/Class.cpp \ templates/Class.h \ @@ -10,18 +10,9 @@ nobase_managementgen_DATA = \ templates/Package.cpp \ templates/Package.h \ management-types.xml +nobase_qmfpython_DATA = \ + qmf/__init__.py \ + qmf/generate.py \ + qmf/schema.py -dist_bin_SCRIPTS = managementgen - -EXTRA_DIST = $(nobase_managementgen_DATA) - -# This should depend on ../../specs/management-types.xml, but can't -# because it won't exist in a dist. This rule means that dist-gzip -# (and rpmbuild) cannot be run purely on the cpp/ directory, the -# cpp/../specs/ directory must exist, which is not a new dependency -# but this is an additional instance of the dependency. -# -# WARNING: Because this target does not have a proper dependency -# changes to the specs/management-types.xml will not be picked up! -management-types.xml: - cp $(top_srcdir)/../specs/management-types.xml . +EXTRA_DIST = $(nobase_qmfdata_DATA) $(nobase_qmfpython_DATA) diff --git a/qpid/cpp/managementgen/management-types.xml b/qpid/cpp/managementgen/management-types.xml new file mode 100644 index 0000000000..31337b23bc --- /dev/null +++ b/qpid/cpp/managementgen/management-types.xml @@ -0,0 +1,56 @@ +<schema-types> + +<!-- + 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. +--> + +<type name="objId" base="REF" cpp="ObjectId" encode="#.encode(@)" decode="#.decode(@)" accessor="direct" init="0"/> +<type name="uint8" base="U8" cpp="uint8_t" encode="@.putOctet(#)" decode="# = @.getOctet()" accessor="direct" init="0"/> +<type name="uint16" base="U16" cpp="uint16_t" encode="@.putShort(#)" decode="# = @.getShort()" accessor="direct" init="0"/> +<type name="uint32" base="U32" cpp="uint32_t" encode="@.putLong(#)" decode="# = @.getLong()" accessor="direct" init="0"/> +<type name="uint64" base="U64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" accessor="direct" init="0"/> +<type name="int8" base="S8" cpp="int8_t" encode="@.putInt8(#)" decode="# = @.getInt8()" accessor="direct" init="0"/> +<type name="int16" base="S16" cpp="int16_t" encode="@.putInt16(#)" decode="# = @.getInt16()" accessor="direct" init="0"/> +<type name="int32" base="S32" cpp="int32_t" encode="@.putInt32(#)" decode="# = @.getInt32()" accessor="direct" init="0"/> +<type name="int64" base="S64" cpp="int64_t" encode="@.putInt64(#)" decode="# = @.getInt64()" accessor="direct" init="0"/> +<type name="bool" base="BOOL" cpp="uint8_t" encode="@.putOctet(#?1:0)" decode="# = @.getOctet()==1" accessor="direct" init="0"/> +<type name="sstr" base="SSTR" cpp="std::string" encode="@.putShortString(#)" decode="@.getShortString(#)" accessor="direct" init='""'/> +<type name="lstr" base="LSTR" cpp="std::string" encode="@.putLongString(#)" decode="@.getLongString(#)" accessor="direct" init='""'/> +<type name="absTime" base="ABSTIME" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" accessor="direct" init="0"/> +<type name="deltaTime" base="DELTATIME" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" accessor="direct" init="0"/> +<type name="float" base="FLOAT" cpp="float" encode="@.putFloat(#)" decode="# = @.getFloat()" accessor="direct" init="0."/> +<type name="double" base="DOUBLE" cpp="double" encode="@.putDouble(#)" decode="# = @.getDouble()" accessor="direct" init="0."/> +<type name="uuid" base="UUID" cpp="framing::Uuid" encode="#.encode(@)" decode="#.decode(@)" accessor="direct"/> +<type name="map" base="FTABLE" cpp="framing::FieldTable" encode="#.encode(@)" decode="#.decode(@)" accessor="direct"/> + +<type name="hilo8" base="U8" cpp="uint8_t" encode="@.putOctet(#)" decode="# = @.getOctet()" style="wm" accessor="counter" init="0"/> +<type name="hilo16" base="U16" cpp="uint16_t" encode="@.putShort(#)" decode="# = @.getShort()" style="wm" accessor="counter" init="0"/> +<type name="hilo32" base="U32" cpp="uint32_t" encode="@.putLong(#)" decode="# = @.getLong()" style="wm" accessor="counter" init="0"/> +<type name="hilo64" base="U64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" style="wm" accessor="counter" init="0"/> + +<type name="count8" base="U8" cpp="uint8_t" encode="@.putOctet(#)" decode="# = @.getOctet()" accessor="counter" init="0" perThread="y"/> +<type name="count16" base="U16" cpp="uint16_t" encode="@.putShort(#)" decode="# = @.getShort()" accessor="counter" init="0" perThread="y"/> +<type name="count32" base="U32" cpp="uint32_t" encode="@.putLong(#)" decode="# = @.getLong()" accessor="counter" init="0" perThread="y"/> +<type name="count64" base="U64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" accessor="counter" init="0" perThread="y"/> + +<!-- Min/Max/Average statistics --> +<type name="mma32" base="U32" cpp="uint32_t" encode="@.putLong(#)" decode="# = @.getLong()" style="mma" accessor="direct" init="0" perThread="y"/> +<type name="mma64" base="U64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" style="mma" accessor="direct" init="0" perThread="y"/> +<type name="mmaTime" base="DELTATIME" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" style="mma" accessor="direct" init="0" perThread="y"/> + +</schema-types> diff --git a/qpid/cpp/managementgen/main.py b/qpid/cpp/managementgen/qmf-gen index 4459177a53..a29a4074fd 100755 --- a/qpid/cpp/managementgen/main.py +++ b/qpid/cpp/managementgen/qmf-gen @@ -18,26 +18,34 @@ # specific language governing permissions and limitations # under the License. # +import sys +import os +from qmf.schema import PackageSchema, SchemaClass +from qmf.generate import Generator +from optparse import OptionParser -from schema import PackageSchema, SchemaClass -from generate import Generator -from optparse import OptionParser +dataPath = os.path.dirname(sys.argv[0]) # Set command line options -usage = "usage: %prog [options] schema-document type-document template-directory out-directory" +usage = "usage: %prog [options] schema-document out-directory" parser = OptionParser (usage=usage) parser.add_option ("-m", "--makefile", dest="makefile", metavar="FILE", help="Makefile fragment") +parser.add_option ("-t", "--typefile", dest="typefile", metavar="FILE", default=dataPath + "/management-types.xml", + help="Type descriptor file") +parser.add_option ("-d", "--templatedir", dest="templatedir", metavar="DIR", default=dataPath + "/templates", + help="Template directory") (opts, args) = parser.parse_args () -if len (args) < 4: +if len (args) < 2: parser.error ("Too few arguments") +typefile = opts.typefile +templatedir = opts.templatedir + schemafile = args[0] -typefile = args[1] -templatedir = args[2] -outdir = args[3] +outdir = args[1] gen = Generator (outdir, templatedir) schema = PackageSchema (typefile, schemafile, opts) diff --git a/qpid/cpp/managementgen/managementgen b/qpid/cpp/managementgen/qmf/__init__.py index 55ea846270..caef6cc58b 100644 --- a/qpid/cpp/managementgen/managementgen +++ b/qpid/cpp/managementgen/qmf/__init__.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file @@ -19,8 +17,3 @@ # under the License. # -import sys - -sys.path.append("/usr/share/managementgen") - -import main diff --git a/qpid/cpp/managementgen/generate.py b/qpid/cpp/managementgen/qmf/generate.py index 6024173f67..c1edf0b8e2 100755 --- a/qpid/cpp/managementgen/generate.py +++ b/qpid/cpp/managementgen/qmf/generate.py @@ -107,10 +107,10 @@ class Makefile: def genGenSources (self, stream, variables): mdir = variables["mgenDir"] sdir = variables["specDir"] - stream.write (mdir + "/main.py \\\n") - stream.write (" " + mdir + "/generate.py \\\n") - stream.write (" " + mdir + "/schema.py \\\n") - stream.write (" " + sdir + "/management-types.xml \\\n") + stream.write (mdir + "/qmf-gen \\\n") + stream.write (" " + mdir + "/qmf/generate.py \\\n") + stream.write (" " + mdir + "/qmf/schema.py \\\n") + stream.write (" " + mdir + "/management-types.xml \\\n") stream.write (" " + sdir + "/management-schema.xml \\\n") first = True for template in self.templateFiles: diff --git a/qpid/cpp/managementgen/schema.py b/qpid/cpp/managementgen/qmf/schema.py index e666bdbb39..e666bdbb39 100755 --- a/qpid/cpp/managementgen/schema.py +++ b/qpid/cpp/managementgen/qmf/schema.py |
