本文整理汇总了Java中org.apache.hadoop.hdfs.util.XMLUtils.InvalidXmlException类的典型用法代码示例。如果您正苦于以下问题:Java InvalidXmlException类的具体用法?Java InvalidXmlException怎么用?Java InvalidXmlException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InvalidXmlException类属于org.apache.hadoop.hdfs.util.XMLUtils包,在下文中一共展示了InvalidXmlException类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: readCacheDirectiveInfo
import org.apache.hadoop.hdfs.util.XMLUtils.InvalidXmlException; //导入依赖的package包/类
public static CacheDirectiveInfo readCacheDirectiveInfo(Stanza st)
throws InvalidXmlException {
CacheDirectiveInfo.Builder builder =
new CacheDirectiveInfo.Builder();
builder.setId(Long.parseLong(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.parseLong(expiryTime)));
}
return builder.build();
}
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:FSImageSerialization.java
示例2: readCachePoolInfo
import org.apache.hadoop.hdfs.util.XMLUtils.InvalidXmlException; //导入依赖的package包/类
public static CachePoolInfo readCachePoolInfo(Stanza st)
throws InvalidXmlException {
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.parseLong(st.getValue("LIMIT")));
}
if (st.hasChildren("MAXRELATIVEEXPIRY")) {
info.setMaxRelativeExpiryMs(
Long.parseLong(st.getValue("MAXRELATIVEEXPIRY")));
}
return info;
}
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:FSImageSerialization.java
示例3: fromXml
import org.apache.hadoop.hdfs.util.XMLUtils.InvalidXmlException; //导入依赖的package包/类
@Override
void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.parseInt(st.getValue("LENGTH"));
this.inodeId = Long.parseLong(st.getValue("INODEID"));
this.path = st.getValue("PATH");
this.replication = Short.valueOf(st.getValue("REPLICATION"));
this.mtime = Long.parseLong(st.getValue("MTIME"));
this.atime = Long.parseLong(st.getValue("ATIME"));
this.blockSize = Long.parseLong(st.getValue("BLOCKSIZE"));
this.clientName = st.getValue("CLIENT_NAME");
this.clientMachine = st.getValue("CLIENT_MACHINE");
this.overwrite = Boolean.parseBoolean(st.getValueOrNull("OVERWRITE"));
if (st.hasChildren("BLOCK")) {
List<Stanza> blocks = st.getChildren("BLOCK");
this.blocks = new Block[blocks.size()];
for (int i = 0; i < blocks.size(); i++) {
this.blocks[i] = FSEditLogOp.blockFromXml(blocks.get(i));
}
} else {
this.blocks = new Block[0];
}
this.permissions = permissionStatusFromXml(st);
aclEntries = readAclEntriesFromXml(st);
readRpcIdsFromXml(st);
}
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:FSEditLogOp.java
示例4: delegationTokenFromXml
import org.apache.hadoop.hdfs.util.XMLUtils.InvalidXmlException; //导入依赖的package包/类
public static DelegationTokenIdentifier delegationTokenFromXml(Stanza st)
throws InvalidXmlException {
String kind = st.getValue("KIND");
if (!kind.equals(DelegationTokenIdentifier.
HDFS_DELEGATION_KIND.toString())) {
throw new InvalidXmlException("can't understand " +
"DelegationTokenIdentifier KIND " + kind);
}
int seqNum = Integer.parseInt(st.getValue("SEQUENCE_NUMBER"));
String owner = st.getValue("OWNER");
String renewer = st.getValue("RENEWER");
String realuser = st.getValue("REALUSER");
long issueDate = Long.parseLong(st.getValue("ISSUE_DATE"));
long maxDate = Long.parseLong(st.getValue("MAX_DATE"));
int masterKeyId = Integer.parseInt(st.getValue("MASTER_KEY_ID"));
DelegationTokenIdentifier token =
new DelegationTokenIdentifier(new Text(owner),
new Text(renewer), new Text(realuser));
token.setSequenceNumber(seqNum);
token.setIssueDate(issueDate);
token.setMaxDate(maxDate);
token.setMasterKeyId(masterKeyId);
return token;
}
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:FSEditLogOp.java
示例5: readXAttrsFromXml
import org.apache.hadoop.hdfs.util.XMLUtils.InvalidXmlException; //导入依赖的package包/类
private static List<XAttr> readXAttrsFromXml(Stanza st)
throws InvalidXmlException {
if (!st.hasChildren("XATTR")) {
return null;
}
List<Stanza> stanzas = st.getChildren("XATTR");
List<XAttr> xattrs = Lists.newArrayListWithCapacity(stanzas.size());
for (Stanza a: stanzas) {
XAttr.Builder builder = new XAttr.Builder();
builder.setNameSpace(XAttr.NameSpace.valueOf(a.getValue("NAMESPACE"))).
setName(a.getValue("NAME"));
String v = a.getValueOrNull("VALUE");
if (v != null) {
try {
builder.setValue(XAttrCodec.decodeValue(v));
} catch (IOException e) {
throw new InvalidXmlException(e.toString());
}
}
xattrs.add(builder.build());
}
return xattrs;
}
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:FSEditLogOp.java
示例6: fromXml
import org.apache.hadoop.hdfs.util.XMLUtils.InvalidXmlException; //导入依赖的package包/类
@Override void fromXml(Stanza st) throws InvalidXmlException {
this.length = Integer.parseInt(st.getValue("LENGTH"));
this.trg = st.getValue("TRG");
this.timestamp = Long.parseLong(st.getValue("TIMESTAMP"));
List<Stanza> sources = st.getChildren("SOURCES");
int i = 0;
while (true) {
if (!sources.get(0).hasChildren("SOURCE" + (i + 1)))
break;
i++;
}
srcs = new String[i];
for (i = 0; i < srcs.length; i++) {
srcs[i] = sources.get(0).getValue("SOURCE" + (i + 1));
}
readRpcIdsFromXml(st);
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:18,代码来源:FSEditLogOp.java
示例7: blockFromXml
import org.apache.hadoop.hdfs.util.XMLUtils.InvalidXmlException; //导入依赖的package包/类
public static Block blockFromXml(Stanza st)
throws InvalidXmlException {
long blockId = Long.parseLong(st.getValue("BLOCK_ID"));
long numBytes = Long.parseLong(st.getValue("NUM_BYTES"));
long generationStamp = Long.parseLong(st.getValue("GENSTAMP"));
return new Block(blockId, numBytes, generationStamp);
}
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:FSEditLogOp.java
示例8: permissionStatusFromXml
import org.apache.hadoop.hdfs.util.XMLUtils.InvalidXmlException; //导入依赖的package包/类
public static PermissionStatus permissionStatusFromXml(Stanza st)
throws InvalidXmlException {
Stanza status = st.getChildren("PERMISSION_STATUS").get(0);
String username = status.getValue("USERNAME");
String groupname = status.getValue("GROUPNAME");
FsPermission mode = fsPermissionFromXml(status);
return new PermissionStatus(username, groupname, mode);
}
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:FSEditLogOp.java
注:本文中的org.apache.hadoop.hdfs.util.XMLUtils.InvalidXmlException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论