Some initial checkins

This commit is contained in:
Alex Huang 2012-11-18 07:37:52 -08:00
parent 6866613af4
commit bd17d35adb
18 changed files with 1102 additions and 438 deletions

View File

@ -33,6 +33,17 @@
<artifactId>cloud-api</artifactId> <artifactId>cloud-api</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle-jaxrs</artifactId>
<version>2.7.0</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies> </dependencies>
<build> <build>
<defaultGoal>install</defaultGoal> <defaultGoal>install</defaultGoal>

View File

@ -20,6 +20,12 @@ package org.apache.cloudstack.engine.cloud.entity.api;
import java.util.List; import java.util.List;
import javax.ws.rs.BeanParam;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.cloudstack.engine.entity.api.CloudStackEntity; import org.apache.cloudstack.engine.entity.api.CloudStackEntity;
import com.cloud.deploy.DeployDestination; import com.cloud.deploy.DeployDestination;
@ -31,12 +37,16 @@ import com.cloud.vm.VirtualMachine;
* Platform. * Platform.
* *
*/ */
@Path("vm/{id}")
@Produces({"application/json", "application/xml"})
@XmlRootElement(name="vm")
public interface VirtualMachineEntity extends VirtualMachine, CloudStackEntity { public interface VirtualMachineEntity extends VirtualMachine, CloudStackEntity {
/** /**
* @return List of uuids for volumes attached to this virtual machine. * @return List of uuids for volumes attached to this virtual machine.
*/ */
List<String> listVolumeUuids(); @GET
List<String> listVolumeIds();
/** /**
* @return List of volumes attached to this virtual machine. * @return List of volumes attached to this virtual machine.
@ -74,7 +84,7 @@ public interface VirtualMachineEntity extends VirtualMachine, CloudStackEntity {
* @param exclude list of areas to exclude * @param exclude list of areas to exclude
* @return a reservation id * @return a reservation id
*/ */
String reserve(String plannerToUse, DeployDestination dest, ExcludeList exclude); String reserve(String plannerToUse, @BeanParam DeployDestination dest, ExcludeList exclude);
/** /**
* Migrate this VM to a certain destination. * Migrate this VM to a certain destination.

View File

@ -18,6 +18,8 @@
*/ */
package org.apache.cloudstack.engine.datacenter.entity.api; package org.apache.cloudstack.engine.datacenter.entity.api;
import javax.ws.rs.POST;
import org.apache.cloudstack.engine.entity.api.CloudStackEntity; import org.apache.cloudstack.engine.entity.api.CloudStackEntity;
import com.cloud.utils.fsm.StateMachine2; import com.cloud.utils.fsm.StateMachine2;
@ -60,24 +62,29 @@ public interface DataCenterResourceEntity extends CloudStackEntity, StateObject<
} }
} }
/** /**
* Prepare the resource to take new on new demands. * Prepare the resource to take new on new demands.
*/ */
@POST
boolean enable(); boolean enable();
/** /**
* Disables the resource. Cleanup. Prepare for the resource to be removed. * Disables the resource. Cleanup. Prepare for the resource to be removed.
*/ */
@POST
boolean disable(); boolean disable();
/** /**
* Do not use the resource for new demands. * Do not use the resource for new demands.
*/ */
@POST
boolean deactivate(); boolean deactivate();
/** /**
* Reactivates a deactivated resource. * Reactivates a deactivated resource.
*/ */
@POST
boolean reactivate(); boolean reactivate();
} }

View File

@ -20,11 +20,16 @@ package org.apache.cloudstack.engine.datacenter.entity.api;
import java.util.List; import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter;
/** /**
* Describes a zone and operations that can be done in a zone. * Describes a zone and operations that can be done in a zone.
*/ */
@Path("zone/{zone-id}")
public interface ZoneEntity extends DataCenterResourceEntity, DataCenter { public interface ZoneEntity extends DataCenterResourceEntity, DataCenter {
List<PodEntity> listPods(); @GET
List<PodEntity> listPods();
} }

View File

