Skip to content

Commit a6df8a5

Browse files
author
Alex Huang
committed
Added engine
1 parent 3dafea6 commit a6df8a5

186 files changed

Lines changed: 11592 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

engine/api/pom.xml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
21+
<modelVersion>4.0.0</modelVersion>
22+
<artifactId>cloud-engine-api</artifactId>
23+
<name>Apache CloudStack Cloud Engine API</name>
24+
<parent>
25+
<groupId>org.apache.cloudstack</groupId>
26+
<artifactId>cloud-engine</artifactId>
27+
<version>4.1.0-SNAPSHOT</version>
28+
<relativePath>../pom.xml</relativePath>
29+
</parent>
30+
<dependencies>
31+
<dependency>
32+
<groupId>org.apache.cloudstack</groupId>
33+
<artifactId>cloud-api</artifactId>
34+
<version>${project.version}</version>
35+
</dependency>
36+
</dependencies>
37+
<build>
38+
<defaultGoal>install</defaultGoal>
39+
<sourceDirectory>src</sourceDirectory>
40+
<testSourceDirectory>test</testSourceDirectory>
41+
</build>
42+
</project>
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.cloudstack.platform;
20+
21+
import java.util.ArrayList;
22+
import java.util.List;
23+
24+
import com.cloud.utils.StringUtils;
25+
26+
/**
27+
* Rules specifies all rules about developing and using CloudStack Orchestration
28+
* Platforms APIs. This class is not actually used in CloudStack Orchestration
29+
* Platform but must be read by all who wants to use and develop against
30+
* CloudStack Orchestration Platform.
31+
*
32+
* Make sure to make changes here when there are changes to how the APIs should
33+
* be used and developed.
34+
*
35+
* Changes to this class must be approved by the maintainer of this project.
36+
*
37+
*/
38+
public class Rules {
39+
public static List<String> whenUsing() {
40+
List<String> rules = new ArrayList<String>();
41+
rules.add("Always be prepared to handle RuntimeExceptions.");
42+
return rules;
43+
}
44+
45+
public static List<String> whenWritingNewApis() {
46+
List<String> rules = new ArrayList<String>();
47+
rules.add("You may think you're the greatest developer in the " +
48+
"world but every change to the API must be reviewed and approved. ");
49+
rules.add("Every API must have unit tests written against it. And not it's unit tests");
50+
rules.add("");
51+
52+
53+
return rules;
54+
}
55+
56+
private static void printRule(String rule) {
57+
System.out.print("API Rule: ");
58+
String skip = "";
59+
int brk = 0;
60+
while (true) {
61+
int stop = StringUtils.formatForOutput(rule, brk, 75 - skip.length(), ' ');
62+
if (stop < 0) {
63+
break;
64+
}
65+
System.out.print(skip);
66+
skip = " ";
67+
System.out.println(rule.substring(brk, stop).trim());
68+
brk = stop;
69+
}
70+
}
71+
72+
public static void main(String[] args) {
73+
System.out.println("When developing against the CloudStack Orchestration Platform, you must following the following rules:");
74+
for (String rule : whenUsing()) {
75+
printRule(rule);
76+
}
77+
System.out.println("");
78+
System.out.println("When writing APIs, you must follow these rules:");
79+
for (String rule : whenWritingNewApis()) {
80+
printRule(rule);
81+
}
82+
}
83+
84+
}
85+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.cloudstack.platform.cloud.entity.api;
20+
21+
import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
22+
23+
/**
24+
* @author ahuang
25+
*
26+
*/
27+
public interface BackupEntity extends CloudStackEntity {
28+
29+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.cloudstack.platform.cloud.entity.api;
20+
21+
public interface EdgeService {
22+
23+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.cloudstack.platform.cloud.entity.api;
20+
21+
import java.util.List;
22+
23+
import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
24+
25+
import com.cloud.network.Network;
26+
27+
public interface NetworkEntity extends CloudStackEntity, Network {
28+
void routeTo(NetworkEntity network);
29+
30+
List<EdgeService> listEdgeServicesTo();
31+
32+
List<String> listVirtualMachineUuids();
33+
34+
List<VirtualMachineEntity> listVirtualMachines();
35+
36+
List<NicEntity> listNics();
37+
38+
void addIpRange();
39+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.cloudstack.platform.cloud.entity.api;
20+
21+
import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
22+
23+
/**
24+
* @author ahuang
25+
*
26+
*/
27+
public interface NicEntity extends CloudStackEntity {
28+
29+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.cloudstack.platform.cloud.entity.api;
20+
21+
import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
22+
23+
import com.cloud.storage.Snapshot;
24+
25+
public interface SnapshotEntity extends CloudStackEntity, Snapshot {
26+
/**
27+
* Make a reservation for backing up this snapshot
28+
* @param expiration time in seconds to expire the reservation
29+
* @return reservation token
30+
*/
31+
String reserveForBackup(int expiration);
32+
33+
/**
34+
* Perform the backup according to the reservation token
35+
* @param reservationToken token returned by reserveForBackup
36+
*/
37+
void backup(String reservationToken);
38+
39+
/**
40+
* restore this snapshot to this vm.
41+
* @param vm
42+
*/
43+
void restore(String vm);
44+
45+
/**
46+
* Destroy this snapshot.
47+
*/
48+
void destroy();
49+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.cloudstack.platform.cloud.entity.api;
20+
21+
import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
22+
23+
import com.cloud.template.VirtualMachineTemplate;
24+
25+
public interface TemplateEntity extends CloudStackEntity, VirtualMachineTemplate {
26+
27+
}

0 commit comments

Comments
 (0)