You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2012/11/01 21:57:48 UTC
git commit: added missing files
Updated Branches:
refs/heads/javelin 4b9990408 -> 7397716fc
added missing files
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/7397716f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/7397716f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/7397716f
Branch: refs/heads/javelin
Commit: 7397716fcd2eb26c812f825804dd5f040d963536
Parents: 4b99904
Author: Alex Huang <al...@citrix.com>
Authored: Thu Nov 1 13:57:34 2012 -0700
Committer: Alex Huang <al...@citrix.com>
Committed: Thu Nov 1 13:57:34 2012 -0700
----------------------------------------------------------------------
.../platform/cloud/entity/api/EdgeService.java | 23 ++++
.../datacenter/entity/api/ClusterEntity.java | 25 ++++
.../entity/api/DataCenterResourceEntity.java | 83 +++++++++++++
.../datacenter/entity/api/OrganizationScope.java | 23 ++++
.../platform/datacenter/entity/api/PodEntity.java | 30 +++++
.../datacenter/entity/api/StorageEntity.java | 24 ++++
.../platform/datacenter/entity/api/ZoneEntity.java | 30 +++++
.../platform/entity/api/CloudStackEntity.java | 96 +++++++++++++++
.../platform/service/api/ProvisioningService.java | 65 ++++++++++
utils/src/com/cloud/utils/fsm/ChangeEvent.java | 23 ++++
utils/src/com/cloud/utils/fsm/FiniteState2.java | 33 +++++
11 files changed, 455 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7397716f/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/EdgeService.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/EdgeService.java b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/EdgeService.java
new file mode 100755
index 0000000..8dceb74
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/EdgeService.java
@@ -0,0 +1,23 @@
+/*
+ * 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.cloudstack.platform.cloud.entity.api;
+
+public interface EdgeService {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7397716f/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/ClusterEntity.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/ClusterEntity.java b/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/ClusterEntity.java
new file mode 100755
index 0000000..8378909
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/ClusterEntity.java
@@ -0,0 +1,25 @@
+/*
+ * 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.cloudstack.platform.datacenter.entity.api;
+
+import com.cloud.org.Cluster;
+
+public interface ClusterEntity extends DataCenterResourceEntity, Cluster, OrganizationScope {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7397716f/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/DataCenterResourceEntity.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/DataCenterResourceEntity.java b/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/DataCenterResourceEntity.java
new file mode 100755
index 0000000..5ca27c5
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/DataCenterResourceEntity.java
@@ -0,0 +1,83 @@
+/*
+ * 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.cloudstack.platform.datacenter.entity.api;
+
+import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
+
+import com.cloud.utils.fsm.StateMachine2;
+import com.cloud.utils.fsm.StateObject;
+
+/**
+ * This interface specifies the states and operations all physical
+ * and virtual resources in the data center must implement.
+ */
+public interface DataCenterResourceEntity extends CloudStackEntity, StateObject<DataCenterResourceEntity.State> {
+
+ /**
+ * This is the state machine for how CloudStack should interact with
+ *
+ */
+ public enum State {
+ Disabled("The resource is disabled so CloudStack should not use it. This is the initial state of all resources added to CloudStack."),
+ Enabled("The resource is now enabled for CloudStack to use."),
+ Deactivated("The resource is disactivated so CloudStack should not use it for new resource needs.");
+
+ String _description;
+
+ private State(String description) {
+ _description = description;
+ }
+
+ public enum Event {
+ EnableRequest,
+ DisableRequest,
+ DeactivateRequest,
+ ActivatedRequest
+ }
+
+ protected static final StateMachine2<State, Event, DataCenterResourceEntity> s_fsm = new StateMachine2<State, Event, DataCenterResourceEntity>();
+ static {
+ s_fsm.addTransition(Disabled, Event.EnableRequest, Enabled);
+ s_fsm.addTransition(Enabled, Event.DisableRequest, Disabled);
+ s_fsm.addTransition(Enabled, Event.DeactivateRequest, Deactivated);
+ s_fsm.addTransition(Deactivated, Event.ActivatedRequest, Enabled);
+ }
+
+ }
+ /**
+ * Prepare the resource to take new on new demands.
+ */
+ boolean enable();
+
+ /**
+ * Disables the resource. Cleanup. Prepare for the resource to be removed.
+ */
+ boolean disable();
+
+ /**
+ * Do not use the resource for new demands.
+ */
+ boolean deactivate();
+
+ /**
+ * Reactivates a deactivated resource.
+ */
+ boolean reactivate();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7397716f/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/OrganizationScope.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/OrganizationScope.java b/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/OrganizationScope.java
new file mode 100755
index 0000000..0fa6497
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/OrganizationScope.java
@@ -0,0 +1,23 @@
+/*
+ * 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.cloudstack.platform.datacenter.entity.api;
+
+public interface OrganizationScope {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7397716f/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/PodEntity.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/PodEntity.java b/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/PodEntity.java
new file mode 100755
index 0000000..e474300
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/PodEntity.java
@@ -0,0 +1,30 @@
+/*
+ * 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.cloudstack.platform.datacenter.entity.api;
+
+import java.util.List;
+
+import com.cloud.dc.Pod;
+import com.cloud.org.Cluster;
+
+public interface PodEntity extends DataCenterResourceEntity, Pod {
+
+ List<Cluster> listClusters();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7397716f/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/StorageEntity.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/StorageEntity.java b/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/StorageEntity.java
new file mode 100755
index 0000000..2d22232
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/StorageEntity.java
@@ -0,0 +1,24 @@
+/*
+ * 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.cloudstack.platform.datacenter.entity.api;
+
+import com.cloud.storage.StoragePool;
+
+public interface StorageEntity extends DataCenterResourceEntity, StoragePool {
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7397716f/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/ZoneEntity.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/ZoneEntity.java b/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/ZoneEntity.java
new file mode 100755
index 0000000..48940fa
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/datacenter/entity/api/ZoneEntity.java
@@ -0,0 +1,30 @@
+/*
+ * 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.cloudstack.platform.datacenter.entity.api;
+
+import java.util.List;
+
+import com.cloud.dc.DataCenter;
+
+/**
+ * Describes a zone and operations that can be done in a zone.
+ */
+public interface ZoneEntity extends DataCenterResourceEntity, DataCenter {
+ List<PodEntity> listPods();
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7397716f/platform/api/src/org/apache/cloudstack/platform/entity/api/CloudStackEntity.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/entity/api/CloudStackEntity.java b/platform/api/src/org/apache/cloudstack/platform/entity/api/CloudStackEntity.java
new file mode 100755
index 0000000..1aa70b6
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/entity/api/CloudStackEntity.java
@@ -0,0 +1,96 @@
+/*
+ * 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.cloudstack.platform.entity.api;
+
+import java.lang.reflect.Method;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * All entities returned by the Cloud Orchestration Platform must implement
+ * this interface. CloudValueEntity is an immutable representation of
+ * an entity exposed by Cloud Orchestration Platform. For each object, it
+ * defines two ids: uuid, generated by CloudStack Orchestration Platform, and
+ * an external id that is set by the caller when the entity is created. All
+ * ids must be unique for that entity. CloudValueEntity also can be converted
+ * to a CloudActionableEntity which contains actions the object can perform.
+ */
+public interface CloudStackEntity {
+ /**
+ * @return the uuid of the object.
+ */
+ String getUuid();
+
+ /**
+ * @return the id which is often the database id.
+ */
+ long getId();
+
+ /**
+ * @return external id set by the caller
+ */
+ String getExternalId();
+
+ /**
+ * @return current state for the entity
+ */
+ String getCurrentState();
+
+ /**
+ * @return desired state for the entity
+ */
+ String getDesiredState();
+
+ /**
+ * Get the time the entity was created
+ */
+ Date getCreatedTime();
+
+ /**
+ * Get the time the entity was last updated
+ */
+ Date getLastUpdatedTime();
+
+ /**
+ * @return reference to the owner of this entity
+ */
+ String getOwner();
+
+ /**
+ * @return details stored for this entity when created.
+ */
+ Map<String, String> getDetails(String source);
+
+ /**
+ * @return a list of sources that have added to the details.
+ */
+ List<String> getDetailSources();
+
+ void addDetail(String source, String name, String value);
+
+ void delDetail(String source, String name, String value);
+
+ void updateDetail(String source, String name, String value);
+
+ /**
+ * @return list of actions that can be performed on the object in its current state
+ */
+ List<Method> getApplicableActions();
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7397716f/platform/api/src/org/apache/cloudstack/platform/service/api/ProvisioningService.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/service/api/ProvisioningService.java b/platform/api/src/org/apache/cloudstack/platform/service/api/ProvisioningService.java
new file mode 100755
index 0000000..0032a25
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/service/api/ProvisioningService.java
@@ -0,0 +1,65 @@
+/*
+ * 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.cloudstack.platform.service.api;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cloudstack.platform.datacenter.entity.api.ZoneEntity;
+
+import com.cloud.dc.DataCenter;
+import com.cloud.dc.Pod;
+import com.cloud.host.Host;
+import com.cloud.host.Status;
+import com.cloud.storage.StoragePool;
+
+
+/**
+ * ProvisioningService registers and deregisters physical and virtual
+ * resources that the management server can use.
+ */
+public interface ProvisioningService {
+
+ String registerStorage(String name, List<String> tags, Map<String, String> details);
+ ZoneEntity registerZone(String name, List<String> tags, Map<String, String> details);
+ String registerPod(String name, List<String> tags, Map<String, String> details);
+ String registerCluster(String name, List<String> tags, Map<String, String> details);
+ String registerHost(String name, List<String> tags, Map<String, String> details);
+
+
+
+ void deregisterStorage(String uuid);
+ void deregisterZone();
+ void deregisterPod();
+ void deregisterCluster();
+ void deregisterHost();
+
+ void changeState(String type, String entity, Status state);
+
+ List<Host> listHosts();
+
+ List<Pod> listPods();
+
+ List<DataCenter> listZones();
+
+
+
+ List<StoragePool> listStorage();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7397716f/utils/src/com/cloud/utils/fsm/ChangeEvent.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/fsm/ChangeEvent.java b/utils/src/com/cloud/utils/fsm/ChangeEvent.java
new file mode 100755
index 0000000..5b37806
--- /dev/null
+++ b/utils/src/com/cloud/utils/fsm/ChangeEvent.java
@@ -0,0 +1,23 @@
+/*
+ * 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 com.cloud.utils.fsm;
+
+public class ChangeEvent {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7397716f/utils/src/com/cloud/utils/fsm/FiniteState2.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/fsm/FiniteState2.java b/utils/src/com/cloud/utils/fsm/FiniteState2.java
new file mode 100755
index 0000000..585521d
--- /dev/null
+++ b/utils/src/com/cloud/utils/fsm/FiniteState2.java
@@ -0,0 +1,33 @@
+/*
+ * 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 com.cloud.utils.fsm;
+
+import java.util.Set;
+
+public interface FiniteState2<T, E> {
+
+ StateMachine2<T, ? extends ChangeEvent, ? extends StateObject> getStateMachine();
+
+ T getNextState(ChangeEvent e) throws NoTransitionException;
+
+ T getFromStates(ChangeEvent e);
+
+ Set<ChangeEvent> getPossibleEvents();
+
+}