Skip to content

Commit

Permalink
Initial code dump
Browse files Browse the repository at this point in the history
  • Loading branch information
kofemann committed Jun 28, 2011
0 parents commit 5bdda33
Show file tree
Hide file tree
Showing 117 changed files with 17,710 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .hg_archival.txt
@@ -0,0 +1,5 @@
repo: 6c0adf39b7e64ad3a567d2248311453c1ca21b3e
node: b77aa7ada26030adbe02da803df359764b5f9a55
branch: default
latesttag: 0.0.3
latesttagdistance: 94
481 changes: 481 additions & 0 deletions License

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions README
@@ -0,0 +1,20 @@
Grizzly-RPC

Motivation
----------

For a couple of years I was successfully using Remote Tea [1] RPC implementation.
The Remote Tea library was implemented for java 1.2. Since then java got NIO and
concurrent utilities. Those features allow to write highly salable RPC applications.
I pick Grizzly[2] NIO framework to not re-implement NIO stack myself. After several
attempts to port Remote Tea to Grizzly I finally decided to write my own RPC server
engine by reusing as much as possible of original Remote Tea code. Technically, this
is not a fork of Remote Tea RPC library, but formally it is as I was inspired by
Remote Tea RPC and took lot of ideas from it including xdr language parser. The
goal to be able to use stubs generated by Remote Tea ( I do not want to rewrite
my RPC server once more ).

References
----------
[1] http://remotetea.sourceforge.net/
[2] https://grizzly.dev.java.net/
1,011 changes: 1,011 additions & 0 deletions docs/rfc1831.txt

Large diffs are not rendered by default.

