mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-16 22:38:38 +00:00
check in basic flex demo as basis to develop a client application
This commit is contained in:
1 parent
cad68d53f5
commit
25be760bbc
76 files changed
+20572
No files matched your search
+66
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict
|
||||
{
|
||||
public class Database
|
||||
{
|
||||
private var _name:String;
|
||||
private var _description:String;
|
||||
|
||||
public function Database(name:String, description:String)
|
||||
{
|
||||
this._name = name;
|
||||
this._description = description;
|
||||
}
|
||||
|
||||
public function set name(name:String):void
|
||||
{
|
||||
this._name = name;
|
||||
}
|
||||
|
||||
public function get name():String
|
||||
{
|
||||
return this._name;
|
||||
}
|
||||
|
||||
public function set description(description:String):void
|
||||
{
|
||||
this._description = description;
|
||||
}
|
||||
|
||||
public function get description():String
|
||||
{
|
||||
return this._description;
|
||||
}
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict
|
||||
{
|
||||
public class Definition
|
||||
{
|
||||
private var _definition:String;
|
||||
private var _database:String;
|
||||
private var _term:String;
|
||||
|
||||
public function set definition(definition:String):void
|
||||
{
|
||||
this._definition = definition;
|
||||
}
|
||||
|
||||
public function get definition():String
|
||||
{
|
||||
return this._definition;
|
||||
}
|
||||
|
||||
public function set database(database:String):void
|
||||
{
|
||||
this._database = database;
|
||||
}
|
||||
|
||||
public function get database():String
|
||||
{
|
||||
return this._database;
|
||||
}
|
||||
|
||||
public function set term(term:String):void
|
||||
{
|
||||
this._term = term;
|
||||
}
|
||||
|
||||
public function get term():String
|
||||
{
|
||||
return this._term;
|
||||
}
|
||||
}
|
||||
}
|
||||
+360
@@ -0,0 +1,360 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict
|
||||
{
|
||||
import com.adobe.protocols.dict.events.*;
|
||||
import com.adobe.protocols.dict.util.*;
|
||||
|
||||
import flash.events.Event;
|
||||
import flash.events.EventDispatcher;
|
||||
import flash.events.IOErrorEvent;
|
||||
import flash.events.ProgressEvent;
|
||||
import flash.events.SecurityErrorEvent;
|
||||
import flash.net.Socket;
|
||||
import mx.rpc.http.HTTPService;
|
||||
import mx.rpc.events.ResultEvent;
|
||||
import mx.rpc.events.FaultEvent;
|
||||
import flash.xml.XMLNode;
|
||||
import mx.utils.StringUtil;
|
||||
|
||||
public class Dict
|
||||
extends EventDispatcher
|
||||
{
|
||||
// Event type names.
|
||||
//public static var CONNECTED:String = "connected";
|
||||
//public static var DISCONNECTED:String = "disconnected";
|
||||
public static var IO_ERROR:String = IOErrorEvent.IO_ERROR;
|
||||
//public static var ERROR:String = "error";
|
||||
//public static var SERVERS:String = "servers";
|
||||
//public static var DATABASES:String = "databases";
|
||||
//public static var MATCH_STRATEGIES:String = "matchStrategies";
|
||||
//public static var DEFINITION:String = "definition";
|
||||
//public static var DEFINITION_HEADER:String = "definitionHeader";
|
||||
//public static var MATCH:String = "match";
|
||||
//public static var NO_MATCH:String = "noMatch";
|
||||
|
||||
public static var FIRST_MATCH:uint = 0;
|
||||
public static var ALL_DATABASES:uint = 1;
|
||||
|
||||
private var socket:SocketHelper;
|
||||
|
||||
private var dbShortList:Boolean;
|
||||
|
||||
public function Dict()
|
||||
{
|
||||
this.socket = new SocketHelper();
|
||||
this.socket.addEventListener(Event.CONNECT, connected);
|
||||
this.socket.addEventListener(Event.CLOSE, disconnected);
|
||||
this.socket.addEventListener(SocketHelper.COMPLETE_RESPONSE, incomingData);
|
||||
this.socket.addEventListener(IOErrorEvent.IO_ERROR, ioError);
|
||||
this.socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityError);
|
||||
}
|
||||
|
||||
public function connect(server:String, port:uint = 2628):void
|
||||
{
|
||||
if (this.socket.connected)
|
||||
{
|
||||
this.socket.close();
|
||||
}
|
||||
this.socket.connect(server, port);
|
||||
}
|
||||
|
||||
public function connectThroughProxy(proxyServer:String,
|
||||
proxyPort:int,
|
||||
server:String,
|
||||
port:uint = 2628):void
|
||||
{
|
||||
if (this.socket.connected)
|
||||
{
|
||||
this.socket.close();
|
||||
}
|
||||
this.socket.setProxyInfo(proxyServer, proxyPort);
|
||||
this.socket.connect(server, port);
|
||||
}
|
||||
|
||||
public function disconnect():void
|
||||
{
|
||||
this.socket.close();
|
||||
this.disconnected(null);
|
||||
}
|
||||
|
||||
public function getServers():void
|
||||
{
|
||||
var http:HTTPService = new HTTPService();
|
||||
http.url = "http://luetzschena-stahmeln.de/dictd/xmllist.php";
|
||||
http.addEventListener(ResultEvent.RESULT, incomingServerXML);
|
||||
http.addEventListener(FaultEvent.FAULT, httpError);
|
||||
http.resultFormat = HTTPService.RESULT_FORMAT_E4X;
|
||||
http.send();
|
||||
}
|
||||
|
||||
public function getDatabases(shortList:Boolean=true):void
|
||||
{
|
||||
this.dbShortList = shortList;
|
||||
this.socket.writeUTFBytes("show db\r\n");
|
||||
this.socket.flush();
|
||||
}
|
||||
|
||||
public function getMatchStrategies():void
|
||||
{
|
||||
this.socket.writeUTFBytes("show strat\r\n");
|
||||
this.socket.flush();
|
||||
}
|
||||
|
||||
public function match(database:String, term:String, scope:String="prefix"):void
|
||||
{
|
||||
this.socket.writeUTFBytes("match " + database + " " + scope + " \"" + term + "\"\r\n");
|
||||
this.socket.flush();
|
||||
}
|
||||
|
||||
public function define(database:String, term:String):void
|
||||
{
|
||||
this.socket.writeUTFBytes("define " + database + " \"" + term + "\"\r\n");
|
||||
this.socket.flush();
|
||||
}
|
||||
|
||||
public function lookup(term:String, scope:uint):void
|
||||
{
|
||||
var flag:String;
|
||||
if (scope == Dict.ALL_DATABASES)
|
||||
{
|
||||
flag = "*";
|
||||
}
|
||||
else if (scope == Dict.FIRST_MATCH)
|
||||
{
|
||||
flag = "!";
|
||||
}
|
||||
this.socket.writeUTFBytes("define " + flag + " \"" + term + "\"\r\n");
|
||||
this.socket.flush();
|
||||
}
|
||||
|
||||
//// Private functions ////
|
||||
|
||||
private function connected(event:Event):void
|
||||
{
|
||||
// Wait to dispatch an event until we get the 220 response.
|
||||
}
|
||||
|
||||
private function disconnected(event:Event):void
|
||||
{
|
||||
dispatchEvent(new DisconnectedEvent(DisconnectedEvent.DISCONNECTED));
|
||||
}
|
||||
|
||||
private function incomingServerXML(event:ResultEvent):void
|
||||
{
|
||||
var dictd:Namespace = new Namespace("http://www.luetzschena-stahmeln.de/dictd/");
|
||||
var result:XML = event.result as XML;
|
||||
var server:String, description:String;
|
||||
var servers:Array = new Array();
|
||||
for each (var serverNode:XML in result.dictd::server)
|
||||
{
|
||||
server = serverNode.dictd::dictdurl;
|
||||
description = serverNode.dictd::description;
|
||||
if (StringUtil.trim(server).length != 0 &&
|
||||
StringUtil.trim(description).length != 0)
|
||||
{
|
||||
var dServer:DictionaryServer = new DictionaryServer();
|
||||
dServer.server = server.replace("dict://", "");
|
||||
dServer.description = description;
|
||||
servers.push(dServer);
|
||||
}
|
||||
}
|
||||
var dEvent:DictionaryServerEvent = new DictionaryServerEvent(DictionaryServerEvent.SERVERS);
|
||||
dEvent.servers = servers;
|
||||
dispatchEvent(dEvent);
|
||||
}
|
||||
|
||||
private function incomingData(event:CompleteResponseEvent):void
|
||||
{
|
||||
var rawResponse:String = event.response;
|
||||
var response:Response = this.parseRawResponse(rawResponse);
|
||||
var responseCode:uint = response.code;
|
||||
if (responseCode == 552) // no matches
|
||||
{
|
||||
throwNoMatchEvent(response);
|
||||
}
|
||||
else if (responseCode >= 400 && responseCode <= 599) // error
|
||||
{
|
||||
throwErrorEvent(response);
|
||||
}
|
||||
else if (responseCode == 220) // successful connection
|
||||
{
|
||||
dispatchEvent(new ConnectedEvent(ConnectedEvent.CONNECTED));
|
||||
}
|
||||
else if (responseCode == 110) // databases are being returned
|
||||
{
|
||||
throwDatabasesEvent(response);
|
||||
}
|
||||
else if (responseCode == 111) // matches strategies
|
||||
{
|
||||
throwMatchStrategiesEvent(response);
|
||||
}
|
||||
else if (responseCode == 152) // matches
|
||||
{
|
||||
throwMatchEvent(response);
|
||||
}
|
||||
else if (responseCode == 150)
|
||||
{
|
||||
throwDefinitionHeaderEvent(response);
|
||||
}
|
||||
else if (responseCode == 151)
|
||||
{
|
||||
throwDefinitionEvent(response);
|
||||
}
|
||||
}
|
||||
|
||||
private function ioError(event:IOErrorEvent):void
|
||||
{
|
||||
dispatchEvent(event);
|
||||
}
|
||||
|
||||
private function httpError(event:FaultEvent):void
|
||||
{
|
||||
trace("httpError!");
|
||||
}
|
||||
|
||||
private function securityError(event:SecurityErrorEvent):void
|
||||
{
|
||||
trace("security error!");
|
||||
trace(event.text);
|
||||
}
|
||||
|
||||
// Dispatch new events.
|
||||
|
||||
private function throwDatabasesEvent(response:Response):void
|
||||
{
|
||||
var databases:Array = new Array();
|
||||
var responseArray:Array = response.body.split("\r\n");
|
||||
for each (var line:String in responseArray)
|
||||
{
|
||||
var name:String = line.substring(0, line.indexOf(" "));
|
||||
if (name == "--exit--")
|
||||
{
|
||||
if (this.dbShortList)
|
||||
{
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
var description:String = line.substring(line.indexOf(" ")+1, line.length).replace(/\"/g,"");
|
||||
databases.push(new Database(name, description));
|
||||
}
|
||||
var event:DatabaseEvent = new DatabaseEvent(DatabaseEvent.DATABASES);
|
||||
event.databases = databases;
|
||||
dispatchEvent(event);
|
||||
}
|
||||
|
||||
private function throwMatchStrategiesEvent(response:Response):void
|
||||
{
|
||||
var strategies:Array = new Array();
|
||||
var responseArray:Array = response.body.split("\r\n");
|
||||
for each (var line:String in responseArray)
|
||||
{
|
||||
var name:String = line.substring(0, line.indexOf(" "));
|
||||
var description:String = line.substring(line.indexOf(" ")+1, line.length).replace(/\"/g,"");
|
||||
strategies.push(new MatchStrategy(name, description));
|
||||
}
|
||||
var event:MatchStrategiesEvent = new MatchStrategiesEvent(MatchStrategiesEvent.MATCH_STRATEGIES);
|
||||
event.strategies = strategies;
|
||||
dispatchEvent(event);
|
||||
}
|
||||
|
||||
private function throwMatchEvent(response:Response):void
|
||||
{
|
||||
var matches:Array = new Array();
|
||||
var responseArray:Array = response.body.split("\r\n");
|
||||
for each (var line:String in responseArray)
|
||||
{
|
||||
var match:String = line.substring(line.indexOf(" ")+1, line.length).replace(/\"/g,"");
|
||||
matches.push(match);
|
||||
}
|
||||
var event:MatchEvent = new MatchEvent(MatchEvent.MATCH);
|
||||
event.matches = matches;
|
||||
dispatchEvent(event);
|
||||
}
|
||||
|
||||
private function throwErrorEvent(response:Response):void
|
||||
{
|
||||
var event:ErrorEvent = new ErrorEvent(ErrorEvent.ERROR);
|
||||
event.code = response.code;
|
||||
event.message = response.headerText;
|
||||
dispatchEvent(event);
|
||||
}
|
||||
|
||||
private function throwNoMatchEvent(response:Response):void
|
||||
{
|
||||
dispatchEvent(new NoMatchEvent(NoMatchEvent.NO_MATCH));
|
||||
}
|
||||
|
||||
private function throwDefinitionHeaderEvent(response:Response):void
|
||||
{
|
||||
var event:DefinitionHeaderEvent = new DefinitionHeaderEvent(DefinitionHeaderEvent.DEFINITION_HEADER);
|
||||
event.definitionCount = uint(response.headerText.substring(0, response.headerText.indexOf(" ")));
|
||||
dispatchEvent(event);
|
||||
}
|
||||
|
||||
private function throwDefinitionEvent(response:Response):void
|
||||
{
|
||||
var event:DefinitionEvent = new DefinitionEvent(DefinitionEvent.DEFINITION);
|
||||
var def:Definition = new Definition();
|
||||
var headerText:String = response.headerText;
|
||||
var tokens:Array = headerText.match(/"[^"]+"/g);
|
||||
def.term = String(tokens[0]).replace(/"/g, "");
|
||||
def.database = String(tokens[1]).replace(/"/g, "");
|
||||
def.definition = response.body;
|
||||
event.definition = def;
|
||||
dispatchEvent(event);
|
||||
}
|
||||
|
||||
private function parseRawResponse(rawResponse:String):Response
|
||||
{
|
||||
var response:Response = new Response();
|
||||
var fullHeader:String;
|
||||
if (rawResponse.indexOf("\r\n") != -1)
|
||||
{
|
||||
fullHeader = rawResponse.substring(0, rawResponse.indexOf("\r\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
fullHeader = rawResponse;
|
||||
}
|
||||
var responseCodeMatch:Array = fullHeader.match(/^\d{3}/);
|
||||
response.code = uint(responseCodeMatch[0]);
|
||||
response.headerText = fullHeader.substring(fullHeader.indexOf(" ")+1, fullHeader.length);
|
||||
var body:String = rawResponse.substring(rawResponse.indexOf("\r\n")+2, rawResponse.length);
|
||||
body = body.replace(/\r\n\.\./, "\r\n.");
|
||||
response.body = body;
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict
|
||||
{
|
||||
public class DictionaryServer
|
||||
{
|
||||
private var _server:String;
|
||||
private var _description:String;
|
||||
|
||||
public function set server(server:String):void
|
||||
{
|
||||
this._server = server;
|
||||
}
|
||||
|
||||
public function get server():String
|
||||
{
|
||||
return this._server;
|
||||
}
|
||||
|
||||
public function set description(description:String):void
|
||||
{
|
||||
this._description = description;
|
||||
}
|
||||
|
||||
public function get description():String
|
||||
{
|
||||
return this._description;
|
||||
}
|
||||
}
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict
|
||||
{
|
||||
public class MatchStrategy
|
||||
{
|
||||
private var _name:String;
|
||||
private var _description:String;
|
||||
|
||||
public function MatchStrategy(name:String, description:String)
|
||||
{
|
||||
this._name = name;
|
||||
this._description = description;
|
||||
}
|
||||
|
||||
public function set name(name:String):void
|
||||
{
|
||||
this._name = name;
|
||||
}
|
||||
|
||||
public function get name():String
|
||||
{
|
||||
return this._name;
|
||||
}
|
||||
|
||||
public function set description(description:String):void
|
||||
{
|
||||
this._description = description;
|
||||
}
|
||||
|
||||
public function get description():String
|
||||
{
|
||||
return this._description;
|
||||
}
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict
|
||||
{
|
||||
public class Response
|
||||
{
|
||||
private var _code:uint;
|
||||
private var _headerText:String;
|
||||
private var _body:String;
|
||||
|
||||
public function set code(code:uint):void
|
||||
{
|
||||
this._code = code;
|
||||
}
|
||||
|
||||
public function set headerText(headerText:String):void
|
||||
{
|
||||
this._headerText = headerText;
|
||||
}
|
||||
|
||||
public function set body(body:String):void
|
||||
{
|
||||
this._body = body;
|
||||
}
|
||||
|
||||
public function get code():uint
|
||||
{
|
||||
return this._code;
|
||||
}
|
||||
|
||||
public function get headerText():String
|
||||
{
|
||||
return this._headerText;
|
||||
}
|
||||
|
||||
public function get body():String
|
||||
{
|
||||
return this._body;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class ConnectedEvent extends Event
|
||||
{
|
||||
public static const CONNECTED:String = "connected";
|
||||
|
||||
public function ConnectedEvent(type:String, bubbles:Boolean = false,
|
||||
cancelable:Boolean = false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
}
|
||||
|
||||
public override function clone():Event
|
||||
{
|
||||
var out:ConnectedEvent = new ConnectedEvent(type, bubbles, cancelable);
|
||||
return out;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class DatabaseEvent extends Event
|
||||
{
|
||||
private var _databases:Array;
|
||||
|
||||
public static const DATABASES:String = "databases";
|
||||
|
||||
public function DatabaseEvent(type:String, bubbles:Boolean = false,
|
||||
cancelable:Boolean = false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
}
|
||||
|
||||
public function set databases(databases:Array):void
|
||||
{
|
||||
this._databases = databases;
|
||||
}
|
||||
|
||||
public function get databases():Array
|
||||
{
|
||||
return this._databases;
|
||||
}
|
||||
|
||||
public override function clone():Event
|
||||
{
|
||||
var out:DatabaseEvent = new DatabaseEvent(type, bubbles, cancelable);
|
||||
out.databases = _databases;
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict.events
|
||||
{
|
||||
import com.adobe.protocols.dict.Definition;
|
||||
|
||||
import flash.events.Event;
|
||||
|
||||
|
||||
public class DefinitionEvent extends Event
|
||||
{
|
||||
public static const DEFINITION:String = "definition";
|
||||
|
||||
private var _definition:Definition;
|
||||
|
||||
public function DefinitionEvent(type:String, bubbles:Boolean = false,
|
||||
cancelable:Boolean = false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
}
|
||||
|
||||
public function set definition(definition:Definition):void
|
||||
{
|
||||
this._definition = definition;
|
||||
}
|
||||
|
||||
public function get definition():Definition
|
||||
{
|
||||
return this._definition;
|
||||
}
|
||||
|
||||
public override function clone():Event
|
||||
{
|
||||
var out:DefinitionEvent = new DefinitionEvent(type, bubbles, cancelable);
|
||||
out.definition = _definition;
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class DefinitionHeaderEvent extends Event
|
||||
{
|
||||
public static const DEFINITION_HEADER:String = "definitionHeader";
|
||||
|
||||
private var _definitionCount:uint;
|
||||
|
||||
public function DefinitionHeaderEvent(type:String, bubbles:Boolean = false,
|
||||
cancelable:Boolean = false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
}
|
||||
|
||||
public function set definitionCount(definitionCount:uint):void
|
||||
{
|
||||
this._definitionCount = definitionCount;
|
||||
}
|
||||
|
||||
public function get definitionCount():uint
|
||||
{
|
||||
return this._definitionCount;
|
||||
}
|
||||
|
||||
public override function clone():Event
|
||||
{
|
||||
var out:DefinitionHeaderEvent = new DefinitionHeaderEvent(type,
|
||||
bubbles, cancelable);
|
||||
|
||||
out.definitionCount = _definitionCount;
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class DictionaryServerEvent extends Event
|
||||
{
|
||||
public static const SERVERS:String = "servers";
|
||||
|
||||
private var _servers:Array;
|
||||
|
||||
public function DictionaryServerEvent(type:String, bubbles:Boolean = false,
|
||||
cancelable:Boolean = false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
}
|
||||
|
||||
public function set servers(servers:Array):void
|
||||
{
|
||||
this._servers = servers;
|
||||
}
|
||||
|
||||
public function get servers():Array
|
||||
{
|
||||
return this._servers;
|
||||
}
|
||||
|
||||
public override function clone():Event
|
||||
{
|
||||
var out:DictionaryServerEvent = new DictionaryServerEvent(type,
|
||||
bubbles, cancelable);
|
||||
|
||||
out.servers = _servers;
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class DisconnectedEvent extends Event
|
||||
{
|
||||
public static const DISCONNECTED:String = "disconnected";
|
||||
|
||||
public function DisconnectedEvent(type:String, bubbles:Boolean = false,
|
||||
cancelable:Boolean = false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
}
|
||||
|
||||
public override function clone():Event
|
||||
{
|
||||
var out:DisconnectedEvent = new DisconnectedEvent(type, bubbles, cancelable);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class ErrorEvent extends Event
|
||||
{
|
||||
public static const ERROR:String = "error";
|
||||
|
||||
private var _code:uint;
|
||||
private var _message:String;
|
||||
|
||||
public function ErrorEvent(type:String, bubbles:Boolean = false,
|
||||
cancelable:Boolean = false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
}
|
||||
|
||||
public function set code(code:uint):void
|
||||
{
|
||||
this._code = code;
|
||||
}
|
||||
|
||||
public function set message(message:String):void
|
||||
{
|
||||
this._message = message;
|
||||
}
|
||||
|
||||
public function get code():uint
|
||||
{
|
||||
return this._code;
|
||||
}
|
||||
|
||||
public function get message():String
|
||||
{
|
||||
return this._message;
|
||||
}
|
||||
|
||||
public override function clone():Event
|
||||
{
|
||||
var out:ErrorEvent = new ErrorEvent(type, bubbles, cancelable);
|
||||
|
||||
out.message = _message;
|
||||
out.code = _code;
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class MatchEvent extends Event
|
||||
{
|
||||
private var _matches:Array;
|
||||
|
||||
public static const MATCH:String = "match";
|
||||
|
||||
public function MatchEvent(type:String, bubbles:Boolean = false,
|
||||
cancelable:Boolean = false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
}
|
||||
|
||||
public function set matches(matches:Array):void
|
||||
{
|
||||
this._matches = matches;
|
||||
}
|
||||
|
||||
public function get matches():Array
|
||||
{
|
||||
return this._matches;
|
||||
}
|
||||
|
||||
public override function clone():Event
|
||||
{
|
||||
var out:MatchEvent = new MatchEvent(type, bubbles, cancelable);
|
||||
out.matches = _matches;
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class MatchStrategiesEvent
|
||||
extends Event
|
||||
{
|
||||
private var _strategies:Array;
|
||||
|
||||
public static const MATCH_STRATEGIES:String = "matchStrategies";
|
||||
|
||||
public function MatchStrategiesEvent(type:String, bubbles:Boolean = false,
|
||||
cancelable:Boolean = false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
}
|
||||
|
||||
public function set strategies(strategies:Array):void
|
||||
{
|
||||
this._strategies = strategies;
|
||||
}
|
||||
|
||||
public function get strategies():Array
|
||||
{
|
||||
return this._strategies;
|
||||
}
|
||||
|
||||
public override function clone():Event
|
||||
{
|
||||
var out:MatchStrategiesEvent = new MatchStrategiesEvent(type,
|
||||
bubbles, cancelable);
|
||||
|
||||
out.strategies = _strategies;
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class NoMatchEvent extends Event
|
||||
{
|
||||
public static const NO_MATCH:String = "noMatch";
|
||||
|
||||
public function NoMatchEvent(type:String, bubbles:Boolean = false,
|
||||
cancelable:Boolean = false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
}
|
||||
|
||||
public override function clone():Event
|
||||
{
|
||||
var out:NoMatchEvent = new NoMatchEvent(type, bubbles, cancelable);
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict.util
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class CompleteResponseEvent extends Event
|
||||
{
|
||||
private var _response:String;
|
||||
|
||||
public static const COMPLETE_RESPONSE:String = "completeResponse"
|
||||
|
||||
public function CompleteResponseEvent(type:String, bubbles:Boolean = false,
|
||||
cancelable:Boolean = false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
}
|
||||
|
||||
public function set response(response:String):void
|
||||
{
|
||||
this._response = response;
|
||||
}
|
||||
|
||||
public function get response():String
|
||||
{
|
||||
return this._response;
|
||||
}
|
||||
|
||||
public override function clone():Event
|
||||
{
|
||||
var out:CompleteResponseEvent = new CompleteResponseEvent(type,
|
||||
bubbles, cancelable);
|
||||
out.response = _response;
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
Copyright (c) 2009, Adobe Systems Incorporated
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of Adobe Systems Incorporated nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.adobe.protocols.dict.util
|
||||
{
|
||||
import com.adobe.net.proxies.RFC2817Socket;
|
||||
import flash.events.ProgressEvent;
|
||||
|
||||
public class SocketHelper
|
||||
extends RFC2817Socket
|
||||
{
|
||||
private var terminator:String = "\r\n.\r\n";
|
||||
private var buffer:String;
|
||||
public static var COMPLETE_RESPONSE:String = "completeResponse";
|
||||
|
||||
public function SocketHelper()
|
||||
{
|
||||
super();
|
||||
buffer = new String();
|
||||
addEventListener(ProgressEvent.SOCKET_DATA, incomingData);
|
||||
}
|
||||
|
||||
private function incomingData(event:ProgressEvent):void
|
||||
{
|
||||
buffer += readUTFBytes(bytesAvailable);
|
||||
buffer = buffer.replace(/250[^\r\n]+\r\n/, ""); // Get rid of all 250s. Don't need them.
|
||||
var codeStr:String = buffer.substring(0, 3);
|
||||
if (!isNaN(parseInt(codeStr)))
|
||||
{
|
||||
var code:uint = uint(codeStr);
|
||||
if (code == 150 || code >= 200)
|
||||
{
|
||||
buffer = buffer.replace("\r\n", this.terminator);
|
||||
}
|
||||
}
|
||||
|
||||
while (buffer.indexOf(this.terminator) != -1)
|
||||
{
|
||||
var chunk:String = buffer.substring(0, buffer.indexOf(this.terminator));
|
||||
buffer = buffer.substring(chunk.length + this.terminator.length, buffer.length);
|
||||
throwResponseEvent(chunk);
|
||||
}
|
||||
}
|
||||
|
||||
private function throwResponseEvent(response:String):void
|
||||
{
|
||||
var responseEvent:CompleteResponseEvent = new CompleteResponseEvent(CompleteResponseEvent.COMPLETE_RESPONSE);
|
||||
responseEvent.response = response;
|
||||
dispatchEvent(responseEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user