cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vadim Gritsenko" <vgritse...@hns.com>
Subject RE: WEB-INF classloading and on the fly compilation
Date Thu, 14 Sep 2000 23:02:48 GMT
Sources are available at www.sun.com; and even if they would be unavailable
there are tools like JAD.

You just need to inherit ( or re-write ) from sun.tools.javac.Main and
replace call

	// Create our Environment.
	BatchEnvironment env = BatchEnvironment.create(out,
						       sourcePathArg,
						       classPathArg,
						       sysClassPathArg,
						       extDirsArg);

with something like this:

        BatchEnvironment env = new BatchEnvironment(out, srcClassPath,
binClassPath);

where srcClassPahth and binClassPath - instances of your class which
inherits from ClassPath,
and this new ClassPath should load classes from where you want - from file
system, RDBMS, network, ...


But - I don't know where to get sources for OS - sorry! :)

Vadim


> -----Original Message-----
> From: Pier P. Fumagalli [mailto:pier.fumagalli@eng.sun.com]
> Sent: Thursday, September 14, 2000 6:49 PM
> To: tomcat-dev@jakarta.apache.org
> Cc: Stefano Mazzocchi; cmanolache@yahoo.com;
> pier@betaversion.org; cocoon-dev@xml.apache.org
> Subject: Re: WEB-INF classloading and on the fly compilation
>
>
> cmanolache@yahoo.com wrote:
> >
> > On Thu, 14 Sep 2000, Stefano Mazzocchi wrote:
> >
> > > cmanolache@yahoo.com wrote:
> > > >
> > > > :-)
> > > >
> > > > You could also find the webapp root ( getRealPath("/") )
> and compute the
> > > > classpath yourself - but I would say this is worse, since
> you'll rely on a
> > > > run-time directory structure that may not exist ( again,
> war file format
> > > > is a deployment format, not a run-time format ).
> >
> > > This works _ONLY_ if classloading is performed thru files... what
> > > happens if I have a NetworkClassLoader a JDBCClassLoader or a
> > > OnTheFlyAssembledClassLoader? no compiler existing today (I
> just checked
> > > ALL the existing java compiler I could find!) would be able to compile
> > > against classes loaded thru a classloader.
> >
> > One would argue that compilation should happen at deployment, not at
> > runtime.
>
> Let's get real... More and more we're using on the fly compilation
> because it has been proven to be an effective techniques... Now you're
> saying that I can't do it within a servlet? And just because the
> compiler works in a different way?
>
> > > everything, ranging from a database to a compiler... so you don't go
> > > shopping for tons of jar, but you just drop  the WAR on the webapp
> > > folder and you're done. Period.
> > >
> > > The WAR packages were created for that right? Good, but this idea is
> > > broken by the fact that all existing java compilers assume
> that classes
> > > are loaded from disk.
> >
> > You may have additional problems - even if you include a javac
> compiler in
> > your WAR, the sandbox will not allow you to use it too much.
> Some servers
> > may care about security ( well, I'm dreaming, nobody cares about that
> > today :-).
>
> What Cocoon does today is to write the JAVA files in the servlet work
> directory (and I believe that's given in the specs), and perform a bunch
> of security-legal operations (like constructing a ClassLoader with the
> WEB-APP classloader as a parent... blablabla)...
> The only "security constraint" such a WEB-APP would require is to be
> able to construct  a classloader, and work in the work directory (even
> if this last one can be avoided, doing basically everything in
> memory)...
>
> > > Damn, now I need to write a java compiler :(
> >
> > Maybe an OS too - all those existing OSes that are using this bad
> > filesystem concept ... :-)
>
> We can hack them, though... If we have the sources.... :) :) :)
>
> 	Pier


Mime
View raw message