jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MMax <Maxim.Mu...@gmail.com>
Subject Re: LazyItemIterator
Date Tue, 24 Nov 2009 15:45:54 GMT

Hi, Alex. Thanks for this tip. 

I've tried using spi2dav way but I saw great performance decreasing. RMI
working 10 times faster on the same repository operations.

Here are 2 snippets of code for each connection way (the code gets root
children and their properties). Can you look through them and tell me if I'm
doing something wrong in spi2dav way?

1. RMI connection : 

Session session = null;
InitialContext ctx = new InitialContext();
JackrabbitClientAdapterFactory adapter = new
JackrabbitClientAdapterFactory(); 
RemoteRepository rr = (RemoteRepository)
ctx.lookup("rmi://localhost:1099/jackrabbit.repository");
Repository repository = adapter.getRepository(rr); 
Credentials credJBoss = new SimpleCredentials("test", "test".toCharArray());

     session = repository.login(credJBoss);
     Node rootNode = session.getRootNode();
     NodeIterator nodeIter = rootNode.getNodes();
     while (nodeIter.hasNext())
     {
	PropertyIterator propIter = nodeIter.nextNode().getProperties();
	while (propIter.hasNext()) {
	      Property prop = propIter.nextProperty();
	      prop.getName();
	}
    }

2. Spi2Dav :

String url = "http://localhost:8081/jackrabbit-webapp-1.6.0/server";
final IdFactory idFactory = IdFactoryImpl.getInstance();
final NameFactory nFactory = NameFactoryImpl.getInstance();
final PathFactory pFactory = PathFactoryImpl.getInstance();
final QValueFactory vFactory = QValueFactoryImpl.getInstance();

final RepositoryServiceImpl webdavRepoService = 
     new RepositoryServiceImpl(url, idFactory, nFactory, pFactory,
vFactory);
SessionInfo sessionInfo = webdavRepoService.obtain(new
SimpleCredentials("user", password".toCharArray()), "default");

Iterator<PropertyId> propIter = null;
Iterator<ChildInfoImpl> iter = webdavRepoService.getChildInfos(sessionInfo,
new MyNodeId(null, null));  // MyNodeId - class implementing NodeId
interface
     while (iter.hasNext()) {
	ChildInfoImpl childInfo = iter.next();
	propIter = webdavRepoService.getNodeInfo(sessionInfo, new
MyNodeId(childInfo.getUniqueID(), null)).getPropertyIds();
	while (propIter.hasNext()) {
 	      propIter.next();
	}
      }

Best Regards,

Maxim Musin
-- 
View this message in context: http://n4.nabble.com/LazyItemIterator-tp786078p786917.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Mime
View raw message