mirror of
https://github.com/google/nomulus.git
synced 2025-06-05 12:07:25 +02:00
Import code from internal repository to git
This commit is contained in:
commit
0ef0c933d2
2490 changed files with 281594 additions and 0 deletions
50
java/com/google/domain/registry/module/backend/BUILD
Normal file
50
java/com/google/domain/registry/module/backend/BUILD
Normal file
|
@ -0,0 +1,50 @@
|
|||
package(
|
||||
default_visibility = ["//java/com/google/domain/registry:registry_project"],
|
||||
)
|
||||
|
||||
|
||||
java_library(
|
||||
name = "backend",
|
||||
srcs = glob(["*.java"]),
|
||||
deps = [
|
||||
"//java/com/google/common/base",
|
||||
"//java/com/google/common/collect",
|
||||
"//java/com/google/common/net",
|
||||
"//java/com/google/domain/registry/backup",
|
||||
"//java/com/google/domain/registry/bigquery",
|
||||
"//java/com/google/domain/registry/config",
|
||||
"//java/com/google/domain/registry/cron",
|
||||
"//java/com/google/domain/registry/dns",
|
||||
"//java/com/google/domain/registry/dns/writer/api",
|
||||
"//java/com/google/domain/registry/export",
|
||||
"//java/com/google/domain/registry/export/sheet",
|
||||
"//java/com/google/domain/registry/flows",
|
||||
"//java/com/google/domain/registry/gcs",
|
||||
"//java/com/google/domain/registry/groups",
|
||||
"//java/com/google/domain/registry/keyring/api",
|
||||
"//java/com/google/domain/registry/mapreduce",
|
||||
"//java/com/google/domain/registry/model",
|
||||
"//java/com/google/domain/registry/rde",
|
||||
"//java/com/google/domain/registry/request",
|
||||
"//java/com/google/domain/registry/request:modules",
|
||||
"//java/com/google/domain/registry/tmch",
|
||||
"//java/com/google/domain/registry/util",
|
||||
"//third_party/java/bouncycastle",
|
||||
"//third_party/java/dagger",
|
||||
"//third_party/java/jsr305_annotations",
|
||||
"//third_party/java/jsr330_inject",
|
||||
"//third_party/java/servlet/servlet_api",
|
||||
],
|
||||
)
|
||||
|
||||
# This rule is used so bazel can generate "backend_jar_deploy.jar" (which
|
||||
# contains transitive dependencies) for deployment to App Engine. It MUST
|
||||
# explicitly depend upon upon anything loaded at runtime, e.g. old servlets
|
||||
# referenced by the module's web.xml file, that isn't statically linked above.
|
||||
java_binary(
|
||||
name = "backend_jar",
|
||||
create_executable = 0,
|
||||
runtime_deps = [
|
||||
":backend",
|
||||
],
|
||||
)
|
|
@ -0,0 +1,74 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed 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 com.google.domain.registry.module.backend;
|
||||
|
||||
import com.google.domain.registry.bigquery.BigqueryModule;
|
||||
import com.google.domain.registry.config.ConfigModule;
|
||||
import com.google.domain.registry.dns.writer.api.VoidDnsWriterModule;
|
||||
import com.google.domain.registry.export.DriveModule;
|
||||
import com.google.domain.registry.export.sheet.SpreadsheetServiceModule;
|
||||
import com.google.domain.registry.gcs.GcsServiceModule;
|
||||
import com.google.domain.registry.groups.DirectoryModule;
|
||||
import com.google.domain.registry.groups.GroupsModule;
|
||||
import com.google.domain.registry.groups.GroupssettingsModule;
|
||||
import com.google.domain.registry.keyring.api.KeyModule;
|
||||
import com.google.domain.registry.keyring.api.VoidKeyringModule;
|
||||
import com.google.domain.registry.rde.JSchModule;
|
||||
import com.google.domain.registry.request.Modules.AppIdentityCredentialModule;
|
||||
import com.google.domain.registry.request.Modules.DatastoreServiceModule;
|
||||
import com.google.domain.registry.request.Modules.GoogleCredentialModule;
|
||||
import com.google.domain.registry.request.Modules.Jackson2Module;
|
||||
import com.google.domain.registry.request.Modules.ModulesServiceModule;
|
||||
import com.google.domain.registry.request.Modules.URLFetchServiceModule;
|
||||
import com.google.domain.registry.request.Modules.UrlFetchTransportModule;
|
||||
import com.google.domain.registry.request.Modules.UseAppIdentityCredentialForGoogleApisModule;
|
||||
import com.google.domain.registry.request.RequestModule;
|
||||
import com.google.domain.registry.util.SystemClock.SystemClockModule;
|
||||
import com.google.domain.registry.util.SystemSleeper.SystemSleeperModule;
|
||||
|
||||
import dagger.Component;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/** Dagger component with instance lifetime for "backend" App Engine module. */
|
||||
@Singleton
|
||||
@Component(
|
||||
modules = {
|
||||
AppIdentityCredentialModule.class,
|
||||
BigqueryModule.class,
|
||||
ConfigModule.class,
|
||||
DatastoreServiceModule.class,
|
||||
DirectoryModule.class,
|
||||
DriveModule.class,
|
||||
GcsServiceModule.class,
|
||||
GoogleCredentialModule.class,
|
||||
GroupsModule.class,
|
||||
GroupssettingsModule.class,
|
||||
JSchModule.class,
|
||||
Jackson2Module.class,
|
||||
KeyModule.class,
|
||||
ModulesServiceModule.class,
|
||||
SpreadsheetServiceModule.class,
|
||||
SystemClockModule.class,
|
||||
SystemSleeperModule.class,
|
||||
URLFetchServiceModule.class,
|
||||
UrlFetchTransportModule.class,
|
||||
UseAppIdentityCredentialForGoogleApisModule.class,
|
||||
VoidDnsWriterModule.class,
|
||||
VoidKeyringModule.class,
|
||||
})
|
||||
interface BackendComponent {
|
||||
BackendRequestComponent startRequest(RequestModule requestModule);
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed 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 com.google.domain.registry.module.backend;
|
||||
|
||||
import static com.google.domain.registry.model.registry.Registries.assertTldExists;
|
||||
import static com.google.domain.registry.request.RequestParameters.extractRequiredParameter;
|
||||
|
||||
import com.google.domain.registry.request.Parameter;
|
||||
import com.google.domain.registry.request.RequestParameters;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* Dagger module for injecting common settings for all Backend tasks.
|
||||
*/
|
||||
@Module
|
||||
public class BackendModule {
|
||||
|
||||
@Provides
|
||||
@Parameter(RequestParameters.PARAM_TLD)
|
||||
static String provideTld(HttpServletRequest req) {
|
||||
return assertTldExists(extractRequiredParameter(req, RequestParameters.PARAM_TLD));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed 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 com.google.domain.registry.module.backend;
|
||||
|
||||
import com.google.domain.registry.backup.BackupModule;
|
||||
import com.google.domain.registry.backup.CommitLogCheckpointAction;
|
||||
import com.google.domain.registry.backup.DeleteOldCommitLogsAction;
|
||||
import com.google.domain.registry.backup.ExportCommitLogDiffAction;
|
||||
import com.google.domain.registry.backup.RestoreCommitLogsAction;
|
||||
import com.google.domain.registry.cron.CommitLogFanoutAction;
|
||||
import com.google.domain.registry.cron.CronModule;
|
||||
import com.google.domain.registry.cron.TldFanoutAction;
|
||||
import com.google.domain.registry.dns.DnsModule;
|
||||
import com.google.domain.registry.dns.PublishDnsUpdatesAction;
|
||||
import com.google.domain.registry.dns.ReadDnsQueueAction;
|
||||
import com.google.domain.registry.dns.RefreshDns;
|
||||
import com.google.domain.registry.dns.WriteDnsTask;
|
||||
import com.google.domain.registry.export.BigqueryPollJobAction;
|
||||
import com.google.domain.registry.export.ExportRequestModule;
|
||||
import com.google.domain.registry.export.ExportReservedTermsTask;
|
||||
import com.google.domain.registry.export.SyncGroupMembersTask;
|
||||
import com.google.domain.registry.export.sheet.SheetModule;
|
||||
import com.google.domain.registry.export.sheet.SyncRegistrarsSheetTask;
|
||||
import com.google.domain.registry.flows.async.AsyncFlowsModule;
|
||||
import com.google.domain.registry.flows.async.DeleteContactResourceAction;
|
||||
import com.google.domain.registry.flows.async.DeleteHostResourceAction;
|
||||
import com.google.domain.registry.flows.async.DnsRefreshForHostRenameAction;
|
||||
import com.google.domain.registry.mapreduce.MapreduceModule;
|
||||
import com.google.domain.registry.rde.BrdaCopyTask;
|
||||
import com.google.domain.registry.rde.RdeModule;
|
||||
import com.google.domain.registry.rde.RdeReportTask;
|
||||
import com.google.domain.registry.rde.RdeReporter;
|
||||
import com.google.domain.registry.rde.RdeStagingAction;
|
||||
import com.google.domain.registry.rde.RdeUploadTask;
|
||||
import com.google.domain.registry.request.RequestModule;
|
||||
import com.google.domain.registry.request.RequestScope;
|
||||
import com.google.domain.registry.tmch.NordnUploadAction;
|
||||
import com.google.domain.registry.tmch.NordnVerifyAction;
|
||||
import com.google.domain.registry.tmch.TmchCrlTask;
|
||||
import com.google.domain.registry.tmch.TmchDnlTask;
|
||||
import com.google.domain.registry.tmch.TmchModule;
|
||||
import com.google.domain.registry.tmch.TmchSmdrlTask;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
/** Dagger component with per-request lifetime for "backend" App Engine module. */
|
||||
@RequestScope
|
||||
@Subcomponent(
|
||||
modules = {
|
||||
AsyncFlowsModule.class,
|
||||
BackendModule.class,
|
||||
BackupModule.class,
|
||||
CronModule.class,
|
||||
DnsModule.class,
|
||||
ExportRequestModule.class,
|
||||
MapreduceModule.class,
|
||||
RdeModule.class,
|
||||
RequestModule.class,
|
||||
SheetModule.class,
|
||||
TmchModule.class,
|
||||
})
|
||||
interface BackendRequestComponent {
|
||||
BigqueryPollJobAction bigqueryPollJobAction();
|
||||
BrdaCopyTask brdaCopyTask();
|
||||
CommitLogCheckpointAction commitLogCheckpointAction();
|
||||
CommitLogFanoutAction commitLogFanoutAction();
|
||||
DeleteContactResourceAction deleteContactResourceAction();
|
||||
DeleteHostResourceAction deleteHostResourceAction();
|
||||
DeleteOldCommitLogsAction deleteOldCommitLogsAction();
|
||||
DnsRefreshForHostRenameAction dnsRefreshForHostRenameAction();
|
||||
ExportCommitLogDiffAction exportCommitLogDiffAction();
|
||||
ExportReservedTermsTask exportReservedTermsTask();
|
||||
NordnUploadAction nordnUploadAction();
|
||||
NordnVerifyAction nordnVerifyAction();
|
||||
PublishDnsUpdatesAction publishDnsUpdatesAction();
|
||||
ReadDnsQueueAction readDnsQueueAction();
|
||||
RdeReportTask rdeReportTask();
|
||||
RdeStagingAction rdeStagingAction();
|
||||
RdeUploadTask rdeUploadTask();
|
||||
RdeReporter rdeReporter();
|
||||
RefreshDns refreshDns();
|
||||
RestoreCommitLogsAction restoreCommitLogsAction();
|
||||
SyncGroupMembersTask syncGroupMembersTask();
|
||||
SyncRegistrarsSheetTask syncRegistrarsSheetTask();
|
||||
TldFanoutAction tldFanoutAction();
|
||||
TmchCrlTask tmchCrlTask();
|
||||
TmchDnlTask tmchDnlTask();
|
||||
TmchSmdrlTask tmchSmdrlTask();
|
||||
WriteDnsTask writeDnsTask();
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed 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 com.google.domain.registry.module.backend;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.domain.registry.request.RequestHandler;
|
||||
import com.google.domain.registry.request.RequestModule;
|
||||
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.Security;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/** Servlet that should handle all requests to our "backend" App Engine module. */
|
||||
public final class BackendServlet extends HttpServlet {
|
||||
|
||||
private static final BackendComponent component = DaggerBackendComponent.create();
|
||||
|
||||
private static final RequestHandler<BackendRequestComponent> requestHandler =
|
||||
RequestHandler.create(BackendRequestComponent.class, FluentIterable
|
||||
.from(asList(BackendRequestComponent.class.getMethods()))
|
||||
.transform(new Function<Method, Method>() {
|
||||
@Override
|
||||
public Method apply(Method method) {
|
||||
method.setAccessible(true); // Make App Engine's security manager happy.
|
||||
return method;
|
||||
}}));
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
Security.addProvider(new BouncyCastleProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void service(HttpServletRequest req, HttpServletResponse rsp) throws IOException {
|
||||
requestHandler.handleRequest(req, rsp, component.startRequest(new RequestModule(req, rsp)));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed 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.
|
||||
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package com.google.domain.registry.module.backend;
|
44
java/com/google/domain/registry/module/frontend/BUILD
Normal file
44
java/com/google/domain/registry/module/frontend/BUILD
Normal file
|
@ -0,0 +1,44 @@
|
|||
package(
|
||||
default_visibility = ["//java/com/google/domain/registry:registry_project"],
|
||||
)
|
||||
|
||||
|
||||
java_library(
|
||||
name = "frontend",
|
||||
srcs = glob(["*.java"]),
|
||||
deps = [
|
||||
"//java/com/google/common/base",
|
||||
"//java/com/google/common/collect",
|
||||
"//java/com/google/domain/registry/braintree",
|
||||
"//java/com/google/domain/registry/config",
|
||||
"//java/com/google/domain/registry/keyring/api",
|
||||
"//java/com/google/domain/registry/rdap",
|
||||
"//java/com/google/domain/registry/request",
|
||||
"//java/com/google/domain/registry/request:modules",
|
||||
"//java/com/google/domain/registry/ui",
|
||||
"//java/com/google/domain/registry/ui/server/registrar",
|
||||
"//java/com/google/domain/registry/util",
|
||||
"//java/com/google/domain/registry/whois",
|
||||
"//third_party/java/bouncycastle",
|
||||
"//third_party/java/dagger",
|
||||
"//third_party/java/jsr305_annotations",
|
||||
"//third_party/java/jsr330_inject",
|
||||
"//third_party/java/servlet/servlet_api",
|
||||
],
|
||||
)
|
||||
|
||||
# This rule is used so bazel can generate "frontend_jar_deploy.jar" (which
|
||||
# contains transitive dependencies) for deployment to App Engine. It MUST
|
||||
# explicitly depend upon upon anything loaded at runtime, e.g. old servlets
|
||||
# referenced by the module's web.xml file, that isn't statically linked above.
|
||||
java_binary(
|
||||
name = "frontend_jar",
|
||||
create_executable = 0,
|
||||
runtime_deps = [
|
||||
":frontend",
|
||||
"//java/com/google/domain/registry/monitoring/whitebox", # MetricsTaskServlet
|
||||
"//java/com/google/domain/registry/ui/server/admin", # AdminUiServlet, etc.
|
||||
"//java/com/google/domain/registry/ui/server/api", # CheckApiServlet
|
||||
"//java/com/google/domain/registry/ui/server/registrar", # ConsoleUiServlet, etc.
|
||||
],
|
||||
)
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed 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 com.google.domain.registry.module.frontend;
|
||||
|
||||
import com.google.domain.registry.braintree.BraintreeModule;
|
||||
import com.google.domain.registry.config.ConfigModule;
|
||||
import com.google.domain.registry.keyring.api.KeyModule;
|
||||
import com.google.domain.registry.keyring.api.VoidKeyringModule;
|
||||
import com.google.domain.registry.request.Modules.UserServiceModule;
|
||||
import com.google.domain.registry.request.RequestModule;
|
||||
import com.google.domain.registry.ui.ConsoleConfigModule;
|
||||
import com.google.domain.registry.util.SystemClock.SystemClockModule;
|
||||
|
||||
import dagger.Component;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/** Dagger component with instance lifetime for "default" App Engine module. */
|
||||
@Singleton
|
||||
@Component(
|
||||
modules = {
|
||||
BraintreeModule.class,
|
||||
ConfigModule.class,
|
||||
ConsoleConfigModule.class,
|
||||
KeyModule.class,
|
||||
SystemClockModule.class,
|
||||
UserServiceModule.class,
|
||||
VoidKeyringModule.class,
|
||||
})
|
||||
interface FrontendComponent {
|
||||
FrontendRequestComponent startRequest(RequestModule requestModule);
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed 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 com.google.domain.registry.module.frontend;
|
||||
|
||||
import com.google.domain.registry.rdap.RdapAutnumAction;
|
||||
import com.google.domain.registry.rdap.RdapDomainAction;
|
||||
import com.google.domain.registry.rdap.RdapDomainSearchAction;
|
||||
import com.google.domain.registry.rdap.RdapEntityAction;
|
||||
import com.google.domain.registry.rdap.RdapEntitySearchAction;
|
||||
import com.google.domain.registry.rdap.RdapHelpAction;
|
||||
import com.google.domain.registry.rdap.RdapIpAction;
|
||||
import com.google.domain.registry.rdap.RdapModule;
|
||||
import com.google.domain.registry.rdap.RdapNameserverAction;
|
||||
import com.google.domain.registry.rdap.RdapNameserverSearchAction;
|
||||
import com.google.domain.registry.request.RequestModule;
|
||||
import com.google.domain.registry.request.RequestScope;
|
||||
import com.google.domain.registry.ui.server.registrar.RegistrarPaymentAction;
|
||||
import com.google.domain.registry.ui.server.registrar.RegistrarPaymentSetupAction;
|
||||
import com.google.domain.registry.whois.WhoisHttpServer;
|
||||
import com.google.domain.registry.whois.WhoisModule;
|
||||
import com.google.domain.registry.whois.WhoisServer;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
/** Dagger component with per-request lifetime for "default" App Engine module. */
|
||||
@RequestScope
|
||||
@Subcomponent(
|
||||
modules = {
|
||||
RdapModule.class,
|
||||
RequestModule.class,
|
||||
WhoisModule.class,
|
||||
})
|
||||
interface FrontendRequestComponent {
|
||||
RdapAutnumAction rdapAutnumAction();
|
||||
RegistrarPaymentAction registrarPaymentAction();
|
||||
RegistrarPaymentSetupAction registrarPaymentSetupAction();
|
||||
RdapDomainAction rdapDomainAction();
|
||||
RdapDomainSearchAction rdapDomainSearchAction();
|
||||
RdapEntityAction rdapEntityAction();
|
||||
RdapEntitySearchAction rdapEntitySearchAction();
|
||||
RdapHelpAction rdapHelpAction();
|
||||
RdapIpAction rdapDefaultAction();
|
||||
RdapNameserverAction rdapNameserverAction();
|
||||
RdapNameserverSearchAction rdapNameserverSearchAction();
|
||||
WhoisHttpServer whoisHttpServer();
|
||||
WhoisServer whoisServer();
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed 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 com.google.domain.registry.module.frontend;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.domain.registry.request.RequestHandler;
|
||||
import com.google.domain.registry.request.RequestModule;
|
||||
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.Security;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/** Servlet that should handle all requests to our "default" App Engine module. */
|
||||
public final class FrontendServlet extends HttpServlet {
|
||||
|
||||
private static final FrontendComponent component = DaggerFrontendComponent.create();
|
||||
|
||||
private static final RequestHandler<FrontendRequestComponent> requestHandler =
|
||||
RequestHandler.create(FrontendRequestComponent.class, FluentIterable
|
||||
.from(asList(FrontendRequestComponent.class.getMethods()))
|
||||
.transform(new Function<Method, Method>() {
|
||||
@Override
|
||||
public Method apply(Method method) {
|
||||
method.setAccessible(true); // Make App Engine's security manager happy.
|
||||
return method;
|
||||
}}));
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
Security.addProvider(new BouncyCastleProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void service(HttpServletRequest req, HttpServletResponse rsp) throws IOException {
|
||||
requestHandler.handleRequest(req, rsp, component.startRequest(new RequestModule(req, rsp)));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed 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.
|
||||
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
package com.google.domain.registry.module.frontend;
|
43
java/com/google/domain/registry/module/tools/BUILD
Normal file
43
java/com/google/domain/registry/module/tools/BUILD
Normal file
|
@ -0,0 +1,43 @@
|
|||
package(
|
||||
default_visibility = ["//java/com/google/domain/registry:registry_project"],
|
||||
)
|
||||
|
||||
|
||||
java_library(
|
||||
name = "tools",
|
||||
srcs = glob(["*.java"]),
|
||||
deps = [
|
||||
"//java/com/google/common/base",
|
||||
"//java/com/google/common/collect",
|
||||
"//java/com/google/domain/registry/config",
|
||||
"//java/com/google/domain/registry/export",
|
||||
"//java/com/google/domain/registry/gcs",
|
||||
"//java/com/google/domain/registry/groups",
|
||||
"//java/com/google/domain/registry/keyring/api",
|
||||
"//java/com/google/domain/registry/loadtest",
|
||||
"//java/com/google/domain/registry/mapreduce",
|
||||
"//java/com/google/domain/registry/request",
|
||||
"//java/com/google/domain/registry/request:modules",
|
||||
"//java/com/google/domain/registry/tools/mapreduce",
|
||||
"//java/com/google/domain/registry/tools/server",
|
||||
"//java/com/google/domain/registry/util",
|
||||
"//third_party/java/bouncycastle",
|
||||
"//third_party/java/dagger",
|
||||
"//third_party/java/jsr305_annotations",
|
||||
"//third_party/java/jsr330_inject",
|
||||
"//third_party/java/servlet/servlet_api",
|
||||
],
|
||||
)
|
||||
|
||||
# This rule is used so bazel can generate "tools_jar_deploy.jar" (which
|
||||
# contains transitive dependencies) for deployment to App Engine. It MUST
|
||||
# explicitly depend upon upon anything loaded at runtime, e.g. old servlets
|
||||
# referenced by the module's web.xml file, that isn't statically linked above.
|
||||
java_binary(
|
||||
name = "tools_jar",
|
||||
create_executable = 0,
|
||||
runtime_deps = [
|
||||
":tools",
|
||||
"//java/com/google/domain/registry/ui/server/admin", # VerifyOteServlet
|
||||
],
|
||||
)
|
|
@ -0,0 +1,62 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed 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 com.google.domain.registry.module.tools;
|
||||
|
||||
import com.google.domain.registry.config.ConfigModule;
|
||||
import com.google.domain.registry.export.DriveModule;
|
||||
import com.google.domain.registry.gcs.GcsServiceModule;
|
||||
import com.google.domain.registry.groups.DirectoryModule;
|
||||
import com.google.domain.registry.groups.GroupsModule;
|
||||
import com.google.domain.registry.groups.GroupssettingsModule;
|
||||
import com.google.domain.registry.keyring.api.KeyModule;
|
||||
import com.google.domain.registry.keyring.api.VoidKeyringModule;
|
||||
import com.google.domain.registry.request.Modules.AppIdentityCredentialModule;
|
||||
import com.google.domain.registry.request.Modules.DatastoreServiceModule;
|
||||
import com.google.domain.registry.request.Modules.GoogleCredentialModule;
|
||||
import com.google.domain.registry.request.Modules.Jackson2Module;
|
||||
import com.google.domain.registry.request.Modules.UrlFetchTransportModule;
|
||||
import com.google.domain.registry.request.Modules.UseAppIdentityCredentialForGoogleApisModule;
|
||||
import com.google.domain.registry.request.RequestModule;
|
||||
import com.google.domain.registry.util.SystemClock.SystemClockModule;
|
||||
import com.google.domain.registry.util.SystemSleeper.SystemSleeperModule;
|
||||
|
||||
import dagger.Component;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/** Dagger component with instance lifetime for "tools" App Engine module. */
|
||||
@Singleton
|
||||
@Component(
|
||||
modules = {
|
||||
AppIdentityCredentialModule.class,
|
||||
ConfigModule.class,
|
||||
DatastoreServiceModule.class,
|
||||
DirectoryModule.class,
|
||||
DriveModule.class,
|
||||
GcsServiceModule.class,
|
||||
GoogleCredentialModule.class,
|
||||
GroupsModule.class,
|
||||
GroupssettingsModule.class,
|
||||
Jackson2Module.class,
|
||||
KeyModule.class,
|
||||
UrlFetchTransportModule.class,
|
||||
UseAppIdentityCredentialForGoogleApisModule.class,
|
||||
SystemClockModule.class,
|
||||
SystemSleeperModule.class,
|
||||
VoidKeyringModule.class,
|
||||
})
|
||||
interface ToolsComponent {
|
||||
ToolsRequestComponent startRequest(RequestModule requestModule);
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed 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 com.google.domain.registry.module.tools;
|
||||
|
||||
import com.google.domain.registry.export.PublishDetailReportAction;
|
||||
import com.google.domain.registry.loadtest.LoadTestAction;
|
||||
import com.google.domain.registry.loadtest.LoadTestModule;
|
||||
import com.google.domain.registry.mapreduce.MapreduceModule;
|
||||
import com.google.domain.registry.request.RequestModule;
|
||||
import com.google.domain.registry.request.RequestScope;
|
||||
import com.google.domain.registry.tools.mapreduce.DeleteProberDataAction;
|
||||
import com.google.domain.registry.tools.mapreduce.ResaveAllEppResourcesAction;
|
||||
import com.google.domain.registry.tools.server.CreateGroupsTask;
|
||||
import com.google.domain.registry.tools.server.CreatePremiumListAction;
|
||||
import com.google.domain.registry.tools.server.DeleteEntityAction;
|
||||
import com.google.domain.registry.tools.server.GenerateZoneFilesAction;
|
||||
import com.google.domain.registry.tools.server.KillAllCommitLogsAction;
|
||||
import com.google.domain.registry.tools.server.KillAllEppResourcesAction;
|
||||
import com.google.domain.registry.tools.server.ListDomainsAction;
|
||||
import com.google.domain.registry.tools.server.ListHostsAction;
|
||||
import com.google.domain.registry.tools.server.ListPremiumListsAction;
|
||||
import com.google.domain.registry.tools.server.ListRegistrarsAction;
|
||||
import com.google.domain.registry.tools.server.ListReservedListsAction;
|
||||
import com.google.domain.registry.tools.server.ListTldsAction;
|
||||
import com.google.domain.registry.tools.server.ToolsServerModule;
|
||||
import com.google.domain.registry.tools.server.UpdatePremiumListAction;
|
||||
import com.google.domain.registry.tools.server.javascrap.AnnihilateNonDefaultNamespacesAction;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
/** Dagger component with per-request lifetime for "tools" App Engine module. */
|
||||
@RequestScope
|
||||
@Subcomponent(
|
||||
modules = {
|
||||
LoadTestModule.class,
|
||||
MapreduceModule.class,
|
||||
RequestModule.class,
|
||||
ToolsServerModule.class,
|
||||
})
|
||||
interface ToolsRequestComponent {
|
||||
AnnihilateNonDefaultNamespacesAction annihilateNonDefaultNamespacesAction();
|
||||
CreateGroupsTask createGroupsTask();
|
||||
CreatePremiumListAction createPremiumListAction();
|
||||
DeleteEntityAction deleteEntityAction();
|
||||
DeleteProberDataAction deleteProberDataAction();
|
||||
GenerateZoneFilesAction generateZoneFilesAction();
|
||||
KillAllCommitLogsAction killAllCommitLogsAction();
|
||||
KillAllEppResourcesAction killAllEppResourcesAction();
|
||||
ListDomainsAction listDomainsAction();
|
||||
ListHostsAction listHostsAction();
|
||||
ListPremiumListsAction listPremiumListsAction();
|
||||
ListRegistrarsAction listRegistrarsAction();
|
||||
ListReservedListsAction listReservedListsAction();
|
||||
ListTldsAction listTldsAction();
|
||||
LoadTestAction loadTestAction();
|
||||
PublishDetailReportAction publishDetailReportAction();
|
||||
ResaveAllEppResourcesAction resaveAllEppResourcesAction();
|
||||
UpdatePremiumListAction updatePremiumListAction();
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Licensed 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 com.google.domain.registry.module.tools;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.FluentIterable;
|
||||
import com.google.domain.registry.request.RequestHandler;
|
||||
import com.google.domain.registry.request.RequestModule;
|
||||
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.Security;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/** Servlet that should handle all requests to our "tools" App Engine module. */
|
||||
public final class ToolsServlet extends HttpServlet {
|
||||
|
||||
private static final ToolsComponent component = DaggerToolsComponent.create();
|
||||
|
||||
private static final RequestHandler<ToolsRequestComponent> requestHandler =
|
||||
RequestHandler.create(ToolsRequestComponent.class, FluentIterable
|
||||
.from(asList(ToolsRequestComponent.class.getMethods()))
|
||||
.transform(new Function<Method, Method>() {
|
||||
@Override
|
||||
public Method apply(Method method) {
|
||||
method.setAccessible(true); // Make App Engine's security manager happy.
|
||||
return method;
|
||||
}}));
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
Security.addProvider(new BouncyCastleProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void service(HttpServletRequest req, HttpServletResponse rsp) throws IOException {
|
||||
requestHandler.handleRequest(req, rsp, component.startRequest(new RequestModule(req, rsp)));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue