diff --git a/ProjectHome.md b/ProjectHome.md
new file mode 100644
index 0000000..b713212
--- /dev/null
+++ b/ProjectHome.md
@@ -0,0 +1,25 @@
+Open Source Project for Merapi. Merapi allows developers to connect Adobe AIR applications, written in Adobe Flex to Java applications running on the user's local computer.
+
+Founding members
+ * Adam Flater - [blog](http://adamflater.net)
+ * Andrew Powell - [blog](http://infoaccelerator.net)
+ * Dave Meeker - [blog](http://whatanexperience.org)
+
+Helpful links
+ * http://groups.google.com/group/merapi-project Google Message Board / Group]
+ * [Binaries and downloadable docs](http://code.google.com/p/merapi/downloads/list)
+ * [ASDocs](http://merapi.googlecode.com/svn/docs/merapi-core-0.1.8-beta/asdocs/index.html)
+ * [JavaDocs](http://merapi.googlecode.com/svn/docs/merapi-core-0.1.8-beta/javadocs/index.html)
+ * [Merapi Examples Google Code Project](http://code.google.com/p/merapi-examples/)
+
+
+
+[](http://www.gnu.org/copyleft/lesser.html)
+
+Merapi is licensed under [LPGL](http://www.gnu.org/copyleft/lesser.html)
+
+
+
+The Merapi Project is sponsored by [Roundarch](http://www.roundarch.com).
+
+
diff --git a/flex/merapi-core/generate-asdoc.sh b/flex/merapi-core/generate-asdoc.sh
deleted file mode 100755
index 7034629..0000000
--- a/flex/merapi-core/generate-asdoc.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-pwd
-/Applications/Adobe\ Flex\ Builder\ 3\ Plug-in/sdks/3.0.0/bin/aasdoc -doc-sources src -compiler.library-path /Applications/Adobe\ Flex\ Builder\ 3.1\ Plug-in/Adobe\ Flex\ Builder\ 3\ Plug-in/sdks/3.1.0/frameworks/libs /Applications/Adobe\ Flex\ Builder\ 3.1\ Plug-in/Adobe\ Flex\ Builder\ 3\ Plug-in/sdks/3.1.0/frameworks/libs/air --
\ No newline at end of file
diff --git a/flex/merapi-core/lgpl-3.0.txt b/flex/merapi-core/lgpl-3.0.txt
deleted file mode 100644
index cca7fc2..0000000
--- a/flex/merapi-core/lgpl-3.0.txt
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/flex/merapi-core/src/config/merapi-client-config.xml b/flex/merapi-core/src/config/merapi-client-config.xml
deleted file mode 100644
index c621ccd..0000000
--- a/flex/merapi-core/src/config/merapi-client-config.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-localhost
-54321
-false
-merapi.io.amf.AMF3Reader
-merapi.io.amf.AMF3Writer
-
diff --git a/flex/merapi-core/src/connectMerapi.as b/flex/merapi-core/src/connectMerapi.as
deleted file mode 100644
index 85d4713..0000000
--- a/flex/merapi-core/src/connectMerapi.as
+++ /dev/null
@@ -1,29 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package
-{
-import merapi.Bridge;
-
-/**
- * Connects the Merapi client/ui Bridge to the native Bridge.
- */
-public function connectMerapi( port : int = -1, host : String = null ) : void
-{
- Bridge.connect( port, host );
-} // end top level function
-} // end package
\ No newline at end of file
diff --git a/flex/merapi-core/src/disconnectMerapi.as b/flex/merapi-core/src/disconnectMerapi.as
deleted file mode 100644
index 5ecac07..0000000
--- a/flex/merapi-core/src/disconnectMerapi.as
+++ /dev/null
@@ -1,30 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package
-{
-
-import merapi.Bridge;
-
-/**
- * Disconnects the Merapi client/ui Bridge from the native Bridge.
- */
-public function disconnectMerapi() : void
-{
- Bridge.disconnect();
-} // end top level function
-} // end package
\ No newline at end of file
diff --git a/flex/merapi-core/src/manifest.xml b/flex/merapi-core/src/manifest.xml
deleted file mode 100644
index c900552..0000000
--- a/flex/merapi-core/src/manifest.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/flex/merapi-core/src/merapi/Bridge.as b/flex/merapi-core/src/merapi/Bridge.as
deleted file mode 100644
index 82ade43..0000000
--- a/flex/merapi-core/src/merapi/Bridge.as
+++ /dev/null
@@ -1,652 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi
-{
-
-import flash.events.Event;
-import flash.events.IOErrorEvent;
-import flash.events.ProgressEvent;
-import flash.net.Socket;
-import flash.net.URLLoader;
-import flash.net.URLRequest;
-import flash.utils.ByteArray;
-import flash.utils.Dictionary;
-import flash.utils.getDefinitionByName;
-
-import merapi.error.MerapiErrorMessage;
-import merapi.handlers.IMessageHandler;
-import merapi.io.amf.AMF3Reader;
-import merapi.io.amf.AMF3Writer;
-import merapi.io.reader.IReader;
-import merapi.io.writer.IWriter;
-import merapi.messages.IMessage;
-
-import mx.core.Application;
-import mx.rpc.IResponder;
-
-
-/**
- * The Bridge class is a singleton gateway to the native Merapi
- * bridge. IMessages are exchanged between this
- * client/ui Bridge instance and the native Merapi
- * Bridge counter part.
- *
- * @see merapi.handlers.IMessageHandler;
- * @see merapi.handlers.MessageHandler;
- * @see merapi.handlers.mxml.CoreErrorHandler;
- * @see merapi.messages.IMessage;
- * @see merapi.messages.Message;
- */
-public class Bridge
-{
- //--------------------------------------------------------------------------
- //
- // Constants
- //
- //--------------------------------------------------------------------------
-
- //--------------------------
- // String literals
- //--------------------------
-
- private static const AUTO_CONNECT_STR : String = "autoConnect";
- private static const CLOSING : String = "closing";
- private static const EMPTY : String = "";
- private static const HOSTNAME : String = "hostname";
- private static const PORT_STR : String = "port";
- private static const READER : String = "reader";
- private static const TRUE : String = "true";
- private static const UID : String = "uid";
- private static const WRITER : String = "writer";
-
-
- //--------------------------------------------------------------------------
- //
- // Static properties
- //
- //--------------------------------------------------------------------------
-
- //----------------------------------
- // PORT
- //----------------------------------
-
- /**
- * The port used to connect Merapi.
- *
- * (Configureable via merapi-client-config.xml)
- */
- public static var PORT : int = 12345;
-
- //----------------------------------
- // HOST
- //----------------------------------
-
- /**
- * The host used to connect Merapi
- *
- * (Configureable via merapi-client-config.xml)
- */
- public static var HOST : String = "127.0.0.1";
-
- //----------------------------------
- // READER_CLASS
- //----------------------------------
-
- /**
- * The IReader class to use for serialization
- *
- * (Configureable via merapi-client-config.xml)
- */
- public static var READER_CLASS : Class = AMF3Reader;
-
- //----------------------------------
- // WRITER_CLASS
- //----------------------------------
-
- /**
- * The IWriter class to use for deserialization
- *
- * (Configureable via merapi-client-config.xml)
- */
- public static var WRITER_CLASS : Class = AMF3Writer;
-
- //----------------------------------
- // CONFIG_PATH
- //----------------------------------
-
- /**
- * The path to the Merapi config xml
- */
- public static var CONFIG_PATH : String = "config/merapi-client-config.xml";
-
- //----------------------------------
- // AUTO_CONNECT
- //----------------------------------
-
- /**
- * If true, the bridge will automatically connect on the first reference of the
- * instance. Bridge.connect() or the top level function connectMerapi
- * may be invoked before the first reference of instance. In this case, AUTO_CONNECT
- * is ignored. The default value is true.
- */
- public static var AUTO_CONNECT : Boolean = true;
-
- //----------------------------------
- // CONNECTED
- //----------------------------------
-
- public static function get CONNECTED() : Boolean
- {
- return __instance != null &&
- __instance.__client != null &&
- __instance.__client.connected == true;
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Static methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Static code block that loads the Merapi config
- */
- {
- readConfig();
- }
-
- /**
- * The singleton instance of Bridge.
- */
- public static function getInstance() : Bridge
- {
- if ( __instance == null )
- {
- __instance = new Bridge( new Bridge_SingletonBlocker );
- }
- return __instance;
- }
-
- /**
- * Connects the Merapi Bridge. (If the Bridge is not connected.)
- */
- public static function connect( port : int = -1, host : String = null ) : void
- {
- if ( Bridge.CONNECTED == false )
- {
- if ( port == -1 ) port = PORT;
- if ( host == null ) host = HOST;
-
- if ( __instance.__client != null )
- {
- __instance.__client.removeEventListener( IOErrorEvent.IO_ERROR,
- __instance.handleIOError );
- }
-
- try
- {
- __instance.__client = new Socket( host, port );
- __instance.__client.addEventListener( IOErrorEvent.IO_ERROR,
- __instance.handleIOError );
-
- __instance.__client.addEventListener( ProgressEvent.SOCKET_DATA,
- __instance.handleReceiveSocketData );
- }
- catch ( error : Error )
- {
- __instance.dispatchMessage( new MerapiErrorMessage( MerapiErrorMessage.CONNECT_FAILURE_ERROR ) );
- }
- }
- }
-
- /**
- * Disconnects the Merapi Bridge.
- */
- public static function disconnect() : void
- {
- try
- {
- getInstance().__client.close();
- }
- catch ( error : Error )
- {
- // error closing the bridge
- }
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Static variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- *
- * Holds the single instance of the Bridge
- */
- private static var __instance : Bridge = null;
-
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- */
- public function Bridge( blocker : Bridge_SingletonBlocker )
- {
- super();
-
- __handlers = new Dictionary();
-
- // Try to initialize the __reader and __writer
- try
- {
- __reader = new READER_CLASS;
- __writer = new WRITER_CLASS;
- }
- catch( error : Error )
- {
- trace( error );
- return;
- }
-
- __respondersMap = new Dictionary();
-
- // Listens for the Event.CLOSING event of application and disconnect the
- // socket if this event is dispatched. (Although this library does not
- // reference the AIR APIs directly, Event.CLOSING is only thrown by a
- // WindowedApplication. Alternate Application instance will not dipatch
- // this Event and therefore will not close tidly.)
- Application.application.addEventListener( CLOSING, handleApplicationClose,
- false, 0, true );
- }
-
- /**
- * @protected
- *
- * Reads the in the CONIFG_PATH location.
- */
- protected static function readConfig() : void
- {
- var loader : URLLoader = new URLLoader();
- loader.addEventListener( IOErrorEvent.IO_ERROR, function( event : Event ) : void {} );
- loader.addEventListener( Event.COMPLETE, handleConfigLoadComplete );
- loader.load( new URLRequest( CONFIG_PATH ) );
- }
-
- /**
- * @protected
- *
- * Event handler; responds to the complete event of the config loader.
- */
- protected static function handleConfigLoadComplete( e : Event ) : void
- {
- try
- {
- var loader : URLLoader = e.target as URLLoader;
- var xml : XML = new XML( loader.data as String );
-
- if ( isEmptyAttribute( xml.entry, PORT_STR ) == false )
- {
- Bridge.PORT = int( xml.entry.( @key == PORT_STR ).toString() );
- }
-
- if ( isEmptyAttribute( xml.entry, HOSTNAME ) == false )
- {
- Bridge.HOST = xml.entry.( @key == HOSTNAME ).toString();
- }
-
- if ( isEmptyAttribute( xml.entry, AUTO_CONNECT_STR ) == false )
- {
- Bridge.AUTO_CONNECT = xml.entry.( @key == AUTO_CONNECT_STR ).toString() == TRUE;
- }
-
- if ( isEmptyAttribute( xml.entry, READER ) == false )
- {
- var readerClassName : String = xml.entry.( @key == READER ).toString();
- Bridge.READER_CLASS = getDefinitionByName( readerClassName ) as Class;
- }
-
- if ( isEmptyAttribute( xml.entry, WRITER ) == false )
- {
- var writerClassName : String = xml.entry.( @key == WRITER ).toString();
- Bridge.WRITER_CLASS = getDefinitionByName( writerClassName ) as Class;
- }
- }
- catch ( error : Error )
- {
- trace( error );
- }
- }
-
- /**
- * @protected
- *
- * XML helper function
- */
- protected static function isEmptyAttribute( xmlList : XMLList, key : String ) : Boolean
- {
- return xmlList.( @key == key ).toString() == EMPTY;
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Sends a message to the java Merapi bridge.
- */
- public function sendMessage( message : IMessage, responder : IResponder = null ) : void
- {
- if ( Bridge.CONNECTED == false && AUTO_CONNECT == true ) connect();
-
- if ( responder != null && message[ UID ] != null )
- {
- __respondersMap[ message[ UID ] ] = responder;
- }
-
- // Try to serialize the message using __writer.
- try
- {
- var bytes : ByteArray = __writer.write( message );
- }
-
- // If an error is caught, dispatch the MerapiErrorEvent.SERIALIZATION_ERROR event.
- catch( error : Error )
- {
- dispatchMessage( new MerapiErrorMessage( MerapiErrorMessage.SERIALIZE_ERROR, message ) );
- }
-
- // Write the message on the socket and flush the packets.
- try
- {
- __client.writeBytes( bytes );
- __client.flush();
- }
-
- // If there is an error dispatch the MerapiErrorMessage.SERIALIZE_ERROR message
- catch ( error : Error )
- {
- dispatchMessage( new MerapiErrorMessage( MerapiErrorMessage.SERIALIZE_ERROR, message ) );
- }
- }
-
- /**
- * @private
- *
- * Event handler; responds to Event.CLOSING when dispatched by the application. Closes the
- * socket when this event has been dispatched.
- */
- private function handleApplicationClose( e : Event ) : void
- {
- if ( Bridge.CONNECTED == true )
- {
- try
- {
- Bridge.disconnect();
- }
- catch ( error : Error )
- {
- // Ignore any errors.. the application is closing.
- }
- }
- }
-
- /**
- * @private
- *
- * Event handler; Responds to IOErrorEvents from the __client socket.
- */
- private function handleIOError( event : IOErrorEvent ) : void
- {
- __client = null;
-
- dispatchMessage( new MerapiErrorMessage( MerapiErrorMessage.CONNECT_FAILURE_ERROR ) );
- }
-
- /**
- * @private
- *
- * Event handler; Responds to data sent by the java bridge.
- */
- private function handleReceiveSocketData( event : ProgressEvent ) : void
- {
- // The first byte sent by the native side of the bridge is the total
- // packet size. This value is persisted and reset to -1 when a set
- // of messages have been read successfully.
- if ( __totalBytes == -1 )
- {
- __totalBytes = __client.readByte();
- }
-
- // A buffer __byteBuffer is used to read the bytes.
- if ( __byteBuffer == null )
- {
- __byteBuffer = new ByteArray();
- }
-
- // If __byteBuffer is not null, the read bytes are appended to __byteBuffer
- // and the position on the buffer is set to 0
- else
- {
- __byteBuffer.position = 0;
- }
-
- // Read the bytes from the socket
- __client.readBytes( __byteBuffer, __byteBuffer.length,
- __client.bytesAvailable );
-
- // If __byteBuffer.length is less than __totalBytes, that means there are more
- // bytes to be read. (This will happen in the next frame in the case of large
- // amounts of data sent across the bridge.)
- if ( __byteBuffer.length < __totalBytes ) return;
-
- try
- {
- // An array of 1 or more decoded messages. (Decoded by __reader)
- var messages : Array = __reader.read( __byteBuffer ).reverse();
-
- // A local var of the message currently being dispatched.
- var message : IMessage = messages.pop() as IMessage;
-
- // While there are items in the array messages, dispatch the messages to
- // registered IMessageHandlers. If any IResponders were registerd with
- // the call, their result methods are invoked as well.
- while ( message != null )
- {
- try
- {
- // Check in __respondersMaps to see if an IResponder has been
- // registered for this message. (Mapped by Message.uid.) Notify
- // the IResponder by invoking the result method.
- if ( __respondersMap[ message[ UID ] ] != null )
- {
- var responder : IResponder =
- __respondersMap[ message[ UID ] ] as IResponder
-
- responder.result( message );
-
- __respondersMap[ message[ UID ] ] = null;
- }
- }
- catch ( error : Error ) {}
-
- // Dispatchs the message to registered IMessageHandlers
- dispatchMessage( message );
-
- // Get the next message in messages
- message = messages.pop() as IMessage
- }
-
- // When all messages have been processed, reset __totalBytes to -1
- // to prepare for the next packet of binary data
- __totalBytes = -1;
- __byteBuffer = null;
- }
-
- // Catch any errors in deserialization.
- catch( e : Error )
- {
- dispatchMessage( new MerapiErrorMessage( MerapiErrorMessage.DESERIALIZE_ERROR ) );
- }
- }
-
- /**
- * Registers an IMessageHandler to receive notifications when a certain
- * message type is dispatched.
- */
- public function registerMessageHandler( type : String, handler : IMessageHandler ) : void
- {
- // Get the list of handlers registered for the event type
- var list : Array = __handlers[ type ] as Array;
-
- // If the list is null, create a new list to add 'handler' to
- if ( list == null )
- {
- list = [];
- __handlers[ type ] = list;
- }
-
- // Add the handler to the list
- list.push( handler );
- }
-
- /**
- * Unregisters a given handler.
- */
- public function unRegisterMessageHandler( type : String, handler : IMessageHandler ) : void
- {
- // Get the list of handlers registered for the event type
- var list : Array = __handlers[ type ] as Array;
-
- // If the list is not null and not empty, look for handler in the list and remove it
- // if a match is found
- if ( list != null && list.length > 0 )
- {
- var activeHandler : IMessageHandler = null;
- for ( var idx : int = 0; idx < list.length; idx++ )
- {
- activeHandler = list[ idx ] as IMessageHandler;
-
- if ( activeHandler == handler )
- {
- list[ idx ] = null;
- }
- }
- }
- }
-
- /**
- * Dispatches an IMessage to registered listeners.
- */
- public function dispatchMessage( message : IMessage ) : void
- {
- // Get the list of handlers registered for the event type
- var list : Array = __handlers[ message.type ] as Array;
-
- // If the list is not null and not empty notify the registered event handlers
- if ( list != null && list.length > 0 )
- {
- for each ( var handler : IMessageHandler in list )
- {
- if ( handler != null )
- {
- handler.handleMessage( message );
- }
- }
- }
- }
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- *
- * The client socket that connects to the java Merapi bridge.
- */
- private var __client : Socket = null;
-
- /**
- * @private
- *
- * The IReader used to deserialize data that comes across the bridge from Java.
- */
- private var __reader : IReader = null;
-
- /**
- * @private
- *
- * The IWriter used to serialize data sent across the bridge to Java.
- */
- private var __writer : IWriter = null;
-
- /**
- * @private
- *
- * A buffer used to batch up fragmented messages
- */
- private var __byteBuffer : ByteArray = null;
-
- /**
- * @private
- *
- * A map of responders keyed by Message uid. Used to callback
- * from a successful response.
- */
- private var __respondersMap : Dictionary = null;
-
-
- /**
- * @private
- *
- * The total number of bytes in the current packet being transmitted.
- */
- private var __totalBytes : int = -1;
-
- /**
- * @private
- *
- * A dictionary of message handlers
- */
- private var __handlers : Dictionary = null;
-
-
-} // end class
-} // end package
-
-
-/**
- * The Bridge_SingletonBlocker class is a private inner class
- * used to block the instantiation of Bridge from outside of
- * the Bridge class.
- */
-class Bridge_SingletonBlocker {}
diff --git a/flex/merapi-core/src/merapi/error/MerapiErrorMessage.as b/flex/merapi-core/src/merapi/error/MerapiErrorMessage.as
deleted file mode 100644
index 684e4bf..0000000
--- a/flex/merapi-core/src/merapi/error/MerapiErrorMessage.as
+++ /dev/null
@@ -1,135 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.error
-{
-import flash.utils.Dictionary;
-
-import merapi.messages.IMessage;
-import merapi.messages.Message;
-
-/**
- * The MerapiErrorMessage class is a sub class of Message
- * that is used to communicate error messages from the Bridge.
- *
- * @see merapi.Bridge
- * @see merapi.handlers.mxml.CoreErrorHandler
- * @see merapi.handlers.IMessageHandler
- * @see merapi.handlers.MessageHandler
- * @see merapi.messages.Message
- * @see merapi.messages.IMessage
- */
-public class MerapiErrorMessage extends Message
-{
-
- //--------------------------------------------------------------------------
- //
- // Constants
- //
- //--------------------------------------------------------------------------
-
- /**
- * Event type for a serialization error.
- */
- public static const SERIALIZE_ERROR : String = "serializeError";
-
- /**
- * Event type for a deserialization error.
- */
- public static const DESERIALIZE_ERROR : String = "deserializeError";
-
- /**
- * Event type for a connect failure error.
- */
- public static const CONNECT_FAILURE_ERROR : String = "connectFailureError";
-
- /**
- * Event type for an initialization error.
- */
- public static const INITIALIZATION_ERROR : String = "initializationError";
-
- /**
- * @private
- *
- * A map of event types -> error messages
- */
- private static const ERROR_MESAGES : Dictionary = new Dictionary();
-
- {
- ERROR_MESAGES[ SERIALIZE_ERROR ] = "Merapi falied to serialize a "+
- "message object using the "+
- "specified IWriter class."
- ERROR_MESAGES[ DESERIALIZE_ERROR ] = "Merapi falied to deserialize "+
- "message data the specified "+
- "IReader class."
- ERROR_MESAGES[ CONNECT_FAILURE_ERROR ] = "Merapi falied to connect to "+
- "the java side of the bridge.";
- ERROR_MESAGES[ INITIALIZATION_ERROR ] = "Merapi falied to initialize the "+
- "specified IWriter or IReader.";
- }
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- */
- public function MerapiErrorMessage( type : String = null, message : IMessage = null ) : void
- {
- super( type );
-
- this.message = message;
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
-
- //----------------------------------
- // message
- //----------------------------------
-
- /**
- * The message that failed to be seriliazed, in the case of a SERIALIZE_ERROR or
- * DESERIALIZE_ERROR.
- */
- public var message : IMessage = null;
-
- //----------------------------------
- // type
- //----------------------------------
-
- /**
- * @override
- *
- * Updates the value of data with the matching error message based
- * on the message type.
- */
- override public function set type( val : String ) : void
- {
- super.type = val;
- data = ERROR_MESAGES[ type ].toString();
- }
-
-} // end clas
-} // end package
\ No newline at end of file
diff --git a/flex/merapi-core/src/merapi/handlers/IMessageHandler.as b/flex/merapi-core/src/merapi/handlers/IMessageHandler.as
deleted file mode 100644
index 788b5eb..0000000
--- a/flex/merapi-core/src/merapi/handlers/IMessageHandler.as
+++ /dev/null
@@ -1,46 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.handlers
-{
-
-import merapi.messages.IMessage;
-
-/**
- * The IMessageHandler interface defines the methods for receiving a
- * Message from the Bridge.
- *
- * @see merapi.Bridge
- * @see merapi.handlers.MessageHandler
- * @see merapi.messages.IMessage
- * @see merapi.messages.Message
- */
-public interface IMessageHandler
-{
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Handles an IMessage dispatched from the Bridge.
- */
- function handleMessage( message : IMessage ) : void
-
-} // end class
-} // end package
\ No newline at end of file
diff --git a/flex/merapi-core/src/merapi/handlers/MessageHandler.as b/flex/merapi-core/src/merapi/handlers/MessageHandler.as
deleted file mode 100644
index 0cc3486..0000000
--- a/flex/merapi-core/src/merapi/handlers/MessageHandler.as
+++ /dev/null
@@ -1,85 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.handlers
-{
-
-import merapi.Bridge;
-import merapi.messages.IMessage;
-
-
-/**
- * The IEventHandler interface defines the methods for receiving a
- * Message from the Bridge.
- *
- * @see merapi.Bridge
- * @see merapi.handlers.IMessageHandler
- * @see merapi.messages.IMessage
- * @see merapi.messages.Message
- */
-public class MessageHandler implements IMessageHandler
-{
- //--------------------------------------------------------------------------
- //
- // Constructors
- //
- //--------------------------------------------------------------------------
-
- /**
- * Automatically registers the handler for message type type.
- *
- * @param type The type of message to handle.
- */
- public function MessageHandler( type : String = null ) : void
- {
- if ( type != null )
- {
- addMessageType( type );
- }
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Handles an IMessage dispatched from the Bridge. This method should
- * be overridden by MessageHandler sub class definitions.
- */
- public function handleMessage( message : IMessage ) : void {}
-
- /**
- * Adds another message type to be listend for by this instance of MessageHandler.
- */
- public function addMessageType( type : String ) : void
- {
- Bridge.getInstance().registerMessageHandler( type, this );
- }
-
- /**
- * Removes the handling of message type type.
- */
- public function removeMessageType( type : String ) : void
- {
- Bridge.getInstance().unRegisterMessageHandler( type, this );
- }
-
-} // end class
-} // end package
\ No newline at end of file
diff --git a/flex/merapi-core/src/merapi/handlers/mxml/CoreErrorHandler.as b/flex/merapi-core/src/merapi/handlers/mxml/CoreErrorHandler.as
deleted file mode 100644
index 6068159..0000000
--- a/flex/merapi-core/src/merapi/handlers/mxml/CoreErrorHandler.as
+++ /dev/null
@@ -1,94 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.handlers.mxml
-{
-
-import merapi.error.MerapiErrorMessage;
-
-import mx.rpc.events.ResultEvent;
-
-//--------------------------------------
-// Events
-//--------------------------------------
-
-/**
- * The result of the event being listned for.
- *
- * @type mx.rpc.events.ResultEvent.RESULT
- */
-[Event( name="result", type="mx.rpc.events.ResultEvent" )]
-
-/**
- * A result event that signals a connectFailureError
- *
- * @type merapi.error.MerapiErrorMessage.CONNECT_FAILURE_ERROR
- */
-[Event( name="connectFailureError", type="mx.rpc.events.ResultEvent" )]
-
-/**
- * A result event that signals a deserializeError
- *
- * @type merapi.error.MerapiErrorMessage.DESERIALIZE_ERROR
- */
-[Event( name="deserializeError", type="mx.rpc.events.ResultEvent" )]
-
-/**
- * A result event that signals a serializeError
- *
- * @type merapi.error.MerapiErrorMessage.SERIALIZE_ERROR
- */
-[Event( name="serializeError", type="mx.rpc.events.ResultEvent" )]
-
-
-[Bindable]
-/**
- * CoreErrorHandler is a Flex-centric implementation of IMessageHandler that
- * reports the core Merapi error messages.
- *
- * The CoreErrorHandler class is intended for declaration in MXML.
- *
- * @see merapi.messages.IMessage;
- * @see merapi.messages.Message;
- * @see merapi.handlers.IMessageHandler;
- * @see merapi.handlers.MessageHandler;
- * @see merapi.handlers.mxml.MessageHandler;
- */
-public class CoreErrorHandler extends MessageHandler
-{
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- */
- public function CoreErrorHandler( type : String = null )
- {
- super( type );
-
- super.types = [ MerapiErrorMessage.CONNECT_FAILURE_ERROR,
- MerapiErrorMessage.DESERIALIZE_ERROR,
- MerapiErrorMessage.SERIALIZE_ERROR ];
- }
-
-
-} // end class
-} // end package
-
diff --git a/flex/merapi-core/src/merapi/handlers/mxml/MessageHandler.as b/flex/merapi-core/src/merapi/handlers/mxml/MessageHandler.as
deleted file mode 100644
index 7ea4793..0000000
--- a/flex/merapi-core/src/merapi/handlers/mxml/MessageHandler.as
+++ /dev/null
@@ -1,214 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.handlers.mxml
-{
-
-import flash.events.EventDispatcher;
-
-import merapi.Bridge;
-import merapi.handlers.IMessageHandler;
-import merapi.messages.IMessage;
-import merapi.messages.Message;
-
-import mx.rpc.events.ResultEvent;
-
-//--------------------------------------
-// Events
-//--------------------------------------
-
-/**
- * The result of the event being listned for.
- *
- * @type mx.rpc.events.ResultEvent.RESULT
- */
-[Event(name="result", type="mx.rpc.events.ResultEvent")]
-
-[Bindable]
-/**
- * MessageHandler is a Flex-centric implementation of IMessageHandler to enable
- * features like binding and the Flex event model.
- *
- * The MessageListener class listens for and responds to a given Merapi Message
- * type (or types). The last message to be returned is stored in the lastMessage
- * property and it's data value is stored in the data property. dataField
- * can be used to dynamically set what property from the Message to use to assign the
- * value of data. The default value for dataField is "data".
- *
- * The MessageListener class is intended for declaration in MXML.
- *
- * @see merapi.messages.IMessage;
- * @see merapi.messages.Message;
- * @see merapi.handlers.IMessageHandler;
- * @see merapi.handlers.MessageHandler;
- */
-public class MessageHandler extends EventDispatcher implements IMessageHandler
-{
- //--------------------------------------------------------------------------
- //
- // Static Properties
- //
- //--------------------------------------------------------------------------
-
- //----------------------------------
- // bridge
- //----------------------------------
-
- private static var bridge : Bridge = Bridge.getInstance();
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- */
- public function MessageHandler( type : String = null )
- {
- this.type = type;
- super();
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
-
- /**
- * The last message recieved by this MessageListener instance
- */
- public var lastMessage : IMessage = null;
-
- /**
- * The last data value that was part of the last Merapi Message
- */
- public var data : Object = null;
-
- /**
- * The name of the property from the last message to use as the setter
- * for the value of data
- */
- public var dataField : String = "data";
-
- /**
- * The message type to listen for
- */
- public function get type() : String { return __type; }
- public function set type( type : String ) : void
- {
- if ( __type != null )
- {
- bridge.unRegisterMessageHandler( __type, this );
- }
-
- __type = type;
-
- if ( __type != null )
- {
- bridge.registerMessageHandler( __type, this );
- }
- }
-
- /**
- * The message types to listen for
- */
- public function get types() : Object { return __types; }
- public function set types( types : Object ) : void
- {
- var type : String = null;
-
- if ( __types != null )
- {
- for each ( type in __types )
- {
- bridge.unRegisterMessageHandler( type, this );
- }
- }
-
- if ( types is Array )
- {
- __types = types as Array;
- }
- else if ( types is String )
- {
- __types = ( types as String ).split( "," )
- }
-
- if ( __types != null )
- {
- for each ( type in __types )
- {
- bridge.registerMessageHandler( type, this );
- }
- }
- }
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Event handler; reponds to the ResultEvent for the Message type registered
- * in the type property.
- */
- public function handleMessage( message : IMessage ) : void
- {
- dispatchEvent( new ResultEvent( ResultEvent.RESULT, false, true, message ) );
- dispatchEvent( new ResultEvent( message.type, false, true, message ) );
-
- if ( message is Message ) lastMessage = message as Message;
- else lastMessage = message;
-
- try
- {
- if ( dataField.indexOf( "." ) == -1 )
- {
- data = lastMessage[ dataField ];
- }
- else
- {
- var df : String = null;
- var ref : Object = lastMessage;
- var fields : Array = dataField.split( "." );
- for each ( df in fields )
- {
- ref = ref[ df ];
- }
- data = ref;
- }
- }
- catch( e : Error ) {}
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- private var __type : String = null;
- private var __types : Array = null;
-
-} // end class
-} // end package
\ No newline at end of file
diff --git a/flex/merapi-core/src/merapi/io/amf/AMF3Reader.as b/flex/merapi-core/src/merapi/io/amf/AMF3Reader.as
deleted file mode 100644
index 5b0c52c..0000000
--- a/flex/merapi-core/src/merapi/io/amf/AMF3Reader.as
+++ /dev/null
@@ -1,83 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.io.amf
-{
-
-import flash.utils.ByteArray;
-
-import merapi.io.reader.IReader;
-
-
-/**
- * The AMF3Reader class deserializes AMF 3 encoded binary data into an
- * IMessage.
- *
- * @see merapi.io.reader.IReader;
- */
-public class AMF3Reader implements IReader
-{
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- */
- public function AMF3Reader()
- {
- super();
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Reads binary data serialized using the as AMF 3 protocol and deserializes
- * it into a set of IMessage instances.
- */
- public function read( bytes : ByteArray ) : Array
- {
- var message : Object = bytes.readObject();
- var messages : Array = [];
-
- while ( message != null )
- {
- messages.push( message );
- try
- {
- message = bytes.readObject();
- }
- catch ( error : Error )
- {
- message = null;
- return messages;
- }
- }
-
- return messages;
- }
-
-} // end class
-} // end package
\ No newline at end of file
diff --git a/flex/merapi-core/src/merapi/io/amf/AMF3Writer.as b/flex/merapi-core/src/merapi/io/amf/AMF3Writer.as
deleted file mode 100644
index f323468..0000000
--- a/flex/merapi-core/src/merapi/io/amf/AMF3Writer.as
+++ /dev/null
@@ -1,73 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.io.amf
-{
-
-import flash.utils.ByteArray;
-
-import merapi.io.writer.IWriter;
-import merapi.messages.IMessage;
-
-import mx.utils.ObjectUtil;
-
-
-
-/**
- * The AMF3Reader class serializes an IMessage into AMF 3 encoded
- * binary data.
- *
- * @see merapi.io.reader.IWriter;
- */
-public class AMF3Writer implements IWriter
-{
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- */
- public function AMF3Writer()
- {
- super();
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Serializes message using flash.utils.ByteArray and
- * returns the binary data.
- */
- public function write( message : IMessage ) : ByteArray
- {
- var bytes : ByteArray = new ByteArray();
- bytes.writeObject( message );
-
- return bytes;
- }
-
-} // end class
-} // end package
diff --git a/flex/merapi-core/src/merapi/io/reader/IReader.as b/flex/merapi-core/src/merapi/io/reader/IReader.as
deleted file mode 100644
index b5294dd..0000000
--- a/flex/merapi-core/src/merapi/io/reader/IReader.as
+++ /dev/null
@@ -1,49 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.io.reader
-{
-
-import flash.utils.ByteArray;
-
-
-/**
- * The IReader interface describes a class for reading binary data from the Merapi
- * bridge.
- *
- * @see merapi.Bridge
- * @see merapi.io.AMF3Reader
- * @see merapi.messages.IMessage
- */
-public interface IReader
-{
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Deserializes the binary data bytes and returns a the data as a
- * set of IMessage instances.
- */
- function read( bytes : ByteArray ) : Array;
-
-
-} // end interface
-} // end package
diff --git a/flex/merapi-core/src/merapi/io/writer/IWriter.as b/flex/merapi-core/src/merapi/io/writer/IWriter.as
deleted file mode 100644
index 0e25648..0000000
--- a/flex/merapi-core/src/merapi/io/writer/IWriter.as
+++ /dev/null
@@ -1,47 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.io.writer
-{
-
-import flash.utils.ByteArray;
-
-import merapi.messages.IMessage;
-
-
-/**
- * The IWriter interface describes a class for reading binary data sent
- * from the Merapi bridge.
- *
- * @see merapi.Bridge;
- * @see merapi.io.AMF3Writer;
- */
-public interface IWriter
-{
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Serializes the message and returns the data as a ByteArray.
- */
- function write( data : IMessage ) : ByteArray;
-
-} // end interface
-} // end package
diff --git a/flex/merapi-core/src/merapi/messages/IMessage.as b/flex/merapi-core/src/merapi/messages/IMessage.as
deleted file mode 100644
index e41644b..0000000
--- a/flex/merapi-core/src/merapi/messages/IMessage.as
+++ /dev/null
@@ -1,61 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.messages
-{
-
-[Bindable]
-/**
- * The IMessage interface describes a 'message' sent by the Merapi bridge.
- *
- * @see merapi.Bridge;
- * @see merapi.handlers.IMessageHandler;
- * @see merapi.handlers.MessageHandler;
- * @see merapi.messages.Message;
- */
-public interface IMessage
-{
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
-
- //----------------------------------
- // type
- //----------------------------------
-
- /**
- * The message type.
- */
- function get type() : String;
- function set type( val : String ) : void;
-
- //----------------------------------
- // data
- //----------------------------------
-
- /**
- * A generic data property.
- */
- function get data() : Object;
- function set data( val : Object ) : void;
-
-
-} // end interface
-} // end package
\ No newline at end of file
diff --git a/flex/merapi-core/src/merapi/messages/Message.as b/flex/merapi-core/src/merapi/messages/Message.as
deleted file mode 100644
index 828b93c..0000000
--- a/flex/merapi-core/src/merapi/messages/Message.as
+++ /dev/null
@@ -1,131 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.messages
-{
-
-import merapi.Bridge;
-
-import mx.rpc.IResponder;
-import mx.utils.UIDUtil;
-
-
-[Bindable]
-[RemoteClass( alias="merapi.messages.Message" )]
-/**
- * The Message class implements IMessage, a 'message' sent from the Merapi
- * UI layer.
- *
- * @see merapi.Bridge;
- * @see merapi.handlers.IMessageHandler;
- * @see merapi.messages.IMessage;
- */
-public class Message implements IMessage
-{
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- */
- public function Message( type : String = null, data : Object = null ) : void
- {
- super();
-
- this.type = type;
- this.data = data;
- this.uid = UIDUtil.createUID();
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
-
- //----------------------------------
- // uid
- //----------------------------------
-
- /**
- * A unique ID for the message.
- */
- public var uid : String = null;
-
- //----------------------------------
- // type
- //----------------------------------
-
- /**
- * The type of the message.
- */
- public function get type() : String { return __type };
- public function set type( val : String ) : void { __type = val; };
-
- //----------------------------------
- // data
- //----------------------------------
-
- /**
- * The data carried by this message.
- */
- public function get data() : Object { return __data };
- public function set data( val : Object ) : void { __data = val };
-
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Redirects toString to the data property
- */
- public function toString() : String
- {
- return data.toString();
- }
-
- /**
- * Sends the event across the Merapi bridge.
- */
- public function send( responder : IResponder = null ) : void
- {
- Bridge.getInstance().sendMessage( this, responder );
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * Used by the getters/setters.
- */
- private var __type : String = null;
- private var __data : Object = null;
-
-
-} // end class
-} // end package
\ No newline at end of file
diff --git a/flex/merapi-core/src/merapi/systemexecute/messages/SystemExecuteMessage.as b/flex/merapi-core/src/merapi/systemexecute/messages/SystemExecuteMessage.as
deleted file mode 100644
index b031bc6..0000000
--- a/flex/merapi-core/src/merapi/systemexecute/messages/SystemExecuteMessage.as
+++ /dev/null
@@ -1,82 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.systemexecute.messages
-{
-import merapi.messages.Message;
-
-
-[Bindable]
-[RemoteClass( alias="merapi.systemexecute.messages.SystemExecuteMessage" )]
-/**
- * The SystemExecuteMessage class is a sub class of Message
- * that signals a system execute request from the UI layer.
- *
- * @see merapi.Bridge;
- * @see merapi.messages.IMessage;
- * @see merapi.messages.Message
- */
-public class SystemExecuteMessage extends Message
-{
- //--------------------------------------------------------------------------
- //
- // Constants
- //
- //--------------------------------------------------------------------------
-
- /**
- * The system execute message type.
- */
- public static const SYSTEM_EXECUTE : String = "systemExecute";
-
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- */
- public function SystemExecuteMessage( args : Array = null ) : void
- {
- super();
-
- this.type = SYSTEM_EXECUTE;
- this.data = args;
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
-
- //----------------------------------
- // args
- //----------------------------------
-
- /**
- * A set of args to use as the system execute parameters
- */
- public function get args() : Array { return data as Array; }
- public function set args( val : Array ) : void { data = val; }
-
-} // end class
-} // end package
\ No newline at end of file
diff --git a/flex/merapi-core/src/systemExecute.as b/flex/merapi-core/src/systemExecute.as
deleted file mode 100644
index 8eb8dca..0000000
--- a/flex/merapi-core/src/systemExecute.as
+++ /dev/null
@@ -1,32 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package
-{
-import merapi.systemexecute.messages.SystemExecuteMessage;
-
-/**
- * Performs a systemExecute by creating a SystemExecutMessage and sending it to the
- * native Merapi Bridge.
- */
-public function systemExecute( args : Array ) : void
-{
- var sem : SystemExecuteMessage = new SystemExecuteMessage();
- sem.args = args;
- sem.send();
-} // end top level function
-} // end package
\ No newline at end of file
diff --git a/java/merapi-core/build.xml b/java/merapi-core/build.xml
deleted file mode 100644
index 39cac9e..0000000
--- a/java/merapi-core/build.xml
+++ /dev/null
@@ -1,131 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/java/merapi-core/config/applicationContext.xml b/java/merapi-core/config/applicationContext.xml
deleted file mode 100644
index 908167d..0000000
--- a/java/merapi-core/config/applicationContext.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/java/merapi-core/config/merapi-native-config.xml b/java/merapi-core/config/merapi-native-config.xml
deleted file mode 100644
index b30620e..0000000
--- a/java/merapi-core/config/merapi-native-config.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
- localhost
- 12345
- ./config/applicationContext.xml
- AMF3Reader
- AMF3Writer
-
diff --git a/java/merapi-core/lgpl-3.0.txt b/java/merapi-core/lgpl-3.0.txt
deleted file mode 100644
index cca7fc2..0000000
--- a/java/merapi-core/lgpl-3.0.txt
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/java/merapi-core/libs/commons-logging.jar b/java/merapi-core/libs/commons-logging.jar
deleted file mode 100644
index 8758a96..0000000
Binary files a/java/merapi-core/libs/commons-logging.jar and /dev/null differ
diff --git a/java/merapi-core/libs/flex-messaging-common.jar b/java/merapi-core/libs/flex-messaging-common.jar
deleted file mode 100644
index 5fa2dc2..0000000
Binary files a/java/merapi-core/libs/flex-messaging-common.jar and /dev/null differ
diff --git a/java/merapi-core/libs/flex-messaging-core.jar b/java/merapi-core/libs/flex-messaging-core.jar
deleted file mode 100644
index 3de28ea..0000000
Binary files a/java/merapi-core/libs/flex-messaging-core.jar and /dev/null differ
diff --git a/java/merapi-core/libs/log4j-1.2.15.jar b/java/merapi-core/libs/log4j-1.2.15.jar
deleted file mode 100644
index c930a6a..0000000
Binary files a/java/merapi-core/libs/log4j-1.2.15.jar and /dev/null differ
diff --git a/java/merapi-core/libs/spring.jar b/java/merapi-core/libs/spring.jar
deleted file mode 100644
index 5273670..0000000
Binary files a/java/merapi-core/libs/spring.jar and /dev/null differ
diff --git a/java/merapi-core/libs/tools.jar b/java/merapi-core/libs/tools.jar
deleted file mode 100644
index 75500da..0000000
Binary files a/java/merapi-core/libs/tools.jar and /dev/null differ
diff --git a/java/merapi-core/src/merapi/Bootstrap.java b/java/merapi-core/src/merapi/Bootstrap.java
deleted file mode 100644
index e295d8f..0000000
--- a/java/merapi-core/src/merapi/Bootstrap.java
+++ /dev/null
@@ -1,40 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi;
-
-
-/**
- * The Bootstrap class is used to execute the Merapi Java process.
- */
-public class Bootstrap {
-
- //--------------------------------------------------------------------------
- //
- // Class Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * The main method that starts the bridge.
- */
- public static void main( String[] args )
- {
- Bridge.open();
- }
-
-}
diff --git a/java/merapi-core/src/merapi/Bridge.java b/java/merapi-core/src/merapi/Bridge.java
deleted file mode 100644
index 7beaedc..0000000
--- a/java/merapi-core/src/merapi/Bridge.java
+++ /dev/null
@@ -1,369 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Properties;
-
-import merapi.config.BridgeConfig;
-import merapi.handlers.IMessageHandler;
-import merapi.io.amf.AMF3Reader;
-import merapi.io.amf.AMF3Writer;
-import merapi.io.reader.IReader;
-import merapi.io.writer.IWriter;
-import merapi.messages.IMessage;
-import merapi.systemexecute.handlers.SystemExecuteMessageHandler;
-
-import org.apache.log4j.Logger;
-import org.springframework.context.ApplicationContext;
-
-
-/**
- * The Bridge class is a singleton gateway to the Flex Merapi bridge.
- * IMessages are exchanged between this Java bridge object and the Flex bridge object.
- *
- * @see merapi.messages.IMessage;
- */
-public class Bridge implements Runnable
-{
- //--------------------------------------------------------------------------
- //
- // Class Constants
- //
- //--------------------------------------------------------------------------
-
- public static final String CONFIG_PATH = "./config/merapi-native-config.xml";
- public static final String READER_STRING = "reader";
- public static final String WRITER_STRING = "writer";
- public static final String PORT_STRING = "port";
-
-
- //--------------------------------------------------------------------------
- //
- // Class Properties
- //
- //--------------------------------------------------------------------------
-
- /**
- * The port used to connect Merapi
- */
- public static int PORT = 12345;
-
-
- //--------------------------------------------------------------------------
- //
- // Class Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * The single instance of the Merapi Bridge
- */
- public static Bridge getInstance()
- {
- if ( instance == null )
- {
- instance = new Bridge();
- instance.registerHandlers();
- }
-
- return instance;
- }
-
- /**
- * Opens the Merapi server socket
- */
- public static void open()
- {
- if ( thread == null )
- {
- Bridge.thread = new Thread( Bridge.getInstance() );
- Bridge.thread.start();
-
- Bridge.isRunning = true;
- }
- }
-
- /**
- * Closes the Merapi server socket
- */
- public static void close()
- {
- Bridge.isRunning = false;
- Bridge.thread = null;
-
- try
- {
- instance.__server.close();
- }
- catch ( IOException exception )
- {
- Bridge.instance.__logger.error( exception );
- }
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Class Variables
- //
- //--------------------------------------------------------------------------
-
- private static Bridge instance = null;
- private static Thread thread = null;
- private static boolean isRunning = true;
-
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- */
- private Bridge()
- {
- super();
-
- readConfig();
-
- __handlers = new HashMap>();
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Called by start() from the Threading API.
- */
- public void run()
- {
- try
- {
- // Open the server socket
- __server = new ServerSocket( PORT );
-
- __logger.info( "Merapi started on port: " + PORT );
-
- while( Bridge.isRunning == true )
- {
- // Get the first client that connects
- Socket temp = __server.accept();
- __client = temp;
-
- // Instantiate a listener thread that will listen and read the input stream
- // of the first client that connects and start the thread
- __clientListenerThread = new BridgeListenerThread( __client.getInputStream(),
- __reader );
- __clientListenerThread.start();
- }
- }
- catch ( IOException e )
- {
- __logger.error( e.getMessage() );
- }
- }
-
- /**
- * Dispatches an IMessage to registered listeners.
- */
- public void dispatchMessage( IMessage message )
- {
- // Get the list of handlers registered for the event type
- ArrayList list = __handlers.get( message.getType() );
-
- // If the list is not null and not empty notify the registered event handlers
- if ( list != null && list.size() > 0 )
- {
- for ( IMessageHandler handler : list )
- {
- if ( handler != null )
- {
- handler.handleMessage( message );
- }
- }
- }
- }
-
- /**
- * Registers an IMessageHandler to be notified when messages of type
- * type are dispatched from the Bridge.
- */
- public void registerMessageHandler( String type, IMessageHandler handler )
- {
- // Get the list of handlers registered for the event type
- ArrayList list = __handlers.get( type );
-
- // If the list is null, create a new list to add 'handler' to
- if ( list == null )
- {
- list = new ArrayList();
- __handlers.put( type, list );
- }
-
- // Add the handler to the list
- list.add( handler );
- }
-
- /**
- * Sends a message to the Flex side of the Merapi bridge.
- */
- public void sendMessage( IMessage message ) throws Exception
- {
- if ( __client == null || __client.isClosed() ) return;
-
- byte[] bytes = __writer.write( message );
-
- // Send the length of the message first
- __client.getOutputStream().write( bytes.length );
-
- // Send the message
- __client.getOutputStream().write( bytes );
- }
-
- /**
- * Unregisters a given handler.
- */
- public void unRegisterMessageHandler( String type, IMessageHandler handler )
- {
- // Get the list of handlers registered for the event type
- ArrayList list = __handlers.get( type );
-
- // If the list is not null and not empty, look for handler in the list and remove it
- // if a match is found
- if ( list != null && list.size() > 0 )
- {
- for ( IMessageHandler activeHandler : list )
- {
- if ( activeHandler == handler )
- {
- list.remove( handler );
- }
- }
- }
- }
-
- /**
- * @protected
- *
- * Instantiates the framework IMessageHandlers.
- */
- protected void registerHandlers()
- {
- // Registers SystemExecuteHandler as the IMessageHandler of the
- // SystemExecuteMessage.SYSTEM_EXECUTE message type.
- new SystemExecuteMessageHandler();
- }
-
- /**
- * @protected
- *
- * Loads the Bridge config via the BridgeConfig object.
- */
- protected void readConfig()
- {
- try
- {
- BridgeConfig bridgeConfig = new BridgeConfig( CONFIG_PATH );
- Properties config = bridgeConfig.getProps();
- ApplicationContext ctx = bridgeConfig.getContext();
-
- __reader = (IReader) ctx.getBean( config.getProperty( READER_STRING ) );
- __writer = (IWriter) ctx.getBean( config.getProperty( WRITER_STRING ) );
-
- PORT = Integer.parseInt( config.getProperty( PORT_STRING ) );
-
- bridgeConfig = null;
- }
-
- catch ( Exception e )
- {
- __logger.error( e.getMessage() );
- }
-
- if ( __reader == null ) __reader = new AMF3Reader();
- if ( __writer == null ) __writer = new AMF3Writer();
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- *
- * The socket that open connections to the Flex Merapi bridge.
- */
- private ServerSocket __server = null;
-
- /**
- * @private
- *
- * The socket that connected to the Flex Merapi bridge.
- */
- private Socket __client = null;
-
- /**
- * @private
- *
- * The thread that listens for messages from the Flex client socket.
- */
- private BridgeListenerThread __clientListenerThread = null;
-
- /**
- * @private
- *
- * The IWriter used to serialize data sent across the bridge to Flex.
- */
- private IWriter __writer = null;
-
- /**
- * @private
- *
- * The IReader used to deserialize data that comes across the bridge from Flex.
- */
- private IReader __reader = null;
-
- /**
- * @private
- *
- * An instance of the log4j logger to handle the logging.
- */
- private Logger __logger = Logger.getLogger( Bridge.class );
-
- /**
- * @private
- *
- * A HashMap of registered event handlers.
- */
- private HashMap> __handlers = null;
-
-}
\ No newline at end of file
diff --git a/java/merapi-core/src/merapi/BridgeListenerThread.java b/java/merapi-core/src/merapi/BridgeListenerThread.java
deleted file mode 100644
index d1b9a01..0000000
--- a/java/merapi-core/src/merapi/BridgeListenerThread.java
+++ /dev/null
@@ -1,146 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-
-import merapi.io.reader.IReader;
-import merapi.messages.IMessage;
-
-import org.apache.log4j.Logger;
-
-import com.sun.tools.javac.util.ByteBuffer;
-
-/**
- * The BridgeListenerThread listens for messages from a client socket and notifies
- * the bridge when a message is received.
- *
- * @see merapi.Bridge;
- * @see merapi.messages.IMessage;
- */
-public class BridgeListenerThread extends Thread {
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- */
- public BridgeListenerThread( InputStream inputStream, IReader reader )
- {
- super();
-
- __inputStream = inputStream;
- __reader = reader;
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @override
- *
- * The run method of the thread that reads data from the input stream. When a messaged is
- * deserialized it is broadcasted from the bridge via Bridge.dispatchEvent.
- * Registered listeners are notified of the event.
- */
- public void run() {
- // The buffer used to read in bytes from __inputStream
- ByteBuffer byteBuffer = new ByteBuffer();
-
- // The first byte returned in a data message
- int firstByte = 0;
-
- // When the first byte returns is equal to -1, the socket has been disconnected
- // we let the thread end at the point.
- while ( firstByte != -1 )
- {
- try
- {
- // Read the first byte from the stream, this call will block synchronously until
- // there is data read to read.
- firstByte = __inputStream.read();
-
- //System.out.println( __inputStream.available() );
-
- // If the first byte is -1, the socket is disconnected.... fall out of the
- // while loop...
- if ( firstByte != -1 )
- {
- // Read the rest of the bytes from the stream
- int b = firstByte;
-
- while ( __inputStream.available() > 0 )
- {
- byteBuffer.appendByte( b );
- b = __inputStream.read();
- }
- byteBuffer.appendByte( b );
-
- ArrayList messages = __reader.read( byteBuffer.elems );
-
- for ( IMessage message : messages )
- {
- // Broadcast the Message from the Bridge
- Bridge.getInstance().dispatchMessage( message );
- }
-
- byteBuffer.reset();
- }
- }
-
- catch ( Exception exception )
- {
- __logger.error( exception.getMessage() );
- }
- }
-
- __logger.info( this.getClass().toString() + " stopped running." );
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private The input stream from the socket connected from Flex to the bridge.
- */
- private InputStream __inputStream = null;
-
- /**
- * @private The reader used to deserialize Objects sent across the bridge.
- */
- private IReader __reader = null;
-
- /**
- * @private An instance of the log4j logger to handle the logging.
- */
- private Logger __logger = Logger.getLogger(BridgeListenerThread.class);
-
-}
diff --git a/java/merapi-core/src/merapi/config/BridgeConfig.java b/java/merapi-core/src/merapi/config/BridgeConfig.java
deleted file mode 100644
index bb7ed74..0000000
--- a/java/merapi-core/src/merapi/config/BridgeConfig.java
+++ /dev/null
@@ -1,156 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.config;
-
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.FileSystemXmlApplicationContext;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.InvalidPropertiesFormatException;
-import java.util.Properties;
-
-/**
- * The BridgeConfig class is responsible for loading the config xml file use
- * to configure the Java Merapi bridge.
- */
-public class BridgeConfig
-{
- //---------------------------------------------------------------------------
- //
- // Constructors
- //
- //---------------------------------------------------------------------------
-
- /**
- * Constructor
- *
- * @param path
- * path to the properties file
- * @throws IOException
- * can't read the file
- */
- public BridgeConfig( String path ) throws IOException
- {
- __configPath = path;
-
- readConfig( __configPath );
-
- if ( __props.containsKey( "springConfig" ) )
- {
- readSpringConfig( __props.getProperty( "springConfig" ) );
- }
- }
-
- /**
- * No arg. constructor. Just nulls out everything.
- */
- public BridgeConfig()
- {
- __configPath = null;
- __context = null;
- __props = null;
- }
-
-
- //---------------------------------------------------------------------------
- //
- // Properties
- //
- //---------------------------------------------------------------------------
-
- /**
- * The path to the config file.
- */
- public String getConfigPath() { return __configPath; }
- public void setConfigPath( String configPath ) { __configPath = configPath; }
-
- /**
- * The properties read from the config file.
- */
- public Properties getProps() { return __props; }
-
- /**
- * The context used to load the IWriter and IReader class types.
- */
- public ApplicationContext getContext() { return __context; }
-
-
- //---------------------------------------------------------------------------
- //
- // Methods
- //
- //---------------------------------------------------------------------------
-
- /**
- * Reads the config from merapi-native-config.xml file
- *
- * @param path
- * path to the xml file
- * @return the populated properties object
- * @throws IOException
- * can't read the file
- * @throws InvalidPropertiesFormatException
- * bad file format
- */
- public void readConfig( String path ) throws IOException, InvalidPropertiesFormatException
- {
- FileInputStream fis = new FileInputStream( path );
- __props = new Properties();
- __props.loadFromXML( fis );
- fis.close();
- }
-
- /**
- * Loads the Spring ApplicationContext
- *
- * @param path
- * the path the spring config file. scans package merapi.* for annotated
- * components
- * @return the ApplicationContext with the beans populated
- */
- public void readSpringConfig( String path )
- {
- FileSystemXmlApplicationContext ctx = new FileSystemXmlApplicationContext( path );
- __context = ctx;
- }
-
-
- //---------------------------------------------------------------------------
- //
- // Variables
- //
- //---------------------------------------------------------------------------
-
- /**
- * @private The file path for the config xml file
- */
- private String __configPath = null;
-
- /**
- * @private The loaded properties (via the config file)
- */
- private Properties __props = null;
-
- /**
- * @private The Spring context used to load the IReader and
- * IWriter class types.
- */
- private ApplicationContext __context = null;
-
-}
\ No newline at end of file
diff --git a/java/merapi-core/src/merapi/handlers/IMessageHandler.java b/java/merapi-core/src/merapi/handlers/IMessageHandler.java
deleted file mode 100644
index 67bc093..0000000
--- a/java/merapi-core/src/merapi/handlers/IMessageHandler.java
+++ /dev/null
@@ -1,41 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.handlers;
-
-import merapi.messages.IMessage;
-
-/**
- * The IEventHandler interface defines the methods for receiving a
- * MerapiEvent from the Bridge.
- *
- * @see merapi.Bridge
- */
-public interface IMessageHandler {
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Handles an IMessage dispatched from the Bridge.
- */
- public void handleMessage( IMessage message );
-
-}
\ No newline at end of file
diff --git a/java/merapi-core/src/merapi/handlers/MessageHandler.java b/java/merapi-core/src/merapi/handlers/MessageHandler.java
deleted file mode 100644
index 7864860..0000000
--- a/java/merapi-core/src/merapi/handlers/MessageHandler.java
+++ /dev/null
@@ -1,76 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.handlers;
-
-import merapi.Bridge;
-import merapi.messages.IMessage;
-
-
-public class MessageHandler implements IMessageHandler
-{
- //--------------------------------------------------------------------------
- //
- // Constructors
- //
- //--------------------------------------------------------------------------
-
- /**
- * The default constructor
- */
- public MessageHandler()
- {
- super();
- }
-
- /**
- * Automatically registers the handler for message type type.
- */
- public MessageHandler( String type )
- {
- addMessageType( type );
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Handles an IMessage dispatched from the Bridge.
- */
- public void handleMessage( IMessage message ) {}
-
- /**
- * Adds another message type to be listened for by this instance of MessageHandler.
- */
- public void addMessageType( String type )
- {
- Bridge.getInstance().registerMessageHandler( type, this );
- }
-
- /**
- * Removes the handling of message type type.
- */
- public void removeMessageType( String type )
- {
- Bridge.getInstance().unRegisterMessageHandler( type, this );
- }
-
-}
diff --git a/java/merapi-core/src/merapi/io/amf/AMF3Reader.java b/java/merapi-core/src/merapi/io/amf/AMF3Reader.java
deleted file mode 100644
index 01a5d73..0000000
--- a/java/merapi-core/src/merapi/io/amf/AMF3Reader.java
+++ /dev/null
@@ -1,119 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.io.amf;
-
-import flex.messaging.io.SerializationContext;
-import flex.messaging.io.amf.ASObject;
-import flex.messaging.io.amf.Amf3Input;
-import merapi.io.reader.IReader;
-import merapi.messages.IMessage;
-import merapi.messages.Message;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Service;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-
-
-/**
- * The AMF3Reader class deserializes AMF 3 encoded binary data into an
- * IMessage. When a message has been received from the Flex bridge.
- *
- * @see merapi.io.reader.IReader;
- */
-@Service
-public class AMF3Reader implements IReader {
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- */
- public AMF3Reader() {
- super();
-
- __amf3Input = new Amf3Input(new SerializationContext());
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private Used to deserialize AMF binary data into an IMessage.
- */
- Amf3Input __amf3Input = null;
- Logger __logger = Logger.getLogger(AMF3Reader.class);
-
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @return Reads the binary data bytes and deserializes it into an
- * IMessage.
- */
- public ArrayList read(byte[] bytes) throws ClassNotFoundException, IOException {
- ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
-
- __amf3Input.reset();
- __amf3Input.setInputStream(byteArrayInputStream);
-
- Object decoded = __amf3Input.readObject();
- IMessage message = null;
- ArrayList al = new ArrayList();
- while (decoded != null) {
- if (decoded instanceof IMessage) {
- message = (IMessage) decoded;
- } else if (decoded instanceof ASObject) {
- ASObject aso = (ASObject) decoded;
-
- Message m = new Message();
- m.setType(aso.get("type").toString());
- m.setUid(aso.get("uid").toString());
- m.setData(aso.get("data"));
-
- message = m;
- }
-
- al.add(message);
-
- try {
- decoded = __amf3Input.readObject();
- }
- catch (Exception e) {
- decoded = null;
- __logger.error(e.getMessage());
- }
- }
-
- return al;
- }
-
-}
diff --git a/java/merapi-core/src/merapi/io/amf/AMF3Writer.java b/java/merapi-core/src/merapi/io/amf/AMF3Writer.java
deleted file mode 100644
index d70d50b..0000000
--- a/java/merapi-core/src/merapi/io/amf/AMF3Writer.java
+++ /dev/null
@@ -1,91 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.io.amf;
-
-import flex.messaging.io.SerializationContext;
-import flex.messaging.io.amf.Amf3Output;
-import merapi.io.writer.IWriter;
-import merapi.messages.IMessage;
-import org.springframework.stereotype.Service;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-
-/**
- * The AMF3Reader class deserializes AMF 3 encoded binary data into an Object.
- * When a message has been received from the Flex bridge.
- *
- * @see merapi.io.reader.IReader;
- */
-@Service
-public class AMF3Writer implements IWriter {
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- */
- public AMF3Writer() {
- super();
-
- __amf3Output = new Amf3Output(new SerializationContext());
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private Used to serialize an object into AMF binary data.
- */
- Amf3Output __amf3Output = null;
-
- /**
- * @private Used to expose the binary data as a stream to __amf3Output
- */
- ByteArrayOutputStream __byteArrayOutputStream = new ByteArrayOutputStream();
-
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Serializes message using flex.messaging.io.amf.Amf3Output.
- */
- public byte[] write(IMessage message) throws IOException {
- __byteArrayOutputStream.reset();
-
- __amf3Output.reset();
- __amf3Output.setOutputStream(__byteArrayOutputStream);
- __amf3Output.writeObject(message);
-
- return __byteArrayOutputStream.toByteArray();
- }
-
-}
diff --git a/java/merapi-core/src/merapi/io/reader/IReader.java b/java/merapi-core/src/merapi/io/reader/IReader.java
deleted file mode 100644
index c1fa377..0000000
--- a/java/merapi-core/src/merapi/io/reader/IReader.java
+++ /dev/null
@@ -1,44 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.io.reader;
-
-import java.util.ArrayList;
-
-import merapi.messages.IMessage;
-
-/**
- * The IReader interface describes a class for reading binary data from
- * the Merapi bridge.
- *
- * @see merapi.Bridge;
- * @see merapi.io.AMF3Reader;
- */
-public interface IReader {
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Deserializes the binary data bytes and returns a the data as an Object
- */
- ArrayList read( byte[] bytes ) throws Exception;
-
-}
diff --git a/java/merapi-core/src/merapi/io/writer/IWriter.java b/java/merapi-core/src/merapi/io/writer/IWriter.java
deleted file mode 100644
index 84e18a8..0000000
--- a/java/merapi-core/src/merapi/io/writer/IWriter.java
+++ /dev/null
@@ -1,42 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.io.writer;
-
-import merapi.messages.IMessage;
-
-/**
- * The IWriter interface describes a class for reading binary data from
- * the Merapi bridge.
- *
- * @see merapi.Bridge;
- * @see merapi.io.AMF3Writer;
- */
-public interface IWriter {
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Serializes the message and returns a the data as an Array of bytes.
- */
- byte[] write( IMessage message ) throws Exception;
-
-}
diff --git a/java/merapi-core/src/merapi/messages/IMessage.java b/java/merapi-core/src/merapi/messages/IMessage.java
deleted file mode 100644
index 388d3d5..0000000
--- a/java/merapi-core/src/merapi/messages/IMessage.java
+++ /dev/null
@@ -1,53 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.messages;
-
-/**
- * The IMessage interface describes a 'message' sent from
- * the Merapi bridge.
- *
- * @see merapi.Bridge;
- * @see merapi.messages.Message;
- */
-public interface IMessage {
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
-
- //----------------------------------
- // type
- //----------------------------------
-
- /**
- * The message type.
- */
- String getType();
-
- //----------------------------------
- // data
- //----------------------------------
-
- /**
- * The data of the message.
- */
- Object getData();
-
-}
\ No newline at end of file
diff --git a/java/merapi-core/src/merapi/messages/Message.java b/java/merapi-core/src/merapi/messages/Message.java
deleted file mode 100644
index 7b01ef9..0000000
--- a/java/merapi-core/src/merapi/messages/Message.java
+++ /dev/null
@@ -1,162 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.messages;
-
-import merapi.Bridge;
-import org.apache.log4j.Logger;
-
-import java.util.UUID;
-
-/**
- * The Message class implements IMessage, a 'message' sent from the Merapi
- * Flex bridge.
- *
- * @see merapi.Bridge;
- * @see merapi.messages.IMessage;
- */
-public class Message implements IMessage
-{
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- */
- public Message()
- {
- super();
-
- this.setUid( UUID.randomUUID().toString() );
- }
-
- /**
- * Constructor.
- */
- public Message( String type )
- {
- this();
-
- this.setType( type );
- }
-
- /**
- * Constructor.
- */
- public Message( String type, Object data )
- {
- this( type );
-
- this.setData( data );
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
-
- //----------------------------------
- // type
- //----------------------------------
-
- /**
- * The type the message.
- */
- public String getType()
- {
- return __type;
- }
- public void setType( String val )
- {
- __type = val;
- }
-
- //----------------------------------
- // uid
- //----------------------------------
-
- /**
- * A unique ID for this message.
- */
- public String getUid()
- {
- return __uid;
- }
- public void setUid( String val )
- {
- __uid = val;
- }
-
- //----------------------------------
- // data
- //----------------------------------
-
- /**
- * The data carried by this message.
- */
- public Object getData()
- {
- return __data;
- }
- public void setData( Object val )
- {
- __data = val;
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Sends this message across the bridge.
- */
- public void send()
- {
- try
- {
- Bridge.getInstance().sendMessage( this );
- }
- catch ( Exception e )
- {
- __logger.error( e.getMessage() );
- }
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * Used by the getters/setters.
- */
- private String __type = null;
- private String __uid = null;
- private Object __data = null;
-
- private Logger __logger = Logger.getLogger(Message.class);
-}
\ No newline at end of file
diff --git a/java/merapi-core/src/merapi/systemexecute/handlers/SystemExecuteMessageHandler.java b/java/merapi-core/src/merapi/systemexecute/handlers/SystemExecuteMessageHandler.java
deleted file mode 100644
index 9b03d6b..0000000
--- a/java/merapi-core/src/merapi/systemexecute/handlers/SystemExecuteMessageHandler.java
+++ /dev/null
@@ -1,70 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.systemexecute.handlers;
-
-import merapi.handlers.MessageHandler;
-import merapi.messages.IMessage;
-import merapi.systemexecute.messages.SystemExecuteMessage;
-
-
-public class SystemExecuteMessageHandler extends MessageHandler
-{
- //--------------------------------------------------------------------------
- //
- // Constructors
- //
- //--------------------------------------------------------------------------
-
- /**
- * The default constructor
- */
- public SystemExecuteMessageHandler()
- {
- super( SystemExecuteMessage.SYSTEM_EXECUTE );
- }
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * Handles an IMessage dispatched from the Bridge.
- */
- public void handleMessage( IMessage message )
- {
- if ( message instanceof SystemExecuteMessage )
- {
- SystemExecuteMessage sem = (SystemExecuteMessage)message;
-
- // Use the args passed in the message to do a shell exec
- try
- {
- String[] args = sem.getArgs();
- Runtime.getRuntime().exec( args );
- }
- catch ( Exception e )
- {
- System.out.println( SystemExecuteMessageHandler.class );
- e.printStackTrace();
- }
- }
- }
-
-}
diff --git a/java/merapi-core/src/merapi/systemexecute/messages/SystemExecuteMessage.java b/java/merapi-core/src/merapi/systemexecute/messages/SystemExecuteMessage.java
deleted file mode 100644
index 8cf4785..0000000
--- a/java/merapi-core/src/merapi/systemexecute/messages/SystemExecuteMessage.java
+++ /dev/null
@@ -1,82 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 3 of the License, or (at your
-// option) any later version.
-//
-// This program 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 General Public License
-// for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, see .
-//
-////////////////////////////////////////////////////////////////////////////////
-
-package merapi.systemexecute.messages;
-
-import merapi.messages.Message;
-
-/**
- * The SystemExecuteMessage class is a sub class of Message
- * that signals a system execute request from the UI layer.
- *
- * @see merapi.Bridge;
- * @see merapi.messages.IMessage;
- * @see merapi.messages.Message
- */
-public class SystemExecuteMessage extends Message
-{
- //--------------------------------------------------------------------------
- //
- // Constants
- //
- //--------------------------------------------------------------------------
-
- /**
- * Message type for a system execute command.
- */
- public static final String SYSTEM_EXECUTE = "systemExecute";
-
-
- //--------------------------------------------------------------------------
- //
- // Constructor
- //
- //--------------------------------------------------------------------------
-
- /**
- * Constructor.
- */
- public SystemExecuteMessage()
- {
- super();
- }
-
-
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
-
- //----------------------------------
- // args
- //----------------------------------
-
- /**
- * A set of args to use as the system execute parameters
- */
- public String[] getArgs()
- {
- Object[] data = (Object[])getData();
- String[] args = new String[ data.length ];
- for ( int i = 0; i < data.length; i++ )
- {
- args[ i ] = (String)data[ i ];
- }
- return args;
- }
-}