You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Luigi Lauro <lu...@gmail.com> on 2007/03/25 18:34:25 UTC

[DERBY-2469] First alpha implementation available - help needed :)

Compiles but doesn't run yet, a lot of things to check/do yet, but a  
first 90% complete implementation is available.

You can download the latest versions for the 3 classes here: https:// 
issues.apache.org/jira/browse/DERBY-2469

I'm coding around a VirtualStorageFactory abstract base class, and a  
VirtualStorageFile. VirtualStorageFile implements basic logic and  
delegates to VirtualStorageFactory for the actual storage manipulation.

VirtualStorageFactory base class is a reworked from scratch  
'BaseStorageFactory' which instead of forcing implementors to give  
both StorageFile and StorageFactory implementation, allows them only  
to implement a few 'CRUD' create/delete/rename/delete methods, and  
build upon these to give a working StorageFactory/StorageFile  
implementation.

Ideally, if things go as I plan, every storage implementation could  
be re-written around this new base class if needed, or this could be  
used as a new base for developing new implementations in a easier way.

Have a look at the abstract class (VirtualStorageFactory) and the  
delegating implentation of StorageFile (VirtualStorageFile).

I also include a starting JNLP implementation of VirtualStorageFactory.

Javadoc comments comes mostly from interfaces (copy & paste), and  
VERY FEW TESTS DONE YET, this is very alpha code, if you wanna help  
go through it and suggest fixes/improvements/whatever to get things  
rolling for real.

I've probably done 100000000000000000000000 things wrong, so if  
someone can help me spot what is right what is not, I can start to  
fix stuff and provide a beta version soon. Thanks :)

P.S. Classes names are ugly, I plan to change those soon.
P.P.S. As soon as I get a beta JNLP implementation out, I will try to  
provide a in-memory implementation as well. This is very easy to do,  
given the base class.

Re: [DERBY-2469] First alpha implementation available - help needed :)

Posted by David Van Couvering <da...@vancouvering.com>.
OK, thanks.

Luigi Lauro wrote:
> 
> On 27 Mar 2007, at 20:01, David Van Couvering wrote:
> 
>> - Don't you need to close any open files on shutdown?  This highlights 
>> my ignorance of this area of the code...
> 
> I noticed now the 'on shutdown'.
> 
> Regarding persistent entities, no, I don't need to close anything, since 
> I don't really 'open' anything at all. I create/delete persistent 
> entities (which are self-contained operations and don't leave anything 
> open) and I hand Input/Output streams when I get requested for them. The 
> caller getting the InputStream/OutputStream will have to flush/close it 
> after usage, but that's its duty not mine.
> 
> Regarding shutdown cleaning, I was doubtful if I had to do something 
> (like deleting all the temporary files for example), but by asking here 
> and by checking the other implementations it seems not: no need to do 
> anything on shutdown in my case since I don't really have anything 
> 'open' during operations.

Re: [DERBY-2469] First alpha implementation available - help needed :)

Posted by Luigi Lauro <lu...@gmail.com>.
On 27 Mar 2007, at 20:01, David Van Couvering wrote:

> - Don't you need to close any open files on shutdown?  This  
> highlights my ignorance of this area of the code...

I noticed now the 'on shutdown'.

Regarding persistent entities, no, I don't need to close anything,  
since I don't really 'open' anything at all. I create/delete  
persistent entities (which are self-contained operations and don't  
leave anything open) and I hand Input/Output streams when I get  
requested for them. The caller getting the InputStream/OutputStream  
will have to flush/close it after usage, but that's its duty not mine.

Regarding shutdown cleaning, I was doubtful if I had to do something  
(like deleting all the temporary files for example), but by asking  
here and by checking the other implementations it seems not: no need  
to do anything on shutdown in my case since I don't really have  
anything 'open' during operations.

Re: [DERBY-2469] First alpha implementation available - help needed :)

Posted by Luigi Lauro <lu...@gmail.com>.
On 28 Mar 2007, at 0:00, David Van Couvering wrote:

> Do you have a workaround for this bug?

There's no real workaround. There are three possibilities:

A) Having Sun acknowledge this as a bug and fix it in next 'update'  
release of the JVM. Regarding this I have good news: I just received  
the mail that they checked and they are inserting my proposal into  
the DB as a new bug. This means we can hopefully get a fix soon,  
since it's SO damn easy to fix. I will commit a patch to the JVM for  
fixing this, so Sun just have to check the patch and include it. Note  
that the bug will take a couple of days to show up in their database,  
I will warn you once it's there, so you can vote it if you want ^_^