@ -23,6 +23,9 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.ws.rs.GET;
import javax.ws.rs.QueryParam;
/** /**
* All entities returned by the Cloud Orchestration Platform must implement * All entities returned by the Cloud Orchestration Platform must implement
* this interface. CloudValueEntity is an immutable representation of * this interface. CloudValueEntity is an immutable representation of
@ -36,6 +39,7 @@ public interface CloudStackEntity {
/** /**
* @return the uuid of the object. * @return the uuid of the object.
*/ */
@GET
String getUuid(); String getUuid();
/** /**
@ -43,40 +47,41 @@ public interface CloudStackEntity {
*/ */
long getId(); long getId();
/**
* @return external id set by the caller
*/
String getExternalId();
/** /**
* @return current state for the entity * @return current state for the entity
*/ */
@GET
String getCurrentState(); String getCurrentState();
/** /**
* @return desired state for the entity * @return desired state for the entity
*/ */
@GET
String getDesiredState(); String getDesiredState();
/** /**
* Get the time the entity was created * Get the time the entity was created
*/ */
@GET
Date getCreatedTime(); Date getCreatedTime();
/** /**
* Get the time the entity was last updated * Get the time the entity was last updated
*/ */
@GET
Date getLastUpdatedTime(); Date getLastUpdatedTime();
/** /**
* @return reference to the owner of this entity * @return reference to the owner of this entity
*/ */
@GET
String getOwner(); String getOwner();
/** /**
* @return details stored for this entity when created. * @return details stored for this entity when created.
*/ */
Map<String, String> getDetails(String source); Map<String, String> getDetails(
@QueryParam("source") String source);
/** /**
* @return a list of sources that have added to the details. * @return a list of sources that have added to the details.

View File

@ -20,6 +20,8 @@ package org.apache.cloudstack.engine.service.api;
import java.util.List; import java.util.List;
import javax.ws.rs.Path;
import com.cloud.network.Network; import com.cloud.network.Network;
import com.cloud.storage.Volume; import com.cloud.storage.Volume;
import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine;
@ -28,6 +30,7 @@ import com.cloud.vm.VirtualMachine;
* Service to retrieve CloudStack entities * Service to retrieve CloudStack entities
* very likely to change * very likely to change
*/ */
@Path("resources")
public interface EntityService { public interface EntityService {
List<String> listVirtualMachines(); List<String> listVirtualMachines();
List<String> listVolumes(); List<String> listVolumes();

View File

@ -20,7 +20,12 @@ package org.apache.cloudstack.engine.service.api;
import java.net.URL; import java.net.URL;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.ws.rs.DELETE;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import org.apache.cloudstack.engine.cloud.entity.api.NetworkEntity; import org.apache.cloudstack.engine.cloud.entity.api.NetworkEntity;
import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity; import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity;
@ -29,56 +34,68 @@ import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity;
import com.cloud.hypervisor.Hypervisor; import com.cloud.hypervisor.Hypervisor;
@Path("orchestration")
@Produces({"application/json", "application/xml"})
public interface OrchestrationService { public interface OrchestrationService {
/** /**
* creates a new virtual machine * creates a new virtual machine
* *
* @param uuid externally unique name to reference the virtual machine * @param id externally unique name to reference the virtual machine
* @param owner owner reference
* @param template reference to the template * @param template reference to the template
* @param hostName name of the host * @param hostName name of the host
* @param displayName name to look at
* @param cpu # of cpu cores * @param cpu # of cpu cores
* @param speed speed of the cpu core * @param speed speed of the cpu core in MHZ
* @param memory memory to allocate in bytes * @param memory memory to allocate in bytes
* @param networks networks that this VM belongs in
* @param rootDiskTags tags for the root disk
* @param computeTags tags for the compute * @param computeTags tags for the compute
* @param details extra details to store for the VM * @param rootDiskTags tags for the root disk
* @return VirtualMachine * @param networks networks that this VM should join
* @return VirtualMachineEntity
*/ */
VirtualMachineEntity createVirtualMachine(String name, @POST
String template, VirtualMachineEntity createVirtualMachine(
String hostName, @QueryParam("id") String id,
int cpu, @QueryParam("owner") String owner,
int speed, @QueryParam("template-id") String templateId,
long memory, @QueryParam("host-name") String hostName,
List<String> networks, @QueryParam("display-name") String displayName,
List<String> rootDiskTags, @QueryParam("cpu") int cpu,
List<String> computeTags, @QueryParam("speed") int speed,
Map<String, String> details, @QueryParam("ram") long memory,
String owner); @QueryParam("compute-tags") List<String> computeTags,
@QueryParam("root-disk-tags") List<String> rootDiskTags,
@QueryParam("networks") List<String> networks
);
VirtualMachineEntity createVirtualMachineFromScratch(String uuid, @POST
String iso, VirtualMachineEntity createVirtualMachineFromScratch(
String os, @QueryParam("id") String id,
String hypervisor, @QueryParam("owner") String owner,
String hostName, @QueryParam("iso-id") String isoId,
int cpu, @QueryParam("host-name") String hostName,
int speed, @QueryParam("display-name") String displayName,
long memory, @QueryParam("hypervisor") String hypervisor,
List<String> networks, @QueryParam("os") String os,
List<String> computeTags, @QueryParam("cpu") int cpu,
Map<String, String> details, @QueryParam("speed") int speed,
String owner); @QueryParam("ram") long memory,
@QueryParam("compute-tags") List<String> computeTags,
@QueryParam("root-disk-tags") List<String> rootDiskTags,
@QueryParam("networks") List<String> networks);
NetworkEntity createNetwork(String externaId, String name, String cidr, String gateway); @POST
NetworkEntity createNetwork(String id, String name, String domainName, String cidr, String gateway);
@DELETE
void destroyNetwork(String networkUuid); void destroyNetwork(String networkUuid);
@POST
VolumeEntity createVolume(); VolumeEntity createVolume();
@DELETE
void destroyVolume(String volumeEntity); void destroyVolume(String volumeEntity);
@POST
TemplateEntity registerTemplate(String name, URL path, String os, Hypervisor hypervisor); TemplateEntity registerTemplate(String name, URL path, String os, Hypervisor hypervisor);
} }

View File

@ -21,9 +21,17 @@ package org.apache.cloudstack.engine.service.api;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import org.apache.cloudstack.engine.datacenter.entity.api.ClusterEntity;
import org.apache.cloudstack.engine.datacenter.entity.api.PodEntity;
import org.apache.cloudstack.engine.datacenter.entity.api.StorageEntity;
import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity; import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity;
import com.cloud.dc.DataCenter;
import com.cloud.dc.Pod; import com.cloud.dc.Pod;
import com.cloud.host.Host; import com.cloud.host.Host;
import com.cloud.host.Status; import com.cloud.host.Status;
@ -34,32 +42,56 @@ import com.cloud.storage.StoragePool;
* ProvisioningService registers and deregisters physical and virtual * ProvisioningService registers and deregisters physical and virtual
* resources that the management server can use. * resources that the management server can use.
*/ */
@Path("/provision")
@Produces({"application/json", "application/xml"})
public interface ProvisioningService { public interface ProvisioningService {
String registerStorage(String name, List<String> tags, Map<String, String> details); @POST
StorageEntity registerStorage(String name, List<String> tags, Map<String, String> details);
@POST
ZoneEntity registerZone(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); @POST
PodEntity registerPod(String name, List<String> tags, Map<String, String> details);
@POST
ClusterEntity registerCluster(String name, List<String> tags, Map<String, String> details);
@POST
String registerHost(String name, List<String> tags, Map<String, String> details); String registerHost(String name, List<String> tags, Map<String, String> details);
@DELETE
void deregisterStorage(String uuid); void deregisterStorage(String uuid);
@DELETE
void deregisterZone(); void deregisterZone();
@DELETE
void deregisterPod(); void deregisterPod();
@DELETE
void deregisterCluster(); void deregisterCluster();
@DELETE
void deregisterHost(); void deregisterHost();
void changeState(String type, String entity, Status state); void changeState(String type, String entity, Status state);
@GET
@Path("/hosts")
List<Host> listHosts(); List<Host> listHosts();
@GET
@Path("/pods")
List<Pod> listPods(); List<Pod> listPods();
List<DataCenter> listZones(); @GET
@Path("/zones")
List<ZoneEntity> listZones();
@GET
@Path("/storages")
List<StoragePool> listStorage(); List<StoragePool> listStorage();
} }

View File

@ -0,0 +1,294 @@
/*
* 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.engine.datacenter.entity.api;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@Path("/zone/{id}")
public class ZoneEntityImpl implements ZoneEntity {
@Override
@POST
public boolean enable() {
// TODO Auto-generated method stub
return false;
}
@Override
@POST
public boolean disable() {
// TODO Auto-generated method stub
return false;
}
@Override
@POST
public boolean deactivate() {
// TODO Auto-generated method stub
return false;
}
@Override
@POST
public boolean reactivate() {
// TODO Auto-generated method stub
return false;
}
@Override
@GET
public String getUuid() {
// TODO Auto-generated method stub
return null;
}
@Override
public long getId() {
// TODO Auto-generated method stub
return 0;
}
@Override
@GET
public String getCurrentState() {
// TODO Auto-generated method stub
return "state";
}
@Override
@GET
public String getDesiredState() {
// TODO Auto-generated method stub
return "desired_state";
}
@Override
@GET
public Date getCreatedTime() {
// TODO Auto-generated method stub
return new Date();
}
@Override
@GET
public Date getLastUpdatedTime() {
// TODO Auto-generated method stub
return new Date();
}
@Override
@GET
public String getOwner() {
// TODO Auto-generated method stub
return "owner";
}
@Override
public Map<String, String> getDetails(String source) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<String> getDetailSources() {
// TODO Auto-generated method stub
return null;
}
@Override
public void addDetail(String source, String name, String value) {
// TODO Auto-generated method stub
}
@Override
public void delDetail(String source, String name, String value) {
// TODO Auto-generated method stub
}
@Override
public void updateDetail(String source, String name, String value) {
// TODO Auto-generated method stub
}
@Override
public List<Method> getApplicableActions() {
// TODO Auto-generated method stub
return null;
}
@Override
public State getState() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getDns1() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getDns2() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getGuestNetworkCidr() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getName() {
// TODO Auto-generated method stub
return null;
}
@Override
public Long getDomainId() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getDescription() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getDomain() {
// TODO Auto-generated method stub
return null;
}
@Override
public NetworkType getNetworkType() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getInternalDns1() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getInternalDns2() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getDnsProvider() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getGatewayProvider() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getFirewallProvider() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getDhcpProvider() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getLoadBalancerProvider() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getUserDataProvider() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getVpnProvider() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean isSecurityGroupEnabled() {
// TODO Auto-generated method stub
return false;
}
@Override
public Map<String, String> getDetails() {
// TODO Auto-generated method stub
return null;
}
@Override
public void setDetails(Map<String, String> details) {
// TODO Auto-generated method stub
}
@Override
public AllocationState getAllocationState() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getZoneToken() {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean isLocalStorageEnabled() {
// TODO Auto-generated method stub
return false;
}
@Override
public List<PodEntity> listPods() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -0,0 +1,138 @@
/*
* 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.engine.service.api;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import org.apache.cloudstack.engine.datacenter.entity.api.ClusterEntity;
import org.apache.cloudstack.engine.datacenter.entity.api.PodEntity;
import org.apache.cloudstack.engine.datacenter.entity.api.StorageEntity;
import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity;
import org.springframework.stereotype.Service;
import com.cloud.dc.Pod;
import com.cloud.host.Host;
import com.cloud.host.Status;
import com.cloud.storage.StoragePool;
@Service("provisioningService")
@Path("/provisioning")
public class ProvisioningServiceImpl implements ProvisioningService {
@Override
public StorageEntity registerStorage(String name, List<String> tags, Map<String, String> details) {
// TODO Auto-generated method stub
return null;
}
@Override
public ZoneEntity registerZone(String name, List<String> tags, Map<String, String> details) {
// TODO Auto-generated method stub
return null;
}
@Override
public PodEntity registerPod(String name, List<String> tags, Map<String, String> details) {
// TODO Auto-generated method stub
return null;
}
@Override
public ClusterEntity registerCluster(String name, List<String> tags, Map<String, String> details) {
// TODO Auto-generated method stub
return null;
}
@Override
public String registerHost(String name, List<String> tags, Map<String, String> details) {
// TODO Auto-generated method stub
return null;
}
@Override
public void deregisterStorage(String uuid) {
// TODO Auto-generated method stub
}
@Override
public void deregisterZone() {
// TODO Auto-generated method stub
}
@Override
public void deregisterPod() {
// TODO Auto-generated method stub
}
@Override
public void deregisterCluster() {
// TODO Auto-generated method stub
}
@Override
public void deregisterHost() {
// TODO Auto-generated method stub
}
@Override
public void changeState(String type, String entity, Status state) {
// TODO Auto-generated method stub
}
@Override
public List<Host> listHosts() {
// TODO Auto-generated method stub
return null;
}
@Override
public List<Pod> listPods() {
// TODO Auto-generated method stub
return null;
}
@Override
@GET
@Path("/zones")
@Produces("text/plain")
public List<ZoneEntity> listZones() {
List<ZoneEntity> zones = new ArrayList<ZoneEntity>();
// TODO Auto-generated method stub
return zones;
}
@Override
public List<StoragePool> listStorage() {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -34,11 +34,7 @@ import com.cloud.hypervisor.Hypervisor;
public class CloudOrchestrator implements OrchestrationService { public class CloudOrchestrator implements OrchestrationService {
public VirtualMachineEntity create(String name, String template, String hostName, int cpu, int speed, long memory, List<String> networks, List<String> rootDiskTags, List<String> computeTags,
Map<String, String> details, String owner) {
// TODO Auto-generated method stub
return null;
}
public VirtualMachineEntity createFromScratch(String uuid, String iso, String os, String hypervisor, String hostName, int cpu, int speed, long memory, List<String> networks, List<String> computeTags, public VirtualMachineEntity createFromScratch(String uuid, String iso, String os, String hypervisor, String hostName, int cpu, int speed, long memory, List<String> networks, List<String> computeTags,
Map<String, String> details, String owner) { Map<String, String> details, String owner) {
@ -82,26 +78,6 @@ public class CloudOrchestrator implements OrchestrationService {
return null; return null;
} }
@Override
public VirtualMachineEntity createVirtualMachine(String name, String template, String hostName, int cpu, int speed, long memory, List<String> networks, List<String> rootDiskTags, List<String> computeTags,
Map<String, String> details, String owner) {
// TODO Auto-generated method stub
return null;
}
@Override
public VirtualMachineEntity createVirtualMachineFromScratch(String uuid, String iso, String os, String hypervisor, String hostName, int cpu, int speed, long memory, List<String> networks, List<String> computeTags,
Map<String, String> details, String owner) {
// TODO Auto-generated method stub
return null;
}
@Override
public NetworkEntity createNetwork(String externaId, String name, String cidr, String gateway) {
// TODO Auto-generated method stub
return null;
}
@Override @Override
public void destroyNetwork(String networkUuid) { public void destroyNetwork(String networkUuid) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
@ -114,4 +90,33 @@ public class CloudOrchestrator implements OrchestrationService {
} }
@Override
public VirtualMachineEntity createVirtualMachine(
String id,
String owner,
String templateId,
String hostName,
String displayName,
int cpu,
int speed,
long memory,
List<String> computeTags,
List<String> rootDiskTags,
List<String> networks) {
return null;
}
@Override
public VirtualMachineEntity createVirtualMachineFromScratch(String id, String owner, String isoId, String hostName, String displayName, String hypervisor, String os, int cpu, int speed, long memory,
List<String> computeTags, List<String> rootDiskTags, List<String> networks) {
// TODO Auto-generated method stub
return null;
}
@Override
public NetworkEntity createNetwork(String id, String name, String domainName, String cidr, String gateway) {
// TODO Auto-generated method stub
return null;
}
} }

View File

@ -1,18 +1,17 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" <project
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.apache.cloudstack</groupId> <groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId> <artifactId>cloud-engine</artifactId>
<version>4.1.0-SNAPSHOT</version> <version>4.1.0-SNAPSHOT</version>
</parent> </parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine-service</artifactId> <artifactId>cloud-engine-service</artifactId>
<version>4.1.0-SNAPSHOT</version>
<packaging>war</packaging> <packaging>war</packaging>
<name>service Maven Webapp</name> <name>CloudStack Cloud-Engine Service</name>
<url>http://maven.apache.org</url> <url>http://www.cloudstack.org</url>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
@ -55,10 +54,49 @@
<artifactId>cloud-engine-compute</artifactId> <artifactId>cloud-engine-compute</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle-jaxrs</artifactId>
<version>2.7.0</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>engine</finalName> <finalName>engine</finalName>
<sourceDirectory>src</sourceDirectory> <plugins>
<testSourceDirectory>test</testSourceDirectory> <plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.7.v20120910</version>
<configuration>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webApp>
<contextPath>/engine</contextPath>
</webApp>
<connectors>
<connector
implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port>1736</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
</configuration>
</plugin>
</plugins>
</build> </build>
</project> </project>

View File

@ -0,0 +1,42 @@
/*
* 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.test;
import java.util.Calendar;
import java.util.Locale;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import org.springframework.format.datetime.DateFormatter;
import org.springframework.stereotype.Service;
@Service("timeService")
@Path("/time")
public class TimeService {
@GET @Produces("text/plain")
public String getDateTime()
{
DateFormatter formatter = new DateFormatter("dd/MM/yyyy hh:mm:ss");
return formatter.print(Calendar.getInstance().getTime(), Locale.getDefault());
}
}

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<context:component-scan base-package="org.apache.cloudstack.engine.service.api" />
<jaxrs:server id="restContainer" address="/">
<jaxrs:serviceBeans>
<ref bean="provisioningService"/>
</jaxrs:serviceBeans>
</jaxrs:server>
</beans>

View File

@ -0,0 +1,31 @@
<log4j:configuration debug="false">
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Threshold" value="DEBUG"/>
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
</layout>
</appender>
<!--
<appender name="FILE_APPENDER" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="${catalina.home}/logs/webapp.txt"/>
<param name="DatePattern" value="'-'yyyy-MM-dd'.txt'"/>
<param name="Threshold" value="DEBUG"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-4p [%t] %C{2} - %m%n"/>
</layout>
</appender>
-->
<!-- Spring -->
<logger name="org.springframework" additivity="false">
<level value="DEBUG"/>
<appender-ref ref="CONSOLE"/>
</logger>
<root>
<level value="DEBUG"/>
<appender-ref ref="CONSOLE"/>
</root>
</log4j:configuration>

View File

@ -3,5 +3,25 @@
"http://java.sun.com/dtd/web-app_2_3.dtd" > "http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app> <web-app>
<display-name>Archetype Created Web Application</display-name> <context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/beans.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<display-name>CXF Servlet</display-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app> </web-app>

View File

@ -24,8 +24,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity; import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity;
import org.apache.cloudstack.storage.image.db.ImageDataVO;
import org.apache.cloudstack.storage.image.store.ImageDataStore;
import org.apache.cloudstack.storage.image.store.ImageDataStoreInfo; import org.apache.cloudstack.storage.image.store.ImageDataStoreInfo;
import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.hypervisor.Hypervisor.HypervisorType;
@ -33,262 +31,256 @@ import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.Storage.TemplateType; import com.cloud.storage.Storage.TemplateType;
public class TemplateEntityImpl implements TemplateEntity { public class TemplateEntityImpl implements TemplateEntity {
protected TemplateInfo templateInfo; protected TemplateInfo templateInfo;
public TemplateEntityImpl(TemplateInfo templateInfo) { public TemplateEntityImpl(TemplateInfo templateInfo) {
this.templateInfo = templateInfo; this.templateInfo = templateInfo;
} }
public ImageDataStoreInfo getImageDataStore() { public ImageDataStoreInfo getImageDataStore() {
return templateInfo.getImageDataStore(); return templateInfo.getImageDataStore();
} }
public long getImageDataStoreId() { public long getImageDataStoreId() {
return getImageDataStore().getImageDataStoreId(); return getImageDataStore().getImageDataStoreId();
} }
public TemplateInfo getTemplateInfo() { public TemplateInfo getTemplateInfo() {
return this.templateInfo; return this.templateInfo;
} }
@Override @Override
public String getUuid() { public String getUuid() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public long getId() { public long getId() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return 0; return 0;
} }
@Override @Override
public String getExternalId() { public String getCurrentState() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public String getCurrentState() { public String getDesiredState() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public String getDesiredState() { public Date getCreatedTime() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public Date getCreatedTime() { public Date getLastUpdatedTime() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public Date getLastUpdatedTime() { public String getOwner() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public String getOwner() { public Map<String, String> getDetails(String source) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public Map<String, String> getDetails(String source) { public List<String> getDetailSources() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public List<String> getDetailSources() { public void addDetail(String source, String name, String value) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null;
}
@Override }
public void addDetail(String source, String name, String value) {
// TODO Auto-generated method stub
}
@Override @Override
public void delDetail(String source, String name, String value) { public void delDetail(String source, String name, String value) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
}
@Override }
public void updateDetail(String source, String name, String value) {
// TODO Auto-generated method stub
}
@Override @Override
public List<Method> getApplicableActions() { public void updateDetail(String source, String name, String value) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null;
}
@Override }
public boolean isFeatured() {
// TODO Auto-generated method stub
return false;
}
@Override @Override
public boolean isPublicTemplate() { public List<Method> getApplicableActions() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false; return null;
} }
@Override @Override
public boolean isExtractable() { public boolean isFeatured() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false; return false;
} }
@Override @Override
public String getName() { public boolean isPublicTemplate() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return false;
} }
@Override @Override
public ImageFormat getFormat() { public boolean isExtractable() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return false;
} }
@Override @Override
public boolean isRequiresHvm() { public String getName() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false; return null;
} }
@Override @Override
public String getDisplayText() { public ImageFormat getFormat() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public boolean getEnablePassword() { public boolean isRequiresHvm() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false; return false;
} }
@Override @Override
public boolean getEnableSshKey() { public String getDisplayText() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false; return null;
} }
@Override @Override
public boolean isCrossZones() { public boolean getEnablePassword() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false; return false;
} }
@Override @Override
public Date getCreated() { public boolean getEnableSshKey() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return false;
} }
@Override @Override
public long getGuestOSId() { public boolean isCrossZones() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return 0; return false;
} }
@Override @Override
public boolean isBootable() { public Date getCreated() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return false; return null;
} }
@Override @Override
public TemplateType getTemplateType() { public long getGuestOSId() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return 0;
} }
@Override @Override
public HypervisorType getHypervisorType() { public boolean isBootable() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return false;
} }
@Override @Override
public int getBits() { public TemplateType getTemplateType() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return 0; return null;
} }
@Override @Override
public String getUniqueName() { public HypervisorType getHypervisorType() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public String getUrl() { public int getBits() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return 0;
} }
@Override @Override
public String getChecksum() { public String getUniqueName() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public Long getSourceTemplateId() { public String getUrl() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public String getTemplateTag() { public String getChecksum() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public Map getDetails() { public Long getSourceTemplateId() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public long getAccountId() { public String getTemplateTag() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return 0; return null;
} }
@Override @Override
public long getDomainId() { public Map getDetails() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return 0; return null;
} }
@Override @Override
public long getPhysicalSize() { public long getAccountId() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return 0; return 0;
} }
@Override @Override
public long getVirtualSize() { public long getDomainId() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return 0; return 0;
} }
@Override
public long getPhysicalSize() {
// TODO Auto-generated method stub
return 0;
}
@Override
public long getVirtualSize() {
// TODO Auto-generated method stub
return 0;
}
} }

View File

@ -31,187 +31,181 @@ import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskTyp
import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType; import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType;
public class VolumeEntityImpl implements VolumeEntity { public class VolumeEntityImpl implements VolumeEntity {
private VolumeInfo volumeInfo; private VolumeInfo volumeInfo;
public VolumeEntityImpl(VolumeInfo volumeObject) {
this.volumeInfo = volumeObject;
}
public VolumeInfo getVolumeInfo() {
return volumeInfo;
}
public void setVolumeInfo(VolumeInfo vi) {
this.volumeInfo = vi;
}
@Override
public String getUuid() {
return volumeInfo.getUuid();
}
@Override public VolumeEntityImpl(VolumeInfo volumeObject) {
public long getId() { this.volumeInfo = volumeObject;
return volumeInfo.getId(); }
}
@Override public VolumeInfo getVolumeInfo() {
public String getExternalId() { return volumeInfo;
// TODO Auto-generated method stub }
return null;
}
@Override public void setVolumeInfo(VolumeInfo vi) {
public String getCurrentState() { this.volumeInfo = vi;
return volumeInfo.getCurrentState().toString(); }
}
@Override @Override
public String getDesiredState() { public String getUuid() {
return volumeInfo.getDesiredState().toString(); return volumeInfo.getUuid();
} }
@Override @Override
public Date getCreatedTime() { public long getId() {
return volumeInfo.getCreatedData(); return volumeInfo.getId();
} }
@Override @Override
public Date getLastUpdatedTime() { public String getCurrentState() {
// TODO Auto-generated method stub return volumeInfo.getCurrentState().toString();
return null; }
}
@Override @Override
public String getOwner() { public String getDesiredState() {
// TODO Auto-generated method stub return volumeInfo.getDesiredState().toString();
return null; }
}
@Override @Override
public Map<String, String> getDetails(String source) { public Date getCreatedTime() {
// TODO Auto-generated method stub return volumeInfo.getCreatedData();
return null; }
}
@Override @Override
public List<String> getDetailSources() { public Date getLastUpdatedTime() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public void addDetail(String source, String name, String value) { public String getOwner() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null;
}
} @Override
public Map<String, String> getDetails(String source) {
// TODO Auto-generated method stub
return null;
}
@Override @Override
public void delDetail(String source, String name, String value) { public List<String> getDetailSources() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null;
}
} @Override
public void addDetail(String source, String name, String value) {
// TODO Auto-generated method stub
@Override }
public void updateDetail(String source, String name, String value) {
// TODO Auto-generated method stub
} @Override
public void delDetail(String source, String name, String value) {
// TODO Auto-generated method stub
@Override }
public List<Method> getApplicableActions() {
// TODO Auto-generated method stub
return null;
}
@Override @Override
public SnapshotEntity takeSnapshotOf(boolean full) { public void updateDetail(String source, String name, String value) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null;
}
@Override }
public String reserveForMigration(long expirationTime) {
// TODO Auto-generated method stub
return null;
}
@Override @Override
public void migrate(String reservationToken) { public List<Method> getApplicableActions() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null;
}
} @Override
public SnapshotEntity takeSnapshotOf(boolean full) {
// TODO Auto-generated method stub
return null;
}
@Override @Override
public VolumeEntity setupForCopy() { public String reserveForMigration(long expirationTime) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public void copy(VolumeEntity dest) { public void migrate(String reservationToken) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@Override @Override
public void attachTo(String vm, long deviceId) { public VolumeEntity setupForCopy() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null;
}
} @Override
public void copy(VolumeEntity dest) {
// TODO Auto-generated method stub
@Override }
public void detachFrom() {
// TODO Auto-generated method stub
} @Override
public void attachTo(String vm, long deviceId) {
// TODO Auto-generated method stub
@Override }
public void destroy() {
// TODO Auto-generated method stub
} @Override
public void detachFrom() {
// TODO Auto-generated method stub
@Override }
public long getSize() {
// TODO Auto-generated method stub
return 0;
}
@Override @Override
public String getTemplatePath() { public void destroy() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null;
}
@Override }
public String getTemplateUuid() {
// TODO Auto-generated method stub
return null;
}
@Override @Override
public VolumeDiskType getDiskType() { public long getSize() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return 0;
} }
@Override @Override
public VolumeType getType() { public String getTemplatePath() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public StorageEntity getDataStore() { public String getTemplateUuid() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public void setPath(String path) { public VolumeDiskType getDiskType() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null;
}
} @Override
public VolumeType getType() {
// TODO Auto-generated method stub
return null;
}
@Override
public StorageEntity getDataStore() {
// TODO Auto-generated method stub
return null;
}
@Override
public void setPath(String path) {
// TODO Auto-generated method stub
}
} }