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

Govind R rocks2984 at gmail.com
Fri Feb 20 08:47:09 CET 2009


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
*
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opencms.org/pipermail/opencms-dev/attachments/20090220/e591930d/attachment.html>


More information about the opencms-dev mailing list