[opencms-dev] cmsObject.getFilesInFolder() return from cache.

Govind R rocks2984 at gmail.com
Fri Feb 20 15:17:59 CET 2009


Hi Jonathan

Thanks for the reply.

My other Application is where i create some files which i save to opencms.
And from the application code snipped which i pasted  trying to read the
file created in the application.

is it possible to get always from resources not from cache.

Please the help

Regards
Govind R

On Fri, Feb 20, 2009 at 4:08 PM, Jonathan Woods <
jonathan.woods at scintillance.com> wrote:

>  You say "from my other application" - what runtime environment does that
> have?  If it's not running in the same web application as the code you've
> written below, then yes - it could be a caching issue, because OpenCms might
> choose to go to the database for some operations but use in-memory caches
> for others.  It isn't enough just to have two CmsObjects referring to the
> same OpenCms installation - to be sure of avoiding caching issues, you have
> to have obtained the CmsObjects in the same runtime context.
>
> Jon
>
>  ------------------------------
> *From:* opencms-dev-bounces at opencms.org [mailto:
> opencms-dev-bounces at opencms.org] *On Behalf Of *Govind R
> *Sent:* 20 February 2009 07:47
> *To:* opencms-dev at opencms.org
> *Subject:* [opencms-dev] cmsObject.getFilesInFolder() return from cache.
>
> Hello All.
>
> I have a strange problem when i am using cmsObject.getFilesInFolder().
>
> I have OpenCms Version 6.2.3 deployed in Jboss4.2.0GA
>
>
> My Test Case:-
>
> I have my MyBeanLoader as i using spring and opencms.
>
>
> MyOperations myOperations = null;
> public void testOpencms()
>     {
>         myOperations = (MyOperations)
> MyBeanLoader.getInstance("MyOperations**");
>         while(true){
>             try {
>               // Gets the  list of files from resource.
>
>                 Vector<CmsFile> documentsize = myOperations
> .getDocumentsFromFolder("MyResource");
>                 System.out.println("Document::"+documentsize .size());
>
>                 // Checks for the existence of resource.
>
>                 boolean checkExistsDocument = myOperations
> .existsDocument("abc","MyResource");
>
> System.out.println("checkExistsDocument::"+checkExistsDocument);
>
>                 // Gets the document
>
>                 byte[] document = myOperations
> .getDocument("abc","MyResource");
>                 System.out.println("document ::"+document );
>                 Thread.sleep(10000);
>             } catch (InterruptedException e) {
>                 // TODO Auto-generated catch block
>                 e.printStackTrace();
>             }
>
> }
>
> MyOperations  is wrapper for CmsObject and the above api's *getDocumentsFromFolder
> will call getFilesInFolder of CmsObject*,
> *getDocument will call** ** readFile** of CmsObject,**existsDocument will
> call existsResource **of CmsObject.
> *
> when i run the test case  i will not be having "*abc*" file in *
> "MyResource"* folder.
>
> So the output which i get
>
> *Document::*" 0
> *checkExistsDocument::*false
> *document *::null
>
> After some execution i create "*abc*" file in *"MyResource"* folder from
> my other appilication .
>
> So the output which i get is
>
> *Document::*" 0
> *checkExistsDocument::*true
> *document *::@fgdfgdfh
>
> i am not able to find why it gives 0 size. *i think may be its is
> returning the size from cache*
>
> But if i  do OpenCms.initCmsObject every time i get the proper count.Why???
>
> Can u help me why.
>
> Regards
> Govind R
> *
> *
>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20090220/d2dc6542/attachment.htm>


More information about the opencms-dev mailing list