1 package org
.argeo
.jackrabbit
.client
;
5 import javax
.jcr
.RepositoryException
;
7 import org
.apache
.jackrabbit
.spi
.RepositoryService
;
8 import org
.apache
.jackrabbit
.spi
.commons
.ItemInfoCacheImpl
;
9 import org
.apache
.jackrabbit
.spi2davex
.BatchReadConfig
;
10 import org
.apache
.jackrabbit
.spi2davex
.Spi2davexRepositoryServiceFactory
;
13 * Wrapper for {@link Spi2davexRepositoryServiceFactory} in order to create a
14 * {@link ClientDavexRepositoryService}.
16 public class ClientDavexRepositoryServiceFactory
extends Spi2davexRepositoryServiceFactory
{
18 public RepositoryService
createRepositoryService(Map
<?
, ?
> parameters
) throws RepositoryException
{
19 // retrieve the repository uri
21 if (parameters
== null) {
22 uri
= System
.getProperty(PARAM_REPOSITORY_URI
);
24 Object repoUri
= parameters
.get(PARAM_REPOSITORY_URI
);
25 uri
= (repoUri
== null) ?
null : repoUri
.toString();
28 uri
= DEFAULT_REPOSITORY_URI
;
31 // load other optional configuration parameters
32 BatchReadConfig brc
= null;
33 int itemInfoCacheSize
= ItemInfoCacheImpl
.DEFAULT_CACHE_SIZE
;
34 int maximumHttpConnections
= 0;
36 // since JCR-4120 the default workspace name is no longer set to 'default'
37 // note: if running with JCR Server < 1.5 a default workspace name must
38 // therefore be configured
39 String workspaceNameDefault
= null;
41 if (parameters
!= null) {
43 Object param
= parameters
.get(PARAM_BATCHREAD_CONFIG
);
44 if (param
!= null && param
instanceof BatchReadConfig
) {
45 brc
= (BatchReadConfig
) param
;
48 // itemCache size config
49 param
= parameters
.get(PARAM_ITEMINFO_CACHE_SIZE
);
52 itemInfoCacheSize
= Integer
.parseInt(param
.toString());
53 } catch (NumberFormatException e
) {
54 // ignore, use default
58 // max connections config
59 param
= parameters
.get(PARAM_MAX_CONNECTIONS
);
62 maximumHttpConnections
= Integer
.parseInt(param
.toString());
63 } catch (NumberFormatException e
) {
68 param
= parameters
.get(PARAM_WORKSPACE_NAME_DEFAULT
);
70 workspaceNameDefault
= param
.toString();
74 if (maximumHttpConnections
> 0) {
75 return new ClientDavexRepositoryService(uri
, workspaceNameDefault
, brc
, itemInfoCacheSize
,
76 maximumHttpConnections
);
78 return new ClientDavexRepositoryService(uri
, workspaceNameDefault
, brc
, itemInfoCacheSize
);