hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [31/51] [abbrv] [partial] hbase-site git commit: Published site at 44c9021d67b0e922e1d2f5f53908742aceab6c80.
Date Thu, 25 Aug 2016 18:25:41 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/a16749a7/apidocs/src-html/org/apache/hadoop/hbase/HTableDescriptor.html
----------------------------------------------------------------------
diff --git a/apidocs/src-html/org/apache/hadoop/hbase/HTableDescriptor.html b/apidocs/src-html/org/apache/hadoop/hbase/HTableDescriptor.html
index ec8365f..7864b69 100644
--- a/apidocs/src-html/org/apache/hadoop/hbase/HTableDescriptor.html
+++ b/apidocs/src-html/org/apache/hadoop/hbase/HTableDescriptor.html
@@ -1123,447 +1123,459 @@
 <span class="sourceLineNo">1115</span>  }<a name="line.1115"></a>
 <span class="sourceLineNo">1116</span><a name="line.1116"></a>
 <span class="sourceLineNo">1117</span>  /**<a name="line.1117"></a>
-<span class="sourceLineNo">1118</span>   * Returns the configured replicas per region<a name="line.1118"></a>
+<span class="sourceLineNo">1118</span>   * Return true if there are at least one cf whose replication scope is serial.<a name="line.1118"></a>
 <span class="sourceLineNo">1119</span>   */<a name="line.1119"></a>
