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 756cb161c3..31747571d5 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,7 +20,6 @@ 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; @@ -30,7 +29,6 @@ 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; @@ -74,8 +72,7 @@ class PatchDetailServiceImpl extends BaseServiceImplementation implements callback.onFailure(new NoSuchEntityException()); return; } - Handler.wrap(patchScriptFactoryFactory.create(patchKey, psa, psb, dp)) - .to(callback); + 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 4e69b141a7..d1f5b245ac 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,9 +28,11 @@ 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/patch/PatchScriptBuilder.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptBuilder.java similarity index 98% rename from gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptBuilder.java rename to gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptBuilder.java index eaa5e75998..5019403db0 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptBuilder.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/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.server.patch; +package com.google.gerrit.httpd.rpc.patch; import com.google.gerrit.common.data.CommentDetail; import com.google.gerrit.common.data.PatchScript; @@ -26,6 +26,11 @@ 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-server/src/main/java/com/google/gerrit/server/patch/PatchScriptFactory.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptFactory.java similarity index 96% rename from gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptFactory.java rename to gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptFactory.java index e700f1450f..e0ec4654c1 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptFactory.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/rpc/patch/PatchScriptFactory.java @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.google.gerrit.server.patch; +package com.google.gerrit.httpd.rpc.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; @@ -31,6 +32,11 @@ 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; @@ -49,13 +55,12 @@ 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; -public class PatchScriptFactory implements Callable { - public interface Factory { +class PatchScriptFactory extends Handler { + interface Factory { PatchScriptFactory create(Patch.Key patchKey, @Assisted("patchSetA") PatchSet.Id patchSetA, @Assisted("patchSetB") PatchSet.Id patchSetB, 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 a7574c9b9e..62c6863743 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,7 +92,6 @@ 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; @@ -187,7 +186,6 @@ 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);