incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [3/4] git commit: links are working
Date Fri, 07 Dec 2012 23:21:42 GMT
links are working


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/35914d6f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/35914d6f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/35914d6f

Branch: refs/heads/javelin
Commit: 35914d6f6a66d90a44ad8e3bfb5d577bbb71f409
Parents: 862dff7
Author: Alex Huang <alex.huang@citrix.com>
Authored: Mon Nov 26 15:59:58 2012 -0800
Committer: Alex Huang <alex.huang@citrix.com>
Committed: Fri Dec 7 15:21:20 2012 -0800

----------------------------------------------------------------------
 engine/api/pom.xml                                 |   37 ++--
 .../entity/api/DataCenterResourceEntity.java       |    7 +
 .../engine/datacenter/entity/api/ZoneEntity.java   |    6 +-
 .../rest/datacenter/entity/api/PodRestTO.java      |   35 +++
 .../rest/datacenter/entity/api/ZoneRestTO.java     |   63 +++++
 .../rest/datacenter/entity/api/ZoneRestTOs.java    |   23 ++
 .../rest/service/api/ProvisioningRestService.java  |   84 ++++++
 .../engine/service/api/ProvisioningService.java    |   30 +--
 .../datacenter/entity/api/PodEntityImpl.java       |  197 +++++++++++++++
 .../datacenter/entity/api/ZoneEntityImpl.java      |   40 ++--
 .../service/api/ProvisioningServiceImpl.java       |   30 ++-
 engine/service/src/main/webapp/WEB-INF/beans.xml   |    8 +-
 engine/service/src/main/webapp/WEB-INF/web.xml     |    6 +-
 13 files changed, 482 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/35914d6f/engine/api/pom.xml
----------------------------------------------------------------------
diff --git a/engine/api/pom.xml b/engine/api/pom.xml
index 45153d8..2abb1ab 100644
--- a/engine/api/pom.xml
+++ b/engine/api/pom.xml
@@ -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>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/35914d6f/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/DataCenterResourceEntity.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/DataCenterResourceEntity.java
b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/DataCenterResourceEntity.java
index 1a331e3..eccccd6 100755
--- a/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/DataCenterResourceEntity.java
+++ b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/DataCenterResourceEntity.java
@@ -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();
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/35914d6f/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/ZoneEntity.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/ZoneEntity.java
b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/ZoneEntity.java
index 577323c..92124c2 100755
--- a/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/ZoneEntity.java
+++ b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/ZoneEntity.java
@@ -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();
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/35914d6f/engine/api/src/org/apache/cloudstack/engine/rest/datacenter/entity/api/PodRestTO.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/rest/datacenter/entity/api/PodRestTO.java
b/engine/api/src/org/apache/cloudstack/engine/rest/datacenter/entity/api/PodRestTO.java
new file mode 100644
index 0000000..f831150
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/engine/rest/datacenter/entity/api/PodRestTO.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.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() {
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/35914d6f/engine/api/src/org/apache/cloudstack/engine/rest/datacenter/entity/api/ZoneRestTO.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/rest/datacenter/entity/api/ZoneRestTO.java
b/engine/api/src/org/apache/cloudstack/engine/rest/datacenter/entity/api/ZoneRestTO.java
new file mode 100644
index 0000000..857538e
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/engine/rest/datacenter/entity/api/ZoneRestTO.java
@@ -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;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/35914d6f/engine/api/src/org/apache/cloudstack/engine/rest/datacenter/entity/api/ZoneRestTOs.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/rest/datacenter/entity/api/ZoneRestTOs.java
b/engine/api/src/org/apache/cloudstack/engine/rest/datacenter/entity/api/ZoneRestTOs.java
new file mode 100644
index 0000000..a76490d
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/engine/rest/datacenter/entity/api/ZoneRestTOs.java
@@ -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 {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/35914d6f/engine/api/src/org/apache/cloudstack/engine/rest/service/api/ProvisioningRestService.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/rest/service/api/ProvisioningRestService.java
b/engine/api/src/org/apache/cloudstack/engine/rest/service/api/ProvisioningRestService.java
new file mode 100644
index 0000000..c3bf9b1
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/engine/rest/service/api/ProvisioningRestService.java
@@ -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;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/35914d6f/engine/api/src/org/apache/cloudstack/engine/service/api/ProvisioningService.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/service/api/ProvisioningService.java
b/engine/api/src/org/apache/cloudstack/engine/service/api/ProvisioningService.java
index a8cd5d2..c2696bf 100755
--- a/engine/api/src/org/apache/cloudstack/engine/service/api/ProvisioningService.java
+++ b/engine/api/src/org/apache/cloudstack/engine/service/api/ProvisioningService.java
@@ -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);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/35914d6f/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/PodEntityImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/PodEntityImpl.java
b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/PodEntityImpl.java
new file mode 100755
index 0000000..978bbcb
--- /dev/null
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/PodEntityImpl.java
@@ -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;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/35914d6f/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/ZoneEntityImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/ZoneEntityImpl.java
b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/ZoneEntityImpl.java
index cd62155..71c1f25 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/ZoneEntityImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/ZoneEntityImpl.java
@@ -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;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/35914d6f/engine/orchestration/src/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java
b/engine/orchestration/src/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java
index d3c0e11..8b62d48 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java
@@ -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;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/35914d6f/engine/service/src/main/webapp/WEB-INF/beans.xml
----------------------------------------------------------------------
diff --git a/engine/service/src/main/webapp/WEB-INF/beans.xml b/engine/service/src/main/webapp/WEB-INF/beans.xml
index 6f6cf3b..55aaa57 100755
--- a/engine/service/src/main/webapp/WEB-INF/beans.xml
+++ b/engine/service/src/main/webapp/WEB-INF/beans.xml
@@ -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>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/35914d6f/engine/service/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/engine/service/src/main/webapp/WEB-INF/web.xml b/engine/service/src/main/webapp/WEB-INF/web.xml
index 7a3f152..71c1ef3 100644
--- a/engine/service/src/main/webapp/WEB-INF/web.xml
+++ b/engine/service/src/main/webapp/WEB-INF/web.xml
@@ -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>


Mime
View raw message