B) Substitute the current default sun implementation with a fixed one  
by replacing it with a new one and registering it into the  
ServiceManager. I don't even know if this is really possible, since  
there we are playing tricks inside JWS sandbox, and I don't know if  
such a substitution would work or would violate the sandbox somehow.

C) Workaround the bug in the storage implementation, by not having a  
1-1 mapping as I'm presently doing, but mapping several storage file  
inside a single JNLP persistent entry. This would mean using a single  
FileContents/InputStream/OutputStream as several StorageFile, and  
would make the implementation A LOT more complex, bigger, slower and  
more bug prone. I don't want to do this except there's no other way out.

What I see this happen is: we get an implementation working and deal  
with the bug. This means you will be able to use derby databases not  
bigger than X tables/records for example... 255 is an harsh limit,  
but from what I've seen it's possible to have a small-to-medium derby  
database even with such limits. I'm currently in the process of  
investigating if there are ways to reduce the number of entities  
created by derby at an higher level, by disabling unneeded features/ 
logging or similar.

Any help here is appreciated :)

Luigi

Re: [DERBY-2469] First alpha implementation available - help needed :)

Posted by David Van Couvering <da...@vancouvering.com>.
Do you have a workaround for this bug?

David

Luigi Lauro wrote:
> 
> Something I forgot.
> 
> On 27 Mar 2007, at 20:01, David Van Couvering wrote:
> 
>>   Perhaps we can provide some feedback to the JNLP folks?
> 
> Regarding this, no I don't think we can legitly ask for a more capable 
> PersistenceService able to save persistent entities with an explicit 
> hierarchy.
> 
> This would go a lot farther than the API goals declare: to provide a 
> simple cookie-like persistent storage for JWS application.
> 
> BUT, we can ask for bug fixing. Current PersistenceService 
> implementation (com.sun.jnlp.PersistenceServiceImpl) is plagued with a 
> _NASTY_ bug which cause the 'create' method to throw a dreaded 
> unforeseen and undocumented ArrayIndexOutOfBoundsException when I try to 
> create a 256th entity.
> 
> This is surely a bug, especially since it's not a storage limit, but a 
> dumb "new URL[255]" used in a getter method to return the persistent 
> storage entities. Throw in ArrayList<URL> instead and you have no bug 
> and not limit.
> 
> Since this is so easily fixable (2-3 lines have to change), and since 
> this would hinders PersistenceService usage for our goals (derby easily 
> creates 200+ files when you start to create tens of tables), I seriously 
> hope we can have Sun fix this in the next JVM update.
> 
> I've filed a bug but no response yet.
> 
> I've also opened a thread on the official java JNLP forum to discuss the 
> matter, where I provide a test case and an detailed explanation of the 
> bug, along with the pointed out problem in the JVM source code.
> 
> If you can help me out in this crusade, I'll be grateful :D
> 
> Read about it here: 
> http://forum.java.sun.com/thread.jspa?threadID=5152055 (I'm omero, 
> that's my nick)

Re: [DERBY-2469] First alpha implementation available - help needed :)

Posted by Luigi Lauro <lu...@gmail.com>.
Something I forgot.

On 27 Mar 2007, at 20:01, David Van Couvering wrote:

>   Perhaps we can provide some feedback to the JNLP folks?

Regarding this, no I don't think we can legitly ask for a more  
capable PersistenceService able to save persistent entities with an  
explicit hierarchy.

This would go a lot farther than the API goals declare: to provide a  
simple cookie-like persistent storage for JWS application.

BUT, we can ask for bug fixing. Current PersistenceService  
implementation (com.sun.jnlp.PersistenceServiceImpl) is plagued with  
a _NASTY_ bug which cause the 'create' method to throw a dreaded  
unforeseen and undocumented ArrayIndexOutOfBoundsException when I try  
to create a 256th entity.

This is surely a bug, especially since it's not a storage limit, but  
a dumb "new URL[255]" used in a getter method to return the  
persistent storage entities. Throw in ArrayList<URL> instead and you  
have no bug and not limit.

Since this is so easily fixable (2-3 lines have to change), and since  
this would hinders PersistenceService usage for our goals (derby  
easily creates 200+ files when you start to create tens of tables), I  
seriously hope we can have Sun fix this in the next JVM update.

