Commit Graph

3704 Commits

Author SHA1 Message Date
Michael Bayne e292e04e65 More fiddling and improvements to code generation.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4411 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-05 01:33:25 +00:00
Michael Bayne 4c2e242261 More jiggery pokery to create blank TypedArray instances of the proper type
when we encounter the pattern "new SomeClass[0]". Le whee!


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4410 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-05 00:30:32 +00:00
Michael Bayne e4438e4070 We need to notice and observe the @ActionScript(name="foo") annotations when
slurping comments from Java source files.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4408 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-05 00:18:06 +00:00
Michael Bayne 4a9fde7830 Now we have a cool @ActionScript annotation that allows us to specify different
field/method names for the ActionScript version of a class (or to omit
something entirely). This removes the need for special case hackery for
toStringBuilder().

In order for annotations to work, however, we have to require that the
GenActionScriptTask be loaded from the same classloader that loads the classes
to be reflected upon. Before we only reflected on the target classes, never
instantiated them. Annotations are actually instantiated, so we have to be able
to create an instance of the ActionScript.class that is compiled into our
target classes and assign it to a reference that is compiled into
GenActionScriptTask. Beware the complexities of dealing with multiple class
loaders.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4405 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-04 23:35:41 +00:00
Michael Bayne ed51df0807 Add Hashable for classes that override hashCode(); strip out *Codes interfaces
because we can't do that in ActionScript; properly handle static var and
non-static const.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4404 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-04 21:25:16 +00:00
Michael Bayne 874d8eaa8f When generating ActionScript streamable classes, use TypedArray for fields but
Array for static constants and method arguments.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4403 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-04 21:08:12 +00:00
Michael Bayne f4a25e9521 Use TypedArray for array fields when converting a Streamable into ActionScript.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4402 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-04 21:03:05 +00:00
Michael Bayne ad7ac5aa3e Let's wrapp everything in parens.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4400 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-04 19:00:23 +00:00
Michael Bayne 9da0e7a4f3 OMG, it like handles the annoying ActionScript not-so-inner classes.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4399 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-04 18:53:36 +00:00
Michael Bayne 20c0f0ff3d Regenerated with updated Marshaller and Dispatcher templates.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4398 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-04 18:13:34 +00:00
Michael Bayne d25d5e53f1 We're getting very close to having generated ActionScript Service and Listener
interfaces, and Marshallers for same. The remaining snag has to do with the
annoyance of ActionScript not supporting inner classes, which means that
ChatService.TellListener for example has to become ChatService_TellListener.

The code for generating the Java marshaller knows to add an import for
ChatService if some random invocation service interface happens to reference
ChatService.TellListener, but now it needs to be made to know to add an import
for ChatService_TellListener in ActionScript land and it has to do it in a way
that doesn't fuck up the Java code generation. Whee!


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4397 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-04 18:12:56 +00:00
Michael Bayne 8015764c61 Don't look now kids, but it's automatic generation of ActionScript code from
Java. Of course this is a very limited translation facility that is mainly
focused on auto-generating Streamable ActionScript classes from their Java
originals, and it doesn't actually convert method bodies, just field and method
declarations, initial values, and such.

Most of our Streamable classes don't have much in the way of real methods, and
the autogenerator will stick new methods in when they show up on the Java side
so at least we'll *know* that they need to be implemented. And the main thing:
readObject and writeObject are in fact implemented by the code generator so at
least we won't be plagued by annoying streaming errors when we change something
on the Java side and forget to change the ActionScript side.

Next up, auto-generating InvocationService interfaces and InvocationMarshaller
implementations in ActionScript and ActionScript versions of DObjects.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4394 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-04 02:05:15 +00:00
Michael Bayne d7bf98354e Match abstract classes as well.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4393 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-04 02:01:00 +00:00
Michael Bayne 5e55b0b343 Fixed typo.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4392 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-10-04 01:59:57 +00:00
Michael Bayne 48faea2ace All VirtualMachineErrors seem worthy of fork sticking. Also re: my previous
checkin, tihs will be a non-issue when we start devoting an entire separate JVM
to each game (which we will have to do for all games that run server code)
because then all a game can do is stick a fork in its own JVM and render itself
unplayable.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4388 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-29 00:45:58 +00:00
Michael Bayne 57edcd84b6 We have to specifically enumerate the scary errors that we'll let actually
stick a fork in the server otherwise malicious or broken code can generate an
AbstractMethodError or some other error and cause the server to decide to quit.

