incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject svn commit: r1592510 - in /sling/trunk/tooling/ide: api-test/src/test/java/org/apache/sling/ide/serialization/ api/src/org/apache/sling/ide/transport/ eclipse-core/src/org/apache/sling/ide/eclipse/core/ eclipse-core/src/org/apache/sling/ide/eclipse/cor...
Date Mon, 05 May 2014 12:31:39 GMT
Author: rombert
Date: Mon May  5 12:31:39 2014
New Revision: 1592510

URL: http://svn.apache.org/r1592510
Log:
SLING-3074-  Repository, SerializationManager - make stateful based on
RepositoryInfo

Create a RepositoryFactory interface and encapsulate all access to the
Repository object through it.

Added:
    sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/RepositoryFactory.java
      - copied, changed from r1592478, sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractRepository.java
    sling/trunk/tooling/ide/impl-resource/OSGI-INF/RepositoryFactoryImpl.xml   (contents,
props changed)
      - copied, changed from r1592478, sling/trunk/tooling/ide/impl-resource/OSGI-INF/RepositoryImpl.xml
    sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryFactoryImpl.java
      - copied, changed from r1592478, sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractRepository.java
    sling/trunk/tooling/ide/impl-vlt/OSGI-INF/VltRepositoryFactory.xml   (contents, props
changed)
      - copied, changed from r1592478, sling/trunk/tooling/ide/impl-vlt/OSGI-INF/VltRepository.xml
    sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepositoryFactory.java
  (contents, props changed)
      - copied, changed from r1592478, sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractRepository.java
Removed:
    sling/trunk/tooling/ide/impl-resource/OSGI-INF/RepositoryImpl.xml
    sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractRepository.java
    sling/trunk/tooling/ide/impl-vlt/OSGI-INF/VltRepository.xml
Modified:
    sling/trunk/tooling/ide/api-test/src/test/java/org/apache/sling/ide/serialization/StubRepository.java
    sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/Repository.java
    sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ServerUtil.java
    sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java
    sling/trunk/tooling/ide/impl-resource/META-INF/MANIFEST.MF
    sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryImpl.java
    sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepository.java