I've filed a bug but no response yet.

I've also opened a thread on the official java JNLP forum to discuss  
the matter, where I provide a test case and an detailed explanation  
of the bug, along with the pointed out problem in the JVM source code.

If you can help me out in this crusade, I'll be grateful :D

Read about it here: http://forum.java.sun.com/thread.jspa? 
threadID=5152055 (I'm omero, that's my nick)

Re: [DERBY-2469] First alpha implementation available - help needed :)

Posted by Luigi Lauro <lu...@gmail.com>.
On 28 Mar 2007, at 0:19, David Van Couvering wrote:

> I think everything is covered, except for the question of testing.   
> I recognize you just wanted to get something started and some  
> feedback. But before anything gets checked in, I would need to see  
> some validation that it works, even partially works.

This is for sure, I was not hoping for 'inclusion' or anything. I  
just wanted some feedbacks in order to avoid losing tons of time in  
things obvious to you derbyers and absolutely not obvious to me (this  
is what you are perfectly done BTW). Once I have what I need, I'll  
prepare a nicer package along with test cases for submission.

> Thinking about it further, rather than building new tests, I guess  
> all you need to exercise this code is to modify the  
> modules.properties file to use this storage factory, and then run  
> some subset of the Derby unit tests.

Good to know, so I need to check module.properties to enable my  
storage instead of the default ons

> I don't know the storage area very well, but I did find the following:
>
> java/testing/org/apache/derbyTesting/unitTests/store

I noticed them as well, but didn't find the time to try them yet. I  
will soon.

> I have never run these tests, but if you ask on the list with a new  
> subject header you should get some help.  Also, any help you may  
> need on configuring Derby to use your storage factory. What is  
> unclear to me is how to automate running in a Java Web Start  
> environment, vs. in a standard no-sandbox VM.  Do you know how to  
> do this?

This is another of my problem. I've even asked on the sun JNLP forums  
and JUnit ML regarding this (you can read about it here: http:// 
tech.groups.yahoo.com/group/junit/message/19132 ), and there seems  
there is _NO_ way to automate tests regarding JNLP APIs.

This is because even if the JNLP interfaces are available in every  
JVM in the jnlp.jar, the implementation classes doesn't get loaded  
unless you run your program from the javaws executable, which  
requires a JNLP descriptor file (which in turns requires you to put  
the file in a proper jar archive on a working webserver, etc...).

This means each time you even do a single change to a line of code  
you have to rebuild the whole package and test it outside the IDE by  
launching the javaws executable. I have YET to find a way for  
automating tests or debugging jnlp-api applications: even on the  
JUnit ML no luck, they just suggested to stub out the  
PersistenceService API, which is possible would 'defy' most of the  
testing since I would also want to test my implementation against the  
persistent service for real and not in theory :)

I've even tried a dirty trick, such as manually including the  
javaws.jar which cointans the com.sun.jnlp.* implementation classes,  
and manually initializing the registering the services, but it all  
fails horribly because of many missing tidbits (such as needed set  
system properties and the like... all this get probably done by the  
javaws executable itself or by some other yet to be found class).

Maybe by digging into the code for the needed time one can find a way  
to properly 'force' the implementation classes to get loaded  
manually, but I didn't have the time to try this for real.

> I also want to see at least some subset of our higher-level system  
> tests run under the JNLP storage factory configuration. Most of the  
> times the database created is quite small, so I don't think it  
> should be an issue.  In particular, I'm be curious to see what  
> security bugs/issues we hit as Derby tries to do various things  
> with the system under such a constrained SecurityManager as JWS.

I'm curious of this as well, let's hope derby doesn't go too far and  
it's JWS sandbox-friendly :) If it isn't, that will be my next step:  
to make it! :P

> In terms of running derbyall, a general principle is that no  
> checkin takes place without running derbyall.  However, I do  
> recognize that in your case this is not necessarily applicaable  
> since your code will never be hit by running the existing  
> regression suites.

I will try to run the most tests possible, but I have yet to find an  
easy way for doing this. Testing JNLP is only possible outside an IDE  
in a full JNLP deployed application package.

> What I would like to see is that one you have identified new tests  
> or new configurations of old tests that exercise your storage  
> service, then these new tests/configurations should be added to  
> derbyall.  I don't think this is required for initial checkin, though.

