public State process(Context cntx) throws TaskException, SysException,
InterruptedException {
State st = paramsValidateAndPrepare(cntx);
if (st != null)
return st;
Process prc = Process.currentProcess();
FindStringStream fss = new FindStringStream();
fss.add("<%prm.", Prm.class);
fss.add("%>", End.class);
fss.setOutSkipped(true);
// //////
FileInputStream fis = null;
java.io.InputStreamReader isr = null;
try {
if (source instanceof File) {
try {
fis = new FileInputStream(((File) source).getCanonicalPath());
prc.regResource(fis);
isr = new java.io.InputStreamReader(fis, "utf-8");
prc.regResource(isr);
} catch (FileNotFoundException e) {
throw new TaskException(State.DONE_ERR, e);
} catch (UnsupportedEncodingException e) {
try {
fis.close();
} catch (IOException e1) {
e1.printStackTrace();
}
throw new TaskException(State.DONE_ERR, e);
} catch (IOException e) {
try {
fis.close();
} catch (IOException e1) {
e1.printStackTrace();
}
throw new TaskException(State.DONE_ERR, e);
}
}
StringBuffer sb = new StringBuffer();
prc.regResourceName(sb, "msg.full");
int ch;
Object r;
Object prev = null;
Object o = null;
try {
while ((ch = isr.read()) != -1) {
fss.write((char) ch);
if (fss.available() > 0)
while ((r = fss.readObject()) != null) {
if (r instanceof Skipped) {
if ((prev != null) && (prev instanceof Prm)) {
((Prm) prev).name = r.toString();
try {
o = cntx.getPrmByFullName(((Prm) prev).name);
} catch(Throwable e) {
o = e.getMessage();
}
String v = o.toString();
prc.regResourceName(v, "msg.part");
if (!Null.equ(v))
sb.append(v);
prev = null;
} else {
String v = ((Skipped) r).getValue();
prc.regResourceName(v, "msg.part");
if (!Null.equ(v))
sb.append(v);
}
cntx.getPrmByFullName("update");
} else if (r instanceof Prm) {
prev = r;
// System.out.println(r.toString() + "\t=\t" + r.getClass());
} else {
prev = null;
}
}
}
fss.write(FindStringStream.EOF);
if (fss.available() > 0)
while ((r = fss.readObject()) != null)
if (r instanceof Skipped) {
if ((prev != null) && (prev instanceof Prm)) {
((Prm) prev).name = r.toString();
try {
o = cntx.getPrmByFullName(((Prm) prev).name);
} catch(Throwable e) {
o = e.getMessage();
}
String v = o.toString();
prc.regResourceName(v, "msg.part");
if (!Null.equ(v))
sb.append(v);
prev = null;
} else {
String v = ((Skipped) r).getValue();
prc.regResourceName(v, "msg.part");
if (!Null.equ(v))
sb.append(v);
}
cntx.getPrmByFullName("update");
} else if (r instanceof Prm) {