diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchDetailServiceImpl.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchDetailServiceImpl.java index 31747571d5..756cb161c3 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchDetailServiceImpl.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchDetailServiceImpl.java @@ -20,6 +20,7 @@ import com.google.gerrit.common.data.PatchScript; import com.google.gerrit.common.data.ReviewResult; import com.google.gerrit.common.errors.NoSuchEntityException; import com.google.gerrit.httpd.rpc.BaseServiceImplementation; +import com.google.gerrit.httpd.rpc.Handler; import com.google.gerrit.httpd.rpc.changedetail.ChangeDetailFactory; import com.google.gerrit.reviewdb.client.AccountDiffPreference; import com.google.gerrit.reviewdb.client.Change; @@ -29,6 +30,7 @@ import com.google.gerrit.reviewdb.client.PatchSet; import com.google.gerrit.reviewdb.server.ReviewDb; import com.google.gerrit.server.CurrentUser; import com.google.gerrit.server.changedetail.DeleteDraftPatchSet; +import com.google.gerrit.server.patch.PatchScriptFactory; import com.google.gerrit.server.patch.PatchSetInfoNotAvailableException; import com.google.gerrit.server.project.NoSuchChangeException; import com.google.gerrit.server.project.NoSuchProjectException; @@ -72,7 +74,8 @@ class PatchDetailServiceImpl extends BaseServiceImplementation implements callback.onFailure(new NoSuchEntityException()); return; } - patchScriptFactoryFactory.create(patchKey, psa, psb, dp).to(callback); + Handler.wrap(patchScriptFactoryFactory.create(patchKey, psa, psb, dp)) + .to(callback); } public void saveDraft(final PatchLineComment comment, diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchModule.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchModule.java index d1f5b245ac..4e69b141a7 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchModule.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchModule.java @@ -28,11 +28,9 @@ public class PatchModule extends RpcServletModule { install(new FactoryModule() { @Override protected void configure() { - factory(PatchScriptFactory.Factory.class); factory(SaveDraft.Factory.class); } }); - bind(PatchScriptBuilder.class); rpc(PatchDetailServiceImpl.class); } } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/config/GerritGlobalModule.java b/gerrit-server/src/main/java/com/google/gerrit/server/config/GerritGlobalModule.java index 62c6863743..a7574c9b9e 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/config/GerritGlobalModule.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/config/GerritGlobalModule.java @@ -92,6 +92,7 @@ import com.google.gerrit.server.mail.RebasedPatchSetSender; import com.google.gerrit.server.mail.ReplacePatchSetSender; import com.google.gerrit.server.mail.VelocityRuntimeProvider; import com.google.gerrit.server.patch.PatchListCacheImpl; +import com.google.gerrit.server.patch.PatchScriptFactory; import com.google.gerrit.server.patch.PatchSetInfoFactory; import com.google.gerrit.server.project.AccessControlModule; import com.google.gerrit.server.project.ChangeControl; @@ -186,6 +187,7 @@ public class GerritGlobalModule extends FactoryModule { factory(MergedSender.Factory.class); factory(MergeFailSender.Factory.class); factory(MergeUtil.Factory.class); + factory(PatchScriptFactory.Factory.class); factory(PerformCreateGroup.Factory.class); factory(PerformRenameGroup.Factory.class); factory(PluginUser.Factory.class); diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptBuilder.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptBuilder.java similarity index 98% rename from gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptBuilder.java rename to gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptBuilder.java index 5019403db0..eaa5e75998 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptBuilder.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptBuilder.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.google.gerrit.httpd.rpc.patch; +package com.google.gerrit.server.patch; import com.google.gerrit.common.data.CommentDetail; import com.google.gerrit.common.data.PatchScript; @@ -26,11 +26,6 @@ import com.google.gerrit.reviewdb.client.PatchLineComment; import com.google.gerrit.reviewdb.client.Project; import com.google.gerrit.reviewdb.client.AccountDiffPreference.Whitespace; import com.google.gerrit.server.FileTypeRegistry; -import com.google.gerrit.server.patch.IntraLineDiff; -import com.google.gerrit.server.patch.IntraLineDiffKey; -import com.google.gerrit.server.patch.PatchListCache; -import com.google.gerrit.server.patch.PatchListEntry; -import com.google.gerrit.server.patch.Text; import com.google.inject.Inject; import eu.medsea.mimeutil.MimeType; diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptFactory.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptFactory.java similarity index 96% rename from gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptFactory.java rename to gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptFactory.java index e0ec4654c1..e700f1450f 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptFactory.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptFactory.java @@ -12,11 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.google.gerrit.httpd.rpc.patch; +package com.google.gerrit.server.patch; import com.google.gerrit.common.data.CommentDetail; import com.google.gerrit.common.data.PatchScript; -import com.google.gerrit.httpd.rpc.Handler; import com.google.gerrit.reviewdb.client.Account; import com.google.gerrit.reviewdb.client.AccountDiffPreference; import com.google.gerrit.reviewdb.client.Change; @@ -32,11 +31,6 @@ import com.google.gerrit.server.IdentifiedUser; import com.google.gerrit.server.account.AccountInfoCacheFactory; import com.google.gerrit.server.git.GitRepositoryManager; import com.google.gerrit.server.git.LargeObjectException; -import com.google.gerrit.server.patch.PatchList; -import com.google.gerrit.server.patch.PatchListCache; -import com.google.gerrit.server.patch.PatchListEntry; -import com.google.gerrit.server.patch.PatchListKey; -import com.google.gerrit.server.patch.PatchListNotAvailableException; import com.google.gerrit.server.project.ChangeControl; import com.google.gerrit.server.project.NoSuchChangeException; import com.google.gwtorm.server.OrmException; @@ -55,12 +49,13 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.Callable; import javax.annotation.Nullable; -class PatchScriptFactory extends Handler { - interface Factory { +public class PatchScriptFactory implements Callable { + public interface Factory { PatchScriptFactory create(Patch.Key patchKey, @Assisted("patchSetA") PatchSet.Id patchSetA, @Assisted("patchSetB") PatchSet.Id patchSetB,