Commit 064d2ecdb3a9a8ad1cbcd9cfd5b2908e775fd17c

Authored by Suraputt Suntimitr
1 parent e52d5f35

AFDemo_Template

Showing 43 changed files with 1657 additions and 0 deletions   Show diff stats
AF-Demo/.classpath 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<classpath>
  3 + <classpathentry kind="src" path="src"/>
  4 + <classpathentry kind="lib" path="lib/gson-2.2.2.jar"/>
  5 + <classpathentry kind="lib" path="lib/XMLParser.jar"/>
  6 + <classpathentry kind="lib" path="lib/ec02_library_V3.2.0.jar"/>
  7 + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  8 + <classpathentry kind="output" path="bin"/>
  9 +</classpath>
... ...
AF-Demo/.project 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>AFDemo</name>
  4 + <comment></comment>
  5 + <projects>
  6 + </projects>
  7 + <buildSpec>
  8 + <buildCommand>
  9 + <name>org.eclipse.jdt.core.javabuilder</name>
  10 + <arguments>
  11 + </arguments>
  12 + </buildCommand>
  13 + </buildSpec>
  14 + <natures>
  15 + <nature>org.eclipse.jdt.core.javanature</nature>
  16 + </natures>
  17 +</projectDescription>
... ...
AF-Demo/.settings/org.eclipse.jdt.core.prefs 0 → 100644
... ... @@ -0,0 +1,12 @@
  1 +#Tue Feb 11 08:46:18 ICT 2014
  2 +eclipse.preferences.version=1
  3 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
  4 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
  5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
  6 +org.eclipse.jdt.core.compiler.compliance=1.6
  7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate
  8 +org.eclipse.jdt.core.compiler.debug.localVariable=generate
  9 +org.eclipse.jdt.core.compiler.debug.sourceFile=generate
  10 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
  11 +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
  12 +org.eclipse.jdt.core.compiler.source=1.6
... ...
AF-Demo/bin/.gitignore 0 → 100644
... ... @@ -0,0 +1 @@
  1 +/af/
... ...
AF-Demo/conf/AF_E01_20131111 0 → 100644
... ... @@ -0,0 +1 @@
  1 +<t>DATA</t><0>TEST</0><1>def</1><2>def</2><3>def</3><4>def</4><d>SUCCESS</d>
... ...
AF-Demo/conf/af/AF.E00.x.0 0 → 100644
... ... @@ -0,0 +1,24 @@
  1 +<?xml version="1.0" encoding="tis-620"?>
  2 +
  3 +<configuration>
  4 + <cold>
  5 + <HomeDirectory value="/opt/equinox"/>
  6 + <Listener port="5050" backlog="256"/>
  7 + <sf group="AF" service="x" instance="0"/>
  8 + </cold>
  9 + <warm>
  10 + <SFLOG value="FATAL|ERROR|WARN|INFO|DEBUG"/>
  11 + <StatInterval value="10"/>
  12 + <HousekeeperInterval value="30"/>
  13 + <RestartDelay value="10"/>
  14 + <ReadTimeout value="60"/>
  15 + <WriteTimeout value="60"/>
  16 + <ACKTimeout value="60"/>
  17 + <WatchdogInterval value="60"/>
  18 + <MaxSession value="256"/>
  19 + <MaxWriteLength value="0"/>
  20 + <HighMessageCount value="20000"/>
  21 + <LowMessageCount value="15000"/>
  22 + <InitPause value="10"/>
  23 + </warm>
  24 +</configuration>
... ...
AF-Demo/conf/af/AF.E01.0.0 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +<?xml version="1.0" encoding="tis-620"?>
  2 +
  3 +<configuration>
  4 + <cold>
  5 + <HomeDirectory value="/opt/equinox"/>
  6 + <sf group="AF" service="0" instance="0">
  7 + <Host host="localhost" port="5050"/>
  8 + </sf>
  9 + <httpd ip="0.0.0.0" port="5053" backlog="256"/>
  10 + <db id="1" ip="0.0.0.0" port="4567" size="100000" link_file="backup">
  11 + <replication id="2" ip="localhost" port="4568"/>
  12 + </db>
  13 + </cold>
  14 + <warm>
  15 + <SFLOG value="FATAL|ERROR|WARN|INFO"/>
  16 + <StatInterval value="10"/>
  17 + <HousekeeperInterval value="10"/>
  18 + <RestartDelay value="1"/>
  19 + <MaxRetry value="0"/>
  20 + <SFMessageTimeout value="5"/>
  21 + <SFMaxClient value="1"/>
  22 + <SFConnectTimeout value="10"/>
  23 + <SFReadTimeout value="5"/>
  24 + <SFWriteTimeout value="30"/>
  25 + <SFACKTimeout value="60"/>
  26 + <SFWatchdogInterval value="30"/>
  27 + <SFMaxWriteLength value="0"/>
  28 + <SFHighMessageCount value="20000"/>
  29 + <SFLowMessageCount value="15000"/>
  30 + <HttpMaxSession value="200"/>
  31 + <HttpReadTimeout value="5"/>
  32 + <HttpWriteTimeout value="5"/>
  33 + <HttpIdleTimeout value="30"/>
  34 + <BatonHeartbeatTimer value="30"/>
  35 + </warm>
  36 +</configuration>
... ...
AF-Demo/conf/af/AF.E11.0.0 0 → 100644
... ... @@ -0,0 +1,44 @@
  1 +<?xml version="1.0" encoding="tis-620"?>
  2 +
  3 +<configuration>
  4 + <cold>
  5 + <HomeDirectory value="/opt/equinox"/>
  6 + <sf group="AF" service="0" instance="0">
  7 + <Host host="localhost" port="5050"/>
  8 + </sf>
  9 + <dmp port="7777" dictionary="E11.dict" org_host="localhost" org_realm="toro.ais.co.th" ip="127.0.0.1" vendor="AIS" product="equinox" standalone="yes"/>
  10 + <diameter host="127.0.0.1" port="7778" dictionary="E11.dict" org_host="localhost" org_realm="toro.ais.co.th" ip="127.0.0.1" app="4" vendor="AIS" product="equinox"/>
  11 + </cold>
  12 + <warm>
  13 + <SFLOG value="FATAL|ERROR|WARN|INFO|DEBUG"/>
  14 + <StatInterval value="12"/>
  15 + <HousekeeperInterval value="1"/>
  16 + <RestartDelay value="10"/>
  17 + <MaxRetry value="1"/>
  18 + <SFMessageTimeout value="60"/>
  19 + <SFMaxClient value="1"/>
  20 + <SFConnectTimeout value="10"/>
  21 + <SFReadTimeout value="30"/>
  22 + <SFWriteTimeout value="30"/>
  23 + <SFACKTimeout value="60"/>
  24 + <SFWatchdogInterval value="10"/>
  25 + <SFMaxWriteLength value="0"/>
  26 + <SFHighMessageCount value="1000"/>
  27 + <SFLowMessageCount value="10"/>
  28 + <DMPMaxSession value="200"/>
  29 + <DMPReadTimeout value="30"/>
  30 + <DMPWriteTimeout value="30"/>
  31 + <DMPEventTimeout value="30"/>
  32 + <DMPMaxWriteLength value="0"/>
  33 + <DMPWatchdogInterval value="15"/>
  34 + <DiameterMaxClient value="10"/>
  35 + <DiameterConnectTimeout value="10"/>
  36 + <DiameterWaitTimeout value="60"/>
  37 + <DiameterReadTimeout value="30"/>
  38 + <DiameterWriteTimeout value="30"/>
  39 + <DiameterMaxWriteLength value="0"/>
  40 + <DiameterWatchdogInterval value="15"/>
  41 + <DiameterEventTimeout value="30"/>
  42 + <DiameterAnswerTimeout value="30"/>
  43 + </warm>
  44 +</configuration>
... ...
AF-Demo/conf/af/AF.E11.0.1 0 → 100644
... ... @@ -0,0 +1,44 @@
  1 +<?xml version="1.0" encoding="tis-620"?>
  2 +
  3 +<configuration>
  4 + <cold>
  5 + <HomeDirectory value="/opt/equinox"/>
  6 + <sf group="AF" service="0" instance="1">
  7 + <Host host="localhost" port="5050"/>
  8 + </sf>
  9 + <dmp port="7778" dictionary="E11.dict" org_host="localhost" org_realm="toro.ais.co.th" ip="127.0.0.1" vendor="AIS" product="equinox" standalone="no"/>
  10 + <diameter host="127.0.0.1" port="7777" dictionary="E11.dict" org_host="localhost" org_realm="toro.ais.co.th" ip="127.0.0.1" app="4" vendor="AIS" product="equinox"/>
  11 + </cold>
  12 + <warm>
  13 + <SFLOG value="FATAL|ERROR|WARN|INFO|DEBUG"/>
  14 + <StatInterval value="12"/>
  15 + <HousekeeperInterval value="1"/>
  16 + <RestartDelay value="10"/>
  17 + <MaxRetry value="1"/>
  18 + <SFMessageTimeout value="60"/>
  19 + <SFMaxClient value="1"/>
  20 + <SFConnectTimeout value="10"/>
  21 + <SFReadTimeout value="30"/>
  22 + <SFWriteTimeout value="30"/>
  23 + <SFACKTimeout value="60"/>
  24 + <SFWatchdogInterval value="10"/>
  25 + <SFMaxWriteLength value="0"/>
  26 + <SFHighMessageCount value="1000"/>
  27 + <SFLowMessageCount value="10"/>
  28 + <DMPMaxSession value="200"/>
  29 + <DMPReadTimeout value="30"/>
  30 + <DMPWriteTimeout value="30"/>
  31 + <DMPEventTimeout value="30"/>
  32 + <DMPMaxWriteLength value="0"/>
  33 + <DMPWatchdogInterval value="15"/>
  34 + <DiameterMaxClient value="10"/>
  35 + <DiameterConnectTimeout value="10"/>
  36 + <DiameterWaitTimeout value="60"/>
  37 + <DiameterReadTimeout value="30"/>
  38 + <DiameterWriteTimeout value="30"/>
  39 + <DiameterMaxWriteLength value="0"/>
  40 + <DiameterWatchdogInterval value="15"/>
  41 + <DiameterEventTimeout value="30"/>
  42 + <DiameterAnswerTimeout value="30"/>
  43 + </warm>
  44 +</configuration>
