The great invocation services rethink of 2002! Rearchitected the remote
method invocation services and converted everything to the new style. Could this be my biggest checkin ever? git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1642 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
+12
-6
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# $Id: genreceiver,v 1.1 2002/08/11 05:53:13 mdb Exp $
|
||||
# $Id: genreceiver,v 1.2 2002/08/14 19:07:48 mdb Exp $
|
||||
#
|
||||
# This script is used to generate invocation receiver marshaller and
|
||||
# unmarshaller classes based on receiver interface definitions.
|
||||
@@ -10,6 +10,7 @@ use Getopt::Long;
|
||||
use Template;
|
||||
use File::Basename;
|
||||
use POSIX qw(strftime);
|
||||
use MD5;
|
||||
|
||||
# use Dumpvalue;
|
||||
|
||||
@@ -84,14 +85,14 @@ while ($srcfile = shift) {
|
||||
|
||||
open(JPO, "$jpcmd|") or die "$script: Can't invoke '$jpcmd': $!\n";
|
||||
while (<JPO>) {
|
||||
if (/^public interface (\S+) extends (\S+)/) {
|
||||
if (/^public interface (\S+) extends ([^, ]+)/) {
|
||||
$ifcname = $1;
|
||||
$imports{$ifcname} = 1;
|
||||
my $sname = $2;
|
||||
|
||||
# if this interface does not extend InvocationReceiver, we
|
||||
# don't want to do nothin'
|
||||
die "$script: Receiver interface does not extend " .
|
||||
die "$script: $ifcname does not extend " .
|
||||
"InvocationReceiver\n (extends $sname).\n"
|
||||
if ($sname ne $ISVC_CNAME);
|
||||
|
||||
@@ -156,7 +157,8 @@ while ($srcfile = shift) {
|
||||
|
||||
# create a template processor
|
||||
my $ttconfig = {
|
||||
RELATIVE => 1
|
||||
RELATIVE => 1,
|
||||
ABSOLUTE => 1,
|
||||
};
|
||||
my $tt = Template->new($ttconfig);
|
||||
my $genstamp = strftime("%T %D", localtime);
|
||||
@@ -207,7 +209,7 @@ while ($srcfile = shift) {
|
||||
my @dimportsl = sort keys %dimports;
|
||||
my %ddata = ( "imports" => \@dimportsl,
|
||||
"name" => $svcname,
|
||||
"receiver_id" => 0, # TODO: do something here
|
||||
"receiver_code" => MD5->hexhash($ifcname),
|
||||
"package" => $dcdrpkg,
|
||||
"methods" => \@methods,
|
||||
"genstamp" => $genstamp,
|
||||
@@ -232,8 +234,12 @@ sub grab_imports {
|
||||
# skip primitive types
|
||||
next unless ($class =~ m/\./);
|
||||
|
||||
# trim array delimiters
|
||||
my $tclass = $class;
|
||||
$tclass =~ s:[\[\]]::g;
|
||||
|
||||
# stuff the class into our import table
|
||||
$imports{$class} = 1;
|
||||
$imports{$tclass} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-9
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# $Id: genservice,v 1.2 2002/08/11 05:53:29 mdb Exp $
|
||||
# $Id: genservice,v 1.3 2002/08/14 19:07:48 mdb Exp $
|
||||
#
|
||||
# This script is used to generate invocation service marshaller and
|
||||
# unmarshaller classes based on invocation service interface definitions.
|
||||
@@ -87,14 +87,14 @@ while ($srcfile = shift) {
|
||||
|
||||
open(JPO, "$jpcmd|") or die "$script: Can't invoke '$jpcmd': $!\n";
|
||||
while (<JPO>) {
|
||||
if (/^public interface (\S+) extends (\S+)/) {
|
||||
if (/^public interface (\S+) extends ([^, ]+)/) {
|
||||
$ifcname = $1;
|
||||
$imports{$ifcname} = 1;
|
||||
my $sname = $2;
|
||||
|
||||
# if this interface does not extend InvocationService, we
|
||||
# don't want to do nothin'
|
||||
die "$script: Service interface does not extend " .
|
||||
die "$script: $ifcname does not extend " .
|
||||
"InvocationService\n (extends $sname).\n"
|
||||
if ($sname ne $ISVC_CNAME);
|
||||
|
||||
@@ -203,7 +203,8 @@ while ($srcfile = shift) {
|
||||
|
||||
# create a template processor
|
||||
my $ttconfig = {
|
||||
RELATIVE => 1
|
||||
RELATIVE => 1,
|
||||
ABSOLUTE => 1,
|
||||
};
|
||||
my $tt = Template->new($ttconfig);
|
||||
my $genstamp = strftime("%T %D", localtime);
|
||||
@@ -284,16 +285,20 @@ sub grab_imports {
|
||||
# skip primitive types
|
||||
next unless ($class =~ m/\./);
|
||||
|
||||
# trim array delimiters
|
||||
my $tclass = $class;
|
||||
$tclass =~ s:[\[\]]::g;
|
||||
|
||||
# stuff the class into our import table
|
||||
$imports{$class} = 1;
|
||||
$imports{$tclass} = 1;
|
||||
|
||||
# if this class is a listener and not in the same package as the
|
||||
# service class we're currently processing, we need to import its
|
||||
# marshaller as well
|
||||
if ($class =~ m/Listener$/ &&
|
||||
$class !~ m/^$spackage/ &&
|
||||
$class !~ $ISVC_CNAME) {
|
||||
my $mclass = $class;
|
||||
if ($tclass =~ m/Listener$/ &&
|
||||
$tclass !~ m/^$spackage/ &&
|
||||
$tclass !~ $ISVC_CNAME) {
|
||||
my $mclass = $tclass;
|
||||
$mclass =~ s:\.client\.:.data.:g;
|
||||
$mclass =~ s:Listener:Marshaller:g;
|
||||
$mclass =~ s:Service:Marshaller:g;
|
||||
|
||||
Reference in New Issue
Block a user