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

Jonathan Woods jonathan.woods at scintillance.com
Fri Feb 20 11:38:39 CET 2009


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 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20090220/f47a8ad8/attachment.htm>


More information about the opencms-dev mailing list