当前位置: 首页>>代码示例>>Java>>正文


Java XMLUtils类代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.util.XMLUtils的典型用法代码示例。如果您正苦于以下问题:Java XMLUtils类的具体用法?Java XMLUtils怎么用?Java XMLUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XMLUtils类属于org.apache.hadoop.hdfs.util包,在下文中一共展示了XMLUtils类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeCacheDirectiveInfo

import org.apache.hadoop.hdfs.util.XMLUtils; //导入依赖的package包/类
public static void writeCacheDirectiveInfo(ContentHandler contentHandler,
    CacheDirectiveInfo directive) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "ID",
      Long.toString(directive.getId()));
  if (directive.getPath() != null) {
    XMLUtils.addSaxString(contentHandler, "PATH",
        directive.getPath().toUri().getPath());
  }
  if (directive.getReplication() != null) {
    XMLUtils.addSaxString(contentHandler, "REPLICATION",
        Short.toString(directive.getReplication()));
  }
  if (directive.getPool() != null) {
    XMLUtils.addSaxString(contentHandler, "POOL", directive.getPool());
  }
  if (directive.getExpiration() != null) {
    XMLUtils.addSaxString(contentHandler, "EXPIRATION",
        "" + directive.getExpiration().getMillis());
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:FSImageSerialization.java

示例2: toXml

import org.apache.hadoop.hdfs.util.XMLUtils; //导入依赖的package包/类
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "LENGTH",
      Integer.toString(length));
  XMLUtils.addSaxString(contentHandler, "INODEID",
      Long.toString(inodeId));
  XMLUtils.addSaxString(contentHandler, "PATH", path);
  XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
      Long.toString(timestamp));
  FSEditLogOp.permissionStatusToXml(contentHandler, permissions);
  if (aclEntries != null) {
    appendAclEntriesToXml(contentHandler, aclEntries);
  }
  if (xAttrs != null) {
    appendXAttrsToXml(contentHandler, xAttrs);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:FSEditLogOp.java

示例3: delegationTokenToXml

import org.apache.hadoop.hdfs.util.XMLUtils; //导入依赖的package包/类
public static void delegationTokenToXml(ContentHandler contentHandler,
    DelegationTokenIdentifier token) throws SAXException {
  contentHandler.startElement("", "", "DELEGATION_TOKEN_IDENTIFIER", new AttributesImpl());
  XMLUtils.addSaxString(contentHandler, "KIND", token.getKind().toString());
  XMLUtils.addSaxString(contentHandler, "SEQUENCE_NUMBER",
      Integer.toString(token.getSequenceNumber()));
  XMLUtils.addSaxString(contentHandler, "OWNER",
      token.getOwner().toString());
  XMLUtils.addSaxString(contentHandler, "RENEWER",
      token.getRenewer().toString());
  XMLUtils.addSaxString(contentHandler, "REALUSER",
      token.getRealUser().toString());
  XMLUtils.addSaxString(contentHandler, "ISSUE_DATE",
      Long.toString(token.getIssueDate()));
  XMLUtils.addSaxString(contentHandler, "MAX_DATE",
      Long.toString(token.getMaxDate()));
  XMLUtils.addSaxString(contentHandler, "MASTER_KEY_ID",
      Integer.toString(token.getMasterKeyId()));
  contentHandler.endElement("", "", "DELEGATION_TOKEN_IDENTIFIER");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:FSEditLogOp.java

示例4: appendXAttrsToXml

import org.apache.hadoop.hdfs.util.XMLUtils; //导入依赖的package包/类
private static void appendXAttrsToXml(ContentHandler contentHandler,
    List<XAttr> xAttrs) throws SAXException {
  for (XAttr xAttr: xAttrs) {
    contentHandler.startElement("", "", "XATTR", new AttributesImpl());
    XMLUtils.addSaxString(contentHandler, "NAMESPACE",
        xAttr.getNameSpace().toString());
    XMLUtils.addSaxString(contentHandler, "NAME", xAttr.getName());
    if (xAttr.getValue() != null) {
      try {
        XMLUtils.addSaxString(contentHandler, "VALUE",
            XAttrCodec.encodeValue(xAttr.getValue(), XAttrCodec.HEX));
      } catch (IOException e) {
        throw new SAXException(e);
      }
    }
    contentHandler.endElement("", "", "XATTR");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:FSEditLogOp.java

示例5: close

import org.apache.hadoop.hdfs.util.XMLUtils; //导入依赖的package包/类
/**
 * Finish visitor
 */
@Override
public void close(Throwable error) throws IOException {
  try {
    contentHandler.endElement("", "", "EDITS");
    if (error != null) {
      String msg = error.getMessage();
      XMLUtils.addSaxString(contentHandler, "ERROR",
          (msg == null) ? "null" : msg);
    }
    contentHandler.endDocument();
  }
  catch (SAXException e) {
    throw new IOException("SAX error: " + e.getMessage());
  }
  out.close();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:XmlEditsVisitor.java

示例6: writeCachePoolInfo

import org.apache.hadoop.hdfs.util.XMLUtils; //导入依赖的package包/类
public static void writeCachePoolInfo(ContentHandler contentHandler,
    CachePoolInfo info) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "POOLNAME", info.getPoolName());

  final String ownerName = info.getOwnerName();
  final String groupName = info.getGroupName();
  final Long limit = info.getLimit();
  final FsPermission mode = info.getMode();
  final Long maxRelativeExpiry = info.getMaxRelativeExpiryMs();

  if (ownerName != null) {
    XMLUtils.addSaxString(contentHandler, "OWNERNAME", ownerName);
  }
  if (groupName != null) {
    XMLUtils.addSaxString(contentHandler, "GROUPNAME", groupName);
  }
  if (mode != null) {
    FSEditLogOp.fsPermissionToXml(contentHandler, mode);
  }
  if (limit != null) {
    XMLUtils.addSaxString(contentHandler, "LIMIT",
        Long.toString(limit));
  }
  if (maxRelativeExpiry != null) {
    XMLUtils.addSaxString(contentHandler, "MAXRELATIVEEXPIRY",
        Long.toString(maxRelativeExpiry));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:FSImageSerialization.java

示例7: appendRpcIdsToXml

import org.apache.hadoop.hdfs.util.XMLUtils; //导入依赖的package包/类
private static void appendRpcIdsToXml(ContentHandler contentHandler,
    final byte[] clientId, final int callId) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "RPC_CLIENTID",
      ClientId.toString(clientId));
  XMLUtils.addSaxString(contentHandler, "RPC_CALLID", 
      Integer.toString(callId));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:FSEditLogOp.java

示例8: outputToXml

import org.apache.hadoop.hdfs.util.XMLUtils; //导入依赖的package包/类
public void outputToXml(ContentHandler contentHandler) throws SAXException {
  contentHandler.startElement("", "", "RECORD", new AttributesImpl());
  XMLUtils.addSaxString(contentHandler, "OPCODE", opCode.toString());
  contentHandler.startElement("", "", "DATA", new AttributesImpl());
  XMLUtils.addSaxString(contentHandler, "TXID", "" + txid);
  toXml(contentHandler);
  contentHandler.endElement("", "", "DATA");
  contentHandler.endElement("", "", "RECORD");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:FSEditLogOp.java

示例9: blockToXml

import org.apache.hadoop.hdfs.util.XMLUtils; //导入依赖的package包/类
public static void blockToXml(ContentHandler contentHandler, Block block) 
    throws SAXException {
  contentHandler.startElement("", "", "BLOCK", new AttributesImpl());
  XMLUtils.addSaxString(contentHandler, "BLOCK_ID",
      Long.toString(block.getBlockId()));
  XMLUtils.addSaxString(contentHandler, "NUM_BYTES",
      Long.toString(block.getNumBytes()));
  XMLUtils.addSaxString(contentHandler, "GENSTAMP",
      Long.toString(block.getGenerationStamp()));
  contentHandler.endElement("", "", "BLOCK");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:FSEditLogOp.java

示例10: delegationKeyToXml

import org.apache.hadoop.hdfs.util.XMLUtils; //导入依赖的package包/类
public static void delegationKeyToXml(ContentHandler contentHandler,
    DelegationKey key) throws SAXException {
  contentHandler.startElement("", "", "DELEGATION_KEY", new AttributesImpl());
  XMLUtils.addSaxString(contentHandler, "KEY_ID",
      Integer.toString(key.getKeyId()));
  XMLUtils.addSaxString(contentHandler, "EXPIRY_DATE",
      Long.toString(key.getExpiryDate()));
  if (key.getEncodedKey() != null) {
    XMLUtils.addSaxString(contentHandler, "KEY",
        Hex.encodeHexString(key.getEncodedKey()));
  }
  contentHandler.endElement("", "", "DELEGATION_KEY");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:FSEditLogOp.java

示例11: permissionStatusToXml

import org.apache.hadoop.hdfs.util.XMLUtils; //导入依赖的package包/类
public static void permissionStatusToXml(ContentHandler contentHandler,
    PermissionStatus perm) throws SAXException {
  contentHandler.startElement("", "", "PERMISSION_STATUS", new AttributesImpl());
  XMLUtils.addSaxString(contentHandler, "USERNAME", perm.getUserName());
  XMLUtils.addSaxString(contentHandler, "GROUPNAME", perm.getGroupName());
  fsPermissionToXml(contentHandler, perm.getPermission());
  contentHandler.endElement("", "", "PERMISSION_STATUS");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:FSEditLogOp.java

示例12: appendAclEntriesToXml

import org.apache.hadoop.hdfs.util.XMLUtils; //导入依赖的package包/类
private static void appendAclEntriesToXml(ContentHandler contentHandler,
    List<AclEntry> aclEntries) throws SAXException {
  for (AclEntry e : aclEntries) {
    contentHandler.startElement("", "", "ENTRY", new AttributesImpl());
    XMLUtils.addSaxString(contentHandler, "SCOPE", e.getScope().name());
    XMLUtils.addSaxString(contentHandler, "TYPE", e.getType().name());
    if (e.getName() != null) {
      XMLUtils.addSaxString(contentHandler, "NAME", e.getName());
    }
    fsActionToXml(contentHandler, e.getPermission());
    contentHandler.endElement("", "", "ENTRY");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:FSEditLogOp.java


注:本文中的org.apache.hadoop.hdfs.util.XMLUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。