From 5efcd04d4557a6902a3ba85aa5114b0f282937f5 Mon Sep 17 00:00:00 2001 From: Robert Godfrey Date: Sun, 31 Jan 2010 00:31:49 +0000 Subject: QPID-2379 : Initial work on adding QMF and federation to the Java Broker git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@904934 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/java/broker/src/xsl/qmf.xsl | 842 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 842 insertions(+) create mode 100644 qpid/java/broker/src/xsl/qmf.xsl (limited to 'qpid/java/broker/src/xsl') diff --git a/qpid/java/broker/src/xsl/qmf.xsl b/qpid/java/broker/src/xsl/qmf.xsl new file mode 100644 index 0000000000..3133674de1 --- /dev/null +++ b/qpid/java/broker/src/xsl/qmf.xsl @@ -0,0 +1,842 @@ + + + + +/* + * + * 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.qpid.qmf.schema; + +import org.apache.qpid.qmf.*; +import org.apache.qpid.server.virtualhost.VirtualHost; +import org.apache.qpid.server.message.ServerMessage; +import org.apache.qpid.transport.codec.BBEncoder; +import org.apache.qpid.transport.codec.BBDecoder; + +import java.util.Arrays; +import java.util.UUID; +import java.util.Map; + + + + + + + +. +Schema + + + +public class extends QMFPackage +{ + private static final byte QMF_VERSION = (byte) '2'; + + private static final BrokerSchema PACKAGE = new (); + private static final String SCHEMA_NAME = ""; + + + + protected abstract class QMFInfoCommand<T extends QMFObject> extends QMFCommand + { + private final T _object; + private final long _sampleTime; + + + protected QMFInfoCommand(QMFCommand trigger, QMFOperation op, T object, long sampleTime) + { + this(trigger.getHeader().getVersion(), + trigger.getHeader().getSeq(), + op, + object, + sampleTime); + } + + protected QMFInfoCommand(QMFOperation op, T object, long sampleTime) + { + this(QMF_VERSION,0,op,object,sampleTime); + } + + private QMFInfoCommand(final byte qmfVersion, + final int seq, + final QMFOperation op, + final T object, + final long sampleTime) + { + super(new QMFCommandHeader(qmfVersion, seq,op)); + _object = object; + _sampleTime = sampleTime; + } + + public T getObject() + { + return _object; + } + + @Override + public void encode(final BBEncoder encoder) + { + super.encode(encoder); + encoder.writeStr8(SCHEMA_NAME); + encoder.writeStr8(_object.getQMFClass().getName()); + encoder.writeBin128(new byte[16]); + encoder.writeUint64(_sampleTime * 1000000L); + encoder.writeUint64(_object.getCreateTime() * 1000000L); + encoder.writeUint64(_object.getDeleteTime() * 1000000L); + encoder.writeBin128(_object.getId()); + } + } + + protected abstract class QMFConfigInfoCommand<T extends QMFObject> extends QMFInfoCommand<T> + { + protected QMFConfigInfoCommand(T object, long sampleTime) + { + super(QMFOperation.CONFIG_INDICATION, object, sampleTime); + } + } + + protected abstract class QMFInstrumentInfoCommand<T extends QMFObject> extends QMFInfoCommand<T> + { + protected QMFInstrumentInfoCommand(T object, long sampleTime) + { + super(QMFOperation.INSTRUMENTATION_INDICATION, object, sampleTime); + } + } + + protected abstract class QMFGetQueryResponseCommand<T extends QMFObject> extends QMFInfoCommand<T> + { + protected QMFGetQueryResponseCommand(T object, QMFGetQueryCommand cmd, long sampleTime) + { + super(cmd, QMFOperation.GET_QUERY_RESPONSE, object, sampleTime); + } + } + + + + + + + + + private () + { + super(SCHEMA_NAME); + setClasses( Arrays.asList( new QMFClass[] { , } ) ); + } + + public <T extends QMFClass> T getQMFClassInstance(Class<T> clazz) + { + for(QMFClass c : getClasses()) + { + if(clazz.isInstance(c)) + { + return (T) c; + } + } + return null; + } + + + + public static BrokerSchema getPackage() + { + return PACKAGE; + } + +} + + + + + Class + + + + + + public class extends QMFObjectClass<Object, Delegate> + { + + + + + + + private () + { + super("", + new byte[16]); + + setProperties( Arrays.asList( new QMFProperty[] { } ) ); + setStatistics( Arrays.asList( new QMFStatistic[] { } ) ); + setMethods( Arrays.asList( new QMFMethod[] { } ) ); + } + + public Object newInstance(final Delegate delegate) + { + return new Object(delegate); + } + + } + + private final _Class = new (); + + public interface Delegate extends QMFObject.Delegate + { + + Y + } + + public final class Object extends QMFObject<, Delegate> + { + protected Object(Delegate delegate) + { + super(delegate); + } + + public Class getQMFClass() + { + return _Class; + } + + public QMFCommand asConfigInfoCmd(long sampleTime) + { + return new QMFConfigInfoCommand(this,sampleTime); + } + + public QMFCommand asInstrumentInfoCmd(long sampleTime) + { + return new QMFInstrumentInfoCommand(this,sampleTime); + } + + public QMFCommand asGetQueryResponseCmd(QMFGetQueryCommand queryCommand, long sampleTime) + { + return new QMFGetQueryResponseCommand(this,queryCommand,sampleTime); + } + + + + + + + } + + public final class QMFConfigInfoCommand extends QMFConfigInfoCommand<Object> + { + + protected QMFConfigInfoCommand(Object object, long sampleTime) + { + super(object, sampleTime); + } + + @Override + public void encode(final BBEncoder encoder) + { + super.encode(encoder); + + + } + } + + public final class QMFInstrumentInfoCommand extends QMFInstrumentInfoCommand<Object> + { + + protected QMFInstrumentInfoCommand(Object object, long sampleTime) + { + super(object, sampleTime); + } + + @Override + public void encode(final BBEncoder encoder) + { + super.encode(encoder); + statistic + + } + } + + public final class QMFGetQueryResponseCommand extends QMFGetQueryResponseCommand<Object> + { + + protected QMFGetQueryResponseCommand(Object object, QMFGetQueryCommand cmd, long sampleTime) + { + super(object, cmd, sampleTime); + } + + @Override + public void encode(final BBEncoder encoder) + { + super.encode(encoder); + + + } + } + + + + + + + + property + presence + + byte = (byte) 0; + + if( getObject().get() != null ) + { + |= (1 << ); + } + + encoder.writeUint8( ); + + + + + + + + count32 get(); + count32 getHigh(); + count32 getLow(); + + + deltaTime getSamples(); + deltaTime getMin(); + deltaTime getMax(); + deltaTime getAverage(); + + get(); + + + + + + + public count32 get() + { + return getDelegate().get(); + } + + public count32 getHigh() + { + return getDelegate().getHigh(); + } + + public count32 getLow() + { + return getDelegate().getLow(); + } + + + + public deltaTime getSamples() + { + return getDelegate().getSamples(); + } + + public deltaTime getMin() + { + return getDelegate().getMin(); + } + + public deltaTime getMax() + { + return getDelegate().getMax(); + } + + public deltaTime getAverage() + { + return getDelegate().getAverage(); + } + + + + public get() + { + return getDelegate().get(); + } + + + + + + + getObject().get() + + + if( != null) + { + encoder.; + } + + + + + encoder.count32; + encoder.getObject().getHigh()count32; + encoder.getObject().getLow()count32; + + + + encoder.getObject().getSamples()deltaTime; + encoder.getObject().getMin()deltaTime; + encoder.getObject().getMax()deltaTime; + encoder.getObject().getAverage()deltaTime; + + + + encoder.; + + + + + + + + + + Property + public class extends QMFProperty + { + + private () + { + super( "", + QMFType., + QMFProperty.AccessCode., + truefalse, + truefalse); + + setDescription(""); + + + setMin(); + + + setMin(); + + + setReferencedClass(""); + + + + setUnit(""); + + } + } + + private final _Property = new (); + + + + + + uint32 + Highuint32 (High) + Lowuint32 (Low) + + + SamplesdeltaTime (Samples) + MaxdeltaTime (Max) + MindeltaTime (Min) + AveragedeltaTime (Average) + + + + + + + + + + + + + Statistic + public class extends QMFStatistic + { + + private () + { + super( "", QMFType., + "" + null + , + "" + null + ); + } + } + + private final _Statistic = new (); + + + + + + Method + public class extends QMFMethod<Object> + { + private () + { + super( "", + "" + null +); + + + + } + + + public Invocation parse(BBDecoder decoder) + { + + return new Invocation(); + } + } + + private final _Method = new (); + + private class Invocation implements QMFMethodInvocation<Object> + { + + + private Invocation(yes) + { + + } + + public QMFMethodResponseCommand execute(Object obj, QMFMethodRequestCommand cmd) + { + return obj.( new ResponseCommandFactory(cmd), _ ); + } + } + + public final class ResponseCommandFactory + { + private final QMFMethodRequestCommand _requestCmd; + private ResponseCommandFactory(QMFMethodRequestCommand cmd) + { + _requestCmd = cmd; + } + + public ResponseCommand createResponseCommand( yesO ) + { + return new ResponseCommand(_requestCmd, O); + } + } + + public final class ResponseCommand extends QMFMethodResponseCommand + { + + private ResponseCommand(QMFMethodRequestCommand cmd, yesO) + { + super(cmd); + + + } + + @Override + public void encode(final BBEncoder encoder) + { + super.encode(encoder); + + + } + } + + + N + Method + public Class.ResponseCommand (Class.ResponseCommandFactory factory, yes ) + { + return getDelegate().(factory, ); + } + ; + + + QMFMethod.Argument = new QMFMethod.Argument("", QMFType.); + + + .setDescription(""); + + + + .setDirection(QMFMethod.Direction.); + addArgument( ); + + + = decoder.; + + + encoder._; + + I + , + + + private final _; + + + _ = ; + + + _Class, + _EventClass, + _Property, + _Statistic, HighStatistic, LowStatisticSamplesStatistic, MaxStatistic, MinStatistic, AverageStatistic, + _Method, + + + + EventClass + Event + + + + + public class extends QMFEventClass + { + + + + + private () + { + super("", + new byte[16]); + + setProperties( Arrays.asList( new QMFProperty[] { } ) ); + } + + public QMFEventSeverity getSeverity() + { + return QMFEventSeverity.; + } + + public QMFEventCommand<> newEvent(argParamList, ) + { + return new (argList, ); + } + + + + } + + private final _EventClass = new (); + + private final class extends QMFEventCommand<> + { + argMemberDef + + private (argParamList, ) + { + argMemberAssign + } + + public getEventClass() + { + return _EventClass; + } + + public void encode(final BBEncoder encoder) + { + super.encode(encoder); + argEncode + + + } + } + + + + + propertyClass + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Arg + public class extends QMFProperty + { + private () + { + super( "", + QMFType., + QMFProperty.AccessCode.RO,false,false); + + + setDescription(""); + + } + } + + private final _Arg = new (); + + + + private final _; + + + + _ = ; + encoder._; + + + + + + + + + _Arg + , + + + + +ABSTIME +BOOLEAN +MAP +OBJECTREFERENCE +STR8 +STR16 +UINT16 +UINT32 +UUID +DELTATIME +UINT32 +UINT64 + + + + + + UUID + Long + Boolean + Map + Object + String + String + Integer + Long + UUID + Long + Long + Long + + + + + + writeUint64( ) + writeInt8( ? (byte) -1 : (byte) 0) + writeMap( ) + writeBin128( .getId() ) + writeStr8( ) + writeStr16( ) + writeUint16( ) + writeUint32( ) + writeUuid( ) + writeUint64( ) + writeUint32( ) + writeUint64( ) + + + + + + readUint64() + readInt8() != 0 + readMap() + readBin128() + readStr8() + readStr16() + readUint16() + readUint32() + readUuid() + readUint64() + readUint32() + readUint64() + + + + + + + + + EMERGENCY + ALERT + CRITICAL + ERROR + WARN + NOTICE + INFORM + DEBUG + + + + + + + + + + + + + + -- cgit v1.2.1