> -----Original Message-----
> From: Paul Hammant [mailto:[EMAIL PROTECTED]]
> Sent: Monday, 25 February, 2002 15:34
> To: Avalon Developers List
> Subject: Re: BlockContext.getBaseDirectory();
>
>
> Stephen,
>
> >>>>>>2) File dir = (File) context.get("phoenix-dir:server-app");
> >>>>>>
> >>>>>try using the string "app.dir" or something and it should work ;)
> >>>>>
> >>>>Doh!
> >>>>
> >>>But its nasty - anyone can change "app.dir" because its the value of
> >>>a constant.  A better solution is needed!
> >>>
> >>But it is defined in an interface, and therefore immutable?
> >>
> >
> >The constant APP_HOME_DIR is defined in the interface - I can change
> >the "app.dir" string value to anything I want without breaking the
> >interface.
> >
> Not quite sure what you are talking about here.  Trying to modify it
> gives the following at compile time:
>
>   "cannot assign a value to final variable APP_HOME_DIR"

Sure.

> Are you trying to say that ....
>
>   Object o = get("dsjhsfhlhjdsflkahjdsf");
>
> could happen?  If yes, then how is the exception unpalatable?

What I'm saying is that the string "app.dir" is not exposed in the
interface.  The string could change (by someone changing the source
code a year from now and everyone has forgotten about external
references to the implementation string.  The interface would still
be good, but your reference to "app.dir" would break - because the
usage of the "app.dir" key circumvents the interface and any compile
time checking.  The only way you can safely use the string "app.dir"
is if there is an Avalon wide directory of reserved names that is
actively maintained.

Steve.


> - Paul
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to