Modified: sling/trunk/tooling/ide/api-test/src/test/java/org/apache/sling/ide/serialization/StubRepository.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/api-test/src/test/java/org/apache/sling/ide/serialization/StubRepository.java?rev=1592510&r1=1592509&r2=1592510&view=diff
==============================================================================
--- sling/trunk/tooling/ide/api-test/src/test/java/org/apache/sling/ide/serialization/StubRepository.java
(original)
+++ sling/trunk/tooling/ide/api-test/src/test/java/org/apache/sling/ide/serialization/StubRepository.java
Mon May  5 12:31:39 2014
@@ -25,9 +25,6 @@ import org.apache.sling.ide.transport.Re
 import org.apache.sling.ide.transport.Result;
 
 public class StubRepository implements Repository {
-    @Override
-    public void setRepositoryInfo(RepositoryInfo repositoryInfo) {
-    }
 
     @Override
     public Command<ResourceProxy> newListChildrenNodeCommand(final String path) {

Modified: sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/Repository.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/Repository.java?rev=1592510&r1=1592509&r2=1592510&view=diff
==============================================================================
--- sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/Repository.java (original)
+++ sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/Repository.java Mon May
 5 12:31:39 2014
@@ -75,10 +75,6 @@ public interface Repository {
 	public static String JCR_VERSION_LABELS= "jcr:versionLabels";
 	public static String JCR_CHILD_VERSION_HISTORY= "jcr:childVersionHistory";
  	
-	//TODO change with properties
-    // FIXME this is not thread-safe and with multiple sling servers will fail intermitently
-	public void setRepositoryInfo(RepositoryInfo repositoryInfo);
-
     RepositoryInfo getRepositoryInfo();
 
     Command<Void> newAddOrUpdateNodeCommand(FileInfo fileInfo, ResourceProxy resourceProxy);

Copied: sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/RepositoryFactory.java
(from r1592478, sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractRepository.java)
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/RepositoryFactory.java?p2=sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/RepositoryFactory.java&p1=sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractRepository.java&r1=1592478&r2=1592510&rev=1592510&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractRepository.java
(original)
+++ sling/trunk/tooling/ide/api/src/org/apache/sling/ide/transport/RepositoryFactory.java
Mon May  5 12:31:39 2014
@@ -14,26 +14,28 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.ide.impl.resource.transport;
+package org.apache.sling.ide.transport;
 
-import org.apache.sling.ide.transport.Repository;
-import org.apache.sling.ide.transport.RepositoryInfo;
-//TODO move to api?
-public abstract class AbstractRepository implements Repository{
-	
-	protected RepositoryInfo repositoryInfo;
-	
-	public void setRepositoryInfo(RepositoryInfo repositoryInfo){
-		this.repositoryInfo=repositoryInfo;
-	}
-
-    @Override
-    public RepositoryInfo getRepositoryInfo() {
-        return repositoryInfo;
-    }
+/**
+ * The <tt>RepositoryFactory</tt> creates new <tt>Repository</tt>
instances
+ * 
+ * <p>
+ * Implementations of this interface must be thread-safe.
+ * </p>
+ *
+ */
+public interface RepositoryFactory {
 
-	@Override
-	public String toString() {
-		return "AbstractRepository [repositoryInfo=" + repositoryInfo + "]";
-	}
+    /**
+     * Returns a <tt>Repository</tt> instance for the specified <tt>repositoryInfo</tt>
+     * 
+     * <p>
+     * As an optimisation, implementations may choose to return the same instance for equivalent
repositoryInfo data.
+     * </p>
+     * 
+     * @param repositoryInfo
+     * @return
+     * @throws RepositoryException
+     */
+    Repository newRepository(RepositoryInfo repositoryInfo) throws RepositoryException;
 }

Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ServerUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ServerUtil.java?rev=1592510&r1=1592509&r2=1592510&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ServerUtil.java
(original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/ServerUtil.java
Mon May  5 12:31:39 2014
@@ -22,6 +22,8 @@ import java.net.URISyntaxException;
 import org.apache.sling.ide.eclipse.core.internal.Activator;
 import org.apache.sling.ide.eclipse.core.internal.SlingLaunchpadServer;
 import org.apache.sling.ide.transport.Repository;
+import org.apache.sling.ide.transport.RepositoryException;
+import org.apache.sling.ide.transport.RepositoryFactory;
 import org.apache.sling.ide.transport.RepositoryInfo;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -33,16 +35,17 @@ public abstract class ServerUtil {
     public static Repository getRepository(IServer server, IProgressMonitor monitor) throws
CoreException {
 
 
-        Repository repository = Activator.getDefault().getRepository();
+        RepositoryFactory repository = Activator.getDefault().getRepositoryFactory();
         try {
             RepositoryInfo repositoryInfo = getRepositoryInfo(server, monitor);
-            repository.setRepositoryInfo(repositoryInfo);
+            return repository.newRepository(repositoryInfo);
         } catch (URISyntaxException e) {
             throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage(),
e));
         } catch (RuntimeException e) {
             throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage(),
e));
+        } catch (RepositoryException e) {
+            throw new CoreException(new Status(Status.ERROR, Activator.PLUGIN_ID, e.getMessage(),
e));
         }
-        return repository;
     }
 
     public static RepositoryInfo getRepositoryInfo(IServer server, IProgressMonitor monitor)
throws URISyntaxException {

Modified: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java?rev=1592510&r1=1592509&r2=1592510&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java
(original)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/internal/Activator.java
Mon May  5 12:31:39 2014
@@ -20,7 +20,7 @@ import org.apache.sling.ide.eclipse.core
 import org.apache.sling.ide.filter.FilterLocator;
 import org.apache.sling.ide.osgi.OsgiClientFactory;
 import org.apache.sling.ide.serialization.SerializationManager;
-import org.apache.sling.ide.transport.Repository;
+import org.apache.sling.ide.transport.RepositoryFactory;
 import org.eclipse.core.runtime.Plugin;
 import org.osgi.framework.BundleContext;
 import org.osgi.util.tracker.ServiceTracker;
@@ -41,7 +41,7 @@ public class Activator extends Plugin {
 	// The shared instance
 	private static Activator plugin;
 
-    private ServiceTracker<Repository, Repository> repository;
+    private ServiceTracker<RepositoryFactory, RepositoryFactory> repositoryFactory;
     private ServiceTracker<SerializationManager, SerializationManager> serializationManager;
     private ServiceTracker<FilterLocator, FilterLocator> filterLocator;
     private ServiceTracker<OsgiClientFactory, OsgiClientFactory> osgiClientFactory;
@@ -50,8 +50,9 @@ public class Activator extends Plugin {
 		super.start(context);
 		plugin = this;
 
-        repository = new ServiceTracker<Repository, Repository>(context, Repository.class,
null);
-        repository.open();
+        repositoryFactory = new ServiceTracker<RepositoryFactory, RepositoryFactory>(context,
RepositoryFactory.class,
+                null);
+        repositoryFactory.open();
 
         serializationManager = new ServiceTracker<SerializationManager, SerializationManager>(context,
                 SerializationManager.class, null);
@@ -70,7 +71,7 @@ public class Activator extends Plugin {
 	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
 	 */
 	public void stop(BundleContext context) throws Exception {
-        repository.close();
+        repositoryFactory.close();
         serializationManager.close();
         filterLocator.close();
         osgiClientFactory.close();
@@ -88,9 +89,9 @@ public class Activator extends Plugin {
 		return plugin;
 	}
 
-	public Repository getRepository() {
+    public RepositoryFactory getRepositoryFactory() {
 
-        return ServiceUtil.getNotNull(repository);
+        return ServiceUtil.getNotNull(repositoryFactory);
 	}
 
     public SerializationManager getSerializationManager() {

Modified: sling/trunk/tooling/ide/impl-resource/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-resource/META-INF/MANIFEST.MF?rev=1592510&r1=1592509&r2=1592510&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-resource/META-INF/MANIFEST.MF (original)
+++ sling/trunk/tooling/ide/impl-resource/META-INF/MANIFEST.MF Mon May  5 12:31:39 2014
@@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.core.runtime
  org.eclipse.osgi.services;bundle-version="3.2.100"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Service-Component: OSGI-INF/RepositoryImpl.xml,
+Service-Component: OSGI-INF/RepositoryFactoryImpl.xml,
  OSGI-INF/SimpleXmlSerializationManager.xml, OSGI-INF/Tracer.xml,
  OSGI-INF/SimpleFilterLocator.xml
 Import-Package: org.json

Copied: sling/trunk/tooling/ide/impl-resource/OSGI-INF/RepositoryFactoryImpl.xml (from r1592478,
sling/trunk/tooling/ide/impl-resource/OSGI-INF/RepositoryImpl.xml)
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-resource/OSGI-INF/RepositoryFactoryImpl.xml?p2=sling/trunk/tooling/ide/impl-resource/OSGI-INF/RepositoryFactoryImpl.xml&p1=sling/trunk/tooling/ide/impl-resource/OSGI-INF/RepositoryImpl.xml&r1=1592478&r2=1592510&rev=1592510&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-resource/OSGI-INF/RepositoryImpl.xml (original)
+++ sling/trunk/tooling/ide/impl-resource/OSGI-INF/RepositoryFactoryImpl.xml Mon May  5 12:31:39
2014
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="false">
-   <implementation class="org.apache.sling.ide.impl.resource.transport.RepositoryImpl"/>
+   <implementation class="org.apache.sling.ide.impl.resource.transport.RepositoryFactoryImpl"/>
    <service>
-      <provide interface="org.apache.sling.ide.transport.Repository"/>
+      <provide interface="org.apache.sling.ide.transport.RepositoryFactory"/>
    </service>
    <reference bind="bindEventAdmin" cardinality="1..1" interface="org.osgi.service.event.EventAdmin"
name="EventAdmin" policy="static" unbind="unbindEventAdmin"/>
 </scr:component>

Propchange: sling/trunk/tooling/ide/impl-resource/OSGI-INF/RepositoryFactoryImpl.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/tooling/ide/impl-resource/OSGI-INF/RepositoryFactoryImpl.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Copied: sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryFactoryImpl.java
(from r1592478, sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractRepository.java)
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryFactoryImpl.java?p2=sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryFactoryImpl.java&p1=sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractRepository.java&r1=1592478&r2=1592510&rev=1592510&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractRepository.java
(original)
+++ sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryFactoryImpl.java
Mon May  5 12:31:39 2014
@@ -17,23 +17,25 @@
 package org.apache.sling.ide.impl.resource.transport;
 
 import org.apache.sling.ide.transport.Repository;
+import org.apache.sling.ide.transport.RepositoryException;
+import org.apache.sling.ide.transport.RepositoryFactory;
 import org.apache.sling.ide.transport.RepositoryInfo;
-//TODO move to api?
-public abstract class AbstractRepository implements Repository{
-	
-	protected RepositoryInfo repositoryInfo;
-	
-	public void setRepositoryInfo(RepositoryInfo repositoryInfo){
-		this.repositoryInfo=repositoryInfo;
-	}
+import org.osgi.service.event.EventAdmin;
+
+/**
+ * The <tt>RepositoryFactoryImpl</tt> creates <tt>RepositoryImpl</tt>
instances
+ *
+ */
+public class RepositoryFactoryImpl implements RepositoryFactory {
+
+    private EventAdmin eventAdmin;
 
     @Override
-    public RepositoryInfo getRepositoryInfo() {
-        return repositoryInfo;
+    public Repository newRepository(RepositoryInfo repositoryInfo) throws RepositoryException
{
+        return new RepositoryImpl(repositoryInfo, eventAdmin);
     }
 
-	@Override
-	public String toString() {
-		return "AbstractRepository [repositoryInfo=" + repositoryInfo + "]";
-	}
+    protected void bindEventAdmin(EventAdmin eventAdmin) {
+        this.eventAdmin = eventAdmin;
+    }
 }

Modified: sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryImpl.java?rev=1592510&r1=1592509&r2=1592510&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryImpl.java
(original)
+++ sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/RepositoryImpl.java
Mon May  5 12:31:39 2014
@@ -19,14 +19,22 @@ package org.apache.sling.ide.impl.resour
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.sling.ide.transport.Command;
 import org.apache.sling.ide.transport.FileInfo;
+import org.apache.sling.ide.transport.Repository;
+import org.apache.sling.ide.transport.RepositoryInfo;
 import org.apache.sling.ide.transport.ResourceProxy;
 import org.apache.sling.ide.transport.TracingCommand;
 import org.osgi.service.event.EventAdmin;
 
-public class RepositoryImpl extends AbstractRepository{
+public class RepositoryImpl implements Repository {
 	
     private final HttpClient httpClient = new HttpClient();
-    private EventAdmin eventAdmin;
+    private final RepositoryInfo repositoryInfo;
+    private final EventAdmin eventAdmin;
+
+    public RepositoryImpl(RepositoryInfo repositoryInfo, EventAdmin eventAdmin) {
+        this.repositoryInfo = repositoryInfo;
+        this.eventAdmin = eventAdmin;
+    }
 
     private <T> Command<T> wrap(AbstractCommand<T> command) {
         return new TracingCommand<T>(command, eventAdmin);
@@ -60,13 +68,8 @@ public class RepositoryImpl extends Abst
                 resource.getProperties(), fileInfo));
 	}
 
-    public void bindEventAdmin(EventAdmin eventAdmin) {
-
-        this.eventAdmin = eventAdmin;
-    }
-
-    public void unbindEventAdmin(EventAdmin eventAdmin) {
-
-        this.eventAdmin = null;
+    @Override
+    public RepositoryInfo getRepositoryInfo() {
+        return repositoryInfo;
     }
 }

Copied: sling/trunk/tooling/ide/impl-vlt/OSGI-INF/VltRepositoryFactory.xml (from r1592478,
sling/trunk/tooling/ide/impl-vlt/OSGI-INF/VltRepository.xml)
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/OSGI-INF/VltRepositoryFactory.xml?p2=sling/trunk/tooling/ide/impl-vlt/OSGI-INF/VltRepositoryFactory.xml&p1=sling/trunk/tooling/ide/impl-vlt/OSGI-INF/VltRepository.xml&r1=1592478&r2=1592510&rev=1592510&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/OSGI-INF/VltRepository.xml (original)
+++ sling/trunk/tooling/ide/impl-vlt/OSGI-INF/VltRepositoryFactory.xml Mon May  5 12:31:39
2014
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="false">
-   <implementation class="org.apache.sling.ide.impl.vlt.VltRepository"/>
-   <service>
-      <provide interface="org.apache.sling.ide.transport.Repository"/>
-   </service>
+   <implementation class="org.apache.sling.ide.impl.vlt.VltRepositoryFactory"/>
    <reference bind="bindEventAdmin" cardinality="1..1" interface="org.osgi.service.event.EventAdmin"
name="EventAdmin" policy="static" unbind="unbindEventAdmin"/>
    <property name="service.ranking" type="Integer" value="100"/>
+   <service>
+      <provide interface="org.apache.sling.ide.transport.RepositoryFactory"/>
+   </service>
 </scr:component>

Propchange: sling/trunk/tooling/ide/impl-vlt/OSGI-INF/VltRepositoryFactory.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/tooling/ide/impl-vlt/OSGI-INF/VltRepositoryFactory.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepository.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepository.java?rev=1592510&r1=1592509&r2=1592510&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepository.java
(original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepository.java
Mon May  5 12:31:39 2014
@@ -17,25 +17,22 @@ import org.osgi.service.event.EventAdmin
  */
 public class VltRepository implements Repository {
 
-    private RepositoryInfo repositoryInfo;
-    private javax.jcr.Repository jcrRepo;
+    private final RepositoryInfo repositoryInfo;
+    private final EventAdmin eventAdmin;
 
-    private EventAdmin eventAdmin;
+    private javax.jcr.Repository jcrRepo;
     private Credentials credentials;
 
-    @Override
-    public void setRepositoryInfo(RepositoryInfo repositoryInfo) {
-
+    public VltRepository(RepositoryInfo repositoryInfo, EventAdmin eventAdmin) {
         this.repositoryInfo = repositoryInfo;
-
-        initJcrRepo();
+        this.eventAdmin = eventAdmin;
     }
 
     public RepositoryInfo getRepositoryInfo() {
         return repositoryInfo;
     }
 
-    private void initJcrRepo() {
+    public void init() {
         try {
             jcrRepo = RepositoryUtils.getRepository(repositoryInfo);
             credentials = RepositoryUtils.getCredentials(repositoryInfo);
@@ -46,7 +43,6 @@ public class VltRepository implements Re
 
     @Override
     public Command<Void> newAddOrUpdateNodeCommand(FileInfo fileInfo, ResourceProxy
resource) {
-        // TODO implement
         return TracingCommand.wrap(new AddOrUpdateNodeCommand(jcrRepo, credentials, fileInfo,
resource),
                 eventAdmin);
     }
@@ -74,14 +70,4 @@ public class VltRepository implements Re
         return TracingCommand.wrap(new GetNodeCommand(jcrRepo, credentials, path), eventAdmin);
     }
 
-    protected void bindEventAdmin(EventAdmin eventAdmin) {
-
-        this.eventAdmin = eventAdmin;
-    }
-
-    protected void unbindEventAdmin(EventAdmin eventAdmin) {
-
-        this.eventAdmin = null;
-    }
-
 }

Copied: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepositoryFactory.java
(from r1592478, sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractRepository.java)
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepositoryFactory.java?p2=sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepositoryFactory.java&p1=sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractRepository.java&r1=1592478&r2=1592510&rev=1592510&view=diff
==============================================================================
--- sling/trunk/tooling/ide/impl-resource/src/org/apache/sling/ide/impl/resource/transport/AbstractRepository.java
(original)
+++ sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepositoryFactory.java
Mon May  5 12:31:39 2014
@@ -14,26 +14,37 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.sling.ide.impl.resource.transport;
+package org.apache.sling.ide.impl.vlt;
 
 import org.apache.sling.ide.transport.Repository;
+import org.apache.sling.ide.transport.RepositoryException;
+import org.apache.sling.ide.transport.RepositoryFactory;
 import org.apache.sling.ide.transport.RepositoryInfo;
-//TODO move to api?
-public abstract class AbstractRepository implements Repository{
-	
-	protected RepositoryInfo repositoryInfo;
-	
-	public void setRepositoryInfo(RepositoryInfo repositoryInfo){
-		this.repositoryInfo=repositoryInfo;
-	}
+import org.osgi.service.event.EventAdmin;
+
+/**
+ * The <tt>VltRepositoryFactory</tt> instatiantes <tt>VltRepository</tt>
instances
+ *
+ */
+public class VltRepositoryFactory implements RepositoryFactory {
+
+    private EventAdmin eventAdmin;
 
     @Override
-    public RepositoryInfo getRepositoryInfo() {
-        return repositoryInfo;
+    public Repository newRepository(RepositoryInfo repositoryInfo) throws RepositoryException
{
+
+        VltRepository repo = new VltRepository(repositoryInfo, eventAdmin);
+
+        repo.init();
+
+        return repo;
+    }
+
+    protected void bindEventAdmin(EventAdmin eventAdmin) {
+        this.eventAdmin = eventAdmin;
     }
 
-	@Override
-	public String toString() {
-		return "AbstractRepository [repositoryInfo=" + repositoryInfo + "]";
-	}
+    protected void unbindEventAdmin(EventAdmin eventAdmin) {
+        this.eventAdmin = null;
+    }
 }

Propchange: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepositoryFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/tooling/ide/impl-vlt/src/org/apache/sling/ide/impl/vlt/VltRepositoryFactory.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL



Mime
View raw message