It may still be possible for malicious code to throw an OutOfMemory error, and
if that's the case then I don't know what we can do to both gracefully get the
fuck out of dodge when things are pear shaped and avoid the wrath of the
kiddies.

Incidentally, it was stupidity, not malice that brought this to my awareness.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4387 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-29 00:41:33 +00:00
Michael Bayne eda71de8d3 Added another method that's booching GG games.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4383 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-27 16:59:38 +00:00
Michael Bayne 8676bb1adc Avoid div0 in rare situation.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4382 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-27 16:54:13 +00:00
Michael Bayne 16689b51d4 We need these for binary compatibility with existing Game Gardens games. We may
need the two argument versions as well, but I'll wait and see.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4378 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-25 05:27:09 +00:00
Ray Greenwell 0709dc9580 Two minor edits to List support.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4376 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-19 01:25:52 +00:00
Michael Bayne afad7dd444 Added support for streaming List and ArrayList natively. A List will be
unmarshalled into an ArrayList on the receiver. Along the way, I improved
support for generic types as arguments to invocation services (which required
one unfortunate "sweeping" warning suppression, but since this is in generated
code, I think we can be sure it won't be doing anything untoward).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4375 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-19 00:31:50 +00:00
Michael Bayne 54d3bb6496 Missed a spot where getStreamer() was called which motivated further changing
around of the interface (I wanted to automatically call getStreamerClass() for
the caller but that turns out not to be possible when unstreaming so fuck it).


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4373 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-12 01:09:01 +00:00
Michael Bayne 13bcdf769d Retidied.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4372 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-12 00:49:49 +00:00
Michael Bayne 65b14cfdb5 Was using the wrong getDeclaringClass() to get an enum's proper class. Things
are now correct, but unfortunately a little more complicated.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4371 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-12 00:47:27 +00:00
Michael Bayne eb3c6ae9cf A particular enum value may actually be a derived class of the declared enum
type, but we don't really want to pollute our class <-> id mapping with a bunch
of extra fiddly enum classes, so we stream all enums as instances of their
declared type and let Enum.valueOf() map back to the custom derived type when
it creates an instance during deserialization.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4370 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-12 00:32:06 +00:00
Michael Bayne ac5951eaa1 Finally incorporated Par's Enum streaming support, modified to use the string
value to avoid future compatibility problems if someone saves an object to a
database and then later adds a new enum anywhere but at the end of the list,
thereby changing the ordinals.

If you want maximal network efficiency, don't use enums. For most of what we'll
do with them, it doesn't merit having the future incompatibility hitch of
sending the ordinal.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4369 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-12 00:04:14 +00:00
Ray Greenwell 5a8b9e14db Lovely varargs, like MessageUtil in samskivert.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4368 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-11 22:16:01 +00:00
Ray Greenwell b596aa724e We don't need to hash, just use an ArrayList.
ObjectInputStream works in conjunction with a ObjectOutputStream on the
other end. The ObjectOutputStream will always assign class codes starting
at 1 and increasing sequentially from there, so we can look up a class
by index rather than hashing.
Uses less memory and is faster.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4365 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-08 18:02:08 +00:00
Michael Bayne 7379cf09db Communicate the client's timezone to the server during the authentication
process and keep that information around in case the server ever wants to know.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4356 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-09-07 01:56:41 +00:00
Ray Greenwell 0149aa3b1d Rollback last commit.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4351 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-30 00:34:07 +00:00
Ray Greenwell a0626f8a3a Pass the authdata returned by the Authenticator into the ClientResolver.
This is actually kind of sketchy, because the resolver can't depend on it
because there are methods to resolve a client object without having an
authenticated connection.
For now, I'll leave this in.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4350 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-30 00:05:22 +00:00
Andrzej Kapolka 83b9ce29d2 I believe this should be null, rather than Object.class; the system was
looking for something assignable from Object (rather than the other 
way around) when the argument was null.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4346 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-25 19:13:04 +00:00
Michael Bayne 6a47c766cc Switched to a better name.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4345 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-24 18:42:22 +00:00
Michael Bayne b4d66588c1 Added some magic on the road toward more elegant support for dynamic languages
like Groovy and JRuby. Created a DynamicEventDispatcher that automatically maps
attribute, element and set events to methods. Say you have a field:

  public DSet occupantInfo;

you can create a method in any class:

  public void occupantInfoAdded (BodyObject source, OccupantInfo entry);

and then bind that class as a listener using the dynamic event dispatcher:

  _myobj.addListener(new DynamicEventDispatcher(object));

I also created a nicer replacement for the MessageHandler system which is
clunky but still way simpler than using a full InvocationService. Basically we
dispatch MessageEvent as if it were a method call. 

For example, in AtlantiManager I define:

    public void placeTile (BodyObject placer, AtlantiTile tile)

which receives a request by a player to place a tile on their turn. Then in
AtlantiController, I simply call:

   _atlobj.manager.invoke("placeTile", tile);

Of course, in JRuby and Groovy, that's going to look like:

   _atlobj.manager.placeTile(tile);

which is all part of the fun.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4344 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-24 17:35:32 +00:00
Michael Bayne bc9f53396c Revamped distributed object creation. There was no particular reason to create
distributed objects by reflection since we don't allow clients to create
objects, furthermore we needn't do it asynchronously. The object creation
methods were moved into the server-side only interface and made "immediate", so
the caller creates a derived instance of DObject and registers it with the
system instead of creating it with a Subscriber callback.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4342 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-23 23:46:48 +00:00
Ray Greenwell d57d213904 Use jdk1.5 notation to do away with the array type prototypes.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4335 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-21 21:50:24 +00:00
Andrzej Kapolka 9607d33093 Suppress warnings in generated code.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4330 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-17 23:39:21 +00:00
Ray Greenwell 1ae508f3aa Removed the pointless InvocationCodes.SUCCESS, moved it to ChatCodes,
which was the only child class that used it.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4328 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-16 18:38:39 +00:00
Ray Greenwell be83e13003 Occam's razor, comment fix.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4326 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-16 00:09:53 +00:00
Michael Bayne f40325fa67 Revamped the way network stats are tracked so that they are all monotonically
increasing integers. Added tracking for connect and disconnect events.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4324 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-15 00:12:42 +00:00
Michael Bayne 1d2c8ae7ac Allow a name to be provided to a persisting unit.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4316 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-10 22:03:06 +00:00
Mike Thomas e8cd7631fd Allow a message to specify the name to display for a user separate from the canonical username passed in the message as the speaker variable.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4313 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-09 22:26:38 +00:00
Michael Bayne e1b68c4cd9 Display the entry first then the set.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4311 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-09 02:47:50 +00:00
Ray Greenwell c9d262bf64 Just print the exception. If it has a message, that will be printed,
otherwise we'll just get the name. I'm killing StringUtil.getMessage().


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4304 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-08 20:06:53 +00:00
Michael Bayne e4d7da7d19 Added getAll().
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4300 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-07 19:04:48 +00:00
Michael Bayne f665a5b2ea Added toString(), moved static methods to top.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4298 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-07 17:25:13 +00:00
Ray Greenwell 52bd679f6c If the normalized version of a name is the same as the raw version, it
may already be the case that the normalize() method returned the same
String, but if not, ensure that we're only holding on to one of those Strings.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4297 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-08-04 23:04:29 +00:00
Mike Thomas 3d7c12a5d1 Allow a little more info in deciding whether to declare the place empty.
Also, while I was in there, added some safety so we don't lose track of shutdownIntervals and let them run amuck.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4295 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-07-28 21:16:37 +00:00
Ray Greenwell 426edf6ad7 Moved some of the standard work done by Authenticators into the base class.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4291 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-07-25 19:02:48 +00:00
Mike Thomas 5b83ee58a0 Call the proper removal function...
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4288 542714f4-19e9-0310-aa3c-eee0fc999fb1
2006-07-24 23:29:43 +00:00