KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > core > descriptor > xml > ProcessDefinitionHandler


1 /*
2  * ################################################################
3  *
4  * ProActive: The Java(TM) library for Parallel, Distributed,
5  * Concurrent computing with Security and Mobility
6  *
7  * Copyright (C) 1997-2002 INRIA/University of Nice-Sophia Antipolis
8  * Contact: proactive-support@inria.fr
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23  * USA
24  *
25  * Initial developer(s): The ProActive Team
26  * http://www.inria.fr/oasis/ProActive/contacts.html
27  * Contributor(s):
28  *
29  * ################################################################
30  */

31 package org.objectweb.proactive.core.descriptor.xml;
32
33 import org.objectweb.proactive.core.ProActiveException;
34 import org.objectweb.proactive.core.descriptor.data.ProActiveDescriptor;
35 import org.objectweb.proactive.core.process.ExternalProcess;
36 import org.objectweb.proactive.core.process.ExternalProcessDecorator;
37 import org.objectweb.proactive.core.process.JVMProcess;
38 import org.objectweb.proactive.core.process.globus.GlobusProcess;
39 import org.objectweb.proactive.core.process.lsf.LSFBSubProcess;
40 import org.objectweb.proactive.core.process.prun.PrunSubProcess;
41 import org.objectweb.proactive.core.process.rsh.maprsh.MapRshProcess;
42 import org.objectweb.proactive.core.xml.handler.AbstractUnmarshallerDecorator;
43 import org.objectweb.proactive.core.xml.handler.BasicUnmarshaller;
44 import org.objectweb.proactive.core.xml.handler.BasicUnmarshallerDecorator;
45 import org.objectweb.proactive.core.xml.handler.CollectionUnmarshaller;
46 import org.objectweb.proactive.core.xml.handler.PassiveCompositeUnmarshaller;
47 import org.objectweb.proactive.core.xml.handler.UnmarshallerHandler;
48 import org.objectweb.proactive.core.xml.io.Attributes;
49
50 import org.xml.sax.SAXException JavaDoc;
51
52
53 public class ProcessDefinitionHandler extends AbstractUnmarshallerDecorator
54     implements ProActiveDescriptorConstants {
55     protected String JavaDoc id;
56     protected ProActiveDescriptor proActiveDescriptor;
57     protected ExternalProcess targetProcess;
58
59     public ProcessDefinitionHandler(ProActiveDescriptor proActiveDescriptor) {
60         super(false);
61         this.proActiveDescriptor = proActiveDescriptor;
62         this.addHandler(JVM_PROCESS_TAG,
63             new JVMProcessHandler(proActiveDescriptor));
64         this.addHandler(RSH_PROCESS_TAG,
65             new RSHProcessHandler(proActiveDescriptor));
66         this.addHandler(MAPRSH_PROCESS_TAG,
67             new MapRshProcessHandler(proActiveDescriptor));
68         this.addHandler(SSH_PROCESS_TAG,
69             new SSHProcessHandler(proActiveDescriptor));
70         this.addHandler(RLOGIN_PROCESS_TAG,
71             new RLoginProcessHandler(proActiveDescriptor));
72         this.addHandler(BSUB_PROCESS_TAG,
73             new BSubProcessHandler(proActiveDescriptor));
74         this.addHandler(GLOBUS_PROCESS_TAG,
75             new GlobusProcessHandler(proActiveDescriptor));
76         this.addHandler(PRUN_PROCESS_TAG,
77             new PrunProcessHandler(proActiveDescriptor));
78     }
79
80     /**
81      * @see org.objectweb.proactive.core.xml.handler.AbstractUnmarshallerDecorator#notifyEndActiveHandler(String, UnmarshallerHandler)
82      */

83     protected void notifyEndActiveHandler(String JavaDoc name,
84         UnmarshallerHandler activeHandler) throws SAXException JavaDoc {
85     }
86
87     /**
88      * @see org.objectweb.proactive.core.xml.handler.UnmarshallerHandler#getResultObject()
89      */

90     public Object JavaDoc getResultObject() throws SAXException JavaDoc {
91         ExternalProcess result = targetProcess;
92         targetProcess = null;
93         return result;
94     }
95
96     /**
97      * @see org.objectweb.proactive.core.xml.handler.UnmarshallerHandler#startContextElement(String, Attributes)
98      */

99     public void startContextElement(String JavaDoc name, Attributes attributes)
100         throws SAXException JavaDoc {
101         id = attributes.getValue("id");
102     }
103
104     public class ProcessHandler extends AbstractUnmarshallerDecorator
105         implements ProActiveDescriptorConstants {
106         protected ProActiveDescriptor proActiveDescriptor;
107         protected boolean isRef;
108
109         public ProcessHandler(ProActiveDescriptor proActiveDescriptor) {
110             super();
111             this.proActiveDescriptor = proActiveDescriptor;
112             addHandler(ENVIRONMENT_TAG, new EnvironmentHandler());
113             addHandler(PROCESS_REFERENCE_TAG, new ProcessReferenceHandler());
114         }
115
116         public void startContextElement(String JavaDoc name, Attributes attributes)
117             throws org.xml.sax.SAXException JavaDoc {
118             String JavaDoc className = attributes.getValue("class");
119             if (!checkNonEmpty(className)) {
120                 throw new org.xml.sax.SAXException JavaDoc(
121                     "Process defined without specifying the class");
122             }
123             try {
124                 targetProcess = proActiveDescriptor.createProcess(id, className);
125             } catch (ProActiveException e) {
126                 //e.printStackTrace();
127
throw new org.xml.sax.SAXException JavaDoc(e.getMessage());
128             }
129             String JavaDoc hostname = attributes.getValue("hostname");
130             if (checkNonEmpty(hostname)) {
131                 targetProcess.setHostname(hostname);
132             }
133             String JavaDoc username = attributes.getValue("username");
134             if (checkNonEmpty(username)) {
135                 targetProcess.setUsername("username");
136             }
137         }
138
139         //
140
// -- implements UnmarshallerHandler ------------------------------------------------------
141
//
142
public Object JavaDoc getResultObject() throws org.xml.sax.SAXException JavaDoc {
143             return null;
144         }
145
146         //
147
// -- PROTECTED METHODS ------------------------------------------------------
148
//
149
protected void notifyEndActiveHandler(String JavaDoc name,
150             UnmarshallerHandler activeHandler) throws org.xml.sax.SAXException JavaDoc {
151             if (name.equals(ENVIRONMENT_TAG)) {
152                 targetProcess.setEnvironment((String JavaDoc[]) activeHandler.getResultObject());
153             } else if (name.equals(PROCESS_REFERENCE_TAG)) {
154                 if (!(targetProcess instanceof ExternalProcessDecorator)) {
155                     throw new org.xml.sax.SAXException JavaDoc(
156                         "found a Process defined inside a non composite process");
157                 }
158                 ExternalProcessDecorator cep = (ExternalProcessDecorator) targetProcess;
159                 Object JavaDoc result = activeHandler.getResultObject();
160                 proActiveDescriptor.registerProcess(cep, (String JavaDoc) result);
161             }
162         }
163
164         //
165
// -- INNER CLASSES ------------------------------------------------------
166
//
167

168         /**
169          * This class receives environment events
170          */

171         protected class EnvironmentHandler extends BasicUnmarshaller {
172             private java.util.ArrayList JavaDoc variables;
173
174             public EnvironmentHandler() {
175             }
176
177             public void startContextElement(String JavaDoc name, Attributes attributes)
178                 throws org.xml.sax.SAXException JavaDoc {
179                 variables = new java.util.ArrayList JavaDoc();
180             }
181
182             public Object JavaDoc getResultObject() throws org.xml.sax.SAXException JavaDoc {
183                 if (variables == null) {
184                     isResultValid = false;
185                 } else {
186                     int n = variables.size();
187                     String JavaDoc[] result = new String JavaDoc[n];
188                     if (n > 0) {
189                         variables.toArray(result);
190                     }
191                     setResultObject(result);
192                     variables.clear();
193                     variables = null;
194                 }
195                 return super.getResultObject();
196             }
197
198             public void startElement(String JavaDoc name, Attributes attributes)
199                 throws org.xml.sax.SAXException JavaDoc {
200                 if (name.equals(VARIABLE_TAG)) {
201                     String JavaDoc vName = attributes.getValue("name");
202                     String JavaDoc vValue = attributes.getValue("value");
203                     if (checkNonEmpty(vName) && (vValue != null)) {
204                         logger.info("Found environment variable name=" + vName +
205                             " value=" + vValue);
206                         variables.add(vName + "=" + vValue);
207                     }
208                 }
209             }
210         }
211
212         // end inner class EnvironmentHandler
213
}
214
215     //end of inner class ProcessHandler
216
protected class PrunProcessHandler extends ProcessHandler {
217         public PrunProcessHandler(ProActiveDescriptor proActiveDescriptor) {
218             super(proActiveDescriptor);
219             this.addHandler(PRUN_OPTIONS_TAG, new PrunOptionHandler());
220             // System.out.println("ProcessDefinitionHandler.PrunProcessHandler()");
221
}
222
223         protected class PrunOptionHandler extends PassiveCompositeUnmarshaller {
224             // private static final String HOSTLIST_ATTRIBUTE = "hostlist";
225
// private static final String PROCESSOR_ATRIBUTE = "processor";
226
//private LSFBSubProcess bSubProcess;
227
public PrunOptionHandler() {
228                 //this.bSubProcess = (LSFBSubProcess)targetProcess;
229
// System.out.println("ProcessDefinitionHandler.PrunOptionHandler()");
230
UnmarshallerHandler pathHandler = new PathHandler();
231                 this.addHandler(HOST_LIST_TAG, new SingleValueUnmarshaller());
232                 this.addHandler(HOSTS_NUMBER_TAG, new SingleValueUnmarshaller());
233                 this.addHandler(PROCESSOR_TAG, new SingleValueUnmarshaller());
234                 this.addHandler(BOOKING_DURATION_TAG,
235                     new SingleValueUnmarshaller());
236                 this.addHandler(PRUN_OUTPUT_FILE, new SingleValueUnmarshaller());
237                 BasicUnmarshallerDecorator bch = new BasicUnmarshallerDecorator();
238                 bch.addHandler(ABS_PATH_TAG, pathHandler);
239                 bch.addHandler(REL_PATH_TAG, pathHandler);
240                 // this.addHandler(SCRIPT_PATH_TAG, bch);
241
}
242
243             public void startContextElement(String JavaDoc name, Attributes attributes)
244                 throws org.xml.sax.SAXException JavaDoc {
245             }
246
247             protected void notifyEndActiveHandler(String JavaDoc name,
248                 UnmarshallerHandler activeHandler)
249                 throws org.xml.sax.SAXException JavaDoc {
250                 // we know that it is a prun process since we are
251
// in prun option!!!
252
PrunSubProcess prunSubProcess = (PrunSubProcess) targetProcess;
253
254                 // System.out.println("+++++ notifyEndActiveHandler " + name);
255
if (name.equals(HOST_LIST_TAG)) {
256                     prunSubProcess.setHostList((String JavaDoc) activeHandler.getResultObject());
257                 } else if (name.equals(HOSTS_NUMBER_TAG)) {
258                     prunSubProcess.setHostsNumber((String JavaDoc) activeHandler.getResultObject());
259                 } else if (name.equals(PROCESSOR_PER_NODE_TAG)) {
260                     prunSubProcess.setProcessorPerNodeNumber((String JavaDoc) activeHandler.getResultObject());
261                     // } else if (name.equals(SCRIPT_PATH_TAG)) {
262
// prunSubProcess.setScriptLocation((String) activeHandler.getResultObject());
263
// }
264
} else if (name.equals(BOOKING_DURATION_TAG)) {
265                     prunSubProcess.setBookingDuration((String JavaDoc) activeHandler.getResultObject());
266                 } else if (name.equals(PRUN_OUTPUT_FILE)) {
267                     prunSubProcess.setOutputFile((String JavaDoc) activeHandler.getResultObject());
268                 } else {
269                     super.notifyEndActiveHandler(name, activeHandler);
270                 }
271             }
272         }
273     }
274
275     //end of inner class PrunProcessHandler
276
protected class JVMProcessHandler extends ProcessHandler {
277         public JVMProcessHandler(ProActiveDescriptor proActiveDescriptor) {
278             super(proActiveDescriptor);
279             UnmarshallerHandler pathHandler = new PathHandler();
280             {
281                 CollectionUnmarshaller cu = new CollectionUnmarshaller(String JavaDoc.class);
282                 cu.addHandler(ABS_PATH_TAG, pathHandler);
283                 cu.addHandler(REL_PATH_TAG, pathHandler);
284                 cu.addHandler(JVMPARAMETER_TAG, new SimpleValueHandler());
285                 this.addHandler(CLASSPATH_TAG, cu);
286                 this.addHandler(BOOT_CLASSPATH_TAG, cu);
287                 this.addHandler(JVMPARAMETERS_TAG, cu);
288             }
289             BasicUnmarshallerDecorator bch = new BasicUnmarshallerDecorator();
290             bch.addHandler(ABS_PATH_TAG, pathHandler);
291             bch.addHandler(REL_PATH_TAG, pathHandler);
292             bch.addHandler(JVMPARAMETER_TAG, new BasicUnmarshaller());
293             // this.addHandler(JVMPARAMETERS_TAG, bch);
294
this.addHandler(JAVA_PATH_TAG, bch);
295             this.addHandler(POLICY_FILE_TAG, bch);
296             this.addHandler(LOG4J_FILE_TAG, bch);
297             this.addHandler(PROACTIVE_PROPS_FILE_TAG, bch);
298             this.addHandler(CLASSNAME_TAG, new SingleValueUnmarshaller());
299             this.addHandler(PARAMETERS_TAG, new SingleValueUnmarshaller());
300             // this.addHandler(JVMPARAMETERS_TAG, new SingleValueUnmarshaller());
301
}
302
303         //
304
// ----- PUBLIC METHODS -----------------------------------------------------------------------------------
305
//
306
//
307
// ----- PROTECTED METHODS -----------------------------------------------------------------------------------
308
//
309
protected void notifyEndActiveHandler(String JavaDoc name,
310             UnmarshallerHandler activeHandler) throws org.xml.sax.SAXException JavaDoc {
311             // the fact targetProcess is a JVMProcess is checked in startContextElement
312
//super.notifyEndActiveHandler(name,activeHandler);
313
JVMProcess jvmProcess = (JVMProcess) targetProcess;
314
315             if (name.equals(CLASSPATH_TAG)) {
316                 String JavaDoc[] paths = (String JavaDoc[]) activeHandler.getResultObject();
317                 if (paths.length > 0) {
318                     StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
319                     String JavaDoc pathSeparator = System.getProperty("path.separator");
320                     sb.append(paths[0]);
321                     for (int i = 1; i < paths.length; i++) {
322                         sb.append(pathSeparator);
323                         sb.append(paths[i]);
324                     }
325                     jvmProcess.setClasspath(sb.toString());
326                 }
327             } else if (name.equals(BOOT_CLASSPATH_TAG)) {
328                 String JavaDoc[] paths = (String JavaDoc[]) activeHandler.getResultObject();
329                 if (paths.length > 0) {
330                     StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
331                     String JavaDoc pathSeparator = System.getProperty("path.separator");
332                     sb.append(paths[0]);
333                     for (int i = 1; i < paths.length; i++) {
334                         sb.append(pathSeparator);
335                         sb.append(paths[i]);
336                     }
337                     jvmProcess.setBootClasspath(sb.toString());
338                 }
339             } else if (name.equals(JVMPARAMETERS_TAG)) {
340                 String JavaDoc[] paths = (String JavaDoc[]) activeHandler.getResultObject();
341
342                 if (paths.length > 0) {
343                     StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
344                     for (int i = 0; i < paths.length; i++) {
345                         // sb.append(pathSeparator);
346
sb.append(paths[i]);
347                         sb.append(" ");
348                     }
349                     jvmProcess.setJvmOptions(sb.toString());
350                 }
351             } else if (name.equals(JAVA_PATH_TAG)) {
352                 String JavaDoc jp = (String JavaDoc) activeHandler.getResultObject();
353                 jvmProcess.setJavaPath(jp);
354             } else if (name.equals(POLICY_FILE_TAG)) {
355                 jvmProcess.setPolicyFile((String JavaDoc) activeHandler.getResultObject());
356             } else if (name.equals(LOG4J_FILE_TAG)) {
357                 jvmProcess.setLog4jFile((String JavaDoc) activeHandler.getResultObject());
358             } else if (name.equals(PROACTIVE_PROPS_FILE_TAG)) {
359                 jvmProcess.setJvmOptions("-Dproactive.configuration=" +
360                     (String JavaDoc) activeHandler.getResultObject());
361             } else if (name.equals(CLASSNAME_TAG)) {
362                 jvmProcess.setClassname((String JavaDoc) activeHandler.getResultObject());
363             } else if (name.equals(PARAMETERS_TAG)) {
364                 jvmProcess.setParameters((String JavaDoc) activeHandler.getResultObject());
365             } // else if (name.equals(JVMPARAMETERS_TAG)) {
366

367             else {
368                 super.notifyEndActiveHandler(name, activeHandler);
369             }
370         }
371     }
372
373     // end of inner class JVMProcessHandler
374
protected class RSHProcessHandler extends ProcessHandler {
375         public RSHProcessHandler(ProActiveDescriptor proActiveDescriptor) {
376             super(proActiveDescriptor);
377         }
378     }
379
380     //end of inner class RSHProcessHandler
381
protected class MapRshProcessHandler extends ProcessHandler {
382         public MapRshProcessHandler(ProActiveDescriptor proActiveDescriptor) {
383             super(proActiveDescriptor);
384             UnmarshallerHandler pathHandler = new PathHandler();
385             BasicUnmarshallerDecorator bch = new BasicUnmarshallerDecorator();
386             bch.addHandler(ABS_PATH_TAG, pathHandler);
387             bch.addHandler(REL_PATH_TAG, pathHandler);
388             this.addHandler(SCRIPT_PATH_TAG, bch);
389         }
390
391         public void startContextElement(String JavaDoc name, Attributes attributes)
392             throws org.xml.sax.SAXException JavaDoc {
393             // we know that it is a maprsh process since we are
394
// in map rsh handler!!!
395
//MapRshProcess mapRshProcess = (MapRshProcess)targetProcess;
396
super.startContextElement(name, attributes);
397             String JavaDoc parallelize = attributes.getValue("parallelize");
398             if (checkNonEmpty(parallelize)) {
399                 ((MapRshProcess) targetProcess).setParallelization(
400                     "parallelize");
401             }
402         }
403
404         protected void notifyEndActiveHandler(String JavaDoc name,
405             UnmarshallerHandler activeHandler) throws org.xml.sax.SAXException JavaDoc {
406             //MapRshProcess mapRshProcess = (MapRshProcess)targetProcess;
407
if (name.equals(SCRIPT_PATH_TAG)) {
408                 ((MapRshProcess) targetProcess).setScriptLocation((String JavaDoc) activeHandler.getResultObject());
409             } else {
410                 super.notifyEndActiveHandler(name, activeHandler);
411             }
412         }
413     }
414
415     //end of inner class MapRshProcessHandler
416
protected class SSHProcessHandler extends ProcessHandler {
417         public SSHProcessHandler(ProActiveDescriptor proActiveDescriptor) {
418             super(proActiveDescriptor);
419         }
420     }
421
422     //end of inner class SSHProcessHandler
423
protected class RLoginProcessHandler extends ProcessHandler {
424         public RLoginProcessHandler(ProActiveDescriptor proActiveDescriptor) {
425             super(proActiveDescriptor);
426         }
427     }
428
429     //end of inner class RLoginProcessHandler
430
protected class BSubProcessHandler extends ProcessHandler {
431         public BSubProcessHandler(ProActiveDescriptor proActiveDescriptor) {
432             super(proActiveDescriptor);
433             this.addHandler(BSUB_OPTIONS_TAG, new BsubOptionHandler());
434         }
435
436         public void startContextElement(String JavaDoc name, Attributes attributes)
437             throws org.xml.sax.SAXException JavaDoc {
438             // we know that it is a maprsh process since we are
439
// in map rsh handler!!!
440
//MapRshProcess mapRshProcess = (MapRshProcess)targetProcess;
441
super.startContextElement(name, attributes);
442             String JavaDoc interactive = (attributes.getValue("interactive"));
443             if (checkNonEmpty(interactive)) {
444                 ((LSFBSubProcess) targetProcess).setInteractive(interactive);
445             }
446             String JavaDoc queueName = (attributes.getValue("queue"));
447             if (checkNonEmpty(queueName)) {
448                 ((LSFBSubProcess) targetProcess).setQueueName(queueName);
449             }
450         }
451
452         protected class BsubOptionHandler extends PassiveCompositeUnmarshaller {
453             // private static final String HOSTLIST_ATTRIBUTE = "hostlist";
454
// private static final String PROCESSOR_ATRIBUTE = "processor";
455
//private LSFBSubProcess bSubProcess;
456
public BsubOptionHandler() {
457                 //this.bSubProcess = (LSFBSubProcess)targetProcess;
458
UnmarshallerHandler pathHandler = new PathHandler();
459                 this.addHandler(HOST_LIST_TAG, new SingleValueUnmarshaller());
460                 this.addHandler(PROCESSOR_TAG, new SingleValueUnmarshaller());
461                 this.addHandler(RES_REQ_TAG, new SimpleValueHandler());
462                 BasicUnmarshallerDecorator bch = new BasicUnmarshallerDecorator();
463                 bch.addHandler(ABS_PATH_TAG, pathHandler);
464                 bch.addHandler(REL_PATH_TAG, pathHandler);
465                 this.addHandler(SCRIPT_PATH_TAG, bch);
466             }
467
468             public void startContextElement(String JavaDoc name, Attributes attributes)
469                 throws org.xml.sax.SAXException JavaDoc {
470             }
471
472             protected void notifyEndActiveHandler(String JavaDoc name,
473                 UnmarshallerHandler activeHandler)
474                 throws org.xml.sax.SAXException JavaDoc {
475                 // we know that it is a bsub process since we are
476
// in bsub option!!!
477
LSFBSubProcess bSubProcess = (LSFBSubProcess) targetProcess;
478                 if (name.equals(HOST_LIST_TAG)) {
479                     bSubProcess.setHostList((String JavaDoc) activeHandler.getResultObject());
480                 } else if (name.equals(PROCESSOR_TAG)) {
481                     bSubProcess.setProcessorNumber((String JavaDoc) activeHandler.getResultObject());
482                 } else if (name.equals(RES_REQ_TAG)) {
483                     bSubProcess.setRes_requirement((String JavaDoc) activeHandler.getResultObject());
484                 } else if (name.equals(SCRIPT_PATH_TAG)) {
485                     bSubProcess.setScriptLocation((String JavaDoc) activeHandler.getResultObject());
486                 } else {
487                     super.notifyEndActiveHandler(name, activeHandler);
488                 }
489             }
490         }
491
492         // end inner class OptionHandler
493
}
494
495     // end of inner class BSubProcessHandler
496
protected class GlobusProcessHandler extends ProcessHandler {
497         public GlobusProcessHandler(ProActiveDescriptor proActiveDescriptor) {
498             super(proActiveDescriptor);
499             this.addHandler(GLOBUS_OPTIONS_TAG, new GlobusOptionHandler());
500         }
501
502         protected class GlobusOptionHandler extends PassiveCompositeUnmarshaller {
503             public GlobusOptionHandler() {
504                 this.addHandler(GLOBUS_COUNT_TAG, new SingleValueUnmarshaller());
505             }
506
507             public void startContextElement(String JavaDoc name, Attributes attributes)
508                 throws org.xml.sax.SAXException JavaDoc {
509             }
510
511             protected void notifyEndActiveHandler(String JavaDoc name,
512                 UnmarshallerHandler activeHandler)
513                 throws org.xml.sax.SAXException JavaDoc {
514                 // we know that it is a globus process since we are
515
// in globus option!!!
516
GlobusProcess globusProcess = (GlobusProcess) targetProcess;
517                 if (name.equals(GLOBUS_COUNT_TAG)) {
518                     globusProcess.setCount((String JavaDoc) activeHandler.getResultObject());
519                 } else {
520                     super.notifyEndActiveHandler(name, activeHandler);
521                 }
522             }
523         }
524
525         //end of inner class GlobusOptionHandler
526
}
527
528     //end of inner class GlobusProcessHandler
529
private class SingleValueUnmarshaller extends BasicUnmarshaller {
530         public void readValue(String JavaDoc value) throws org.xml.sax.SAXException JavaDoc {
531             //System.out.println("SingleValueUnmarshaller.readValue() " + value);
532
setResultObject(value);
533         }
534     }
535
536     private class SimpleValueHandler extends BasicUnmarshaller {
537         public void startContextElement(String JavaDoc name, Attributes attributes)
538             throws org.xml.sax.SAXException JavaDoc {
539             // read from XML
540
String JavaDoc value = attributes.getValue("value");
541
542             setResultObject(value);
543         }
544     }
545
546     //end of inner class SingleValueUnmarshaller
547
}
548
Popular Tags