If I get the time, I would also love to provide a full test suite for  
exercising the whole StorageFactory/StorageFile interfaces in an  
implementation-agnostic way, and this would mean we would have an  
easy way to fully test each (old and new) storage implementations  
just by running this suite to check if the storage is fully  
specifications and API-compliant.

Currently I don't have enough derby storage knowledge to implement  
such an extensive test suite, and it's not my main focus. Maybe  
later, once JNLP is done :)

>
> Make sense?

It does! :)

To sum it up: I'll try my best to test my storageFactory with the  
tools I find or I have to develop for, and will report back once a  
minimal testing is done. Any help here is appreciated of course :)


Re: [DERBY-2469] First alpha implementation available - help needed :)

Posted by David Van Couvering <da...@vancouvering.com>.
Hi, Luigi, thanks for your responses.

I think everything is covered, except for the question of testing.  I 
recognize you just wanted to get something started and some feedback. 
But before anything gets checked in, I would need to see some validation 
that it works, even partially works.

Thinking about it further, rather than building new tests, I guess all 
you need to exercise this code is to modify the modules.properties file 
to use this storage factory, and then run some subset of the Derby unit 
tests.

I don't know the storage area very well, but I did find the following:

java/testing/org/apache/derbyTesting/unitTests/store

I have never run these tests, but if you ask on the list with a new 
subject header you should get some help.  Also, any help you may need on 
configuring Derby to use your storage factory. What is unclear to me is 
how to automate running in a Java Web Start environment, vs. in a 
standard no-sandbox VM.  Do you know how to do this?

I also want to see at least some subset of our higher-level system tests 
run under the JNLP storage factory configuration. Most of the times the 
database created is quite small, so I don't think it should be an issue. 
  In particular, I'm be curious to see what security bugs/issues we hit 
as Derby tries to do various things with the system under such a 
constrained SecurityManager as JWS.

In terms of running derbyall, a general principle is that no checkin 
takes place without running derbyall.  However, I do recognize that in 
your case this is not necessarily applicaable since your code will never 
be hit by running the existing regression suites.

What I would like to see is that one you have identified new tests or 
new configurations of old tests that exercise your storage service, then 
these new tests/configurations should be added to derbyall.  I don't 
think this is required for initial checkin, though.

Make sense?

Thanks,

David

