Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
missing files from the last commit
git-svn-id: https://svn.apache.org/repos/asf/flex/whiteboard@1448512 13f79535-47bb-0310-9956-ffa450edef68
- Loading branch information
Showing
10 changed files
with
585 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<fx:Object xmlns:fx="http://ns.adobe.com/mxml/2009" | ||
xmlns:parsley="http://www.spicefactory.org/parsley" | ||
xmlns:menu="org.apache.flex.utilities.developerToolSuite.presentation.behavior.menu.*"> | ||
|
||
<fx:Declarations> | ||
<parsley:DynamicObject type="{GeneralMenu}"/> | ||
|
||
<parsley:MapCommand type="{MenuActionCommand}"/> | ||
<parsley:MapCommand type="{LaunchUICommand}"/> | ||
<parsley:MapCommand type="{ExitUICommand}"/> | ||
|
||
<menu:ApplicationMenuPM/> | ||
</fx:Declarations> | ||
|
||
<fx:Script><![CDATA[ | ||
import org.apache.flex.utilities.developerToolSuite.infrastructure.command.ExitUICommand; | ||
import org.apache.flex.utilities.developerToolSuite.infrastructure.command.LaunchUICommand; | ||
import org.apache.flex.utilities.developerToolSuite.infrastructure.command.MenuActionCommand; | ||
import org.apache.flex.utilities.developerToolSuite.presentation.graphic.menu.GeneralMenu; | ||
]]></fx:Script> | ||
</fx:Object> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,52 @@ | ||
package org.apache.flex.utilities.developerToolSuite.infrastructure.command { | ||
import flash.data.SQLResult; | ||
import flash.errors.SQLError; | ||
|
||
import mx.utils.ObjectUtil; | ||
|
||
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.AbstractDBCommand; | ||
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.CommandCallBackError; | ||
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.CommandCallBackResult; | ||
import org.apache.flex.utilities.developerToolSuite.infrastructure.message.ApplicationExitReadyMessage; | ||
import org.apache.flex.utilities.developerToolSuite.infrastructure.message.RequestExitApplicationMessage; | ||
|
||
public class ExitUICommand extends AbstractDBCommand { | ||
|
||
private var _msg:RequestExitApplicationMessage; | ||
|
||
public function execute(msg:RequestExitApplicationMessage):void { | ||
log.debug("Executing Command with message: " + ObjectUtil.toString(msg)); | ||
this._msg = msg; | ||
executeAsync(); | ||
} | ||
|
||
override protected function prepareSql():void { | ||
sql = ""; | ||
for (var property:String in _msg.settings) { | ||
sql += "UPDATE setting SET value='" + _msg.settings[property] + "' WHERE name='" + property + "';"; | ||
} | ||
|
||
super.prepareSql(); | ||
} | ||
|
||
override protected function result(result:SQLResult, terminateCommand:Boolean = true):void { | ||
super.result(result, false); | ||
|
||
dispatch(new ApplicationExitReadyMessage()); | ||
|
||
if (terminateCommand) { | ||
callback(new CommandCallBackResult(result)); | ||
} | ||
} | ||
|
||
override protected function error(error:SQLError, terminateCommand:Boolean = true):void { | ||
super.error(error, false); | ||
|
||
dispatch(new ApplicationExitReadyMessage()); | ||
|
||
if (terminateCommand) { | ||
callback(new CommandCallBackError(error.message, error.detailID)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,6 @@ | ||
package org.apache.flex.utilities.developerToolSuite.infrastructure.message { | ||
public class ApplicationExitReadyMessage { | ||
public function ApplicationExitReadyMessage() { | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,11 @@ | ||
package org.apache.flex.utilities.developerToolSuite.infrastructure.message { | ||
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.SaveSettingsMessage; | ||
|
||
public class RequestExitApplicationMessage{ | ||
public var settings:Object; | ||
|
||
public function RequestExitApplicationMessage(settings:Object) { | ||
this.settings = settings; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,64 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<fx:Object xmlns:fx="http://ns.adobe.com/mxml/2009" | ||
xmlns:parsley="http://www.spicefactory.org/parsley" | ||
xmlns:database="org.apache.flex.utilities.developerToolSuite.executor.application.database.*" | ||
xmlns:domain="org.apache.flex.utilities.developerToolSuite.executor.domain.*" | ||
xmlns:nativeprocess="org.apache.flex.utilities.developerToolSuite.executor.application.nativeProcess.*"> | ||
|
||
<fx:Declarations> | ||
<database:ApplicationDB/> | ||
|
||
<parsley:MapCommand messageType="{InitApplicationMessage}"> | ||
<parsley:CommandSequence> | ||
<parsley:Command type="{InitDBCommand}"/> | ||
<parsley:Command type="{GetEnvironmentVariablesCommand}"/> | ||
<parsley:Command type="{GetSettingsFromDBCommand}"/> | ||
</parsley:CommandSequence> | ||
</parsley:MapCommand> | ||
|
||
|
||
<parsley:MapCommand type="{ChangeLanguageCommand}"/> | ||
<parsley:MapCommand type="{SaveSettingsCommand}"/> | ||
<parsley:MapCommand type="{SaveSettingCommand}"/> | ||
<parsley:MapCommand type="{ValidateJavaPathCommand}"/> | ||
<parsley:MapCommand type="{ValidateAntPathCommand}"/> | ||
<parsley:MapCommand type="{ValidateMavenPathCommand}"/> | ||
<parsley:MapCommand type="{ValidateSvnPathCommand}"/> | ||
<parsley:MapCommand type="{ValidateGitPathCommand}"/> | ||
<parsley:MapCommand type="{ValidateCygwinPathCommand}"/> | ||
|
||
<domain:SettingModel id="applicationModel"/> | ||
</fx:Declarations> | ||
|
||
<fx:Script><![CDATA[ | ||
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ChangeLanguageCommand; | ||
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.GetEnvironmentVariablesCommand; | ||
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.GetSettingsFromDBCommand; | ||
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.InitDBCommand; | ||
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.SaveSettingCommand; | ||
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.SaveSettingsCommand; | ||
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateAntPathCommand; | ||
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateCygwinPathCommand; | ||
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateGitPathCommand; | ||
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateJavaPathCommand; | ||
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateMavenPathCommand; | ||
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.ValidateSvnPathCommand; | ||
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.InitApplicationMessage; | ||
]]></fx:Script> | ||
</fx:Object> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,139 @@ | ||
/** | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
package org.apache.flex.utilities.developerToolSuite.executor.application.database { | ||
import flash.data.SQLConnection; | ||
import flash.data.SQLResult; | ||
import flash.data.SQLStatement; | ||
import flash.errors.SQLError; | ||
import flash.events.SQLErrorEvent; | ||
import flash.events.SQLEvent; | ||
import flash.filesystem.File; | ||
import flash.net.Responder; | ||
|
||
import mx.logging.ILogger; | ||
import mx.utils.ObjectUtil; | ||
|
||
import org.apache.flex.utilities.developerToolSuite.executor.application.util.LogUtil; | ||
|
||
public class ApplicationDB { | ||
|
||
public static const DB_VERSION:uint = 1; | ||
|
||
private static var LOG:ILogger = LogUtil.getLogger(ApplicationDB); | ||
|
||
public static const DATABASE_NAME:String = "DTSDB.db"; | ||
private static var _conn:SQLConnection; | ||
|
||
private var _isReady:Boolean; | ||
private var _isBusy:Boolean; | ||
|
||
private var _callbacks:Array = []; | ||
private var _resultCallback:Function; | ||
private var _errorCallback:Function; | ||
|
||
public function connect(callback:Function):void { | ||
|
||
_callbacks.push(callback); | ||
|
||
if (!_isReady && !_isBusy) { | ||
LOG.debug("Connecting async DB: {0}", ApplicationDB.DATABASE_NAME); | ||
_conn = new SQLConnection(); | ||
|
||
_conn.addEventListener(SQLEvent.OPEN, openHandler); | ||
_conn.addEventListener(SQLEvent.CLOSE, closedHandler); | ||
_conn.addEventListener(SQLErrorEvent.ERROR, errorHandler); | ||
|
||
// The database file is in the application storage directory | ||
var folder:File = File.applicationStorageDirectory; | ||
var dbFile:File = folder.resolvePath(DATABASE_NAME); | ||
|
||
_isBusy = true; | ||
_conn.openAsync(dbFile); | ||
} else executeNextCallback(); | ||
} | ||
|
||
protected function openHandler(event:SQLEvent):void { | ||
_isReady = true; | ||
_isBusy = false; | ||
LOG.debug("the database was opened successfully"); | ||
executeNextCallback(); | ||
} | ||
|
||
protected function close():void { | ||
LOG.debug("Closing async DB: {0}", ApplicationDB.DATABASE_NAME); | ||
_isReady = false; | ||
_isBusy = false; | ||
_conn.close(); | ||
} | ||
|
||
protected function closedHandler(event:SQLEvent):void { | ||
LOG.debug("the database was closed successfully"); | ||
} | ||
|
||
protected function errorHandler(event:SQLErrorEvent):void { | ||
LOG.error("Error executing DB Command: {0}", ObjectUtil.toString(event.error)); | ||
_isReady = false; | ||
_isBusy = false; | ||
} | ||
|
||
public function executeSqlStatement(stmt:SQLStatement, resultCallback:Function, errorCallback:Function):void { | ||
_resultCallback = resultCallback; | ||
_errorCallback = errorCallback; | ||
|
||
_isBusy = true; | ||
stmt.sqlConnection = _conn; | ||
stmt.execute(-1, new Responder(result, error)); | ||
} | ||
|
||
private function result(result:SQLResult):void { | ||
_isBusy = false | ||
if (_resultCallback) { | ||
_resultCallback(result); | ||
_resultCallback = null; | ||
} | ||
executeNextCallback(); | ||
} | ||
|
||
private function error(error:SQLError):void { | ||
LOG.error("Error executing DB Command: {0}", ObjectUtil.toString(error)); | ||
_isBusy = false; | ||
if (_errorCallback) { | ||
_errorCallback(error); | ||
_errorCallback = null; | ||
} | ||
executeNextCallback(); | ||
} | ||
|
||
private function executeNextCallback():void { | ||
if (_isReady && !_isBusy) { | ||
if (_callbacks.length > 0) { | ||
_callbacks.pop()(); | ||
} else { | ||
close(); | ||
} | ||
} | ||
} | ||
|
||
public function get isReady():Boolean { | ||
return _isReady; | ||
} | ||
|
||
public function get isBusy():Boolean { | ||
return _isBusy; | ||
} | ||
} | ||
} |
Oops, something went wrong.