... ...
AF-Demo/conf/af/AF.EC02.AF.0 0 → 100644
... ... @@ -0,0 +1,56 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<configuration>
  3 + <cold>
  4 + <HomeDirectory value="/opt/equinoxAS" />
  5 + <Application group="AF" service="AF" instance="0" />
  6 + <Listener port="7878" backlog="256"/>
  7 + <Library directory="/opt/equinoxAS/lib/" name="af_demo.jar" function="af.control.AFMain" />
  8 + <ECProperties>
  9 + <ThreadPool value="8" />
  10 + <AutoCpuUtilize value="true" />
  11 + <CpuUtilizeList value="4,5,6,7,8,9,10,11,12,13,14,15,16" />
  12 + <JavaOption value="-server" />
  13 + <JavaOption value="-XX:CompileThreshold=1000" />
  14 + <JavaOption value="-XX:ThreadStackSize=65535" />
  15 + <JavaOption value="-XX:MainThreadStackSize=65535" />
  16 + <JavaOption value="-Xms1G" />
  17 + <JavaOption value="-Xmx1G" />
  18 + <JavaOption value="-Djavax.xml.xpath.XPathFactory:http://java.sun.com/jaxp/xpath/dom=com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl" />
  19 + <JavaOption value="-Djava.version=1.6" />
  20 + <JavaLibrary value="ec02_library_V3.2.0.jar" />
  21 + <JavaLibrary value="gson-2.2.2.jar" />
  22 + <JavaLibrary value="af_demo.jar" />
  23 + </ECProperties>
  24 + </cold>
  25 + <warm>
  26 + <SFLOG value="FATAL|ERROR|WARN|INFO|DEBUG" />
  27 + <AFLOG value="FATAL|ERROR|WARN|INFO" />
  28 + <StatInterval value="2" />
  29 + <HousekeeperInterval value="10" />
  30 + <RestartDelay value="10" />
  31 +
  32 + <IncomingMsgDecode value="false" />
  33 + <OutgoingMsgEncode value="false" />
  34 + <IncomingMsgTrim value="false" />
  35 + <OutgoingMsgTrim value="true" />
  36 +
  37 + <ServerMaxSession value="20" />
  38 + <ServerReadTimeout value="30" />
  39 + <ServerWriteTimeout value="30" />
  40 + <ServerIdleTimeout value="30" />
  41 +
  42 + <!-- Configuration Destination -->
  43 +
  44 +
  45 + <!-- Resource name of Group-->
  46 + <Resource-Name-A value="AF.ES04.A"/>
  47 + <Update-Instance-timeout value="5" />
  48 + <HTTP-timeout value="10" />
  49 + <LDAP-timeout value="5" />
  50 + <Diameter-timeout value="5" />
  51 + <SMPP-timeout value="5" />
  52 + <Default-timeout value="10" />
  53 + <!-- end server config-->
  54 +
  55 + </warm>
  56 +</configuration>
... ...
AF-Demo/conf/af/AF.ES00.0.0 0 → 100644
... ... @@ -0,0 +1,44 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<configuration>
  3 + <cold>
  4 + <HomeDirectory value="/opt/equinox" />
  5 + <sf group="AF" service="0" instance="0">
  6 + <Host host="localhost" port="5050" />
  7 + </sf>
  8 + <http host="0.0.0.0" port="7878" uri="/">
  9 + <Header name="Pragma" value="no-cache" />
  10 + <Header name="Accept" value="image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*" />
  11 + <Header name="Content-Type" value="application/x-www-form-urlencoded" />
  12 + </http>
  13 + </cold>
  14 + <warm>
  15 + <SFLOG value="FATAL|ERROR|WARN|INFO|DEBUG" />
  16 + <StatInterval value="10" />
  17 + <HousekeeperInterval value="10" />
  18 + <RestartDelay value="10" />
  19 + <MaxRetry value="0" />
  20 +
  21 + <E11ScaleNumber value="1" />
  22 + <EDBTimeToWait value="1" />
  23 + <SFMessageTimeout value="60" />
  24 + <SFOAMTimeout value="120" />
  25 + <SFMaxClient value="1" />
  26 + <SFConnectTimeout value="10" />
  27 + <SFReadTimeout value="30" />
  28 + <SFWriteTimeout value="30" />
  29 + <SFACKTimeout value="60" />
  30 + <SFWatchdogInterval value="10" />
  31 + <SFMaxWriteLength value="0" />
  32 +
  33 + <HttpMaxClient value="1" />
  34 + <HttpMaxReadLength value="1000000" />
  35 + <HttpConnectTimeout value="10" />
  36 + <HttpWaitTimeout value="60" />
  37 + <HttpReadTimeout value="30" />
  38 + <HttpWriteTimeout value="30" />
  39 + <HttpMaxWriteLength value="0" />
  40 +
  41 + <HighMessageCount value="200000" />
  42 + <LowMessageCount value="150000" />
  43 + </warm>
  44 +</configuration>
... ...
AF-Demo/conf/af/AF.ES04.A.0 0 → 100644
... ... @@ -0,0 +1,43 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<configuration>
  3 + <cold>
  4 + <HomeDirectory value="/opt/equinox" />
  5 + <sf group="AF" service="A" instance="0">
  6 + <Host host="localhost" port="5050" />
  7 + </sf>
  8 + <http host="localhost" port="6668" uri="/">
  9 + <Header name="Pragma" value="no-cache" />
  10 + <Header name="Accept" value="image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*" />
  11 + <Header name="Content-Type" value="application/x-www-form-urlencoded" />
  12 + </http>
  13 + </cold>
  14 + <warm>
  15 + <SFLOG value="FATAL|ERROR|WARN|INFO|DEBUG" />
  16 + <StatInterval value="10" />
  17 + <HousekeeperInterval value="10" />
  18 + <RestartDelay value="10" />
  19 + <MaxRetry value="2" />
  20 +
  21 + <SFMessageTimeout value="60" />
  22 + <SFMaxClient value="1" />
  23 + <SFConnectTimeout value="10" />
  24 + <SFReadTimeout value="30" />
  25 + <SFWriteTimeout value="30" />
  26 + <SFACKTimeout value="60" />
  27 + <SFWatchdogInterval value="10" />
  28 + <SFMaxWriteLength value="0" />
  29 +
  30 + <HttpMaxClient value="10" />
  31 + <HttpConnectTimeout value="40" />
  32 + <HttpWaitTimeout value="60" />
  33 + <HttpReadTimeout value="30" />
  34 + <HttpWriteTimeout value="30" />
  35 + <HttpMaxWriteLength value="0" />
  36 +
  37 + <HighMessageCount value="200000" />
  38 + <LowMessageCount value="150000" />
  39 +
  40 + <HttpMaxRetryConnectionError value="10" />
  41 + <HttpReconnectInterval value="10" />
  42 + </warm>
  43 +</configuration>
... ...
AF-Demo/conf/af/AF.ES05.SERV.0 0 → 100644
... ... @@ -0,0 +1,44 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<configuration>
  3 + <cold>
  4 + <HomeDirectory value="/opt/equinox" />
  5 + <sf group="AF" service="SERV" instance="0">
  6 + <Host host="localhost" port="5050" />
  7 + </sf>
  8 + <httpd ip="0.0.0.0" port="5055" backlog="256"/>
  9 + <correlation library="default" name="libcorrelate.so" function="extract_correlate"/>
  10 + </cold>
  11 + <warm>
  12 + <SFLOG value="FATAL|ERROR|WARN|INFO|DEBUG" />
  13 + <StatInterval value="10" />
  14 + <HousekeeperInterval value="10" />
  15 + <RestartDelay value="1" />
  16 + <MaxRetry value="0" />
  17 +
  18 + <E11ScaleNumber value="1" />
  19 + <EDBTimeToWait value="40" />
  20 +
  21 + <SFMessageTimeout value="5" />
  22 + <SFMaxClient value="1" />
  23 + <SFConnectTimeout value="10" />
  24 + <SFReadTimeout value="5" />
  25 + <SFWriteTimeout value="30" />
  26 + <SFACKTimeout value="60" />
  27 + <SFWatchdogInterval value="10" />
  28 + <SFMaxWriteLength value="0" />
  29 + <SFHighMessageCount value="20000" />
  30 + <SFLowMessageCount value="15000" />
  31 +
  32 + <HttpForcePlainText value="false" />
  33 + <HttpMaxSession value="1000" />
  34 + <HttpReadTimeout value="5" />
  35 + <HttpWriteTimeout value="5" />
  36 + <HttpIdleTimeout value="30" />
  37 + <HttpMaxWriteLength value="0" />
  38 + <DelayProcessing value="6000" />
  39 +
  40 + <TPSLimit value="100" />
  41 + <TPSWindow value="1" />
  42 +
  43 + </warm>
  44 +</configuration>
