Thanks for the inputs !!! ;)
Here are some more of them apart from comments (from a colleague):
"..you can place these class files in a jar directly under the application directory and once everything is done you can proceed with moving that file to lib"
-- Ya here jerry would not disturb user's directory structure! It is just the jar and lib after all!!
"..don't forget to create the lib directory in the application, if one doesn't exist. If it exist you should proceed with putting the generated jar file in that directory. Bit of logic in build.xml"
--hmm... ok
Also :
* Jerry would not bother about the compilation errors!! that is left to the user!
(Let him write the correct syntax!!)
Now jerry makes use of Logger (Atlast it is put to use for a valid reason!!) to log the compilation errors, if any.
But it is taking lot of time to start. :(
Something has to be done...
I have some more stratergies for Jerry to compile:
B4 running ANT:
* Check for the class files' modified date. If it is not less than a "considerable" time (a day or two?), do not recompile the whole app.
Just ask Jerry to run !!
* If any of the files have been changed (mainly *.java) then compile only that file or at the
worst cases compile the dependent file. Even worst case compile that app !! ;)
But not all apps in webapps!
I hope this will save some time for jerry to start!
Other important points:
* build.xml is built dynamically and saved to the disk where ant is run.
* using java.lang.Runtime.exec("ant") to execute ant.
This week-end is going to be exciting !!
WOW !!
Will blog after some improvements !!
Friday, February 11, 2005
Monday, February 07, 2005
As planned, yesterday Jerry compiled the classes in webapps folder.
Great !!
But with this i landed into a great confusion !!!
Reason :
1) How to place the class files in the app folders ?? shall i create a classes folder or just
place it where the .java is ?? Right now doing the latter. (is there any other way?)
2) I think iam playing with the users folders (some intrusion kinda thing ??!!).
3) i have a check :
if the user has his build.xml for ant
then execute that but without his permission or the intension?? (i dont know)
Boys , help me out !!
Comment on this issue as much as possible and let me know what to do. If you have any other
ideas(innovative ?!! as the compilation of classes is itself is innovative!!)
Thanks for the support!!
Great !!
But with this i landed into a great confusion !!!
Reason :
1) How to place the class files in the app folders ?? shall i create a classes folder or just
place it where the .java is ?? Right now doing the latter. (is there any other way?)
2) I think iam playing with the users folders (some intrusion kinda thing ??!!).
3) i have a check :
if the user has his build.xml for ant
then execute that but without his permission or the intension?? (i dont know)
Boys , help me out !!
Comment on this issue as much as possible and let me know what to do. If you have any other
ideas(innovative ?!! as the compilation of classes is itself is innovative!!)
Thanks for the support!!
Tuesday, February 01, 2005
Well.., sacrificing movies on last Saturday and Sunday, managed to parse web.xml and load the mapped classes. ;)
Tomcat uses some six to seven conditions to check
whether a class requested can be loaded or not.
First , it checks in the repository before checking the mappings in web.xml. Then in the Cache.
Still some more conditions apply ...
If it does not find anywhere then it throws a
ClassNotFoundException
That is why the class could be loaded (sometimes!!) even when u have deleted the class. It could be found in cache. But once you restart the server, it'll throw the exception.
But aim (as i have been telling this for long time!!) being just to understand How Tomcat Works , i came up with only two conditions. ;)
One being the repository search or just the folder in which class is present and is well-known like /WEB-INF/classes/*.
And other being mapped in web.xml.
This is because you can have a simple Servlet in classes directory (without packages!!) which is looked after by the first condition and also you can have a servlet mapped as a controller (or anything for that matter) like:
servlet-mapping servletName = "com.mycontroller.classes.MyMainServletController" uriPattern="/servlet/MyController"
If both these conditions fail, then throw the exception.
Tomcat uses neither DOM nor SAX for parsing of the web.xml file. It uses Apache Software Foundations' (ASF) Digester project.
Look for digester here:
http://jakarta.apache.org/commons/digester/
It basically maps XML to Java objects and allows certain rules to be set.
Learnt Digester (the simple reason is i didnt know either of DOM or SAX ) ;)
You might figure out that the mappings in Struts-config.xml or web.xml like
or the or the tags are all
Classes !!
Digester parses the xml file and allows you to trigger a method on finding a certain pattern.
Example:
On finding the pattern
, you can invoke a method after assigning it to a class
digester.addSetProperties("employee","Employee");
digester.addCallMethod("employee","printName");
This will call the method printName() of the class Employee on finding pattern "employee".
Very usefull indeed !! (like all the jakarta projects) ;)
But exploration of powers of Digester was limited, should utilize it to the maximum extent (but when ??!!).
Next thing to learn is Ant (Another Neat Tool). May be i should try to compile classes when the server is restarted or when the class is modified.
Surprisingly this was my original aim !!! Ya to compile and reload the classes.
We'll see what'll happen !!
Thanks for support again!
Tomcat uses some six to seven conditions to check
whether a class requested can be loaded or not.
First , it checks in the repository before checking the mappings in web.xml. Then in the Cache.
Still some more conditions apply ...
If it does not find anywhere then it throws a
ClassNotFoundException
That is why the class could be loaded (sometimes!!) even when u have deleted the class. It could be found in cache. But once you restart the server, it'll throw the exception.
But aim (as i have been telling this for long time!!) being just to understand How Tomcat Works , i came up with only two conditions. ;)
One being the repository search or just the folder in which class is present and is well-known like /WEB-INF/classes/*.
And other being mapped in web.xml.
This is because you can have a simple Servlet in classes directory (without packages!!) which is looked after by the first condition and also you can have a servlet mapped as a controller (or anything for that matter) like:
servlet-mapping servletName = "com.mycontroller.classes.MyMainServletController" uriPattern="/servlet/MyController"
If both these conditions fail, then throw the exception.
Tomcat uses neither DOM nor SAX for parsing of the web.xml file. It uses Apache Software Foundations' (ASF) Digester project.
Look for digester here:
http://jakarta.apache.org/commons/digester/
It basically maps XML to Java objects and allows certain rules to be set.
Learnt Digester (the simple reason is i didnt know either of DOM or SAX ) ;)
You might figure out that the mappings in Struts-config.xml or web.xml like
or the
Classes !!
Digester parses the xml file and allows you to trigger a method on finding a certain pattern.
Example:
On finding the pattern
digester.addSetProperties("employee","Employee");
digester.addCallMethod("employee","printName");
This will call the method printName() of the class Employee on finding pattern "employee".
Very usefull indeed !! (like all the jakarta projects) ;)
But exploration of powers of Digester was limited, should utilize it to the maximum extent (but when ??!!).
Next thing to learn is Ant (Another Neat Tool). May be i should try to compile classes when the server is restarted or when the class is modified.
Surprisingly this was my original aim !!! Ya to compile and reload the classes.
We'll see what'll happen !!
Thanks for support again!
Sunday, January 09, 2005
Did not get much time to implement and obviously to blog !!
But late in night thought of implementing only a Logger.
Logger is a program which will log (or blog !!) or writes to a file configured.
Extending to this feature, just added a ResourceBundle from which it will obtain the key String and just write it to a file.
Usage of ResourceBundle helps in i18n, for you can configure more than one bundle using different
languages.
ResourceBundle has a key/value pair Strings written in a
file , something like ApplicationResources.properties.
(Struts users will be more familiar with this name !). It contains the strings like:
key.username.invalid=Invalid User Name
....
For logging, a most common method viz., log(String stringToBeLogged) is used.
Logger makes use of Key for stringToBeLogged and gets the Value and writes it to a file.
Still have plans to implement following:
1) Digester , for parsing of XML and using it as a configuration file like that of web.xml
2) Context for getting the servlet context..
3) Loader to load all the classes configured in web.xml
and much more... somthing like JSP compiler or
JSP Engine.
But late in night thought of implementing only a Logger.
Logger is a program which will log (or blog !!) or writes to a file configured.
Extending to this feature, just added a ResourceBundle from which it will obtain the key String and just write it to a file.
Usage of ResourceBundle helps in i18n, for you can configure more than one bundle using different
languages.
ResourceBundle has a key/value pair Strings written in a
file , something like ApplicationResources.properties.
(Struts users will be more familiar with this name !). It contains the strings like:
key.username.invalid=Invalid User Name
....
For logging, a most common method viz., log(String stringToBeLogged) is used.
Logger makes use of Key for stringToBeLogged and gets the Value and writes it to a file.
Still have plans to implement following:
1) Digester , for parsing of XML and using it as a configuration file like that of web.xml
2) Context for getting the servlet context..
3) Loader to load all the classes configured in web.xml
and much more... somthing like JSP compiler or
JSP Engine.
Sunday, December 26, 2004
It all happened on Friday night 3:30 am (early morning !). But could not blog as we had to go for trip and did not get time.
It took so much time to blog this. I hope nobody is missing this(missing not even me!!).
The web-server was earlier responded to the Servlet programs which extended Servlet,
now it also responds to the modern servlet which extends HttpServlet.
Thats really nice !!
Going still further, the query string is also parsed and set to request parameters.
And we can now set and get request parameters !!
This all an HashMap, i.e., a key/value pairs. For setting parameters it takes two objects(values) one is key and the other is value. As the signature of the method goes..
public void setParameter(Object key,Object value);
Add the key and value to the hash map.
And for getting the parameters value, you need to provide the key.
As the signature of the method goes..
public Object setParameter(Object key);//returns the value.. for key
Similar kind of implementations for Cookies and Session will take place today.
One more thing, This is not the exact implementation of the Tomcat which i am studying right now. I just read the explaination for the things to be done and the UML diagrams, so implemented it in my own programs.
Just the crude thing !!
There are still no packages made, it is just some 6 programs working for me.
Still if someone cares to see the code with UML diagrams, can mail or just add comments will get them(of course with their email id !!).
After some more implementation, blogs will come up!!
Thanks for all the comments and encouragement u all have given!!
Merry Christmas and Enjoy !!
It took so much time to blog this. I hope nobody is missing this(missing not even me!!).
The web-server was earlier responded to the Servlet programs which extended Servlet,
now it also responds to the modern servlet which extends HttpServlet.
Thats really nice !!
Going still further, the query string is also parsed and set to request parameters.
And we can now set and get request parameters !!
This all an HashMap, i.e., a key/value pairs. For setting parameters it takes two objects(values) one is key and the other is value. As the signature of the method goes..
public void setParameter(Object key,Object value);
Add the key and value to the hash map.
And for getting the parameters value, you need to provide the key.
As the signature of the method goes..
public Object setParameter(Object key);//returns the value.. for key
Similar kind of implementations for Cookies and Session will take place today.
One more thing, This is not the exact implementation of the Tomcat which i am studying right now. I just read the explaination for the things to be done and the UML diagrams, so implemented it in my own programs.
Just the crude thing !!
There are still no packages made, it is just some 6 programs working for me.
Still if someone cares to see the code with UML diagrams, can mail or just add comments will get them(of course with their email id !!).
After some more implementation, blogs will come up!!
Thanks for all the comments and encouragement u all have given!!
Merry Christmas and Enjoy !!
Monday, December 20, 2004
Know not why whole day never felt hungry !! didnt eat anything .At about 10 pm i wandered the chord road on my cycle for an hour.
Yesterday JerryMouse began to digest some more things! It now can run a Primitive Servlet , i.e, a class which implements Servlet.(Not HttpServlet ! thats a bit modern.)
But in night around 12(is the time which we used to go for Tea in RC !! remember?), some rats(Jerry - The Mouse!?) began to wander in my empty stomach!! it was time to have some tea and bun.
Began to think of designing issue, may be i should start reading Larmann . As usual(!) time was a constraint had to shutdown the PC and slept till 6 am.
Late to bed, early to rise !!
Yesterday JerryMouse began to digest some more things! It now can run a Primitive Servlet , i.e, a class which implements Servlet.(Not HttpServlet ! thats a bit modern.)
But in night around 12(is the time which we used to go for Tea in RC !! remember?), some rats(Jerry - The Mouse!?) began to wander in my empty stomach!! it was time to have some tea and bun.
Began to think of designing issue, may be i should start reading Larmann . As usual(!) time was a constraint had to shutdown the PC and slept till 6 am.
Late to bed, early to rise !!
Sunday, December 19, 2004
JerryMouse 's Birth
On Thursday i decided to write my own web-server to learn how tomcat works.
Thus began the journey. Did night out on Friday and a set of programs began to listen on port 8080
(pretty famous port !!) and a Request and Reponse were created.
Saw the result on browser (ya the same IE !).
Now shows only HTML pages under the WEB-INF(As an infant, it consumes only milk !!).
Thinking of a name to the infant, but now calling it as Jerry Mouse(Its just a name, nothing to do with Tom-cat!! can u believe?).
Thus the Jerry Mouse was born!!
The Major part is remaining Still!! The Servlet Engine and later on JSP Engine.
Night outs will commence.....Jerry Mouse will grow !!
Thus began the journey. Did night out on Friday and a set of programs began to listen on port 8080
(pretty famous port !!) and a Request and Reponse were created.
Saw the result on browser (ya the same IE !).
Now shows only HTML pages under the WEB-INF(As an infant, it consumes only milk !!).
Thinking of a name to the infant, but now calling it as Jerry Mouse(Its just a name, nothing to do with Tom-cat!! can u believe?).
Thus the Jerry Mouse was born!!
The Major part is remaining Still!! The Servlet Engine and later on JSP Engine.
Night outs will commence.....Jerry Mouse will grow !!
Subscribe to:
Posts (Atom)