Import code from internal repository to git

This commit is contained in:
Justine Tunney 2016-03-01 17:18:14 -05:00
commit 0ef0c933d2
2490 changed files with 281594 additions and 0 deletions

View 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.
],
)

View file

@ -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);
}

View file

@ -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();
}

View file

@ -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)));
}
}

View file

@ -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;