Luigi Lauro wrote:
> 
> On 27 Mar 2007, at 20:01, David Van Couvering wrote:
> 
>> Hi, Luigi.  Thanks for submitting this!
> 
> Thanks for replying.
> 
>> Here are my comments:
>>
>> - Your code is very well written - clear, well-commented, nicely 
>> structured!
> 
> Thanks. I try to do my best, and I value code clarity above all.
> 
> My goal is that ppl should understand what I've written with the minimum 
> effort possible.
> 
>> - Sigh.  Does the JNLP persistence service have no concept of a 
>> directory?  I hate the "length == 0" approach of identifying a 
>> directory.  But sometimes that's the best we can do.  Perhaps we can 
>> provide some feedback to the JNLP folks?
> 
> Unluckily, no.
> 
> The structure is 'somewhat' hierarchical since it's like a Map<URL, 
> FileContent>, but I'm forced to write under my codebase only. I cannot 
> create 'virtual' directory in the URL.
> 
> This means that if I'm "http://db.apache.org/derby" (this is the 
> codebase so), I can write under:
> 
> http://db.apache.org/derby
> http://db.apache.org
> http://apache.org
> 
> This is allowed in order to allow data sharing between applications from 
> the same vendor/domain.
> 
> BUT, I cannot write to http://db.apache.org/derby/subdir. I get a 
> 'denied access' because PersistenceService enforces the codebase. I 
> cannot go past it.
> 
> This is why I had to resort to using the NAME itself (which is 
> completely free, as long as doesn't violate URLs standard) and code an 
> IMPLICIT hierarchy into the name. Of the available separators (pipe, 
> comma, etc...) I chose comma because it seems to me it's the least 
> commonly used in 'files' and the most easily readable (dir,dir2,file is 
> more readable than dir|dir2|file).
> 
> This means I will persist the file as
> 
> http://db.apache.org/derby/derbyhome,databasehome,directory,subdirectory,filename 
> 
> 
> for example. For JNLP that's a single file under the 
> http://db.apache.org/derby codebase, so it's allowed, and I code the 
> hierarchy into the name with comma separated paths.
> 
> Regarding directories: I've chosen to create directory even if they 
> contain nothing (so I will create a placeholder entry whenever a 
> directory is 'created', otherwise I would have no mean of find out if a 
> directory exists or not, if no file is available under it) and I've 
> chosen to use the 0-length to 'flag them'. Since they won't hold any 
> data at all, this isn't _THAT_ unclean after all.
> 
> Other approaches I considered were to use the TAG feature of JNLP to tag 
> directory, but I discarded it because I would have to abuse of the 
> meaning of the TAG and violate the API contract, since the only 
> supported values are DIRTY, CACHED, TEMPORARY. Or to flag them using the 
> name, but this would add even more complications to the name structure, 
> which already contains the path hierarchy and all, so I thought the 
> 0-length was the best I could get.
> 
>> Don't you need to close any open files on shutdown?  This highlights 
>> my ignorance of this area of the code...
> 
> They are really 'files', you should think of them more like cookies.
> 
> I don't need to close anything, I can create/delete any entity and 
> write/read to/from it using streams.
> 
> Of course, the streams have to be flushed/close after usage, but that's 
> not my duty: I make them available through the 
> getInputStream/getOutputStream methods on the StorageFile interface, 
> then it's duty of the caller to close them upon usage.
> 
> Where does it seems to you I have left something open? Maybe I've done 
> and haven't noticed, but AFAIK I can't see any such mistake.
> 
> Beware also that some stuff as sync/supportRws is still in the works for 
> the JNLPStorageFactory. Not everything is in yet
> 
>> - Next time, please submit your changes as a patch file.  You generate 
>> a patch file by doing 'svn diff' from the root of your code tree, and 
>> routing the output to a file.  Make sure you have actually added new 
>> files and directories in your local tree using 'svn add'.
> 
> Will do, thanks for letting me now. I didn't make a patch of it mainly 
> because these are new files, so I thought it was easier this way, but I 
> will provide a patch next time :)
> 
>>
>> - You didn't submit any unit tests.  Without this, how do we know this 
>> feature works?  Have you run it through any tests?
> 
> Haven't put in any test yet. I don't think this code will run yet, very 
> very few tests done on it, all manual. I plan to provide junit unit 
> tests later, when I get the hang of it and stabilize the code a bit. 
> Yes, I know TDD and all, but given the premises, I focused on 
> understanding how derby works and testing my ideas of a possible 
> implementation against reality :)
> 
> And also, I was hoping to find a full StorageFile/StorageFactory testing 
> suite in derby for checking if the interface implementations fully 
> adhere to the API specifications, but no such thing seems available to 
> me. Are there some specific tests I could run against a 
> StorageFactory/StorageFile implementation?
> 
> 
>> - Did you run derbyall?  Did it pass?
> 
> Not at all. In fact, I have yet to see how I can 'pass' my new 
> implementation to derby for testing. :) Any pointer here is appreciated
> 
>> Take a good gander at http://wiki.apache.org/db-derby/DerbyCommitHowTo 
>> - everything here applies except that you can't commit the change 
>> yourself, only committers can do that.
>>
>> - Did you go through the checklist at 
>> http://wiki.apache.org/db-derby/DerbyContributorChecklist?  This is 
>> really important, especially signing and faxing in the ICLA
> 
> Will check these later. Thanks!
> 
>> - There are three versions of JNLPStorageFactory.java.  It's really 
>> hard to tell which one is the most recent.  When submitting updated 
>> patches, again it's best if you submit a single patch file, and name 
>> it with a version number or a date.
> 
> True, in fact I was looking for some 'mod' to delete the old ones. I 
> will submit a patch with date in the name, so to avoid doubts next time. 
> Can you tell someone to clean those attachments in the meanwhile? :)
> 
>> - Your source files need to have the Apache license header on them.  
>> See other files for examples
> 
> I will, thanks again. I'm n00b here you know :)
> 
>> Gotta run, maybe more later.
> 
> Thanks again, looking forward for any more help.
> 
> Really really appreciated David.
> 
> Luigi

Re: [DERBY-2469] First alpha implementation available - help needed :)

Posted by Luigi Lauro <lu...@gmail.com>.
On 27 Mar 2007, at 20:01, David Van Couvering wrote:

> Hi, Luigi.  Thanks for submitting this!

Thanks for replying.

> Here are my comments:
>
> - Your code is very well written - clear, well-commented, nicely  
> structured!

