[Design the new POJO MicroContainer] - Internal AbstractController State
by adrian@jboss.org
I can see having the abstract controller state protected is a bit dangerous
given the recent changes for the Scoped Kernels.
So I've changed all the state to private with documented protected methods
for subclasses to use.
The reason I say it is dangerous is because there is more to updating a context's
state than allContexts. There are other "indexes" where the context could exist.
Besides this new api looks wrong to me anyway, I documented it in a TODO
| // TODO This api looks broken and unsafe
| // 1) It should not be public
| // 2) There should be parameter checking for public methods
| // 3) There should be locking when updating state
| // 4) Error handling?
| public void addControllerContext(ControllerContext context)
|
The way to make more dangerous operations available to subclasses
would be through some helper class that is only protected accesible.
e.g.
|
| private UnsafeInterface unsafe = new UnsafeImplementation();
|
| protected UnsafeInterface getUnsafe()
| {
| return unsafe;
| }
|
| protected interface UnsafeInterface
| {
| // Methods intended for subclasses that know what they are doing here
| // Properly documented to explain requirements, e.g. locking
| }
|
| private class UnsafeImplementation implements UnsafeInterface
| {
| // Implementation of potentially unsafe methods, but still does some checking
| // like null parameters or reasonable error handling so we don't end up
| // with a subclass breaking the whole system.
| }
|
There is a similar trick that is the reverse where you define a wrapper interface
that only exposes safe methods and make the real implementation
unreachable (you always hand out the wrapper externally).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034065#4034065
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034065
18 years, 8 months
[Design the new POJO MicroContainer] - Re: Remove eclipse files from SVN?
by pgier
Is this plugin (m2eclipse) not an option?
If I do a clean checkout of microcontainer, then delete the .project and .classpath files. Then create a project in eclipse and right click (maven-> enable). Eclipse sets up the project and classpath settings for me.
This way we could remove the .project and .classpath files from the command line, and not have to use eclipse:eclipse from the command line. Assuming that this plugin is installed in eclipse, the steps could just be:
1. Check out the project from svn using subclipse.
2. Right click on the project and enable maven.
3. (Optional) Change local preferences as needed.
Am I missing something that is required in the setup of the project?
It didn't work for me when I tried to set up the individual modules of microcontainer as eclipse projects, so I guess this part might still require eclipse:eclipse.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034061#4034061
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034061
18 years, 8 months
[Design the new POJO MicroContainer] - Re: Remove eclipse files from SVN?
by adrian@jboss.org
"Kevin.Conner(a)jboss.com" wrote : "adrian(a)jboss.org" wrote : I hate scripts. I always preferred make (declaritive) to ant (scripts).
| Well, I was thinking more along the lines of having maven generate it :-)
|
But I don't want any extra steps that are unnecessary.
Shelling out to the command line defaults the whole point of using an IDE.
anonymous wrote :
| "adrian(a)jboss.org" wrote : I want to download things and have it work, not waste time
| | baby sitting eclipse builds (like I do now :-( )
| | or remembering what order of magic incantations I need to get to a working build
| | (besides rm -rf * and start again :-)
| Sounds as if you need to use emacs + mvn command line :-)
|
I was probably more productive when I used wordpad and cygwin,
but then I broke the build a lot when I forgot to commit stuff. :-)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4034055#4034055
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4034055
18 years, 8 months