... ...
AF-Demo/conf/af_testamentor.so 0 → 100644
No preview for this file type
AF-Demo/conf/testamentor/gw.E00.x.0 0 → 100644
... ... @@ -0,0 +1,23 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<configuration>
  3 + <cold>
  4 + <HomeDirectory value="/opt/equinox" />
  5 + <Listener port="6666" backlog="256"/>
  6 + <sf group="gw" service="N/A" instance="0"/>
  7 + </cold>
  8 + <warm>
  9 + <SFLOG value="FATAL|ERROR|WARN|INFO|DEBUG" />
  10 + <StatInterval value="10" />
  11 + <HousekeeperInterval value="30" />
  12 + <RestartDelay value="10" />
  13 + <ReadTimeout value="60" />
  14 + <WriteTimeout value="60" />
  15 + <ACKTimeout value="60" />
  16 + <WatchdogInterval value="60" />
  17 + <MaxSession value="256" />
  18 + <MaxWriteLength value="0" />
  19 + <HighMessageCount value="20000" />
  20 + <LowMessageCount value="15000" />
  21 + <InitPause value="10" />
  22 + </warm>
  23 +</configuration>
... ...
AF-Demo/conf/testamentor/gw.E11.0.0 0 → 100644
... ... @@ -0,0 +1,47 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<configuration>
  3 + <cold>
  4 + <HomeDirectory value="/opt/equinox" />
  5 + <sf group="gw" service="N/A" instance="0">
  6 + <Host host="localhost" port="6666" />
  7 + </sf>
  8 + <dmp port="23456" dictionary="E11.dict" org_host="localhost" org_realm="toro.ais.co.th" ip="127.0.0.1" vendor="AIS" product="equinox" />
  9 + <diameter host="127.0.0.1" port="23457" dictionary="E11.dict" org_host="localhost" org_realm="toro.ais.co.th" ip="127.0.0.1" app="4" vendor="AIS" product="equinox" />
  10 + </cold>
  11 + <warm>
  12 + <SFLOG value="FATAL|ERROR|WARN|INFO|DEBUG" />
  13 + <StatInterval value="10" />
  14 + <HousekeeperInterval value="10" />
  15 + <RestartDelay value="10" />
  16 + <MaxRetry value="1" />
  17 +
  18 + <SFMessageTimeout value="60" />
  19 + <SFMaxClient value="1" />
  20 + <SFConnectTimeout value="10" />
  21 + <SFReadTimeout value="30" />
  22 + <SFWriteTimeout value="30" />
  23 + <SFACKTimeout value="60" />
  24 + <SFWatchdogInterval value="10" />
  25 + <SFMaxWriteLength value="0" />
  26 + <SFHighMessageCount value="1000" />
  27 + <SFLowMessageCount value="100" />
  28 +
  29 + <DMPMaxSession value="200" />
  30 + <DMPReadTimeout value="30" />
  31 + <DMPWriteTimeout value="30" />
  32 + <DMPEventTimeout value="30" />
  33 + <DMPMaxWriteLength value="0" />
  34 + <DMPWatchdogInterval value="15" />
  35 +
  36 + <DiameterMaxClient value="10" />
  37 + <DiameterConnectTimeout value="10" />
  38 + <DiameterWaitTimeout value="60" />
  39 + <DiameterReadTimeout value="30" />
  40 + <DiameterWriteTimeout value="30" />
  41 + <DiameterMaxWriteLength value="0" />
  42 + <DiameterWatchdogInterval value="15" />
  43 + <DiameterEventTimeout value="30" />
  44 + <DiameterAnswerTimeout value="30" />
  45 +
  46 + </warm>
  47 +</configuration>
... ...
AF-Demo/conf/testamentor/gw.EC00.0.0 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<configuration>
  3 + <cold>
  4 + <HomeDirectory value="/opt/equinox" />
  5 + <httpd ip="127.0.0.1" port="6667" backlog="256" />
  6 + <sf group="gw" service="0" instance="0" />
  7 + <AFLibrary name="af_testamentor.so" function="af_action_process" cold="af_config_verify" warm="af_config_reload" />
  8 + </cold>
  9 + <warm>
  10 + <SFLOG value="FATAL|ERROR|WARN|INFO|DEBUG" />
  11 + <StatInterval value="10" />
  12 + <HousekeeperInterval value="10" />
  13 + <RestartDelay value="10" />
  14 + <HttpMaxSession value="200" />
  15 + <HttpReadTimeout value="30" />
  16 + <HttpWriteTimeout value="30" />
  17 + <HttpMessageTimeout value="30" />
  18 + <HttpIdleTimeout value="30" />
  19 + <HttpMaxWriteLength value="0" />
  20 + </warm>
  21 +</configuration>
... ...
AF-Demo/conf/testamentor/gw.ES00.0.0 0 → 100644
... ... @@ -0,0 +1,44 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<configuration>
  3 + <cold>
  4 + <HomeDirectory value="/opt/equinox" />
  5 + <sf group="gw" service="0" instance="0">
  6 + <Host host="localhost" port="6666" />
  7 + </sf>
  8 + <http host="localhost" port="6667" uri="/">
  9 + <Header name="Pragma" value="no-cache" />
  10 + <Header name="Accept" value="image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*" />
  11 + <Header name="Content-Type" value="application/x-www-form-urlencoded" />
  12 + </http>
  13 + </cold>
  14 + <warm>
  15 + <SFLOG value="FATAL|ERROR|WARN|INFO|DEBUG" />
  16 + <StatInterval value="10" />
  17 + <HousekeeperInterval value="10" />
  18 + <RestartDelay value="10" />
  19 + <MaxRetry value="0" />
  20 +
  21 + <E11ScaleNumber value="1" />
  22 + <EDBTimeToWait value="1" />
  23 + <SFMessageTimeout value="60" />
  24 + <SFMaxClient value="1" />
  25 + <SFOAMTimeout value="120" />
  26 + <SFConnectTimeout value="10" />
  27 + <SFReadTimeout value="30" />
  28 + <SFWriteTimeout value="30" />
  29 + <SFACKTimeout value="60" />
  30 + <SFWatchdogInterval value="10" />
  31 + <SFMaxWriteLength value="0" />
  32 +
  33 + <HttpMaxClient value="1" />
  34 + <HttpMaxReadLength value="1000000" />
  35 + <HttpConnectTimeout value="10" />
  36 + <HttpWaitTimeout value="60" />
  37 + <HttpReadTimeout value="30" />
  38 + <HttpWriteTimeout value="30" />
  39 + <HttpMaxWriteLength value="0" />
  40 +
  41 + <HighMessageCount value="200000" />
  42 + <LowMessageCount value="150000" />
  43 + </warm>
  44 +</configuration>
... ...
AF-Demo/conf/testamentor/gw.ES04.AF.0 0 → 100644
... ... @@ -0,0 +1,43 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<configuration>
  3 + <cold>
  4 + <HomeDirectory value="/opt/equinox" />
  5 + <sf group="gw" service="AF" instance="0">
  6 + <Host host="127.0.0.1" port="6666" />
  7 + </sf>
  8 + <http host="127.0.0.1" port="5055" uri="/">
  9 + <Header name="Pragma" value="no-cache" />
  10 + <Header name="Accept" value="image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*" />
  11 + <Header name="Content-Type" value="application/x-www-form-urlencoded" />
  12 + </http>
  13 + </cold>
  14 + <warm>
  15 + <SFLOG value="FATAL|ERROR|WARN|INFO|DEBUG" />
  16 + <StatInterval value="10" />
  17 + <HousekeeperInterval value="10" />
  18 + <RestartDelay value="10" />
  19 + <MaxRetry value="2" />
  20 +
  21 + <SFMessageTimeout value="60" />
  22 + <SFMaxClient value="1" />
  23 + <SFConnectTimeout value="10" />
  24 + <SFReadTimeout value="30" />
  25 + <SFWriteTimeout value="30" />
  26 + <SFACKTimeout value="60" />
  27 + <SFWatchdogInterval value="15" />
  28 + <SFMaxWriteLength value="0" />
  29 +
  30 + <HttpMaxClient value="10" />
  31 + <HttpConnectTimeout value="10" />
  32 + <HttpWaitTimeout value="60" />
  33 + <HttpReadTimeout value="30" />
  34 + <HttpWriteTimeout value="30" />
  35 + <HttpMaxWriteLength value="0" />
  36 +
  37 + <HighMessageCount value="200000" />
  38 + <LowMessageCount value="150000" />
  39 +
  40 + <HttpMaxRetryConnectionError value="10" />
  41 + <HttpReconnectInterval value="10" />
  42 + </warm>
  43 +</configuration>
... ...
AF-Demo/conf/testamentor/gw.ES04.INJ.0 0 → 100644
... ... @@ -0,0 +1,45 @@
  1 + <?xml version="1.0" encoding="tis-620" ?>
  2 +<configuration>
  3 + <cold>
  4 + <HomeDirectory value="/opt/equinox" />
  5 + <sf group="gw" service="INJ" instance="0">
  6 + <Host host="localhost" port="6666" />
  7 + </sf>
  8 + <http loadtype="none" uri="/" >
  9 + <LoadBalance host="localhost" port="10000" weight="10" permanence="no"/>
  10 + <Header name="Pragma" value="no-cache" />
  11 + <Header name="Accept" value="image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*" />
  12 + <Header name="Content-Type" value="text/xml;charset=UTF8"/>
  13 + </http>
  14 + </cold>
  15 + <warm>
  16 + <SFLOG value="FATAL|ERROR|WARN|INFO|DEBUG" />
  17 + <StatInterval value="10" />
  18 + <HousekeeperInterval value="10" />
  19 + <RestartDelay value="10" />
  20 + <MaxRetry value="0" />
  21 +
  22 + <SFMessageTimeout value="60" />
  23 + <SFMaxClient value="1" />
  24 + <SFConnectTimeout value="10" />
  25 + <SFReadTimeout value="30" />
  26 + <SFWriteTimeout value="30" />
  27 + <SFACKTimeout value="60" />
  28 + <SFWatchdogInterval value="10" />
  29 + <SFMaxWriteLength value="0" />
  30 +
  31 + <HttpMaxClient value="10" />
  32 + <HttpConnectTimeout value="10" />
  33 + <HttpWaitTimeout value="60" />
  34 + <HttpReadTimeout value="30" />
  35 + <HttpWriteTimeout value="30" />
  36 + <HttpMaxWriteLength value="0" />
  37 +
  38 + <HighMessageCount value="200000" />
  39 + <LowMessageCount value="150000" />
  40 +
  41 + <HttpMaxRetryConnectionError value="10" />
  42 + <HttpReconnectInterval value="10" />
  43 +
  44 + </warm>
  45 +</configuration>
