Java 类org.apache.hadoop.hdfs.util.XMLUtils 实例源码

项目:hadoop    文件:FSImageSerialization.java   
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());
  }
}
项目:hadoop    文件:FSEditLogOp.java   
@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);
  }
}
项目:hadoop    文件:FSEditLogOp.java   
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "LENGTH",
      Integer.toString(length));
  XMLUtils.addSaxString(contentHandler, "SRC", src);
  XMLUtils.addSaxString(contentHandler, "DST", dst);
  XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
      Long.toString(timestamp));
  StringBuilder bld = new StringBuilder();
  String prefix = "";
  for (Rename r : options) {
    bld.append(prefix).append(r.toString());
    prefix = "|";
  }
  XMLUtils.addSaxString(contentHandler, "OPTIONS", bld.toString());
  appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
项目:hadoop    文件:FSEditLogOp.java   
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");
}
项目:hadoop    文件:FSEditLogOp.java   
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");
  }
}
项目:hadoop    文件:XmlEditsVisitor.java   
/**
 * 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();
}
项目:aliyun-oss-hadoop-fs    文件:FSImageSerialization.java   
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());
  }
}
项目:aliyun-oss-hadoop-fs    文件:FSEditLogOp.java   
@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);
  }
}
项目:aliyun-oss-hadoop-fs    文件:FSEditLogOp.java   
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "LENGTH",
      Integer.toString(length));
  XMLUtils.addSaxString(contentHandler, "SRC", src);
  XMLUtils.addSaxString(contentHandler, "DST", dst);
  XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
      Long.toString(timestamp));
  StringBuilder bld = new StringBuilder();
  String prefix = "";
  for (Rename r : options) {
    bld.append(prefix).append(r.toString());
    prefix = "|";
  }
  XMLUtils.addSaxString(contentHandler, "OPTIONS", bld.toString());
  appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
项目:big-c    文件:XmlEditsVisitor.java   
/**
 * 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();
}
项目:aliyun-oss-hadoop-fs    文件:FSEditLogOp.java   
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");
}
项目:aliyun-oss-hadoop-fs    文件:FSEditLogOp.java   
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");
  }
}
项目:aliyun-oss-hadoop-fs    文件:XmlEditsVisitor.java   
/**
 * 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();
}
项目:big-c    文件:FSImageSerialization.java   
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());
  }
}
项目:big-c    文件:FSEditLogOp.java   
@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);
  }
}
项目:big-c    文件:FSEditLogOp.java   
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "LENGTH",
      Integer.toString(length));
  XMLUtils.addSaxString(contentHandler, "SRC", src);
  XMLUtils.addSaxString(contentHandler, "DST", dst);
  XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
      Long.toString(timestamp));
  StringBuilder bld = new StringBuilder();
  String prefix = "";
  for (Rename r : options) {
    bld.append(prefix).append(r.toString());
    prefix = "|";
  }
  XMLUtils.addSaxString(contentHandler, "OPTIONS", bld.toString());
  appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
项目:big-c    文件:FSEditLogOp.java   
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");
}
项目:hadoop    文件:FSImageSerialization.java   
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));
  }
}
项目:hadoop    文件:FSEditLogOp.java   
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));
}
项目:hadoop    文件:FSEditLogOp.java   
@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, "REPLICATION",
      Short.valueOf(replication).toString());
  XMLUtils.addSaxString(contentHandler, "MTIME",
      Long.toString(mtime));
  XMLUtils.addSaxString(contentHandler, "ATIME",
      Long.toString(atime));
  XMLUtils.addSaxString(contentHandler, "BLOCKSIZE",
      Long.toString(blockSize));
  XMLUtils.addSaxString(contentHandler, "CLIENT_NAME", clientName);
  XMLUtils.addSaxString(contentHandler, "CLIENT_MACHINE", clientMachine);
  XMLUtils.addSaxString(contentHandler, "OVERWRITE", 
      Boolean.toString(overwrite));
  for (Block b : blocks) {
    FSEditLogOp.blockToXml(contentHandler, b);
  }
  FSEditLogOp.permissionStatusToXml(contentHandler, permissions);
  if (this.opCode == OP_ADD) {
    if (aclEntries != null) {
      appendAclEntriesToXml(contentHandler, aclEntries);
    }
    appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
  }
}
项目:hadoop    文件:FSEditLogOp.java   
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "PATH", path);
  XMLUtils.addSaxString(contentHandler, "CLIENT_NAME", clientName);
  XMLUtils.addSaxString(contentHandler, "CLIENT_MACHINE", clientMachine);
  XMLUtils.addSaxString(contentHandler, "NEWBLOCK",
      Boolean.toString(newBlock));
  appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
项目:hadoop    文件:FSEditLogOp.java   
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "PATH", path);
  if (penultimateBlock != null) {
    FSEditLogOp.blockToXml(contentHandler, penultimateBlock);
  }
  FSEditLogOp.blockToXml(contentHandler, lastBlock);
  appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
项目:hadoop    文件:FSEditLogOp.java   
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "PATH", path);
  for (Block b : blocks) {
    FSEditLogOp.blockToXml(contentHandler, b);
  }
  appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
项目:hadoop    文件:FSEditLogOp.java   
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "LENGTH",
      Integer.toString(length));
  XMLUtils.addSaxString(contentHandler, "TRG", trg);
  XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
      Long.toString(timestamp));
  contentHandler.startElement("", "", "SOURCES", new AttributesImpl());
  for (int i = 0; i < srcs.length; ++i) {
    XMLUtils.addSaxString(contentHandler,
        "SOURCE" + (i + 1), srcs[i]);
  }
  contentHandler.endElement("", "", "SOURCES");
  appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
项目:hadoop    文件:FSEditLogOp.java   
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "LENGTH",
      Integer.toString(length));
  XMLUtils.addSaxString(contentHandler, "SRC", src);
  XMLUtils.addSaxString(contentHandler, "DST", dst);
  XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
      Long.toString(timestamp));
  appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
项目:hadoop    文件:FSEditLogOp.java   
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "LENGTH",
      Integer.toString(length));
  XMLUtils.addSaxString(contentHandler, "PATH", path);
  XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
      Long.toString(timestamp));
  appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
项目:hadoop    文件:FSEditLogOp.java   
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "SRC", src);
  if (username != null) {
    XMLUtils.addSaxString(contentHandler, "USERNAME", username);
  }
  if (groupname != null) {
    XMLUtils.addSaxString(contentHandler, "GROUPNAME", groupname);
  }
}
项目:hadoop    文件:FSEditLogOp.java   
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "SRC", src);
  XMLUtils.addSaxString(contentHandler, "NSQUOTA",
      Long.toString(nsQuota));
  XMLUtils.addSaxString(contentHandler, "DSQUOTA",
      Long.toString(dsQuota));
}
项目:hadoop    文件:FSEditLogOp.java   
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "SRC", src);
  XMLUtils.addSaxString(contentHandler, "STORAGETYPE",
    Integer.toString(type.ordinal()));
  XMLUtils.addSaxString(contentHandler, "DSQUOTA",
    Long.toString(dsQuota));
}
项目:hadoop    文件:FSEditLogOp.java   
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "LENGTH",
      Integer.toString(length));
  XMLUtils.addSaxString(contentHandler, "PATH", path);
  XMLUtils.addSaxString(contentHandler, "MTIME",
      Long.toString(mtime));
  XMLUtils.addSaxString(contentHandler, "ATIME",
      Long.toString(atime));
}
项目:hadoop    文件:FSEditLogOp.java   
@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, "VALUE", value);
  XMLUtils.addSaxString(contentHandler, "MTIME",
      Long.toString(mtime));
  XMLUtils.addSaxString(contentHandler, "ATIME",
      Long.toString(atime));
  FSEditLogOp.permissionStatusToXml(contentHandler, permissionStatus);
  appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
项目:hadoop    文件:FSEditLogOp.java   
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "SRC", src);
  XMLUtils.addSaxString(contentHandler, "CLIENTNAME", clientName);
  XMLUtils.addSaxString(contentHandler, "CLIENTMACHINE", clientMachine);
  XMLUtils.addSaxString(contentHandler, "NEWLENGTH",
      Long.toString(newLength));
  XMLUtils.addSaxString(contentHandler, "TIMESTAMP",
      Long.toString(timestamp));
  if(truncateBlock != null)
    FSEditLogOp.blockToXml(contentHandler, truncateBlock);
}
项目:hadoop    文件:FSEditLogOp.java   
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
  XMLUtils.addSaxString(contentHandler, "SNAPSHOTROOT", snapshotRoot);
  XMLUtils.addSaxString(contentHandler, "SNAPSHOTOLDNAME", snapshotOldName);
  XMLUtils.addSaxString(contentHandler, "SNAPSHOTNEWNAME", snapshotNewName);
  appendRpcIdsToXml(contentHandler, rpcClientId, rpcCallId);
}
项目:hadoop    文件:FSEditLogOp.java   
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");
}
项目:hadoop    文件:FSEditLogOp.java   
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");
}
项目:hadoop    文件:FSEditLogOp.java   
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");
}
项目:hadoop    文件:FSEditLogOp.java   
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");
}
项目:hadoop    文件:FSEditLogOp.java   
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");
  }
}
项目:aliyun-oss-hadoop-fs    文件:FSImageSerialization.java   
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));
  }
}
项目:aliyun-oss-hadoop-fs    文件:FSEditLogOp.java   
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));
}