You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2018/10/15 16:25:24 UTC
[08/15] jclouds-labs git commit: Remove deprecated Azure provider
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListLocationsHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListLocationsHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListLocationsHandler.java
deleted file mode 100644
index 926be98..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListLocationsHandler.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import java.util.List;
-
-import org.jclouds.azurecompute.domain.Location;
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-import com.google.inject.Inject;
-
-public final class ListLocationsHandler extends ParseSax.HandlerForGeneratedRequestWithResult<List<Location>> {
-
- private boolean inLocation;
-
- private final LocationHandler locationHandler;
-
- private final Builder<Location> locations = ImmutableList.builder();
-
- @Inject
- ListLocationsHandler(LocationHandler locationHandler) {
- this.locationHandler = locationHandler;
- }
-
- @Override
- public List<Location> getResult() {
- return locations.build();
- }
-
- @Override
- public void startElement(String url, String name, String qName, Attributes attributes) {
- if (qName.equals("Location")) {
- inLocation = true;
- }
- }
-
- @Override
- public void endElement(String uri, String name, String qName) {
- if (qName.equals("Location")) {
- inLocation = false;
- locations.add(locationHandler.getResult());
- } else if (inLocation) {
- locationHandler.endElement(uri, name, qName);
- }
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- if (inLocation) {
- locationHandler.characters(ch, start, length);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListNetworkSecurityGroupsHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListNetworkSecurityGroupsHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListNetworkSecurityGroupsHandler.java
deleted file mode 100644
index ad47e77..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListNetworkSecurityGroupsHandler.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import java.util.List;
-
-import org.jclouds.azurecompute.domain.NetworkSecurityGroup;
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-import com.google.common.collect.ImmutableList;
-import com.google.inject.Inject;
-
-public class ListNetworkSecurityGroupsHandler extends ParseSax.HandlerForGeneratedRequestWithResult<List<NetworkSecurityGroup>> {
-
- private boolean inNetworkSecurityGroup;
-
- private final NetworkSecurityGroupHandler networkSecurityGroupHandler;
-
- private final ImmutableList.Builder<NetworkSecurityGroup> networkSecurityGroups = ImmutableList.builder();
-
- @Inject
- ListNetworkSecurityGroupsHandler(NetworkSecurityGroupHandler networkSecurityGroupHandler) {
- this.networkSecurityGroupHandler = networkSecurityGroupHandler;
- }
-
- @Override
- public List<NetworkSecurityGroup> getResult() {
- return networkSecurityGroups.build();
- }
-
- @Override
- public void startElement(String url, String name, String qName, Attributes attributes) {
- if (qName.equals("NetworkSecurityGroup")) {
- inNetworkSecurityGroup = true;
- }
- }
-
- @Override
- public void endElement(String uri, String name, String qName) {
- if (qName.equals("NetworkSecurityGroup")) {
- inNetworkSecurityGroup = false;
- networkSecurityGroups.add(networkSecurityGroupHandler.getResult());
- } else if (inNetworkSecurityGroup) {
- networkSecurityGroupHandler.endElement(uri, name, qName);
- }
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- if (inNetworkSecurityGroup) {
- networkSecurityGroupHandler.characters(ch, start, length);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListOSImagesHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListOSImagesHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListOSImagesHandler.java
deleted file mode 100644
index 29e7df4..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListOSImagesHandler.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import java.util.List;
-
-import org.jclouds.azurecompute.domain.OSImage;
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-import com.google.inject.Inject;
-
-public final class ListOSImagesHandler extends ParseSax.HandlerForGeneratedRequestWithResult<List<OSImage>> {
-
- private boolean inOSImage;
-
- private final OSImageHandler osImageHandler;
-
- private final Builder<OSImage> images = ImmutableList.builder();
-
- @Inject
- ListOSImagesHandler(OSImageHandler osImageHandler) {
- this.osImageHandler = osImageHandler;
- }
-
- @Override
- public List<OSImage> getResult() {
- return images.build();
- }
-
- @Override
- public void startElement(String url, String name, String qName, Attributes attributes) {
- if (qName.equals("OSImage")) {
- inOSImage = true;
- }
- }
-
- @Override
- public void endElement(String uri, String name, String qName) {
- if (qName.equals("OSImage")) {
- inOSImage = false;
- images.add(osImageHandler.getResult());
- } else if (inOSImage) {
- osImageHandler.endElement(uri, name, qName);
- }
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- if (inOSImage) {
- osImageHandler.characters(ch, start, length);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfileDefinitionsHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfileDefinitionsHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfileDefinitionsHandler.java
deleted file mode 100644
index 733b002..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfileDefinitionsHandler.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-import org.jclouds.azurecompute.domain.ProfileDefinition;
-
-/**
- * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh758252.aspx">Response body description</a>
- */
-public final class ListProfileDefinitionsHandler extends
- ParseSax.HandlerForGeneratedRequestWithResult<List<ProfileDefinition>> {
-
- private boolean inDefinition;
-
- private final ProfileDefinitionHandler profileDefinitionHandler;
-
- private final Builder<ProfileDefinition> definitions = ImmutableList.builder();
-
- @Inject
- ListProfileDefinitionsHandler(ProfileDefinitionHandler profileDefinitionHandler) {
- this.profileDefinitionHandler = profileDefinitionHandler;
- }
-
- @Override
- public List<ProfileDefinition> getResult() {
- return definitions.build();
- }
-
- @Override
- public void startElement(final String url, final String name, final String qName, final Attributes attributes) {
- if (qName.equals("Definition")) {
- inDefinition = true;
- }
-
- if (inDefinition) {
- profileDefinitionHandler.startElement(url, name, qName, attributes);
- }
- }
-
- @Override
- public void endElement(final String uri, final String name, final String qName) {
- if (qName.equals("Definition")) {
- inDefinition = false;
- definitions.add(profileDefinitionHandler.getResult());
- } else if (inDefinition) {
- profileDefinitionHandler.endElement(uri, name, qName);
- }
- }
-
- @Override
- public void characters(final char[] ch, final int start, final int length) {
- if (inDefinition) {
- profileDefinitionHandler.characters(ch, start, length);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfilesHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfilesHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfilesHandler.java
deleted file mode 100644
index 2602afc..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListProfilesHandler.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-import org.jclouds.azurecompute.domain.Profile;
-
-/**
- * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh758249.aspx">Response body description</a>
- */
-public final class ListProfilesHandler extends
- ParseSax.HandlerForGeneratedRequestWithResult<List<Profile>> {
-
- private boolean inProfile;
-
- private final ProfileHandler profileHandler;
-
- private final Builder<Profile> profiles = ImmutableList.builder();
-
- @Inject
- ListProfilesHandler(ProfileHandler profileHandler) {
- this.profileHandler = profileHandler;
- }
-
- @Override
- public List<Profile> getResult() {
- return profiles.build();
- }
-
- @Override
- public void startElement(final String url, final String name, final String qName, final Attributes attributes) {
- if (qName.equals("Profile")) {
- inProfile = true;
- }
-
- if (inProfile) {
- profileHandler.startElement(url, name, qName, attributes);
- }
- }
-
- @Override
- public void endElement(final String uri, final String name, final String qName) {
- if (qName.equals("Profile")) {
- inProfile = false;
- profiles.add(profileHandler.getResult());
- } else if (inProfile) {
- profileHandler.endElement(uri, name, qName);
- }
- }
-
- @Override
- public void characters(final char[] ch, final int start, final int length) {
- if (inProfile) {
- profileHandler.characters(ch, start, length);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListReservedIPAddressHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListReservedIPAddressHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListReservedIPAddressHandler.java
deleted file mode 100644
index b576662..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListReservedIPAddressHandler.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-import org.jclouds.azurecompute.domain.ReservedIPAddress;
-
-/**
- * @see <a href="https://msdn.microsoft.com/en-us/library/azure/dn722418.aspx">Response body description</a>
- */
-public final class ListReservedIPAddressHandler extends
- ParseSax.HandlerForGeneratedRequestWithResult<List<ReservedIPAddress>> {
-
- private boolean inReservedIP;
-
- private final ReservedIPAddressHandler reservedIPAddressHandler;
-
- private final Builder<ReservedIPAddress> ips = ImmutableList.builder();
-
- @Inject
- ListReservedIPAddressHandler(ReservedIPAddressHandler reservedIPAddressHandler) {
- this.reservedIPAddressHandler = reservedIPAddressHandler;
- }
-
- @Override
- public List<ReservedIPAddress> getResult() {
- return ips.build();
- }
-
- @Override
- public void startElement(final String url, final String name, final String qName, final Attributes attributes) {
- if (qName.equals("ReservedIP")) {
- inReservedIP = true;
- }
- if (inReservedIP) {
- reservedIPAddressHandler.startElement(url, name, qName, attributes);
- }
- }
-
- @Override
- public void endElement(final String uri, final String name, final String qName) {
- if (qName.equals("ReservedIP")) {
- inReservedIP = false;
- ips.add(reservedIPAddressHandler.getResult());
- } else if (inReservedIP) {
- reservedIPAddressHandler.endElement(uri, name, qName);
- }
- }
-
- @Override
- public void characters(final char[] ch, final int start, final int length) {
- if (inReservedIP) {
- reservedIPAddressHandler.characters(ch, start, length);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListRoleSizesHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListRoleSizesHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListRoleSizesHandler.java
deleted file mode 100644
index 94b7d75..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListRoleSizesHandler.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import java.util.List;
-
-import org.jclouds.azurecompute.domain.RoleSize;
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-import com.google.common.collect.ImmutableList;
-import com.google.inject.Inject;
-
-public final class ListRoleSizesHandler extends ParseSax.HandlerForGeneratedRequestWithResult<List<RoleSize>> {
-
- private boolean inRoleSize;
-
- private final RoleSizeHandler roleSizeHandler;
-
- private final ImmutableList.Builder<RoleSize> roleSizes = ImmutableList.builder();
-
- @Inject
- ListRoleSizesHandler(RoleSizeHandler roleSizeHandler) {
- this.roleSizeHandler = roleSizeHandler;
- }
-
- @Override
- public List<RoleSize> getResult() {
- return roleSizes.build();
- }
-
- @Override
- public void startElement(String url, String name, String qName, Attributes attributes) {
- if (qName.equals("RoleSize")) {
- inRoleSize = true;
- }
- }
-
- @Override
- public void endElement(String uri, String name, String qName) {
- if (qName.equals("RoleSize")) {
- inRoleSize = false;
- roleSizes.add(roleSizeHandler.getResult());
- } else if (inRoleSize) {
- roleSizeHandler.endElement(uri, name, qName);
- }
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- if (inRoleSize) {
- roleSizeHandler.characters(ch, start, length);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListServiceCertificatesHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListServiceCertificatesHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListServiceCertificatesHandler.java
deleted file mode 100644
index 5310f01..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListServiceCertificatesHandler.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-import org.jclouds.azurecompute.domain.ServiceCertificate;
-
-/**
- * @see <a href="https://msdn.microsoft.com/en-us/library/azure/ee460788.aspx">Response body description</a>
- */
-public final class ListServiceCertificatesHandler extends
- ParseSax.HandlerForGeneratedRequestWithResult<List<ServiceCertificate>> {
-
- private boolean inCertificate;
-
- private final ServiceCertificateHandler serviceCertificateHandler;
-
- private final Builder<ServiceCertificate> certificates = ImmutableList.builder();
-
- @Inject
- ListServiceCertificatesHandler(ServiceCertificateHandler serviceCertificateHandler) {
- this.serviceCertificateHandler = serviceCertificateHandler;
- }
-
- @Override
- public List<ServiceCertificate> getResult() {
- return certificates.build();
- }
-
- @Override
- public void startElement(final String url, final String name, final String qName, final Attributes attributes) {
- if (qName.equals("Certificate")) {
- inCertificate = true;
- }
- if (inCertificate) {
- serviceCertificateHandler.startElement(url, name, qName, attributes);
- }
- }
-
- @Override
- public void endElement(final String uri, final String name, final String qName) {
- if (qName.equals("Certificate")) {
- inCertificate = false;
- certificates.add(serviceCertificateHandler.getResult());
- } else if (inCertificate) {
- serviceCertificateHandler.endElement(uri, name, qName);
- }
- }
-
- @Override
- public void characters(final char[] ch, final int start, final int length) {
- if (inCertificate) {
- serviceCertificateHandler.characters(ch, start, length);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListStorageServicesHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListStorageServicesHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListStorageServicesHandler.java
deleted file mode 100644
index 284131f..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListStorageServicesHandler.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import java.util.List;
-
-import org.jclouds.azurecompute.domain.StorageService;
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-import com.google.common.collect.ImmutableList;
-import com.google.inject.Inject;
-
-public class ListStorageServicesHandler extends ParseSax.HandlerForGeneratedRequestWithResult<List<StorageService>> {
-
- private boolean inStorageService;
-
- private final StorageServiceHandler storageServiceHandler;
-
- private final ImmutableList.Builder<StorageService> storageAccounts = ImmutableList.builder();
-
- @Inject
- ListStorageServicesHandler(final StorageServiceHandler storageServiceHandler) {
- this.storageServiceHandler = storageServiceHandler;
- }
-
- @Override
- public List<StorageService> getResult() {
- return storageAccounts.build();
- }
-
- @Override
- public void startElement(final String url, final String name, final String qName, final Attributes attributes) {
- if ("StorageService".equals(qName)) {
- inStorageService = true;
- }
- if (inStorageService) {
- storageServiceHandler.startElement(url, name, qName, attributes);
- }
- }
-
- @Override
- public void endElement(final String uri, final String name, final String qName) {
- if ("StorageService".equals(qName)) {
- inStorageService = false;
- storageAccounts.add(storageServiceHandler.getResult());
- } else if (inStorageService) {
- storageServiceHandler.endElement(uri, name, qName);
- }
- }
-
- @Override
- public void characters(final char[] ch, final int start, final int length) {
- if (inStorageService) {
- storageServiceHandler.characters(ch, start, length);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListVMImagesHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListVMImagesHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListVMImagesHandler.java
deleted file mode 100644
index 7818abc..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListVMImagesHandler.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-import com.google.inject.Inject;
-import org.jclouds.azurecompute.domain.VMImage;
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-import java.util.List;
-
-public final class ListVMImagesHandler extends ParseSax.HandlerForGeneratedRequestWithResult<List<VMImage>> {
- private boolean inVMImage;
- private final VMImageHandler vmImageHandler;
- private final Builder<VMImage> images = ImmutableList.builder();
-
- @Inject ListVMImagesHandler(VMImageHandler vmImageHandler) {
- this.vmImageHandler = vmImageHandler;
- }
-
- @Override
- public List<VMImage> getResult() {
- return images.build();
- }
-
- @Override
- public void startElement(String url, String name, String qName, Attributes attributes) throws SAXException {
- if (qName.equals("VMImage")) {
- inVMImage = true;
- }
- if (inVMImage) {
- vmImageHandler.startElement(url, name, qName, attributes);
- }
- }
-
- @Override
- public void endElement(String uri, String name, String qName) {
- if (qName.equals("VMImage")) {
- inVMImage = false;
- images.add(vmImageHandler.getResult());
- }
- if (inVMImage) {
- vmImageHandler.endElement(uri, name, qName);
- }
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- if (inVMImage) {
- vmImageHandler.characters(ch, start, length);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListVirtualNetworkSitesHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListVirtualNetworkSitesHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListVirtualNetworkSitesHandler.java
deleted file mode 100644
index cd8aed5..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ListVirtualNetworkSitesHandler.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import java.util.List;
-
-import org.jclouds.azurecompute.domain.NetworkConfiguration.VirtualNetworkSite;
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-import com.google.common.collect.ImmutableList;
-import com.google.inject.Inject;
-
-public class ListVirtualNetworkSitesHandler extends ParseSax.HandlerForGeneratedRequestWithResult<List<VirtualNetworkSite>> {
-
- private boolean inVirtualNetworkSite;
-
- private final VirtualNetworkSiteHandler virtualNetworkSiteHandler;
-
- private final ImmutableList.Builder<VirtualNetworkSite> virtualNetworkSites = ImmutableList.builder();
-
- @Inject
- ListVirtualNetworkSitesHandler(VirtualNetworkSiteHandler virtualNetworkSiteHandler) {
- this.virtualNetworkSiteHandler = virtualNetworkSiteHandler;
- }
-
- @Override
- public List<VirtualNetworkSite> getResult() {
- return virtualNetworkSites.build();
- }
-
- @Override
- public void startElement(String url, String name, String qName, Attributes attributes) {
- if (qName.equals("VirtualNetworkSite")) {
- inVirtualNetworkSite = true;
- }
- if (inVirtualNetworkSite) {
- virtualNetworkSiteHandler.startElement(url, name, qName, attributes);
- }
- }
-
- @Override
- public void endElement(String uri, String name, String qName) {
- if (qName.equals("VirtualNetworkSite")) {
- inVirtualNetworkSite = false;
- virtualNetworkSites.add(virtualNetworkSiteHandler.getResult());
- } else if (inVirtualNetworkSite) {
- virtualNetworkSiteHandler.endElement(uri, name, qName);
- }
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- if (inVirtualNetworkSite) {
- virtualNetworkSiteHandler.characters(ch, start, length);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/LocationHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/LocationHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/LocationHandler.java
deleted file mode 100644
index 2b226c5..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/LocationHandler.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import static org.jclouds.util.SaxUtils.currentOrNull;
-
-import java.util.List;
-
-import org.jclouds.azurecompute.domain.Location;
-import org.jclouds.http.functions.ParseSax;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
-import org.jclouds.azurecompute.domain.ComputeCapabilities;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-/**
- * @see <a href="http://msdn.microsoft.com/en-us/library/gg441293" >api</a>
- */
-final class LocationHandler extends ParseSax.HandlerForGeneratedRequestWithResult<Location> {
-
- private String name;
-
- private String displayName;
-
- private final List<String> availableServices = Lists.newArrayList();
-
- private ComputeCapabilities computeCapabilities;
-
- private boolean inComputeCapabilities = false;
-
- private final ComputeCapabilitiesHandler computeCapabilitiesHandler;
-
- private final StringBuilder currentText = new StringBuilder();
-
- @Inject
- LocationHandler(final ComputeCapabilitiesHandler computeCapabilitiesHandler) {
- this.computeCapabilitiesHandler = computeCapabilitiesHandler;
- }
-
- @Override
- public Location getResult() {
- Location result = Location.create(
- name, displayName, ImmutableList.copyOf(availableServices), computeCapabilities);
-
- // handler is called in a loop.
- name = displayName = null;
- availableServices.clear();
- computeCapabilities = null;
-
- return result;
- }
-
- @Override
- public void startElement(final String uri, final String localName, final String qName, final Attributes attributes)
- throws SAXException {
-
- if ("ComputeCapabilities".equals(qName)) {
- inComputeCapabilities = true;
- } else if (inComputeCapabilities) {
- computeCapabilitiesHandler.startElement(uri, localName, qName, attributes);
- }
- }
-
- @Override
- public void endElement(String ignoredUri, String ignoredName, String qName) {
- if (qName.equals("Name")) {
- name = currentOrNull(currentText);
- } else if (qName.equals("DisplayName")) {
- displayName = currentOrNull(currentText);
- } else if (qName.equals("AvailableService")) {
- availableServices.add(currentOrNull(currentText));
- } else if ("ComputeCapabilities".equals(qName)) {
- inComputeCapabilities = false;
- computeCapabilities = computeCapabilitiesHandler.getResult();
- } else if (inComputeCapabilities) {
- computeCapabilitiesHandler.endElement(ignoredUri, ignoredName, qName);
- }
-
- currentText.setLength(0);
- }
-
- @Override
- public void characters(final char[] ch, final int start, final int length) {
- if (inComputeCapabilities) {
- computeCapabilitiesHandler.characters(ch, start, length);
- } else {
- currentText.append(ch, start, length);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/NetworkConfigurationHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/NetworkConfigurationHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/NetworkConfigurationHandler.java
deleted file mode 100644
index 1679d6a..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/NetworkConfigurationHandler.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import org.jclouds.azurecompute.domain.NetworkConfiguration;
-import org.jclouds.azurecompute.domain.NetworkConfiguration.VirtualNetworkConfiguration;
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-import com.google.inject.Inject;
-
-public class NetworkConfigurationHandler extends ParseSax.HandlerForGeneratedRequestWithResult<NetworkConfiguration> {
-
- private VirtualNetworkConfiguration virtualNetworkConfiguration;
-
- private boolean inVirtualNetworkConfiguration;
-
- private final VirtualNetworkConfigurationHandler virtualNetworkConfigurationHandler;
-
- @Inject
- NetworkConfigurationHandler(VirtualNetworkConfigurationHandler virtualNetworkConfigurationHandler) {
- this.virtualNetworkConfigurationHandler = virtualNetworkConfigurationHandler;
- }
-
- private final StringBuilder currentText = new StringBuilder();
-
- @Override
- public void startElement(String url, String name, String qName, Attributes attributes) {
- if (qName.equals("VirtualNetworkConfiguration")) {
- inVirtualNetworkConfiguration = true;
- }
- if (inVirtualNetworkConfiguration) {
- virtualNetworkConfigurationHandler.startElement(url, name, qName, attributes);
- }
- }
-
- @Override
- public NetworkConfiguration getResult() {
- return NetworkConfiguration.create(virtualNetworkConfiguration);
- }
-
- @Override
- public void endElement(String ignoredUri, String ignoredName, String qName) {
- if (qName.equals("VirtualNetworkConfiguration")) {
- virtualNetworkConfiguration = virtualNetworkConfigurationHandler.getResult();
- } else if (inVirtualNetworkConfiguration) {
- virtualNetworkConfigurationHandler.endElement(ignoredUri, ignoredName, qName);
- }
- currentText.setLength(0);
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- if (inVirtualNetworkConfiguration) {
- virtualNetworkConfigurationHandler.characters(ch, start, length);
- } else {
- currentText.append(ch, start, length);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/NetworkSecurityGroupHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/NetworkSecurityGroupHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/NetworkSecurityGroupHandler.java
deleted file mode 100644
index 876cfe8..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/NetworkSecurityGroupHandler.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import static org.jclouds.util.SaxUtils.currentOrNull;
-import java.util.List;
-
-import org.jclouds.azurecompute.domain.NetworkSecurityGroup;
-import org.jclouds.azurecompute.domain.Rule;
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-import com.google.common.collect.Lists;
-
-public class NetworkSecurityGroupHandler extends ParseSax.HandlerForGeneratedRequestWithResult<NetworkSecurityGroup> {
-
- private String name;
-
- private String label;
-
- private String location;
-
- private NetworkSecurityGroup.State state;
-
- private List<Rule> rules = Lists.newArrayList();
-
- private boolean inRule;
-
- private final RuleHandler ruleHandler = new RuleHandler();
-
- private final StringBuilder currentText = new StringBuilder();
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attributes) {
- if (qName.equals("Rule")) {
- inRule = true;
- }
- }
-
- @Override
- public NetworkSecurityGroup getResult() {
- NetworkSecurityGroup result = NetworkSecurityGroup.create(name, label, location, state, rules);
- name = label = location = null; // handler is called in a loop.
- this.state = null;
- rules = Lists.newArrayList();
- return result;
- }
-
- @Override
- public void endElement(String ignoredUri, String ignoredName, String qName) {
- if (qName.equals("Rule")) {
- inRule = false;
- rules.add(ruleHandler.getResult());
- } else if (inRule) {
- ruleHandler.endElement(ignoredUri, ignoredName, qName);
- } else if (qName.equals("Name")) {
- name = currentOrNull(currentText);
- } else if (qName.equals("Label")) {
- label = currentOrNull(currentText);
- } else if (qName.equals("Location")) {
- location = currentOrNull(currentText);
- } else if (qName.equals("State")) {
- state = NetworkSecurityGroup.State.fromString(currentOrNull(currentText));
- }
- currentText.setLength(0);
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- if (inRule) {
- ruleHandler.characters(ch, start, length);
- } else {
- currentText.append(ch, start, length);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OSConfigHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OSConfigHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OSConfigHandler.java
deleted file mode 100644
index 2d4998b..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OSConfigHandler.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import org.jclouds.azurecompute.domain.OSImage;
-import org.jclouds.azurecompute.domain.VMImage;
-import org.jclouds.http.functions.ParseSax;
-
-import java.net.URI;
-
-import static com.google.common.base.CaseFormat.UPPER_CAMEL;
-import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
-import static org.jclouds.util.SaxUtils.currentOrNull;
-
-/**
- * @see <a href="https://msdn.microsoft.com/en-us/library/azure/jj157193.aspx#DataVirtualHardDisks" >api</a>
- */
-final class OSConfigHandler extends ParseSax.HandlerForGeneratedRequestWithResult<VMImage.OSDiskConfiguration> {
-
- private VMImage.OSDiskConfiguration.Caching hostCaching;
- private String name;
- private VMImage.OSDiskConfiguration.OSState osState;
- private OSImage.Type os;
- private Integer logicalDiskSizeInGB;
- private URI mediaLink;
- private String ioType;
-
- private final StringBuilder currentText = new StringBuilder();
-
- @Override
- public VMImage.OSDiskConfiguration getResult() {
- return VMImage.OSDiskConfiguration
- .create(name, hostCaching, osState, os, mediaLink, logicalDiskSizeInGB, ioType);
- }
-
- @Override
- public void endElement(String ignoredUri, String ignoredName, String qName) {
-
- if (qName.equals("HostCaching")) {
- String hostCachingText = currentOrNull(currentText);
- if (hostCachingText != null) {
- hostCaching = parseHostCache(hostCachingText);
- }
- } else if (qName.equals("OSState")) {
- String osStateText = currentOrNull(currentText);
- if (osStateText != null) {
- osState = VMImage.OSDiskConfiguration.OSState.valueOf(osStateText.toUpperCase());
- }
- } else if (qName.equals("OS")) {
- String osText = currentOrNull(currentText);
- if (osText != null) {
- os = OSImage.Type.valueOf(osText.toUpperCase());
- }
- } else if (qName.equals("Name")) {
- name = currentOrNull(currentText);
- } else if (qName.equals("LogicalDiskSizeInGB")) {
- String gb = currentOrNull(currentText);
- if (gb != null) {
- logicalDiskSizeInGB = Integer.parseInt(gb);
- }
- } else if (qName.equals("MediaLink")) {
- String link = currentOrNull(currentText);
- if (link != null) {
- mediaLink = URI.create(link);
- }
- } else if (qName.equals("IOType")) {
- ioType = currentOrNull(currentText);
- }
- currentText.setLength(0);
- }
-
- private static VMImage.OSDiskConfiguration.Caching parseHostCache(String hostCaching) {
- try {
- return VMImage.OSDiskConfiguration.Caching.valueOf(UPPER_CAMEL.to(UPPER_UNDERSCORE, hostCaching));
- } catch (IllegalArgumentException e) {
- return VMImage.OSDiskConfiguration.Caching.NONE;
- }
- }
-
- private static VMImage.OSDiskConfiguration.OSState parseOSState(String osState) {
- try {
- return VMImage.OSDiskConfiguration.OSState.valueOf(UPPER_CAMEL.to(UPPER_UNDERSCORE, osState));
- } catch (IllegalArgumentException e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- currentText.append(ch, start, length);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OSImageHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OSImageHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OSImageHandler.java
deleted file mode 100644
index 0932c08..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OSImageHandler.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import static com.google.common.base.Strings.emptyToNull;
-import static org.jclouds.util.SaxUtils.currentOrNull;
-
-import java.net.URI;
-import java.util.Date;
-import java.util.List;
-
-import org.jclouds.azurecompute.domain.OSImage;
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.http.functions.ParseSax;
-
-import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-
-/**
- * @see <a href="http://msdn.microsoft.com/en-us/library/jj157191" >api</a>
- */
-final class OSImageHandler extends ParseSax.HandlerForGeneratedRequestWithResult<OSImage> {
-
- private String name;
-
- private String location;
-
- private String affinityGroup;
-
- private String label;
-
- private String category;
-
- private String description;
-
- private String imageFamily;
-
- private OSImage.Type os;
-
- private URI mediaLink;
-
- private Integer logicalSizeInGB;
-
- private final List<String> eulas = Lists.newArrayList();
-
- private Date publishedDate;
-
- private String iconUri;
-
- private String smallIconUri;
-
- private URI privacyUri;
-
- private URI pricingDetailLink;
-
- private String recommendedVMSize;
-
- private Boolean isPremium;
-
- private Boolean showInGui;
-
- private String publisherName;
-
- private final StringBuilder currentText = new StringBuilder();
-
- @Override
- public OSImage getResult() {
- OSImage result = OSImage.create(name, location, affinityGroup, label, description, imageFamily, category, os,
- publisherName, mediaLink, logicalSizeInGB, ImmutableList.copyOf(eulas));
- resetState(); // handler is called in a loop.
- return result;
- }
-
- private void resetState() {
- name = affinityGroup = label = description = category = imageFamily = iconUri = smallIconUri = recommendedVMSize
- = publisherName = null;
- os = null;
- publisherName = null;
- mediaLink = null;
- logicalSizeInGB = null;
- publishedDate = null;
- privacyUri = pricingDetailLink = null;
- isPremium = null;
- showInGui = null;
- eulas.clear();
- location = null;
- }
-
- @Override
- public void endElement(String ignoredUri, String ignoredName, String qName) {
- if (qName.equals("OS")) {
- String osText = currentOrNull(currentText);
- if (osText != null) {
- os = OSImage.Type.valueOf(currentOrNull(currentText).toUpperCase());
- }
- } else if (qName.equals("Name")) {
- name = currentOrNull(currentText);
- } else if (qName.equals("LogicalSizeInGB")) {
- String gb = currentOrNull(currentText);
- if (gb != null) {
- logicalSizeInGB = Integer.parseInt(gb);
- }
- } else if (qName.equals("Description")) {
- description = currentOrNull(currentText);
- } else if (qName.equals("Category")) {
- category = currentOrNull(currentText);
- } else if (qName.equals("Location")) {
- location = currentOrNull(currentText);
- } else if (qName.equals("AffinityGroup")) {
- affinityGroup = currentOrNull(currentText);
- } else if (qName.equals("PublisherName")) {
- publisherName = currentOrNull(currentText);
- } else if (qName.equals("MediaLink")) {
- String link = currentOrNull(currentText);
- if (link != null) {
- mediaLink = URI.create(link);
- }
- } else if (qName.equals("Eula")) {
- String eulaField = currentOrNull(currentText);
- if (eulaField != null) {
- for (String eula : Splitter.on(';').split(eulaField)) {
- if ((eula = emptyToNull(eula.trim())) != null) { // Dirty data in RightScale eulas field.
- eulas.add(eula);
- }
- }
- }
- } else if (qName.equals("Label")) {
- label = currentOrNull(currentText);
- } else if (qName.equals("ImageFamily")) {
- imageFamily = currentOrNull(currentText);
- } else if (qName.equals("PublishedDate")) {
- String date = currentOrNull(currentText);
- if (date != null) {
- publishedDate = new SimpleDateFormatDateService().iso8601DateOrSecondsDateParse(date);
- }
- } else if (qName.equals("IconUri")) {
- iconUri = currentOrNull(currentText);
- } else if (qName.equals("SmallIconUri")) {
- smallIconUri = currentOrNull(currentText);
- } else if (qName.equals("PrivacyUri")) {
- String uri = currentOrNull(currentText);
- if (uri != null) {
- privacyUri = URI.create(uri);
- }
- } else if (qName.equals("RecommendedVMSize")) {
- recommendedVMSize = currentOrNull(currentText);
- } else if (qName.equals("IsPremium")) {
- String premium = currentOrNull(currentText);
- if (premium != null) {
- isPremium = Boolean.valueOf(premium);
- }
- } else if (qName.equals("ShowInGui")) {
- String show = currentOrNull(currentText);
- if (show != null) {
- showInGui = Boolean.valueOf(show);
- }
- } else if (qName.equals("PublisherName")) {
- publisherName = currentOrNull(currentText);
- } else if (qName.equals("PricingDetailLink")) {
- String uri = currentOrNull(currentText);
- if (uri != null) {
- pricingDetailLink = URI.create(uri);
- }
- }
-
- currentText.setLength(0);
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- currentText.append(ch, start, length);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OSVirtualHardDiskHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OSVirtualHardDiskHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OSVirtualHardDiskHandler.java
deleted file mode 100644
index 265e786..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OSVirtualHardDiskHandler.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import static org.jclouds.util.SaxUtils.currentOrNull;
-import java.net.URI;
-
-import org.jclouds.azurecompute.domain.OSImage;
-import org.jclouds.azurecompute.domain.Role;
-import org.jclouds.http.functions.ParseSax;
-
-public class OSVirtualHardDiskHandler extends ParseSax.HandlerForGeneratedRequestWithResult<Role.OSVirtualHardDisk> {
-
- private String hostCaching;
-
- private String diskName;
-
- private URI mediaLink;
-
- private String sourceImageName;
-
- private OSImage.Type os;
-
- private Integer lun;
-
- private Integer logicalDiskSizeInGB;
-
- private final StringBuilder currentText = new StringBuilder();
-
- @Override
- public Role.OSVirtualHardDisk getResult() {
- return Role.OSVirtualHardDisk.create(hostCaching, diskName, lun, logicalDiskSizeInGB, mediaLink, sourceImageName, os);
- }
-
- @Override
- public void endElement(String ignoredUri, String ignoredName, String qName) {
- if (qName.equals("HostCaching")) {
- hostCaching = currentOrNull(currentText);
- } else if (qName.equals("DiskName")) {
- diskName = currentOrNull(currentText);
- } else if (qName.equals("MediaLink")) {
- String link = currentOrNull(currentText);
- if (link != null) {
- mediaLink = URI.create(link);
- }
- } else if (qName.equals("SourceImageName")) {
- sourceImageName = currentOrNull(currentText);
- } else if (qName.equals("OS")) {
- String osText = currentOrNull(currentText);
- if (osText != null) {
- os = OSImage.Type.valueOf(currentOrNull(currentText).toUpperCase());
- }
- }
- currentText.setLength(0);
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- currentText.append(ch, start, length);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OperationHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OperationHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OperationHandler.java
deleted file mode 100644
index 321316d..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/OperationHandler.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import static com.google.common.base.CaseFormat.UPPER_CAMEL;
-import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
-import static org.jclouds.util.SaxUtils.currentOrNull;
-
-import org.jclouds.azurecompute.domain.Error;
-import org.jclouds.azurecompute.domain.Operation;
-import org.jclouds.azurecompute.domain.Operation.Status;
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-/**
- * @see <a href="http://msdn.microsoft.com/en-us/library/ee460783" >api</a>
- */
-public final class OperationHandler extends ParseSax.HandlerForGeneratedRequestWithResult<Operation> {
-
- private String id;
-
- private Status status;
-
- private Integer httpStatusCode;
-
- private Error error;
-
- private boolean inError;
-
- private final ErrorHandler errorHandler = new ErrorHandler();
-
- private final StringBuilder currentText = new StringBuilder();
-
- @Override
- public Operation getResult() {
- return Operation.create(id, status, httpStatusCode, error);
- }
-
- @Override
- public void startElement(String url, String name, String qName, Attributes attributes) {
- if (qName.equals("Error")) {
- inError = true;
- }
- }
-
- @Override
- public void endElement(String uri, String name, String qName) {
- if (qName.equals("Error")) {
- error = errorHandler.getResult();
- inError = false;
- } else if (inError) {
- errorHandler.endElement(uri, name, qName);
- } else if (qName.equals("ID")) {
- id = currentOrNull(currentText);
- } else if (qName.equals("Status")) {
- String statusText = currentOrNull(currentText);
- status = Status.fromString(UPPER_CAMEL.to(UPPER_UNDERSCORE, statusText));
- } else if (qName.equals("HttpStatusCode")) {
- httpStatusCode = Integer.parseInt(currentOrNull(currentText));
- }
- currentText.setLength(0);
- }
-
- @Override
- public void characters(char[] ch, int start, int length) {
- if (inError) {
- errorHandler.characters(ch, start, length);
- } else {
- currentText.append(ch, start, length);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionEndpointHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionEndpointHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionEndpointHandler.java
deleted file mode 100644
index 8266a17..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionEndpointHandler.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import static org.jclouds.util.SaxUtils.currentOrNull;
-
-import org.jclouds.azurecompute.domain.ProfileDefinition;
-import org.jclouds.azurecompute.domain.ProfileDefinitionEndpoint;
-import org.jclouds.azurecompute.domain.ProfileDefinition.HealthStatus;
-import org.jclouds.azurecompute.domain.ProfileDefinition.Status;
-
-import org.jclouds.http.functions.ParseSax;
-
-import org.xml.sax.Attributes;
-
-/**
- * @see <a href="http://msdn.microsoft.com/en-us/library/gg441293" >Response body description</a>
- */
-public final class ProfileDefinitionEndpointHandler
- extends ParseSax.HandlerForGeneratedRequestWithResult<ProfileDefinitionEndpoint> {
-
- private String domain;
-
- private Status status;
-
- private HealthStatus healthStatus;
-
- private ProfileDefinitionEndpoint.Type type;
-
- private String location;
-
- private Integer weight;
-
- private Integer min;
-
- private final StringBuilder currentText = new StringBuilder();
-
- @Override
- public ProfileDefinitionEndpoint getResult() {
- final ProfileDefinitionEndpoint result = ProfileDefinitionEndpoint.create(
- domain, status, healthStatus, type, location, weight, min);
- resetState(); // handler is called in a loop.
- return result;
- }
-
- private void resetState() {
- domain = location = null;
- min = null;
- status = null;
- type = null;
- }
-
- @Override
- public void startElement(
- final String ignoredUri,
- final String ignoredLocalName,
- final String qName,
- final Attributes ignoredAttributes) {
- }
-
- @Override
- public void endElement(final String ignoredUri, final String ignoredName, final String qName) {
- if (qName.equals("DomainName")) {
- domain = currentOrNull(currentText);
- } else if (qName.equals("Status")) {
- final String value = currentText.toString().trim();
- status = value.isEmpty()
- ? null
- : Status.fromString(value);
- } else if (qName.equals("MonitorStatus")) {
- final String value = currentText.toString().trim();
- healthStatus = value.isEmpty()
- ? null
- : ProfileDefinition.HealthStatus.fromString(value);
- } else if (qName.equals("Type")) {
- final String value = currentText.toString().trim();
- type = value.isEmpty()
- ? ProfileDefinitionEndpoint.Type.CLOUDSERVICE
- : ProfileDefinitionEndpoint.Type.fromString(value);
- } else if (qName.equals("Location")) {
- location = currentOrNull(currentText);
- } else if (qName.equals("Weight")) {
- final String value = currentText.toString().trim();
- weight = value.isEmpty() ? 1 : Integer.parseInt(value);
- } else if (qName.equals("MinChildEndpoints")) {
- final String value = currentText.toString().trim();
- min = value.isEmpty() ? 1 : Integer.parseInt(value);
- }
- currentText.setLength(0);
- }
-
- @Override
- public void characters(final char[] ch, final int start, final int length) {
- currentText.append(ch, start, length);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionHandler.java
deleted file mode 100644
index 98a8804..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionHandler.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableList.Builder;
-import static org.jclouds.util.SaxUtils.currentOrNull;
-
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-import javax.inject.Inject;
-import org.jclouds.azurecompute.domain.ProfileDefinition;
-import org.jclouds.azurecompute.domain.ProfileDefinitionEndpoint;
-import org.jclouds.azurecompute.domain.ProfileDefinitionMonitor;
-
-/**
- * @see <a href="http://msdn.microsoft.com/en-us/library/gg441293" >Response body description</a>
- */
-public final class ProfileDefinitionHandler extends ParseSax.HandlerForGeneratedRequestWithResult<ProfileDefinition> {
-
- private Integer ttl;
-
- private ProfileDefinition.Status status;
-
- private String version;
-
- private Builder<ProfileDefinitionMonitor> monitors = ImmutableList.<ProfileDefinitionMonitor>builder();
-
- private ProfileDefinition.LBMethod lb;
-
- private Builder<ProfileDefinitionEndpoint> endpoints = ImmutableList.<ProfileDefinitionEndpoint>builder();
-
- private ProfileDefinition.HealthStatus healthStatus;
-
- private final StringBuilder currentText = new StringBuilder();
-
- private final ProfileDefinitionMonitorHandler monitorHandler;
-
- private final ProfileDefinitionEndpointHandler endpointHandler;
-
- private boolean inMonitor = false;
- private boolean inEndpoint = false;
-
- @Inject
- public ProfileDefinitionHandler(
- ProfileDefinitionMonitorHandler monitorHandler, ProfileDefinitionEndpointHandler endpointHandler) {
- this.monitorHandler = monitorHandler;
- this.endpointHandler = endpointHandler;
- }
-
- @Override
- public ProfileDefinition getResult() {
- final ProfileDefinition result = ProfileDefinition.create(
- ttl, status, version, monitors.build(), lb, endpoints.build(), healthStatus);
- resetState(); // handler is called in a loop.
- return result;
- }
-
- private void resetState() {
- ttl = null;
- status = null;
- version = null;
- monitors = ImmutableList.<ProfileDefinitionMonitor>builder();
- lb = null;
- endpoints = ImmutableList.<ProfileDefinitionEndpoint>builder();
- inMonitor = false;
- inEndpoint = false;
- }
-
- @Override
- public void startElement(
- final String url,
- final String name,
- final String qName,
- final Attributes attributes) {
-
- if (!inEndpoint && qName.equals("Monitor")) {
- inMonitor = true;
- }
-
- if (!inMonitor && qName.equals("Endpoint")) {
- inEndpoint = true;
- }
-
- if (inMonitor) {
- monitorHandler.startElement(url, name, qName, attributes);
- } else if (inEndpoint) {
- endpointHandler.startElement(url, name, qName, attributes);
- }
- }
-
- @Override
- public void endElement(final String uri, final String name, final String qName) {
- if (!inEndpoint && qName.equals("Monitor")) {
- inMonitor = false;
- monitors.add(monitorHandler.getResult());
- } else if (!inMonitor && qName.equals("Endpoint")) {
- inEndpoint = false;
- endpoints.add(endpointHandler.getResult());
- } else if (inMonitor) {
- monitorHandler.endElement(uri, name, qName);
- } else if (inEndpoint) {
- endpointHandler.endElement(uri, name, qName);
- } else {
- if (qName.equals("TimeToLiveInSeconds")) {
- ttl = Integer.parseInt(currentOrNull(currentText));
- } else if (qName.equals("Status")) {
- status = ProfileDefinition.Status.fromString(currentOrNull(currentText));
- } else if (qName.equals("Version")) {
- version = currentOrNull(currentText);
- } else if (qName.equals("LoadBalancingMethod")) {
- lb = ProfileDefinition.LBMethod.fromString(currentOrNull(currentText));
- } else if (qName.equals("MonitorStatus")) {
- final String value = currentText.toString().trim();
- healthStatus = value.isEmpty()
- ? null
- : ProfileDefinition.HealthStatus.fromString(value);
- }
- currentText.setLength(0);
- }
- }
-
- @Override
- public void characters(final char[] ch, final int start, final int length) {
- if (inMonitor) {
- monitorHandler.characters(ch, start, length);
- } else if (inEndpoint) {
- endpointHandler.characters(ch, start, length);
- } else {
- currentText.append(ch, start, length);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionMonitorHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionMonitorHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionMonitorHandler.java
deleted file mode 100644
index 2a19158..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileDefinitionMonitorHandler.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import static org.jclouds.util.SaxUtils.currentOrNull;
-
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-import org.jclouds.azurecompute.domain.ProfileDefinition;
-import org.jclouds.azurecompute.domain.ProfileDefinitionMonitor;
-
-/**
- * @see <a href="http://msdn.microsoft.com/en-us/library/gg441293" >Response body description</a>
- */
-public final class ProfileDefinitionMonitorHandler
- extends ParseSax.HandlerForGeneratedRequestWithResult<ProfileDefinitionMonitor> {
-
- private Integer intervall;
-
- private Integer timeout;
-
- private Integer toleration;
-
- private ProfileDefinition.Protocol protocol;
-
- private Integer port;
-
- private String verb;
-
- private String path;
-
- private Integer expected;
-
- private final StringBuilder currentText = new StringBuilder();
-
- @Override
- public ProfileDefinitionMonitor getResult() {
- final ProfileDefinitionMonitor result = ProfileDefinitionMonitor.create(
- intervall, timeout, toleration, protocol, port, verb, path, expected);
- resetState(); // handler is called in a loop.
- return result;
- }
-
- private void resetState() {
- intervall = timeout = toleration = port = expected = null;
- protocol = null;
- verb = path = null;
- }
-
- @Override
- public void startElement(
- final String ignoredUri,
- final String ignoredLocalName,
- final String qName,
- final Attributes ignoredAttributes) {
- }
-
- @Override
- public void endElement(final String ignoredUri, final String ignoredName, final String qName) {
- if (qName.equals("IntervalInSeconds")) {
- final String value = currentText.toString().trim();
- intervall = value.isEmpty()
- ? ProfileDefinitionMonitor.DEFAULT_INTERVAL
- : Integer.parseInt(value);
- } else if (qName.equals("TimeoutInSeconds")) {
- final String value = currentText.toString().trim();
- timeout = value.isEmpty()
- ? ProfileDefinitionMonitor.DEFAULT_TIMEOUT
- : Integer.parseInt(value);
- } else if (qName.equals("ToleratedNumberOfFailures")) {
- final String value = currentText.toString().trim();
- toleration = value.isEmpty()
- ? ProfileDefinitionMonitor.DEFAULT_TOLERAION
- : Integer.parseInt(value);
- } else if (qName.equals("Protocol")) {
- protocol = ProfileDefinition.Protocol.fromString(currentOrNull(currentText));
- } else if (qName.equals("Port")) {
- port = Integer.parseInt(currentOrNull(currentText));
- } else if (qName.equals("Verb")) {
- final String value = currentText.toString().trim();
- verb = value.isEmpty()
- ? ProfileDefinitionMonitor.DEFAULT_VERB
- : value;
- } else if (qName.equals("RelativePath")) {
- path = currentOrNull(currentText);
- } else if (qName.equals("ExpectedStatusCode")) {
- final String value = currentText.toString().trim();
- expected = value.isEmpty()
- ? ProfileDefinitionMonitor.DEFAULT_EXPECTED
- : Integer.parseInt(value);
- }
- currentText.setLength(0);
- }
-
- @Override
- public void characters(final char[] ch, final int start, final int length) {
- currentText.append(ch, start, length);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileHandler.java
deleted file mode 100644
index 8df6a85..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ProfileHandler.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import com.google.common.collect.ImmutableMap;
-import static org.jclouds.util.SaxUtils.currentOrNull;
-
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-import org.jclouds.azurecompute.domain.Profile;
-import org.jclouds.azurecompute.domain.ProfileDefinition;
-
-/**
- * @see <a href="https://msdn.microsoft.com/en-us/library/azure/hh758251.aspx" >Response body description</a>
- */
-public final class ProfileHandler extends ParseSax.HandlerForGeneratedRequestWithResult<Profile> {
-
- private String domain;
-
- private String name;
-
- private ProfileDefinition.Status status;
-
- private String version;
-
- private ImmutableMap.Builder<String, ProfileDefinition.Status> definitions
- = ImmutableMap.<String, ProfileDefinition.Status>builder();
-
- private final StringBuilder currentText = new StringBuilder();
-
- private boolean inDefinition = false;
-
- private String definitionVersion = null;
- private ProfileDefinition.Status definitionStatus = null;
-
- @Override
- public Profile getResult() {
- final Profile result = Profile.create(domain, name, status, version, definitions.build());
- resetState(); // handler is called in a loop.
- return result;
- }
-
- private void resetState() {
- domain = name = version = null;
- status = null;
- definitions = ImmutableMap.<String, ProfileDefinition.Status>builder();
- inDefinition = false;
- }
-
- @Override
- public void startElement(
- final String url,
- final String name,
- final String qName,
- final Attributes attributes) {
-
- if (qName.equals("Definition")) {
- inDefinition = true;
- }
- }
-
- @Override
- public void endElement(final String ignoredURI, final String ignoredName, final String qName) {
- if (qName.equals("Definition")) {
- inDefinition = false;
- definitions.put(definitionVersion, definitionStatus);
- } else if (inDefinition) {
- if (qName.equals("Status")) {
- final String value = currentText.toString().trim();
- definitionStatus = value.isEmpty()
- ? null
- : ProfileDefinition.Status.fromString(value);
- } else if (qName.equals("Version")) {
- definitionVersion = currentOrNull(currentText);
- }
- } else {
- if (qName.equals("DomainName")) {
- domain = currentOrNull(currentText);
- } else if (qName.equals("Name")) {
- name = currentOrNull(currentText);
- } else if (qName.equals("Status")) {
- final String value = currentText.toString().trim();
- status = value.isEmpty()
- ? null
- : ProfileDefinition.Status.fromString(value);
- } else if (qName.equals("EnabledVersion")) {
- version = currentOrNull(currentText);
- }
- }
- currentText.setLength(0);
-
- }
-
- @Override
- public void characters(final char[] ch, final int start, final int length) {
- currentText.append(ch, start, length);
- }
-}
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/eb990020/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ReservedIPAddressHandler.java
----------------------------------------------------------------------
diff --git a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ReservedIPAddressHandler.java b/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ReservedIPAddressHandler.java
deleted file mode 100644
index c3838e0..0000000
--- a/azurecompute/src/main/java/org/jclouds/azurecompute/xml/ReservedIPAddressHandler.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF 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.azurecompute.xml;
-
-import static org.jclouds.util.SaxUtils.currentOrNull;
-
-import org.jclouds.http.functions.ParseSax;
-import org.xml.sax.Attributes;
-
-import org.jclouds.azurecompute.domain.ReservedIPAddress;
-import org.jclouds.azurecompute.domain.ReservedIPAddress.State;
-
-/**
- * @see <a href="https://msdn.microsoft.com/en-us/library/azure/dn722412.aspx" >Response body description</a>
- */
-public final class ReservedIPAddressHandler extends ParseSax.HandlerForGeneratedRequestWithResult<ReservedIPAddress> {
-
- private String name;
-
- private String address;
-
- private String id;
-
- private String label;
-
- private State state;
-
- private Boolean inUse;
-
- private String serviceName;
-
- private String deploymentName;
-
- private String location;
-
- private final StringBuilder currentText = new StringBuilder();
-
- @Override
- public ReservedIPAddress getResult() {
- final ReservedIPAddress result = ReservedIPAddress.create(
- name, address, id, label, state, inUse, serviceName, deploymentName, location);
- resetState(); // handler is called in a loop.
- return result;
- }
-
- private void resetState() {
- name = address = id = label = serviceName = deploymentName = location = null;
- state = null;
- inUse = null;
- }
-
- @Override
- public void startElement(
- final String ignoredUri,
- final String ignoredLocalName,
- final String qName,
- final Attributes ignoredAttributes) {
- }
-
- @Override
- public void endElement(final String ignoredUri, final String ignoredName, final String qName) {
- if (qName.equals("Name")) {
- name = currentOrNull(currentText);
- } else if (qName.equals("Address")) {
- address = currentOrNull(currentText);
- } else if (qName.equals("Id")) {
- id = currentOrNull(currentText);
- } else if (qName.equals("Label")) {
- label = currentOrNull(currentText);
- } else if (qName.equals("State")) {
- state = State.fromString(currentOrNull(currentText));
- } else if (qName.equals("InUse")) {
- final String use = currentOrNull(currentText);
- inUse = use == null ? null : Boolean.valueOf(use);
- } else if (qName.equals("ServiceName")) {
- serviceName = currentOrNull(currentText);
- } else if (qName.equals("DeploymentName")) {
- deploymentName = currentOrNull(currentText);
- } else if (qName.equals("Location")) {
- location = currentOrNull(currentText);
- }
- currentText.setLength(0);
- }
-
- @Override
- public void characters(final char[] ch, final int start, final int length) {
- currentText.append(ch, start, length);
- }
-}