... ...
AF-Demo/conf/testamentor/gw.ES05.INJ.0 0 → 100644
... ... @@ -0,0 +1,47 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<configuration>
  3 + <cold>
  4 + <HomeDirectory value="/opt/equinox" />
  5 + <sf group="gw" service="INJ" instance="0">
  6 + <Host host="localhost" port="6666" />
  7 + </sf>
  8 + <httpd ip="localhost" port="9000" backlog="256" />
  9 + <correlation library="default" name="libcorrelate.so" function="extract_correlate"/>
  10 + <Body name="XML_version" value="1.0"/>
  11 + <Body name="XML_encoding" value="tis-620" display="none"/>
  12 +
  13 + </cold>
  14 + <warm>
  15 + <SFLOG value="FATAL|ERROR|WARN|INFO|DEBUG" />
  16 + <StatInterval value="10" />
  17 + <HousekeeperInterval value="10" />
  18 + <RestartDelay value="1" />
  19 + <MaxRetry value="0" />
  20 + <E11ScaleNumber value="1" />
  21 +
  22 + <SFMessageTimeout value="5" />
  23 + <SFMaxClient value="1" />
  24 + <SFConnectTimeout value="10" />
  25 + <SFReadTimeout value="5" />
  26 + <SFWriteTimeout value="30" />
  27 + <SFACKTimeout value="60" />
  28 + <SFWatchdogInterval value="10" />
  29 + <SFMaxWriteLength value="0" />
  30 + <SFHighMessageCount value="20000" />
  31 + <SFLowMessageCount value="15000" />
  32 +
  33 + <HttpMaxSession value="200" />
  34 + <HttpReadTimeout value="5" />
  35 + <HttpWriteTimeout value="5" />
  36 + <HttpIdleTimeout value="600" />
  37 + <HttpMaxWriteLength value="0" />
  38 +
  39 + <EDBTimeToWait value="600" />
  40 + <DelayProcessing value="6000" />
  41 +
  42 + <SmoothReject value="0" />
  43 + <TPSLimit value="100" />
  44 + <TPSWindow value="1" />
  45 + <RejectResultCode value="3004" />
  46 + </warm>
  47 +</configuration>
... ...
AF-Demo/conf/testamentor/gw.ES05.SERV.0 0 → 100644
... ... @@ -0,0 +1,47 @@
  1 +<?xml version="1.0" encoding="tis-620" ?>
  2 +<configuration>
  3 + <cold>
  4 + <HomeDirectory value="/opt/equinox" />
  5 + <sf group="gw" service="SERV" instance="0">
  6 + <Host host="localhost" port="6666" />
  7 + </sf>
  8 + <httpd ip="localhost" port="6668" backlog="256" />
  9 + <correlation library="default" name="libcorrelate.so" function="extract_correlate"/>
  10 + <Body name="XML_version" value="1.0"/>
  11 + <Body name="XML_encoding" value="tis-620" display="none"/>
  12 +
  13 + </cold>
  14 + <warm>
  15 + <SFLOG value="FATAL|ERROR|WARN|INFO|DEBUG" />
  16 + <StatInterval value="10" />
  17 + <HousekeeperInterval value="10" />
  18 + <RestartDelay value="1" />
  19 + <MaxRetry value="0" />
  20 + <E11ScaleNumber value="1" />
  21 +
  22 + <SFMessageTimeout value="5" />
  23 + <SFMaxClient value="1" />
  24 + <SFConnectTimeout value="10" />
  25 + <SFReadTimeout value="5" />
  26 + <SFWriteTimeout value="30" />
  27 + <SFACKTimeout value="60" />
  28 + <SFWatchdogInterval value="10" />
  29 + <SFMaxWriteLength value="0" />
  30 + <SFHighMessageCount value="20000" />
  31 + <SFLowMessageCount value="15000" />
  32 +
  33 + <HttpMaxSession value="200" />
  34 + <HttpReadTimeout value="5" />
  35 + <HttpWriteTimeout value="5" />
  36 + <HttpIdleTimeout value="30" />
  37 + <HttpMaxWriteLength value="0" />
  38 +
  39 + <EDBTimeToWait value="600" />
  40 + <DelayProcessing value="6000" />
  41 +
  42 + <SmoothReject value="0" />
  43 + <TPSLimit value="100" />
  44 + <TPSWindow value="1" />
  45 + <RejectResultCode value="3004" />
  46 + </warm>
  47 +</configuration>
... ...
AF-Demo/lib/XMLParser.jar 0 → 100644
No preview for this file type
AF-Demo/lib/af_demo.jar 0 → 100644
No preview for this file type
AF-Demo/lib/af_demo_oam.jar 0 → 100644
No preview for this file type
AF-Demo/lib/ec02_library_V3.2.0.jar 0 → 100644
No preview for this file type
AF-Demo/lib/gson-2.2.2.jar 0 → 100644
No preview for this file type
AF-Demo/src/af/control/AFMain.java 0 → 100644
... ... @@ -0,0 +1,141 @@
  1 +package af.control;
  2 +
  3 +import java.util.ArrayList;
  4 +import com.google.gson.Gson;
  5 +import af.instatnce.AFInstance;
  6 +import af.instatnce.EC02Instance;
  7 +import af.interfaces.AFEvent;
  8 +import af.utils.Zip;
  9 +import ec02.af.abstracts.AbstractAF;
  10 +import ec02.af.data.ECDialogue;
  11 +import ec02.af.data.EquinoxProperties;
  12 +import ec02.af.data.EquinoxRawData;
  13 +import ec02.af.exception.ActionProcessException;
  14 +import ec02.af.exception.ComposeInstanceException;
  15 +import ec02.af.exception.ConstructRawDataException;
  16 +import ec02.af.exception.ExtractInstanceException;
  17 +import ec02.af.exception.ExtractRawDataException;
  18 +import ec02.interfaces.IEC02;
  19 +import ec02.utils.AppLog;
  20 +import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
  21 +
  22 +public class AFMain extends AbstractAF implements IEC02{
  23 +
  24 + @Override
  25 + public ECDialogue actionProcess(EquinoxProperties eqxProp, ArrayList<EquinoxRawData> eqxRawDataList, Object instance)
  26 + throws ActionProcessException {
  27 +
  28 + AppLog.i("[CURRENT STATE] : " + eqxProp.getState());
  29 + EC02Instance ec02Ins = (EC02Instance) instance;
  30 + ec02Ins.setEquinoxProperties(eqxProp);
  31 + ec02Ins.setAbstractAF((AbstractAF) this);
  32 + StateManager sm = new StateManager(eqxProp.getState());
  33 + String eqxState = sm.doAction((AbstractAF) this, ec02Ins, eqxRawDataList);
  34 + EquinoxProperties newEqxProp = new EquinoxProperties();
  35 + newEqxProp.setState(eqxState);
  36 + AppLog.i("[NEXT STATE] : " + eqxState);
  37 + newEqxProp.setTimeout(ec02Ins.getTimeout());
  38 + AppLog.i("[TIMEOUT] : " + ec02Ins.getTimeout());
  39 + ECDialogue ecDialogue = new ECDialogue(newEqxProp, ec02Ins);
  40 +
  41 + return ecDialogue;
  42 + }
  43 +
  44 + @Override
  45 + public boolean verifyAFConfiguration(String arg0) {
  46 + return true;
  47 + }
  48 +
  49 + @Override
  50 + public String composeInstance(Object instance) throws ComposeInstanceException {
  51 + EC02Instance ec02Instance = (EC02Instance) instance;
  52 + AFInstance afInstance = ec02Instance.getAFInstance();
  53 + String encodeString = "";
  54 +
  55 + try {
  56 + encodeString = encodeInstance(afInstance);
  57 + }
  58 + catch (Exception e) {
  59 + e.printStackTrace();
  60 + }
  61 +
  62 + return encodeString;
  63 + }
  64 +
  65 + @Override
  66 + public ArrayList<EquinoxRawData> constructRawData(Object instance)
  67 + throws ConstructRawDataException {
  68 + EC02Instance ins = (EC02Instance) instance;
  69 + return ins.getEqxRawDataList();
  70 + }
  71 +
  72 + @Override
  73 + public Object extractInstance(String instance) throws ExtractInstanceException {
  74 + EC02Instance ec02Instance = new EC02Instance();
  75 + AFInstance afInstance = null;
  76 +
  77 + if ((instance == null) || instance.isEmpty()) {
  78 + afInstance = new AFInstance();
  79 + }
  80 + else {
  81 + try {
  82 + afInstance = decodeInstance(instance);
  83 + }
  84 + catch (Exception e) {
  85 + e.printStackTrace();
  86 + }
  87 + }
  88 +
  89 + ec02Instance.setAFInstance(afInstance);
  90 + return (Object) ec02Instance;
  91 + }
  92 +
  93 + @Override
  94 + public void extractRawData(Object instanceData, ArrayList<EquinoxRawData> rawDatas)
  95 + throws ExtractRawDataException {
  96 +
  97 + for (EquinoxRawData r : rawDatas) {
  98 + String type = r.getRawDataAttribute("type");
  99 + String ctype = r.getRawDataAttribute("ctype");
  100 +
  101 + if(r.getRawEventType().equals(AFEvent.Unknown)){
  102 + if(ctype.equals("text/plain") && type.equals("request")) {
  103 + r.setRawMessage(r.getRawDataAttribute("val").trim());
  104 + r.setRawEventType(AFEvent.Incoming_HTTP_Request);
  105 + }
  106 + else if(ctype.equals("text/xml") && type.equals("response")) {
  107 + r.setRawEventType(AFEvent.Incoming_A_Response);
  108 + }
  109 + }
  110 + AppLog.i("[EVENT TYPE] : " + r.getRawEventType());
  111 + }
  112 + }
  113 +
  114 + private String encodeInstance(AFInstance instance) {
  115 + String encodeString = "";
  116 + try {
  117 + Gson gson = new Gson();
  118 + String str = gson.toJson(instance);
  119 + byte[] bytes = str.getBytes();
  120 + byte[] zipBytes = Zip.compressBytes(bytes);
  121 + encodeString = Base64.encode(zipBytes);
  122 + }
  123 + catch (Exception e) {
  124 + AppLog.e("Encode fail!! " + e);
  125 + }
  126 + return encodeString;
  127 + }
  128 +
  129 + private AFInstance decodeInstance(String instance) {
  130 + AFInstance afInstance = null;
  131 + try {
  132 + byte[] simpleString = Base64.decode(instance);
  133 + byte[] unZipString = Zip.extractBytes(simpleString);
  134 + Gson gson = new Gson();
  135 + afInstance = gson.fromJson(new String(unZipString), AFInstance.class);
  136 + } catch (Exception e) {
  137 + AppLog.e("Decode fail!! " + e);
  138 + }
  139 + return afInstance;
  140 + }
  141 +}
... ...
AF-Demo/src/af/control/StateManager.java 0 → 100644
... ... @@ -0,0 +1,22 @@
  1 +package af.control;
  2 +
  3 +import af.interfaces.AFState;
  4 +import af.state.StateIdle;
  5 +import af.state.StateWaitE01;
  6 +import af.state.StateWaitA;
  7 +import ec02.af.abstracts.AbstractAFStateManager;
  8 +
  9 +public class StateManager extends AbstractAFStateManager {
  10 + public StateManager(String state) {
  11 + this.afState = null;
  12 + if (state.equals(AFState.IDLE)) {
  13 + this.afState = new StateIdle();
  14 + }
  15 + else if (state.equals(AFState.W_E01Res)) {
  16 + this.afState = new StateWaitE01();
  17 + }
  18 + else if (state.equals(AFState.W_ARes)) {
  19 + this.afState = new StateWaitA();
  20 + }
  21 + }
  22 +}
... ...
AF-Demo/src/af/instatnce/AFInstance.java 0 → 100644
... ... @@ -0,0 +1,23 @@
  1 +package af.instatnce;
  2 +
  3 +public class AFInstance {
  4 +
  5 + private String orig = "";
  6 + private String invoke = "";
  7 +
  8 +
  9 + public String getOrig(){
  10 + return this.orig;
  11 + }
  12 + public void setOrig(String orig){
  13 + this.orig = orig;
  14 + }
  15 + public void setInvoke(String invoke) {
  16 + this.invoke = invoke;
  17 + }
  18 + public String getInvoke(){
  19 + return this.invoke;
  20 + }
  21 +
  22 +
  23 +}
... ...
AF-Demo/src/af/instatnce/E01Instance.java 0 → 100644
... ... @@ -0,0 +1,42 @@
  1 +package af.instatnce;
  2 +
  3 +import java.util.ArrayList;
  4 +
  5 +public class E01Instance {
  6 + private String cmd = "";
  7 + private String objType = "";
  8 + private String data = "";
  9 + private String id = "";
  10 + private ArrayList<String> key = null;
  11 +
  12 + public String getCmd() {
  13 + return cmd;
  14 + }
  15 + public void setCmd(String cmd) {
  16 + this.cmd = cmd;
  17 + }
  18 + public String getObjType() {
  19 + return objType;
  20 + }
  21 + public void setObjType(String objType) {
  22 + this.objType = objType;
  23 + }
  24 + public String getData() {
  25 + return data;
  26 + }
  27 + public void setData(String data) {
  28 + this.data = data;
  29 + }
  30 + public ArrayList<String> getKey() {
  31 + return key;
  32 + }
  33 + public void setKey(ArrayList<String> key) {
  34 + this.key = key;
  35 + }
  36 + public String getId() {
  37 + return id;
  38 + }
  39 + public void setId(String id) {
  40 + this.id = id;
  41 + }
  42 +}
... ...
AF-Demo/src/af/instatnce/EC02Instance.java 0 → 100644
... ... @@ -0,0 +1,67 @@
  1 +package af.instatnce;
  2 +
  3 +import java.util.ArrayList;
  4 +
  5 +import ec02.af.abstracts.AbstractAF;
  6 +import ec02.af.data.EquinoxProperties;
  7 +import ec02.af.data.EquinoxRawData;
  8 +
  9 +public class EC02Instance {
  10 + private String orig = "";
  11 + private String timeout = "";
  12 + private String e01data = "";
  13 + private ArrayList<EquinoxRawData> eqxRawDataList = null;
  14 + private AFInstance afIns = null;
  15 + private EquinoxProperties eqxProp = null;
  16 + private AbstractAF abstractAF = null;
  17 + private E01Instance e01Ins = null;
  18 +
  19 + public String getOrig() {
  20 + return orig;
  21 + }
  22 + public void setOrig(String orig) {
  23 + this.orig = orig;
  24 + }
  25 + public String getTimeout() {
  26 + return timeout;
  27 + }
  28 + public void setTimeout(String timeout) {
  29 + this.timeout = timeout;
  30 + }
  31 + public ArrayList<EquinoxRawData> getEqxRawDataList() {
  32 + return eqxRawDataList;
  33 + }
  34 + public void setEqxRawDataList(ArrayList<EquinoxRawData> eqxRawDataList) {
  35 + this.eqxRawDataList = eqxRawDataList;
  36 + }
  37 + public AFInstance getAFInstance() {
  38 + return afIns;
  39 + }
  40 + public void setAFInstance(AFInstance afIns) {
  41 + this.afIns = afIns;
  42 + }
  43 + public EquinoxProperties getEquinoxProperties() {
  44 + return eqxProp;
  45 + }
  46 + public void setEquinoxProperties(EquinoxProperties eqxProp) {
  47 + this.eqxProp = eqxProp;
  48 + }
  49 + public AbstractAF getAbstractAF() {
  50 + return abstractAF;
  51 + }
  52 + public void setAbstractAF(AbstractAF abstractAF) {
  53 + this.abstractAF = abstractAF;
  54 + }
  55 + public String getE01data() {
  56 + return e01data;
  57 + }
  58 + public void setE01data(String e01data) {
  59 + this.e01data = e01data;
  60 + }
  61 + public E01Instance getE01Ins() {
  62 + return e01Ins;
  63 + }
  64 + public void setE01Ins(E01Instance e01Ins) {
  65 + this.e01Ins = e01Ins;
  66 + }
  67 +}
... ...
AF-Demo/src/af/instatnce/EQXRawInstance.java 0 → 100644
... ... @@ -0,0 +1,54 @@
  1 +package af.instatnce;
  2 +
  3 +public class EQXRawInstance {
  4 + private String to = null;
  5 + private String type = null;
  6 + private String ctype = null;
  7 + private String oid = null;
  8 + private String uri = null;
  9 + private String ecode = null;
  10 + private String message = null;
  11 +
  12 + public String getTo() {
  13 + return to;
  14 + }
  15 + public void setTo(String to) {
  16 + this.to = to;
  17 + }
  18 + public String getType() {
  19 + return type;
  20 + }
  21 + public void setType(String type) {
  22 + this.type = type;
  23 + }
  24 + public String getCtype() {
  25 + return ctype;
  26 + }
  27 + public void setCtype(String ctype) {
  28 + this.ctype = ctype;
  29 + }
  30 + public String getOid() {
  31 + return oid;
  32 + }
  33 + public void setOid(String oid) {
  34 + this.oid = oid;
  35 + }
  36 + public String getUri() {
  37 + return uri;
  38 + }
  39 + public void setUri(String uri) {
  40 + this.uri = uri;
  41 + }
  42 + public String getEcode() {
  43 + return ecode;
  44 + }
  45 + public void setEcode(String ecode) {
  46 + this.ecode = ecode;
  47 + }
  48 + public String getMessage() {
  49 + return message;
  50 + }
  51 + public void setMessage(String message) {
  52 + this.message = message;
  53 + }
  54 +}
... ...
AF-Demo/src/af/interfaces/AFEvent.java 0 → 100644
... ... @@ -0,0 +1,11 @@
  1 +package af.interfaces;
  2 +
  3 +public interface AFEvent {
  4 + public String Unknown ="Unknown";
  5 + public String Incoming_HTTP_Request ="Incoming HTTP Request";
  6 + public String TEST ="TEST";
  7 + public String Incoming_A_Response ="Incoming A Response";
  8 + public String ERROR = "EQUINOX_EVENT_ERROR";
  9 + public String REJECT = "EQUINOX_EVENT_REJECT";
  10 + public String ABORT = "EQUINOX_EVENT_ABORT";
  11 +}
... ...
AF-Demo/src/af/interfaces/AFState.java 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +package af.interfaces;
  2 +
  3 +public interface AFState {
  4 + public String IDLE = "IDLE";
  5 + public String W_E01Res = "W_DBRes";
  6 + public String W_ARes = "W_ARes";
  7 +}
