| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332 |
- <?xml version="1.0" encoding="UTF-8"?>
- <project basedir="../../." name="p5ant.safety"
- xmlns:p5ant="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache.public/ant/ant.xsd"
- >
-
-
-
- <description> safety functions to protect system failures etc </description>
-
- <include file="build.p5ant.safety.PRODUCT.xml" as="PRODUCT"/>
- <include file="../system_ui_info_speech/build.system_ui_info_speech.PRODUCT.xml" as="p5suis"/>
- <include file="../apple/build_apple.xml" as="p5apl" optional="yes"/>
- <!--<include file="build_ant.xml" optional="true" as="build_ant"/>-->
- <!--<import file="build_ant.xml" optional="yes" as="p5ant"/>-->
-
-
-
- <target name="open_file.input">
- <input addproperty="local.p5ant.safety.limit.file.size__x3A__open_file" message="local.p5ant.safety.limit.file.size__x3A__open_file" defaultvalue="${p5ant.safety.limit.file.size__x3A__open_file}"/>
- <input addproperty="local.p5ant.safety.limit.file.size__x3A__open_file.units" message="local.p5ant.safety.limit.file.size__x3A__open_file.units [M], [k], [G]" defaultvalue="${p5ant.safety.limit.file.size__x3A__open_file.units}" />
- <input addproperty="local.p5ant.safety.filename" message="local.p5ant.safety.filename" />
- <property name="local.p5apl.terminal-notifier.open" value="${local.p5ant.safety.filename}"/>
- </target>
-
- <target name="limit.file.size__x3A__open_file.if_not_exists.condition">
- <condition property="limit.file.size__x3A__open_file.if_not_exists">
- <available file="${local.p5ant.safety.filename}"/>
- </condition>
- </target>
-
- <target name="limit.file.size__x3A__open_file.if_not_exists" if="limit.file.size__x3A__open_file.if_not_exists">
- <property name="local.p5apl.terminal-notifier.message" value="Brak oczekiwanego pliku do otwarcia ${local.p5ant.safety.filename}"/>
- <property name="local.p5apl.terminal-notifier.title" value="p5ant.safety"/>
- <property name="local.p5apl.terminal-notifier.subtitle" value="file not exists "/>
- <property name="limit.file.size__x3A__open_file__x3A__deny_flag" value="denied by limit.file.size__x3A__open_file.if_not_exists ${local.p5apl.terminal-notifier.message}"/>
- <echo>#32 [ S A F E T Y ] [ F I L E N O T E X I S T S ]
- $limit.file.size__x3A__open_file.if_not_exists = ${limit.file.size__x3A__open_file.if_not_exists}
- $local.p5apl.terminal-notifier.message = ${local.p5apl.terminal-notifier.message}
- </echo>
- <ant antfile="${p5suis.build}" target="p5suis:say_to_queue.PL">
- <property name="p5suis:say_text" value="${local.p5apl.terminal-notifier.message}"/>
- </ant>
- </target>
-
-
-
- <target name="limit.file.size__x3A__open_file.if_exceeded" unless="limit.file.size__x3A__open_file.if_not_exists">
- <input addproperty="local.p5ant.safety.filename" message="local.p5ant.safety.filename type!"/>
- <input addproperty="local.p5ant.safety.limit.file.size__x3A__open_file.units" message="local.p5ant.safety.limit.file.size__x3A__open_file.units" defaultvalue="${p5ant.safety.limit.file.size__x3A__open_file.units}" />
- <input addproperty="local.p5ant.safety.limit.file.size__x3A__open_file" message="local.p5ant.safety.limit.file.size__x3A__open_file" defaultvalue="${p5ant.safety.limit.file.size__x3A__open_file}"/>
-
-
- <fileset id="limit.file.size__x3A__open_file.if_exceeded.fileset" file="${local.p5ant.safety.filename}">
- <size value="${local.p5ant.safety.limit.file.size__x3A__open_file}" units="${local.p5ant.safety.limit.file.size__x3A__open_file.units}" when="more"/>
- </fileset>
-
- <property name="limit.file.size__x3A__open_file.if_exceeded.fileset" refid="limit.file.size__x3A__open_file.if_exceeded.fileset"/>
-
- <length property="local.p5ant.safety.filename.length" file="${local.p5ant.safety.filename}" />
- <condition property="limit.file.size__x3A__open_file.if_exceeded" value="is exceeded file : ${limit.file.size__x3A__open_file.if_exceeded.fileset} ">
- <!--<istrue value="${local.p5ant.safety.filename.length}"/>-->
- <and>
- <contains string="${local.p5ant.safety.filename}" substring="${limit.file.size__x3A__open_file.if_exceeded.fileset}"/>
- <not>
- <equals arg1="${limit.file.size__x3A__open_file.if_exceeded.fileset}" arg2="" />
- </not>
- </and>
- <!--<isset property="limit.file.size__x3A__open_file.if_exceeded.fileset"/>-->
- </condition>
- <condition property="limit.file.size__x3A__open_file__x3A__deny_flag" value="is exceeded file : ${limit.file.size__x3A__open_file.if_exceeded.fileset}">
- <and>
- <contains string="${local.p5ant.safety.filename}" substring="${limit.file.size__x3A__open_file.if_exceeded.fileset}"/>
- <not>
- <equals arg1="${limit.file.size__x3A__open_file.if_exceeded.fileset}" arg2="" />
- </not>
- </and>
- </condition>
- <echo> #30 [? C O N D I T I O N ?] results:
- [ $limit.file.size__x3A__open_file.if_exceeded = ${limit.file.size__x3A__open_file.if_exceeded} ]
- [ $local.p5ant.safety.limit.file.size__x3A__open_file.units = ${local.p5ant.safety.limit.file.size__x3A__open_file.units} ]
- [ $limit.file.size__x3A__open_file.if_exceeded.fileset = ${limit.file.size__x3A__open_file.if_exceeded.fileset} ]
- [ $limit.file.size__x3A__open_file__x3A__deny_flag = ${limit.file.size__x3A__open_file__x3A__deny_flag} ]
- </echo>
- </target>
-
- <target name="limit.file.size__x3A__open_file.rename" if="limit.file.size__x3A__open_file.if_exceeded">
- <input addproperty="local.p5ant.safety.filename" message="local.p5ant.safety.filename type!"/>
- <property name="local.p5ant.safety.filename.rename" value="${local.p5ant.safety.filename}${p5ant.safety.limit.file.size.exceeded.suffix}"/>
- <property name="limit.file__x3A__open_file.if_exceeded" value="size exceeded"/>
- <echo>#34[ S A F E T Y R E N A M E ] = [!! F I L E T O O B I G = ${local.p5ant.safety.filename.length} !!!!] !!!!!!!!!!!!!!!!!!!!
- from $local.p5ant.safety.filename ${local.p5ant.safety.filename}
- to $local.p5ant.safety.filename.rename ${local.p5ant.safety.filename.rename}
-
- SET $limit.file__x3A__open_file.if_exceeded to ${limit.file__x3A__open_file.if_exceeded}
-
- </echo>
- <move file="${local.p5ant.safety.filename}" tofile="${local.p5ant.safety.filename.rename}" verbose="true"/>
- </target>
-
- <target name="limit.file.size__x3A__open_file.notify" if="limit.file.size__x3A__open_file.if_exceeded"> <!-- limit.file.size__x3A__open_file.if_exceeded -->
- <echo>#71 [ N O T I F Y ] $limit.file.size__x3A__open_file.if_exceeded = ${limit.file.size__x3A__open_file.if_exceeded} </echo>
- <property name="local.p5apl.terminal-notifier.message" value="safety limit wielkości pliku przekroczony w celu jego otwarcia dla pliku p5:file"/>
- <property name="local.p5apl.terminal-notifier.title" value="p5ant.safety"/>
- <property name="local.p5apl.terminal-notifier.subtitle" value="size limit exceeded"/>
- <ant antfile="${p5suis.build}" target="p5suis:say_to_queue.PL">
- <property name="p5suis:say_text" value="safety limit wielkości pliku przekroczony w celu jego otwarcia dla pliku p5:file ${local.p5ant.safety.filename} .
- Wielkość pliku to ${local.p5ant.safety.filename.length} .
- Następuje zmiana nazwy na p5:file ${local.p5ant.safety.filename.rename} .
- "/>
- </ant>
-
- </target>
-
- <target name="limit__x3A__open_file.sleep" if="limit.file__x3A__open_file.if_exceeded">
- <echo>#34 S A F E T Y S L E E P (TODO) by @if $limit.file__x3A__open_file.if_exceeded = ${limit.file__x3A__open_file.if_exceeded}
- will sleeping 5 seconds..
- </echo>
- <sleep seconds="1"/>
- <echo>....5</echo>
- <sleep seconds="1"/>
- <echo>....4</echo>
- <sleep seconds="1"/>
- <echo>....3</echo>
- <sleep seconds="1"/>
- <echo>....2</echo>
- <sleep seconds="1"/>
- <echo>....1</echo>
- <sleep seconds="1"/>
- <echo>....0</echo>
- </target>
-
-
- <extension-point name="say_and_describe_file" depends="say_and_describe_file__x3A__controller" description="to just describe file size and say its contents"/>
- <extension-point name="say_and_describe_file__x3A__controller" depends="say_and_open_file.input,
- limit.file.size__x3A__open_file.if_not_exists,
- describe_file__x3A__size,
- say_and_describe_file.warning,
- say_and_open_file.action,
- say_and_open_file.drop_overflow.action" />
-
- <target name="say_and_describe_file.warning" if="describe_file__x3A__size__x3A__warning_flag">
- <property name="local.p5apl.terminal-notifier.message" value="Uwaga nieoczekiwana wielkośc pliku ${local.p5ant.safety.filename} "/>
- <property name="local.p5apl.terminal-notifier.title" value="wytworzonego pliku "/>
- <property name="local.p5apl.terminal-notifier.subtitle" value=" wielkość ${local.p5ant.safety.filename.length}"/>
-
- <ant antfile="${p5suis.build}" target="p5suis:say_to_queue.PL">
- <property name="p5suis:say_text" value="${local.p5apl.terminal-notifier.message} ${local.p5apl.terminal-notifier.title} ${local.p5apl.terminal-notifier.subtitle}"/>
- </ant>
- <echo>#149 sayed [ W A R N I N G ] $describe_file__x3A__size__x3A__warning_flag ${describe_file__x3A__size__x3A__warning_flag}</echo>
- </target>
-
- <target name="describe_file__x3A__size" >
- <input addproperty="local.p5ant.safety.filename" message="local.p5ant.safety.filename type!"/>
- <input addproperty="local.p5ant.safety.limit.file.size__x3A__open_file.units" message="local.p5ant.safety.limit.file.size__x3A__open_file.units" defaultvalue="${p5ant.safety.limit.file.size__x3A__open_file.units}" />
- <input addproperty="local.p5ant.safety.limit.file.size__x3A__open_file" message="local.p5ant.safety.limit.file.size__x3A__open_file" defaultvalue="${p5ant.safety.limit.file.size__x3A__open_file}"/>
-
-
- <fileset id="describe_file__x3A__size.if_exceeded.fileset" file="${local.p5ant.safety.filename}">
- <size value="${local.p5ant.safety.limit.file.size__x3A__open_file}" units="${local.p5ant.safety.limit.file.size__x3A__open_file.units}" when="more"/>
- </fileset>
-
- <property name="describe_file__x3A__size.if_exceeded.fileset" refid="describe_file__x3A__size.if_exceeded.fileset"/>
-
- <length property="local.p5ant.safety.filename.length" file="${local.p5ant.safety.filename}" />
- <condition property="describe_file__x3A__size.if_exceeded" value="is exceeded file : ${describe_file__x3A__size.if_exceeded.fileset} ">
- <!--<istrue value="${local.p5ant.safety.filename.length}"/>-->
- <and>
- <contains string="${local.p5ant.safety.filename}" substring="${describe_file__x3A__size.if_exceeded.fileset}"/>
- <not>
- <equals arg1="${limit.file.size__x3A__open_file.if_exceeded.fileset}" arg2="" />
- </not>
- </and>
- <!--<isset property="limit.file.size__x3A__open_file.if_exceeded.fileset"/>-->
- </condition>
- <condition property="describe_file__x3A__size__x3A__warning_flag" value="is exceeded file : ${describe_file__x3A__size.if_exceeded.fileset}">
- <and>
- <contains string="${local.p5ant.safety.filename}" substring="${describe_file__x3A__size.if_exceeded.fileset}"/>
- <not>
- <equals arg1="${describe_file__x3A__size.if_exceeded.fileset}" arg2="" />
- </not>
- </and>
- </condition>
- <echo> #17- [? C O N D I T I O N ?] results:
- [ $describe_file__x3A__size.if_exceeded = ${describe_file__x3A__size.if_exceeded} ]
- [ $local.p5ant.safety.limit.file.size__x3A__open_file.units = ${local.p5ant.safety.limit.file.size__x3A__open_file.units} ]
- [ $describe_file__x3A__size.if_exceeded.fileset = ${describe_file__x3A__size.if_exceeded.fileset} ]
- [ $describe_file__x3A__size__x3A__warning_flag = ${describe_file__x3A__size__x3A__warning_flag} ]
- [ $local.p5apl.terminal-notifier.group = ${local.p5apl.terminal-notifier.group} ] - nice to set!!!
- </echo>
- </target>
-
- <extension-point name="say_and_open_file" depends="say_and_open_file.input, open_file" />
- <extension-point name="say_and_open_file.drop_overflow" depends="say_and_open_file.drop_overflow.input, open_file"/>
-
- <target name="say_and_open_file.input">
- <property name="local.say_and_open_file" value="open and say "/>
- <echo>+ [ $local.say_and_open_file = ${local.say_and_open_file} ]</echo>
- </target>
-
- <target name="say_and_open_file.drop_overflow.input">
- <property name="local.say_and_open_file.drop_overflow" value="open and say with drop overflow"/>
- <echo>+ [ $local.say_and_open_file.drop_overflow = ${local.say_and_open_file.drop_overflow} ]</echo>
- </target>
-
-
-
-
-
- <target name="say_and_open_file.action" if="local.say_and_open_file" unless="limit.file.size__x3A__open_file__x3A__deny_flag" >
- <ant antfile="${p5suis.build}" target="p5suis.say_to_queue.copy_file">
- <property name="p5suis.say_to_queue.copy_file" value="${local.p5ant.safety.filename}"/>
- </ant>
- </target>
-
- <target name="say_and_open_file.drop_overflow.action" if="local.say_and_open_file.drop_overflow" unless="limit.file.size__x3A__open_file__x3A__deny_flag" >
- <echo>#121 + [ c o p y o v e r f l o w s a y ] </echo>
- <ant antfile="${p5suis.build}" target="p5suis.say_to_queue.copy_file.drop_overflow">
- <property name="p5suis.say_to_queue.copy_file" value="${local.p5ant.safety.filename}"/>
- </ant>
- </target>
-
-
-
- <target name="open_file__x3A__opened" if="open_file__x3A__opened">
- <echo level="info">#128-166 [ O P E N F I L E ] [ O K ] controller $open_file__x3A__opened = ${open_file__x3A__opened}
- </echo>
- </target>
-
- <target name="open_file__x3A__error" unless="open_file__x3A__opened">
- <echo level="error">#128 there is not aviable any function to UI open file -
- $open_file__x3A__opened ${open_file__x3A__opened}
- [ open_file__x3A__p5apl.terminal-notifier ]
- [ open_file__x3A__p5apl.open ]
- </echo>
- </target>
-
- <extension-point name="open_file__x3A__p5apl.open" />
-
- <extension-point name="open_file__x3A__p5apl.terminal-notifier" />
-
- <extension-point name="open_file" unless="limit.file.size__x3A__open_file__x3A__deny_flag" description="to safe open file when it not exceeds $p5ant.safety.limit.file.size__x3A__open_file"
- depends="open_file.input,
- limit.file.size__x3A__open_file.if_not_exists,
- limit.file.size__x3A__open_file.if_exceeded,
- limit.file.size__x3A__open_file.rename,
- limit.file.size__x3A__open_file.notify,
- limit__x3A__open_file.sleep,
- say_and_open_file.action,
- say_and_open_file.drop_overflow.action,
- limit.file.size__x3A__open_file.message,
- open_file__x3A__p5apl.terminal-notifier,
- open_file__x3A__p5apl.open,
- open_file__x3A__error,
- open_file__x3A__opened
- "/>
-
-
-
-
- <target name="limit.file.size__x3A__open_file.message" unless="limit.file.size__x3A__open_file__x3A__deny_flag" description="to safe open file when it not exceeds $p5ant.safety.limit.file.size__x3A__open_file">
- <basename property="local.p5ant.safety.filename.basename" file="${local.p5ant.safety.filename}"/>
-
- <property name="local.p5apl.terminal-notifier.message" value="otworz plik ${local.p5ant.safety.filename.basename} "/>
- <property name="local.p5apl.terminal-notifier.title" value="plik gotowy do otwarcia"/>
- <property name="local.p5apl.terminal-notifier.subtitle" value="kliknij na link"/>
- <echo level="info">#18 [ S A F E O P E N F I L E ] = [== F I L E I S S A F E T O O P E N ==]=
- LIMIT $local.p5ant.safety.filename.length = ${local.p5ant.safety.filename.length} tested against ${local.p5ant.safety.limit.file.size__x3A__open_file} ($local.p5ant.safety.limit.file.size__x3A__open_file)
- RESULT $local.p5ant.safety.filename = ${local.p5ant.safety.filename}
-
- $local.p5ant.safety.filename.length = ${local.p5ant.safety.filename.length}
- $limit.file.size__x3A__open_file.if_exceeded ${limit.file.size__x3A__open_file.if_exceeded}
- + $local.p5apl.terminal-notifier.message = ${local.p5apl.terminal-notifier.message}
- </echo>
- <ant antfile="${p5suis.build}" target="p5suis:say_to_queue.PL.drop_overflow">
- <property name="p5suis:say_text" value=" gotowy do otwarcia plik p5:file ${local.p5ant.safety.filename} o oczekiwanej p5:size ${local.p5ant.safety.filename.length} , mniejszej od limitu p5:size__x3A__unit ${local.p5ant.safety.limit.file.size__x3A__open_file}__x3A__${local.p5ant.safety.limit.file.size__x3A__open_file.units} . "/>
- </ant>
-
- <!--<exec executable="open">
- <arg file="${local.p5ant.safety.filename}"/>
- </exec>-->
- </target>
-
-
- <target name="antcall" description="to get some notifications about task finished or not finished ">
- <description>will use properties and if not success ge wont set some flag - thus ntoficiation will occur</description>
- <input addproperty="local.ant.safety.task.complete.output" message="local.ant.safety.task.complete.output" defaultvalue="local.ant.safety.task.complete.output"/>
-
- <tempfile id="local.ant.safety.output__analyze.temp" property="local.ant.safety.output__analyze.temp" prefix="local.ant.safety.output__analyze.temp" suffix="log"/>
- <echo> #2444 try to look at $local.ant.safety.task.complete.output ${local.ant.safety.task.complete.output} and parse? </echo>
-
- </target>
-
-
-
-
- <extension-point name="open_dir" description="to verify dir exists or error messages"
- depends="open_dir.input , open_dir.if_not_exists, open_dir.if_not_exists.error , say_and_open_dir, p5apl.terminal-notifier.notify"
- />
-
- <target name="open_dir.input">
- <input addproperty="local.p5ant.safety.filename" message="local.p5ant.safety.filename - dir " />
- <property name="local.p5apl.terminal-notifier.open" value="${local.p5ant.safety.filename}"/>
- </target>
-
- <target name="open_dir.if_not_exists">
- <condition property="open_dir.if_not_exists">
- <not><available file="${local.p5ant.safety.filename}"></available></not>
- </condition>
- </target>
-
- <target name="open_dir.if_not_exists.error" if="open_dir.if_not_exists">
- <echo>#245 [ N O T I F Y ] $open_dir.if_not_exists ${open_dir.if_not_exists} </echo>
- <property name="local.p5apl.terminal-notifier.message" value="oczekiwany katalog nie istnieje"/>
- <property name="local.p5apl.terminal-notifier.title" value="p5ant.open_dir"/>
- <property name="local.p5apl.terminal-notifier.subtitle" value="dir not exists"/>
-
- <ant antfile="${p5suis.build}" target="p5suis:say_to_queue.PL">
- <property name="p5suis:say_text" value="Oczekiwany katalog p5:file ${open_dir.if_not_exists} nie istnieje."/>
- </ant>
- </target>
- <target name="say_and_open_dir" unless="open_dir.if_not_exists" >
- <echo>#245-OK [ N O T I F Y ] ready to open dir ${local.p5ant.safety.filename} </echo>
- <ant antfile="${p5suis.build}" target="p5suis:say_to_queue.PL">
- <property name="p5suis:say_text" value="Oczekiwany katalog p5:file ${open_dir.if_not_exists} gotowy do otwarcia."/>
- </ant>
- <property name="local.p5apl.terminal-notifier.message" value="akcja otwarcia katalogu możliwa"/>
- <property name="local.p5apl.terminal-notifier.title" value="p5ant.open_dir"/>
- <property name="local.p5apl.terminal-notifier.subtitle" value="OK dir exists ;-)"/>
- </target>
-
- </project>
|