You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by "Harding, Christopher (Student Assistant)" <Ch...@softwareag.com> on 2000/11/14 11:42:02 UTC

MemoryDescriptorStore

Hello,
  In the Domain.XML file you have the code

   <descriptorsstore name="memory"/>
      
      <contentstore name="file"
classname="slidestore.file.FileContentStore">
        <parameter name="rootpath">files</parameter>
      </contentstore>
      
      <scope match="/" descriptorsstore="memory" contentstore="file"/>

  This means that the contentstore "file" uses the descriptorstore "memory",
I have a contentstore that I would like to use a seperate descriptorstore
for, say "mymemory", so I believe this should  work

  <descriptorsstore name="memory"/>
  <descriptorsstore name="mymemory" classname="slidestore.memory.mymemory"/>
      
      <contentstore name="file"
classname="slidestore.file.FileContentStore">
        <parameter name="rootpath">files</parameter>
      </contentstore>

      <contentstore name="mystore" classname="slidestore.file.mystore">
        <parameter name="mystorepath">mystore</parameter>
      </contentstore>
      
      <scope match="/" descriptorsstore="memory" contentstore="file"/>
      <scope match="/mystore" descriptorsstore="mymemory"
contentstore="mystore"/>

  Would this be correct, because if I use this then I get a CastException
thrown when I start up Slide. Can you use more than one descriptorsstore,
with different contentstores, if so can you please supply a code snippet for
the Domain XML file on how to do this. mymemory is a copy of the
MemoryDescriptorsStore code. Or can I only use one descriptorstore at a time
with slide?

Thanxs for any help

Chris Harding

                                  | | | | | | | | |
                 --------
                 ( o  o )
------------oo0---(    )---0oo------------
|  Chris Harding                         |
|     Christopher.Harding@sotwareag.com  |
|                                        |
|----------------------------------------|


Re: MemoryDescriptorStore

Posted by Remy Maucherat <re...@apache.org>.
> Hello,
>   In the Domain.XML file you have the code
>
>    <descriptorsstore name="memory"/>
>
>       <contentstore name="file"
> classname="slidestore.file.FileContentStore">
>         <parameter name="rootpath">files</parameter>
>       </contentstore>
>
>       <scope match="/" descriptorsstore="memory" contentstore="file"/>
>
>   This means that the contentstore "file" uses the descriptorstore
"memory",
> I have a contentstore that I would like to use a seperate descriptorstore
> for, say "mymemory", so I believe this should  work
>
>   <descriptorsstore name="memory"/>
>   <descriptorsstore name="mymemory"
classname="slidestore.memory.mymemory"/>

That's not correct. Unfortunately, the XML file format is still not totally
coherent.
The default value of this classname element is
org.apache.slide.store.StandardDescriptorsStore, and it's actually a
placeholder object which is responsible of doing caching. It's pluggable to
enable admins to choose a different caching policy, or do other things I
didn't think about.

Eventually, the descriptorsstore and contentstore element will get merged
into a store element (and content store will be a child element of store).
Unfortunately, I can't do that right now (I'm way too busy with Catalina)
:((

Let's say your mymemory class implements NodeStore and SecurityStore :
<descriptorsstore name="memory">
  <nodestore classname="slidestore.memory.mymemory" />
  <securitystore reference="nodestore" />
</descriptorsstore>

The securitystore element means : The security store will be handled by the
object instance alreadi used for the node store.

Note : The package names / classnames are arbitrary, so you can give your
stores whatever name you want.

Eventually, the format will be :
<store name="memory">
  <nodestore classname="slidestore.memory.mymemory" />
  <securitystore reference="nodestore" />
  <contentstore name="file" classname="slidestore.file.FileContentStore">
    <parameter name="rootpath">files</parameter>
  </contentstore>
</store>

IMO it makes a lot more sense. Unfortunately, it means moving around more
code than what it looks like, since I want the underlying object structure
to match the XML structure.

>       <contentstore name="file"
> classname="slidestore.file.FileContentStore">
>         <parameter name="rootpath">files</parameter>
>       </contentstore>
>
>       <contentstore name="mystore" classname="slidestore.file.mystore">
>         <parameter name="mystorepath">mystore</parameter>
>       </contentstore>
>
>       <scope match="/" descriptorsstore="memory" contentstore="file"/>
>       <scope match="/mystore" descriptorsstore="mymemory"
> contentstore="mystore"/>
>
>   Would this be correct, because if I use this then I get a CastException
> thrown when I start up Slide. Can you use more than one descriptorsstore,
> with different contentstores, if so can you please supply a code snippet
for
> the Domain XML file on how to do this. mymemory is a copy of the
> MemoryDescriptorsStore code. Or can I only use one descriptorstore at a
time
> with slide?

The rest is correct. That's how you use more that one store.
Also, you can reuse the same store at multiple nodes in the namespace. A
different instance will be used each time. The store is responsible for
behaving correctly if that happens (of course, you have to help it
sometimes, like by specifying a different rootpath for your
FileContentStores).

Thanks,
Remy