... ...
AF-Demo/src/af/interfaces/EQXMsg.java 0 → 100644
... ... @@ -0,0 +1,39 @@
  1 +package af.interfaces;
  2 +
  3 +public interface EQXMsg {
  4 + public String ORIG = "orig";
  5 +
  6 + public String INVOKE = "invoke";
  7 + public String TYPE = "type";
  8 + public String CTYPE = "ctype";
  9 + public String NAME = "name";
  10 + public String OID = "oid";
  11 + public String VAL = "val";
  12 + public String ECODE = "ecode";
  13 +
  14 + public String OID_CODE = "";
  15 +
  16 + //type
  17 + public String REQUEST = "request";
  18 + public String RESPONSE = "response";
  19 +
  20 + //http
  21 + public String HTTP = "HTTP";
  22 + public String TEXTPLAIN = "text/plain";
  23 + public String TEXTXML = "text/xml";
  24 + public String TEXTHTML = "text/html";
  25 +
  26 + //ldap
  27 + public String LDAP = "LDAP";
  28 + public String SEARCH = "search";
  29 + public String MODIFY = "modify";
  30 + public String DELETE = "delete";
  31 + public String EXTENDED = "extended";
  32 + public String EXECUTE = "execute";
  33 +
  34 + //smpp
  35 + public String SMPP = "SMPP";
  36 +
  37 + //diameter
  38 + public String DIAMETER = "DIAMETER";
  39 +}
... ...
AF-Demo/src/af/message/EC02Builder.java 0 → 100644
... ... @@ -0,0 +1,143 @@
  1 +package af.message;
  2 +
  3 +import java.util.ArrayList;
  4 +import af.instatnce.EC02Instance;
  5 +import af.instatnce.EQXRawInstance;
  6 +import af.interfaces.EQXMsg;
  7 +import ec02.af.abstracts.AbstractAF;
  8 +import ec02.af.data.EquinoxRawData;
  9 +import ec02.af.data.KeyObject;
  10 +
  11 +public class EC02Builder {
  12 + private EC02Instance ec02Ins = null;
  13 + private AbstractAF abstractAF = null;
  14 + private EquinoxRawData eqxRawData =null;
  15 + private EC02MSGBuilder msgBuilder = null;
  16 +
  17 +
  18 + public void setEquinoxRawData(AbstractAF abstractAF, EC02Instance ec02Ins){
  19 + this.abstractAF = abstractAF;
  20 + this.ec02Ins = ec02Ins;
  21 + }
  22 + public void setEquinoxRawData(EquinoxRawData eqxRawData, AbstractAF abstractAF, EC02Instance ec02Ins){
  23 + this.eqxRawData = eqxRawData;
  24 + this.abstractAF = abstractAF;
  25 + this.ec02Ins = ec02Ins;
  26 + }
  27 +
  28 + public ArrayList<EquinoxRawData> getHTTPRequest(ArrayList<EQXRawInstance> eqxRawList){
  29 + ArrayList<EquinoxRawData> eqxRawDataList = new ArrayList<EquinoxRawData>();
  30 + for (int i = 0; i < eqxRawList.size(); i++) {
  31 + eqxRawList.get(i).setType(EQXMsg.REQUEST);
  32 + this.msgBuilder = new EC02MSGBuilder(eqxRawList.get(i));
  33 + this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke() + i);
  34 + eqxRawDataList.add(this.msgBuilder.getHttpMessage());
  35 + }
  36 + String timeoutConf = this.abstractAF.getUtils().getHmWarmConfig().get("HTTP-timeout").get(0);
  37 + String timeout = (timeoutConf == null) ? this.ec02Ins.getAbstractAF().getUtils().getHmWarmConfig().get("Default-timeout").get(0) : timeoutConf;
  38 + this.ec02Ins.setTimeout(timeout);
  39 + return eqxRawDataList;
  40 + }
  41 +
  42 + public EquinoxRawData getHTTPResponse(EQXRawInstance eqxRaw){
  43 + eqxRaw.setType(EQXMsg.RESPONSE);
  44 + this.msgBuilder = new EC02MSGBuilder(eqxRaw);
  45 + this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke());
  46 + return this.msgBuilder.getHttpMessage();
  47 + }
  48 +
  49 + public ArrayList<EquinoxRawData> getLDAPRequest(ArrayList<EQXRawInstance> eqxRawList){
  50 + ArrayList<EquinoxRawData> eqxRawDataList = new ArrayList<EquinoxRawData>();
  51 + for (int i = 0; i < eqxRawList.size(); i++) {
  52 + eqxRawList.get(i).setType(EQXMsg.REQUEST);
  53 + this.msgBuilder = new EC02MSGBuilder(eqxRawList.get(i));
  54 + this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke() + i);
  55 + eqxRawDataList.add(this.msgBuilder.getLdapMessage());
  56 + }
  57 + String timeoutConf = this.abstractAF.getUtils().getHmWarmConfig().get("LDAP-timeout").get(0);
  58 + String timeout = (timeoutConf == null) ? this.ec02Ins.getAbstractAF().getUtils().getHmWarmConfig().get("Default-timeout").get(0) : timeoutConf;
  59 + this.ec02Ins.setTimeout(timeout);
  60 +
  61 + return eqxRawDataList;
  62 + }
  63 +
  64 + public EquinoxRawData getLDAPResponse(EQXRawInstance eqxRaw){
  65 + eqxRaw.setType(EQXMsg.RESPONSE);
  66 + this.msgBuilder = new EC02MSGBuilder(eqxRaw);
  67 + this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke());
  68 + return this.msgBuilder.getLdapMessage();
  69 + }
  70 +
  71 +
  72 + public ArrayList<EquinoxRawData> getDiameterRequest(ArrayList<EQXRawInstance> eqxRawList){
  73 + ArrayList<EquinoxRawData> eqxRawDataList = new ArrayList<EquinoxRawData>();
  74 + for (int i = 0; i < eqxRawList.size(); i++) {
  75 + eqxRawList.get(i).setType(EQXMsg.REQUEST);
  76 + this.msgBuilder = new EC02MSGBuilder(eqxRawList.get(i));
  77 + this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke() + i);
  78 + eqxRawDataList.add(this.msgBuilder.getDiameterMessage());
  79 + }
  80 + String timeoutConf = this.abstractAF.getUtils().getHmWarmConfig().get("Diameter-timeout").get(0);
  81 + String timeout = (timeoutConf == null) ? this.ec02Ins.getAbstractAF().getUtils().getHmWarmConfig().get("Default-timeout").get(0) : timeoutConf;
  82 + this.ec02Ins.setTimeout(timeout);
  83 +
  84 + return eqxRawDataList;
  85 + }
  86 +
  87 + public EquinoxRawData getDiameterResponse(EQXRawInstance eqxRaw){
  88 + eqxRaw.setType(EQXMsg.RESPONSE);
  89 + this.msgBuilder = new EC02MSGBuilder(eqxRaw);
  90 + this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke());
  91 + return this.msgBuilder.getDiameterMessage();
  92 + }
  93 +
  94 + public ArrayList<EquinoxRawData> getSMPPRequest(ArrayList<EQXRawInstance> eqxRawList){
  95 + ArrayList<EquinoxRawData> eqxRawDataList = new ArrayList<EquinoxRawData>();
  96 + for (int i = 0; i < eqxRawList.size(); i++) {
  97 + eqxRawList.get(i).setType(EQXMsg.REQUEST);
  98 + this.msgBuilder = new EC02MSGBuilder(eqxRawList.get(i));
  99 + this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke() + i);
  100 + eqxRawDataList.add(this.msgBuilder.getSMPPMessage());
  101 + }
  102 + String timeoutConf = this.abstractAF.getUtils().getHmWarmConfig().get("SMPP-timeout").get(0);
  103 + String timeout = (timeoutConf == null) ? this.ec02Ins.getAbstractAF().getUtils().getHmWarmConfig().get("Default-timeout").get(0) : timeoutConf;
  104 + this.ec02Ins.setTimeout(timeout);
  105 +
  106 + return eqxRawDataList;
  107 + }
  108 +
  109 + public EquinoxRawData getSMPPResponse(EQXRawInstance eqxRaw){
  110 + eqxRaw.setType(EQXMsg.RESPONSE);
  111 + this.msgBuilder = new EC02MSGBuilder(eqxRaw);
  112 + this.msgBuilder.setInvoke(this.ec02Ins.getAFInstance().getInvoke());
  113 + return this.msgBuilder.getSMPPMessage();
  114 + }
  115 +
  116 + public void getE01Request(){
  117 + KeyObject keyobj = new KeyObject();
  118 + keyobj.setObjectType(this.ec02Ins.getE01Ins().getObjType());
  119 + ArrayList<String> keyList = this.ec02Ins.getE01Ins().getKey();
  120 + for (int i = 0; i < keyList.size(); i++) {
  121 + keyobj.setKey(String.valueOf(i), keyList.get(i));
  122 + }
  123 + if(this.ec02Ins.getE01Ins().getCmd().equals("search")){
  124 + this.abstractAF.getUtils().getGlobalData().search(keyobj);
  125 + }
  126 + else if(this.ec02Ins.getE01Ins().getCmd().equals("delete")){
  127 + this.abstractAF.getUtils().getGlobalData().delete(keyobj);
  128 + }
  129 + else if(this.ec02Ins.getE01Ins().getCmd().equals("add")){
  130 + this.abstractAF.getUtils().getGlobalData().add(keyobj, this.ec02Ins.getE01Ins().getData());
  131 + }
  132 + else if(this.ec02Ins.getE01Ins().getCmd().equals("replace")){
  133 + this.abstractAF.getUtils().getGlobalData().replace(keyobj, this.ec02Ins.getE01Ins().getData());
  134 + }
  135 + this.abstractAF.getUtils().getGlobalData().setMessageId(this.eqxRawData.getInvoke());
  136 + }
  137 +
  138 + public EquinoxRawData getUpdateIns(){
  139 + this.msgBuilder = new EC02MSGBuilder();
  140 + this.ec02Ins.setTimeout(this.abstractAF.getUtils().getHmWarmConfig().get("Update-Instance-timeout").get(0));
  141 + return this.msgBuilder.getUpdateIns();
  142 + }
  143 +}
