AX AX2012 啟動時執行命令

2021-09-06 06:11:16 字數 3490 閱讀 3462

先來講講在開啟ax客戶端時,自動執行一些命令。客戶端程式ax32.exe在啟動時按先後順序呼叫以下方法:

the sysstartupcmd class is instantiated here.

super(sysstartupcmd)

info.startup()

//the sysstartupcmd class is instantiated here.

sysstartupcmd.infoinit()

super(sysstartupcmd)

info.startuppost()

sysstartupcmd.inforun()

ax32.exe -startupcmd= mycommand

sysstartupcmd例項的構建是在sysstartupcmd::construct(),在這裡使用switch...case判斷傳入的命令引數,構建相應的sysstartupcmd子類的例項,比如命令「batch」,會初始化乙個sysstartupcmdbatchrun的例項來執行。如果我們要實現自己的命令,可以從sysstartupcmd構建乙個子類,再放到sysstartupcmd::construct(),通過判斷傳入的命令引數來初始化我們的這個命令例項。

在這裡我們注意到乙個處理「autorun」命令的子類sysstartupcmdautorun,它處理類似「autorun_c:\folder\filename.xml」這樣的啟動命令列,「_」後是該命令的引數,由它標識乙個xml的配置檔案,下面是乙個xml配置檔案的例子:

<?

xml version=」1.0」

?>

<

axaptaautorun

exitwhendone

="false"

version

="4.0"

logfile

="d:\axapta\axaptaautorun.log"

>

<

crossreference

="false"

/>

<

licenseinformation

file

="d:\axapta\license.txt"

/>

<

configuration

>

<

configurationkey

name

="sysuserlog"

enabled

="true"

/>

<

configurationkey

name

="pba_advancedproductbuilder"

enabled

="false"

/>

configuration

>

<

adjustglobaltypes

>

<

accountnum

length

="24"

adjustright

="false"

/>

<

amountmst

displaylength

="12"

decimals

="10"

/>

adjustglobaltypes

>

<

synchronize

/>

<

updatecrossreference

/>

<

usergroups

>

<

usergroup

id="sales"

name

="sales force"

/>

usergroups

>

<

users

>

<

user

id="maryn"

name

="mary north"

email

="[email protected]"

language

="en-us"

companyid

="ex"

osaccount

="maryn"

/>

users

>

<

companyaccounts

>

<

company

id="nwt"

name

="northwind traders"

overwrite

="true"

/>

companyaccounts

>

<

xpoimport

file

="d:\axapta\setup\xpo\logger\enum_testlogentrytype.xpo"

/>

<

dataimport

companyid

="bvt"

file

="d:\axapta\basedata.dat"

/>

<

run

type

="class"

name

="runmytests"

method

="main"

/>

<

run

type

="displaymenuitem"

name

="mytestmenuitem"

/>

<

preventchecklist

/>

axaptaautorun

>

可以在配置檔案中指定使用者資訊、license等,還有就是指定的自動執行命令,比如上面的例子中執行乙個class的main方法,以及執行乙個選單項。

實際上在sysstartupcmdautorun內部,它使用 sysautorun::construct(xmlfile)構建乙個sysautorun的例項,由它來具體解析和執行在xml檔案中的命令和配置。

ax32.exe -command=value -command2=value

ax32serve.exe -command=value -command2=value

也可以把命令列「-command=value -command2=value」直接填入配置工具的「configuration command to run at kernel startup」內,效果和命令列引數是一樣的。

順便指出「ax32.exe -development 」可以直接開啟開發workspace,這裡的「-development」命令引數不屬於kenerl命令引數。

專案啟動時執行特定方法

commandlinerunner import org.springframework.boot.commandlinerunner import org.springframework.stereotype.component component public class mycommandli...

mysql啟動時執行過程 mysql啟動過程

明白 etc init.d mysql從 來,和mysql.server什麼關係?etc init.d mysql和mysqld safe之間的關係 mysqld safe怎麼把mysql啟動起來的 mysql就是mysql.server拷貝到這裡來的。mysql啟動,呼叫mysqld safe m...

SpringBoot啟動時執行特定的任務

springboot啟動時,執行任務commandlinerunner 在開發過程中,可能需要實現專案啟動之後執行功能,springboot提供的一種方案 就是用乙個bean或者model實現commandlinerunner介面,將實現功能的 放在run 方法中.componentscan cn....