mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
links are working
This commit is contained in:
parent
862dff7d37
commit
35914d6f6a
@ -1,21 +1,13 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<!-- 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. -->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" 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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@ -42,8 +34,13 @@
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-jaxrs</artifactId>
|
||||
<version>1.9.9</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<defaultGoal>install</defaultGoal>
|
||||
|
||||
@ -18,7 +18,9 @@
|
||||
*/
|
||||
package org.apache.cloudstack.engine.datacenter.entity.api;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.apache.cloudstack.engine.entity.api.CloudStackEntity;
|
||||
|
||||
@ -29,6 +31,7 @@ import com.cloud.utils.fsm.StateObject;
|
||||
* This interface specifies the states and operations all physical
|
||||
* and virtual resources in the data center must implement.
|
||||
*/
|
||||
@Produces({"application/json", "application/xml"})
|
||||
public interface DataCenterResourceEntity extends CloudStackEntity, StateObject<DataCenterResourceEntity.State> {
|
||||
|
||||
/**
|
||||
@ -87,4 +90,8 @@ public interface DataCenterResourceEntity extends CloudStackEntity, StateObject<
|
||||
@POST
|
||||
boolean reactivate();
|
||||
|
||||
@Override
|
||||
@GET
|
||||
State getState();
|
||||
|
||||
}
|
||||
|
||||
@ -22,14 +22,18 @@ import java.util.List;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.cloud.dc.DataCenter;
|
||||
|
||||
/**
|
||||
* Describes a zone and operations that can be done in a zone.
|
||||
*/
|
||||
@Path("zone/{zone-id}")
|
||||
@XmlRootElement(name="zone")
|
||||
public interface ZoneEntity extends DataCenterResourceEntity, DataCenter {
|
||||
@GET
|
||||
@Path("/pods")
|
||||
List<PodEntity> listPods();
|
||||
|
||||
List<String> listPodIds();
|
||||
}
|
||||
|
||||
@ -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.engine.rest.datacenter.entity.api;
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.PodEntity;
|
||||
|
||||
public class PodRestTO {
|
||||
|
||||
public String uuid;
|
||||
public String name;
|
||||
|
||||
public PodRestTO(PodEntity pod) {
|
||||
this.uuid = pod.getUuid();
|
||||
this.name = pod.getName();
|
||||
}
|
||||
|
||||
public PodRestTO() {
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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.rest.datacenter.entity.api;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity;
|
||||
import org.apache.cloudstack.engine.service.api.ProvisioningService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("zoneService")
|
||||
@Path("/zone/{zoneid}")
|
||||
public class ZoneRestTO {
|
||||
@Inject
|
||||
protected static ProvisioningService s_provisioningService;
|
||||
|
||||
public String id;
|
||||
public URI uri;
|
||||
public String name;
|
||||
public String[] pods;
|
||||
|
||||
public ZoneRestTO(UriBuilder ub, ZoneEntity zone, URI uri) {
|
||||
this.id = zone.getUuid();
|
||||
this.name = zone.getName();
|
||||
this.uri = uri;
|
||||
List<String> podIds = zone.listPodIds();
|
||||
this.pods = new String[podIds.size()];
|
||||
this.pods = podIds.toArray(new String[podIds.size()]);
|
||||
}
|
||||
|
||||
public ZoneRestTO() {
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/pods")
|
||||
public String[] listPods(@PathParam("zoneid") String zoneId) {
|
||||
return this.pods;
|
||||
}
|
||||
|
||||
}
|
||||
@ -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.engine.rest.datacenter.entity.api;
|
||||
|
||||
public class ZoneRestTOs {
|
||||
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* 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.rest.service.api;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.PodEntity;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity;
|
||||
import org.apache.cloudstack.engine.rest.datacenter.entity.api.PodRestTO;
|
||||
import org.apache.cloudstack.engine.rest.datacenter.entity.api.ZoneRestTO;
|
||||
import org.apache.cloudstack.engine.service.api.ProvisioningService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@Service("provisioningService")
|
||||
@Path("/provisioning")
|
||||
@Produces({"application/xml", "application/json"})
|
||||
@Component
|
||||
public class ProvisioningRestService {
|
||||
@Inject
|
||||
ProvisioningService _provisioningService;
|
||||
|
||||
@GET
|
||||
@Path("/{zoneid}")
|
||||
public ZoneRestTO getZone(@Context UriInfo ui, @PathParam("zoneid") String id) {
|
||||
UriBuilder ub = ui.getAbsolutePathBuilder().path(this.getClass(), "getZone");
|
||||
ZoneEntity entity = _provisioningService.getZone(id);
|
||||
return new ZoneRestTO(ub, entity, ub.build(entity.getUuid()));
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/zones")
|
||||
public ZoneRestTO[] listZones(@Context UriInfo ui) {
|
||||
List<ZoneEntity> zones = _provisioningService.listZones();
|
||||
ZoneRestTO[] tos = new ZoneRestTO[zones.size()];
|
||||
UriBuilder ub = ui.getAbsolutePathBuilder().path(this.getClass(), "getZone");
|
||||
Iterator<ZoneEntity> it = zones.iterator();
|
||||
for (int i = 0; i < tos.length; i++) {
|
||||
ZoneEntity entity = it.next();
|
||||
tos[i] = new ZoneRestTO(ub, entity, ub.build(entity.getUuid()));
|
||||
}
|
||||
return tos;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/zone/{zoneid}/pods")
|
||||
public PodRestTO[] listPods(@PathParam("zoneid") String zoneId) {
|
||||
List<PodEntity> pods = _provisioningService.listPods();
|
||||
PodRestTO[] tos = new PodRestTO[pods.size()];
|
||||
Iterator<PodEntity> it = pods.iterator();
|
||||
for (int i = 0; i < tos.length; i++) {
|
||||
PodEntity pod = it.next();
|
||||
tos[i] = new PodRestTO(pod);
|
||||
}
|
||||
return tos;
|
||||
}
|
||||
}
|
||||
@ -21,18 +21,11 @@ package org.apache.cloudstack.engine.service.api;
|
||||
import java.util.List;
|
||||
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 com.cloud.dc.Pod;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.storage.StoragePool;
|
||||
@ -42,56 +35,37 @@ import com.cloud.storage.StoragePool;
|
||||
* ProvisioningService registers and deregisters physical and virtual
|
||||
* resources that the management server can use.
|
||||
*/
|
||||
@Path("/provision")
|
||||
@Produces({"application/json", "application/xml"})
|
||||
public interface ProvisioningService {
|
||||
|
||||
@POST
|
||||
StorageEntity registerStorage(String name, List<String> tags, Map<String, String> details);
|
||||
|
||||
@POST
|
||||
ZoneEntity registerZone(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);
|
||||
|
||||
@DELETE
|
||||
void deregisterStorage(String uuid);
|
||||
|
||||
@DELETE
|
||||
void deregisterZone();
|
||||
|
||||
@DELETE
|
||||
void deregisterPod();
|
||||
|
||||
@DELETE
|
||||
void deregisterCluster();
|
||||
|
||||
@DELETE
|
||||
void deregisterHost();
|
||||
|
||||
void changeState(String type, String entity, Status state);
|
||||
|
||||
@GET
|
||||
@Path("/hosts")
|
||||
List<Host> listHosts();
|
||||
|
||||
@GET
|
||||
@Path("/pods")
|
||||
List<Pod> listPods();
|
||||
List<PodEntity> listPods();
|
||||
|
||||
@GET
|
||||
@Path("/zones")
|
||||
List<ZoneEntity> listZones();
|
||||
|
||||
@GET
|
||||
@Path("/storages")
|
||||
List<StoragePool> listStorage();
|
||||
|
||||
ZoneEntity getZone(String id);
|
||||
}
|
||||
|
||||
@ -0,0 +1,197 @@
|
||||
/*
|
||||
* 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 com.cloud.org.Cluster;
|
||||
|
||||
public class PodEntityImpl implements PodEntity {
|
||||
String _uuid;
|
||||
String _name;
|
||||
|
||||
public PodEntityImpl(String uuid, String name) {
|
||||
_uuid = uuid;
|
||||
_name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean enable() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean disable() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deactivate() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reactivate() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public State getState() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
return _uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCurrentState() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDesiredState() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getCreatedTime() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getLastUpdatedTime() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwner() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@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 String getCidrAddress() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCidrSize() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGateway() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDataCenterId() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return _name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AllocationState getAllocationState() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getExternalDhcp() {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Cluster> listClusters() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -19,50 +19,52 @@
|
||||
package org.apache.cloudstack.engine.datacenter.entity.api;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
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 {
|
||||
String _id;
|
||||
String _name;
|
||||
|
||||
// This is a test constructor
|
||||
public ZoneEntityImpl(String id, String name) {
|
||||
_id = id;
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public ZoneEntityImpl() {
|
||||
}
|
||||
|
||||
@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;
|
||||
return _id;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -72,35 +74,30 @@ public class ZoneEntityImpl implements ZoneEntity {
|
||||
}
|
||||
|
||||
@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";
|
||||
@ -168,8 +165,7 @@ public class ZoneEntityImpl implements ZoneEntity {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return _name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -291,4 +287,12 @@ public class ZoneEntityImpl implements ZoneEntity {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listPodIds() {
|
||||
List<String> podIds = new ArrayList<String>();
|
||||
podIds.add("pod-uuid-1");
|
||||
podIds.add("pod-uuid-2");
|
||||
return podIds;
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,23 +22,19 @@ 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.PodEntityImpl;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.StorageEntity;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntityImpl;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.dc.Pod;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.storage.StoragePool;
|
||||
|
||||
@Service("provisioningService")
|
||||
@Path("/provisioning")
|
||||
@Component
|
||||
public class ProvisioningServiceImpl implements ProvisioningService {
|
||||
|
||||
@Override
|
||||
@ -114,18 +110,18 @@ public class ProvisioningServiceImpl implements ProvisioningService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Pod> listPods() {
|
||||
// TODO Auto-generated method stub
|
||||
public List<PodEntity> listPods() {
|
||||
List<PodEntity> pods = new ArrayList<PodEntity>();
|
||||
pods.add(new PodEntityImpl("pod-uuid-1", "pod1"));
|
||||
pods.add(new PodEntityImpl("pod-uuid-2", "pod2"));
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@GET
|
||||
@Path("/zones")
|
||||
@Produces("text/plain")
|
||||
public List<ZoneEntity> listZones() {
|
||||
List<ZoneEntity> zones = new ArrayList<ZoneEntity>();
|
||||
// TODO Auto-generated method stub
|
||||
zones.add(new ZoneEntityImpl("zone-uuid-1", "name1"));
|
||||
zones.add(new ZoneEntityImpl("zone-uuid-2", "name2"));
|
||||
return zones;
|
||||
}
|
||||
|
||||
@ -135,4 +131,10 @@ public class ProvisioningServiceImpl implements ProvisioningService {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZoneEntity getZone(String uuid) {
|
||||
ZoneEntityImpl impl = new ZoneEntityImpl(uuid, "name");
|
||||
return impl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -10,11 +10,15 @@
|
||||
<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.test"/>
|
||||
<context:component-scan base-package="org.apache.cloudstack" />
|
||||
|
||||
<jaxrs:server id="restContainer" address="/">
|
||||
<jaxrs:serviceBeans>
|
||||
<ref bean="timeService" />
|
||||
<ref bean="provisioningService" />
|
||||
<ref bean="zoneService" />
|
||||
</jaxrs:serviceBeans>
|
||||
<jaxrs:providers>
|
||||
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />
|
||||
</jaxrs:providers>
|
||||
</jaxrs:server>
|
||||
</beans>
|
||||
|
||||
@ -2,7 +2,11 @@
|
||||
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd" >
|
||||
|
||||
<web-app>
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
metadata-complete="true"
|
||||
version="3.0">
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>WEB-INF/beans.xml</param-value>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user