diff --git common/src/java/org/apache/hadoop/hive/common/classification/InterfaceAudience.java common/src/java/org/apache/hadoop/hive/common/classification/InterfaceAudience.java new file mode 100644 index 0000000..1334ed6 --- /dev/null +++ common/src/java/org/apache/hadoop/hive/common/classification/InterfaceAudience.java @@ -0,0 +1,45 @@ +/* + * 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.hive.common.classification; + +import java.lang.annotation.Documented; + +/** + * Annotation to inform users of a package, class or method's intended audience. + */ +public class InterfaceAudience { + /** + * Intended for use by any project or application. + */ + @Documented public @interface Public {}; + + /** + * Intended only for the project(s) specified in the annotation + */ + @Documented public @interface LimitedPrivate { + String[] value(); + }; + + /** + * Intended for use only within Hive itself. + */ + @Documented public @interface Private {}; + + private InterfaceAudience() {} // Audience can't exist on its own +} + diff --git common/src/java/org/apache/hadoop/hive/common/classification/InterfaceStability.java common/src/java/org/apache/hadoop/hive/common/classification/InterfaceStability.java new file mode 100644 index 0000000..2a12806 --- /dev/null +++ common/src/java/org/apache/hadoop/hive/common/classification/InterfaceStability.java @@ -0,0 +1,46 @@ +/* + * 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.hive.common.classification; + +import java.lang.annotation.Documented; + +/** + * Annotation to inform users of how much to rely on a particular package, + * class or method not changing over time. + */ +public class InterfaceStability { + /** + * Can evolve while retaining compatibility for minor release boundaries.; + * can break compatibility only at major release (ie. at m.0). + */ + @Documented + public @interface Stable {}; + + /** + * Evolving, but can break compatibility at minor release (i.e. m.x) + */ + @Documented + public @interface Evolving {}; + + /** + * No guarantee is provided as to reliability or stability across any + * level of release granularity. + */ + @Documented + public @interface Unstable {}; +} diff --git metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java index 2ccdaab..b4c7c49 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java @@ -38,6 +38,8 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.common.JavaUtils; +import org.apache.hadoop.hive.common.classification.InterfaceAudience; +import org.apache.hadoop.hive.common.classification.InterfaceStability; import org.apache.hadoop.hive.common.metrics.Metrics; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.api.AlreadyExistsException; @@ -280,13 +282,16 @@ public class HiveMetaStore extends ThriftHiveMetastore { * The catch blocks are used to ensure that the exceptions thrown by the * follow the function definition. */ - private static class Command { + @InterfaceAudience.LimitedPrivate({"HCATALOG"}) + @InterfaceStability.Evolving + public static class Command { T run(RawStore ms) throws Exception { return null; } } - - private T executeWithRetry(Command cmd) throws Exception { + @InterfaceAudience.LimitedPrivate({"HCATALOG"}) + @InterfaceStability.Evolving + public T executeWithRetry(Command cmd) throws Exception { T ret = null; boolean gotNewConnectUrl = false; @@ -342,7 +347,9 @@ public class HiveMetaStore extends ThriftHiveMetastore { * @return * @throws MetaException */ - private RawStore getMS(boolean reloadConf) throws MetaException { + @InterfaceAudience.LimitedPrivate({"HCATALOG"}) + @InterfaceStability.Evolving + public RawStore getMS(boolean reloadConf) throws MetaException { RawStore ms = threadLocalMS.get(); if (ms == null) { LOG.info(addPrefix("Opening raw store with implemenation class:" diff --git metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java index 864ed6a..c3d8d82 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java @@ -48,6 +48,8 @@ import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configurable; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hive.common.FileUtils; +import org.apache.hadoop.hive.common.classification.InterfaceAudience; +import org.apache.hadoop.hive.common.classification.InterfaceStability; import org.apache.hadoop.hive.conf.HiveConf; import org.apache.hadoop.hive.metastore.api.Database; import org.apache.hadoop.hive.metastore.api.FieldSchema; @@ -257,7 +259,9 @@ public class ObjectStore implements RawStore, Configurable { return pmf; } - private PersistenceManager getPersistenceManager() { + @InterfaceAudience.LimitedPrivate({"HCATALOG"}) + @InterfaceStability.Evolving + public PersistenceManager getPersistenceManager() { return getPMF().getPersistenceManager(); }