From: Guijarro, J. <jul...@hp...> - 2006-03-28 22:49:06
|
Hi Hal, =20 The ANT component did not check for attribute values using SmartFrog reference and it was adding then directly to the Ant tasks without trying to resolve them first and that is the reason for the class cast exception. I have fixed the ANT component in CVS. =20 In your example there was another potential problem because the LoadPropertyFile component was creating the sf attributes during sfStart instead of sfDeploy. I have also fixed this component in CVS and it now gets ready to be used/queried during sfDeploy. =20 With all these changes your example should now work, otherwise please let me know. =20 Regards,=20 =20 Julio =20 ________________________________ From: sma...@li... [mailto:sma...@li...] On Behalf Of Hal Hildebrand Sent: 27 March 2006 21:32 To: smartfrog-developer Subject: [Smartfrog-developer] Lazy concatenation of strings and Ant =20 I have a need to lazily concatenate strings - i.e. concatenate values that may not be available until after deployment. These strings are then to be used in various places in the SF Ant integration - usually in Java execution. =20 Here's a scenario I've put together which demonstrates the problem I have. =20 The script reads in properties from a property file, using the org.smartfrog.services.os.java.propertyfile.sf mechanism. One of these properties will then be used in a concatenation and then fed as an argument to an Ant task - in the example below, simply echoing out the message. =20 The contents of the property file, "test.properties" is simply: =20 OH=3Dd:/projects/lilly-pads/iAS/oc4j =20 The result of running this test is a class cast exception (see stack trace at end of email - note, code has been altered, so it won't match your line numbers. See below for code context). =20 The question is whether this is easy to fix in the Ant integration components, or if this is a kind of general problem that may not be easy to overcome. If it's an easy fix to the Ant integration, just point me in the general direction and I can probably take it from there. My concern, however, is that this is a general issue that components will have to be modified in order for them to work with this kind of lazy system. While I'm using the property file mechanism as an example, it is merely a convenient mechanism to demonstrate the problem - it is not emblematic of all the use cases where I need this lazy concatenation. =20 Thanks. =20 =20 #include "org/smartfrog/components.sf" #include "org/smartfrog/services/ant/components.sf"; #include "org/smartfrog/services/utils/concat/components.sf" #include "org/smartfrog/services/os/java/propertyfile.sf" =20 sfConfig extends Compound { testProps extends LoadPropertyFile { filename "test.properties"; } oracle_home LAZY testProps:OH; mash extends LazyConcat { debug true; string extends { -- oracle_home; -- " "; -- "foo"; } } test extends Compound { foo LAZY mash:concat; t extends Ant { out extends echo { message foo; } } } } =20 =20 Caused by: java.lang.ClassCastException: org.smartfrog.sfcore.reference.Reference at org.smartfrog.services.ant.AntProject.setAttribute(AntProject.java:241) at org.smartfrog.services.ant.AntProject.getElement(AntProject.java:205) at org.smartfrog.services.ant.AntProject.getTask(AntProject.java:488) at org.smartfrog.services.ant.AntImpl.executeNestedAntTasks(AntImpl.java:82 ) =20 =20 =20 // May need for type conversion if (!ptypes[0].equals(value.getClass())) { value =3D convType((String) value, ptypes[0]); <<<<<----- AntProject.java:241 }=20 |