... ...
AF-Demo/src/af/message/EC02MSGBuilder.java 0 → 100644
... ... @@ -0,0 +1,118 @@
  1 +package af.message;
  2 +
  3 +import java.util.HashMap;
  4 +import java.util.Map;
  5 +import af.instatnce.EQXRawInstance;
  6 +import af.interfaces.EQXMsg;
  7 +import ec02.af.data.EquinoxRawData;
  8 +
  9 +public class EC02MSGBuilder {
  10 + private String message = null;
  11 + private EQXRawInstance eqxRawIns = null;
  12 + private EquinoxRawData eqxRawDatas = null;
  13 + private Map<String, String> map = new HashMap<String, String>();
  14 + private String invoke = null;
  15 +
  16 + public EC02MSGBuilder(){
  17 + this.eqxRawDatas = new EquinoxRawData();
  18 + }
  19 +
  20 + public EC02MSGBuilder(EQXRawInstance eqxRawIns){
  21 + this.setEqxRawIns(eqxRawIns);
  22 + this.eqxRawDatas = new EquinoxRawData();
  23 + }
  24 +
  25 + public String getMessage() {
  26 + return message;
  27 + }
  28 +
  29 + public void setMessage(String message) {
  30 + this.message = message;
  31 + }
  32 +
  33 + public Map<String, String> getMap() {
  34 + return map;
  35 + }
  36 +
  37 + public void setMap(Map<String, String> map) {
  38 + this.map = map;
  39 + }
  40 +
  41 + public String getInvoke() {
  42 + return invoke;
  43 + }
  44 +
  45 + public void setInvoke(String invoke) {
  46 + this.invoke = invoke;
  47 + }
  48 +
  49 + public EquinoxRawData getDiameterMessage() {
  50 + if (this.invoke != null)
  51 + this.map.put(EQXMsg.INVOKE, this.invoke);
  52 + this.map.put(EQXMsg.NAME, EQXMsg.DIAMETER);
  53 + this.map.put(EQXMsg.TYPE, this.eqxRawIns.getType());
  54 + this.map.put(EQXMsg.CTYPE, this.eqxRawIns.getCtype());
  55 + this.eqxRawDatas.setRawDataAttributes(this.map);
  56 + this.eqxRawDatas.setTo(this.eqxRawIns.getTo());
  57 + this.eqxRawDatas.setRawMessage(this.eqxRawIns.getMessage());
  58 +
  59 + return this.eqxRawDatas;
  60 + }
  61 +
  62 + public EquinoxRawData getHttpMessage() {
  63 + if (this.invoke != null)
  64 + this.map.put(EQXMsg.INVOKE, this.invoke);
  65 + this.map.put(EQXMsg.NAME, EQXMsg.HTTP);
  66 + this.map.put(EQXMsg.TYPE, this.eqxRawIns.getType());
  67 + this.map.put(EQXMsg.CTYPE, this.eqxRawIns.getCtype());
  68 + if(this.eqxRawIns.getCtype().equals(EQXMsg.TEXTPLAIN) || this.eqxRawIns.getCtype().equals(EQXMsg.TEXTHTML)) {
  69 + this.map.put(EQXMsg.VAL, this.eqxRawIns.getMessage());
  70 + }
  71 + else {
  72 + this.eqxRawDatas.setRawMessage(this.eqxRawIns.getMessage());
  73 + }
  74 + this.eqxRawDatas.setRawDataAttributes(this.map);
  75 + this.eqxRawDatas.setTo(this.eqxRawIns.getTo());
  76 +
  77 + return this.eqxRawDatas;
  78 + }
  79 +
  80 + public EquinoxRawData getLdapMessage() {
  81 + if (this.invoke != null)
  82 + this.map.put(EQXMsg.INVOKE, this.invoke);
  83 + this.map.put(EQXMsg.NAME, EQXMsg.LDAP);
  84 + this.map.put(EQXMsg.TYPE, this.eqxRawIns.getType());
  85 + this.map.put(EQXMsg.CTYPE, this.eqxRawIns.getCtype());
  86 + this.map.put(EQXMsg.OID, this.eqxRawIns.getOid());
  87 + this.eqxRawDatas.setRawDataAttributes(this.map);
  88 + this.eqxRawDatas.setTo(this.eqxRawIns.getTo());
  89 + this.eqxRawDatas.setRawMessage(this.eqxRawIns.getMessage());
  90 +
  91 + return this.eqxRawDatas;
  92 + }
  93 +
  94 + public EquinoxRawData getSMPPMessage() {
  95 + if (this.invoke != null)
  96 + this.map.put(EQXMsg.INVOKE, this.invoke);
  97 + this.map.put(EQXMsg.NAME, EQXMsg.SMPP);
  98 + this.map.put(EQXMsg.TYPE, this.eqxRawIns.getType());
  99 + this.map.put(EQXMsg.CTYPE, this.eqxRawIns.getCtype());
  100 + this.eqxRawDatas.setRawDataAttributes(this.map);
  101 + this.eqxRawDatas.setTo(this.eqxRawIns.getTo());
  102 + this.eqxRawDatas.setRawMessage(this.eqxRawIns.getMessage());
  103 +
  104 + return this.eqxRawDatas;
  105 + }
  106 +
  107 + public EquinoxRawData getUpdateIns() {
  108 + return this.eqxRawDatas;
  109 + }
  110 +
  111 + public EQXRawInstance getEqxRawIns() {
  112 + return eqxRawIns;
  113 + }
  114 +
  115 + public void setEqxRawIns(EQXRawInstance eqxRawIns) {
  116 + this.eqxRawIns = eqxRawIns;
  117 + }
  118 +}
... ...
AF-Demo/src/af/message/MSGParser.java 0 → 100644
... ... @@ -0,0 +1,67 @@
  1 +package af.message;
  2 +
  3 +import java.util.ArrayList;
  4 +import af.instatnce.AFInstance;
  5 +import af.instatnce.E01Instance;
  6 +
  7 +public class MSGParser {
  8 + private String msg = "";
  9 + private E01Instance e01Ins = null;
  10 + private AFInstance afInstance = null;
  11 +
  12 +
  13 +
  14 + public MSGParser(String msg){
  15 + this.msg = msg;
  16 + }
  17 +
  18 + public void extractHTTPMessage(AFInstance afIns){
  19 + this.afInstance = afIns;
  20 +
  21 + }
  22 +
  23 + public void extractE01Message(E01Instance e01Ins){
  24 + this.e01Ins = e01Ins;
  25 + ArrayList<String> key = null;
  26 + String [] e01msg = this.msg.split(":");
  27 + String [] cmd = e01msg[0].split("=");
  28 + this.e01Ins.setCmd(cmd[1].trim());
  29 + String [] e01objAndkey = e01msg[1].split(",");
  30 + for(int i = 0; i < e01objAndkey.length; i++){
  31 + String [] e01val = e01objAndkey[i].split("=");
  32 + if(e01val[0].trim().equalsIgnoreCase("objecttype")){
  33 + this.e01Ins.setObjType(e01val[1].trim());
  34 + }
  35 + else if(e01val[0].contains("key")){
  36 + if(key == null){
  37 + key = new ArrayList<String>();
  38 + }
  39 + key.add(e01val[1].trim());
  40 + }
  41 + else if(e01val[0].trim().equalsIgnoreCase("data")){
  42 + this.e01Ins.setData(e01val[1].trim());
  43 + }
  44 + else if(e01val[0].trim().equalsIgnoreCase("id")){
  45 + this.e01Ins.setId(e01val[1].trim());
  46 + }
  47 + }
  48 +
  49 + this.e01Ins.setKey(key);
  50 + }
  51 +
  52 + public E01Instance getE01Ins() {
  53 + return e01Ins;
  54 + }
  55 +
  56 + public void setE01Ins(E01Instance e01Ins) {
  57 + this.e01Ins = e01Ins;
  58 + }
  59 +
  60 + public AFInstance getAFInstance() {
  61 + return afInstance;
  62 + }
  63 +
  64 + public void setMsgIns(AFInstance afInstance) {
  65 + this.afInstance = afInstance;
  66 + }
  67 +}
... ...
AF-Demo/src/af/state/StateIdle.java 0 → 100644
... ... @@ -0,0 +1,59 @@
  1 +package af.state;
  2 +
  3 +import java.util.ArrayList;
  4 +
  5 +import af.instatnce.E01Instance;
  6 +import af.instatnce.EC02Instance;
  7 +import af.interfaces.AFEvent;
  8 +import af.interfaces.AFState;
  9 +import af.interfaces.EQXMsg;
  10 +import af.message.EC02Builder;
  11 +
  12 +import ec02.af.abstracts.AbstractAF;
  13 +import ec02.af.data.EquinoxRawData;
  14 +import ec02.af.interfaces.IAFState;
  15 +import ec02.af.utils.AlarmCategory;
  16 +import ec02.af.utils.AlarmSeverity;
  17 +import ec02.af.utils.AlarmType;
  18 +
  19 +public class StateIdle implements IAFState {
  20 + private String eqxState = null;
  21 + private EC02Builder ec02Builder = new EC02Builder();
  22 + private ArrayList<EquinoxRawData> eqxRawDataList = new ArrayList<EquinoxRawData>();
  23 +
  24 + @Override
  25 + public String doAction(AbstractAF abstractAF, Object instance, ArrayList<EquinoxRawData> eqxRawDataList) {
  26 + EC02Instance ec02Ins = (EC02Instance) instance;
  27 +
  28 + for(EquinoxRawData eqxRawData : eqxRawDataList){
  29 + this.ec02Builder.setEquinoxRawData(eqxRawData, abstractAF, ec02Ins);
  30 + ec02Ins.getAFInstance().setInvoke(eqxRawData.getInvoke());
  31 + ec02Ins.getAFInstance().setOrig(eqxRawData.getRawDataAttribute(EQXMsg.ORIG));
  32 +
  33 + if(eqxRawData.getRawEventType().equals(AFEvent.Incoming_HTTP_Request)){
  34 + E01Instance e01Ins = new E01Instance();
  35 + ArrayList<String> keys = new ArrayList<String>();
  36 + keys.add(eqxRawData.getRawDataMessage());
  37 + keys.add("def");
  38 + keys.add("def");
  39 + keys.add("def");
  40 + keys.add("def");
  41 + e01Ins.setCmd("search");
  42 + e01Ins.setObjType("TESTDATA");
  43 + e01Ins.setKey(keys);
  44 +// e01Ins.setId("01");
  45 + ec02Ins.setE01Ins(e01Ins);
  46 + this.ec02Builder.getE01Request();
  47 + String [] parameter = {""};
  48 + abstractAF.getUtils().writeLog("mylog1", "hello word!!!");
  49 + abstractAF.getUtils().incrementStats("my_stat");
  50 + abstractAF.getUtils().incrementStats("raise_by_stat");
  51 + abstractAF.getUtils().raiseAlarm("my_alarm", parameter, AlarmSeverity.WARNING, AlarmCategory.APPLICATION, AlarmType.Normal);
  52 + this.eqxState = AFState.W_E01Res;
  53 + }
  54 + }
  55 + ec02Ins.setEqxRawDataList(this.eqxRawDataList);
  56 + return this.eqxState;
  57 + }
  58 +
  59 +}
