From: Kumaravel G. <kum...@ie...> - 2007-01-31 10:21:44
|
Hi , I knew that , SF language is untyped language. but still i am looking for any work around. Is there any way to get a "list of all atributes" which is a "TYPE of Component" . For example, ___________________________________dado_example.sf_______________ myPC0 extends pointcut { param "(object key, object o)"; call "(* Cashe.put(object key, object o))&&"; not-on "(jphost)"; } myPC1 extends pointcut { // sfProcessHost ATTRIB hostA; param "method(..args)"; execution "method"; } easy_Hook extends hook { pc ATTRIB myPC1; pc2 ATTRIB myPC2; .. ... advice ## after() { System.out.println("after"); } #; } ------------------------------------------------------------------------------ in hook.impl class, i would like to get the list of all attributes which is type of pointcut (or which extends pointcut). (the number of pc's may vary time to time.) -- Thanks, Kumaravel Ganesan Research Student *Dr.MGR EDUCATIONAL AND RESEARCH INSTITUTE Chennai , India email : kum...@ie... *** |
From: Steve L. <ste...@hp...> - 2007-02-01 23:29:47
|
Kumaravel Ganesan wrote: > Hi , > > I knew that , SF language is untyped language. but still i am looking > for any work around. > > Is there any way to get a "list of all atributes" which is a "TYPE of > Component" . > > > For example, > ___________________________________dado_example.sf_______________ > myPC0 extends pointcut > { > param "(object key, object o)"; > call "(* Cashe.put(object key, object o))&&"; > not-on "(jphost)"; > } > > myPC1 extends pointcut > { > // sfProcessHost ATTRIB hostA; > param "method(..args)"; > execution "method"; > } > > easy_Hook extends hook > { > > pc ATTRIB myPC1; > pc2 ATTRIB myPC2; > .. > ... > > advice ## > after() { > System.out.println("after"); > } > #; > } > ------------------------------------------------------------------------------ > > in hook.impl class, i would like to get the list of all attributes which > is type of pointcut (or which extends pointcut). > (the number of pc's may vary time to time.) In the implementation class, *after all your children are deployed* (but not necessarily started, just deployed is enough), you can run through the list of children and use instanceof to check their type. Like here, in the TestRunnerImpl class to run child test suites: private boolean executeBatchTests() throws RemoteException, SmartFrogException { boolean successful = true; Enumeration e = sfChildren(); while (e.hasMoreElements()) { Object child = e.nextElement(); if (child instanceof TestSuite) { TestSuite suiteComponent = (TestSuite) child; successful &= executeTestSuite(suiteComponent); } //break out if the thread is interrupted if (Thread.currentThread().isInterrupted()) { log.info("Test was interrupted"); return false; } if(!successful && !configuration.getKeepGoing()) { //we have failed and asked to stop in this situation log.info("Stopping tests after a failure"); return false; } } return successful; } You must check interface type and not implementation, because if the child is remote, the child is some RMI proxy that implements the remote interfaces, not the implementation class. -Steve |