Thanks. I try to do my best, and I value code clarity above all.

My goal is that ppl should understand what I've written with the  
minimum effort possible.

> - Sigh.  Does the JNLP persistence service have no concept of a  
> directory?  I hate the "length == 0" approach of identifying a  
> directory.  But sometimes that's the best we can do.  Perhaps we  
> can provide some feedback to the JNLP folks?

Unluckily, no.

The structure is 'somewhat' hierarchical since it's like a Map<URL,  
FileContent>, but I'm forced to write under my codebase only. I  
cannot create 'virtual' directory in the URL.

This means that if I'm "http://db.apache.org/derby" (this is the  
codebase so), I can write under:

http://db.apache.org/derby
http://db.apache.org
http://apache.org

This is allowed in order to allow data sharing between applications  
from the same vendor/domain.

BUT, I cannot write to http://db.apache.org/derby/subdir. I get a  
'denied access' because PersistenceService enforces the codebase. I  
cannot go past it.

This is why I had to resort to using the NAME itself (which is  
completely free, as long as doesn't violate URLs standard) and code  
an IMPLICIT hierarchy into the name. Of the available separators  
(pipe, comma, etc...) I chose comma because it seems to me it's the  
least commonly used in 'files' and the most easily readable  
(dir,dir2,file is more readable than dir|dir2|file).

This means I will persist the file as

http://db.apache.org/derby/ 
derbyhome,databasehome,directory,subdirectory,filename

for example. For JNLP that's a single file under the http:// 
db.apache.org/derby codebase, so it's allowed, and I code the  
hierarchy into the name with comma separated paths.

Regarding directories: I've chosen to create directory even if they  
contain nothing (so I will create a placeholder entry whenever a  
directory is 'created', otherwise I would have no mean of find out if  
a directory exists or not, if no file is available under it) and I've  
chosen to use the 0-length to 'flag them'. Since they won't hold any  
data at all, this isn't _THAT_ unclean after all.

Other approaches I considered were to use the TAG feature of JNLP to  
tag directory, but I discarded it because I would have to abuse of  
the meaning of the TAG and violate the API contract, since the only  
supported values are DIRTY, CACHED, TEMPORARY. Or to flag them using  
the name, but this would add even more complications to the name  
structure, which already contains the path hierarchy and all, so I  
thought the 0-length was the best I could get.

> Don't you need to close any open files on shutdown?  This  
> highlights my ignorance of this area of the code...

They are really 'files', you should think of them more like cookies.

I don't need to close anything, I can create/delete any entity and  
write/read to/from it using streams.

Of course, the streams have to be flushed/close after usage, but  
that's not my duty: I make them available through the getInputStream/ 
getOutputStream methods on the StorageFile interface, then it's duty  
of the caller to close them upon usage.

Where does it seems to you I have left something open? Maybe I've  
done and haven't noticed, but AFAIK I can't see any such mistake.

Beware also that some stuff as sync/supportRws is still in the works  
for the JNLPStorageFactory. Not everything is in yet

> - Next time, please submit your changes as a patch file.  You  
> generate a patch file by doing 'svn diff' from the root of your  
> code tree, and routing the output to a file.  Make sure you have  
> actually added new files and directories in your local tree using  
> 'svn add'.

Will do, thanks for letting me now. I didn't make a patch of it  
mainly because these are new files, so I thought it was easier this  
way, but I will provide a patch next time :)

>
> - You didn't submit any unit tests.  Without this, how do we know  
> this feature works?  Have you run it through any tests?

Haven't put in any test yet. I don't think this code will run yet,  
very very few tests done on it, all manual. I plan to provide junit  
unit tests later, when I get the hang of it and stabilize the code a  
bit. Yes, I know TDD and all, but given the premises, I focused on  
understanding how derby works and testing my ideas of a possible  
implementation against reality :)

And also, I was hoping to find a full StorageFile/StorageFactory  
testing suite in derby for checking if the interface implementations  
fully adhere to the API specifications, but no such thing seems  
available to me. Are there some specific tests I could run against a  
StorageFactory/StorageFile implementation?


> - Did you run derbyall?  Did it pass?

Not at all. In fact, I have yet to see how I can 'pass' my new  
implementation to derby for testing. :) Any pointer here is appreciated