... ...
AF-Demo/src/af/state/StateWaitA.java 0 → 100644
... ... @@ -0,0 +1,48 @@
  1 +package af.state;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.HashMap;
  5 +
  6 +import th.co.ais.equinox.utils.StringExtract;
  7 +import af.instatnce.EC02Instance;
  8 +import af.instatnce.EQXRawInstance;
  9 +import af.interfaces.AFEvent;
  10 +import af.interfaces.AFState;
  11 +import af.interfaces.EQXMsg;
  12 +import af.message.EC02Builder;
  13 +import ec02.af.abstracts.AbstractAF;
  14 +import ec02.af.data.EquinoxRawData;
  15 +import ec02.af.interfaces.IAFState;
  16 +
  17 +public class StateWaitA implements IAFState {
  18 + private String eqxState = null;
  19 + private EC02Builder ec02Builder = new EC02Builder();
  20 + private ArrayList<EquinoxRawData> eqxRawDataList = new ArrayList<EquinoxRawData>();
  21 +
  22 + @Override
  23 + public String doAction(AbstractAF abstractAF, Object instance, ArrayList<EquinoxRawData> eqxRawDataList) {
  24 + EC02Instance ec02Ins = (EC02Instance)instance;
  25 +
  26 + for(EquinoxRawData eqxRawData : eqxRawDataList) {
  27 + this.ec02Builder.setEquinoxRawData(eqxRawData, abstractAF, ec02Ins);
  28 + if(eqxRawData.getRawEventType().equals(AFEvent.Incoming_A_Response)){
  29 + StringExtract str = new StringExtract();
  30 + HashMap<String, String> map = str.getAll(str.setMessage(eqxRawData.getRawDataMessage().trim()));
  31 + String message = map.get("MSG[0].value");
  32 + if (message.trim().equals("SUCCESS")) {
  33 + EQXRawInstance eqxRaw = new EQXRawInstance();
  34 + eqxRaw.setMessage(message.trim());
  35 + eqxRaw.setTo(ec02Ins.getAFInstance().getOrig());
  36 + eqxRaw.setCtype(EQXMsg.TEXTPLAIN);
  37 + this.eqxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw));
  38 + this.eqxState = AFState.IDLE;
  39 + }
  40 + else {
  41 +
  42 + }
  43 + }
  44 + }
  45 + ec02Ins.setEqxRawDataList(this.eqxRawDataList);
  46 + return this.eqxState;
  47 + }
  48 +}
... ...
AF-Demo/src/af/state/StateWaitE01.java 0 → 100644
... ... @@ -0,0 +1,52 @@
  1 +package af.state;
  2 +
  3 +import java.util.ArrayList;
  4 +import af.instatnce.EC02Instance;
  5 +import af.instatnce.EQXRawInstance;
  6 +import af.interfaces.AFState;
  7 +import af.interfaces.EQXMsg;
  8 +import af.message.EC02Builder;
  9 +import ec02.af.abstracts.AbstractAF;
  10 +import ec02.af.data.EquinoxRawData;
  11 +import ec02.af.interfaces.IAFState;
  12 +
  13 +public class StateWaitE01 implements IAFState {
  14 + private String eqxState = null;
  15 + private EC02Builder ec02Builder = new EC02Builder();
  16 + private ArrayList<EquinoxRawData> eqxRawDataList = new ArrayList<EquinoxRawData>();
  17 +
  18 + @Override
  19 + public String doAction(AbstractAF abstractAF, Object instance, ArrayList<EquinoxRawData> eqxRawDataList) {
  20 + EC02Instance ec02Ins = (EC02Instance) instance;
  21 +
  22 + //receive E01 response
  23 + if(abstractAF.getUtils().getGlobalData().isRecieve()){
  24 + this.ec02Builder.setEquinoxRawData(abstractAF, ec02Ins);
  25 + //E01 return success
  26 + ec02Ins.setE01data(abstractAF.getUtils().getGlobalData().getDataResultSet().get(0).getData());
  27 + if(abstractAF.getUtils().getGlobalData().getResultCode().equals("0")){
  28 + ArrayList<EQXRawInstance> eqxRawList = new ArrayList<EQXRawInstance>();
  29 + if (ec02Ins.getE01data().equals("SUCCESS")) {
  30 + EQXRawInstance eqxRaw = new EQXRawInstance();
  31 + eqxRaw.setMessage("<MSG value=\"TEST\"/>");
  32 + eqxRaw.setTo(abstractAF.getUtils().getHmWarmConfig().get("Resource-Name-A").get(0));
  33 + eqxRaw.setCtype(EQXMsg.TEXTXML);
  34 + eqxRawList.add(eqxRaw);
  35 + ArrayList<EquinoxRawData> rawList = this.ec02Builder.getHTTPRequest(eqxRawList);
  36 + for (int i = 0; i < rawList.size(); i++) {
  37 + this.eqxRawDataList.add(rawList.get(i));
  38 + }
  39 + this.eqxState = AFState.W_ARes;
  40 + }
  41 + }
  42 + //E01 does not return success
  43 +
  44 + }
  45 + //E01 does not response
  46 + else{
  47 +
  48 + }
  49 + ec02Ins.setEqxRawDataList(this.eqxRawDataList);
  50 + return this.eqxState;
  51 + }
  52 +}
... ...
AF-Demo/src/af/utils/Zip.java 0 → 100644
... ... @@ -0,0 +1,72 @@
  1 +package af.utils;
  2 +
  3 +import java.io.ByteArrayOutputStream;
  4 +import java.io.IOException;
  5 +import java.io.UnsupportedEncodingException;
  6 +import java.util.zip.DataFormatException;
  7 +import java.util.zip.Deflater;
  8 +import java.util.zip.Inflater;
  9 +
  10 +/**
  11 + * Created by IntelliJ IDEA.
  12 + * User: Administrator
  13 + * Date: 25/8/2555
  14 + * To change this template use File | Settings | File Templates.
  15 + */
  16 +public class Zip {
  17 + public static byte[] compressBytes(byte[] input) throws UnsupportedEncodingException, IOException {
  18 + Deflater df = new Deflater(); //this function mainly generate the byte code
  19 + //df.setLevel(Deflater.BEST_COMPRESSION);
  20 + df.setInput(input);
  21 +
  22 + ByteArrayOutputStream baos = new ByteArrayOutputStream(input.length); //we write the generated byte code in this array
  23 + df.finish();
  24 + byte[] buff = new byte[1024]; //segment segment pop....segment set 1024
  25 + while (!df.finished()) {
  26 + int count = df.deflate(buff); //returns the generated code... index
  27 + baos.write(buff, 0, count); //write 4m 0 to count
  28 + }
  29 + baos.close();
  30 + byte[] output = baos.toByteArray();
  31 +
  32 + //System.out.println("Original: " + input.length);
  33 + //System.out.println("Compressed: " + output.length);
  34 + return output;
  35 + }
  36 +
  37 + public static byte[] extractBytes(byte[] input) throws UnsupportedEncodingException, IOException, DataFormatException {
  38 + Inflater ifl = new Inflater(); //mainly generate the extraction
  39 + //df.setLevel(Deflater.BEST_COMPRESSION);
  40 +// Log.i(input +"");
  41 + ifl.setInput(input);
  42 +
  43 + ByteArrayOutputStream baos = new ByteArrayOutputStream(input.length);
  44 + byte[] buff = new byte[1024];
  45 + while (!ifl.finished()) {
  46 + int count = ifl.inflate(buff);
  47 + baos.write(buff, 0, count);
  48 + }
  49 + baos.close();
  50 + byte[] output = baos.toByteArray();
  51 +
  52 + //System.out.println("Original: " + input.length);
  53 + //System.out.println("Extracted: " + output.length);
  54 + //System.out.println("Data:");
  55 + //System.out.println(new String(output));
  56 + return output;
  57 + }
  58 +
  59 + public static void compressFile(String src, String dest) throws IOException {
  60 + java.util.zip.GZIPOutputStream out = new java.util.zip.GZIPOutputStream(new java.io.FileOutputStream(dest));
  61 + java.io.FileInputStream in = new java.io.FileInputStream(src);
  62 + byte[] buf = new byte[1024];
  63 + int len;
  64 + while ((len = in.read(buf)) > 0) {
  65 + out.write(buf, 0, len);
  66 + }
  67 + in.close();
  68 + // Complete the GZIP file
  69 + out.finish();
  70 + out.close();
  71 + }
  72 +}
... ...