-<span class="sourceLineNo">1120</span>  public int getRegionReplication() {<a name="line.1120"></a>
-<span class="sourceLineNo">1121</span>    return getIntValue(REGION_REPLICATION_KEY, DEFAULT_REGION_REPLICATION);<a name="line.1121"></a>
-<span class="sourceLineNo">1122</span>  }<a name="line.1122"></a>
-<span class="sourceLineNo">1123</span><a name="line.1123"></a>
-<span class="sourceLineNo">1124</span>  private int getIntValue(Bytes key, int defaultVal) {<a name="line.1124"></a>
-<span class="sourceLineNo">1125</span>    byte[] val = getValue(key);<a name="line.1125"></a>
-<span class="sourceLineNo">1126</span>    if (val == null || val.length == 0) {<a name="line.1126"></a>
-<span class="sourceLineNo">1127</span>      return defaultVal;<a name="line.1127"></a>
-<span class="sourceLineNo">1128</span>    }<a name="line.1128"></a>
-<span class="sourceLineNo">1129</span>    return Integer.parseInt(Bytes.toString(val));<a name="line.1129"></a>
-<span class="sourceLineNo">1130</span>  }<a name="line.1130"></a>
-<span class="sourceLineNo">1131</span><a name="line.1131"></a>
-<span class="sourceLineNo">1132</span>  /**<a name="line.1132"></a>
-<span class="sourceLineNo">1133</span>   * Sets the number of replicas per region.<a name="line.1133"></a>
-<span class="sourceLineNo">1134</span>   * @param regionReplication the replication factor per region<a name="line.1134"></a>
-<span class="sourceLineNo">1135</span>   */<a name="line.1135"></a>
-<span class="sourceLineNo">1136</span>  public HTableDescriptor setRegionReplication(int regionReplication) {<a name="line.1136"></a>
-<span class="sourceLineNo">1137</span>    setValue(REGION_REPLICATION_KEY,<a name="line.1137"></a>
-<span class="sourceLineNo">1138</span>        new Bytes(Bytes.toBytes(Integer.toString(regionReplication))));<a name="line.1138"></a>
-<span class="sourceLineNo">1139</span>    return this;<a name="line.1139"></a>
-<span class="sourceLineNo">1140</span>  }<a name="line.1140"></a>
-<span class="sourceLineNo">1141</span><a name="line.1141"></a>
-<span class="sourceLineNo">1142</span>  /**<a name="line.1142"></a>
-<span class="sourceLineNo">1143</span>   * @return true if the read-replicas memstore replication is enabled.<a name="line.1143"></a>
-<span class="sourceLineNo">1144</span>   */<a name="line.1144"></a>
-<span class="sourceLineNo">1145</span>  public boolean hasRegionMemstoreReplication() {<a name="line.1145"></a>
-<span class="sourceLineNo">1146</span>    return isSomething(REGION_MEMSTORE_REPLICATION_KEY, DEFAULT_REGION_MEMSTORE_REPLICATION);<a name="line.1146"></a>
-<span class="sourceLineNo">1147</span>  }<a name="line.1147"></a>
-<span class="sourceLineNo">1148</span><a name="line.1148"></a>
-<span class="sourceLineNo">1149</span>  /**<a name="line.1149"></a>
-<span class="sourceLineNo">1150</span>   * Enable or Disable the memstore replication from the primary region to the replicas.<a name="line.1150"></a>
-<span class="sourceLineNo">1151</span>   * The replication will be used only for meta operations (e.g. flush, compaction, ...)<a name="line.1151"></a>
-<span class="sourceLineNo">1152</span>   *<a name="line.1152"></a>
-<span class="sourceLineNo">1153</span>   * @param memstoreReplication true if the new data written to the primary region<a name="line.1153"></a>
-<span class="sourceLineNo">1154</span>   *                                 should be replicated.<a name="line.1154"></a>
-<span class="sourceLineNo">1155</span>   *                            false if the secondaries can tollerate to have new<a name="line.1155"></a>
-<span class="sourceLineNo">1156</span>   *                                  data only when the primary flushes the memstore.<a name="line.1156"></a>
-<span class="sourceLineNo">1157</span>   */<a name="line.1157"></a>
-<span class="sourceLineNo">1158</span>  public HTableDescriptor setRegionMemstoreReplication(boolean memstoreReplication) {<a name="line.1158"></a>
-<span class="sourceLineNo">1159</span>    setValue(REGION_MEMSTORE_REPLICATION_KEY, memstoreReplication ? TRUE : FALSE);<a name="line.1159"></a>
-<span class="sourceLineNo">1160</span>    // If the memstore replication is setup, we do not have to wait for observing a flush event<a name="line.1160"></a>
-<span class="sourceLineNo">1161</span>    // from primary before starting to serve reads, because gaps from replication is not applicable<a name="line.1161"></a>
-<span class="sourceLineNo">1162</span>    setConfiguration(RegionReplicaUtil.REGION_REPLICA_WAIT_FOR_PRIMARY_FLUSH_CONF_KEY,<a name="line.1162"></a>
-<span class="sourceLineNo">1163</span>      Boolean.toString(memstoreReplication));<a name="line.1163"></a>
-<span class="sourceLineNo">1164</span>    return this;<a name="line.1164"></a>
-<span class="sourceLineNo">1165</span>  }<a name="line.1165"></a>
-<span class="sourceLineNo">1166</span><a name="line.1166"></a>
-<span class="sourceLineNo">1167</span>  public HTableDescriptor setPriority(int priority) {<a name="line.1167"></a>
-<span class="sourceLineNo">1168</span>    setValue(PRIORITY_KEY, Integer.toString(priority));<a name="line.1168"></a>
-<span class="sourceLineNo">1169</span>    return this;<a name="line.1169"></a>
-<span class="sourceLineNo">1170</span>  }<a name="line.1170"></a>
-<span class="sourceLineNo">1171</span><a name="line.1171"></a>
-<span class="sourceLineNo">1172</span>  public int getPriority() {<a name="line.1172"></a>
-<span class="sourceLineNo">1173</span>    return getIntValue(PRIORITY_KEY, DEFAULT_PRIORITY);<a name="line.1173"></a>
-<span class="sourceLineNo">1174</span>  }<a name="line.1174"></a>
-<span class="sourceLineNo">1175</span><a name="line.1175"></a>
-<span class="sourceLineNo">1176</span>  /**<a name="line.1176"></a>
-<span class="sourceLineNo">1177</span>   * Returns all the column family names of the current table. The map of<a name="line.1177"></a>
-<span class="sourceLineNo">1178</span>   * HTableDescriptor contains mapping of family name to HColumnDescriptors.<a name="line.1178"></a>
-<span class="sourceLineNo">1179</span>   * This returns all the keys of the family map which represents the column<a name="line.1179"></a>
-<span class="sourceLineNo">1180</span>   * family names of the table.<a name="line.1180"></a>
-<span class="sourceLineNo">1181</span>   *<a name="line.1181"></a>
-<span class="sourceLineNo">1182</span>   * @return Immutable sorted set of the keys of the families.<a name="line.1182"></a>
-<span class="sourceLineNo">1183</span>   */<a name="line.1183"></a>
-<span class="sourceLineNo">1184</span>  public Set&lt;byte[]&gt; getFamiliesKeys() {<a name="line.1184"></a>
-<span class="sourceLineNo">1185</span>    return Collections.unmodifiableSet(this.families.keySet());<a name="line.1185"></a>
+<span class="sourceLineNo">1120</span>  public boolean hasSerialReplicationScope() {<a name="line.1120"></a>
+<span class="sourceLineNo">1121</span>    for (HColumnDescriptor column: getFamilies()){<a name="line.1121"></a>
+<span class="sourceLineNo">1122</span>      if (column.getScope() == HConstants.REPLICATION_SCOPE_SERIAL){<a name="line.1122"></a>
+<span class="sourceLineNo">1123</span>        return true;<a name="line.1123"></a>
+<span class="sourceLineNo">1124</span>      }<a name="line.1124"></a>
+<span class="sourceLineNo">1125</span>    }<a name="line.1125"></a>
+<span class="sourceLineNo">1126</span>    return false;<a name="line.1126"></a>
+<span class="sourceLineNo">1127</span>  }<a name="line.1127"></a>
+<span class="sourceLineNo">1128</span><a name="line.1128"></a>
+<span class="sourceLineNo">1129</span>  /**<a name="line.1129"></a>
+<span class="sourceLineNo">1130</span>   * Returns the configured replicas per region<a name="line.1130"></a>
+<span class="sourceLineNo">1131</span>   */<a name="line.1131"></a>
+<span class="sourceLineNo">1132</span>  public int getRegionReplication() {<a name="line.1132"></a>
+<span class="sourceLineNo">1133</span>    return getIntValue(REGION_REPLICATION_KEY, DEFAULT_REGION_REPLICATION);<a name="line.1133"></a>
+<span class="sourceLineNo">1134</span>  }<a name="line.1134"></a>
+<span class="sourceLineNo">1135</span><a name="line.1135"></a>
+<span class="sourceLineNo">1136</span>  private int getIntValue(Bytes key, int defaultVal) {<a name="line.1136"></a>
+<span class="sourceLineNo">1137</span>    byte[] val = getValue(key);<a name="line.1137"></a>
+<span class="sourceLineNo">1138</span>    if (val == null || val.length == 0) {<a name="line.1138"></a>
+<span class="sourceLineNo">1139</span>      return defaultVal;<a name="line.1139"></a>
+<span class="sourceLineNo">1140</span>    }<a name="line.1140"></a>
+<span class="sourceLineNo">1141</span>    return Integer.parseInt(Bytes.toString(val));<a name="line.1141"></a>
+<span class="sourceLineNo">1142</span>  }<a name="line.1142"></a>
+<span class="sourceLineNo">1143</span><a name="line.1143"></a>
+<span class="sourceLineNo">1144</span>  /**<a name="line.1144"></a>
+<span class="sourceLineNo">1145</span>   * Sets the number of replicas per region.<a name="line.1145"></a>
+<span class="sourceLineNo">1146</span>   * @param regionReplication the replication factor per region<a name="line.1146"></a>
+<span class="sourceLineNo">1147</span>   */<a name="line.1147"></a>
+<span class="sourceLineNo">1148</span>  public HTableDescriptor setRegionReplication(int regionReplication) {<a name="line.1148"></a>
+<span class="sourceLineNo">1149</span>    setValue(REGION_REPLICATION_KEY,<a name="line.1149"></a>
+<span class="sourceLineNo">1150</span>        new Bytes(Bytes.toBytes(Integer.toString(regionReplication))));<a name="line.1150"></a>
+<span class="sourceLineNo">1151</span>    return this;<a name="line.1151"></a>
+<span class="sourceLineNo">1152</span>  }<a name="line.1152"></a>
+<span class="sourceLineNo">1153</span><a name="line.1153"></a>
+<span class="sourceLineNo">1154</span>  /**<a name="line.1154"></a>
+<span class="sourceLineNo">1155</span>   * @return true if the read-replicas memstore replication is enabled.<a name="line.1155"></a>
+<span class="sourceLineNo">1156</span>   */<a name="line.1156"></a>
+<span class="sourceLineNo">1157</span>  public boolean hasRegionMemstoreReplication() {<a name="line.1157"></a>
+<span class="sourceLineNo">1158</span>    return isSomething(REGION_MEMSTORE_REPLICATION_KEY, DEFAULT_REGION_MEMSTORE_REPLICATION);<a name="line.1158"></a>
+<span class="sourceLineNo">1159</span>  }<a name="line.1159"></a>
+<span class="sourceLineNo">1160</span><a name="line.1160"></a>
+<span class="sourceLineNo">1161</span>  /**<a name="line.1161"></a>
+<span class="sourceLineNo">1162</span>   * Enable or Disable the memstore replication from the primary region to the replicas.<a name="line.1162"></a>
+<span class="sourceLineNo">1163</span>   * The replication will be used only for meta operations (e.g. flush, compaction, ...)<a name="line.1163"></a>
+<span class="sourceLineNo">1164</span>   *<a name="line.1164"></a>
+<span class="sourceLineNo">1165</span>   * @param memstoreReplication true if the new data written to the primary region<a name="line.1165"></a>
+<span class="sourceLineNo">1166</span>   *                                 should be replicated.<a name="line.1166"></a>
+<span class="sourceLineNo">1167</span>   *                            false if the secondaries can tollerate to have new<a name="line.1167"></a>
+<span class="sourceLineNo">1168</span>   *                                  data only when the primary flushes the memstore.<a name="line.1168"></a>
+<span class="sourceLineNo">1169</span>   */<a name="line.1169"></a>
+<span class="sourceLineNo">1170</span>  public HTableDescriptor setRegionMemstoreReplication(boolean memstoreReplication) {<a name="line.1170"></a>
+<span class="sourceLineNo">1171</span>    setValue(REGION_MEMSTORE_REPLICATION_KEY, memstoreReplication ? TRUE : FALSE);<a name="line.1171"></a>
+<span class="sourceLineNo">1172</span>    // If the memstore replication is setup, we do not have to wait for observing a flush event<a name="line.1172"></a>
+<span class="sourceLineNo">1173</span>    // from primary before starting to serve reads, because gaps from replication is not applicable<a name="line.1173"></a>
+<span class="sourceLineNo">1174</span>    setConfiguration(RegionReplicaUtil.REGION_REPLICA_WAIT_FOR_PRIMARY_FLUSH_CONF_KEY,<a name="line.1174"></a>
+<span class="sourceLineNo">1175</span>      Boolean.toString(memstoreReplication));<a name="line.1175"></a>
+<span class="sourceLineNo">1176</span>    return this;<a name="line.1176"></a>
+<span class="sourceLineNo">1177</span>  }<a name="line.1177"></a>
+<span class="sourceLineNo">1178</span><a name="line.1178"></a>
+<span class="sourceLineNo">1179</span>  public HTableDescriptor setPriority(int priority) {<a name="line.1179"></a>
+<span class="sourceLineNo">1180</span>    setValue(PRIORITY_KEY, Integer.toString(priority));<a name="line.1180"></a>
+<span class="sourceLineNo">1181</span>    return this;<a name="line.1181"></a>
+<span class="sourceLineNo">1182</span>  }<a name="line.1182"></a>
+<span class="sourceLineNo">1183</span><a name="line.1183"></a>
+<span class="sourceLineNo">1184</span>  public int getPriority() {<a name="line.1184"></a>
+<span class="sourceLineNo">1185</span>    return getIntValue(PRIORITY_KEY, DEFAULT_PRIORITY);<a name="line.1185"></a>
 <span class="sourceLineNo">1186</span>  }<a name="line.1186"></a>
 <span class="sourceLineNo">1187</span><a name="line.1187"></a>
 <span class="sourceLineNo">1188</span>  /**<a name="line.1188"></a>
-<span class="sourceLineNo">1189</span>   * Returns an array all the {@link HColumnDescriptor} of the column families<a name="line.1189"></a>
-<span class="sourceLineNo">1190</span>   * of the table.<a name="line.1190"></a>
-<span class="sourceLineNo">1191</span>   *<a name="line.1191"></a>
-<span class="sourceLineNo">1192</span>   * @return Array of all the HColumnDescriptors of the current table<a name="line.1192"></a>
+<span class="sourceLineNo">1189</span>   * Returns all the column family names of the current table. The map of<a name="line.1189"></a>
+<span class="sourceLineNo">1190</span>   * HTableDescriptor contains mapping of family name to HColumnDescriptors.<a name="line.1190"></a>
+<span class="sourceLineNo">1191</span>   * This returns all the keys of the family map which represents the column<a name="line.1191"></a>
+<span class="sourceLineNo">1192</span>   * family names of the table.<a name="line.1192"></a>
 <span class="sourceLineNo">1193</span>   *<a name="line.1193"></a>
-<span class="sourceLineNo">1194</span>   * @see #getFamilies()<a name="line.1194"></a>
+<span class="sourceLineNo">1194</span>   * @return Immutable sorted set of the keys of the families.<a name="line.1194"></a>
 <span class="sourceLineNo">1195</span>   */<a name="line.1195"></a>
-<span class="sourceLineNo">1196</span>  public HColumnDescriptor[] getColumnFamilies() {<a name="line.1196"></a>
-<span class="sourceLineNo">1197</span>    Collection&lt;HColumnDescriptor&gt; hColumnDescriptors = getFamilies();<a name="line.1197"></a>
-<span class="sourceLineNo">1198</span>    return hColumnDescriptors.toArray(new HColumnDescriptor[hColumnDescriptors.size()]);<a name="line.1198"></a>
-<span class="sourceLineNo">1199</span>  }<a name="line.1199"></a>
-<span class="sourceLineNo">1200</span><a name="line.1200"></a>
-<span class="sourceLineNo">1201</span><a name="line.1201"></a>
-<span class="sourceLineNo">1202</span>  /**<a name="line.1202"></a>
-<span class="sourceLineNo">1203</span>   * Returns the HColumnDescriptor for a specific column family with name as<a name="line.1203"></a>
-<span class="sourceLineNo">1204</span>   * specified by the parameter column.<a name="line.1204"></a>
+<span class="sourceLineNo">1196</span>  public Set&lt;byte[]&gt; getFamiliesKeys() {<a name="line.1196"></a>
+<span class="sourceLineNo">1197</span>    return Collections.unmodifiableSet(this.families.keySet());<a name="line.1197"></a>
+<span class="sourceLineNo">1198</span>  }<a name="line.1198"></a>
+<span class="sourceLineNo">1199</span><a name="line.1199"></a>
+<span class="sourceLineNo">1200</span>  /**<a name="line.1200"></a>
+<span class="sourceLineNo">1201</span>   * Returns an array all the {@link HColumnDescriptor} of the column families<a name="line.1201"></a>
+<span class="sourceLineNo">1202</span>   * of the table.<a name="line.1202"></a>
+<span class="sourceLineNo">1203</span>   *<a name="line.1203"></a>
+<span class="sourceLineNo">1204</span>   * @return Array of all the HColumnDescriptors of the current table<a name="line.1204"></a>
 <span class="sourceLineNo">1205</span>   *<a name="line.1205"></a>
-<span class="sourceLineNo">1206</span>   * @param column Column family name<a name="line.1206"></a>
-<span class="sourceLineNo">1207</span>   * @return Column descriptor for the passed family name or the family on<a name="line.1207"></a>
-<span class="sourceLineNo">1208</span>   * passed in column.<a name="line.1208"></a>
-<span class="sourceLineNo">1209</span>   */<a name="line.1209"></a>
-<span class="sourceLineNo">1210</span>  public HColumnDescriptor getFamily(final byte [] column) {<a name="line.1210"></a>
-<span class="sourceLineNo">1211</span>    return this.families.get(column);<a name="line.1211"></a>
-<span class="sourceLineNo">1212</span>  }<a name="line.1212"></a>
+<span class="sourceLineNo">1206</span>   * @see #getFamilies()<a name="line.1206"></a>
+<span class="sourceLineNo">1207</span>   */<a name="line.1207"></a>
+<span class="sourceLineNo">1208</span>  public HColumnDescriptor[] getColumnFamilies() {<a name="line.1208"></a>
+<span class="sourceLineNo">1209</span>    Collection&lt;HColumnDescriptor&gt; hColumnDescriptors = getFamilies();<a name="line.1209"></a>
+<span class="sourceLineNo">1210</span>    return hColumnDescriptors.toArray(new HColumnDescriptor[hColumnDescriptors.size()]);<a name="line.1210"></a>
+<span class="sourceLineNo">1211</span>  }<a name="line.1211"></a>
+<span class="sourceLineNo">1212</span><a name="line.1212"></a>
 <span class="sourceLineNo">1213</span><a name="line.1213"></a>
-<span class="sourceLineNo">1214</span><a name="line.1214"></a>
-<span class="sourceLineNo">1215</span>  /**<a name="line.1215"></a>
-<span class="sourceLineNo">1216</span>   * Removes the HColumnDescriptor with name specified by the parameter column<a name="line.1216"></a>
-<span class="sourceLineNo">1217</span>   * from the table descriptor<a name="line.1217"></a>
-<span class="sourceLineNo">1218</span>   *<a name="line.1218"></a>
-<span class="sourceLineNo">1219</span>   * @param column Name of the column family to be removed.<a name="line.1219"></a>
-<span class="sourceLineNo">1220</span>   * @return Column descriptor for the passed family name or the family on<a name="line.1220"></a>
-<span class="sourceLineNo">1221</span>   * passed in column.<a name="line.1221"></a>
-<span class="sourceLineNo">1222</span>   */<a name="line.1222"></a>
-<span class="sourceLineNo">1223</span>  public HColumnDescriptor removeFamily(final byte [] column) {<a name="line.1223"></a>
-<span class="sourceLineNo">1224</span>    return this.families.remove(column);<a name="line.1224"></a>
-<span class="sourceLineNo">1225</span>  }<a name="line.1225"></a>
+<span class="sourceLineNo">1214</span>  /**<a name="line.1214"></a>
+<span class="sourceLineNo">1215</span>   * Returns the HColumnDescriptor for a specific column family with name as<a name="line.1215"></a>
+<span class="sourceLineNo">1216</span>   * specified by the parameter column.<a name="line.1216"></a>
+<span class="sourceLineNo">1217</span>   *<a name="line.1217"></a>
+<span class="sourceLineNo">1218</span>   * @param column Column family name<a name="line.1218"></a>
+<span class="sourceLineNo">1219</span>   * @return Column descriptor for the passed family name or the family on<a name="line.1219"></a>
+<span class="sourceLineNo">1220</span>   * passed in column.<a name="line.1220"></a>
+<span class="sourceLineNo">1221</span>   */<a name="line.1221"></a>
+<span class="sourceLineNo">1222</span>  public HColumnDescriptor getFamily(final byte [] column) {<a name="line.1222"></a>
+<span class="sourceLineNo">1223</span>    return this.families.get(column);<a name="line.1223"></a>
+<span class="sourceLineNo">1224</span>  }<a name="line.1224"></a>
+<span class="sourceLineNo">1225</span><a name="line.1225"></a>
 <span class="sourceLineNo">1226</span><a name="line.1226"></a>
 <span class="sourceLineNo">1227</span>  /**<a name="line.1227"></a>
-<span class="sourceLineNo">1228</span>   * Add a table coprocessor to this table. The coprocessor<a name="line.1228"></a>
-<span class="sourceLineNo">1229</span>   * type must be {@link org.apache.hadoop.hbase.coprocessor.RegionObserver}<a name="line.1229"></a>
-<span class="sourceLineNo">1230</span>   * or Endpoint.<a name="line.1230"></a>
-<span class="sourceLineNo">1231</span>   * It won't check if the class can be loaded or not.<a name="line.1231"></a>
-<span class="sourceLineNo">1232</span>   * Whether a coprocessor is loadable or not will be determined when<a name="line.1232"></a>
-<span class="sourceLineNo">1233</span>   * a region is opened.<a name="line.1233"></a>
-<span class="sourceLineNo">1234</span>   * @param className Full class name.<a name="line.1234"></a>
-<span class="sourceLineNo">1235</span>   * @throws IOException<a name="line.1235"></a>
-<span class="sourceLineNo">1236</span>   */<a name="line.1236"></a>
-<span class="sourceLineNo">1237</span>  public HTableDescriptor addCoprocessor(String className) throws IOException {<a name="line.1237"></a>
-<span class="sourceLineNo">1238</span>    addCoprocessor(className, null, Coprocessor.PRIORITY_USER, null);<a name="line.1238"></a>
-<span class="sourceLineNo">1239</span>    return this;<a name="line.1239"></a>
-<span class="sourceLineNo">1240</span>  }<a name="line.1240"></a>
-<span class="sourceLineNo">1241</span><a name="line.1241"></a>
-<span class="sourceLineNo">1242</span>  /**<a name="line.1242"></a>
-<span class="sourceLineNo">1243</span>   * Add a table coprocessor to this table. The coprocessor<a name="line.1243"></a>
-<span class="sourceLineNo">1244</span>   * type must be {@link org.apache.hadoop.hbase.coprocessor.RegionObserver}<a name="line.1244"></a>
-<span class="sourceLineNo">1245</span>   * or Endpoint.<a name="line.1245"></a>
-<span class="sourceLineNo">1246</span>   * It won't check if the class can be loaded or not.<a name="line.1246"></a>
-<span class="sourceLineNo">1247</span>   * Whether a coprocessor is loadable or not will be determined when<a name="line.1247"></a>
-<span class="sourceLineNo">1248</span>   * a region is opened.<a name="line.1248"></a>
-<span class="sourceLineNo">1249</span>   * @param jarFilePath Path of the jar file. If it's null, the class will be<a name="line.1249"></a>
-<span class="sourceLineNo">1250</span>   * loaded from default classloader.<a name="line.1250"></a>
-<span class="sourceLineNo">1251</span>   * @param className Full class name.<a name="line.1251"></a>
-<span class="sourceLineNo">1252</span>   * @param priority Priority<a name="line.1252"></a>
-<span class="sourceLineNo">1253</span>   * @param kvs Arbitrary key-value parameter pairs passed into the coprocessor.<a name="line.1253"></a>
-<span class="sourceLineNo">1254</span>   * @throws IOException<a name="line.1254"></a>
-<span class="sourceLineNo">1255</span>   */<a name="line.1255"></a>
-<span class="sourceLineNo">1256</span>  public HTableDescriptor addCoprocessor(String className, Path jarFilePath,<a name="line.1256"></a>
-<span class="sourceLineNo">1257</span>                             int priority, final Map&lt;String, String&gt; kvs)<a name="line.1257"></a>
-<span class="sourceLineNo">1258</span>  throws IOException {<a name="line.1258"></a>
-<span class="sourceLineNo">1259</span>    checkHasCoprocessor(className);<a name="line.1259"></a>
-<span class="sourceLineNo">1260</span><a name="line.1260"></a>
-<span class="sourceLineNo">1261</span>    // Validate parameter kvs and then add key/values to kvString.<a name="line.1261"></a>
-<span class="sourceLineNo">1262</span>    StringBuilder kvString = new StringBuilder();<a name="line.1262"></a>
-<span class="sourceLineNo">1263</span>    if (kvs != null) {<a name="line.1263"></a>
-<span class="sourceLineNo">1264</span>      for (Map.Entry&lt;String, String&gt; e: kvs.entrySet()) {<a name="line.1264"></a>
-<span class="sourceLineNo">1265</span>        if (!e.getKey().matches(HConstants.CP_HTD_ATTR_VALUE_PARAM_KEY_PATTERN)) {<a name="line.1265"></a>
-<span class="sourceLineNo">1266</span>          throw new IOException("Illegal parameter key = " + e.getKey());<a name="line.1266"></a>
-<span class="sourceLineNo">1267</span>        }<a name="line.1267"></a>
-<span class="sourceLineNo">1268</span>        if (!e.getValue().matches(HConstants.CP_HTD_ATTR_VALUE_PARAM_VALUE_PATTERN)) {<a name="line.1268"></a>
-<span class="sourceLineNo">1269</span>          throw new IOException("Illegal parameter (" + e.getKey() +<a name="line.1269"></a>
-<span class="sourceLineNo">1270</span>              ") value = " + e.getValue());<a name="line.1270"></a>
-<span class="sourceLineNo">1271</span>        }<a name="line.1271"></a>
-<span class="sourceLineNo">1272</span>        if (kvString.length() != 0) {<a name="line.1272"></a>
-<span class="sourceLineNo">1273</span>          kvString.append(',');<a name="line.1273"></a>
-<span class="sourceLineNo">1274</span>        }<a name="line.1274"></a>
-<span class="sourceLineNo">1275</span>        kvString.append(e.getKey());<a name="line.1275"></a>
-<span class="sourceLineNo">1276</span>        kvString.append('=');<a name="line.1276"></a>
-<span class="sourceLineNo">1277</span>        kvString.append(e.getValue());<a name="line.1277"></a>
-<span class="sourceLineNo">1278</span>      }<a name="line.1278"></a>
-<span class="sourceLineNo">1279</span>    }<a name="line.1279"></a>
-<span class="sourceLineNo">1280</span><a name="line.1280"></a>
-<span class="sourceLineNo">1281</span>    String value = ((jarFilePath == null)? "" : jarFilePath.toString()) +<a name="line.1281"></a>
-<span class="sourceLineNo">1282</span>        "|" + className + "|" + Integer.toString(priority) + "|" +<a name="line.1282"></a>
-<span class="sourceLineNo">1283</span>        kvString.toString();<a name="line.1283"></a>
-<span class="sourceLineNo">1284</span>    return addCoprocessorToMap(value);<a name="line.1284"></a>
-<span class="sourceLineNo">1285</span>  }<a name="line.1285"></a>
-<span class="sourceLineNo">1286</span><a name="line.1286"></a>
-<span class="sourceLineNo">1287</span>  /**<a name="line.1287"></a>
-<span class="sourceLineNo">1288</span>   * Add a table coprocessor to this table. The coprocessor<a name="line.1288"></a>
-<span class="sourceLineNo">1289</span>   * type must be {@link org.apache.hadoop.hbase.coprocessor.RegionObserver}<a name="line.1289"></a>
-<span class="sourceLineNo">1290</span>   * or Endpoint.<a name="line.1290"></a>
-<span class="sourceLineNo">1291</span>   * It won't check if the class can be loaded or not.<a name="line.1291"></a>
-<span class="sourceLineNo">1292</span>   * Whether a coprocessor is loadable or not will be determined when<a name="line.1292"></a>
-<span class="sourceLineNo">1293</span>   * a region is opened.<a name="line.1293"></a>
-<span class="sourceLineNo">1294</span>   * @param specStr The Coprocessor specification all in in one String formatted so matches<a name="line.1294"></a>
-<span class="sourceLineNo">1295</span>   * {@link HConstants#CP_HTD_ATTR_VALUE_PATTERN}<a name="line.1295"></a>
-<span class="sourceLineNo">1296</span>   * @throws IOException<a name="line.1296"></a>
-<span class="sourceLineNo">1297</span>   */<a name="line.1297"></a>
-<span class="sourceLineNo">1298</span>  public HTableDescriptor addCoprocessorWithSpec(final String specStr) throws IOException {<a name="line.1298"></a>
-<span class="sourceLineNo">1299</span>    String className = getCoprocessorClassNameFromSpecStr(specStr);<a name="line.1299"></a>
-<span class="sourceLineNo">1300</span>    if (className == null) {<a name="line.1300"></a>
-<span class="sourceLineNo">1301</span>      throw new IllegalArgumentException("Format does not match " +<a name="line.1301"></a>
-<span class="sourceLineNo">1302</span>        HConstants.CP_HTD_ATTR_VALUE_PATTERN + ": " + specStr);<a name="line.1302"></a>
-<span class="sourceLineNo">1303</span>    }<a name="line.1303"></a>
-<span class="sourceLineNo">1304</span>    checkHasCoprocessor(className);<a name="line.1304"></a>
-<span class="sourceLineNo">1305</span>    return addCoprocessorToMap(specStr);<a name="line.1305"></a>
-<span class="sourceLineNo">1306</span>  }<a name="line.1306"></a>
-<span class="sourceLineNo">1307</span><a name="line.1307"></a>
-<span class="sourceLineNo">1308</span>  private void checkHasCoprocessor(final String className) throws IOException {<a name="line.1308"></a>
-<span class="sourceLineNo">1309</span>    if (hasCoprocessor(className)) {<a name="line.1309"></a>
-<span class="sourceLineNo">1310</span>      throw new IOException("Coprocessor " + className + " already exists.");<a name="line.1310"></a>
-<span class="sourceLineNo">1311</span>    }<a name="line.1311"></a>
-<span class="sourceLineNo">1312</span>  }<a name="line.1312"></a>
-<span class="sourceLineNo">1313</span><a name="line.1313"></a>
-<span class="sourceLineNo">1314</span>  /**<a name="line.1314"></a>
-<span class="sourceLineNo">1315</span>   * Add coprocessor to values Map<a name="line.1315"></a>
-<span class="sourceLineNo">1316</span>   * @param specStr The Coprocessor specification all in in one String formatted so matches<a name="line.1316"></a>
-<span class="sourceLineNo">1317</span>   * {@link HConstants#CP_HTD_ATTR_VALUE_PATTERN}<a name="line.1317"></a>
-<span class="sourceLineNo">1318</span>   * @return Returns &lt;code&gt;this&lt;/code&gt;<a name="line.1318"></a>
-<span class="sourceLineNo">1319</span>   */<a name="line.1319"></a>
-<span class="sourceLineNo">1320</span>  private HTableDescriptor addCoprocessorToMap(final String specStr) {<a name="line.1320"></a>
-<span class="sourceLineNo">1321</span>    if (specStr == null) return this;<a name="line.1321"></a>
-<span class="sourceLineNo">1322</span>    // generate a coprocessor key<a name="line.1322"></a>
-<span class="sourceLineNo">1323</span>    int maxCoprocessorNumber = 0;<a name="line.1323"></a>
-<span class="sourceLineNo">1324</span>    Matcher keyMatcher;<a name="line.1324"></a>
-<span class="sourceLineNo">1325</span>    for (Map.Entry&lt;Bytes, Bytes&gt; e: this.values.entrySet()) {<a name="line.1325"></a>
-<span class="sourceLineNo">1326</span>      keyMatcher = HConstants.CP_HTD_ATTR_KEY_PATTERN.matcher(Bytes.toString(e.getKey().get()));<a name="line.1326"></a>
-<span class="sourceLineNo">1327</span>      if (!keyMatcher.matches()) {<a name="line.1327"></a>
-<span class="sourceLineNo">1328</span>        continue;<a name="line.1328"></a>
-<span class="sourceLineNo">1329</span>      }<a name="line.1329"></a>
-<span class="sourceLineNo">1330</span>      maxCoprocessorNumber = Math.max(Integer.parseInt(keyMatcher.group(1)), maxCoprocessorNumber);<a name="line.1330"></a>
-<span class="sourceLineNo">1331</span>    }<a name="line.1331"></a>
-<span class="sourceLineNo">1332</span>    maxCoprocessorNumber++;<a name="line.1332"></a>
-<span class="sourceLineNo">1333</span>    String key = "coprocessor$" + Integer.toString(maxCoprocessorNumber);<a name="line.1333"></a>
-<span class="sourceLineNo">1334</span>    this.values.put(new Bytes(Bytes.toBytes(key)), new Bytes(Bytes.toBytes(specStr)));<a name="line.1334"></a>
-<span class="sourceLineNo">1335</span>    return this;<a name="line.1335"></a>
-<span class="sourceLineNo">1336</span>  }<a name="line.1336"></a>
-<span class="sourceLineNo">1337</span><a name="line.1337"></a>
-<span class="sourceLineNo">1338</span>  /**<a name="line.1338"></a>
-<span class="sourceLineNo">1339</span>   * Check if the table has an attached co-processor represented by the name className<a name="line.1339"></a>
-<span class="sourceLineNo">1340</span>   *<a name="line.1340"></a>
-<span class="sourceLineNo">1341</span>   * @param classNameToMatch - Class name of the co-processor<a name="line.1341"></a>
-<span class="sourceLineNo">1342</span>   * @return true of the table has a co-processor className<a name="line.1342"></a>
-<span class="sourceLineNo">1343</span>   */<a name="line.1343"></a>
-<span class="sourceLineNo">1344</span>  public boolean hasCoprocessor(String classNameToMatch) {<a name="line.1344"></a>
-<span class="sourceLineNo">1345</span>    Matcher keyMatcher;<a name="line.1345"></a>
-<span class="sourceLineNo">1346</span>    for (Map.Entry&lt;Bytes, Bytes&gt; e :<a name="line.1346"></a>
-<span class="sourceLineNo">1347</span>        this.values.entrySet()) {<a name="line.1347"></a>
-<span class="sourceLineNo">1348</span>      keyMatcher =<a name="line.1348"></a>
-<span class="sourceLineNo">1349</span>          HConstants.CP_HTD_ATTR_KEY_PATTERN.matcher(<a name="line.1349"></a>
-<span class="sourceLineNo">1350</span>              Bytes.toString(e.getKey().get()));<a name="line.1350"></a>
-<span class="sourceLineNo">1351</span>      if (!keyMatcher.matches()) {<a name="line.1351"></a>
-<span class="sourceLineNo">1352</span>        continue;<a name="line.1352"></a>
-<span class="sourceLineNo">1353</span>      }<a name="line.1353"></a>
-<span class="sourceLineNo">1354</span>      String className = getCoprocessorClassNameFromSpecStr(Bytes.toString(e.getValue().get()));<a name="line.1354"></a>
-<span class="sourceLineNo">1355</span>      if (className == null) continue;<a name="line.1355"></a>
-<span class="sourceLineNo">1356</span>      if (className.equals(classNameToMatch.trim())) {<a name="line.1356"></a>
-<span class="sourceLineNo">1357</span>        return true;<a name="line.1357"></a>
-<span class="sourceLineNo">1358</span>      }<a name="line.1358"></a>
-<span class="sourceLineNo">1359</span>    }<a name="line.1359"></a>
-<span class="sourceLineNo">1360</span>    return false;<a name="line.1360"></a>
-<span class="sourceLineNo">1361</span>  }<a name="line.1361"></a>
-<span class="sourceLineNo">1362</span><a name="line.1362"></a>
-<span class="sourceLineNo">1363</span>  /**<a name="line.1363"></a>
-<span class="sourceLineNo">1364</span>   * Return the list of attached co-processor represented by their name className<a name="line.1364"></a>
-<span class="sourceLineNo">1365</span>   *<a name="line.1365"></a>
-<span class="sourceLineNo">1366</span>   * @return The list of co-processors classNames<a name="line.1366"></a>
-<span class="sourceLineNo">1367</span>   */<a name="line.1367"></a>
-<span class="sourceLineNo">1368</span>  public List&lt;String&gt; getCoprocessors() {<a name="line.1368"></a>
-<span class="sourceLineNo">1369</span>    List&lt;String&gt; result = new ArrayList&lt;String&gt;();<a name="line.1369"></a>
-<span class="sourceLineNo">1370</span>    Matcher keyMatcher;<a name="line.1370"></a>
-<span class="sourceLineNo">1371</span>    for (Map.Entry&lt;Bytes, Bytes&gt; e : this.values.entrySet()) {<a name="line.1371"></a>
-<span class="sourceLineNo">1372</span>      keyMatcher = HConstants.CP_HTD_ATTR_KEY_PATTERN.matcher(Bytes.toString(e.getKey().get()));<a name="line.1372"></a>
-<span class="sourceLineNo">1373</span>      if (!keyMatcher.matches()) {<a name="line.1373"></a>
-<span class="sourceLineNo">1374</span>        continue;<a name="line.1374"></a>
-<span class="sourceLineNo">1375</span>      }<a name="line.1375"></a>
-<span class="sourceLineNo">1376</span>      String className = getCoprocessorClassNameFromSpecStr(Bytes.toString(e.getValue().get()));<a name="line.1376"></a>
-<span class="sourceLineNo">1377</span>      if (className == null) continue;<a name="line.1377"></a>
-<span class="sourceLineNo">1378</span>      result.add(className); // classname is the 2nd field<a name="line.1378"></a>
-<span class="sourceLineNo">1379</span>    }<a name="line.1379"></a>
-<span class="sourceLineNo">1380</span>    return result;<a name="line.1380"></a>
-<span class="sourceLineNo">1381</span>  }<a name="line.1381"></a>
-<span class="sourceLineNo">1382</span><a name="line.1382"></a>
-<span class="sourceLineNo">1383</span>  /**<a name="line.1383"></a>
-<span class="sourceLineNo">1384</span>   * @param spec String formatted as per {@link HConstants#CP_HTD_ATTR_VALUE_PATTERN}<a name="line.1384"></a>
-<span class="sourceLineNo">1385</span>   * @return Class parsed from passed in &lt;code&gt;spec&lt;/code&gt; or null if no match or classpath found<a name="line.1385"></a>
-<span class="sourceLineNo">1386</span>   */<a name="line.1386"></a>
-<span class="sourceLineNo">1387</span>  private static String getCoprocessorClassNameFromSpecStr(final String spec) {<a name="line.1387"></a>
-<span class="sourceLineNo">1388</span>    Matcher matcher = HConstants.CP_HTD_ATTR_VALUE_PATTERN.matcher(spec);<a name="line.1388"></a>
-<span class="sourceLineNo">1389</span>    // Classname is the 2nd field<a name="line.1389"></a>
-<span class="sourceLineNo">1390</span>    return matcher != null &amp;&amp; matcher.matches()? matcher.group(2).trim(): null;<a name="line.1390"></a>
-<span class="sourceLineNo">1391</span>  }<a name="line.1391"></a>
-<span class="sourceLineNo">1392</span><a name="line.1392"></a>
-<span class="sourceLineNo">1393</span>  /**<a name="line.1393"></a>
-<span class="sourceLineNo">1394</span>   * Remove a coprocessor from those set on the table<a name="line.1394"></a>
-<span class="sourceLineNo">1395</span>   * @param className Class name of the co-processor<a name="line.1395"></a>
-<span class="sourceLineNo">1396</span>   */<a name="line.1396"></a>
-<span class="sourceLineNo">1397</span>  public void removeCoprocessor(String className) {<a name="line.1397"></a>
-<span class="sourceLineNo">1398</span>    Bytes match = null;<a name="line.1398"></a>
-<span class="sourceLineNo">1399</span>    Matcher keyMatcher;<a name="line.1399"></a>
-<span class="sourceLineNo">1400</span>    Matcher valueMatcher;<a name="line.1400"></a>
-<span class="sourceLineNo">1401</span>    for (Map.Entry&lt;Bytes, Bytes&gt; e : this.values<a name="line.1401"></a>
-<span class="sourceLineNo">1402</span>        .entrySet()) {<a name="line.1402"></a>
-<span class="sourceLineNo">1403</span>      keyMatcher = HConstants.CP_HTD_ATTR_KEY_PATTERN.matcher(Bytes.toString(e<a name="line.1403"></a>
-<span class="sourceLineNo">1404</span>          .getKey().get()));<a name="line.1404"></a>
-<span class="sourceLineNo">1405</span>      if (!keyMatcher.matches()) {<a name="line.1405"></a>
-<span class="sourceLineNo">1406</span>        continue;<a name="line.1406"></a>
-<span class="sourceLineNo">1407</span>      }<a name="line.1407"></a>
-<span class="sourceLineNo">1408</span>      valueMatcher = HConstants.CP_HTD_ATTR_VALUE_PATTERN.matcher(Bytes<a name="line.1408"></a>
-<span class="sourceLineNo">1409</span>          .toString(e.getValue().get()));<a name="line.1409"></a>
-<span class="sourceLineNo">1410</span>      if (!valueMatcher.matches()) {<a name="line.1410"></a>
-<span class="sourceLineNo">1411</span>        continue;<a name="line.1411"></a>
-<span class="sourceLineNo">1412</span>      }<a name="line.1412"></a>
-<span class="sourceLineNo">1413</span>      // get className and compare<a name="line.1413"></a>
-<span class="sourceLineNo">1414</span>      String clazz = valueMatcher.group(2).trim(); // classname is the 2nd field<a name="line.1414"></a>
-<span class="sourceLineNo">1415</span>      // remove the CP if it is present<a name="line.1415"></a>
-<span class="sourceLineNo">1416</span>      if (clazz.equals(className.trim())) {<a name="line.1416"></a>
-<span class="sourceLineNo">1417</span>        match = e.getKey();<a name="line.1417"></a>
-<span class="sourceLineNo">1418</span>        break;<a name="line.1418"></a>
+<span class="sourceLineNo">1228</span>   * Removes the HColumnDescriptor with name specified by the parameter column<a name="line.1228"></a>
+<span class="sourceLineNo">1229</span>   * from the table descriptor<a name="line.1229"></a>
+<span class="sourceLineNo">1230</span>   *<a name="line.1230"></a>
+<span class="sourceLineNo">1231</span>   * @param column Name of the column family to be removed.<a name="line.1231"></a>
+<span class="sourceLineNo">1232</span>   * @return Column descriptor for the passed family name or the family on<a name="line.1232"></a>
+<span class="sourceLineNo">1233</span>   * passed in column.<a name="line.1233"></a>
+<span class="sourceLineNo">1234</span>   */<a name="line.1234"></a>
+<span class="sourceLineNo">1235</span>  public HColumnDescriptor removeFamily(final byte [] column) {<a name="line.1235"></a>
+<span class="sourceLineNo">1236</span>    return this.families.remove(column);<a name="line.1236"></a>
+<span class="sourceLineNo">1237</span>  }<a name="line.1237"></a>
+<span class="sourceLineNo">1238</span><a name="line.1238"></a>
+<span class="sourceLineNo">1239</span>  /**<a name="line.1239"></a>
+<span class="sourceLineNo">1240</span>   * Add a table coprocessor to this table. The coprocessor<a name="line.1240"></a>
+<span class="sourceLineNo">1241</span>   * type must be {@link org.apache.hadoop.hbase.coprocessor.RegionObserver}<a name="line.1241"></a>
+<span class="sourceLineNo">1242</span>   * or Endpoint.<a name="line.1242"></a>
+<span class="sourceLineNo">1243</span>   * It won't check if the class can be loaded or not.<a name="line.1243"></a>
+<span class="sourceLineNo">1244</span>   * Whether a coprocessor is loadable or not will be determined when<a name="line.1244"></a>
+<span class="sourceLineNo">1245</span>   * a region is opened.<a name="line.1245"></a>
+<span class="sourceLineNo">1246</span>   * @param className Full class name.<a name="line.1246"></a>
+<span class="sourceLineNo">1247</span>   * @throws IOException<a name="line.1247"></a>
+<span class="sourceLineNo">1248</span>   */<a name="line.1248"></a>
+<span class="sourceLineNo">1249</span>  public HTableDescriptor addCoprocessor(String className) throws IOException {<a name="line.1249"></a>
+<span class="sourceLineNo">1250</span>    addCoprocessor(className, null, Coprocessor.PRIORITY_USER, null);<a name="line.1250"></a>
+<span class="sourceLineNo">1251</span>    return this;<a name="line.1251"></a>
+<span class="sourceLineNo">1252</span>  }<a name="line.1252"></a>
+<span class="sourceLineNo">1253</span><a name="line.1253"></a>
+<span class="sourceLineNo">1254</span>  /**<a name="line.1254"></a>
+<span class="sourceLineNo">1255</span>   * Add a table coprocessor to this table. The coprocessor<a name="line.1255"></a>
+<span class="sourceLineNo">1256</span>   * type must be {@link org.apache.hadoop.hbase.coprocessor.RegionObserver}<a name="line.1256"></a>
+<span class="sourceLineNo">1257</span>   * or Endpoint.<a name="line.1257"></a>
+<span class="sourceLineNo">1258</span>   * It won't check if the class can be loaded or not.<a name="line.1258"></a>
+<span class="sourceLineNo">1259</span>   * Whether a coprocessor is loadable or not will be determined when<a name="line.1259"></a>
+<span class="sourceLineNo">1260</span>   * a region is opened.<a name="line.1260"></a>
+<span class="sourceLineNo">1261</span>   * @param jarFilePath Path of the jar file. If it's null, the class will be<a name="line.1261"></a>
+<span class="sourceLineNo">1262</span>   * loaded from default classloader.<a name="line.1262"></a>
+<span class="sourceLineNo">1263</span>   * @param className Full class name.<a name="line.1263"></a>
+<span class="sourceLineNo">1264</span>   * @param priority Priority<a name="line.1264"></a>
+<span class="sourceLineNo">1265</span>   * @param kvs Arbitrary key-value parameter pairs passed into the coprocessor.<a name="line.1265"></a>
+<span class="sourceLineNo">1266</span>   * @throws IOException<a name="line.1266"></a>
+<span class="sourceLineNo">1267</span>   */<a name="line.1267"></a>
+<span class="sourceLineNo">1268</span>  public HTableDescriptor addCoprocessor(String className, Path jarFilePath,<a name="line.1268"></a>
+<span class="sourceLineNo">1269</span>                             int priority, final Map&lt;String, String&gt; kvs)<a name="line.1269"></a>
+<span class="sourceLineNo">1270</span>  throws IOException {<a name="line.1270"></a>
+<span class="sourceLineNo">1271</span>    checkHasCoprocessor(className);<a name="line.1271"></a>
+<span class="sourceLineNo">1272</span><a name="line.1272"></a>
+<span class="sourceLineNo">1273</span>    // Validate parameter kvs and then add key/values to kvString.<a name="line.1273"></a>
+<span class="sourceLineNo">1274</span>    StringBuilder kvString = new StringBuilder();<a name="line.1274"></a>
+<span class="sourceLineNo">1275</span>    if (kvs != null) {<a name="line.1275"></a>
+<span class="sourceLineNo">1276</span>      for (Map.Entry&lt;String, String&gt; e: kvs.entrySet()) {<a name="line.1276"></a>
+<span class="sourceLineNo">1277</span>        if (!e.getKey().matches(HConstants.CP_HTD_ATTR_VALUE_PARAM_KEY_PATTERN)) {<a name="line.1277"></a>
+<span class="sourceLineNo">1278</span>          throw new IOException("Illegal parameter key = " + e.getKey());<a name="line.1278"></a>
+<span class="sourceLineNo">1279</span>        }<a name="line.1279"></a>
+<span class="sourceLineNo">1280</span>        if (!e.getValue().matches(HConstants.CP_HTD_ATTR_VALUE_PARAM_VALUE_PATTERN)) {<a name="line.1280"></a>
+<span class="sourceLineNo">1281</span>          throw new IOException("Illegal parameter (" + e.getKey() +<a name="line.1281"></a>
+<span class="sourceLineNo">1282</span>              ") value = " + e.getValue());<a name="line.1282"></a>
+<span class="sourceLineNo">1283</span>        }<a name="line.1283"></a>
+<span class="sourceLineNo">1284</span>        if (kvString.length() != 0) {<a name="line.1284"></a>
+<span class="sourceLineNo">1285</span>          kvString.append(',');<a name="line.1285"></a>
+<span class="sourceLineNo">1286</span>        }<a name="line.1286"></a>
+<span class="sourceLineNo">1287</span>        kvString.append(e.getKey());<a name="line.1287"></a>
+<span class="sourceLineNo">1288</span>        kvString.append('=');<a name="line.1288"></a>
+<span class="sourceLineNo">1289</span>        kvString.append(e.getValue());<a name="line.1289"></a>
+<span class="sourceLineNo">1290</span>      }<a name="line.1290"></a>
+<span class="sourceLineNo">1291</span>    }<a name="line.1291"></a>
+<span class="sourceLineNo">1292</span><a name="line.1292"></a>
+<span class="sourceLineNo">1293</span>    String value = ((jarFilePath == null)? "" : jarFilePath.toString()) +<a name="line.1293"></a>
+<span class="sourceLineNo">1294</span>        "|" + className + "|" + Integer.toString(priority) + "|" +<a name="line.1294"></a>
+<span class="sourceLineNo">1295</span>        kvString.toString();<a name="line.1295"></a>
+<span class="sourceLineNo">1296</span>    return addCoprocessorToMap(value);<a name="line.1296"></a>
+<span class="sourceLineNo">1297</span>  }<a name="line.1297"></a>
+<span class="sourceLineNo">1298</span><a name="line.1298"></a>
+<span class="sourceLineNo">1299</span>  /**<a name="line.1299"></a>
+<span class="sourceLineNo">1300</span>   * Add a table coprocessor to this table. The coprocessor<a name="line.1300"></a>
+<span class="sourceLineNo">1301</span>   * type must be {@link org.apache.hadoop.hbase.coprocessor.RegionObserver}<a name="line.1301"></a>
+<span class="sourceLineNo">1302</span>   * or Endpoint.<a name="line.1302"></a>
+<span class="sourceLineNo">1303</span>   * It won't check if the class can be loaded or not.<a name="line.1303"></a>
+<span class="sourceLineNo">1304</span>   * Whether a coprocessor is loadable or not will be determined when<a name="line.1304"></a>
+<span class="sourceLineNo">1305</span>   * a region is opened.<a name="line.1305"></a>
+<span class="sourceLineNo">1306</span>   * @param specStr The Coprocessor specification all in in one String formatted so matches<a name="line.1306"></a>
+<span class="sourceLineNo">1307</span>   * {@link HConstants#CP_HTD_ATTR_VALUE_PATTERN}<a name="line.1307"></a>
+<span class="sourceLineNo">1308</span>   * @throws IOException<a name="line.1308"></a>
+<span class="sourceLineNo">1309</span>   */<a name="line.1309"></a>
+<span class="sourceLineNo">1310</span>  public HTableDescriptor addCoprocessorWithSpec(final String specStr) throws IOException {<a name="line.1310"></a>
+<span class="sourceLineNo">1311</span>    String className = getCoprocessorClassNameFromSpecStr(specStr);<a name="line.1311"></a>
+<span class="sourceLineNo">1312</span>    if (className == null) {<a name="line.1312"></a>
+<span class="sourceLineNo">1313</span>      throw new IllegalArgumentException("Format does not match " +<a name="line.1313"></a>
+<span class="sourceLineNo">1314</span>        HConstants.CP_HTD_ATTR_VALUE_PATTERN + ": " + specStr);<a name="line.1314"></a>
+<span class="sourceLineNo">1315</span>    }<a name="line.1315"></a>
+<span class="sourceLineNo">1316</span>    checkHasCoprocessor(className);<a name="line.1316"></a>
+<span class="sourceLineNo">1317</span>    return addCoprocessorToMap(specStr);<a name="line.1317"></a>
+<span class="sourceLineNo">1318</span>  }<a name="line.1318"></a>
+<span class="sourceLineNo">1319</span><a name="line.1319"></a>
+<span class="sourceLineNo">1320</span>  private void checkHasCoprocessor(final String className) throws IOException {<a name="line.1320"></a>
+<span class="sourceLineNo">1321</span>    if (hasCoprocessor(className)) {<a name="line.1321"></a>
+<span class="sourceLineNo">1322</span>      throw new IOException("Coprocessor " + className + " already exists.");<a name="line.1322"></a>
+<span class="sourceLineNo">1323</span>    }<a name="line.1323"></a>
+<span class="sourceLineNo">1324</span>  }<a name="line.1324"></a>
+<span class="sourceLineNo">1325</span><a name="line.1325"></a>
+<span class="sourceLineNo">1326</span>  /**<a name="line.1326"></a>
+<span class="sourceLineNo">1327</span>   * Add coprocessor to values Map<a name="line.1327"></a>
+<span class="sourceLineNo">1328</span>   * @param specStr The Coprocessor specification all in in one String formatted so matches<a name="line.1328"></a>
+<span class="sourceLineNo">1329</span>   * {@link HConstants#CP_HTD_ATTR_VALUE_PATTERN}<a name="line.1329"></a>
+<span class="sourceLineNo">1330</span>   * @return Returns &lt;code&gt;this&lt;/code&gt;<a name="line.1330"></a>
+<span class="sourceLineNo">1331</span>   */<a name="line.1331"></a>
+<span class="sourceLineNo">1332</span>  private HTableDescriptor addCoprocessorToMap(final String specStr) {<a name="line.1332"></a>
+<span class="sourceLineNo">1333</span>    if (specStr == null) return this;<a name="line.1333"></a>
+<span class="sourceLineNo">1334</span>    // generate a coprocessor key<a name="line.1334"></a>
+<span class="sourceLineNo">1335</span>    int maxCoprocessorNumber = 0;<a name="line.1335"></a>
+<span class="sourceLineNo">1336</span>    Matcher keyMatcher;<a name="line.1336"></a>
+<span class="sourceLineNo">1337</span>    for (Map.Entry&lt;Bytes, Bytes&gt; e: this.values.entrySet()) {<a name="line.1337"></a>
+<span class="sourceLineNo">1338</span>      keyMatcher = HConstants.CP_HTD_ATTR_KEY_PATTERN.matcher(Bytes.toString(e.getKey().get()));<a name="line.1338"></a>
+<span class="sourceLineNo">1339</span>      if (!keyMatcher.matches()) {<a name="line.1339"></a>
+<span class="sourceLineNo">1340</span>        continue;<a name="line.1340"></a>
+<span class="sourceLineNo">1341</span>      }<a name="line.1341"></a>
+<span class="sourceLineNo">1342</span>      maxCoprocessorNumber = Math.max(Integer.parseInt(keyMatcher.group(1)), maxCoprocessorNumber);<a name="line.1342"></a>
+<span class="sourceLineNo">1343</span>    }<a name="line.1343"></a>
+<span class="sourceLineNo">1344</span>    maxCoprocessorNumber++;<a name="line.1344"></a>
+<span class="sourceLineNo">1345</span>    String key = "coprocessor$" + Integer.toString(maxCoprocessorNumber);<a name="line.1345"></a>
+<span class="sourceLineNo">1346</span>    this.values.put(new Bytes(Bytes.toBytes(key)), new Bytes(Bytes.toBytes(specStr)));<a name="line.1346"></a>
+<span class="sourceLineNo">1347</span>    return this;<a name="line.1347"></a>
+<span class="sourceLineNo">1348</span>  }<a name="line.1348"></a>
+<span class="sourceLineNo">1349</span><a name="line.1349"></a>
+<span class="sourceLineNo">1350</span>  /**<a name="line.1350"></a>
+<span class="sourceLineNo">1351</span>   * Check if the table has an attached co-processor represented by the name className<a name="line.1351"></a>
+<span class="sourceLineNo">1352</span>   *<a name="line.1352"></a>
+<span class="sourceLineNo">1353</span>   * @param classNameToMatch - Class name of the co-processor<a name="line.1353"></a>
+<span class="sourceLineNo">1354</span>   * @return true of the table has a co-processor className<a name="line.1354"></a>
+<span class="sourceLineNo">1355</span>   */<a name="line.1355"></a>
+<span class="sourceLineNo">1356</span>  public boolean hasCoprocessor(String classNameToMatch) {<a name="line.1356"></a>
+<span class="sourceLineNo">1357</span>    Matcher keyMatcher;<a name="line.1357"></a>
+<span class="sourceLineNo">1358</span>    for (Map.Entry&lt;Bytes, Bytes&gt; e :<a name="line.1358"></a>
+<span class="sourceLineNo">1359</span>        this.values.entrySet()) {<a name="line.1359"></a>
+<span class="sourceLineNo">1360</span>      keyMatcher =<a name="line.1360"></a>
+<span class="sourceLineNo">1361</span>          HConstants.CP_HTD_ATTR_KEY_PATTERN.matcher(<a name="line.1361"></a>
+<span class="sourceLineNo">1362</span>              Bytes.toString(e.getKey().get()));<a name="line.1362"></a>
+<span class="sourceLineNo">1363</span>      if (!keyMatcher.matches()) {<a name="line.1363"></a>
+<span class="sourceLineNo">1364</span>        continue;<a name="line.1364"></a>
+<span class="sourceLineNo">1365</span>      }<a name="line.1365"></a>
+<span class="sourceLineNo">1366</span>      String className = getCoprocessorClassNameFromSpecStr(Bytes.toString(e.getValue().get()));<a name="line.1366"></a>
+<span class="sourceLineNo">1367</span>      if (className == null) continue;<a name="line.1367"></a>
+<span class="sourceLineNo">1368</span>      if (className.equals(classNameToMatch.trim())) {<a name="line.1368"></a>
+<span class="sourceLineNo">1369</span>        return true;<a name="line.1369"></a>
+<span class="sourceLineNo">1370</span>      }<a name="line.1370"></a>
+<span class="sourceLineNo">1371</span>    }<a name="line.1371"></a>
+<span class="sourceLineNo">1372</span>    return false;<a name="line.1372"></a>
+<span class="sourceLineNo">1373</span>  }<a name="line.1373"></a>
+<span class="sourceLineNo">1374</span><a name="line.1374"></a>
+<span class="sourceLineNo">1375</span>  /**<a name="line.1375"></a>
+<span class="sourceLineNo">1376</span>   * Return the list of attached co-processor represented by their name className<a name="line.1376"></a>
+<span class="sourceLineNo">1377</span>   *<a name="line.1377"></a>
+<span class="sourceLineNo">1378</span>   * @return The list of co-processors classNames<a name="line.1378"></a>
+<span class="sourceLineNo">1379</span>   */<a name="line.1379"></a>
+<span class="sourceLineNo">1380</span>  public List&lt;String&gt; getCoprocessors() {<a name="line.1380"></a>
+<span class="sourceLineNo">1381</span>    List&lt;String&gt; result = new ArrayList&lt;String&gt;();<a name="line.1381"></a>
+<span class="sourceLineNo">1382</span>    Matcher keyMatcher;<a name="line.1382"></a>
+<span class="sourceLineNo">1383</span>    for (Map.Entry&lt;Bytes, Bytes&gt; e : this.values.entrySet()) {<a name="line.1383"></a>
+<span class="sourceLineNo">1384</span>      keyMatcher = HConstants.CP_HTD_ATTR_KEY_PATTERN.matcher(Bytes.toString(e.getKey().get()));<a name="line.1384"></a>
+<span class="sourceLineNo">1385</span>      if (!keyMatcher.matches()) {<a name="line.1385"></a>
+<span class="sourceLineNo">1386</span>        continue;<a name="line.1386"></a>
+<span class="sourceLineNo">1387</span>      }<a name="line.1387"></a>
+<span class="sourceLineNo">1388</span>      String className = getCoprocessorClassNameFromSpecStr(Bytes.toString(e.getValue().get()));<a name="line.1388"></a>
+<span class="sourceLineNo">1389</span>      if (className == null) continue;<a name="line.1389"></a>
+<span class="sourceLineNo">1390</span>      result.add(className); // classname is the 2nd field<a name="line.1390"></a>
+<span class="sourceLineNo">1391</span>    }<a name="line.1391"></a>
+<span class="sourceLineNo">1392</span>    return result;<a name="line.1392"></a>
+<span class="sourceLineNo">1393</span>  }<a name="line.1393"></a>
+<span class="sourceLineNo">1394</span><a name="line.1394"></a>
+<span class="sourceLineNo">1395</span>  /**<a name="line.1395"></a>
+<span class="sourceLineNo">1396</span>   * @param spec String formatted as per {@link HConstants#CP_HTD_ATTR_VALUE_PATTERN}<a name="line.1396"></a>
+<span class="sourceLineNo">1397</span>   * @return Class parsed from passed in &lt;code&gt;spec&lt;/code&gt; or null if no match or classpath found<a name="line.1397"></a>
+<span class="sourceLineNo">1398</span>   */<a name="line.1398"></a>
+<span class="sourceLineNo">1399</span>  private static String getCoprocessorClassNameFromSpecStr(final String spec) {<a name="line.1399"></a>
+<span class="sourceLineNo">1400</span>    Matcher matcher = HConstants.CP_HTD_ATTR_VALUE_PATTERN.matcher(spec);<a name="line.1400"></a>
+<span class="sourceLineNo">1401</span>    // Classname is the 2nd field<a name="line.1401"></a>
+<span class="sourceLineNo">1402</span>    return matcher != null &amp;&amp; matcher.matches()? matcher.group(2).trim(): null;<a name="line.1402"></a>
+<span class="sourceLineNo">1403</span>  }<a name="line.1403"></a>
+<span class="sourceLineNo">1404</span><a name="line.1404"></a>
+<span class="sourceLineNo">1405</span>  /**<a name="line.1405"></a>
+<span class="sourceLineNo">1406</span>   * Remove a coprocessor from those set on the table<a name="line.1406"></a>
+<span class="sourceLineNo">1407</span>   * @param className Class name of the co-processor<a name="line.1407"></a>
+<span class="sourceLineNo">1408</span>   */<a name="line.1408"></a>
+<span class="sourceLineNo">1409</span>  public void removeCoprocessor(String className) {<a name="line.1409"></a>
+<span class="sourceLineNo">1410</span>    Bytes match = null;<a name="line.1410"></a>
+<span class="sourceLineNo">1411</span>    Matcher keyMatcher;<a name="line.1411"></a>
+<span class="sourceLineNo">1412</span>    Matcher valueMatcher;<a name="line.1412"></a>
+<span class="sourceLineNo">1413</span>    for (Map.Entry&lt;Bytes, Bytes&gt; e : this.values<a name="line.1413"></a>
+<span class="sourceLineNo">1414</span>        .entrySet()) {<a name="line.1414"></a>
+<span class="sourceLineNo">1415</span>      keyMatcher = HConstants.CP_HTD_ATTR_KEY_PATTERN.matcher(Bytes.toString(e<a name="line.1415"></a>
+<span class="sourceLineNo">1416</span>          .getKey().get()));<a name="line.1416"></a>
+<span class="sourceLineNo">1417</span>      if (!keyMatcher.matches()) {<a name="line.1417"></a>
+<span class="sourceLineNo">1418</span>        continue;<a name="line.1418"></a>
 <span class="sourceLineNo">1419</span>      }<a name="line.1419"></a>
-<span class="sourceLineNo">1420</span>    }<a name="line.1420"></a>
-<span class="sourceLineNo">1421</span>    // if we found a match, remove it<a name="line.1421"></a>
-<span class="sourceLineNo">1422</span>    if (match != null)<a name="line.1422"></a>
-<span class="sourceLineNo">1423</span>      remove(match);<a name="line.1423"></a>
-<span class="sourceLineNo">1424</span>  }<a name="line.1424"></a>
-<span class="sourceLineNo">1425</span><a name="line.1425"></a>
-<span class="sourceLineNo">1426</span>  /**<a name="line.1426"></a>
-<span class="sourceLineNo">1427</span>   * Returns the {@link Path} object representing the table directory under<a name="line.1427"></a>
-<span class="sourceLineNo">1428</span>   * path rootdir<a name="line.1428"></a>
-<span class="sourceLineNo">1429</span>   *<a name="line.1429"></a>
-<span class="sourceLineNo">1430</span>   * Deprecated use FSUtils.getTableDir() instead.<a name="line.1430"></a>
-<span class="sourceLineNo">1431</span>   *<a name="line.1431"></a>
-<span class="sourceLineNo">1432</span>   * @param rootdir qualified path of HBase root directory<a name="line.1432"></a>
-<span class="sourceLineNo">1433</span>   * @param tableName name of table<a name="line.1433"></a>
-<span class="sourceLineNo">1434</span>   * @return {@link Path} for table<a name="line.1434"></a>
-<span class="sourceLineNo">1435</span>   */<a name="line.1435"></a>
-<span class="sourceLineNo">1436</span>  @Deprecated<a name="line.1436"></a>
-<span class="sourceLineNo">1437</span>  public static Path getTableDir(Path rootdir, final byte [] tableName) {<a name="line.1437"></a>
-<span class="sourceLineNo">1438</span>    //This is bad I had to mirror code from FSUTils.getTableDir since<a name="line.1438"></a>
-<span class="sourceLineNo">1439</span>    //there is no module dependency between hbase-client and hbase-server<a name="line.1439"></a>
-<span class="sourceLineNo">1440</span>    TableName name = TableName.valueOf(tableName);<a name="line.1440"></a>
-<span class="sourceLineNo">1441</span>    return new Path(rootdir, new Path(HConstants.BASE_NAMESPACE_DIR,<a name="line.1441"></a>
-<span class="sourceLineNo">1442</span>              new Path(name.getNamespaceAsString(), new Path(name.getQualifierAsString()))));<a name="line.1442"></a>
-<span class="sourceLineNo">1443</span>  }<a name="line.1443"></a>
-<span class="sourceLineNo">1444</span><a name="line.1444"></a>
-<span class="sourceLineNo">1445</span>  public final static String NAMESPACE_FAMILY_INFO = "info";<a name="line.1445"></a>
-<span class="sourceLineNo">1446</span>  public final static byte[] NAMESPACE_FAMILY_INFO_BYTES = Bytes.toBytes(NAMESPACE_FAMILY_INFO);<a name="line.1446"></a>
-<span class="sourceLineNo">1447</span>  public final static byte[] NAMESPACE_COL_DESC_BYTES = Bytes.toBytes("d");<a name="line.1447"></a>
-<span class="sourceLineNo">1448</span><a name="line.1448"></a>
-<span class="sourceLineNo">1449</span>  /** Table descriptor for namespace table */<a name="line.1449"></a>
-<span class="sourceLineNo">1450</span>  public static final HTableDescriptor NAMESPACE_TABLEDESC = new HTableDescriptor(<a name="line.1450"></a>
-<span class="sourceLineNo">1451</span>      TableName.NAMESPACE_TABLE_NAME,<a name="line.1451"></a>
-<span class="sourceLineNo">1452</span>      new HColumnDescriptor[] {<a name="line.1452"></a>
-<span class="sourceLineNo">1453</span>          new HColumnDescriptor(NAMESPACE_FAMILY_INFO)<a name="line.1453"></a>
-<span class="sourceLineNo">1454</span>              // Ten is arbitrary number.  Keep versions to help debugging.<a name="line.1454"></a>
-<span class="sourceLineNo">1455</span>              .setMaxVersions(10)<a name="line.1455"></a>
-<span class="sourceLineNo">1456</span>              .setInMemory(true)<a name="line.1456"></a>
-<span class="sourceLineNo">1457</span>              .setBlocksize(8 * 1024)<a name="line.1457"></a>
-<span class="sourceLineNo">1458</span>              .setScope(HConstants.REPLICATION_SCOPE_LOCAL)<a name="line.1458"></a>
-<span class="sourceLineNo">1459</span>              // Enable cache of data blocks in L1 if more than one caching tier deployed:<a name="line.1459"></a>
-<span class="sourceLineNo">1460</span>              // e.g. if using CombinedBlockCache (BucketCache).<a name="line.1460"></a>
-<span class="sourceLineNo">1461</span>              .setCacheDataInL1(true)<a name="line.1461"></a>
-<span class="sourceLineNo">1462</span>      });<a name="line.1462"></a>
-<span class="sourceLineNo">1463</span><a name="line.1463"></a>
-<span class="sourceLineNo">1464</span>  @Deprecated<a name="line.1464"></a>
-<span class="sourceLineNo">1465</span>  public HTableDescriptor setOwner(User owner) {<a name="line.1465"></a>
-<span class="sourceLineNo">1466</span>    return setOwnerString(owner != null ? owner.getShortName() : null);<a name="line.1466"></a>
-<span class="sourceLineNo">1467</span>  }<a name="line.1467"></a>
-<span class="sourceLineNo">1468</span><a name="line.1468"></a>
-<span class="sourceLineNo">1469</span>  // used by admin.rb:alter(table_name,*args) to update owner.<a name="line.1469"></a>
-<span class="sourceLineNo">1470</span>  @Deprecated<a name="line.1470"></a>
-<span class="sourceLineNo">1471</span>  public HTableDescriptor setOwnerString(String ownerString) {<a name="line.1471"></a>
-<span class="sourceLineNo">1472</span>    if (ownerString != null) {<a name="line.1472"></a>
-<span class="sourceLineNo">1473</span>      setValue(OWNER_KEY, ownerString);<a name="line.1473"></a>
-<span class="sourceLineNo">1474</span>    } else {<a name="line.1474"></a>
-<span class="sourceLineNo">1475</span>      remove(OWNER_KEY);<a name="line.1475"></a>
-<span class="sourceLineNo">1476</span>    }<a name="line.1476"></a>
-<span class="sourceLineNo">1477</span>    return this;<a name="line.1477"></a>
-<span class="sourceLineNo">1478</span>  }<a name="line.1478"></a>
-<span class="sourceLineNo">1479</span><a name="line.1479"></a>
-<span class="sourceLineNo">1480</span>  @Deprecated<a name="line.1480"></a>
-<span class="sourceLineNo">1481</span>  public String getOwnerString() {<a name="line.1481"></a>
-<span class="sourceLineNo">1482</span>    if (getValue(OWNER_KEY) != null) {<a name="line.1482"></a>
-<span class="sourceLineNo">1483</span>      return Bytes.toString(getValue(OWNER_KEY));<a name="line.1483"></a>
-<span class="sourceLineNo">1484</span>    }<a name="line.1484"></a>
-<span class="sourceLineNo">1485</span>    // Note that every table should have an owner (i.e. should have OWNER_KEY set).<a name="line.1485"></a>
-<span class="sourceLineNo">1486</span>    // hbase:meta and -ROOT- should return system user as owner, not null (see<a name="line.1486"></a>
-<span class="sourceLineNo">1487</span>    // MasterFileSystem.java:bootstrap()).<a name="line.1487"></a>
-<span class="sourceLineNo">1488</span>    return null;<a name="line.1488"></a>
-<span class="sourceLineNo">1489</span>  }<a name="line.1489"></a>
-<span class="sourceLineNo">1490</span><a name="line.1490"></a>
-<span class="sourceLineNo">1491</span>  /**<a name="line.1491"></a>
-<span class="sourceLineNo">1492</span>   * @return This instance serialized with pb with pb magic prefix<a name="line.1492"></a>
-<span class="sourceLineNo">1493</span>   * @see #parseFrom(byte[])<a name="line.1493"></a>
-<span class="sourceLineNo">1494</span>   */<a name="line.1494"></a>
-<span class="sourceLineNo">1495</span>  public byte[] toByteArray() {<a name="line.1495"></a>
-<span class="sourceLineNo">1496</span>    return ProtobufUtil.prependPBMagic(ProtobufUtil.convertToTableSchema(this).toByteArray());<a name="line.1496"></a>
-<span class="sourceLineNo">1497</span>  }<a name="line.1497"></a>
-<span class="sourceLineNo">1498</span><a name="line.1498"></a>
-<span class="sourceLineNo">1499</span>  /**<a name="line.1499"></a>
-<span class="sourceLineNo">1500</span>   * @param bytes A pb serialized {@link HTableDescriptor} instance with pb magic prefix<a name="line.1500"></a>
-<span class="sourceLineNo">1501</span>   * @return An instance of {@link HTableDescriptor} made from &lt;code&gt;bytes&lt;/code&gt;<a name="line.1501"></a>
-<span class="sourceLineNo">1502</span>   * @throws DeserializationException<a name="line.1502"></a>
-<span class="sourceLineNo">1503</span>   * @throws IOException<a name="line.1503"></a>
-<span class="sourceLineNo">1504</span>   * @see #toByteArray()<a name="line.1504"></a>
-<span class="sourceLineNo">1505</span>   */<a name="line.1505"></a>
-<span class="sourceLineNo">1506</span>  public static HTableDescriptor parseFrom(final byte [] bytes)<a name="line.1506"></a>
-<span class="sourceLineNo">1507</span>  throws DeserializationException, IOException {<a name="line.1507"></a>
-<span class="sourceLineNo">1508</span>    if (!ProtobufUtil.isPBMagicPrefix(bytes)) {<a name="line.1508"></a>
-<span class="sourceLineNo">1509</span>      throw new DeserializationException("Expected PB encoded HTableDescriptor");<a name="line.1509"></a>
-<span class="sourceLineNo">1510</span>    }<a name="line.1510"></a>
-<span class="sourceLineNo">1511</span>    int pblen = ProtobufUtil.lengthOfPBMagic();<a name="line.1511"></a>
-<span class="sourceLineNo">1512</span>    TableSchema.Builder builder = TableSchema.newBuilder();<a name="line.1512"></a>
-<span class="sourceLineNo">1513</span>    TableSchema ts;<a name="line.1513"></a>
-<span class="sourceLineNo">1514</span>    try {<a name="line.1514"></a>
-<span class="sourceLineNo">1515</span>      ProtobufUtil.mergeFrom(builder, bytes, pblen, bytes.length - pblen);<a name="line.1515"></a>
-<span class="sourceLineNo">1516</span>      ts = builder.build();<a name="line.1516"></a>
-<span class="sourceLineNo">1517</span>    } catch (IOException e) {<a name="line.1517"></a>
-<span class="sourceLineNo">1518</span>      throw new DeserializationException(e);<a name="line.1518"></a>
-<span class="sourceLineNo">1519</span>    }<a name="line.1519"></a>
-<span class="sourceLineNo">1520</span>    return ProtobufUtil.convertToHTableDesc(ts);<a name="line.1520"></a>
-<span class="sourceLineNo">1521</span>  }<a name="line.1521"></a>
-<span class="sourceLineNo">1522</span><a name="line.1522"></a>
-<span class="sourceLineNo">1523</span>  /**<a name="line.1523"></a>
-<span class="sourceLineNo">1524</span>   * Getter for accessing the configuration value by key<a name="line.1524"></a>
-<span class="sourceLineNo">1525</span>   */<a name="line.1525"></a>
-<span class="sourceLineNo">1526</span>  public String getConfigurationValue(String key) {<a name="line.1526"></a>
-<span class="sourceLineNo">1527</span>    return configuration.get(key);<a name="line.1527"></a>
-<span class="sourceLineNo">1528</span>  }<a name="line.1528"></a>
-<span class="sourceLineNo">1529</span><a name="line.1529"></a>
-<span class="sourceLineNo">1530</span>  /**<a name="line.1530"></a>
-<span class="sourceLineNo">1531</span>   * Getter for fetching an unmodifiable {@link #configuration} map.<a name="line.1531"></a>
-<span class="sourceLineNo">1532</span>   */<a name="line.1532"></a>
-<span class="sourceLineNo">1533</span>  public Map&lt;String, String&gt; getConfiguration() {<a name="line.1533"></a>
-<span class="sourceLineNo">1534</span>    // shallow pointer copy<a name="line.1534"></a>
-<span class="sourceLineNo">1535</span>    return Collections.unmodifiableMap(configuration);<a name="line.1535"></a>
-<span class="sourceLineNo">1536</span>  }<a name="line.1536"></a>
-<span class="sourceLineNo">1537</span><a name="line.1537"></a>
-<span class="sourceLineNo">1538</span>  /**<a name="line.1538"></a>
-<span class="sourceLineNo">1539</span>   * Setter for storing a configuration setting in {@link #configuration} map.<a name="line.1539"></a>
-<span class="sourceLineNo">1540</span>   * @param key Config key. Same as XML config key e.g. hbase.something.or.other.<a name="line.1540"></a>
-<span class="sourceLineNo">1541</span>   * @param value String value. If null, removes the setting.<a name="line.1541"></a>
-<span class="sourceLineNo">1542</span>   */<a name="line.1542"></a>
-<span class="sourceLineNo">1543</span>  public HTableDescriptor setConfiguration(String key, String value) {<a name="line.1543"></a>
-<span class="sourceLineNo">1544</span>    if (value == null) {<a name="line.1544"></a>
-<span class="sourceLineNo">1545</span>      removeConfiguration(key);<a name="line.1545"></a>
-<span class="sourceLineNo">1546</span>    } else {<a name="line.1546"></a>
-<span class="sourceLineNo">1547</span>      configuration.put(key, value);<a name="line.1547"></a>
-<span class="sourceLineNo">1548</span>    }<a name="line.1548"></a>
-<span class="sourceLineNo">1549</span>    return this;<a name="line.1549"></a>
-<span class="sourceLineNo">1550</span>  }<a name="line.1550"></a>
-<span class="sourceLineNo">1551</span><a name="line.1551"></a>
-<span class="sourceLineNo">1552</span>  /**<a name="line.1552"></a>
-<span class="sourceLineNo">1553</span>   * Remove a config setting represented by the key from the {@link #configuration} map<a name="line.1553"></a>
+<span class="sourceLineNo">1420</span>      valueMatcher = HConstants.CP_HTD_ATTR_VALUE_PATTERN.matcher(Bytes<a name="line.1420"></a>
+<span class="sourceLineNo">1421</span>          .toString(e.getValue().get()));<a name="line.1421"></a>
+<span class="sourceLineNo">1422</span>      if (!valueMatcher.matches()) {<a name="line.1422"></a>
+<span class="sourceLineNo">1423</span>        continue;<a name="line.1423"></a>
+<span class="sourceLineNo">1424</span>      }<a name="line.1424"></a>
+<span class="sourceLineNo">1425</span>      // get className and compare<a name="line.1425"></a>
+<span class="sourceLineNo">1426</span>      String clazz = valueMatcher.group(2).trim(); // classname is the 2nd field<a name="line.1426"></a>
+<span class="sourceLineNo">1427</span>      // remove the CP if it is present<a name="line.1427"></a>
+<span class="sourceLineNo">1428</span>      if (clazz.equals(className.trim())) {<a name="line.1428"></a>
+<span class="sourceLineNo">1429</span>        match = e.getKey();<a name="line.1429"></a>
+<span class="sourceLineNo">1430</span>        break;<a name="line.1430"></a>
+<span class="sourceLineNo">1431</span>      }<a name="line.1431"></a>
+<span class="sourceLineNo">1432</span>    }<a name="line.1432"></a>
+<span class="sourceLineNo">1433</span>    // if we found a match, remove it<a name="line.1433"></a>
+<span class="sourceLineNo">1434</span>    if (match != null)<a name="line.1434"></a>
+<span class="sourceLineNo">1435</span>      remove(match);<a name="line.1435"></a>
+<span class="sourceLineNo">1436</span>  }<a name="line.1436"></a>
+<span class="sourceLineNo">1437</span><a name="line.1437"></a>
+<span class="sourceLineNo">1438</span>  /**<a name="line.1438"></a>
+<span class="sourceLineNo">1439</span>   * Returns the {@link Path} object representing the table directory under<a name="line.1439"></a>
+<span class="sourceLineNo">1440</span>   * path rootdir<a name="line.1440"></a>
+<span class="sourceLineNo">1441</span>   *<a name="line.1441"></a>
+<span class="sourceLineNo">1442</span>   * Deprecated use FSUtils.getTableDir() instead.<a name="line.1442"></a>
+<span class="sourceLineNo">1443</span>   *<a name="line.1443"></a>
+<span class="sourceLineNo">1444</span>   * @param rootdir qualified path of HBase root directory<a name="line.1444"></a>
+<span class="sourceLineNo">1445</span>   * @param tableName name of table<a name="line.1445"></a>
+<span class="sourceLineNo">1446</span>   * @return {@link Path} for table<a name="line.1446"></a>
+<span class="sourceLineNo">1447</span>   */<a name="line.1447"></a>
+<span class="sourceLineNo">1448</span>  @Deprecated<a name="line.1448"></a>
+<span class="sourceLineNo">1449</span>  public static Path getTableDir(Path rootdir, final byte [] tableName) {<a name="line.1449"></a>
+<span class="sourceLineNo">1450</span>    //This is bad I had to mirror code from FSUTils.getTableDir since<a name="line.1450"></a>
+<span class="sourceLineNo">1451</span>    //there is no module dependency between hbase-client and hbase-server<a name="line.1451"></a>
+<span class="sourceLineNo">1452</span>    TableName name = TableName.valueOf(tableName);<a name="line.1452"></a>
+<span class="sourceLineNo">1453</span>    return new Path(rootdir, new Path(HConstants.BASE_NAMESPACE_DIR,<a name="line.1453"></a>
+<span class="sourceLineNo">1454</span>              new Path(name.getNamespaceAsString(), new Path(name.getQualifierAsString()))));<a name="line.1454"></a>
+<span class="sourceLineNo">1455</span>  }<a name="line.1455"></a>
+<span class="sourceLineNo">1456</span><a name="line.1456"></a>
+<span class="sourceLineNo">1457</span>  public final static String NAMESPACE_FAMILY_INFO = "info";<a name="line.1457"></a>
+<span class="sourceLineNo">1458</span>  public final static byte[] NAMESPACE_FAMILY_INFO_BYTES = Bytes.toBytes(NAMESPACE_FAMILY_INFO);<a name="line.1458"></a>
+<span class="sourceLineNo">1459</span>  public final static byte[] NAMESPACE_COL_DESC_BYTES = Bytes.toBytes("d");<a name="line.1459"></a>
+<span class="sourceLineNo">1460</span><a name="line.1460"></a>
+<span class="sourceLineNo">1461</span>  /** Table descriptor for namespace table */<a name="line.1461"></a>
+<span class="sourceLineNo">1462</span>  public static final HTableDescriptor NAMESPACE_TABLEDESC = new HTableDescriptor(<a name="line.1462"></a>
+<span class="sourceLineNo">1463</span>      TableName.NAMESPACE_TABLE_NAME,<a name="line.1463"></a>
+<span class="sourceLineNo">1464</span>      new HColumnDescriptor[] {<a name="line.1464"></a>
+<span class="sourceLineNo">1465</span>          new HColumnDescriptor(NAMESPACE_FAMILY_INFO)<a name="line.1465"></a>
+<span class="sourceLineNo">1466</span>              // Ten is arbitrary number.  Keep versions to help debugging.<a name="line.1466"></a>
+<span class="sourceLineNo">1467</span>              .setMaxVersions(10)<a name="line.1467"></a>
+<span class="sourceLineNo">1468</span>              .setInMemory(true)<a name="line.1468"></a>
+<span class="sourceLineNo">1469</span>              .setBlocksize(8 * 1024)<a name="line.1469"></a>
+<span class="sourceLineNo">1470</span>              .setScope(HConstants.REPLICATION_SCOPE_LOCAL)<a name="line.1470"></a>
+<span class="sourceLineNo">1471</span>              // Enable cache of data blocks in L1 if more than one caching tier deployed:<a name="line.1471"></a>
+<span class="sourceLineNo">1472</span>              // e.g. if using CombinedBlockCache (BucketCache).<a name="line.1472"></a>
+<span class="sourceLineNo">1473</span>              .setCacheDataInL1(true)<a name="line.1473"></a>
+<span class="sourceLineNo">1474</span>      });<a name="line.1474"></a>
+<span class="sourceLineNo">1475</span><a name="line.1475"></a>
+<span class="sourceLineNo">1476</span>  @Deprecated<a name="line.1476"></a>
+<span class="sourceLineNo">1477</span>  public HTableDescriptor setOwner(User owner) {<a name="line.1477"></a>
+<span class="sourceLineNo">1478</span>    return setOwnerString(owner != null ? owner.getShortName() : null);<a name="line.1478"></a>
+<span class="sourceLineNo">1479</span>  }<a name="line.1479"></a>
+<span class="sourceLineNo">1480</span><a name="line.1480"></a>
+<span class="sourceLineNo">1481</span>  // used by admin.rb:alter(table_name,*args) to update owner.<a name="line.1481"></a>
+<span class="sourceLineNo">1482</span>  @Deprecated<a name="line.1482"></a>
+<span class="sourceLineNo">1483</span>  public HTableDescriptor setOwnerString(String ownerString) {<a name="line.1483"></a>
+<span class="sourceLineNo">1484</span>    if (ownerString != null) {<a name="line.1484"></a>
+<span class="sourceLineNo">1485</span>      setValue(OWNER_KEY, ownerString);<a name="line.1485"></a>
+<span class="sourceLineNo">1486</span>    } else {<a name="line.1486"></a>
+<span class="sourceLineNo">1487</span>      remove(OWNER_KEY);<a name="line.1487"></a>
+<span class="sourceLineNo">1488</span>    }<a name="line.1488"></a>
+<span class="sourceLineNo">1489</span>    return this;<a name="line.1489"></a>
+<span class="sourceLineNo">1490</span>  }<a name="line.1490"></a>
+<span class="sourceLineNo">1491</span><a name="line.1491"></a>
+<span class="sourceLineNo">1492</span>  @Deprecated<a name="line.1492"></a>
+<span class="sourceLineNo">1493</span>  public String getOwnerString() {<a name="line.1493"></a>
+<span class="sourceLineNo">1494</span>    if (getValue(OWNER_KEY) != null) {<a name="line.1494"></a>
+<span class="sourceLineNo">1495</span>      return Bytes.toString(getValue(OWNER_KEY));<a name="line.1495"></a>
+<span class="sourceLineNo">1496</span>    }<a name="line.1496"></a>
+<span class="sourceLineNo">1497</span>    // Note that every table should have an owner (i.e. should have OWNER_KEY set).<a name="line.1497"></a>
+<span class="sourceLineNo">1498</span>    // hbase:meta and -ROOT- should return system user as owner, not null (see<a name="line.1498"></a>
+<span class="sourceLineNo">1499</span>    // MasterFileSystem.java:bootstrap()).<a name="line.1499"></a>
+<span class="sourceLineNo">1500</span>    return null;<a name="line.1500"></a>
+<span class="sourceLineNo">1501</span>  }<a name="line.1501"></a>
+<span class="sourceLineNo">1502</span><a name="line.1502"></a>
+<span class="sourceLineNo">1503</span>  /**<a name="line.1503"></a>
+<span class="sourceLineNo">1504</span>   * @return This instance serialized with pb with pb magic prefix<a name="line.1504"></a>
+<span class="sourceLineNo">1505</span>   * @see #parseFrom(byte[])<a name="line.1505"></a>
+<span class="sourceLineNo">1506</span>   */<a name="line.1506"></a>
+<span class="sourceLineNo">1507</span>  public byte[] toByteArray() {<a name="line.1507"></a>
+<span class="sourceLineNo">1508</span>    return ProtobufUtil.prependPBMagic(ProtobufUtil.convertToTableSchema(this).toByteArray());<a name="line.1508"></a>
+<span class="sourceLineNo">1509</span>  }<a name="line.1509"></a>
+<span class="sourceLineNo">1510</span><a name="line.1510"></a>
+<span class="sourceLineNo">1511</span>  /**<a name="line.1511"></a>
+<span class="sourceLineNo">1512</span>   * @param bytes A pb serialized {@link HTableDescriptor} instance with pb magic prefix<a name="line.1512"></a>
+<span class="sourceLineNo">1513</span>   * @return An instance of {@link HTableDescriptor} made from &lt;code&gt;bytes&lt;/code&gt;<a name="line.1513"></a>
+<span class="sourceLineNo">1514</span>   * @throws DeserializationException<a name="line.1514"></a>
+<span class="sourceLineNo">1515</span>   * @throws IOException<a name="line.1515"></a>
+<span class="sourceLineNo">1516</span>   * @see #toByteArray()<a name="line.1516"></a>
+<span class="sourceLineNo">1517</span>   */<a name="line.1517"></a>
+<span class="sourceLineNo">1518</span>  public static HTableDescriptor parseFrom(final byte [] bytes)<a name="line.1518"></a>
+<span class="sourceLineNo">1519</span>  throws DeserializationException, IOException {<a name="line.1519"></a>
+<span class="sourceLineNo">1520</span>    if (!ProtobufUtil.isPBMagicPrefix(bytes)) {<a name="line.1520"></a>
+<span class="sourceLineNo">1521</span>      throw new DeserializationException("Expected PB encoded HTableDescriptor");<a name="line.1521"></a>
+<span class="sourceLineNo">1522</span>    }<a name="line.1522"></a>
+<span class="sourceLineNo">1523</span>    int pblen = ProtobufUtil.lengthOfPBMagic();<a name="line.1523"></a>
+<span class="sourceLineNo">1524</span>    TableSchema.Builder builder = TableSchema.newBuilder();<a name="line.1524"></a>
+<span class="sourceLineNo">1525</span>    TableSchema ts;<a name="line.1525"></a>
+<span class="sourceLineNo">1526</span>    try {<a name="line.1526"></a>
+<span class="sourceLineNo">1527</span>      ProtobufUtil.mergeFrom(builder, bytes, pblen, bytes.length - pblen);<a name="line.1527"></a>
+<span class="sourceLineNo">1528</span>      ts = builder.build();<a name="line.1528"></a>
+<span class="sourceLineNo">1529</span>    } catch (IOException e) {<a name="line.1529"></a>
+<span class="sourceLineNo">1530</span>      throw new DeserializationException(e);<a name="line.1530"></a>
+<span class="sourceLineNo">1531</span>    }<a name="line.1531"></a>
+<span class="sourceLineNo">1532</span>    return ProtobufUtil.convertToHTableDesc(ts);<a name="line.1532"></a>
+<span class="sourceLineNo">1533</span>  }<a name="line.1533"></a>
+<span class="sourceLineNo">1534</span><a name="line.1534"></a>
+<span class="sourceLineNo">1535</span>  /**<a name="line.1535"></a>
+<span class="sourceLineNo">1536</span>   * Getter for accessing the configuration value by key<a name="line.1536"></a>
+<span class="sourceLineNo">1537</span>   */<a name="line.1537"></a>
+<span class="sourceLineNo">1538</span>  public String getConfigurationValue(String key) {<a name="line.1538"></a>
+<span class="sourceLineNo">1539</span>    return configuration.get(key);<a name="line.1539"></a>
+<span class="sourceLineNo">1540</span>  }<a name="line.1540"></a>
+<span class="sourceLineNo">1541</span><a name="line.1541"></a>
+<span class="sourceLineNo">1542</span>  /**<a name="line.1542"></a>
+<span class="sourceLineNo">1543</span>   * Getter for fetching an unmodifiable {@link #configuration} map.<a name="line.1543"></a>
+<span class="sourceLineNo">1544</span>   */<a name="line.1544"></a>
+<span class="sourceLineNo">1545</span>  public Map&lt;String, String&gt; getConfiguration() {<a name="line.1545"></a>
+<span class="sourceLineNo">1546</span>    // shallow pointer copy<a name="line.1546"></a>
+<span class="sourceLineNo">1547</span>    return Collections.unmodifiableMap(configuration);<a name="line.1547"></a>
+<span class="sourceLineNo">1548</span>  }<a name="line.1548"></a>
+<span class="sourceLineNo">1549</span><a name="line.1549"></a>
+<span class="sourceLineNo">1550</span>  /**<a name="line.1550"></a>
+<span class="sourceLineNo">1551</span>   * Setter for storing a configuration setting in {@link #configuration} map.<a name="line.1551"></a>
+<span class="sourceLineNo">1552</span>   * @param key Config key. Same as XML config key e.g. hbase.something.or.other.<a name="line.1552"></a>
+<span class="sourceLineNo">1553</span>   * @param value String value. If null, removes the setting.<a name="line.1553"></a>
 <span class="sourceLineNo">1554</span>   */<a name="line.1554"></a>
-<span class="sourceLineNo">1555</span>  public void removeConfiguration(final String key) {<a name="line.1555"></a>
-<span class="sourceLineNo">1556</span>    configuration.remove(key);<a name="line.1556"></a>
-<span class="sourceLineNo">1557</span>  }<a name="line.1557"></a>
-<span class="sourceLineNo">1558</span>}<a name="line.1558"></a>
+<span class="sourceLineNo">1555</span>  public HTableDescriptor setConfiguration(String key, String value) {<a name="line.1555"></a>
+<span class="sourceLineNo">1556</span>    if (value == null) {<a name="line.1556"></a>
+<span class="sourceLineNo">1557</span>      removeConfiguration(key);<a name="line.1557"></a>
+<span class="sourceLineNo">1558</span>    } else {<a name="line.1558"></a>
+<span class="sourceLineNo">1559</span>      configuration.put(key, value);<a name="line.1559"></a>
+<span class="sourceLineNo">1560</span>    }<a name="line.1560"></a>
+<span class="sourceLineNo">1561</span>    return this;<a name="line.1561"></a>
+<span class="sourceLineNo">1562</span>  }<a name="line.1562"></a>
+<span class="sourceLineNo">1563</span><a name="line.1563"></a>
+<span class="sourceLineNo">1564</span>  /**<a name="line.1564"></a>
+<span class="sourceLineNo">1565</span>   * Remove a config setting represented by the key from the {@link #configuration} map<a name="line.1565"></a>
+<span class="sourceLineNo">1566</span>   */<a name="line.1566"></a>
+<span class="sourceLineNo">1567</span>  public void removeConfiguration(final String key) {<a name="line.1567"></a>
+<span class="sourceLineNo">1568</span>    configuration.remove(key);<a name="line.1568"></a>
+<span class="sourceLineNo">1569</span>  }<a name="line.1569"></a>
+<span class="sourceLineNo">1570</span>}<a name="line.1570"></a>
 
 
 


Mime
View raw message