You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ad...@apache.org on 2013/09/30 18:15:30 UTC
[10/17] JCLOUDS-304. Remove broken terremark providers
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/predicates/TaskSuccess.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/predicates/TaskSuccess.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/predicates/TaskSuccess.java
deleted file mode 100644
index 62b88d7..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/predicates/TaskSuccess.java
+++ /dev/null
@@ -1,64 +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.trmk.vcloud_0_8.predicates;
-
-import java.net.URI;
-
-import javax.annotation.Resource;
-import javax.inject.Singleton;
-
-import org.jclouds.logging.Logger;
-import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudApi;
-import org.jclouds.trmk.vcloud_0_8.domain.Task;
-import org.jclouds.trmk.vcloud_0_8.domain.TaskStatus;
-
-import com.google.common.base.Predicate;
-import com.google.inject.Inject;
-
-/**
- *
- * Tests to see if a task succeeds.
- *
- * @author Adrian Cole
- */
-@Singleton
-public class TaskSuccess implements Predicate<URI> {
-
- private final TerremarkVCloudApi client;
-
- @Resource
- protected Logger logger = Logger.NULL;
-
- @Inject
- public TaskSuccess(TerremarkVCloudApi client) {
- this.client = client;
- }
-
- public boolean apply(URI taskId) {
- logger.trace("looking for status on task %s", taskId);
-
- Task task = client.getTask(taskId);
- // perhaps task isn't available, yet
- if (task == null)
- return false;
- logger.trace("%s: looking for status %s: currently: %s", task, TaskStatus.SUCCESS, task.getStatus());
- if (task.getStatus() == TaskStatus.ERROR)
- throw new RuntimeException("error on task: " + task.getHref() + " error: " + task.getError());
- return task.getStatus() == TaskStatus.SUCCESS;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/reference/TerremarkConstants.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/reference/TerremarkConstants.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/reference/TerremarkConstants.java
deleted file mode 100644
index 3ff7596..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/reference/TerremarkConstants.java
+++ /dev/null
@@ -1,29 +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.trmk.vcloud_0_8.reference;
-
-/**
- * Configuration properties and constants used in Terremark connections.
- *
- * @author Adrian Cole
- */
-public interface TerremarkConstants {
- public static final String PROPERTY_TERREMARK_EXTENSION_NAME = "jclouds.terremark.extension.name";
- public static final String PROPERTY_TERREMARK_EXTENSION_VERSION = "jclouds.terremark.extension.version";
- public static final String PROPERTY_TERREMARK_EXTENSION_NS = "jclouds.terremark.extension.ns";
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/reference/VCloudConstants.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/reference/VCloudConstants.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/reference/VCloudConstants.java
deleted file mode 100644
index f271139..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/reference/VCloudConstants.java
+++ /dev/null
@@ -1,55 +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.trmk.vcloud_0_8.reference;
-
-/**
- * Configuration properties and constants used in VCloud connections.
- *
- * @author Adrian Cole
- */
-public interface VCloudConstants {
- public static final String PROPERTY_VCLOUD_VERSION_SCHEMA = "jclouds.vcloud.version.schema";
- /**
- * name of the default org that your vApp will join, if an org isn't
- * explicitly specified.
- */
- public static final String PROPERTY_VCLOUD_DEFAULT_ORG = "jclouds.vcloud.defaults.org";
- /**
- * name of the default catalog to query, if it isn't explicitly specified.
- */
- public static final String PROPERTY_VCLOUD_DEFAULT_CATALOG = "jclouds.vcloud.defaults.catalog";
- /**
- * name of the default taskslist to query, if it isn't explicitly specified.
- */
- public static final String PROPERTY_VCLOUD_DEFAULT_TASKSLIST = "jclouds.vcloud.defaults.taskslist";
- /**
- * name of the VDC that your vApp will join, if a vDC isn't explicitly
- * specified.
- */
- public static final String PROPERTY_VCLOUD_DEFAULT_VDC = "jclouds.vcloud.defaults.vdc";
- /**
- * name of the default network, in the default VDC that your vApp will join.
- */
- public static final String PROPERTY_VCLOUD_DEFAULT_NETWORK = "jclouds.vcloud.defaults.network";
- public static final String PROPERTY_VCLOUD_DEFAULT_FENCEMODE = "jclouds.vcloud.defaults.fencemode";
-
- public static final String PROPERTY_VCLOUD_XML_NAMESPACE = "jclouds.vcloud.xml.ns";
- public static final String PROPERTY_VCLOUD_XML_SCHEMA = "jclouds.vcloud.xml.schema";
-
- public static final String PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED = "jclouds.vcloud.timeout.task-complete";
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/reference/package-info.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/reference/package-info.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/reference/package-info.java
deleted file mode 100644
index cccf474..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/reference/package-info.java
+++ /dev/null
@@ -1,21 +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.
- */
-/**
- * This package contains properties and reference data used in vCloud.
- * @author Adrian Cole
- */
-package org.jclouds.trmk.vcloud_0_8.reference;
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/suppliers/InternetServiceAndPublicIpAddressSupplier.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/suppliers/InternetServiceAndPublicIpAddressSupplier.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/suppliers/InternetServiceAndPublicIpAddressSupplier.java
deleted file mode 100644
index 102f114..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/suppliers/InternetServiceAndPublicIpAddressSupplier.java
+++ /dev/null
@@ -1,32 +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.trmk.vcloud_0_8.suppliers;
-
-import java.util.Map.Entry;
-
-import org.jclouds.trmk.vcloud_0_8.domain.InternetService;
-import org.jclouds.trmk.vcloud_0_8.domain.Protocol;
-import org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress;
-import org.jclouds.trmk.vcloud_0_8.domain.VApp;
-
-/**
- * @author Adrian Cole
- */
-public interface InternetServiceAndPublicIpAddressSupplier {
- Entry<InternetService, PublicIpAddress> getNewInternetServiceAndIp(VApp vApp, int port,
- Protocol protocol);
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault.java
deleted file mode 100644
index df3ee73..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/suppliers/OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault.java
+++ /dev/null
@@ -1,99 +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.trmk.vcloud_0_8.suppliers;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.NoSuchElementException;
-
-import org.jclouds.config.ValueOfConfigurationKeyOrNull;
-import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
-
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-
-/**
- *
- * @author Adrian Cole
- */
-public class OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault implements
- Function<Iterable<ReferenceType>, ReferenceType> {
-
- protected final ValueOfConfigurationKeyOrNull valueOfConfigurationKeyOrNull;
- protected final String configurationKey;
- protected final Predicate<ReferenceType> defaultSelector;
-
- public OnlyReferenceTypeFirstWithNameMatchingConfigurationKeyOrDefault(
- ValueOfConfigurationKeyOrNull valueOfConfigurationKeyOrNull, String configurationKey,
- Predicate<ReferenceType> defaultSelector) {
- this.configurationKey = checkNotNull(configurationKey, "configurationKey");
- this.valueOfConfigurationKeyOrNull = checkNotNull(valueOfConfigurationKeyOrNull, "valueOfConfigurationKeyOrNull");
- this.defaultSelector = checkNotNull(defaultSelector, "defaultSelector");
- }
-
- @Override
- public ReferenceType apply(Iterable<ReferenceType> referenceTypes) {
- checkNotNull(referenceTypes, "referenceTypes");
- checkArgument(Iterables.size(referenceTypes) > 0,
- "No referenceTypes corresponding to configuration key %s present", configurationKey);
- if (Iterables.size(referenceTypes) == 1)
- return Iterables.getLast(referenceTypes);
- String namingPattern = valueOfConfigurationKeyOrNull.apply(configurationKey);
- if (namingPattern != null) {
- return findReferenceTypeWithNameMatchingPattern(referenceTypes, namingPattern);
- } else {
- return defaultReferenceType(referenceTypes);
- }
- }
-
- public ReferenceType defaultReferenceType(Iterable<ReferenceType> referenceTypes) {
- return Iterables.find(referenceTypes, defaultSelector);
- }
-
- public ReferenceType findReferenceTypeWithNameMatchingPattern(Iterable<ReferenceType> referenceTypes,
- String namingPattern) {
- try {
- return Iterables.find(referenceTypes, new ReferenceTypeNameMatchesPattern(namingPattern));
- } catch (NoSuchElementException e) {
- throw new NoSuchElementException(String.format(
- "referenceType matching pattern [%s], corresponding to configuration key %s, not in %s", namingPattern,
- configurationKey, referenceTypes));
- }
- }
-
- static class ReferenceTypeNameMatchesPattern implements Predicate<ReferenceType> {
-
- private final String namingPattern;
-
- public ReferenceTypeNameMatchesPattern(String namingPattern) {
- this.namingPattern = checkNotNull(namingPattern, "namingPattern");
- }
-
- @Override
- public boolean apply(ReferenceType arg0) {
- return arg0.getName().matches(namingPattern);
- }
-
- @Override
- public String toString() {
- return "nameMatchesPattern(" + namingPattern + ")";
-
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/util/Utils.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/util/Utils.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/util/Utils.java
deleted file mode 100644
index 86b6b63..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/util/Utils.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.trmk.vcloud_0_8.util;
-
-import java.net.URI;
-import java.util.Map;
-
-import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
-import org.jclouds.trmk.vcloud_0_8.domain.VCloudError;
-import org.jclouds.trmk.vcloud_0_8.domain.VCloudError.MinorCode;
-import org.jclouds.trmk.vcloud_0_8.domain.internal.ErrorImpl;
-import org.jclouds.trmk.vcloud_0_8.domain.internal.ReferenceTypeImpl;
-
-/**
- *
- * @author Adrian Cole
- */
-public class Utils {
-
- public static ReferenceType newReferenceType(Map<String, String> attributes, String defaultType) {
- String uri = attributes.get("href");
- String type = attributes.get("type");
- // savvis org has null href
- URI href = (uri != null) ? URI.create(uri) : null;
- return new ReferenceTypeImpl(attributes.get("name"), type != null ? type : defaultType, href);
- }
-
- public static ReferenceType newReferenceType(Map<String, String> attributes) {
- return newReferenceType(attributes, null);
- }
-
- public static VCloudError newError(Map<String, String> attributes) {
-
- String vendorSpecificErrorCode = attributes.get("vendorSpecificErrorCode");
- int errorCode;
- // remove this logic when vcloud 0.8 is gone
- try {
- errorCode = Integer.parseInt(attributes.get("majorErrorCode"));
- } catch (NumberFormatException e) {
- errorCode = 500;
- vendorSpecificErrorCode = attributes.get("majorErrorCode");
- }
- MinorCode minorErrorCode = attributes.containsKey("minorErrorCode") ? MinorCode.fromValue(attributes
- .get("minorErrorCode")) : null;
- if (minorErrorCode == null || minorErrorCode == MinorCode.UNRECOGNIZED) {
- vendorSpecificErrorCode = attributes.get("minorErrorCode");
- }
-
- return new ErrorImpl(attributes.get("message"), errorCode, minorErrorCode, vendorSpecificErrorCode, attributes
- .get("stackTrace"));
- }
-
- public static void putReferenceType(Map<String, ReferenceType> map, Map<String, String> attributes) {
- map.put(attributes.get("name"), newReferenceType(attributes));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/util/VCloudUtils.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/util/VCloudUtils.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/util/VCloudUtils.java
deleted file mode 100644
index 378a6f5..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/util/VCloudUtils.java
+++ /dev/null
@@ -1,64 +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.trmk.vcloud_0_8.util;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-import javax.inject.Provider;
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.HttpResponse;
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.http.functions.ParseSax.Factory;
-import org.jclouds.logging.Logger;
-import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType;
-import org.jclouds.trmk.vcloud_0_8.domain.VCloudError;
-import org.jclouds.trmk.vcloud_0_8.xml.ErrorHandler;
-
-/**
- * Needed to sign and verify requests and responses.
- *
- * @author Adrian Cole
- */
-@Singleton
-public class VCloudUtils {
- private final ParseSax.Factory factory;
- private final Provider<ErrorHandler> errorHandlerProvider;
- @Resource
- protected Logger logger = Logger.NULL;
-
- @Inject
- VCloudUtils(Factory factory, Provider<ErrorHandler> errorHandlerProvider) {
- this.factory = factory;
- this.errorHandlerProvider = errorHandlerProvider;
- }
-
- public VCloudError parseErrorFromContent(HttpRequest request, HttpResponse response) {
- // HEAD has no content
- if (response.getPayload() == null)
- return null;
- if (TerremarkVCloudMediaType.ERROR_XML.equals(response.getPayload().getContentMetadata().getContentType())) {
- try {
- return factory.create(errorHandlerProvider.get()).setContext(request).apply(response);
- } catch (RuntimeException e) {
- logger.warn(e, "error parsing error");
- }
- }
- return null;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/CatalogHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/CatalogHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/CatalogHandler.java
deleted file mode 100644
index 0f08e67..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/CatalogHandler.java
+++ /dev/null
@@ -1,75 +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.trmk.vcloud_0_8.xml;
-
-import static org.jclouds.trmk.vcloud_0_8.util.Utils.newReferenceType;
-import static org.jclouds.trmk.vcloud_0_8.util.Utils.putReferenceType;
-
-import java.util.Map;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.trmk.vcloud_0_8.TerremarkVCloudMediaType;
-import org.jclouds.trmk.vcloud_0_8.domain.Catalog;
-import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
-import org.jclouds.trmk.vcloud_0_8.domain.internal.CatalogImpl;
-import org.jclouds.util.SaxUtils;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-import com.google.common.collect.Maps;
-
-/**
- * @author Adrian Cole
- */
-public class CatalogHandler extends ParseSax.HandlerWithResult<Catalog> {
-
- private StringBuilder currentText = new StringBuilder();
-
- private ReferenceType catalog;
- private Map<String, ReferenceType> contents = Maps.newLinkedHashMap();
- private String description;
-
- public Catalog getResult() {
- return new CatalogImpl(catalog.getName(), catalog.getType(), catalog.getHref(), description, contents);
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
- Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
- if (qName.equals("Catalog")) {
- catalog = newReferenceType(attributes, TerremarkVCloudMediaType.CATALOG_XML);
- } else if (qName.equals("CatalogItem")) {
- putReferenceType(contents, attributes);
- }
- }
-
- public void endElement(String uri, String name, String qName) {
- if (qName.equals("Description")) {
- description = currentOrNull();
- }
- currentText = new StringBuilder();
- }
-
- public void characters(char ch[], int start, int length) {
- currentText.append(ch, start, length);
- }
-
- protected String currentOrNull() {
- String returnVal = currentText.toString().trim();
- return returnVal.equals("") ? null : returnVal;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/CatalogItemHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/CatalogItemHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/CatalogItemHandler.java
deleted file mode 100644
index 512b5aa..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/CatalogItemHandler.java
+++ /dev/null
@@ -1,92 +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.trmk.vcloud_0_8.xml;
-
-import static org.jclouds.trmk.vcloud_0_8.util.Utils.newReferenceType;
-
-import java.util.Map;
-import java.util.SortedMap;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.trmk.vcloud_0_8.domain.CatalogItem;
-import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
-import org.jclouds.trmk.vcloud_0_8.domain.internal.CatalogItemImpl;
-import org.jclouds.util.SaxUtils;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-import com.google.common.collect.Maps;
-
-/**
- * @author Adrian Cole
- */
-public class CatalogItemHandler extends ParseSax.HandlerWithResult<CatalogItem> {
- private StringBuilder currentText = new StringBuilder();
-
- protected ReferenceType catalogItem;
- protected ReferenceType entity;
-
- protected String description;
- protected String key;
- protected SortedMap<String, String> properties = Maps.newTreeMap();
- private ReferenceType customizationOptions;
- private ReferenceType computeOptions;
-
- public CatalogItem getResult() {
- return new CatalogItemImpl(catalogItem.getName(), catalogItem.getHref(), description, computeOptions,
- customizationOptions, entity, properties);
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
- Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
- if (qName.equals("CatalogItem")) {
- catalogItem = newReferenceType(attributes);
- } else if (qName.equals("Entity")) {
- entity = newReferenceType(attributes);
- } else if (qName.equals("Property")) {
- key = attributes.get("key");
- } else if (qName.equals("Link")) {
- if (attributes.containsKey("name")) {
- if (attributes.get("name").equals("Customization Options")) {
- customizationOptions = newReferenceType(attributes);
- } else if (attributes.get("name").equals("Compute Options")) {
- computeOptions = newReferenceType(attributes);
- }
- }
- }
- }
-
- public void endElement(String uri, String name, String qName) {
- if (qName.equals("Description")) {
- description = currentOrNull();
- } else if (qName.equals("Property")) {
- properties.put(key, currentOrNull());
- key = null;
- }
- currentText = new StringBuilder();
- }
-
- public void characters(char ch[], int start, int length) {
- currentText.append(ch, start, length);
- }
-
- protected String currentOrNull() {
- String returnVal = currentText.toString().trim();
- return returnVal.equals("") ? null : returnVal;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/CustomizationParametersHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/CustomizationParametersHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/CustomizationParametersHandler.java
deleted file mode 100644
index 466ef80..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/CustomizationParametersHandler.java
+++ /dev/null
@@ -1,60 +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.trmk.vcloud_0_8.xml;
-
-import org.jclouds.http.functions.ParseSax.HandlerWithResult;
-import org.jclouds.trmk.vcloud_0_8.domain.CustomizationParameters;
-
-/**
- * @author Adrian Cole
- */
-public class CustomizationParametersHandler extends HandlerWithResult<CustomizationParameters> {
-
- private StringBuilder currentText = new StringBuilder();
- boolean customizeNetwork;
- boolean customizePassword;
- boolean customizeSSH;
-
- protected String currentOrNull() {
- String returnVal = currentText.toString().trim();
- return returnVal.equals("") ? null : returnVal;
- }
-
- @Override
- public CustomizationParameters getResult() {
- return new CustomizationParameters(customizeNetwork, customizePassword, customizeSSH);
- }
-
- public void endElement(String uri, String name, String qName) {
- String current = currentOrNull();
- if (current != null) {
- if (qName.equals("CustomizeNetwork")) {
- customizeNetwork = Boolean.parseBoolean(current);
- } else if (qName.equals("CustomizePassword")) {
- customizePassword = Boolean.parseBoolean(current);
- } else if (qName.equals("CustomizeSSH")) {
- customizeSSH = Boolean.parseBoolean(current);
- }
- }
- currentText = new StringBuilder();
- }
-
- public void characters(char ch[], int start, int length) {
- currentText.append(ch, start, length);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/DataCenterHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/DataCenterHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/DataCenterHandler.java
deleted file mode 100644
index ebdb409..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/DataCenterHandler.java
+++ /dev/null
@@ -1,65 +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.trmk.vcloud_0_8.xml;
-
-import static org.jclouds.util.SaxUtils.currentOrNull;
-import static org.jclouds.util.SaxUtils.equalsOrSuffix;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.trmk.vcloud_0_8.domain.DataCenter;
-import org.xml.sax.Attributes;
-
-/**
- * @author Adrian Cole
- */
-public class DataCenterHandler extends ParseSax.HandlerWithResult<DataCenter> {
- protected StringBuilder currentText = new StringBuilder();
-
- protected DataCenter.Builder builder = DataCenter.builder();
-
- public DataCenter getResult() {
- try {
- return builder.build();
- } finally {
- builder = DataCenter.builder();
- }
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attrs) {
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) {
- String current = currentOrNull(currentText);
- if (current != null) {
- if (equalsOrSuffix(qName, "Id")) {
- builder.id(current);
- } else if (equalsOrSuffix(qName, "Code")) {
- builder.code(current);
- } else if (equalsOrSuffix(qName, "Name")) {
- builder.name(current);
- }
- }
- currentText = new StringBuilder();
- }
-
- public void characters(char ch[], int start, int length) {
- currentText.append(ch, start, length);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/DataCentersHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/DataCentersHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/DataCentersHandler.java
deleted file mode 100644
index e7239fa..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/DataCentersHandler.java
+++ /dev/null
@@ -1,71 +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.trmk.vcloud_0_8.xml;
-
-import static org.jclouds.util.SaxUtils.equalsOrSuffix;
-
-import java.util.Set;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.trmk.vcloud_0_8.domain.DataCenter;
-import org.xml.sax.Attributes;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.ImmutableSet.Builder;
-
-/**
- * @author Adrian Cole
- */
-public class DataCentersHandler extends ParseSax.HandlerWithResult<Set<DataCenter>> {
- protected Builder<DataCenter> dataCenters = ImmutableSet.builder();
-
- protected final DataCenterHandler handler;
-
- public Set<DataCenter> getResult() {
- try {
- return dataCenters.build();
- } finally {
- dataCenters = ImmutableSet.<DataCenter> builder();
- }
- }
-
- @Inject
- public DataCentersHandler(DataCenterHandler handler) {
- this.handler = handler;
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attrs) {
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) {
- if (equalsOrSuffix(qName, "DataCenter")) {
- dataCenters.add(handler.getResult());
- } else {
- handler.endElement(uri, localName, qName);
- }
- }
-
- @Override
- public void characters(char ch[], int start, int length) {
- handler.characters(ch, start, length);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/ErrorHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/ErrorHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/ErrorHandler.java
deleted file mode 100644
index 8f07084..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/ErrorHandler.java
+++ /dev/null
@@ -1,45 +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.trmk.vcloud_0_8.xml;
-
-import java.util.Map;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.trmk.vcloud_0_8.domain.VCloudError;
-import org.jclouds.trmk.vcloud_0_8.util.Utils;
-import org.jclouds.util.SaxUtils;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-/**
- * @author Adrian Cole
- */
-public class ErrorHandler extends ParseSax.HandlerWithResult<VCloudError> {
- private VCloudError error;
-
- public VCloudError getResult() {
- return error;
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
- Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
- if (qName.equals("Error")) {
- error = Utils.newError(attributes);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/InternetServiceHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/InternetServiceHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/InternetServiceHandler.java
deleted file mode 100644
index ae7a045..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/InternetServiceHandler.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.trmk.vcloud_0_8.xml;
-
-import static org.jclouds.util.SaxUtils.currentOrNull;
-import static org.jclouds.util.SaxUtils.equalsOrSuffix;
-
-import java.net.URI;
-
-import org.jclouds.http.functions.ParseSax.HandlerWithResult;
-import org.jclouds.trmk.vcloud_0_8.domain.InternetService;
-import org.jclouds.trmk.vcloud_0_8.domain.Protocol;
-import org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress;
-import org.xml.sax.Attributes;
-
-/**
- * @author Adrian Cole
- */
-public class InternetServiceHandler extends HandlerWithResult<InternetService> {
-
- private StringBuilder currentText = new StringBuilder();
-
- private boolean inPublicIpAddress;
- private URI location;
- private URI addressLocation;
- private String serviceName;
- private String address;
- private PublicIpAddress publicIpAddress;
- private int port;
- private String description;
- private int timeout;
- private boolean enabled;
- private Protocol protocol;
-
- protected int depth = 0;
-
- private int thisDepth;
-
- @Override
- public InternetService getResult() {
- return new InternetService(serviceName, location, publicIpAddress, port, protocol, enabled, timeout, description);
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attrs) {
- depth++;
- if (equalsOrSuffix(qName, "InternetService")) {
- thisDepth = depth;
- } else if (equalsOrSuffix(qName, "PublicIpAddress")) {
- inPublicIpAddress = true;
- }
- }
-
- public void endElement(String uri, String name, String qName) {
- depth--;
- if (equalsOrSuffix(qName, "PublicIpAddress")) {
- inPublicIpAddress = false;
- publicIpAddress = new PublicIpAddress(address, addressLocation);
- address = null;
- addressLocation = null;
- } else {
- String value = currentOrNull(currentText);
- if (value != null && !value.equals("")) {
- if (depth == thisDepth) {
- if (equalsOrSuffix(qName, "Href")) {
- location = URI.create(value);
- } else if (equalsOrSuffix(qName, "Name")) {
- serviceName = value;
- } else if (equalsOrSuffix(qName, "Port")) {
- port = Integer.parseInt(value);
- } else if (equalsOrSuffix(qName, "Protocol")) {
- protocol = Protocol.valueOf(value);
- } else if (equalsOrSuffix(qName, "Enabled")) {
- enabled = Boolean.parseBoolean(value);
- } else if (equalsOrSuffix(qName, "Timeout")) {
- timeout = Integer.parseInt(value);
- } else if (equalsOrSuffix(qName, "Description")) {
- description = currentOrNull(currentText);
- }
- } else if (inPublicIpAddress) {
- if (equalsOrSuffix(qName, "Href")) {
- addressLocation = URI.create(value);
- } else if (equalsOrSuffix(qName, "Name")) {
- address = value;
- }
- }
- }
- }
- currentText = new StringBuilder();
- }
-
- public void characters(char ch[], int start, int length) {
- currentText.append(ch, start, length);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/InternetServicesHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/InternetServicesHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/InternetServicesHandler.java
deleted file mode 100644
index 16297dd..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/InternetServicesHandler.java
+++ /dev/null
@@ -1,87 +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.trmk.vcloud_0_8.xml;
-
-import static org.jclouds.util.SaxUtils.equalsOrSuffix;
-
-import java.util.Set;
-
-import javax.inject.Inject;
-
-import org.jclouds.http.functions.ParseSax.HandlerWithResult;
-import org.jclouds.trmk.vcloud_0_8.domain.InternetService;
-import org.xml.sax.Attributes;
-
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.ImmutableSet.Builder;
-
-/**
- * @author Adrian Cole
- */
-public class InternetServicesHandler extends HandlerWithResult<Set<InternetService>> {
-
- private final InternetServiceHandler handler;
- private Builder<InternetService> builder = ImmutableSet.builder();
-
- @Inject
- public InternetServicesHandler(InternetServiceHandler handler) {
- this.handler = handler;
- }
-
- @Override
- public Set<InternetService> getResult() {
- try {
- return builder.build();
- } finally {
- builder = ImmutableSet.<InternetService> builder();
- }
- }
-
- int depth;
- private boolean inInternetService;
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attrs) {
- depth++;
- if (depth == 2) {
- if (equalsOrSuffix(qName, "InternetService")) {
- inInternetService = true;
- }
- } else if (inInternetService) {
- handler.startElement(uri, localName, qName, attrs);
- }
- }
-
- public void endElement(String uri, String name, String qName) {
- depth--;
- if (depth == 1) {
- if (equalsOrSuffix(qName, "InternetService")) {
- inInternetService = false;
- builder.add(handler.getResult());
- }
- } else if (inInternetService) {
- handler.endElement(uri, name, qName);
- }
- }
-
- public void characters(char ch[], int start, int length) {
- if (inInternetService) {
- handler.characters(ch, start, length);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/IpAddressesHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/IpAddressesHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/IpAddressesHandler.java
deleted file mode 100644
index b65565c..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/IpAddressesHandler.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.trmk.vcloud_0_8.xml;
-
-import java.util.Set;
-
-import javax.annotation.Resource;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.javax.annotation.Nullable;
-import org.jclouds.logging.Logger;
-import org.jclouds.trmk.vcloud_0_8.domain.IpAddress;
-import org.jclouds.trmk.vcloud_0_8.domain.IpAddress.Status;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-import com.google.common.collect.Sets;
-
-/**
- * @author Adrian Cole
- */
-public class IpAddressesHandler extends ParseSax.HandlerWithResult<Set<IpAddress>> {
- protected StringBuilder currentText = new StringBuilder();
-
- @Resource
- protected Logger logger = Logger.NULL;
-
- private Set<IpAddress> addresses = Sets.newLinkedHashSet();
- private String address;
- private Status status;
- @Nullable
- private String server;
- private boolean skip;
-
- public Set<IpAddress> getResult() {
- return addresses;
- }
-
- public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
- if (attributes.getIndex("xsi:nil") != -1) {
- skip = true;
- return;
- } else {
- skip = false;
- }
- }
-
- @Override
- public void endElement(String uri, String localName, String qName) throws SAXException {
- String current = currentOrNull();
- if (current != null) {
- if (qName.equals("Name")) {
- address = current;
- } else if (qName.equals("Status")) {
- status = IpAddress.Status.fromValue(current);
- } else if (!skip && qName.equals("Server")) {
- server = current;
- }
- } else if (qName.equals("IpAddress")) {
- addresses.add(new IpAddress(address, status, server));
- address = null;
- status = null;
- server = null;
- }
- currentText = new StringBuilder();
- }
-
- public void characters(char ch[], int start, int length) {
- currentText.append(ch, start, length);
- }
-
- protected String currentOrNull() {
- String returnVal = currentText.toString().trim();
- return returnVal.equals("") ? null : returnVal;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/KeyPairByNameHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/KeyPairByNameHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/KeyPairByNameHandler.java
deleted file mode 100644
index a3ce542..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/KeyPairByNameHandler.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.trmk.vcloud_0_8.xml;
-
-import java.util.NoSuchElementException;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.logging.Logger;
-import org.jclouds.trmk.vcloud_0_8.domain.KeyPair;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Iterables;
-
-/**
- * @author Adrian Cole
- */
-public class KeyPairByNameHandler extends ParseSax.HandlerForGeneratedRequestWithResult<KeyPair> {
-
- @Resource
- protected Logger logger = Logger.NULL;
- private final KeyPairsHandler handler;
-
- @Inject
- public KeyPairByNameHandler(KeyPairsHandler handler) {
- this.handler = handler;
- }
-
- @Override
- public KeyPair getResult() {
- final String name = getRequest().getInvocation().getArgs().get(1).toString();
- try {
- return Iterables.find(handler.getResult(), new Predicate<KeyPair>() {
-
- @Override
- public boolean apply(KeyPair input) {
- return input.getName().equals(name);
- }
-
- });
- } catch (NoSuchElementException e) {
- logger.debug("keypair %s/%s not found in %s", getRequest().getInvocation().getArgs().get(0), name,
- handler.getResult());
- return null;
- }
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
- handler.startElement(uri, localName, qName, attributes);
- }
-
- public void endElement(String uri, String name, String qName) {
- handler.endElement(uri, name, qName);
- }
-
- public void characters(char ch[], int start, int length) {
- handler.characters(ch, start, length);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/KeyPairHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/KeyPairHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/KeyPairHandler.java
deleted file mode 100644
index d261df1..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/KeyPairHandler.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.trmk.vcloud_0_8.xml;
-
-import java.net.URI;
-
-import javax.annotation.Resource;
-
-import org.jclouds.http.functions.ParseSax.HandlerWithResult;
-import org.jclouds.logging.Logger;
-import org.jclouds.trmk.vcloud_0_8.domain.KeyPair;
-
-/**
- * @author Adrian Cole
- */
-public class KeyPairHandler extends HandlerWithResult<KeyPair> {
-
- @Resource
- protected Logger logger = Logger.NULL;
- private StringBuilder currentText = new StringBuilder();
-
- private URI location;
- private String name;
- private boolean isDefault;
- private String privateKey;
- private String fingerPrint;
-
- protected String currentOrNull() {
- String returnVal = currentText.toString().trim();
- return returnVal.equals("") ? null : returnVal;
- }
-
- @Override
- public KeyPair getResult() {
- return new KeyPair(location, name, isDefault, privateKey, fingerPrint);
- }
-
- public void endElement(String uri, String name, String qName) {
- String current = currentOrNull();
- if (current != null) {
- if (qName.equals("Href")) {
- location = URI.create(current);
- } else if (qName.equals("Name")) {
- this.name = current;
- } else if (qName.equals("IsDefault")) {
- isDefault = Boolean.parseBoolean(current);
- } else if (qName.equals("PrivateKey")) {
- privateKey = current;
- } else if (qName.equals("FingerPrint")) {
- fingerPrint = current;
- }
- }
- currentText = new StringBuilder();
- }
-
- public void characters(char ch[], int start, int length) {
- currentText.append(ch, start, length);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/KeyPairsHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/KeyPairsHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/KeyPairsHandler.java
deleted file mode 100644
index 89452da..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/KeyPairsHandler.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.trmk.vcloud_0_8.xml;
-
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-
-import org.jclouds.http.functions.ParseSax.HandlerWithResult;
-import org.jclouds.logging.Logger;
-import org.jclouds.trmk.vcloud_0_8.domain.KeyPair;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-import com.google.common.collect.Sets;
-
-/**
- * @author Adrian Cole
- */
-public class KeyPairsHandler extends HandlerWithResult<Set<KeyPair>> {
-
- @Resource
- protected Logger logger = Logger.NULL;
- private final KeyPairHandler handler;
- Set<KeyPair> result = Sets.newLinkedHashSet();
-
- @Inject
- public KeyPairsHandler(KeyPairHandler handler) {
- this.handler = handler;
- }
-
- @Override
- public Set<KeyPair> getResult() {
- return result;
- }
-
- @Override
- public void startElement(String uri, String localName, String qName,
- Attributes attributes) throws SAXException {
- handler.startElement(uri, localName, qName, attributes);
- }
-
- public void endElement(String uri, String name, String qName) {
- handler.endElement(uri, name, qName);
- if (qName.equals("Key")) {
- result.add(handler.getResult());
- }
- }
-
- public void characters(char ch[], int start, int length) {
- handler.characters(ch, start, length);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/NetworkExtendedInfoHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/NetworkExtendedInfoHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/NetworkExtendedInfoHandler.java
deleted file mode 100644
index ebd7ad5..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/NetworkExtendedInfoHandler.java
+++ /dev/null
@@ -1,84 +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.trmk.vcloud_0_8.xml;
-
-import static org.jclouds.util.SaxUtils.currentOrNull;
-import static org.jclouds.util.SaxUtils.equalsOrSuffix;
-
-import java.net.URI;
-
-import org.jclouds.http.functions.ParseSax.HandlerWithResult;
-import org.jclouds.trmk.vcloud_0_8.domain.NetworkExtendedInfo;
-import org.jclouds.trmk.vcloud_0_8.domain.NetworkExtendedInfo.Type;
-
-/**
- * @author Adrian Cole
- */
-public class NetworkExtendedInfoHandler extends HandlerWithResult<NetworkExtendedInfo> {
-
- private StringBuilder currentText = new StringBuilder();
-
- private String id;
- private URI href;
- private String name;
- private String rnatAddress;
- private String address;
- private String broadcastAddress;
- private String gatewayAddress;
- private Type networkType;
- private String vlan;
- private String friendlyName;
-
- @Override
- public NetworkExtendedInfo getResult() {
- return new NetworkExtendedInfo(id, href, name, rnatAddress, address, broadcastAddress, gatewayAddress,
- networkType, vlan, friendlyName);
- }
-
- public void endElement(String uri, String name, String qName) {
- String current = currentOrNull(currentText);
- if (current != null) {
- if (equalsOrSuffix(qName, "Href")) {
- href = URI.create(current);
- } else if (equalsOrSuffix(qName, "Id")) {
- id = current;
- } else if (equalsOrSuffix(qName, "Name")) {
- this.name = current;
- } else if (equalsOrSuffix(qName, "RnatAddress")) {
- rnatAddress = current;
- } else if (equalsOrSuffix(qName, "Address")) {
- address = current;
- } else if (equalsOrSuffix(qName, "BroadcastAddress")) {
- broadcastAddress = current;
- } else if (equalsOrSuffix(qName, "GatewayAddress")) {
- gatewayAddress = current;
- } else if (equalsOrSuffix(qName, "NetworkType")) {
- networkType = NetworkExtendedInfo.Type.fromValue(current);
- } else if (equalsOrSuffix(qName, "Vlan")) {
- vlan = current;
- } else if (equalsOrSuffix(qName, "FriendlyName")) {
- friendlyName = current;
- }
- }
- currentText = new StringBuilder();
- }
-
- public void characters(char ch[], int start, int length) {
- currentText.append(ch, start, length);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/NetworkHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/NetworkHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/NetworkHandler.java
deleted file mode 100644
index 474b9c8..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/NetworkHandler.java
+++ /dev/null
@@ -1,93 +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.trmk.vcloud_0_8.xml;
-
-import static org.jclouds.trmk.vcloud_0_8.util.Utils.newReferenceType;
-import static org.jclouds.util.SaxUtils.cleanseAttributes;
-import static org.jclouds.util.SaxUtils.currentOrNull;
-
-import java.util.Map;
-
-import javax.annotation.Resource;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.logging.Logger;
-import org.jclouds.trmk.vcloud_0_8.domain.FenceMode;
-import org.jclouds.trmk.vcloud_0_8.domain.Network;
-import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
-import org.jclouds.trmk.vcloud_0_8.domain.internal.NetworkImpl;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-/**
- * @author Adrian Cole
- */
-public class NetworkHandler extends ParseSax.HandlerWithResult<Network> {
-
- @Resource
- protected Logger logger = Logger.NULL;
-
- protected StringBuilder currentText = new StringBuilder();
-
- protected ReferenceType network;
-
- protected String description;
-
- protected String gateway;
- protected String netmask;
- protected FenceMode fenceMode;
-
- private ReferenceType ips;
- private ReferenceType extension;
-
- public Network getResult() {
- return new NetworkImpl(network.getName(), network.getType(), network.getHref(), description, gateway, netmask,
- fenceMode, extension, ips);
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
- Map<String, String> attributes = cleanseAttributes(attrs);
- if (qName.equals("Network")) {
- network = newReferenceType(attributes);
- } else if (qName.equals("Link")) {
- if ("IP Addresses".equals(attributes.get("name"))) {
- ips = newReferenceType(attributes);
- } else if ("down".equals(attributes.get("rel"))) {
- extension = newReferenceType(attributes);
- }
- }
- }
-
- public void endElement(String uri, String name, String qName) {
- if (qName.equals("Description")) {
- description = currentOrNull(currentText);
- } else if (qName.equals("Gateway")) {
- gateway = currentOrNull(currentText);
- } else if (qName.equals("Netmask")) {
- netmask = currentOrNull(currentText);
- } else if (qName.equals("FenceMode")) {
- fenceMode = FenceMode.fromValue(currentOrNull(currentText));
- }
- currentText = new StringBuilder();
- }
-
- public void characters(char ch[], int start, int length) {
- currentText.append(ch, start, length);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/NodeHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/NodeHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/NodeHandler.java
deleted file mode 100644
index 458e9d2..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/NodeHandler.java
+++ /dev/null
@@ -1,77 +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.trmk.vcloud_0_8.xml;
-
-import java.net.URI;
-
-import javax.annotation.Resource;
-
-import org.jclouds.http.functions.ParseSax.HandlerWithResult;
-import org.jclouds.logging.Logger;
-import org.jclouds.trmk.vcloud_0_8.domain.Node;
-
-/**
- * @author Adrian Cole
- */
-public class NodeHandler extends HandlerWithResult<Node> {
-
- @Resource
- protected Logger logger = Logger.NULL;
- private StringBuilder currentText = new StringBuilder();
-
- private URI location;
- private String serviceName;
- private String address;
- private int port;
- private String description;
- private boolean enabled;
-
- protected String currentOrNull() {
- String returnVal = currentText.toString().trim();
- return returnVal.equals("") ? null : returnVal;
- }
-
- @Override
- public Node getResult() {
- return new Node(serviceName, location, address, port, enabled, description);
- }
-
- public void endElement(String uri, String name, String qName) {
- String current = currentOrNull();
- if (current != null) {
- if (qName.equals("Href")) {
- location = URI.create(current);
- } else if (qName.equals("Name")) {
- serviceName = current;
- } else if (qName.equals("Port")) {
- port = Integer.parseInt(current);
- } else if (qName.equals("Enabled")) {
- enabled = Boolean.parseBoolean(current);
- } else if (qName.equals("IpAddress")) {
- address = current;
- } else if (qName.equals("Description")) {
- description = current;
- }
- }
- currentText = new StringBuilder();
- }
-
- public void characters(char ch[], int start, int length) {
- currentText.append(ch, start, length);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/NodesHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/NodesHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/NodesHandler.java
deleted file mode 100644
index 0edcb58..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/NodesHandler.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.trmk.vcloud_0_8.xml;
-
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-
-import org.jclouds.http.functions.ParseSax.HandlerWithResult;
-import org.jclouds.logging.Logger;
-import org.jclouds.trmk.vcloud_0_8.domain.Node;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-import com.google.common.collect.Sets;
-
-/**
- * @author Adrian Cole
- */
-public class NodesHandler extends HandlerWithResult<Set<Node>> {
-
- @Resource
- protected Logger logger = Logger.NULL;
- private final NodeHandler handler;
- Set<Node> result = Sets.newLinkedHashSet();
-
- @Inject
- public NodesHandler(NodeHandler handler) {
- this.handler = handler;
- }
-
- @Override
- public Set<Node> getResult() {
- return result;
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attributes)
- throws SAXException {
- handler.startElement(uri, localName, qName, attributes);
- }
-
- public void endElement(String uri, String name, String qName) {
- handler.endElement(uri, name, qName);
- if (qName.equals("NodeService")) {
- result.add(handler.getResult());
- }
- }
-
- public void characters(char ch[], int start, int length) {
- handler.characters(ch, start, length);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/OrgHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/OrgHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/OrgHandler.java
deleted file mode 100644
index 515a6ba..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/OrgHandler.java
+++ /dev/null
@@ -1,90 +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.trmk.vcloud_0_8.xml;
-
-import static org.jclouds.trmk.vcloud_0_8.util.Utils.newReferenceType;
-import static org.jclouds.trmk.vcloud_0_8.util.Utils.putReferenceType;
-
-import java.util.Map;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.trmk.vcloud_0_8.domain.Org;
-import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
-import org.jclouds.trmk.vcloud_0_8.domain.internal.OrgImpl;
-import org.jclouds.util.SaxUtils;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-import com.google.common.collect.Maps;
-
-/**
- * @author Adrian Cole
- */
-public class OrgHandler extends ParseSax.HandlerWithResult<Org> {
-
- private StringBuilder currentText = new StringBuilder();
-
- protected ReferenceType org;
- protected Map<String, ReferenceType> vdcs = Maps.newLinkedHashMap();
- protected Map<String, ReferenceType> catalogs = Maps.newLinkedHashMap();
- protected Map<String, ReferenceType> tasksLists = Maps.newLinkedHashMap();
- protected ReferenceType keys;
-
- protected String description;
-
- public Org getResult() {
- return new OrgImpl(org.getName(), org.getType(), org.getHref(),
- description, catalogs, vdcs, tasksLists, keys);
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
- Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
- if (qName.endsWith("Org")) {
- org = newReferenceType(attributes);
- } else if (qName.endsWith("Link")) {
- String type = attributes.get("type");
- if (type != null) {
- if (type.indexOf("vdc+xml") != -1) {
- putReferenceType(vdcs, attributes);
- } else if (type.indexOf("catalog+xml") != -1) {
- putReferenceType(catalogs, attributes);
- } else if (type.indexOf("tasksList+xml") != -1) {
- putReferenceType(tasksLists, attributes);
- } else if (type.endsWith("keysList+xml")) {
- keys = newReferenceType(attributes);
- }
- }
- }
- }
-
- public void endElement(String uri, String name, String qName) {
- if (qName.endsWith("Description")) {
- description = currentOrNull();
- }
- currentText = new StringBuilder();
- }
-
- public void characters(char ch[], int start, int length) {
- currentText.append(ch, start, length);
- }
-
- protected String currentOrNull() {
- String returnVal = currentText.toString().trim();
- return returnVal.equals("") ? null : returnVal;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/OrgListHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/OrgListHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/OrgListHandler.java
deleted file mode 100644
index 4dad07e..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/OrgListHandler.java
+++ /dev/null
@@ -1,54 +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.trmk.vcloud_0_8.xml;
-
-import static org.jclouds.trmk.vcloud_0_8.util.Utils.putReferenceType;
-
-import java.util.Map;
-
-import org.jclouds.http.functions.ParseSax;
-import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
-import org.jclouds.util.SaxUtils;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-import com.google.common.collect.Maps;
-
-/**
- * @author Adrian Cole
- */
-public class OrgListHandler extends ParseSax.HandlerWithResult<Map<String, ReferenceType>> {
-
- private Map<String, ReferenceType> org = Maps.newHashMap();
-
- public Map<String, ReferenceType> getResult() {
- return org;
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
- Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
- if (qName.endsWith("Org")) {
- String type = attributes.get("type");
- if (type != null) {
- if (type.indexOf("org+xml") != -1) {
- putReferenceType(org, attributes);
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/PublicIpAddressHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/PublicIpAddressHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/PublicIpAddressHandler.java
deleted file mode 100644
index c9c30ee..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/PublicIpAddressHandler.java
+++ /dev/null
@@ -1,67 +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.trmk.vcloud_0_8.xml;
-
-import java.net.URI;
-
-import javax.annotation.Resource;
-
-import org.jclouds.http.functions.ParseSax.HandlerWithResult;
-import org.jclouds.logging.Logger;
-import org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress;
-
-/**
- * @author Adrian Cole
- */
-public class PublicIpAddressHandler extends HandlerWithResult<PublicIpAddress> {
-
- @Resource
- protected Logger logger = Logger.NULL;
-
- private StringBuilder currentText = new StringBuilder();
-
- private String address;
-
- private URI location;
-
- protected String currentOrNull() {
- String returnVal = currentText.toString().trim();
- return returnVal.equals("") ? null : returnVal;
- }
-
- @Override
- public PublicIpAddress getResult() {
- return new PublicIpAddress(address, location);
- }
-
- public void endElement(String uri, String name, String qName) {
- String current = currentOrNull();
- if (current != null) {
- if (qName.equals("Href")) {
- location = URI.create(current);
- } else if (qName.equals("Name")) {
- address = current;
- }
- }
- currentText = new StringBuilder();
- }
-
- public void characters(char ch[], int start, int length) {
- currentText.append(ch, start, length);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/ddfefd7e/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/PublicIpAddressesHandler.java
----------------------------------------------------------------------
diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/PublicIpAddressesHandler.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/PublicIpAddressesHandler.java
deleted file mode 100644
index 1121997..0000000
--- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/xml/PublicIpAddressesHandler.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.trmk.vcloud_0_8.xml;
-
-import java.util.Set;
-
-import javax.annotation.Resource;
-import javax.inject.Inject;
-
-import org.jclouds.http.functions.ParseSax.HandlerWithResult;
-import org.jclouds.logging.Logger;
-import org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-import com.google.common.collect.Sets;
-
-/**
- * @author Adrian Cole
- */
-public class PublicIpAddressesHandler extends HandlerWithResult<Set<PublicIpAddress>> {
-
- @Resource
- protected Logger logger = Logger.NULL;
- private final PublicIpAddressHandler handler;
- Set<PublicIpAddress> result = Sets.newLinkedHashSet();
-
- @Inject
- public PublicIpAddressesHandler(PublicIpAddressHandler handler) {
- this.handler = handler;
- }
-
- @Override
- public Set<PublicIpAddress> getResult() {
- return result;
- }
-
- @Override
- public void startElement(String uri, String localName, String qName, Attributes attributes)
- throws SAXException {
- handler.startElement(uri, localName, qName, attributes);
- }
-
- public void endElement(String uri, String name, String qName) {
- handler.endElement(uri, name, qName);
- if (qName.equals("PublicIPAddress")) {
- result.add(handler.getResult());
- }
- }
-
- public void characters(char ch[], int start, int length) {
- handler.characters(ch, start, length);
- }
-
-}