public ServerCertificate unmarshall(StaxUnmarshallerContext context) throws Exception {
    ServerCertificate serverCertificate = new ServerCertificate();
    int originalDepth = context.getCurrentDepth();
    int targetDepth = originalDepth + 1;

    if (context.isStartOfDocument()) targetDepth += 2;

    while (true) {
      XMLEvent xmlEvent = context.nextEvent();
      if (xmlEvent.isEndDocument()) return serverCertificate;

      if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
        if (context.testExpression("ServerCertificateMetadata", targetDepth)) {
          serverCertificate.setServerCertificateMetadata(
              ServerCertificateMetadataStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("CertificateBody", targetDepth)) {
          serverCertificate.setCertificateBody(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
        if (context.testExpression("CertificateChain", targetDepth)) {
          serverCertificate.setCertificateChain(
              StringStaxUnmarshaller.getInstance().unmarshall(context));
          continue;
        }
      } else if (xmlEvent.isEndElement()) {
        if (context.getCurrentDepth() < originalDepth) {
          return serverCertificate;
        }
      }
    }
  }
예제 #2
0
 /**
  * Constructs a new ServerCertificate object. Callers should use the setter or fluent setter
  * (with...) methods to initialize any additional object members.
  *
  * @param serverCertificateMetadata The meta information of the server certificate, such as its
  *     name, path, ID, and ARN.
  * @param certificateBody The contents of the public key certificate.
  */
 public ServerCertificate(
     ServerCertificateMetadata serverCertificateMetadata, String certificateBody) {
   setServerCertificateMetadata(serverCertificateMetadata);
   setCertificateBody(certificateBody);
 }