java - How can I parse job definition kind of file -
assume have kind of file
schedule aep#gsae3_sco_d99008 timezone ect description "apollo_ mqft sending jobs" on runcycle rule1 "freq=daily;" : aep#gsae3_sco_d99008_asup_ord_v4 scriptname "-job z3_sco_d99008_asup_ord_v4 -user beckdel1 -i 04093800 -c c" streamlogon batchatl description "take customer order send in mqft format" tasktype sap recovery stop @ 2145 timezone ect needs 1 aep#gsae_sco ... end this file tws (tivoli workload scheduler). want json or xml file looks like:
{ "jobstream":"aep#gsae3_sco_d99008", "timezone": "ect", "description": "apollo_ mqft sending jobs", "jobs": {[ "job": "aep#gsae3_sco_d99008_asup_ord_v4", "sap_job": "z3_sco_d99008_asup_ord_v4", "sap_user": "beckdel1", "id": 04093800, "streamlogon": "batchatl", "description": "take customer order send in mqft format", "tasktype": "sap", "recovery": "stop", "at": 2145, "timezone": "ect" ],[...]} what need read understand how can parse kind of file? tried use bufferreader , scanner in java. have 2 java classes: jobstream , job. jobstream:
public class jobstream { private string name; private string timezone; private string description; private arraylist<job> jobs; public jobstream(string name, string timezone, string description) { this.name = name; this.timezone = timezone; this.description = description; this.jobs = new arraylist<>(); } public void appendjob(job job) { this.jobs.add(job); } } and job:
public class job { private string name; private string sapname; private string sapuser; private int id; private string logon; private string description; private string type; private string recovery; private int at; private string timezone; public job(string name, string sapname, string sapuser, int id, string logon, string description, string type, string recovery, int at, string timezone) { this.name = name; this.sapname = sapname; this.sapuser = sapuser; this.id = id; this.logon = logon; this.description = description; this.type = type; this.recovery = recovery; this.at = at; this.timezone = timezone; } } so that's structure.
it awesome if tell me way can make it.
have nice day!
p.s. i'm not asking me write parser. i'm asking me find information need write myself.
Comments
Post a Comment