185 changes: 185 additions & 0 deletions pom.xml
@@ -0,0 +1,185 @@
<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/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<description>
Pure Java implementation of ONC RPC protocol specification
(http://www.ietf.org/rfc/rfc1831.txt)
</description>

<groupId>org.dcache</groupId>
<artifactId>rpc</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Grizzly Based ONC RPC implementation</name>
<packaging>jar</packaging>
<url>http://www.dCache.ORG</url>

<!--
CODE LICENSE
-->
<licenses>
<license>
<name>
GNU Lesser General Public License
</name>
<url>
http://www.fsf.org/licensing/licenses/lgpl.txt
</url>
</license>
</licenses>

<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!--
start java app
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>org.dcache.xdr.SpringRunner</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-4</version>
<executions>
<execution>
<goals>
<goal>attached</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>org.dcache.xdr.SpringRunner</mainClass>
<packageName>org.dcache.rpc</packageName>
<addExtensions />
</manifest>
<manifestEntries>
<mode>development</mode>
<Implementation-Build>${buildNumber}</Implementation-Build>
<url>${project.url}</url>
<Build-Time>${maven.build.timestamp}</Build-Time>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>resources</directory>
<includes>
</includes>
</resource>
</resources>
</build>

<!--
EXTERNAL DEPENDENCIES
-->
<dependencies>
<dependency>
<groupId>com.sun.grizzly</groupId>
<artifactId>grizzly-framework</artifactId>
<version>1.9.19</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>0.9.28</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>r09</version>
</dependency>
<dependency>
<groupId>org.dcache.common</groupId>
<artifactId>dcache-auth</artifactId>
<version>0.0.10-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sun.jna</groupId>
<artifactId>jna</artifactId>
<version>3.0.9</version>
</dependency>
</dependencies>

<!--
MAVEN REPOSITORIES
-->
<repositories>
<!-- Grizzly repository -->
<repository>
<id>download.java.net</id>
<name>Glassfish Repository for Maven</name>
<url>http://download.java.net/maven/glassfish/ </url>
<layout>default</layout>
</repository>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
<repository>
<id>maven2-repository.dcache.org</id>
<name>dCache.ORG Repository for Maven</name>
<url>http://www.dcache.org/nexus/content/groups/public/</url>
<layout>default</layout>
</repository>
<repository>
<id>dcache-snapshots</id>
<name>dCache.ORG snapshots repository</name>
<url>http://www.dcache.org/nexus/content/repositories/snapshots</url>
<layout>default</layout>
</repository>
</repositories>
</project>
12 changes: 12 additions & 0 deletions resources/logback.xml
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<jmxConfigurator />
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %X{mdc.client} %logger{24} - %msg%n</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
</configuration>
164 changes: 164 additions & 0 deletions src/org/acplt/oncrpc/apps/jrpcgen/JrpcgenConst.java
@@ -0,0 +1,164 @@
/*
* $Header: /cvsroot/remotetea/remotetea/src/org/acplt/oncrpc/apps/jrpcgen/JrpcgenConst.java,v 1.1.1.1 2003/08/13 12:03:45 haraldalbrecht Exp $
*
* Copyright (c) 1999, 2000
* Lehrstuhl fuer Prozessleittechnik (PLT), RWTH Aachen
* D-52064 Aachen, Germany.
* All rights reserved.
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this program (see the file COPYING.LIB for more
* details); if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/

package org.acplt.oncrpc.apps.jrpcgen;

/**
* The <code>JrpcgenConst</code> class represents a single constant defined
* in an rpcgen "x"-file.
*
* @version $Revision: 1.1.1.1 $ $Date: 2003/08/13 12:03:45 $ $State: Exp $ $Locker: $
* @author Harald Albrecht
*/
public class JrpcgenConst {

/**
* Constant identifier.
*/
public String identifier;

/**
* Contains value (or identifier refering to another constant) of constant.
*/
public String value;

/**
* Specifies the enclosure (scope) within the identifier must be
* addressed for a constant defined by an enumumeration.
*/
public String enclosure;

/**
* Returns value as integer literal (and thus resolving identifiers
* recursively, if necessary). This is only possible for simple
* subsitutions, that is A is defined as B, B as C, and C as 42, thus
* A is eventually defined as 42.
*
* <p>This simple kind of resolving is necessary when defining a particular
* version of an ONC/RPC protocol. We need to be able to resolve the
* version to an integer literal because we need to append the version
* number to any remote procedure defined to avoid identifier clashes if
* the same remote procedure is defined for several versions.
*
* @return integer literal as <code>String</code> or <code>null</code>,
* if the identifier could not be resolved to an integer literal.
*/
public String resolveValue() {
if ( value.length() > 0 ) {
//
// If the value is an integer literal, then we just have to
// return it. That's it.
//
if ( Character.isDigit(value.charAt(0))
|| (value.charAt(0) == '-') ) {
return value;
}
//
// It's an identifier, which we now have to resolve. First,
// look it up in the list of global identifiers. Then recursively
// resolve the value.
//
Object id = jrpcgen.globalIdentifiers.get(identifier);
if ( (id != null)
&& (id instanceof JrpcgenConst) ) {
return ((JrpcgenConst) id).resolveValue();
}
}
return null;
}

/**
* Constructs a <code>JrpcgenConst</code> and sets the identifier and
* the associated value.
*
* @param identifier Constant identifier to define.
* @param value Value assigned to constant.
*/
public JrpcgenConst(String identifier, String value) {
this(identifier, value, null);
}

/**
* Constructs a <code>JrpcgenConst</code> and sets the identifier and
* the associated value of an enumeration etc.
*
* @param identifier Constant identifier to define.
* @param value Value assigned to constant.
* @param enclosure Name of enclosing enumeration, etc.
*/
public JrpcgenConst(String identifier, String value, String enclosure) {
this.identifier = identifier;
this.value = value;
this.enclosure = enclosure;
}

/**
* Returns the identifier this constant depends on or <code>null</code>,
* if no dependency exists.
*
* @return dependency identifier or <code>null</code>.
*/
public String getDependencyIdentifier() {
int len = value.length();
int idx = 0;
char c;

//
// Check to see if it's an identifier and search for its end.
// This is necessary as elements of an enumeration might have
// "+x" appended, where x is an integer literal.
//
while ( idx < len ) {
c = value.charAt(idx++);
if ( !( ((c >= 'A') && (c <= 'Z'))
|| ((c >= 'a') && (c <= 'z'))
|| (c == '_')
|| ((c >= '0') && (c <= '9') && (idx > 0))
) ) {
--idx; // back up to the char not belonging to the identifier.
break;
}
}
if ( idx > 0 ) {
return value.substring(0, idx);
}
return null;
}

/**
* Dumps the constant as well as its value to <code>System.out</code>.
*/
public void dump() {
System.out.println(identifier + " = " + value);
}

/**
* Flag indicating whether this constant and its dependencies should be
* traversed any more.
*/
public boolean dontTraverseAnyMore = false;

}

// End of JrpcgenConst.java

0 comments on commit 5bdda33

Please sign in to comment.