Skip to content
Permalink
Browse files
Adding first pass of the proto generator
  • Loading branch information
chirino committed Aug 29, 2008
1 parent 34d5969 commit 82b2babeb7f0b73af6a1e49c2af89f1e0ca2517b
Showing 15 changed files with 1,907 additions and 0 deletions.
@@ -0,0 +1,25 @@
=======================================================================
The AcitveMQ Protocol Buffers Java Implementation
=======================================================================

Protocol Buffers is a data interchange format developed by
Google. You can get more information about Protocol Buffers
at:

http://code.google.com/apis/protocolbuffers/


Unfortunately the the main Protocol Buffer's project made the
Java API cumbersome to use since the messages are immutable. They
Justify this decision by highlighting the fact it reduces end user
error that occur with Mutable messages.

This module brings you a slimmed down lean and mean API to accessing
Protocol Buffer data structures. It provides little protection
from end users 'hurting themselves', but it does give power user
and easier to use API.

In addition, this module provides a Java based code generator so
that it's easier to code generate your Protocol Buffer classes in
a java based build system like Ant or Maven.

79 pom.xml
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.activemq.protobuf</groupId>
<artifactId>activemq-protobuf</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>A Simple Protocol Buffer Java API</name>

<description>
A Simpler Protocol Buffer Java API. Comes with a built in proto file compiler and Java source code generator.
</description>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.0.1rc1</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javacc-maven-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<id>javacc</id>
<goals>
<goal>javacc</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
@@ -0,0 +1,57 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.protobuf.compiler;

import java.util.List;
import java.util.Map;

public class EnumDescriptor {

private String name;
private Map<String,EnumFieldDescriptor> fields;
private final ProtoDescriptor protoDescriptor;

public EnumDescriptor(ProtoDescriptor protoDescriptor) {
this.protoDescriptor = protoDescriptor;
}

public String getName() {
return name;
}

public Map<String,EnumFieldDescriptor> getFields() {
return fields;
}

public void setName(String name) {
this.name = name;
}

public void setFields(Map<String,EnumFieldDescriptor> fields) {
this.fields = fields;
}
public ProtoDescriptor getProtoDescriptor() {
return protoDescriptor;
}

public void validate(List<String> errors) {
// TODO Auto-generated method stub

}


}
@@ -0,0 +1,54 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.protobuf.compiler;

public class EnumFieldDescriptor {

private String name;
private int value;
private final ProtoDescriptor protoDescriptor;

public EnumFieldDescriptor(ProtoDescriptor protoDescriptor) {
this.protoDescriptor = protoDescriptor;
}

public void setName(String name) {
this.name = name;
}

public void setValue(int value) {
this.value = value;
}

public String getName() {
return name;
}

public int getValue() {
return value;
}

public ProtoDescriptor getProtoDescriptor() {
return protoDescriptor;
}

public String geName() {
// TODO Auto-generated method stub
return null;
}

}
@@ -0,0 +1,56 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.protobuf.compiler;

import java.util.List;
import java.util.Map;

public class ExtendDescriptor {

private String name;
private Map<String,FieldDescriptor> fields;
private final ProtoDescriptor protoDescriptor;

public ExtendDescriptor(ProtoDescriptor protoDescriptor) {
this.protoDescriptor = protoDescriptor;
}

public void setName(String name) {
this.name = name;
}

public void setFields(Map<String,FieldDescriptor> fields) {
this.fields = fields;
}

public String getName() {
return name;
}

public Map<String,FieldDescriptor> getFields() {
return fields;
}

public ProtoDescriptor getProtoDescriptor() {
return protoDescriptor;
}

public void validate(List<String> errors) {
}


}
@@ -0,0 +1,49 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.protobuf.compiler;

public class ExtensionsDescriptor {

private int first;
private int last;
private final ProtoDescriptor protoDescriptor;

public ExtensionsDescriptor(ProtoDescriptor protoDescriptor) {
this.protoDescriptor = protoDescriptor;
}

public void setFirst(int first) {
this.first = first;
}

public void setLast(int last) {
this.last = last;
}

public int getFirst() {
return first;
}

public int getLast() {
return last;
}

public ProtoDescriptor getProtoDescriptor() {
return protoDescriptor;
}

}

0 comments on commit 82b2bab

Please sign in to comment.