hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject [hadoop] branch trunk updated: HDDS-1188. Implement a skeleton patch for Recon server with initial set of interfaces. Contributed by Siddharth Wagle.
Date Tue, 05 Mar 2019 23:55:53 GMT
This is an automated email from the ASF dual-hosted git repository.

arp pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 1ad5bfc  HDDS-1188. Implement a skeleton patch for Recon server with initial set
of interfaces. Contributed by Siddharth Wagle.
1ad5bfc is described below

commit 1ad5bfc53fb4871e6ac297812de1d98025ebd13f
Author: Arpit Agarwal <arp@apache.org>
AuthorDate: Tue Mar 5 15:54:29 2019 -0800

    HDDS-1188. Implement a skeleton patch for Recon server with initial set of interfaces.
Contributed by Siddharth Wagle.
---
 .../org/apache/hadoop/hdds/cli/GenericCli.java     |  3 +-
 hadoop-ozone/ozone-recon/pom.xml                   | 50 ++++++++++++
 .../ozone/recon/OzoneConfigurationProvider.java    | 43 +++++++++++
 .../hadoop/ozone/recon/ReconApplication.java       | 29 +++++++
 .../hadoop/ozone/recon/ReconControllerModule.java  | 36 +++++++++
 .../apache/hadoop/ozone/recon/ReconHttpServer.java | 88 ++++++++++++++++++++++
 .../org/apache/hadoop/ozone/recon/ReconServer.java | 76 +++++++++++++++++++
 .../ozone/recon/ReconServerConfiguration.java      | 56 ++++++++++++++
 .../ozone/recon/api/ContainerKeyService.java       | 43 +++++++++++
 .../hadoop/ozone/recon/api/package-info.java       | 23 ++++++
 .../ozone/recon/api/types/ContainerMetadata.java   | 73 ++++++++++++++++++
 .../ozone/recon/api/types/IsoDateAdapter.java      | 48 ++++++++++++
 .../hadoop/ozone/recon/api/types/KeyMetadata.java  | 88 ++++++++++++++++++++++
 .../hadoop/ozone/recon/api/types/package-info.java | 22 ++++++
 .../apache/hadoop/ozone/recon/package-info.java    | 22 ++++++
 .../hadoop/ozone/recon/recovery/package-info.java  | 22 ++++++
 .../recon/spi/HddsDatanodeServiceProvider.java     | 25 ++++++
 .../recon/spi/OzoneManagerServiceProvider.java     | 25 ++++++
 .../recon/spi/StorageContainerServiceProvider.java | 25 ++++++
 .../hadoop/ozone/recon/spi/package-info.java       | 24 ++++++
 .../main/resources/webapps.recon.WEB-INF/web.xml   | 33 ++++++++
 .../apache/hadoop/ozone/recon/package-info.java    | 21 ++++++
 hadoop-ozone/pom.xml                               |  1 +
 23 files changed, 874 insertions(+), 2 deletions(-)

diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/GenericCli.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/GenericCli.java
index 79ef711..f905f60 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/GenericCli.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/cli/GenericCli.java
@@ -85,8 +85,7 @@ public class GenericCli implements Callable<Void>, GenericParentCommand
{
     OzoneConfiguration ozoneConf = new OzoneConfiguration();
     if (configurationOverrides != null) {
       for (Entry<String, String> entry : configurationOverrides.entrySet()) {
-        ozoneConf
-            .set(entry.getKey(), entry.getValue());
+        ozoneConf.set(entry.getKey(), entry.getValue());
       }
     }
     return ozoneConf;
diff --git a/hadoop-ozone/ozone-recon/pom.xml b/hadoop-ozone/ozone-recon/pom.xml
new file mode 100644
index 0000000..fed7ad4
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/pom.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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. See accompanying LICENSE file.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>hadoop-ozone</artifactId>
+    <groupId>org.apache.hadoop</groupId>
+    <version>0.4.0-SNAPSHOT</version>
+  </parent>
+  <name>Apache Hadoop Ozone Recon</name>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>ozone-recon</artifactId>
+  <dependencies>
+    <dependency>
+      <groupId>com.google.inject</groupId>
+      <artifactId>guice</artifactId>
+      <version>${guice.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.google.inject.extensions</groupId>
+      <artifactId>guice-servlet</artifactId>
+      <version>4.1.0</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.glassfish.jersey.containers</groupId>
+      <artifactId>jersey-container-servlet-core</artifactId>
+      <version>2.27</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.google.inject.extensions</groupId>
+      <artifactId>guice-assistedinject</artifactId>
+      <version>4.1.0</version>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/OzoneConfigurationProvider.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/OzoneConfigurationProvider.java
new file mode 100644
index 0000000..3c8dae0
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/OzoneConfigurationProvider.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.hadoop.ozone.recon;
+
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+
+import com.google.inject.Provider;
+
+/**
+ * Ozone Configuration Provider.
+ * <p>
+ * As the OzoneConfiguration is created by the CLI application here we inject
+ * it via a singleton instance to the Jax-RS/CDI instances.
+ */
+public class OzoneConfigurationProvider implements
+    Provider<OzoneConfiguration> {
+
+  private static OzoneConfiguration configuration;
+
+  static void setConfiguration(OzoneConfiguration conf) {
+    OzoneConfigurationProvider.configuration = conf;
+  }
+
+  @Override
+  public OzoneConfiguration get() {
+    return configuration;
+  }
+}
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/ReconApplication.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/ReconApplication.java
new file mode 100644
index 0000000..24ba5ee
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/ReconApplication.java
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.hadoop.ozone.recon;
+
+import org.glassfish.jersey.server.ResourceConfig;
+
+/**
+ * JaxRS resource definition.
+ */
+public class ReconApplication extends ResourceConfig {
+  public ReconApplication() {
+    packages("org.apache.hadoop.ozone.recon.api");
+  }
+}
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/ReconControllerModule.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/ReconControllerModule.java
new file mode 100644
index 0000000..1a90e70
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/ReconControllerModule.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.hadoop.ozone.recon;
+
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Singleton;
+
+/**
+ * Guice controller that defines concrete bindings.
+ */
+public class ReconControllerModule extends AbstractModule {
+  @Override
+  protected void configure() {
+    bind(OzoneConfiguration.class).toProvider(OzoneConfigurationProvider.class);
+    bind(ReconHttpServer.class).in(Singleton.class);
+  }
+
+
+}
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/ReconHttpServer.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/ReconHttpServer.java
new file mode 100644
index 0000000..72818c5
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/ReconHttpServer.java
@@ -0,0 +1,88 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.hadoop.ozone.recon;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hdds.server.BaseHttpServer;
+
+import com.google.inject.Inject;
+
+/**
+ * Recon http server with recon supplied config defaults.
+ */
+
+public class ReconHttpServer extends BaseHttpServer {
+
+  @Inject
+  ReconHttpServer(Configuration conf) throws IOException {
+    super(conf, "recon");
+  }
+
+  @Override
+  protected String getHttpAddressKey() {
+    return ReconServerConfiguration.OZONE_RECON_HTTP_ADDRESS_KEY;
+  }
+
+  @Override
+  protected String getHttpsAddressKey() {
+    return ReconServerConfiguration.OZONE_RECON_HTTPS_ADDRESS_KEY;
+  }
+
+  @Override
+  protected String getHttpBindHostKey() {
+    return ReconServerConfiguration.OZONE_RECON_HTTP_BIND_HOST_KEY;
+  }
+
+  @Override
+  protected String getHttpsBindHostKey() {
+    return ReconServerConfiguration.OZONE_RECON_HTTPS_BIND_HOST_KEY;
+  }
+
+  @Override
+  protected String getBindHostDefault() {
+    return ReconServerConfiguration.OZONE_RECON_HTTP_BIND_HOST_DEFAULT;
+  }
+
+  @Override
+  protected int getHttpBindPortDefault() {
+    return ReconServerConfiguration.OZONE_RECON_HTTP_BIND_PORT_DEFAULT;
+  }
+
+  @Override
+  protected int getHttpsBindPortDefault() {
+    return ReconServerConfiguration.OZONE_RECON_HTTPS_BIND_PORT_DEFAULT;
+  }
+
+  @Override
+  protected String getKeytabFile() {
+    return ReconServerConfiguration.OZONE_RECON_KEYTAB_FILE;
+  }
+
+  @Override
+  protected String getSpnegoPrincipal() {
+    return ReconServerConfiguration
+        .OZONE_RECON_WEB_AUTHENTICATION_KERBEROS_PRINCIPAL;
+  }
+
+  @Override
+  protected String getEnabledKey() {
+    return ReconServerConfiguration.OZONE_RECON_HTTP_ENABLED_KEY;
+  }
+}
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/ReconServer.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/ReconServer.java
new file mode 100644
index 0000000..0858d61
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/ReconServer.java
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.hadoop.ozone.recon;
+
+import org.apache.hadoop.hdds.cli.GenericCli;
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.inject.Guice;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+
+import picocli.CommandLine.Command;
+
+/**
+ * Recon server main class that stops and starts recon services.
+ */
+@Command(name = "ozone recon",
+    hidden = true, description = "File system health and other stats server.",
+    versionProvider = HddsVersionProvider.class,
+    mixinStandardHelpOptions = true)
+public class ReconServer extends GenericCli {
+
+  private static final Logger LOG = LoggerFactory.getLogger(ReconServer.class);
+
+  @Inject
+  private ReconHttpServer httpServer;
+
+  public static void main(String[] args) {
+    new ReconServer().run(args);
+  }
+
+  @Override
+  public Void call() throws Exception {
+    OzoneConfiguration ozoneConfiguration = createOzoneConfiguration();
+    OzoneConfigurationProvider.setConfiguration(ozoneConfiguration);
+
+    Injector injector = Guice.createInjector(new ReconControllerModule());
+
+    httpServer = injector.getInstance(ReconHttpServer.class);
+    LOG.info("Starting Recon server");
+    httpServer.start();
+
+    Runtime.getRuntime().addShutdownHook(new Thread(() -> {
+      try {
+        stop();
+      } catch (Exception e) {
+        LOG.error("Error during stop Recon server", e);
+      }
+    }));
+    return null;
+  }
+
+  void stop() throws Exception {
+    LOG.info("Stopping Recon server");
+    httpServer.stop();
+  }
+}
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/ReconServerConfiguration.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/ReconServerConfiguration.java
new file mode 100644
index 0000000..78281bc
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/ReconServerConfiguration.java
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.hadoop.ozone.recon;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+
+/**
+ * This class contains constants for Recon configuration keys.
+ */
+@InterfaceAudience.Public
+@InterfaceStability.Unstable
+public final class ReconServerConfiguration {
+
+  public static final String OZONE_RECON_HTTP_ENABLED_KEY =
+      "ozone.recon.http.enabled";
+  public static final String OZONE_RECON_HTTP_BIND_HOST_KEY =
+      "ozone.recon.http-bind-host";
+  public static final String OZONE_RECON_HTTPS_BIND_HOST_KEY =
+      "ozone.recon.https-bind-host";
+  public static final String OZONE_RECON_HTTP_ADDRESS_KEY =
+      "ozone.recon.http-address";
+  public static final String OZONE_RECON_HTTPS_ADDRESS_KEY =
+      "ozone.recon.https-address";
+  public static final String OZONE_RECON_KEYTAB_FILE =
+      "ozone.recon.keytab.file";
+  public static final String OZONE_RECON_HTTP_BIND_HOST_DEFAULT =
+      "0.0.0.0";
+  public static final int OZONE_RECON_HTTP_BIND_PORT_DEFAULT = 9888;
+  public static final int OZONE_RECON_HTTPS_BIND_PORT_DEFAULT = 9889;
+  public static final String OZONE_RECON_WEB_AUTHENTICATION_KERBEROS_PRINCIPAL =
+      "ozone.recon.authentication.kerberos.principal";
+  public static final String OZONE_RECON_DOMAIN_NAME =
+      "ozone.recon.domain.name";
+
+  /**
+   * Private constructor for utility class.
+   */
+  private ReconServerConfiguration() {
+  }
+}
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/ContainerKeyService.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/ContainerKeyService.java
new file mode 100644
index 0000000..60b533e
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/ContainerKeyService.java
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.hadoop.ozone.recon.api;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Response;
+
+/**
+ * Endpoint for querying keys that belong to a container.
+ */
+@Path("/containers")
+public class ContainerKeyService {
+
+  /**
+   * Return @{@link org.apache.hadoop.ozone.recon.api.types.KeyMetadata} for
+   * all keys that belong to the container identified by the id param.
+   *
+   * @param containerId Container Id
+   * @return {@link Response}
+   */
+  @GET
+  @Path("{id}")
+  public Response getKeysForContainer(@PathParam("id") String containerId) {
+    return Response.ok().build();
+  }
+}
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/package-info.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/package-info.java
new file mode 100644
index 0000000..894e9d5
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/package-info.java
@@ -0,0 +1,23 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+
+/**
+ * The classes in this package define api endpoints for Recon.
+ */
+
+package org.apache.hadoop.ozone.recon.api;
\ No newline at end of file
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/ContainerMetadata.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/ContainerMetadata.java
new file mode 100644
index 0000000..29af448
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/ContainerMetadata.java
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.hadoop.ozone.recon.api.types;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * Metadata object that represents a Container.
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+public class ContainerMetadata {
+
+  @XmlElement(name = "ContainerId")
+  private long containerId;
+
+  @XmlElement(name = "UserBytes")
+  private long usedBytes;
+
+  @XmlElement(name = "NumberOfKeys")
+  private long numberOfKeys;
+
+  @XmlElement(name = "Owner")
+  private String owner;
+
+  public long getContainerId() {
+    return containerId;
+  }
+
+  public void setContainerId(long containerId) {
+    this.containerId = containerId;
+  }
+
+  public long getUsedBytes() {
+    return usedBytes;
+  }
+
+  public void setUsedBytes(long usedBytes) {
+    this.usedBytes = usedBytes;
+  }
+
+  public long getNumberOfKeys() {
+    return numberOfKeys;
+  }
+
+  public void setNumberOfKeys(long numberOfKeys) {
+    this.numberOfKeys = numberOfKeys;
+  }
+
+  public String getOwner() {
+    return owner;
+  }
+
+  public void setOwner(String owner) {
+    this.owner = owner;
+  }
+}
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/IsoDateAdapter.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/IsoDateAdapter.java
new file mode 100644
index 0000000..7bcdbe1
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/IsoDateAdapter.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.hadoop.ozone.recon.api.types;
+
+import java.time.Instant;
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+/**
+ * A converter to convert Instant to standard date string.
+ */
+public class IsoDateAdapter extends XmlAdapter<String, Instant> {
+
+  private DateTimeFormatter iso8861Formatter;
+
+  public IsoDateAdapter() {
+    iso8861Formatter =
+        DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSX")
+            .withZone(ZoneOffset.UTC);
+  }
+
+  @Override
+  public Instant unmarshal(String v) throws Exception {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  public String marshal(Instant v) throws Exception {
+    return iso8861Formatter.format(v);
+  }
+}
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/KeyMetadata.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/KeyMetadata.java
new file mode 100644
index 0000000..441ee65
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/KeyMetadata.java
@@ -0,0 +1,88 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 org.apache.hadoop.ozone.recon.api.types;
+
+import java.time.Instant;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+/**
+ * Metadata object represents one key in the object store.
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+public class KeyMetadata {
+
+  @XmlElement(name = "Key")
+  private String key; // or the Object Name
+
+  @XmlJavaTypeAdapter(IsoDateAdapter.class)
+  @XmlElement(name = "LastModified")
+  private Instant lastModified;
+
+  @XmlElement(name = "ETag")
+  private String eTag;
+
+  @XmlElement(name = "Size")
+  private long size;
+
+  @XmlElement(name = "StorageClass")
+  private String storageClass;
+
+  public String getKey() {
+    return key;
+  }
+
+  public void setKey(String key) {
+    this.key = key;
+  }
+
+  public Instant getLastModified() {
+    return lastModified;
+  }
+
+  public void setLastModified(Instant lastModified) {
+    this.lastModified = lastModified;
+  }
+
+  public String getETag() {
+    return eTag;
+  }
+
+  public void setETag(String tag) {
+    this.eTag = tag;
+  }
+
+  public long getSize() {
+    return size;
+  }
+
+  public void setSize(long size) {
+    this.size = size;
+  }
+
+  public String getStorageClass() {
+    return storageClass;
+  }
+
+  public void setStorageClass(String storageClass) {
+    this.storageClass = storageClass;
+  }
+}
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/package-info.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/package-info.java
new file mode 100644
index 0000000..cc2a7ab
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/api/types/package-info.java
@@ -0,0 +1,22 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+
+/**
+ * Common type definitions for Recon API.
+ */
+package org.apache.hadoop.ozone.recon.api.types;
\ No newline at end of file
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/package-info.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/package-info.java
new file mode 100644
index 0000000..db27ffc
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/package-info.java
@@ -0,0 +1,22 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+
+/**
+ * This package contains application entry point and related classes for Recon.
+ */
+package org.apache.hadoop.ozone.recon;
\ No newline at end of file
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/recovery/package-info.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/recovery/package-info.java
new file mode 100644
index 0000000..5c00ee9
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/recovery/package-info.java
@@ -0,0 +1,22 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+
+/**
+ * The classes in this package handle OM snapshot recovery and checkpoints.
+ */
+package org.apache.hadoop.ozone.recon.recovery;
\ No newline at end of file
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/spi/HddsDatanodeServiceProvider.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/spi/HddsDatanodeServiceProvider.java
new file mode 100644
index 0000000..ce7d414
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/spi/HddsDatanodeServiceProvider.java
@@ -0,0 +1,25 @@
+package org.apache.hadoop.ozone.recon.spi;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+
+/**
+ * Interface to access datanode endpoints.
+ */
+public interface HddsDatanodeServiceProvider {
+}
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/spi/OzoneManagerServiceProvider.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/spi/OzoneManagerServiceProvider.java
new file mode 100644
index 0000000..7dae610
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/spi/OzoneManagerServiceProvider.java
@@ -0,0 +1,25 @@
+package org.apache.hadoop.ozone.recon.spi;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+
+/**
+ * Interface to access OM endpoints.
+ */
+public interface OzoneManagerServiceProvider {
+}
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/spi/StorageContainerServiceProvider.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/spi/StorageContainerServiceProvider.java
new file mode 100644
index 0000000..db052a7
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/spi/StorageContainerServiceProvider.java
@@ -0,0 +1,25 @@
+package org.apache.hadoop.ozone.recon.spi;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+
+/**
+ * Interface to access SCM endpoints.
+ */
+public interface StorageContainerServiceProvider {
+}
diff --git a/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/spi/package-info.java
b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/spi/package-info.java
new file mode 100644
index 0000000..24692fa
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/java/org/apache/hadoop/ozone/recon/spi/package-info.java
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+
+/**
+ * The classes in this package define the Service Provider interfaces for
+ * Recon. The implementations of Spi interfaces provide connectivity to
+ * underlying Ozone subsystems.
+ */
+package org.apache.hadoop.ozone.recon.spi;
\ No newline at end of file
diff --git a/hadoop-ozone/ozone-recon/src/main/resources/webapps.recon.WEB-INF/web.xml b/hadoop-ozone/ozone-recon/src/main/resources/webapps.recon.WEB-INF/web.xml
new file mode 100644
index 0000000..c32f64c
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/main/resources/webapps.recon.WEB-INF/web.xml
@@ -0,0 +1,33 @@
+<!--
+  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. See accompanying LICENSE file.
+-->
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+
+  <servlet>
+    <servlet-name>jaxrs</servlet-name>
+    <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
+    <init-param>
+      <param-name>javax.ws.rs.Application</param-name>
+      <param-value>org.apache.hadoop.ozone.recon.ReconApplication</param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>jaxrs</servlet-name>
+    <url-pattern>/*</url-pattern>
+  </servlet-mapping>
+
+
+</web-app>
\ No newline at end of file
diff --git a/hadoop-ozone/ozone-recon/src/test/java/org/apache/hadoop/ozone/recon/package-info.java
b/hadoop-ozone/ozone-recon/src/test/java/org/apache/hadoop/ozone/recon/package-info.java
new file mode 100644
index 0000000..d0066a3
--- /dev/null
+++ b/hadoop-ozone/ozone-recon/src/test/java/org/apache/hadoop/ozone/recon/package-info.java
@@ -0,0 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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 for recon server tests.
+ */
+package org.apache.hadoop.ozone.recon;
\ No newline at end of file
diff --git a/hadoop-ozone/pom.xml b/hadoop-ozone/pom.xml
index ac20f1e..4c3105c 100644
--- a/hadoop-ozone/pom.xml
+++ b/hadoop-ozone/pom.xml
@@ -48,6 +48,7 @@
     <module>datanode</module>
     <module>s3gateway</module>
     <module>dist</module>
+    <module>ozone-recon</module>
   </modules>
 
   <repositories>


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message