You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by me...@apache.org on 2014/02/27 09:41:01 UTC
[13/32] git commit: Adding VCloud PartitionValidator
Adding VCloud PartitionValidator
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/b4d75a02
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/b4d75a02
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/b4d75a02
Branch: refs/heads/master
Commit: b4d75a0280eb520fcfce4968c49fc8cce510d6cd
Parents: d14a01a
Author: Melan Nimesh <me...@gmail.com>
Authored: Sat Feb 8 16:35:45 2014 +0530
Committer: Melan Nimesh <me...@gmail.com>
Committed: Sat Feb 8 16:35:45 2014 +0530
----------------------------------------------------------------------
.../cloud/controller/iaases/VCloudIaas.java | 9 ++--
.../validate/VCloudPartitionValidator.java | 54 ++++++++++++++++++++
2 files changed, 59 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b4d75a02/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/VCloudIaas.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/VCloudIaas.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/VCloudIaas.java
index b49f2c8..a6f5d8d 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/VCloudIaas.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/iaases/VCloudIaas.java
@@ -25,6 +25,8 @@ import org.apache.stratos.cloud.controller.exception.CloudControllerException;
import org.apache.stratos.cloud.controller.interfaces.Iaas;
import org.apache.stratos.cloud.controller.jcloud.ComputeServiceBuilderUtil;
import org.apache.stratos.cloud.controller.pojo.IaasProvider;
+import org.apache.stratos.cloud.controller.pojo.PersistanceMapping;
+import org.apache.stratos.cloud.controller.validate.VCloudPartitionValidator;
import org.apache.stratos.cloud.controller.validate.interfaces.PartitionValidator;
import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.Template;
@@ -196,19 +198,18 @@ public class VCloudIaas extends Iaas {
@Override
public boolean isValidZone(String region, String zone) {
// TODO Auto-generated method stub
- return false;
+ return true;
}
@Override
public boolean isValidHost(String zone, String host) {
// TODO Auto-generated method stub
- return false;
+ return true;
}
@Override
public PartitionValidator getPartitionValidator() {
- // TODO Auto-generated method stub
- return null;
+ return new VCloudPartitionValidator();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/b4d75a02/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/VCloudPartitionValidator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/VCloudPartitionValidator.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/VCloudPartitionValidator.java
new file mode 100644
index 0000000..411b7ea
--- /dev/null
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/validate/VCloudPartitionValidator.java
@@ -0,0 +1,54 @@
+/*
+ * 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.apache.stratos.cloud.controller.validate;
+
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.cloud.controller.exception.InvalidPartitionException;
+import org.apache.stratos.cloud.controller.interfaces.Iaas;
+import org.apache.stratos.cloud.controller.pojo.IaasProvider;
+import org.apache.stratos.cloud.controller.validate.interfaces.PartitionValidator;
+
+
+/**
+ * The VCloud {@link PartitionValidator} implementation.
+ *
+ */
+public class VCloudPartitionValidator implements PartitionValidator {
+
+ private static final Log log = LogFactory.getLog(VCloudPartitionValidator.class);
+ private IaasProvider iaasProvider;
+ private Iaas iaas;
+
+ @Override
+ public IaasProvider validate(String partitionId, Properties properties) throws InvalidPartitionException {
+ //TODO: implement real validation logic
+ return iaasProvider;
+
+ }
+
+ @Override
+ public void setIaasProvider(IaasProvider iaas) {
+ this.iaasProvider = iaas;
+ this.iaas = iaas.getIaas();
+ }
+
+}