Author: elvisisking
Date: 2009-07-24 16:22:31 -0400 (Fri, 24 Jul 2009)
New Revision: 1132
Modified:
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java
Log:
Made ServerManager implement IRestClient and delegate to the actual IRestClient.
Modified:
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java
===================================================================
---
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java 2009-07-24
20:08:32 UTC (rev 1131)
+++
branches/eclipse/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java 2009-07-24
20:22:31 UTC (rev 1132)
@@ -61,7 +61,7 @@
* @since 0.6
*/
@ThreadSafe
-public final class ServerManager {
+public final class ServerManager implements IRestClient {
//
===========================================================================================================================
// Constants
@@ -125,7 +125,7 @@
*
* @since 0.6
*/
- private final IRestClient restExecutor;
+ private final IRestClient delegate;
/**
* The path where the server registry is persisted or <code>null</code>
if not persisted.
@@ -165,7 +165,7 @@
this.servers = new ArrayList<Server>();
this.stateLocationPath = stateLocationPath;
- this.restExecutor = restExecutor;
+ this.delegate = restExecutor;
this.listeners = new CopyOnWriteArrayList<IServerRegistryListener>();
}
@@ -236,11 +236,9 @@
}
/**
- * @param server the server whose repositories are being requested (never
<code>null</code>)
- * @return the server repositories (never <code>null</code>)
- * @throws Exception if there is a problem obtaining the repositories or if the
server is not registered
- * @throws RuntimeException if the server is not registered
- * @see #isRegistered(Server)
+ * {@inheritDoc}
+ *
+ * @see
org.jboss.dna.web.jcr.rest.client.IRestClient#getRepositories(org.jboss.dna.web.jcr.rest.client.domain.Server)
* @since 0.6
*/
public Collection<Repository> getRepositories( Server server ) throws Exception
{
@@ -250,7 +248,7 @@
this.serverLock.readLock().lock();
if (isRegistered(server)) {
- Collection<Repository> repositories =
this.restExecutor.getRepositories(server);
+ Collection<Repository> repositories =
this.delegate.getRepositories(server);
return Collections.unmodifiableCollection(new
ArrayList<Repository>(repositories));
}
@@ -262,11 +260,9 @@
}
/**
- * @param repository the repository whose workspaces are being requested (never
<code>null</code>)
- * @return the DNA repository workspaces (never <code>null</code>)
- * @throws Exception if there is a problem obtaining the workspaces
- * @throws RuntimeException if the repository's server is not registered
- * @see #isRegistered(Server)
+ * {@inheritDoc}
+ *
+ * @see
org.jboss.dna.web.jcr.rest.client.IRestClient#getWorkspaces(org.jboss.dna.web.jcr.rest.client.domain.Repository)
* @since 0.6
*/
public Collection<Workspace> getWorkspaces( Repository repository ) throws
Exception {
@@ -276,7 +272,7 @@
this.serverLock.readLock().lock();
if (isRegistered(repository.getServer())) {
- Collection<Workspace> workspaces =
this.restExecutor.getWorkspaces(repository);
+ Collection<Workspace> workspaces =
this.delegate.getWorkspaces(repository);
return Collections.unmodifiableCollection(new
ArrayList<Workspace>(workspaces));
}
@@ -440,6 +436,19 @@
}
/**
+ * {@inheritDoc}
+ *
+ * @see
org.jboss.dna.web.jcr.rest.client.IRestClient#publish(org.jboss.dna.web.jcr.rest.client.domain.Workspace,
+ * java.lang.String, java.io.File)
+ * @since 0.6
+ */
+ public Status publish( Workspace workspace,
+ String path,
+ File file ) {
+ return this.delegate.publish(workspace, path, file);
+ }
+
+ /**
* @param listener the listener being unregistered and will no longer receive events
(never <code>null</code>)
* @return <code>true</code> if listener was removed
* @since 0.6
@@ -562,6 +571,19 @@
}
/**
+ * {@inheritDoc}
+ *
+ * @see
org.jboss.dna.web.jcr.rest.client.IRestClient#unpublish(org.jboss.dna.web.jcr.rest.client.domain.Workspace,
+ * java.lang.String, java.io.File)
+ * @since 0.6
+ */
+ public Status unpublish( Workspace workspace,
+ String path,
+ File file ) {
+ return this.delegate.unpublish(workspace, path, file);
+ }
+
+ /**
* Updates the server registry with a new version of a server.
*
* @param previousServerVersion the version of the server being replaced (never
<code>null</code>)
Show replies by date