[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freenet-dev
Subject:    Re: [Freenet-dev] newDocument()
From:       Oskar Sandberg <md98-osa () nada ! kth ! se>
Date:       2000-04-28 7:39:17
[Download RAW message or body]

It is to make the sure the code in the message classes is pluggable for new
storage types. By overwriting the MyDocument internal class in the datastore you
use as n.ds the DataSend will now create the correct type of Data
automatically. 

If FileDocument were instantiated directly where needed, then people would
have to look up and change all those calls if they wanted to develop a DataStore
that stored documents in a Database. Currently all they (should) need to do is
add DBDocument/DBData/DBDataproperties implementations, and make a subclass of
the StandardDataStore that overwrites the newDocument method to return a
DBDocument instead.

For the Testbed, I plan to use this to make data classes that never store
anything to disk (for speeds sake). Since the testbed has to exist side by side
with the current code, I can obviously not go in and change a bunch of "new
FileDocument" to "new StringDocument" every time it needs to be used. 

Making the FileDocument class abstract is simply an enforcement thing, to force
people to use n.ds.newDocument() to make new ones.

On Fri, 28 Apr 2000, Brandon wrote:
> Why is the correct way to make a new document to call
> StandardDataStore.newDocument()? All it does is make a new MyDocument and
> all MyDocument does is subclass FileDocument since FileDocument is
> abstract. Also why should FileDocument be abstract if the class used by
> StandardDataStore subclasses but doesn't change anything?
> 
> 
> 
> 
> _______________________________________________
> Freenet-dev mailing list
> Freenet-dev@lists.sourceforge.net
> http://lists.sourceforge.net/mailman/listinfo/freenet-dev
-- 

Oskar Sandberg

md98-osa@nada.kth.se

#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic