Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to jclouds, Inc. (jclouds) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. jclouds licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.jclouds.elb.xml;
 
 import java.util.Set;
 
 
 

Author(s):
Lili Nadar
 
 public class DescribeLoadBalancersResponseHandler extends
    private final DateService dateService;
 
    @Inject
    public DescribeLoadBalancersResponseHandler(DateService dateServiceLoadBalancerListenerHandler listenerHandler) {
       this. = dateService;
       this. = listenerHandler;
    }
 
    @Resource
    protected Logger logger = .;
 
    private Set<LoadBalancercontents = Sets.newLinkedHashSet();
    private StringBuilder currentText = new StringBuilder();
 
    private boolean inListenerDescriptions = false;
    private boolean inInstances = false;
    private boolean inAppCookieStickinessPolicies = false;
    private boolean inLBCookieStickinessPolicies = false;
    private boolean inAvailabilityZones = false;
    // TODO unused?
    private boolean inLoadBalancerDescriptions = false;
 
    private LoadBalancer elb;
    // TODO unused?
    // TODO unused?
 
    public void startElement(String uriString localNameString qNameAttributes attributes) {
 
       if (qName.equals("ListenerDescriptions") || ) {
           = true;
       } else if (qName.equals("AppCookieStickinessPolicies")) {
           = true;
       } else if (qName.equals("LBCookieStickinessPolicies")) {
           = true;
       } else if (qName.equals("LoadBalancerDescriptions")) {
           = true;
       } else if (qName.equals("Instances")) {
           = true;
       } else if (qName.equals("AvailabilityZones")) {
           = true;
       }
 
       if (qName.equals("member")) {
              = new LoadBalancer();
          }
       }
    }
 
    public void endElement(String uriString localNameString qName) {
       // if end tag is one of below then set inXYZ to false
       if (qName.equals("ListenerDescriptions")) {
          = false;
      } else if (qName.equals("AppCookieStickinessPolicies")) {
          = false;
      } else if (qName.equals("LBCookieStickinessPolicies")) {
          = false;
      } else if (qName.equals("LoadBalancerDescriptions")) {
          = false;
      } else if (qName.equals("Instances")) {
          = false;
      } else if (qName.equals("AvailabilityZones")) {
          = false;
      }
      if (qName.equals("DNSName")) {
         .setDnsName(.toString().trim());
      } else if (qName.equals("LoadBalancerName")) {
         .setName(.toString().trim());
      } else if (qName.equals("InstanceId")) {
         .getInstanceIds().add(.toString().trim());
      }
      else if (qName.equals("member")) {
         if () {
            .getAvailabilityZones().add(.toString().trim());
         } else if (!( ||  || 
               ||  || )) {
            try {
               String region = AWSUtils.findRegionInArgsOrNull(getRequest());
               .setRegion(region);
               .add();
            } catch (NullPointerException e) {
               .warn(e"malformed load balancer: %s"localName);
               this. = null;
            }
         }
      }
       = new StringBuilder();
   }
   public Set<LoadBalancergetResult() {
      return ;
   }
   public void characters(char ch[], int startint length) {
      .append(chstartlength);
   }
      .setContext(request);
      super.setContext(request);
      return this;
   }
      private Set<LoadBalancerListenerlisteners = Sets.newHashSet();
      private StringBuilder currentText = new StringBuilder();
      private LoadBalancerListener listener;
      public void startElement(String uriString nameString qNameAttributes attrs) {
         if (qName.equals("member")) {
             = new LoadBalancerListener();
         }
      }
      public void endElement(String uriString nameString qName) {
         if (qName.equals("Protocol")) {
            .setProtocol(.toString().trim());
         } else if (qName.equals("LoadBalancerPort")) {
            .setLoadBalancerPort(Integer.parseInt(.toString().trim()));
         } else if (qName.equals("InstancePort")) {
            .setInstancePort(Integer.parseInt(.toString().trim()));
         } else if (qName.equals("member")) {
            .add();
         }
          = new StringBuilder();
      }
      @Override
      public Set<LoadBalancerListenergetResult() {
         return ;
      }
      public void characters(char ch[], int startint length) {
         .append(chstartlength);
      }
   }
New to GrepCode? Check out our FAQ X