cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davanum Srinivas <d...@yahoo.com>
Subject Re: [C2] XSP / keywords in directory names
Date Fri, 02 Mar 2001 19:19:25 GMT
Checked in code which adds a $ suffix to the package elements if the package elements are java
keywords.

For example, 
   com.mycom.www.static.volatile
Will be turned into,
   com.mycom.www.static$.volatile$

Thanks,
dims

--- Sylvain Wallez <sylvain.wallez@anyware-tech.com> wrote:
> 
> 
> Berin Loritsch a écrit :
> > 
> > "Matthias D. Herold" wrote:
> > >
> > > "Berin Loritsch" wrote:
> > > >
> > > > "Matthias D. Herold" wrote:
> > > > >
> > > > > Hello Davanum,
> > > > >
> > > > > if I rename the directory, it works. But I think it should also work
> > > > > with java keywords as directory name...
> > > > >
> > > > > IMO there should be a better method for mapping directories to package
names
> > > > > (for example just adding underscores to the beginning and the end
of each
> > > > > package name would be fine: directory /static maps to org.apache.cocoon._static_).
> > > > >
> > > > > I am currently not familiar enough with the code to be able to fix
such things;
> > > > > so I'll just send bug reports  ;-)
> > > >
> > > > If you actually had an extension on your file name, it would work as well:
> > > > org.apache.cocoon.static_xmap
> > >
> > > There is an extension on the file name; the file is named 'index.jsp' and put
> > > in a directory named 'static': 'static/index.xsp'.
> > 
> > Ah. so the class is:
> > 
> > com.mycom.www.static.index_xsp (or equiv.).
> > 
> > That makes sense that your having this problem.  It's too much work to check for
> > keywords in the path, and I want the clean com.mycom.www prefix to work.  Another
> > solution would be that ALL generated classes have the same prefix, but no subdirectories:
> > 
> > com.mycom.www.static_index_xsp
> > 
> > Or preferably, remove the underscore and capitalize the first char of each word:
> > 
> > com.mycom.www.StaticIndexXsp
> > 
> > The problem with that is we might reach a limit on the character length of the class
> > name.
> > 
> > Truthfully, the most scalable approach is still prefixing or postfixing a character
> > to the directory name.  We already mangle the name to remove periods and dashes,
but
> > who said we have to use an underscore?
> > 
> > com.mycom.www.c_static.c_volatile.c_index_xsp
> > 
> > The thing is the prefixing with an underscore according to some C/C++ coding practices
> > is indicative of a compiler or system constant that you can't rely on to be useable.
> > That is my beef with the underscore thing.
> > 
> 
> In Java, the '$' character is used for this purpose. This is specified
> by the JLS at
> http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#40625
> 
> The compiler uses it e.g. for generated identifiers when you reference a
> Class object (writing "org.apache.Foo.class" produces a
> "class$org$apache$Foo" attribute in the class file).
> 
> So there's nothing against the use of the '_' prefix but the C/C++
> history and IMO it's important that java keywords do not impact the
> naming of directories in the web site !
> 
> My .02 euro.
> 
> -- 
> Sylvain Wallez
> Anyware Technologies
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 


=====
Davanum Srinivas, JNI-FAQ Manager
http://www.jGuru.com/faq/JNI

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

Mime
View raw message