Updated openwire generation scripts so that they produce file with consistent newlines even on windows.

Updated dotnet generator due to refactor


git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@383296 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2006-03-05 08:49:13 +00:00
parent 47a327ab83
commit e0a2b8eab7
91 changed files with 5719 additions and 5606 deletions

View File

@ -261,6 +261,11 @@
<artifactId>annogen</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>${ant_version}</version>
</dependency>
<!-- Axion SQL DB used for testing JDBC message store -->
<dependency>

View File

@ -31,7 +31,7 @@ public abstract class OpenWireCSharpClassesScript extends OpenWireClassesScript
public Object run() {
filePostFix = ".cs";
if (destDir == null) {
destDir = new File("../openwire-dotnet/src/OpenWire.Client/Commands");
destDir = new File("../openwire-dotnet/src/ActiveMQ/Commands");
}
return super.run();

View File

@ -33,7 +33,7 @@ public abstract class OpenWireCSharpMarshallingScript extends OpenWireJavaMarsha
public Object run() {
filePostFix = ".cs";
if (destDir == null) {
destDir = new File("../openwire-dotnet/src/OpenWire.Client/IO");
destDir = new File("../openwire-dotnet/src/ActiveMQ/OpenWire/V"+getOpenwireVersion());
}
return super.run();

View File

@ -16,14 +16,19 @@
*/
package org.apache.activemq.openwire.tool;
import org.codehaus.jam.JClass;
import org.codehaus.jam.JProperty;
import org.codehaus.jam.JamClassIterator;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.FixCRLF;
import org.codehaus.jam.JClass;
import org.codehaus.jam.JProperty;
import org.codehaus.jam.JamClassIterator;
/**
*
@ -110,6 +115,16 @@ public abstract class OpenWireClassesScript extends OpenWireScript {
out.close();
}
}
// Use the FixCRLF Ant Task to make sure the file has consistent newlines
// so that SVN does not complain on checkin.
Project project = new Project();
project.init();
FixCRLF fixCRLF = new FixCRLF();
fixCRLF.setProject(project);
fixCRLF.setSrcdir(destFile.getParentFile());
fixCRLF.setIncludes(destFile.getName());
fixCRLF.execute();
}
protected abstract void generateFile(PrintWriter out);

View File

@ -44,10 +44,10 @@ class GenerateCSharpClasses extends OpenWireCSharpClassesScript {
using System;
using System.Collections;
using OpenWire.Client;
using OpenWire.Client.Core;
using ActiveMQ.OpenWire;
using ActiveMQ.Commands;
namespace OpenWire.Client.Commands
namespace ActiveMQ.Commands
{
//
// Marshalling code for Open Wire Format for ${jclass.simpleName}

View File

@ -45,12 +45,11 @@ using System;
using System.Collections;
using System.IO;
using OpenWire.Client;
using OpenWire.Client.Commands;
using OpenWire.Client.Core;
using OpenWire.Client.IO;
using ActiveMQ.Commands;
using ActiveMQ.OpenWire;
using ActiveMQ.OpenWire.V${openwireVersion};
namespace OpenWire.Client.IO
namespace ActiveMQ.OpenWire.V${openwireVersion}
{
//
// Marshalling code for Open Wire Format for ${jclass.simpleName}
@ -182,12 +181,11 @@ using System;
using System.Collections;
using System.IO;
using OpenWire.Client;
using OpenWire.Client.Commands;
using OpenWire.Client.Core;
using OpenWire.Client.IO;
using ActiveMQ.Commands;
using ActiveMQ.OpenWire;
using ActiveMQ.OpenWire.V${openwireVersion};
namespace OpenWire.Client.IO
namespace ActiveMQ.OpenWire.V${openwireVersion}
{
public class MarshallerFactory
{

View File

@ -16,6 +16,8 @@
*/
import org.apache.activemq.openwire.tool.OpenWireScript
import org.apache.activemq.openwire.tool.TestDataGenerator
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.FixCRLF;
/**
* Generates the Java test code for the Open Wire Format
@ -205,6 +207,16 @@ for (property in properties) {
}
"""
}
// Use the FixCRLF Ant Task to make sure the file has consistent newlines
// so that SVN does not complain on checkin.
Project project = new Project();
project.init();
FixCRLF fixCRLF = new FixCRLF();
fixCRLF.setProject(project);
fixCRLF.setSrcdir(file.getParentFile());
fixCRLF.setIncludes(file.getName());
fixCRLF.execute();
}
}
}

View File

@ -68,6 +68,7 @@ public class ConsumerInfoMarshaller extends BaseCommandMarshaller {
info.setBrowser(bs.readBoolean());
info.setDestination((ActiveMQDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setPrefetchSize(dataIn.readInt());
info.setMaximumPendingMessageLimit(dataIn.readInt());
info.setDispatchAsync(bs.readBoolean());
info.setSelector(tightUnmarshalString(dataIn, bs));
info.setSubcriptionName(tightUnmarshalString(dataIn, bs));
@ -112,7 +113,7 @@ public class ConsumerInfoMarshaller extends BaseCommandMarshaller {
rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
bs.writeBoolean(info.isNetworkSubscription());
return rc + 5;
return rc + 9;
}
/**
@ -130,6 +131,7 @@ public class ConsumerInfoMarshaller extends BaseCommandMarshaller {
bs.readBoolean();
tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs);
dataOut.writeInt(info.getPrefetchSize());
dataOut.writeInt(info.getMaximumPendingMessageLimit());
bs.readBoolean();
tightMarshalString2(info.getSelector(), dataOut, bs);
tightMarshalString2(info.getSubcriptionName(), dataOut, bs);
@ -157,6 +159,7 @@ public class ConsumerInfoMarshaller extends BaseCommandMarshaller {
info.setBrowser(dataIn.readBoolean());
info.setDestination((ActiveMQDestination) looseUnmarsalCachedObject(wireFormat, dataIn));
info.setPrefetchSize(dataIn.readInt());
info.setMaximumPendingMessageLimit(dataIn.readInt());
info.setDispatchAsync(dataIn.readBoolean());
info.setSelector(looseUnmarshalString(dataIn));
info.setSubcriptionName(looseUnmarshalString(dataIn));
@ -193,6 +196,7 @@ public class ConsumerInfoMarshaller extends BaseCommandMarshaller {
dataOut.writeBoolean(info.isBrowser());
looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut);
dataOut.writeInt(info.getPrefetchSize());
dataOut.writeInt(info.getMaximumPendingMessageLimit());
dataOut.writeBoolean(info.isDispatchAsync());
looseMarshalString(info.getSelector(), dataOut);
looseMarshalString(info.getSubcriptionName(), dataOut);

View File

@ -54,6 +54,7 @@ public class ConsumerInfoTest extends BaseCommandTestSupport {
info.setBrowser(true);
info.setDestination(createActiveMQDestination("Destination:2"));
info.setPrefetchSize(1);
info.setMaximumPendingMessageLimit(2);
info.setDispatchAsync(false);
info.setSelector("Selector:3");
info.setSubcriptionName("SubcriptionName:4");

View File

@ -66,6 +66,7 @@ maven.repo.apache.scp.executable=scp
#maven.jar.override=on
<!-- used by all modules -->
ant_version=1.6
geronimo_spec_j2ee_version=1.4-rc4
concurrent_version=1.3.4
commons_logging_version=1.0.3

View File

@ -957,6 +957,7 @@ apr_status_t ow_marshal1_ConsumerInfo(ow_bit_buffer *buffer, ow_ConsumerInfo *ob
ow_bit_buffer_append(buffer, object->browser);
SUCCESS_CHECK(ow_marshal1_cached_object(buffer, (ow_DataStructure*)object->destination));
ow_bit_buffer_append(buffer, object->dispatchAsync);
ow_marshal1_string(buffer, object->selector);
ow_marshal1_string(buffer, object->subcriptionName);
@ -976,6 +977,7 @@ apr_status_t ow_marshal2_ConsumerInfo(ow_byte_buffer *buffer, ow_bit_buffer *bit
ow_bit_buffer_read(bitbuffer);
SUCCESS_CHECK(ow_marshal2_cached_object(buffer, bitbuffer, (ow_DataStructure*)object->destination));
SUCCESS_CHECK(ow_byte_buffer_append_int(buffer, object->prefetchSize));
SUCCESS_CHECK(ow_byte_buffer_append_int(buffer, object->maximumPendingMessageLimit));
ow_bit_buffer_read(bitbuffer);
SUCCESS_CHECK(ow_marshal2_string(buffer, bitbuffer, object->selector));
SUCCESS_CHECK(ow_marshal2_string(buffer, bitbuffer, object->subcriptionName));
@ -996,6 +998,7 @@ apr_status_t ow_unmarshal_ConsumerInfo(ow_byte_array *buffer, ow_bit_buffer *bit
object->browser = ow_bit_buffer_read(bitbuffer);
SUCCESS_CHECK(ow_unmarshal_cached_object(buffer, bitbuffer, (ow_DataStructure**)&object->destination, pool));
SUCCESS_CHECK(ow_byte_array_read_int(buffer, &object->prefetchSize));
SUCCESS_CHECK(ow_byte_array_read_int(buffer, &object->maximumPendingMessageLimit));
object->dispatchAsync = ow_bit_buffer_read(bitbuffer);
SUCCESS_CHECK(ow_unmarshal_string(buffer, bitbuffer, &object->selector, pool));
SUCCESS_CHECK(ow_unmarshal_string(buffer, bitbuffer, &object->subcriptionName, pool));

View File

@ -312,6 +312,7 @@ typedef struct ow_ConsumerInfo {
ow_boolean browser;
struct ow_ActiveMQDestination *destination;
ow_int prefetchSize;
ow_int maximumPendingMessageLimit;
ow_boolean dispatchAsync;
ow_string *selector;
ow_string *subcriptionName;

View File

@ -34,6 +34,7 @@ ConsumerInfo::ConsumerInfo()
this->browser = 0 ;
this->destination = 0 ;
this->prefetchSize = 0 ;
this->maximumPendingMessageLimit = 0 ;
this->dispatchAsync = 0 ;
this->selector = 0 ;
this->subcriptionName = 0 ;
@ -94,6 +95,17 @@ void ConsumerInfo::setPrefetchSize(int prefetchSize)
}
int ConsumerInfo::getMaximumPendingMessageLimit()
{
return maximumPendingMessageLimit ;
}
void ConsumerInfo::setMaximumPendingMessageLimit(int maximumPendingMessageLimit)
{
this->maximumPendingMessageLimit = maximumPendingMessageLimit ;
}
bool ConsumerInfo::getDispatchAsync()
{
return dispatchAsync ;

View File

@ -56,6 +56,7 @@ private:
bool browser ;
p<ActiveMQDestination> destination ;
int prefetchSize ;
int maximumPendingMessageLimit ;
bool dispatchAsync ;
p<string> selector ;
p<string> subcriptionName ;
@ -87,6 +88,9 @@ public:
virtual int getPrefetchSize() ;
virtual void setPrefetchSize(int prefetchSize) ;
virtual int getMaximumPendingMessageLimit() ;
virtual void setMaximumPendingMessageLimit(int maximumPendingMessageLimit) ;
virtual bool getDispatchAsync() ;
virtual void setDispatchAsync(bool dispatchAsync) ;

View File

@ -60,6 +60,7 @@ void ConsumerInfoMarshaller::unmarshal(OpenWireFormat& wireFormat, Object o, Bin
info.setBrowser(bs.readBoolean());
info.setDestination((ActiveMQDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs));
info.setPrefetchSize(dataIn.readInt());
info.setMaximumPendingMessageLimit(dataIn.readInt());
info.setDispatchAsync(bs.readBoolean());
info.setSelector(tightUnmarshalString(dataIn, bs));
info.setSubcriptionName(tightUnmarshalString(dataIn, bs));
@ -103,7 +104,7 @@ int ConsumerInfoMarshaller::marshal1(OpenWireFormat& wireFormat, Object& o, Bool
rc += marshalObjectArray(wireFormat, info.getBrokerPath(), bs);
bs.writeBoolean(info.isNetworkSubscription());
return rc + 2;
return rc + 3;
}
/*
@ -117,6 +118,7 @@ void ConsumerInfoMarshaller::marshal2(OpenWireFormat& wireFormat, Object& o, Bin
bs.readBoolean();
marshal2CachedObject(wireFormat, info.getDestination(), dataOut, bs);
DataStreamMarshaller.writeInt(info.getPrefetchSize(), dataOut);
DataStreamMarshaller.writeInt(info.getMaximumPendingMessageLimit(), dataOut);
bs.readBoolean();
writeString(info.getSelector(), dataOut, bs);
writeString(info.getSubcriptionName(), dataOut, bs);

View File

@ -0,0 +1,55 @@
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed 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.
*/
using ActiveMQ;
using ActiveMQ.OpenWire;
/// <summary>
/// Exception thrown when the broker returns an error
/// </summary>
namespace ActiveMQ
{
public class BrokerException : OpenWireException
{
private BrokerError brokerError;
public BrokerException(BrokerError brokerError) : base(
brokerError.ExceptionClass + " : " + brokerError.Message)
{
this.brokerError = brokerError;
}
public BrokerError BrokerError
{
get {
return brokerError;
}
}
public virtual string JavaStackTrace
{
get {
return brokerError.StackTrace;
}
}
}
}