You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/06/15 08:30:39 UTC
[05/48] git commit: [flex-utilities] [refs/heads/develop] - move
ant_on_air into flex-installer
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/ReplaceFilter.as
----------------------------------------------------------------------
diff --git a/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/ReplaceFilter.as b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/ReplaceFilter.as
new file mode 100644
index 0000000..e4f69d1
--- /dev/null
+++ b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/ReplaceFilter.as
@@ -0,0 +1,50 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.ant.tags
+{
+ import mx.core.IFlexModuleFactory;
+
+ import org.apache.flex.ant.Ant;
+ import org.apache.flex.ant.tags.supportClasses.TagHandler;
+
+ [Mixin]
+ public class ReplaceFilter extends TagHandler
+ {
+ public static function init(mf:IFlexModuleFactory):void
+ {
+ Ant.antTagProcessors["replacefilter"] = ReplaceFilter;
+ }
+
+ public function ReplaceFilter()
+ {
+ super();
+ }
+
+ public function get token():String
+ {
+ return getAttributeValue("@token");
+ }
+
+ public function get value():String
+ {
+ return getAttributeValue("@value");
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/ReplaceToken.as
----------------------------------------------------------------------
diff --git a/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/ReplaceToken.as b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/ReplaceToken.as
new file mode 100644
index 0000000..8bb811d
--- /dev/null
+++ b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/ReplaceToken.as
@@ -0,0 +1,44 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.ant.tags
+{
+ import mx.core.IFlexModuleFactory;
+
+ import org.apache.flex.ant.Ant;
+ import org.apache.flex.ant.tags.supportClasses.TagHandler;
+
+ [Mixin]
+ public class ReplaceToken extends TagHandler
+ {
+ public static function init(mf:IFlexModuleFactory):void
+ {
+ Ant.antTagProcessors["replacetoken"] = ReplaceToken;
+ }
+
+ public function ReplaceToken()
+ {
+ super();
+ }
+
+ public function get text():String
+ {
+ return ant.getValue(xml.text().toString(), context);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/ReplaceValue.as
----------------------------------------------------------------------
diff --git a/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/ReplaceValue.as b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/ReplaceValue.as
new file mode 100644
index 0000000..227d8a9
--- /dev/null
+++ b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/ReplaceValue.as
@@ -0,0 +1,44 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.ant.tags
+{
+ import mx.core.IFlexModuleFactory;
+
+ import org.apache.flex.ant.Ant;
+ import org.apache.flex.ant.tags.supportClasses.TagHandler;
+
+ [Mixin]
+ public class ReplaceValue extends TagHandler
+ {
+ public static function init(mf:IFlexModuleFactory):void
+ {
+ Ant.antTagProcessors["replacevalue"] = ReplaceValue;
+ }
+
+ public function ReplaceValue()
+ {
+ super();
+ }
+
+ public function get text():String
+ {
+ return ant.getValue(xml.text().toString(), context);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/TStamp.as
----------------------------------------------------------------------
diff --git a/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/TStamp.as b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/TStamp.as
new file mode 100644
index 0000000..0646a1f
--- /dev/null
+++ b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/TStamp.as
@@ -0,0 +1,68 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.ant.tags
+{
+ import mx.core.IFlexModuleFactory;
+ import mx.resources.ResourceManager;
+
+ import flash.globalization.DateTimeFormatter;
+ import flash.globalization.LocaleID;
+
+ import org.apache.flex.ant.Ant;
+ import org.apache.flex.ant.tags.supportClasses.TaskHandler;
+
+ [ResourceBundle("ant")]
+ [Mixin]
+ public class TStamp extends TaskHandler
+ {
+ public static function init(mf:IFlexModuleFactory):void
+ {
+ Ant.antTagProcessors["tstamp"] = TStamp;
+ }
+
+ public function TStamp()
+ {
+ }
+
+ override public function execute(callbackMode:Boolean, context:Object):Boolean
+ {
+ super.execute(callbackMode, context);
+
+ var d:Date = new Date();
+ var df:DateTimeFormatter = new DateTimeFormatter(LocaleID.DEFAULT);
+ df.setDateTimePattern("yyyyMMdd");
+ var dstamp:String = df.format(d);
+ context["DSTAMP"] = dstamp;
+ df.setDateTimePattern("hhmm");
+ var tstamp:String = df.format(d);
+ context["TSTAMP"] = tstamp;
+ df.setDateTimePattern("MMMM dd yyyy");
+ var today:String = df.format(d);
+ context["TODAY"] = today;
+
+ return true;
+ }
+
+ private function get prefix():String
+ {
+ return getAttributeValue("@prefix");
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Target.as
----------------------------------------------------------------------
diff --git a/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Target.as b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Target.as
new file mode 100644
index 0000000..8c3272c
--- /dev/null
+++ b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Target.as
@@ -0,0 +1,203 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.ant.tags
+{
+ import flash.events.Event;
+ import flash.net.LocalConnection;
+
+ import mx.core.IFlexModuleFactory;
+
+ import org.apache.flex.ant.Ant;
+ import org.apache.flex.ant.tags.supportClasses.TaskHandler;
+
+ [Mixin]
+ public class Target extends TaskHandler
+ {
+ public static function init(mf:IFlexModuleFactory):void
+ {
+ Ant.antTagProcessors["target"] = Target;
+ }
+
+ public function Target()
+ {
+ }
+
+ private function get ifProperty():String
+ {
+ return getNullOrAttributeValue("@if");
+ }
+
+ private function get unlessProperty():String
+ {
+ return getNullOrAttributeValue("@unless");
+ }
+
+ public function get depends():String
+ {
+ return getNullOrAttributeValue("@depends");
+ }
+
+ private var dependsList:Array;
+
+ private function processDepends():Boolean
+ {
+ if (dependsList.length == 0)
+ {
+ continueOnToSteps();
+ return true;
+ }
+
+ while (dependsList.length > 0)
+ {
+ var depend:String = dependsList.shift();
+ var t:Target = ant.project.getTarget(depend);
+ if (!t.execute(callbackMode, context))
+ {
+ t.addEventListener(Event.COMPLETE, dependCompleteHandler);
+ return false;
+ }
+ }
+
+ return continueOnToSteps();
+ }
+
+ private function dependCompleteHandler(event:Event):void
+ {
+ event.target.removeEventListener(Event.COMPLETE, dependCompleteHandler);
+ if (!ant.project.status)
+ {
+ if (!inExecute)
+ dispatchEvent(new Event(Event.COMPLETE));
+ return;
+ }
+ processDepends();
+ }
+
+ private var inExecute:Boolean;
+
+ override public function execute(callbackMode:Boolean, context:Object):Boolean
+ {
+ super.execute(callbackMode, context);
+
+ current = 0;
+ inExecute = true;
+ this.callbackMode = callbackMode;
+ if (depends)
+ {
+ dependsList = depends.split(",");
+ if (!processDepends())
+ {
+ inExecute = false;
+ return false;
+ }
+ }
+
+ var ok:Boolean = continueOnToSteps();
+ inExecute = false;
+ return ok;
+ }
+
+ private function continueOnToSteps():Boolean
+ {
+ if (!ant.project.status)
+ return true;
+ ant.output("\n" + name + ":");
+ return processSteps();
+ }
+
+ private var current:int = 0;
+
+ private function processSteps():Boolean
+ {
+ // try forcing GC before each step
+ try {
+ var lc1:LocalConnection = new LocalConnection();
+ var lc2:LocalConnection = new LocalConnection();
+
+ lc1.connect("name");
+ lc2.connect("name");
+ }
+ catch (error:Error)
+ {
+ }
+
+
+ if (ifProperty != null)
+ {
+ if (!context.hasOwnProperty(ifProperty))
+ {
+ dispatchEvent(new Event(Event.COMPLETE));
+ return true;
+ }
+ }
+
+ if (unlessProperty != null)
+ {
+ if (context.hasOwnProperty(unlessProperty))
+ {
+ dispatchEvent(new Event(Event.COMPLETE));
+ return true;
+ }
+ }
+
+ if (current == numChildren)
+ {
+ dispatchEvent(new Event(Event.COMPLETE));
+ return true;
+ }
+
+ while (current < numChildren)
+ {
+ var step:TaskHandler = getChildAt(current++) as TaskHandler;
+ if (!step.execute(callbackMode, context))
+ {
+ step.addEventListener(Event.COMPLETE, completeHandler);
+ return false;
+ }
+ if (!ant.project.status)
+ {
+ if (!inExecute)
+ dispatchEvent(new Event(Event.COMPLETE));
+ return true;
+ }
+ if (callbackMode)
+ {
+ ant.functionToCall = processSteps;
+ return false;
+ }
+ }
+ dispatchEvent(new Event(Event.COMPLETE));
+ return true;
+ }
+
+ private function completeHandler(event:Event):void
+ {
+ event.target.removeEventListener(Event.COMPLETE, completeHandler);
+ if (!ant.project.status)
+ {
+ dispatchEvent(new Event(Event.COMPLETE));
+ return;
+ }
+ if (callbackMode)
+ ant.functionToCall = processSteps;
+ else
+ processSteps();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Touch.as
----------------------------------------------------------------------
diff --git a/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Touch.as b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Touch.as
new file mode 100644
index 0000000..6982f43
--- /dev/null
+++ b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Touch.as
@@ -0,0 +1,79 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.ant.tags
+{
+ import flash.filesystem.File;
+ import flash.filesystem.FileMode;
+ import flash.filesystem.FileStream;
+
+ import mx.core.IFlexModuleFactory;
+ import mx.resources.ResourceManager;
+
+ import org.apache.flex.ant.Ant;
+ import org.apache.flex.ant.tags.supportClasses.TaskHandler;
+
+ [ResourceBundle("ant")]
+ [Mixin]
+ public class Touch extends TaskHandler
+ {
+ public static function init(mf:IFlexModuleFactory):void
+ {
+ Ant.antTagProcessors["touch"] = Touch;
+ }
+
+ public function Touch()
+ {
+ }
+
+ override public function execute(callbackMode:Boolean, context:Object):Boolean
+ {
+ super.execute(callbackMode, context);
+
+ try {
+ var f:File = new File(fileName);
+ }
+ catch (e:Error)
+ {
+ ant.output(fileName);
+ ant.output(e.message);
+ if (failonerror)
+ {
+ ant.project.failureMessage = e.message;
+ ant.project.status = false;
+ }
+ return true;
+ }
+
+ var s:String = ResourceManager.getInstance().getString('ant', 'TOUCH');
+ s = s.replace("%1", f.nativePath);
+ ant.output(ant.formatOutput("touch", s));
+
+ var fs:FileStream = new FileStream();
+ fs.open(f, FileMode.APPEND);
+ fs.close();
+ return true;
+ }
+
+ private function get fileName():String
+ {
+ return getAttributeValue("@file");
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Untar.as
----------------------------------------------------------------------
diff --git a/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Untar.as b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Untar.as
new file mode 100644
index 0000000..92b313d
--- /dev/null
+++ b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Untar.as
@@ -0,0 +1,194 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.ant.tags
+{
+ import com.probertson.utils.GZIPEncoder;
+ import de.ketzler.utils.SimpleUntar;
+
+ import flash.desktop.NativeProcess;
+ import flash.desktop.NativeProcessStartupInfo;
+ import flash.events.Event;
+ import flash.events.ProgressEvent;
+ import flash.events.NativeProcessExitEvent;
+ import flash.filesystem.File;
+ import flash.system.Capabilities;
+
+ import mx.core.IFlexModuleFactory;
+ import mx.resources.ResourceManager;
+
+ import org.apache.flex.ant.Ant;
+ import org.apache.flex.ant.tags.supportClasses.TaskHandler;
+
+ [ResourceBundle("ant")]
+ [Mixin]
+ public class Untar extends TaskHandler
+ {
+ public static function init(mf:IFlexModuleFactory):void
+ {
+ Ant.antTagProcessors["untar"] = Untar;
+ }
+
+ public function Untar()
+ {
+ super();
+ }
+
+ private function get src():String
+ {
+ return getAttributeValue("@src");
+ }
+
+ private function get dest():String
+ {
+ return getAttributeValue("@dest");
+ }
+
+ private function get overwrite():Boolean
+ {
+ return getAttributeValue("@overwrite") == "true";
+ }
+
+ private function get compression():String
+ {
+ return getNullOrAttributeValue("@compression");
+ }
+
+ private var destFile:File;
+
+ override public function execute(callbackMode:Boolean, context:Object):Boolean
+ {
+ super.execute(callbackMode, context);
+
+ try {
+ var srcFile:File = File.applicationDirectory.resolvePath(src);
+ }
+ catch (e:Error)
+ {
+ ant.output(src);
+ ant.output(e.message);
+ if (failonerror)
+ {
+ ant.project.failureMessage = e.message;
+ ant.project.status = false;
+ }
+ return true;
+ }
+
+ try {
+ destFile = File.applicationDirectory.resolvePath(dest);
+ if (!destFile.exists)
+ destFile.createDirectory();
+ }
+ catch (e:Error)
+ {
+ ant.output(dest);
+ ant.output(e.message);
+ if (failonerror)
+ {
+ ant.project.failureMessage = e.message;
+ ant.project.status = false;
+ }
+ return true;
+ }
+
+ return untar(srcFile);
+ }
+
+ private var _process:NativeProcess;
+
+ private function untar(source:File):Boolean
+ {
+ if (Capabilities.os.indexOf("Win") != -1)
+ {
+ winUntar(source);
+ return true;
+ }
+
+ var tar:File;
+ var startupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
+ var arguments:Vector.<String> = new Vector.<String>();
+
+ if (Capabilities.os.indexOf("Linux") != -1)
+ tar = new File("/bin/tar");
+ else
+ tar = new File("/usr/bin/tar");
+
+ arguments.push("xf");
+ arguments.push(source.nativePath);
+ arguments.push("-C");
+ arguments.push(destFile.nativePath);
+
+ startupInfo.executable = tar;
+ startupInfo.arguments = arguments;
+
+ var s:String = ResourceManager.getInstance().getString('ant', 'UNZIP');
+ s = s.replace("%1", source.nativePath);
+ s = s.replace("%2", destFile.nativePath);
+ ant.output(ant.formatOutput("untar", s));
+
+ _process = new NativeProcess();
+ _process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, unTarFileProgress);
+ _process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, unTarError);
+ _process.addEventListener(NativeProcessExitEvent.EXIT, unTarComplete);
+ _process.start(startupInfo);
+
+ return false;
+
+ }
+
+ private function unTarError(event:Event):void {
+ var output:String = _process.standardError.readUTFBytes(_process.standardError.bytesAvailable);
+ ant.output(output);
+ if (failonerror)
+ {
+ ant.project.failureMessage = output;
+ ant.project.status = false;
+ }
+ dispatchEvent(new Event(Event.COMPLETE));
+ }
+
+ private function unTarFileProgress(event:Event):void {
+ var output:String = _process.standardOutput.readUTFBytes(_process.standardOutput.bytesAvailable);
+ ant.output(output);
+ }
+
+ private function unTarComplete(event:NativeProcessExitEvent):void {
+ _process.closeInput();
+ _process.exit(true);
+ dispatchEvent(new Event(Event.COMPLETE));
+ }
+
+ private function winUntar(source:File):void
+ {
+ if (compression == "gzip")
+ {
+ var tarName:String = source.nativePath + ".tar";
+ var tarFile:File = File.applicationDirectory.resolvePath(tarName);
+ var gz:GZIPEncoder = new GZIPEncoder();
+ gz.uncompressToFile(source, tarFile);
+ source = tarFile;
+ }
+ var su:SimpleUntar = new SimpleUntar();
+ su.sourcePath = source.nativePath;
+ su.targetPath = destFile.nativePath;
+ su.extract();
+ dispatchEvent(new Event(Event.COMPLETE));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Unzip.as
----------------------------------------------------------------------
diff --git a/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Unzip.as b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Unzip.as
new file mode 100644
index 0000000..f4f385d
--- /dev/null
+++ b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/Unzip.as
@@ -0,0 +1,214 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.ant.tags
+{
+ import flash.events.ErrorEvent;
+ import flash.events.Event;
+ import flash.filesystem.File;
+ import flash.filesystem.FileMode;
+ import flash.filesystem.FileStream;
+ import flash.utils.ByteArray;
+
+ import mx.core.IFlexModuleFactory;
+ import mx.resources.ResourceManager;
+
+ import org.apache.flex.ant.Ant;
+ import org.apache.flex.ant.tags.supportClasses.TaskHandler;
+ import org.apache.flex.xml.ITagHandler;
+ import org.as3commons.zip.Zip;
+ import org.as3commons.zip.ZipEvent;
+ import org.as3commons.zip.ZipFile;
+
+ [ResourceBundle("ant")]
+ [Mixin]
+ public class Unzip extends TaskHandler
+ {
+ public static function init(mf:IFlexModuleFactory):void
+ {
+ Ant.antTagProcessors["unzip"] = Unzip;
+ }
+
+ public function Unzip()
+ {
+ super();
+ }
+
+ private function get src():String
+ {
+ return getAttributeValue("@src");
+ }
+
+ private function get dest():String
+ {
+ return getAttributeValue("@dest");
+ }
+
+ private function get overwrite():Boolean
+ {
+ return getAttributeValue("@overwrite") == "true";
+ }
+
+ private var srcFile:File;
+ private var destFile:File;
+ private var patternSet:PatternSet;
+
+ override public function execute(callbackMode:Boolean, context:Object):Boolean
+ {
+ super.execute(callbackMode, context);
+ if (numChildren > 0)
+ {
+ // look for a patternset
+ for (var i:int = 0; i < numChildren; i++)
+ {
+ var child:ITagHandler = getChildAt(i);
+ if (child is PatternSet)
+ {
+ patternSet = child as PatternSet;
+ patternSet.setContext(context);
+ break;
+ }
+ }
+ }
+
+ try {
+ srcFile = File.applicationDirectory.resolvePath(src);
+ }
+ catch (e:Error)
+ {
+ ant.output(src);
+ ant.output(e.message);
+ if (failonerror)
+ {
+ ant.project.failureMessage = e.message;
+ ant.project.status = false;
+ }
+ return true;
+ }
+
+ try {
+ destFile = File.applicationDirectory.resolvePath(dest);
+ if (!destFile.exists)
+ destFile.createDirectory();
+ }
+ catch (e:Error)
+ {
+ ant.output(dest);
+ ant.output(e.message);
+ if (failonerror)
+ {
+ ant.project.failureMessage = e.message;
+ ant.project.status = false;
+ }
+ return true;
+ }
+
+
+ var s:String = ResourceManager.getInstance().getString('ant', 'UNZIP');
+ s = s.replace("%1", srcFile.nativePath);
+ s = s.replace("%2", destFile.nativePath);
+ ant.output(ant.formatOutput("unzip", s));
+ ant.functionToCall = dounzip;
+ return false;
+ }
+
+ private function dounzip():void
+ {
+ unzip(srcFile);
+ dispatchEvent(new Event(Event.COMPLETE));
+ }
+
+ private function unzip(fileToUnzip:File):void {
+ var zipFileBytes:ByteArray = new ByteArray();
+ var fs:FileStream = new FileStream();
+ var fzip:Zip = new Zip();
+
+ fs.open(fileToUnzip, FileMode.READ);
+ fs.readBytes(zipFileBytes);
+ fs.close();
+
+ fzip.addEventListener(ZipEvent.FILE_LOADED, onFileLoaded);
+ fzip.addEventListener(Event.COMPLETE, onUnzipComplete, false, 0, true);
+ fzip.addEventListener(ErrorEvent.ERROR, onUnzipError, false, 0, true);
+
+ // synchronous, so no progress events
+ fzip.loadBytes(zipFileBytes);
+ }
+
+ private function isDirectory(f:ZipFile):Boolean {
+ if (f.filename.substr(f.filename.length - 1) == "/" || f.filename.substr(f.filename.length - 1) == "\\") {
+ return true;
+ }
+ return false;
+ }
+
+ private function onFileLoaded(e:ZipEvent):void {
+ try {
+ var fzf:ZipFile = e.file;
+ if (patternSet)
+ {
+ if (!(patternSet.matches(fzf.filename)))
+ return;
+ }
+ var f:File = destFile.resolvePath(fzf.filename);
+ var fs:FileStream = new FileStream();
+
+ if (isDirectory(fzf)) {
+ // Is a directory, not a file. Dont try to write anything into it.
+ return;
+ }
+
+ fs.open(f, FileMode.WRITE);
+ fs.writeBytes(fzf.content);
+ fs.close();
+
+ // attempt to shrink bytearray so memory doesn't store every uncompressed byte
+ fzf.setContent(null, false);
+
+ } catch (error:Error) {
+ ant.output(error.message);
+ if (failonerror)
+ {
+ ant.project.failureMessage = error.message;
+ ant.project.status = false;
+ }
+ }
+ }
+
+ private function onUnzipComplete(event:Event):void {
+ var fzip:Zip = event.target as Zip;
+ fzip.close();
+ fzip.removeEventListener(ZipEvent.FILE_LOADED, onFileLoaded);
+ fzip.removeEventListener(Event.COMPLETE, onUnzipComplete);
+ fzip.removeEventListener(ErrorEvent.ERROR, onUnzipError);
+ }
+
+ private function onUnzipError(event:Event):void {
+ var fzip:Zip = event.target as Zip;
+ fzip.close();
+ fzip.removeEventListener(ZipEvent.FILE_LOADED, onFileLoaded);
+ fzip.removeEventListener(Event.COMPLETE, onUnzipComplete);
+ fzip.removeEventListener(ErrorEvent.ERROR, onUnzipError);
+ if (failonerror)
+ {
+ ant.project.failureMessage = event.toString();
+ ant.project.status = false;
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/XmlProperty.as
----------------------------------------------------------------------
diff --git a/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/XmlProperty.as b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/XmlProperty.as
new file mode 100644
index 0000000..c7c5b03
--- /dev/null
+++ b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/XmlProperty.as
@@ -0,0 +1,118 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.ant.tags
+{
+ import flash.filesystem.File;
+ import flash.filesystem.FileMode;
+ import flash.filesystem.FileStream;
+
+ import mx.core.IFlexModuleFactory;
+
+ import org.apache.flex.ant.Ant;
+ import org.apache.flex.ant.tags.supportClasses.TaskHandler;
+
+ [Mixin]
+ public class XmlProperty extends TaskHandler
+ {
+ public static function init(mf:IFlexModuleFactory):void
+ {
+ Ant.antTagProcessors["xmlproperty"] = XmlProperty;
+ }
+
+ public function XmlProperty()
+ {
+ }
+
+ override public function execute(callbackMode:Boolean, context:Object):Boolean
+ {
+ super.execute(callbackMode, context);
+
+ try {
+ var f:File = new File(fileName);
+ }
+ catch (e:Error)
+ {
+ ant.output(fileName);
+ ant.output(e.message);
+ if (failonerror)
+ {
+ ant.project.failureMessage = e.message;
+ ant.project.status = false;
+ }
+ return true;
+ }
+
+ var fs:FileStream = new FileStream();
+ fs.open(f, FileMode.READ);
+ var data:String = fs.readUTFBytes(fs.bytesAvailable);
+ var xml:XML = XML(data);
+ createProperties(xml, xml.name());
+ fs.close();
+ return true;
+ }
+
+ private function createProperties(xml:XML, prefix:String):void
+ {
+ var children:XMLList = xml.*;
+ for each (var node:XML in children)
+ {
+ var val:String;
+ var key:String;
+ if (node.nodeKind() == "text")
+ {
+ key = prefix;
+ val = node.toString();
+ if (!context.hasOwnProperty(key))
+ context[key] = val;
+ }
+ else if (node.nodeKind() == "element")
+ {
+ key = prefix + "." + node.name();
+ var id:String = node.@id.toString();
+ if (id)
+ ant.project.refids[id] = key;
+ createProperties(node, key);
+ }
+ }
+ if (collapse)
+ {
+ var attrs:XMLList = xml.attributes();
+ var n:int = attrs.length();
+ for (var i:int = 0; i < n; i++)
+ {
+ key = prefix + "." + attrs[i].name();
+ val = xml.attribute(attrs[i].name()).toString();
+ if (!context.hasOwnProperty(key))
+ context[key] = val;
+ }
+ }
+ }
+
+ private function get fileName():String
+ {
+ return getAttributeValue("@file");
+ }
+
+ private function get collapse():Boolean
+ {
+ return getAttributeValue("@collapseAttributes") == "true";
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/Character.as
----------------------------------------------------------------------
diff --git a/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/Character.as b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/Character.as
new file mode 100644
index 0000000..d2b6b87
--- /dev/null
+++ b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/Character.as
@@ -0,0 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.ant.tags.filesetClasses
+{
+ public class Character
+ {
+ public function Character()
+ {
+ super();
+ }
+
+ public static function isLetter(c:String):Boolean
+ {
+ return "a" <= c && c <= "z" ||
+ "A" <= c && c <= "Z";
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/CollectionUtils.as
----------------------------------------------------------------------
diff --git a/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/CollectionUtils.as b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/CollectionUtils.as
new file mode 100644
index 0000000..0717a4e
--- /dev/null
+++ b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/CollectionUtils.as
@@ -0,0 +1,41 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.ant.tags.filesetClasses
+{
+ public class CollectionUtils
+ {
+ public function CollectionUtils()
+ {
+ super();
+ }
+
+ private static var target:String;
+
+ private static function callback(item:String, index:int, list:Vector.<String>):Boolean
+ {
+ return CollectionUtils.target == item;
+ }
+
+ public static function frequency(list:Vector.<String>, c:String):int
+ {
+ target = c;
+ return list.filter(callback).length;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/f954e6f6/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/DataType.as
----------------------------------------------------------------------
diff --git a/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/DataType.as b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/DataType.as
new file mode 100644
index 0000000..16acca7
--- /dev/null
+++ b/flex-installer/ant_on_air/src/org/apache/flex/ant/tags/filesetClasses/DataType.as
@@ -0,0 +1,330 @@
+/*
+* 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.ant.tags.filesetClasses
+{
+ import flash.system.ApplicationDomain;
+ import flash.utils.getQualifiedClassName;
+
+ import org.apache.flex.ant.Ant;
+ import org.apache.flex.ant.tags.Project;
+ import org.apache.flex.ant.tags.filesetClasses.exceptions.BuildException;
+
+ /**
+ * Ported from org.apache.tools.ant.types.DataType.java on 12/3/13
+ * Base class for those classes that can appear inside the build file
+ * as stand alone data types.
+ *
+ * <p>This class handles the common description attribute and provides
+ * a default implementation for reference handling and checking for
+ * circular references that is appropriate for types that can not be
+ * nested inside elements of the same type (i.e. <patternset>
+ * but not <path>).</p>
+ *
+ */
+ public class DataType
+ {
+ // CheckStyle:VisibilityModifier OFF
+
+ /**
+ * Value to the refid attribute.
+ *
+ * @deprecated since 1.7.
+ * The user should not be directly referencing
+ * variable. Please use {@link #getRefid} instead.
+ */
+ protected var ref:Reference;
+
+ /**
+ * Are we sure we don't hold circular references?
+ *
+ * <p>Subclasses are responsible for setting this value to false
+ * if we'd need to investigate this condition (usually because a
+ * child element has been added that is a subclass of
+ * DataType).</p>
+ *
+ * @deprecated since 1.7.
+ * The user should not be directly referencing
+ * variable. Please use {@link #setChecked} or
+ * {@link #isChecked} instead.
+ */
+ protected var checked:Boolean = true;
+ // CheckStyle:VisibilityModifier ON
+
+ /**
+ * Has the refid attribute of this element been set?
+ * @return true if the refid attribute has been set
+ */
+ public function isReference():Boolean
+ {
+ return ref != null;
+ }
+
+ /**
+ * Set the value of the refid attribute.
+ *
+ * <p>Subclasses may need to check whether any other attributes
+ * have been set as well or child elements have been created and
+ * thus override this method. if they do the must call
+ * <code>super.setRefid</code>.</p>
+ * @param ref the reference to use
+ */
+ public function setRefid(ref:Reference):void
+ {
+ this.ref = ref;
+ checked = false;
+ }
+
+ /**
+ * Gets as descriptive as possible a name used for this datatype instance.
+ * @return <code>String</code> name.
+ */
+ protected function getDataTypeName():String
+ {
+ return "DataType";
+ }
+
+ /**
+ * Check to see whether any DataType we hold references to is
+ * included in the Stack (which holds all DataType instances that
+ * directly or indirectly reference this instance, including this
+ * instance itself).
+ *
+ * <p>If one is included, throw a BuildException created by {@link
+ * #circularReference circularReference}.</p>
+ *
+ * <p>This implementation is appropriate only for a DataType that
+ * cannot hold other DataTypes as children.</p>
+ *
+ * <p>The general contract of this method is that it shouldn't do
+ * anything if {@link #checked <code>checked</code>} is true and
+ * set it to true on exit.</p>
+ * @param stack the stack of references to check.
+ * @param project the project to use to dereference the references.
+ * @throws BuildException on error.
+ */
+ protected function dieOnCircularReference(stack:Vector.<String> = null, project:Project = null):void
+ {
+ if (!project)
+ project = Ant.currentAnt.project;
+
+ if (!stack)
+ stack = new Vector.<String>();
+
+ if (checked || !isReference()) {
+ return;
+ }
+ var o:Object = ref.getReferencedObject(project);
+
+ if (o is DataType) {
+ if (stack.indexOf(o) != -1) {
+ throw circularReference();
+ } else {
+ stack.push(o);
+ DataType(o).dieOnCircularReference(Vector.<String>([id]), project);
+ stack.pop();
+ }
+ }
+ checked = true;
+ }
+
+ /**
+ * Allow DataTypes outside org.apache.tools.ant.types to indirectly call
+ * dieOnCircularReference on nested DataTypes.
+ * @param dt the DataType to check.
+ * @param stk the stack of references to check.
+ * @param p the project to use to dereference the references.
+ * @throws BuildException on error.
+ * @since Ant 1.7
+ */
+ public static function invokeCircularReferenceCheck(dt:DataType, stk:Vector.<String>,
+ p:Project):void
+ {
+ dt.dieOnCircularReference(stk, p);
+ }
+
+ /**
+ * Allow DataTypes outside org.apache.tools.ant.types to indirectly call
+ * dieOnCircularReference on nested DataTypes.
+ *
+ * <p>Pushes dt on the stack, runs dieOnCircularReference and pops
+ * it again.</p>
+ * @param dt the DataType to check.
+ * @param stk the stack of references to check.
+ * @param p the project to use to dereference the references.
+ * @throws BuildException on error.
+ * @since Ant 1.8.0
+ */
+ public static function pushAndInvokeCircularReferenceCheck(dt:DataType,
+ stk:Vector.<String>,
+ p:Project):void
+ {
+ stk.push(dt);
+ dt.dieOnCircularReference(stk, p);
+ stk.pop();
+ }
+
+ /**
+ * Performs the check for circular references and returns the
+ * referenced object.
+ * @param p the Ant Project instance against which to resolve references.
+ * @return the dereferenced object.
+ * @throws BuildException if the reference is invalid (circular ref, wrong class, etc).
+ * @since Ant 1.7
+ */
+ protected function getCheckedRef(p:Project = null):Object
+ {
+ if (!p)
+ p = Ant.currentAnt.project;
+ return getCheckedRefActual(Class(ApplicationDomain.currentDomain.getDefinition(getQualifiedClassName(this))),
+ getDataTypeName(), p);
+ }
+
+ /**
+ * Performs the check for circular references and returns the
+ * referenced object. This version allows the fallback Project instance to be specified.
+ * @param requiredClass the class that this reference should be a subclass of.
+ * @param dataTypeName the name of the datatype that the reference should be
+ * (error message use only).
+ * @param project the fallback Project instance for dereferencing.
+ * @return the dereferenced object.
+ * @throws BuildException if the reference is invalid (circular ref, wrong class, etc),
+ * or if <code>project</code> is <code>null</code>.
+ * @since Ant 1.7
+ */
+ protected function getCheckedRefActual(requiredClass:Class,
+ dataTypeName:String, project:Project):Object {
+ if (project == null) {
+ throw new BuildException("No Project specified");
+ }
+ dieOnCircularReference(null, project);
+ var o:Object = ref.getReferencedObject(project);
+ var oClass:Class = ApplicationDomain.currentDomain.getDefinition(getQualifiedClassName(o)) as Class;
+ if (!(requiredClass is oClass)) {
+ Ant.log("Class " + oClass + " is not a subclass of " + requiredClass,
+ Project.MSG_VERBOSE);
+ var msg:String = ref.getRefId() + " doesn\'t denote a " + dataTypeName;
+ throw new BuildException(msg);
+ }
+ return o;
+ }
+
+ /**
+ * Creates an exception that indicates that refid has to be the
+ * only attribute if it is set.
+ * @return the exception to throw
+ */
+ protected function tooManyAttributes():BuildException
+ {
+ return new BuildException("You must not specify more than one "
+ + "attribute when using refid");
+ }
+
+ /**
+ * Creates an exception that indicates that this XML element must
+ * not have child elements if the refid attribute is set.
+ * @return the exception to throw
+ */
+ protected function noChildrenAllowed():BuildException
+ {
+ return new BuildException("You must not specify nested elements "
+ + "when using refid");
+ }
+
+ /**
+ * Creates an exception that indicates the user has generated a
+ * loop of data types referencing each other.
+ * @return the exception to throw
+ */
+ protected function circularReference():BuildException
+ {
+ return new BuildException("This data type contains a circular "
+ + "reference.");
+ }
+
+ /**
+ * The flag that is used to indicate that circular references have been checked.
+ * @return true if circular references have been checked
+ */
+ protected function isChecked():Boolean
+ {
+ return checked;
+ }
+
+ /**
+ * Set the flag that is used to indicate that circular references have been checked.
+ * @param checked if true, if circular references have been checked
+ */
+ protected function setChecked(checked:Boolean):void
+ {
+ this.checked = checked;
+ }
+
+ /**
+ * get the reference set on this object
+ * @return the reference or null
+ */
+ public function getRefid():Reference
+ {
+ return ref;
+ }
+
+ /**
+ * check that it is ok to set attributes, i.e that no reference is defined
+ * @since Ant 1.6
+ * @throws BuildException if not allowed
+ */
+ protected function checkAttributesAllowed():void
+ {
+ if (isReference()) {
+ throw tooManyAttributes();
+ }
+ }
+
+ /**
+ * check that it is ok to add children, i.e that no reference is defined
+ * @since Ant 1.6
+ * @throws BuildException if not allowed
+ */
+ protected function checkChildrenAllowed():void
+ {
+ if (isReference()) {
+ throw noChildrenAllowed();
+ }
+ }
+
+ /**
+ * Basic DataType toString().
+ * @return this DataType formatted as a String.
+ */
+ public function toString():String {
+ var d:String = getDescription();
+ return d == null ? getDataTypeName() : getDataTypeName() + " " + d;
+ }
+
+ /**
+ * Basic description
+ */
+ public function getDescription():String
+ {
+ return null;
+ }
+
+ public var id:String;
+ }
+}