/// <exception cref="Org.Apache.Hadoop.Hdfs.Util.XMLUtils.InvalidXmlException"/> public static CachePoolInfo ReadCachePoolInfo(XMLUtils.Stanza st) { string poolName = st.GetValue("POOLNAME"); CachePoolInfo info = new CachePoolInfo(poolName); if (st.HasChildren("OWNERNAME")) { info.SetOwnerName(st.GetValue("OWNERNAME")); } if (st.HasChildren("GROUPNAME")) { info.SetGroupName(st.GetValue("GROUPNAME")); } if (st.HasChildren("MODE")) { info.SetMode(FSEditLogOp.FsPermissionFromXml(st)); } if (st.HasChildren("LIMIT")) { info.SetLimit(long.Parse(st.GetValue("LIMIT"))); } if (st.HasChildren("MAXRELATIVEEXPIRY")) { info.SetMaxRelativeExpiryMs(long.Parse(st.GetValue("MAXRELATIVEEXPIRY"))); } return(info); }
/// <exception cref="Org.Apache.Hadoop.Hdfs.Util.XMLUtils.InvalidXmlException"/> public static CacheDirectiveInfo ReadCacheDirectiveInfo(XMLUtils.Stanza st) { CacheDirectiveInfo.Builder builder = new CacheDirectiveInfo.Builder(); builder.SetId(long.Parse(st.GetValue("ID"))); string path = st.GetValueOrNull("PATH"); if (path != null) { builder.SetPath(new Path(path)); } string replicationString = st.GetValueOrNull("REPLICATION"); if (replicationString != null) { builder.SetReplication(short.ParseShort(replicationString)); } string pool = st.GetValueOrNull("POOL"); if (pool != null) { builder.SetPool(pool); } string expiryTime = st.GetValueOrNull("EXPIRATION"); if (expiryTime != null) { builder.SetExpiration(CacheDirectiveInfo.Expiration.NewAbsolute(long.Parse(expiryTime ))); } return(builder.Build()); }