-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Peter Donald wrote: | Hi, | | On Tue, 20 Aug 2002 20:46, Tomasz Skutnik wrote: | |>I've got this simple question. Can someone tell me what is preferred way |>of accessing application working directory in Phoenix(I assume it is |>'apps/<app-name>/', correct me if I'm wrong) ? So far I did it by |>obtaining configuration location during configuration phase and than |>converting it to URL, and then invoking 'getFile()' method, followed by |>~ double 'getParent()' - which doesn't seem to be very elegant IMHO. | | | public class MyBlock implements Contextualizable | { | private BlockContext _context; | | public void contextualize( final Context context ) | { | _context = (BlockContext)context; | } | | public void someMethod() | { | File f = _context.getBaseDirectory(); | ... | } |
Thx. That's exactly I was looking for :-) | |>Another problem, a bit more complex. I'm developing Phoenix-based server |>for remote invocation of Ant (to speedup development by avoiding Java |>startup overhead each time Ant is invoked) + simple Python client to |>forward requests. | | | sounds koool. | | |>1. How can I access arbitrary jar archive placed inside SAR archive |>(e.g. construct URL pointing at it)? - FWIR Phoenix does not extract any |>files from SAR except configuration, so there should(?) be the way to |>access it's content other way - can someone help me with this ? | | | Phoenix extracts everything not in SAR-INF so you could store them in | something like | | /SAR-INF/*.xml | /ant/lib/ant.jar | /ant/lib/ant-optional.jar | | You can then reference these jars via | | File f = _context.getBaseDirectory() | final File antFile = new File( f, "ant/lib/ant.jar" ); | URL url = antFile.toURL(); | | URLCassLoader loader = new URLCassLoader( new URL[] { url } ); | Second shot, second hit! Thx again :-) | |>2. Is there some better (simpler) way to implement the feature I've |>described? I don't want to reinvent the wheel - if someone knows details |>about Phoenix classloader handling and how this could be exploited to |>achieve desired effect - please share your knowledge :-) | | | I am not sure whay you can't just copy $ANT_HOME/lib/* into /SAR-INF/lib | ? | See my 'reaalyy looong' answer to Jeff Turner reply (If you are bored :-) ). Thanks again for your time. Scooter - -- Tomasz Skutnik, R&D Director, www.e-point.pl tel +48 (22) 853 48 30, mob +48 501 555 705, fax +48 (22) 853 48 30 e-point S.A., ul. Filona 16, 02-658 Warsaw, Poland PGP/GPG public key: http://scooter.ext.e-point.pl/tomasz.skutnik.gpg -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD4DBQE9Y5MFKoVCme/JcTgRApX0AJYyEP8iWCPdiy63plPBPQHz154sAJ9GpyBn bkc9y+W2ajPjIgLZ1cGsAQ== =F9yB -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>