Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 54908 invoked from network); 2 Dec 2008 10:38:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Dec 2008 10:38:09 -0000 Received: (qmail 99536 invoked by uid 500); 2 Dec 2008 10:38:21 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 99513 invoked by uid 500); 2 Dec 2008 10:38:21 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 99504 invoked by uid 99); 2 Dec 2008 10:38:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Dec 2008 02:38:21 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Dec 2008 10:37:00 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6C3B3238889E; Tue, 2 Dec 2008 02:37:48 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r722416 - in /jackrabbit/sandbox/spi/client: ./ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/jackrabbit/ src/main/java/org/apache/jackrabbit/client/ src/main/java/org/apache/jackrabbit/clien... Date: Tue, 02 Dec 2008 10:37:47 -0000 To: commits@jackrabbit.apache.org From: angela@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081202103748.6C3B3238889E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: angela Date: Tue Dec 2 02:37:46 2008 New Revision: 722416 URL: http://svn.apache.org/viewvc?rev=722416&view=rev Log: JCR-1890: create RepositoryFactory implementation for spi2dav (and other spi-sandbox impls). Added: jackrabbit/sandbox/spi/client/src/main/ jackrabbit/sandbox/spi/client/src/main/java/ jackrabbit/sandbox/spi/client/src/main/java/org/ jackrabbit/sandbox/spi/client/src/main/java/org/apache/ jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/ jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/ jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/AbstractRepositoryConfig.java (with props) jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/RepositoryFactoryImpl.java (with props) jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spi2dav/ jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spi2dav/RepositoryConfigImpl.java (with props) jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spi2rmi/ jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spi2rmi/RepositoryConfigImpl.java (with props) jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spilogger/ jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spilogger/RepositoryConfigImpl.java (with props) Modified: jackrabbit/sandbox/spi/client/pom.xml jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/JCR2SPI2JCROverRMIRepositoryStub.java jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/JCR2SPIOverRMIRepositoryStub.java jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/JCR2SPIRepositoryStub.java jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/RMIRepositoryStub.java Modified: jackrabbit/sandbox/spi/client/pom.xml URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/client/pom.xml?rev=722416&r1=722415&r2=722416&view=diff ============================================================================== --- jackrabbit/sandbox/spi/client/pom.xml (original) +++ jackrabbit/sandbox/spi/client/pom.xml Tue Dec 2 02:37:46 2008 @@ -88,6 +88,10 @@ org.apache.jackrabbit + jackrabbit-spi-logger + + + org.apache.jackrabbit jackrabbit-jcr-commons @@ -142,6 +146,11 @@ junit 3.8.1 + + commons-io + commons-io + test + Added: jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/AbstractRepositoryConfig.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/AbstractRepositoryConfig.java?rev=722416&view=auto ============================================================================== --- jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/AbstractRepositoryConfig.java (added) +++ jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/AbstractRepositoryConfig.java Tue Dec 2 02:37:46 2008 @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.client; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig; +import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour; + +/** AbstractRepositoryConfig... */ +public abstract class AbstractRepositoryConfig implements RepositoryConfig { + + private static Logger log = LoggerFactory.getLogger(AbstractRepositoryConfig.class); + + public static final int DEFAULT_ITEM_CACHE_SIZE = 5000; + + private final CacheBehaviour cacheBehaviour; + private final int itemCacheSize; + + protected AbstractRepositoryConfig() { + this(CacheBehaviour.INVALIDATE, DEFAULT_ITEM_CACHE_SIZE); + } + + protected AbstractRepositoryConfig(CacheBehaviour cacheBehaviour, int itemCacheSize) { + this.cacheBehaviour = cacheBehaviour; + this.itemCacheSize = itemCacheSize; + } + + //---------------------------------------------------< RepositoryConfig >--- + /** + * @see RepositoryConfig#getCacheBehaviour() + */ + public CacheBehaviour getCacheBehaviour() { + return cacheBehaviour; + } + + /** + * @see RepositoryConfig#getItemCacheSize() + */ + public int getItemCacheSize() { + return itemCacheSize; + } +} \ No newline at end of file Propchange: jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/AbstractRepositoryConfig.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/AbstractRepositoryConfig.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/RepositoryFactoryImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/RepositoryFactoryImpl.java?rev=722416&view=auto ============================================================================== --- jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/RepositoryFactoryImpl.java (added) +++ jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/RepositoryFactoryImpl.java Tue Dec 2 02:37:46 2008 @@ -0,0 +1,104 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.client; + +import org.apache.jackrabbit.jcr2spi.RepositoryImpl; +import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig; +import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour; +import org.apache.jackrabbit.api.jsr283.RepositoryFactory; + +import javax.jcr.Repository; +import javax.jcr.RepositoryException; +import java.util.Map; +import java.rmi.RemoteException; +import java.rmi.NotBoundException; +import java.io.Writer; + +/** + * RepositoryFactoryImpl... + */ +public class RepositoryFactoryImpl implements RepositoryFactory { + + public static final String REPOSITORY_ITEM_CACHE_SIZE = "org.apache.jackrabbit.repository.itemCacheSize"; + public static final String REPOSITORY_CACHEBEHAVIOUR = "org.apache.jackrabbit.repository.cacheBehaviour"; + public static final String REPOSITORY_CONFIG = "org.apache.jackrabbit.repository.config"; + + public static final String REPOSITORY_SPI2RMI_URL = "org.apache.jackrabbit.repository.spi2rmi.url"; + public static final String REPOSITORY_SPI2DAV_URL = "org.apache.jackrabbit.repository.spi2dav.url"; + + public static final String REPOSITORY_SPILOG_WRITER = "org.apache.jackrabbit.repository.spilog.writer"; + + /** + * + * @param parameters + * @return + * @throws RepositoryException + */ + public Repository getRepository(Map parameters) throws RepositoryException { + RepositoryConfig config = null; + Object param = parameters.get(REPOSITORY_CONFIG); + if (param != null && param instanceof RepositoryConfig) { + config = (RepositoryConfig) param; + } + + if (config == null) { + int cacheSize = AbstractRepositoryConfig.DEFAULT_ITEM_CACHE_SIZE; + param = parameters.get(REPOSITORY_ITEM_CACHE_SIZE); + if (param != null) { + if (param instanceof Integer) { + cacheSize = ((Integer) param).intValue(); + } else { + try { + cacheSize = Integer.parseInt(param.toString()); + } catch (NumberFormatException e) { + // ignore. + } + } + } + + CacheBehaviour cb = CacheBehaviour.INVALIDATE; + param = parameters.get(REPOSITORY_CACHEBEHAVIOUR); + if (param != null && param instanceof CacheBehaviour) { + cb = (CacheBehaviour) param; + } + + if (parameters.containsKey(REPOSITORY_SPI2RMI_URL)) { + try { + String url = parameters.get(REPOSITORY_SPI2RMI_URL).toString(); + config = new org.apache.jackrabbit.client.spi2rmi.RepositoryConfigImpl(url, cb, cacheSize); + } catch (RemoteException e) { + throw new RepositoryException(e.getMessage()); + } catch (NotBoundException e) { + throw new RepositoryException(e.getMessage()); + } + } else if (parameters.containsKey(REPOSITORY_SPI2DAV_URL)) { + String url = parameters.get(REPOSITORY_SPI2DAV_URL).toString(); + config = new org.apache.jackrabbit.client.spi2dav.RepositoryConfigImpl(url, cb, cacheSize); + } + } + + if (config != null) { + Object spiLogWriter = parameters.get(REPOSITORY_SPILOG_WRITER); + if (spiLogWriter != null && spiLogWriter instanceof Writer) { + config = new org.apache.jackrabbit.client.spilogger.RepositoryConfigImpl(config, ((Writer) spiLogWriter)); + } + return RepositoryImpl.create(config); + } else { + return null; + } + } +} \ No newline at end of file Propchange: jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/RepositoryFactoryImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/RepositoryFactoryImpl.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spi2dav/RepositoryConfigImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spi2dav/RepositoryConfigImpl.java?rev=722416&view=auto ============================================================================== --- jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spi2dav/RepositoryConfigImpl.java (added) +++ jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spi2dav/RepositoryConfigImpl.java Tue Dec 2 02:37:46 2008 @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.client.spi2dav; + +import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour; +import org.apache.jackrabbit.spi.RepositoryService; +import org.apache.jackrabbit.spi.IdFactory; +import org.apache.jackrabbit.spi.NameFactory; +import org.apache.jackrabbit.spi.PathFactory; +import org.apache.jackrabbit.spi.QValueFactory; +import org.apache.jackrabbit.spi.commons.identifier.IdFactoryImpl; +import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl; +import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl; +import org.apache.jackrabbit.spi.commons.value.QValueFactoryImpl; +import org.apache.jackrabbit.spi2dav.RepositoryServiceImpl; +import org.apache.jackrabbit.client.AbstractRepositoryConfig; + +import javax.jcr.RepositoryException; + +/** + * RepositoryFactoryImpl... + */ +public class RepositoryConfigImpl extends AbstractRepositoryConfig { + + private final RepositoryService service; + + public RepositoryConfigImpl(String uri) throws RepositoryException { + super(); + service = createService(uri); + } + + public RepositoryConfigImpl(String uri, CacheBehaviour cacheBehaviour, int itemCacheSize) throws RepositoryException { + super(cacheBehaviour, itemCacheSize); + service = createService(uri); + } + + private static RepositoryService createService(String uri) throws RepositoryException { + IdFactory idFactory = IdFactoryImpl.getInstance(); + NameFactory nFactory = NameFactoryImpl.getInstance(); + PathFactory pFactory = PathFactoryImpl.getInstance(); + QValueFactory vFactory = QValueFactoryImpl.getInstance(); + return new RepositoryServiceImpl(uri, idFactory, nFactory, pFactory, vFactory); + } + + public RepositoryService getRepositoryService() throws RepositoryException { + return service; + } +} \ No newline at end of file Propchange: jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spi2dav/RepositoryConfigImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spi2dav/RepositoryConfigImpl.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spi2rmi/RepositoryConfigImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spi2rmi/RepositoryConfigImpl.java?rev=722416&view=auto ============================================================================== --- jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spi2rmi/RepositoryConfigImpl.java (added) +++ jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spi2rmi/RepositoryConfigImpl.java Tue Dec 2 02:37:46 2008 @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.client.spi2rmi; + +import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour; +import org.apache.jackrabbit.spi.rmi.remote.RemoteRepositoryService; +import org.apache.jackrabbit.spi.rmi.client.ClientRepositoryService; +import org.apache.jackrabbit.spi.rmi.server.ServerRepositoryService; +import org.apache.jackrabbit.spi.RepositoryService; +import org.apache.jackrabbit.client.AbstractRepositoryConfig; + +import javax.jcr.RepositoryException; +import java.rmi.registry.Registry; +import java.rmi.registry.LocateRegistry; +import java.rmi.RemoteException; +import java.rmi.NotBoundException; + +/** + * RepositoryFactoryImpl... + */ +public class RepositoryConfigImpl extends AbstractRepositoryConfig { + + private final RepositoryService service; + + public RepositoryConfigImpl(String repositoryName) + throws RepositoryException, RemoteException, NotBoundException { + super(); + service = createService(repositoryName); + } + + public RepositoryConfigImpl(String repositoryName, CacheBehaviour cacheBehaviour, + int itemCacheSize) + throws RepositoryException, RemoteException, NotBoundException { + super(cacheBehaviour, itemCacheSize); + service = createService(repositoryName); + } + + public RepositoryConfigImpl(RepositoryService repositoryService) throws RemoteException { + super(); + service = createService(new ServerRepositoryService(repositoryService)); + } + + public RepositoryConfigImpl(RepositoryService repositoryService, + CacheBehaviour cacheBehaviour, + int itemCacheSize) throws RemoteException { + super(cacheBehaviour, itemCacheSize); + service = createService(new ServerRepositoryService(repositoryService)); + } + + private static RepositoryService createService(String repositoryName) + throws RemoteException, NotBoundException { + Registry reg = LocateRegistry.getRegistry(Registry.REGISTRY_PORT); + return createService((RemoteRepositoryService) reg.lookup(repositoryName)); + } + + private static RepositoryService createService(RemoteRepositoryService remoteService) { + return new ClientRepositoryService(remoteService); + } + + public RepositoryService getRepositoryService() throws RepositoryException { + return service; + } +} \ No newline at end of file Propchange: jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spi2rmi/RepositoryConfigImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spi2rmi/RepositoryConfigImpl.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spilogger/RepositoryConfigImpl.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spilogger/RepositoryConfigImpl.java?rev=722416&view=auto ============================================================================== --- jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spilogger/RepositoryConfigImpl.java (added) +++ jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spilogger/RepositoryConfigImpl.java Tue Dec 2 02:37:46 2008 @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.client.spilogger; + +import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour; +import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig; +import org.apache.jackrabbit.spi.RepositoryService; +import org.apache.jackrabbit.spi.logger.RepositoryServiceLogger; + +import javax.jcr.RepositoryException; +import java.io.Writer; + +/** RepositoryConfigImpl... */ +public class RepositoryConfigImpl implements RepositoryConfig { + + private final RepositoryConfig config; + private final Writer writer; + + private RepositoryService service; + + public RepositoryConfigImpl(RepositoryConfig config, Writer writer) throws RepositoryException { + super(); + this.config = config; + this.writer = writer; + } + + public CacheBehaviour getCacheBehaviour() { + return config.getCacheBehaviour(); + } + public int getItemCacheSize() { + return config.getItemCacheSize(); + } + + public RepositoryService getRepositoryService() throws RepositoryException { + if (service == null) { + service = new RepositoryServiceLogger(config.getRepositoryService(), writer); + } + return service; + } +} \ No newline at end of file Propchange: jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spilogger/RepositoryConfigImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/sandbox/spi/client/src/main/java/org/apache/jackrabbit/client/spilogger/RepositoryConfigImpl.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Modified: jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/JCR2SPI2JCROverRMIRepositoryStub.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/JCR2SPI2JCROverRMIRepositoryStub.java?rev=722416&r1=722415&r2=722416&view=diff ============================================================================== --- jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/JCR2SPI2JCROverRMIRepositoryStub.java (original) +++ jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/JCR2SPI2JCROverRMIRepositoryStub.java Tue Dec 2 02:37:46 2008 @@ -16,18 +16,16 @@ */ package org.apache.jackrabbit.client; -import org.apache.jackrabbit.test.RepositoryStubException; +import org.apache.jackrabbit.client.spi2rmi.RepositoryConfigImpl; +import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig; import org.apache.jackrabbit.spi.RepositoryService; -import org.apache.jackrabbit.spi.rmi.server.ServerRepositoryService; -import org.apache.jackrabbit.spi.rmi.remote.RemoteRepositoryService; -import org.apache.jackrabbit.spi.rmi.client.ClientRepositoryService; -import org.apache.jackrabbit.jcr2spi.RepositoryImpl; -import org.apache.jackrabbit.jcr2spi.AbstractRepositoryConfig; +import org.apache.jackrabbit.test.RepositoryStubException; import javax.jcr.Repository; import javax.jcr.RepositoryException; -import java.util.Properties; import java.rmi.RemoteException; +import java.util.Properties; +import java.util.Collections; /** * JCR2SPI2JCROverRMIRepositoryStub implements a repository stub that @@ -59,14 +57,8 @@ if (repo == null) { RepositoryService spi2jcrRepoService = super.getRepositoryService(); try { - RemoteRepositoryService remoteRepoService = new ServerRepositoryService(spi2jcrRepoService); - final RepositoryService localRepoService = new ClientRepositoryService(remoteRepoService); - - repo = RepositoryImpl.create(new AbstractRepositoryConfig() { - public RepositoryService getRepositoryService() { - return localRepoService; - } - }); + RepositoryConfig config = new RepositoryConfigImpl(spi2jcrRepoService); + repo = new RepositoryFactoryImpl().getRepository(Collections.singletonMap(RepositoryFactoryImpl.REPOSITORY_CONFIG, config)); } catch (RepositoryException e) { RepositoryStubException ex = new RepositoryStubException(e.getMessage()); ex.initCause(e); Modified: jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/JCR2SPIOverRMIRepositoryStub.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/JCR2SPIOverRMIRepositoryStub.java?rev=722416&r1=722415&r2=722416&view=diff ============================================================================== --- jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/JCR2SPIOverRMIRepositoryStub.java (original) +++ jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/JCR2SPIOverRMIRepositoryStub.java Tue Dec 2 02:37:46 2008 @@ -15,20 +15,15 @@ */ package org.apache.jackrabbit.client; +import org.apache.jackrabbit.client.spi2rmi.RepositoryConfigImpl; import org.apache.jackrabbit.test.RepositoryStub; import org.apache.jackrabbit.test.RepositoryStubException; -import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig; -import org.apache.jackrabbit.jcr2spi.AbstractRepositoryConfig; -import org.apache.jackrabbit.jcr2spi.RepositoryImpl; -import org.apache.jackrabbit.spi.RepositoryService; -import org.apache.jackrabbit.spi.rmi.client.ClientRepositoryService; -import org.apache.jackrabbit.spi.rmi.remote.RemoteRepositoryService; import org.apache.log4j.PropertyConfigurator; import javax.jcr.Repository; import java.util.Properties; -import java.rmi.registry.LocateRegistry; -import java.rmi.registry.Registry; +import java.util.Collections; +import java.util.Map; /** * JCR2SPIRepositoryStub implements a repository stub that returns @@ -61,18 +56,9 @@ if (repository == null) { try { String repName = environment.getProperty(PROP_REPOSITORY_NAME); + Map params = Collections.singletonMap(RepositoryFactoryImpl.REPOSITORY_SPI2RMI_URL, repName); + repository = new RepositoryFactoryImpl().getRepository(params); - Registry reg = LocateRegistry.getRegistry(Registry.REGISTRY_PORT); - RemoteRepositoryService remoteService = (RemoteRepositoryService) reg.lookup(repName); - final RepositoryService rmiService = new ClientRepositoryService(remoteService); - - RepositoryConfig config = new AbstractRepositoryConfig() { - public RepositoryService getRepositoryService() { - return rmiService; - } - }; - - repository = RepositoryImpl.create(config); } catch (Exception e) { throw new RepositoryStubException(e.toString()); } Modified: jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/JCR2SPIRepositoryStub.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/JCR2SPIRepositoryStub.java?rev=722416&r1=722415&r2=722416&view=diff ============================================================================== --- jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/JCR2SPIRepositoryStub.java (original) +++ jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/JCR2SPIRepositoryStub.java Tue Dec 2 02:37:46 2008 @@ -15,25 +15,14 @@ */ package org.apache.jackrabbit.client; -import org.apache.jackrabbit.spi.commons.identifier.IdFactoryImpl; -import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig; -import org.apache.jackrabbit.jcr2spi.AbstractRepositoryConfig; -import org.apache.jackrabbit.jcr2spi.RepositoryImpl; -import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl; -import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl; -import org.apache.jackrabbit.spi.IdFactory; -import org.apache.jackrabbit.spi.NameFactory; -import org.apache.jackrabbit.spi.PathFactory; -import org.apache.jackrabbit.spi.QValueFactory; -import org.apache.jackrabbit.spi.RepositoryService; -import org.apache.jackrabbit.spi2dav.RepositoryServiceImpl; import org.apache.jackrabbit.test.RepositoryStub; import org.apache.jackrabbit.test.RepositoryStubException; -import org.apache.jackrabbit.spi.commons.value.QValueFactoryImpl; import org.apache.log4j.PropertyConfigurator; import javax.jcr.Repository; import java.util.Properties; +import java.util.Map; +import java.util.Collections; /** * JCR2SPIRepositoryStub implements a repository stub that returns @@ -67,20 +56,9 @@ if (repository == null) { try { String url = environment.getProperty(PROP_REPOSITORY_URL); + Map params = Collections.singletonMap(RepositoryFactoryImpl.REPOSITORY_SPI2DAV_URL, url); - 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); - - RepositoryConfig config = new AbstractRepositoryConfig() { - public RepositoryService getRepositoryService() { - return webdavRepoService; - } - }; - - repository = RepositoryImpl.create(config); + repository = new RepositoryFactoryImpl().getRepository(params); } catch (Exception e) { throw new RepositoryStubException(e.toString()); } Modified: jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/RMIRepositoryStub.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/RMIRepositoryStub.java?rev=722416&r1=722415&r2=722416&view=diff ============================================================================== --- jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/RMIRepositoryStub.java (original) +++ jackrabbit/sandbox/spi/client/src/test/java/org/apache/jackrabbit/client/RMIRepositoryStub.java Tue Dec 2 02:37:46 2008 @@ -36,7 +36,7 @@ * Property for the repository url */ public static final String PROP_REPOSITORY_URI = "org.apache.jackrabbit.rmi.repository.uri"; - + static { PropertyConfigurator.configure(RMIRepositoryStub.class.getClassLoader().getResource("log4j.properties")); } @@ -111,7 +111,7 @@ static String FactoryClassName = ClientRepositoryFactory.class.getName(); public Repository getRepository(String uri) throws MalformedURLException, NotBoundException, RemoteException { - System.setProperty("java.rmi.server.useCodebaseOnly", "true"); + System.setProperty("java.spi2rmi.server.useCodebaseOnly", "true"); return new ClientRepositoryFactory().getRepository(uri); } }