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 79ef711ac2f..f905f6042ec 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, GenericParentCommand { OzoneConfiguration ozoneConf = new OzoneConfiguration(); if (configurationOverrides != null) { for (Entry 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 00000000000..fed7ad4dda0 --- /dev/null +++ b/hadoop-ozone/ozone-recon/pom.xml @@ -0,0 +1,50 @@ + + + + + hadoop-ozone + org.apache.hadoop + 0.4.0-SNAPSHOT + + Apache Hadoop Ozone Recon + 4.0.0 + ozone-recon + + + com.google.inject + guice + ${guice.version} + + + com.google.inject.extensions + guice-servlet + 4.1.0 + compile + + + org.glassfish.jersey.containers + jersey-container-servlet-core + 2.27 + compile + + + com.google.inject.extensions + guice-assistedinject + 4.1.0 + + + \ 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 00000000000..3c8dae04c16 --- /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. + *

+ * 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 { + + 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 00000000000..24ba5ee6c75 --- /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 + *

+ * 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.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 00000000000..1a90e702644 --- /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 + *

+ * 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.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 00000000000..72818c57ed6 --- /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 + *

+ * 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 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 00000000000..0858d610348 --- /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 + *

+ * 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.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 00000000000..78281bcac26 --- /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 + *

+ * 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.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 00000000000..60b533e3e97 --- /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 + *

+ * 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; + +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 00000000000..894e9d5d9f2 --- /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 + *

+ * 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. + */ + +/** + * 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 00000000000..29af448f91f --- /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 + *

+ * 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 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 00000000000..7bcdbe19f5c --- /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 { + + 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 00000000000..441ee65bae2 --- /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 + *

+ * 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 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 00000000000..cc2a7abfe57 --- /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 + *

+ * 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. + */ + +/** + * 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 00000000000..db27ffcecc2 --- /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 + *

+ * 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. + */ + +/** + * 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 00000000000..5c00ee9ef4b --- /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 + *

+ * 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. + */ + +/** + * 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 00000000000..ce7d4143820 --- /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 + *

+ * 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. + */ + +/** + * 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 00000000000..7dae610ccce --- /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 + *

+ * 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. + */ + +/** + * 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 00000000000..db052a7be57 --- /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 + *

+ * 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. + */ + +/** + * 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 00000000000..24692facf0a --- /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 + *

+ * 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. + */ + +/** + * 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 00000000000..c32f64ced89 --- /dev/null +++ b/hadoop-ozone/ozone-recon/src/main/resources/webapps.recon.WEB-INF/web.xml @@ -0,0 +1,33 @@ + + + + + jaxrs + org.glassfish.jersey.servlet.ServletContainer + + javax.ws.rs.Application + org.apache.hadoop.ozone.recon.ReconApplication + + 1 + + + jaxrs + /* + + + + \ 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 00000000000..d0066a38554 --- /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 + *

+ * 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 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 ac20f1e8d5c..4c3105c9538 100644 --- a/hadoop-ozone/pom.xml +++ b/hadoop-ozone/pom.xml @@ -48,6 +48,7 @@ datanode s3gateway dist + ozone-recon