> Take a good gander at http://wiki.apache.org/db-derby/ 
> DerbyCommitHowTo - everything here applies except that you can't  
> commit the change yourself, only committers can do that.
>
> - Did you go through the checklist at http://wiki.apache.org/db- 
> derby/DerbyContributorChecklist?  This is really important,  
> especially signing and faxing in the ICLA

Will check these later. Thanks!

> - There are three versions of JNLPStorageFactory.java.  It's really  
> hard to tell which one is the most recent.  When submitting updated  
> patches, again it's best if you submit a single patch file, and  
> name it with a version number or a date.

True, in fact I was looking for some 'mod' to delete the old ones. I  
will submit a patch with date in the name, so to avoid doubts next  
time. Can you tell someone to clean those attachments in the  
meanwhile? :)

> - Your source files need to have the Apache license header on  
> them.  See other files for examples

I will, thanks again. I'm n00b here you know :)

> Gotta run, maybe more later.

Thanks again, looking forward for any more help.

Really really appreciated David.

Luigi

Re: [DERBY-2469] First alpha implementation available - help needed :)

Posted by David Van Couvering <da...@vancouvering.com>.
Hi, Luigi.  Thanks for submitting this!

Here are my comments:

- Your code is very well written - clear, well-commented, nicely 
structured!

- Sigh.  Does the JNLP persistence service have no concept of a 
directory?  I hate the "length == 0" approach of identifying a 
directory.  But sometimes that's the best we can do.  Perhaps we can 
provide some feedback to the JNLP folks?

- Don't you need to close any open files on shutdown?  This highlights 
my ignorance of this area of the code...

- Next time, please submit your changes as a patch file.  You generate a 
patch file by doing 'svn diff' from the root of your code tree, and 
routing the output to a file.  Make sure you have actually added new 
files and directories in your local tree using 'svn add'.

- You didn't submit any unit tests.  Without this, how do we know this 
feature works?  Have you run it through any tests?

- Did you run derbyall?  Did it pass?

Take a good gander at http://wiki.apache.org/db-derby/DerbyCommitHowTo - 
everything here applies except that you can't commit the change 
yourself, only committers can do that.

- Did you go through the checklist at 
http://wiki.apache.org/db-derby/DerbyContributorChecklist?  This is 
really important, especially signing and faxing in the ICLA

- There are three versions of JNLPStorageFactory.java.  It's really hard 
to tell which one is the most recent.  When submitting updated patches, 
again it's best if you submit a single patch file, and name it with a 
version number or a date.

- Your source files need to have the Apache license header on them.  See 
other files for examples

Gotta run, maybe more later.

Thanks,

David

Luigi Lauro wrote:
> 
> Compiles but doesn't run yet, a lot of things to check/do yet, but a 
> first 90% complete implementation is available.
> 
> You can download the latest versions for the 3 classes here: 
> https://issues.apache.org/jira/browse/DERBY-2469
> 
> I'm coding around a VirtualStorageFactory abstract base class, and a 
> VirtualStorageFile. VirtualStorageFile implements basic logic and 
> delegates to VirtualStorageFactory for the actual storage manipulation.
> 
> VirtualStorageFactory base class is a reworked from scratch 
> 'BaseStorageFactory' which instead of forcing implementors to give both 
> StorageFile and StorageFactory implementation, allows them only to 
> implement a few 'CRUD' create/delete/rename/delete methods, and build 
> upon these to give a working StorageFactory/StorageFile implementation.
> 
> Ideally, if things go as I plan, every storage implementation could be 
> re-written around this new base class if needed, or this could be used 
> as a new base for developing new implementations in a easier way.
> 
> Have a look at the abstract class (VirtualStorageFactory) and the 
> delegating implentation of StorageFile (VirtualStorageFile).
> 
> I also include a starting JNLP implementation of VirtualStorageFactory.
> 
> Javadoc comments comes mostly from interfaces (copy & paste), and VERY 
> FEW TESTS DONE YET, this is very alpha code, if you wanna help go 
> through it and suggest fixes/improvements/whatever to get things rolling 
> for real.
> 
> I've probably done 100000000000000000000000 things wrong, so if someone 
> can help me spot what is right what is not, I can start to fix stuff and 
> provide a beta version soon. Thanks :)
> 
> P.S. Classes names are ugly, I plan to change those soon.
> P.P.S. As soon as I get a beta JNLP implementation out, I will try to 
> provide a in-memory implementation as well. This is very easy to do, 
> given the base class.