mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
Fixed problems with inject checkin
This commit is contained in:
parent
54cce5fa18
commit
e936c32a04
@ -22,6 +22,7 @@ import java.util.List;
|
||||
|
||||
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.service.api.ProvisioningService;
|
||||
@ -32,6 +33,8 @@ import com.cloud.dc.DataCenter;
|
||||
/**
|
||||
* Describes a zone and operations that can be done in a zone.
|
||||
*/
|
||||
@Path("/zone/{zoneid}")
|
||||
@Produces({"application/json"})
|
||||
@XmlRootElement(name="zone")
|
||||
public interface ZoneEntity extends DataCenterResourceEntity, DataCenter {
|
||||
@GET
|
||||
@ -40,4 +43,8 @@ public interface ZoneEntity extends DataCenterResourceEntity, DataCenter {
|
||||
|
||||
@Url(clazz=ProvisioningService.class, method="getPod", name="id", type=List.class)
|
||||
List<String> listPodIds();
|
||||
|
||||
@Override
|
||||
@Path("/enable")
|
||||
boolean enable();
|
||||
}
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* 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() {
|
||||
}
|
||||
}
|
||||
@ -1,78 +0,0 @@
|
||||
/*
|
||||
* 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.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.core.Context;
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
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 URI[] pods;
|
||||
|
||||
public ZoneRestTO(UriInfo ui, ZoneEntity zone, URI uri) {
|
||||
this.id = zone.getUuid();
|
||||
this.name = zone.getName();
|
||||
this.uri = uri;
|
||||
List<String> podIds = zone.listPodIds();
|
||||
this.pods = new URI[podIds.size()];
|
||||
UriBuilder ub = ui.getAbsolutePathBuilder().path(this.getClass(), "getPod");
|
||||
Iterator<String> it = podIds.iterator();
|
||||
for (int i = 0; i < pods.length; i++) {
|
||||
String pod = it.next();
|
||||
pods[i] = ub.build(pod);
|
||||
}
|
||||
}
|
||||
|
||||
public ZoneRestTO() {
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/pods")
|
||||
public URI[] listPods(@PathParam("zoneid") String zoneId) {
|
||||
return this.pods;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/pod/{podid}")
|
||||
public PodRestTO getPod(@Context UriInfo ui, @PathParam("podid") String podId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* 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,87 @@
|
||||
/*
|
||||
* 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.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.ClusterEntity;
|
||||
import org.apache.cloudstack.engine.service.api.ProvisioningService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Component
|
||||
@Service("ClusterRestService")
|
||||
@Produces("application/json")
|
||||
public class ClusterRestService {
|
||||
@Inject
|
||||
ProvisioningService _provisioningService;
|
||||
|
||||
@GET @Path("/clusters")
|
||||
public List<ClusterEntity> listAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@GET @Path("/cluster/{clusterid}")
|
||||
public ClusterEntity get(@PathParam("clusterid") String clusterId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@POST @Path("/cluster/{clusterid}/enable")
|
||||
public String enable(@PathParam("clusterid") String clusterId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@POST @Path("/cluster/{clusterid}/disable")
|
||||
public String disable(@PathParam("clusterid") String clusterId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@POST @Path("/cluster/{clusterid}/deactivate")
|
||||
public String deactivate(@PathParam("clusterid") String clusterId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@POST @Path("/cluster/{clusterid}/reactivate")
|
||||
public String reactivate(@PathParam("clusterid") String clusterId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@PUT @Path("/cluster/create")
|
||||
public ClusterEntity create(
|
||||
@QueryParam("xid") String xid,
|
||||
@QueryParam("display-name") String displayName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@PUT @Path("/cluster/{clusterid}/update")
|
||||
public ClusterEntity update(
|
||||
@QueryParam("display-name") String displayName) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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.List;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
|
||||
import org.apache.cloudstack.engine.cloud.entity.api.NetworkEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("NetworkRestService")
|
||||
@Component
|
||||
@Produces("application/json")
|
||||
public class NetworkRestService {
|
||||
@PUT @Path("/network/create")
|
||||
public NetworkEntity create(
|
||||
@QueryParam("xid") String xid,
|
||||
@QueryParam("display-name") String displayName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@GET @Path("/network/{network-id}")
|
||||
public NetworkEntity get(@PathParam("network-id") String networkId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@GET @Path("/networks")
|
||||
public List<NetworkEntity> listAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@POST @Path("/network/{network-id}/")
|
||||
public String deploy(@PathParam("network-id") String networkId) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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 javax.inject.Inject;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.PodEntity;
|
||||
import org.apache.cloudstack.engine.service.api.ProvisioningService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Component
|
||||
@Service("PodService")
|
||||
@Produces({"application/json"})
|
||||
public class PodRestService {
|
||||
@Inject
|
||||
ProvisioningService _provisioningService;
|
||||
|
||||
@GET @Path("/pod/{pod-id}")
|
||||
public PodEntity getPod(@PathParam("pod-id") String podId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@POST @Path("/pod/{pod-id}/enable")
|
||||
public String enable(@PathParam("pod-id") String podId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@POST @Path("/pod/{pod-id}/disable")
|
||||
public String disable(@PathParam("pod-id") String podId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@POST @Path("/pod/{pod-id}/deactivate")
|
||||
public String deactivate(@PathParam("pod-id") String podId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@POST @Path("/pod/{pod-id}/reactivate")
|
||||
public String reactivate(@PathParam("pod-id") String podId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@PUT @Path("/pod/create")
|
||||
public PodEntity create(
|
||||
@QueryParam("xid") String xid,
|
||||
@QueryParam("display-name") String displayName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@PUT @Path("/pod/{pod-id}")
|
||||
public PodEntity update(
|
||||
@PathParam("pod-id") String podId,
|
||||
@QueryParam("display-name") String displayName) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1,82 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
|
||||
@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(ui, 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(ui, 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;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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.List;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
|
||||
import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Component
|
||||
@Service("VirtualMachineRestService")
|
||||
@Produces("application/xml")
|
||||
public class VirtualMachineRestService {
|
||||
|
||||
@GET @Path("/vm/{vmid}")
|
||||
public VirtualMachineEntity get(@PathParam("vmid") String vmId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@PUT @Path("/vm/create")
|
||||
public VirtualMachineEntity create(
|
||||
@QueryParam("xid") String xid,
|
||||
@QueryParam("hostname") String hostname,
|
||||
@QueryParam("display-name") String displayName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@GET @Path("/vms")
|
||||
public List<VirtualMachineEntity> listAll() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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.List;
|
||||
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
|
||||
import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Component
|
||||
@Service("VolumeRestService")
|
||||
@Produces("application/json")
|
||||
public class VolumeRestService {
|
||||
|
||||
@PUT @Path("/vol/create")
|
||||
public VolumeEntity create(
|
||||
@QueryParam("xid") String xid,
|
||||
@QueryParam("display-name") String displayName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@POST @Path("/vol/{volid}/deploy")
|
||||
public String deploy(@PathParam("volid") String volumeId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@GET @Path("/vols")
|
||||
public List<VolumeEntity> listAll() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@POST @Path("/vol/{volid}/attach-to")
|
||||
public String attachTo(
|
||||
@PathParam("volid") String volumeId,
|
||||
@QueryParam("vmid") String vmId,
|
||||
@QueryParam("device-order") short device) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@DELETE @Path("/vol/{volid}")
|
||||
public String delete(@PathParam("volid") String volumeId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@POST @Path("/vol/{volid}/detach")
|
||||
public String detach(@QueryParam("volid") String volumeId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity;
|
||||
import org.apache.cloudstack.engine.service.api.ProvisioningService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Component
|
||||
@Service("zoneService")
|
||||
@Produces({"application/json"})
|
||||
public class ZoneRestService {
|
||||
@Inject
|
||||
ProvisioningService _provisioningService;
|
||||
|
||||
@GET @Path("/zones")
|
||||
public List<ZoneEntity> listAll() {
|
||||
return _provisioningService.listZones();
|
||||
}
|
||||
|
||||
@GET @Path("/zone/{zone-id}")
|
||||
public ZoneEntity get(@PathParam("zone-id") String zoneId) {
|
||||
return _provisioningService.getZone(zoneId);
|
||||
}
|
||||
|
||||
@POST @Path("/zone/{zone-id}/enable")
|
||||
public String enable(String zoneId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@POST @Path("/zone/{zone-id}/disable")
|
||||
public String disable(@PathParam("zone-id") String zoneId) {
|
||||
ZoneEntity zoneEntity = _provisioningService.getZone(zoneId);
|
||||
zoneEntity.disable();
|
||||
return null;
|
||||
}
|
||||
|
||||
@POST @Path("/zone/{zone-id}/deactivate")
|
||||
public String deactivate(@PathParam("zone-id") String zoneId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@POST @Path("/zone/{zone-id}/activate")
|
||||
public String reactivate(@PathParam("zone-id") String zoneId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@PUT @Path("/zone/create")
|
||||
public ZoneEntity createZone(@QueryParam("xid") String xid,
|
||||
@QueryParam("display-name") String displayName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@DELETE @Path("/zone/{zone-id}")
|
||||
public String deleteZone(@QueryParam("zone-id") String xid) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -24,7 +24,10 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@Service("zoneService")
|
||||
public class ZoneEntityImpl implements ZoneEntity {
|
||||
String _id;
|
||||
String _name;
|
||||
|
||||
@ -10,12 +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" />
|
||||
<context:component-scan base-package="org.apache.cloudstack.engine.rest.service" />
|
||||
|
||||
<jaxrs:server id="restContainer" address="/">
|
||||
<jaxrs:server id="EngineService" address="/">
|
||||
<jaxrs:serviceBeans>
|
||||
<ref bean="provisioningService" />
|
||||
<ref bean="zoneService" />
|
||||
<ref bean="ZoneRestService" />
|
||||
<ref bean="PodRestService" />
|
||||
<ref bean="ClusterRestService" />
|
||||
<ref bean="VirtualMachineRestService" />
|
||||
<ref bean="VolumeRestService" />
|
||||
</jaxrs:serviceBeans>
|
||||
<jaxrs:providers>
|
||||
<bean class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider" />
|
||||
|
||||
@ -36,7 +36,6 @@ import com.cloud.dc.PodVlanVO;
|
||||
import com.cloud.org.Grouping;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
@ -64,15 +63,16 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
||||
protected SearchBuilder<DataCenterVO> DisabledZonesSearch;
|
||||
protected SearchBuilder<DataCenterVO> TokenSearch;
|
||||
|
||||
@Inject protected final DataCenterIpAddressDaoImpl _ipAllocDao;
|
||||
@Inject protected final DataCenterLinkLocalIpAddressDaoImpl _LinkLocalIpAllocDao;
|
||||
@Inject protected final DataCenterVnetDaoImpl _vnetAllocDao;
|
||||
@Inject protected final PodVlanDaoImpl _podVlanAllocDao;
|
||||
@Inject protected DataCenterIpAddressDaoImpl _ipAllocDao = null;
|
||||
@Inject protected DataCenterLinkLocalIpAddressDaoImpl _LinkLocalIpAllocDao = null;
|
||||
@Inject protected DataCenterVnetDaoImpl _vnetAllocDao = null;
|
||||
@Inject protected PodVlanDaoImpl _podVlanAllocDao = null;
|
||||
@Inject protected DcDetailsDaoImpl _detailsDao = null;
|
||||
|
||||
protected long _prefix;
|
||||
protected Random _rand = new Random(System.currentTimeMillis());
|
||||
protected TableGenerator _tgMacAddress;
|
||||
|
||||
@Inject protected final DcDetailsDaoImpl _detailsDao;
|
||||
|
||||
@Override
|
||||
public DataCenterVO findByName(String name) {
|
||||
@ -234,6 +234,7 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
||||
return new Pair<String, Long>(vo.getIpAddress(), vo.getMacAddress());
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataCenterIpAddressVO allocatePrivateIpAddress(long dcId, String reservationId) {
|
||||
DataCenterIpAddressVO vo = _ipAllocDao.takeDataCenterIpAddress(dcId, reservationId);
|
||||
return vo;
|
||||
|
||||
@ -37,7 +37,6 @@ import javax.persistence.Transient;
|
||||
|
||||
import com.cloud.api.Identity;
|
||||
import com.cloud.network.dao.FirewallRulesCidrsDaoImpl;
|
||||
import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
@ -46,7 +45,7 @@ import com.cloud.utils.net.NetUtils;
|
||||
@Inheritance(strategy=InheritanceType.JOINED)
|
||||
@DiscriminatorColumn(name="purpose", discriminatorType=DiscriminatorType.STRING, length=32)
|
||||
public class FirewallRuleVO implements Identity, FirewallRule {
|
||||
@Inject protected final FirewallRulesCidrsDaoImpl _firewallRulesCidrsDao;
|
||||
@Inject protected final FirewallRulesCidrsDaoImpl _firewallRulesCidrsDao = null;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user