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/09/05 23:17:46 UTC
[4/5] git commit: More changes
More changes
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/e41cb9ff
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/e41cb9ff
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/e41cb9ff
Branch: refs/heads/javelin
Commit: e41cb9ff7470f1dc26a70a6e9606513b95c527b3
Parents: 73cc474
Author: Alex Huang <al...@citrix.com>
Authored: Wed Sep 5 13:38:32 2012 -0700
Committer: Alex Huang <al...@citrix.com>
Committed: Wed Sep 5 13:39:32 2012 -0700
----------------------------------------------------------------------
.../src/org/apache/cloudstack/platform/Rules.java | 83 +++++++++++++++
.../platform/cloud/entity/api/BackupEntity.java | 29 +++++
.../platform/service/api/OperationsServices.java | 35 ++++++
utils/src/com/cloud/utils/fsm/State.java | 26 +++++
4 files changed, 173 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e41cb9ff/platform/api/src/org/apache/cloudstack/platform/Rules.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/Rules.java b/platform/api/src/org/apache/cloudstack/platform/Rules.java
new file mode 100755
index 0000000..8cb0ff1
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/Rules.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;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.cloud.utils.StringUtils;
+
+/**
+ * Rules specifies all rules about developing and using CloudStack Orchestration
+ * Platforms APIs. This class is not actually used in CloudStack Orchestration
+ * Platform but must be read by all who wants to use and develop against
+ * CloudStack Orchestration Platform.
+ *
+ * Make sure to make changes here when there are changes to how the APIs should
+ * be used and developed.
+ *
+ * Changes to this class must be approved by the maintainer of this project.
+ *
+ */
+public class Rules {
+ public static List<String> whenUsing() {
+ List<String> rules = new ArrayList<String>();
+ return rules;
+ }
+
+ public static List<String> whenWritingNewApis() {
+ List<String> rules = new ArrayList<String>();
+ rules.add("You may think you're the greatest developer in the " +
+ "world but every change to the API must be reviewed and approved. ");
+ rules.add("");
+
+
+ return rules;
+ }
+
+ private static void printRule(String rule) {
+ System.out.print("API Rule: ");
+ String skip = "";
+ int brk = 0;
+ while (true) {
+ int stop = StringUtils.formatForOutput(rule, brk, 75 - skip.length(), ' ');
+ if (stop < 0) {
+ break;
+ }
+ System.out.print(skip);
+ skip = " ";
+ System.out.println(rule.substring(brk, stop).trim());
+ brk = stop;
+ }
+ }
+
+ public static void main(String[] args) {
+ System.out.println("When developing against the CloudStack Orchestration Platform, you must following the following rules:");
+ for (String rule : whenUsing()) {
+ printRule(rule);
+ }
+ System.out.println("");
+ System.out.println("When writing APIs, you must follow these rules:");
+ for (String rule : whenWritingNewApis()) {
+ printRule(rule);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e41cb9ff/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/BackupEntity.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/BackupEntity.java b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/BackupEntity.java
new file mode 100755
index 0000000..8a5edba
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/cloud/entity/api/BackupEntity.java
@@ -0,0 +1,29 @@
+/*
+ * 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;
+
+import org.apache.cloudstack.platform.entity.api.CloudEntity;
+
+/**
+ * @author ahuang
+ *
+ */
+public interface BackupEntity extends CloudEntity {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e41cb9ff/platform/api/src/org/apache/cloudstack/platform/service/api/OperationsServices.java
----------------------------------------------------------------------
diff --git a/platform/api/src/org/apache/cloudstack/platform/service/api/OperationsServices.java b/platform/api/src/org/apache/cloudstack/platform/service/api/OperationsServices.java
new file mode 100755
index 0000000..74dfe1b
--- /dev/null
+++ b/platform/api/src/org/apache/cloudstack/platform/service/api/OperationsServices.java
@@ -0,0 +1,35 @@
+/*
+ * 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 com.cloud.async.AsyncJob;
+
+public interface OperationsServices {
+ List<AsyncJob> listJobs();
+
+ List<AsyncJob> listJobsInProgress();
+
+ List<AsyncJob> listJobsCompleted(Long from);
+
+ List<AsyncJob> listJobsInWaiting();
+
+ void cancelJob(String job);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e41cb9ff/utils/src/com/cloud/utils/fsm/State.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/fsm/State.java b/utils/src/com/cloud/utils/fsm/State.java
new file mode 100755
index 0000000..eb618e2
--- /dev/null
+++ b/utils/src/com/cloud/utils/fsm/State.java
@@ -0,0 +1,26 @@
+/*
+ * 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;
+
+/**
+ * State represents one state for that object
+ */
+public interface State<T> {
+
+}