You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2012/12/29 01:26:34 UTC
[1/2] git commit: Getting things to compile
Getting things to compile
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/54cce5fa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/54cce5fa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/54cce5fa
Branch: refs/heads/javelin
Commit: 54cce5fa18485bb50fe66e3163d48ead022b5645
Parents: 259e6d5
Author: Alex Huang <al...@citrix.com>
Authored: Thu Dec 13 15:10:27 2012 -0800
Committer: Alex Huang <al...@citrix.com>
Committed: Fri Dec 28 16:07:56 2012 -0800
----------------------------------------------------------------------
engine/api/pom.xml | 6 +-
.../engine/datacenter/entity/api/ZoneEntity.java | 4 +
.../rest/service/api/ProvisioningRestService.java | 2 -
.../engine/service/api/ProvisioningService.java | 10 ++
.../service/api/ProvisioningServiceImpl.java | 62 +++++-----
engine/pom.xml | 1 -
engine/service/src/main/webapp/WEB-INF/beans.xml | 2 +-
.../DefaultPrimaryDatastoreProviderImpl.java | 5 +
framework/rest/pom.xml | 11 ++
.../jackson/CSJacksonAnnotationIntrospector.java | 60 +++++++++
.../ws/jackson/CSJacksonAnnotationModule.java | 47 +++++++
.../framework/ws/jackson/UriSerializer.java | 58 ++++++++
.../framework/ws/jackson/UrisSerializer.java | 71 ++++++++++
.../cloudstack/framework/ws/jackson/Url.java | 53 ++++++++
.../ws/jackson/CSJacksonAnnotationTest.java | 101 +++++++++++++++
.../SolidfirePrimaryDataStoreProvider.java | 7 +-
16 files changed, 462 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/54cce5fa/engine/api/pom.xml
----------------------------------------------------------------------
diff --git a/engine/api/pom.xml b/engine/api/pom.xml
index 2abb1ab..63071b3 100644
--- a/engine/api/pom.xml
+++ b/engine/api/pom.xml
@@ -37,9 +37,9 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-jaxrs</artifactId>
- <version>1.9.9</version>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-framework-rest</artifactId>
+ <version>${project.version}</version>
</dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/54cce5fa/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 92124c2..2b683e2 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
@@ -24,6 +24,9 @@ import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.xml.bind.annotation.XmlRootElement;
+import org.apache.cloudstack.engine.service.api.ProvisioningService;
+import org.apache.cloudstack.framework.ws.jackson.Url;
+
import com.cloud.dc.DataCenter;
/**
@@ -35,5 +38,6 @@ public interface ZoneEntity extends DataCenterResourceEntity, DataCenter {
@Path("/pods")
List<PodEntity> listPods();
+ @Url(clazz=ProvisioningService.class, method="getPod", name="id", type=List.class)
List<String> listPodIds();
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/54cce5fa/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
index 6355b30..fe2aa5b 100644
--- 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
@@ -36,10 +36,8 @@ 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
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/54cce5fa/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 c2696bf..fc1d8dc 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,6 +21,10 @@ package org.apache.cloudstack.engine.service.api;
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;
@@ -35,6 +39,8 @@ import com.cloud.storage.StoragePool;
* ProvisioningService registers and deregisters physical and virtual
* resources that the management server can use.
*/
+@Path("/provisioning")
+@Produces({"application/json"})
public interface ProvisioningService {
StorageEntity registerStorage(String name, List<String> tags, Map<String, String> details);
@@ -61,11 +67,15 @@ public interface ProvisioningService {
List<Host> listHosts();
+ @GET
+ @Path("/zone/{zoneid}/pods")
List<PodEntity> listPods();
List<ZoneEntity> listZones();
List<StoragePool> listStorage();
+ @GET
+ @Path("/{zoneid}")
ZoneEntity getZone(String id);
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/54cce5fa/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 8b62d48..f9a4ddf 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
@@ -29,45 +29,17 @@ 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.ZoneEntityImpl;
import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
import com.cloud.host.Host;
import com.cloud.host.Status;
import com.cloud.storage.StoragePool;
@Component
+@Service("provisioningService")
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
@@ -137,4 +109,34 @@ public class ProvisioningServiceImpl implements ProvisioningService {
return impl;
}
+ @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;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/54cce5fa/engine/pom.xml
----------------------------------------------------------------------
diff --git a/engine/pom.xml b/engine/pom.xml
index 1a8a0b8..e1681f1 100644
--- a/engine/pom.xml
+++ b/engine/pom.xml
@@ -42,7 +42,6 @@
<module>storage/imagemotion</module>
<module>storage/backup</module>
<module>storage/snapshot</module>
- <module>storage/integration-test</module>
<module>components-api</module>
<module>schema</module>
<module>network</module>
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/54cce5fa/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 55aaa57..c7151ee 100755
--- a/engine/service/src/main/webapp/WEB-INF/beans.xml
+++ b/engine/service/src/main/webapp/WEB-INF/beans.xml
@@ -18,7 +18,7 @@
<ref bean="zoneService" />
</jaxrs:serviceBeans>
<jaxrs:providers>
- <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />
+ <bean class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider" />
</jaxrs:providers>
</jaxrs:server>
</beans>
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/54cce5fa/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
index f89ba80..dae0832 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java
@@ -51,6 +51,11 @@ public class DefaultPrimaryDatastoreProviderImpl implements PrimaryDataStoreProv
configuratorMaps.put(key, configurator);
}
}
+
+ // TODO: Remove this. I put this in to get over the compilation problem. Edison needs to look at Solidfire's implementation which requires this.
+ public DefaultPrimaryDatastoreProviderImpl() {
+
+ }
protected String generateKey(HypervisorType hypervisor, String poolType) {
return hypervisor.toString().toLowerCase() + "_" + poolType.toString().toLowerCase();
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/54cce5fa/framework/rest/pom.xml
----------------------------------------------------------------------
diff --git a/framework/rest/pom.xml b/framework/rest/pom.xml
index dc2a580..e9009bf 100644
--- a/framework/rest/pom.xml
+++ b/framework/rest/pom.xml
@@ -40,5 +40,16 @@
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.1.1</version>
</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>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/54cce5fa/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationIntrospector.java
----------------------------------------------------------------------
diff --git a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationIntrospector.java b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationIntrospector.java
new file mode 100644
index 0000000..998bfa0
--- /dev/null
+++ b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationIntrospector.java
@@ -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.framework.ws.jackson;
+
+import java.lang.reflect.AnnotatedElement;
+import java.util.List;
+
+import com.fasterxml.jackson.core.Version;
+import com.fasterxml.jackson.databind.introspect.Annotated;
+import com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector;
+
+
+/**
+ * Adds introspectors for the annotations added specifically for CloudStack
+ * Web Services.
+ *
+ */
+public class CSJacksonAnnotationIntrospector extends NopAnnotationIntrospector {
+
+ private static final long serialVersionUID = 5532727887216652602L;
+
+ @Override
+ public Version version() {
+ return new Version(1, 7, 0, "abc", "org.apache.cloudstack", "cloudstack-framework-rest");
+ }
+
+ @Override
+ public Object findSerializer(Annotated a) {
+ AnnotatedElement ae = a.getAnnotated();
+ Url an = ae.getAnnotation(Url.class);
+ if (an == null) {
+ return null;
+ }
+
+ if (an.type() == String.class) {
+ return new UriSerializer(an);
+ } else if (an.type() == List.class){
+ return new UrisSerializer(an);
+ }
+
+ throw new UnsupportedOperationException("Unsupported type " + an.type());
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/54cce5fa/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationModule.java
----------------------------------------------------------------------
diff --git a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationModule.java b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationModule.java
new file mode 100644
index 0000000..55debd9
--- /dev/null
+++ b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationModule.java
@@ -0,0 +1,47 @@
+/*
+ * 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.framework.ws.jackson;
+
+
+import com.fasterxml.jackson.core.Version;
+import com.fasterxml.jackson.databind.Module;
+
+
+/**
+ * This module extends SimpleModle so that our annotations can be processed.
+ *
+ */
+public class CSJacksonAnnotationModule extends Module {
+
+ @Override
+ public String getModuleName() {
+ return "CloudStackSupplementalModule";
+ }
+
+ @Override
+ public void setupModule(SetupContext ctx) {
+ ctx.appendAnnotationIntrospector(new CSJacksonAnnotationIntrospector());
+ }
+
+ @Override
+ public Version version() {
+ return new Version(1, 0, 0, "", "org.apache.cloudstack", "cloudstack-framework-rest");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/54cce5fa/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UriSerializer.java
----------------------------------------------------------------------
diff --git a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UriSerializer.java b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UriSerializer.java
new file mode 100644
index 0000000..074d60f
--- /dev/null
+++ b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UriSerializer.java
@@ -0,0 +1,58 @@
+/*
+ * 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.framework.ws.jackson;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.UriBuilder;
+
+import org.apache.cxf.jaxrs.impl.tl.ThreadLocalUriInfo;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+
+public class UriSerializer extends JsonSerializer<String> {
+
+ Url _annotation;
+
+ public UriSerializer(Url annotation) {
+ _annotation = annotation;
+ }
+
+ protected UriSerializer() {
+ }
+
+ @Override
+ public void serialize(String id, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
+ jgen.writeStartObject();
+ jgen.writeStringField("id", id);
+ jgen.writeFieldName("uri");
+ jgen.writeString(buildUri(_annotation.clazz(), _annotation.method(), id));
+ jgen.writeEndObject();
+ }
+
+ protected String buildUri(Class<?> clazz, String method, String id) {
+ ThreadLocalUriInfo uriInfo = new ThreadLocalUriInfo();
+ UriBuilder ub = uriInfo.getAbsolutePathBuilder().path(clazz, method);
+ ub.build(id);
+ return ub.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/54cce5fa/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UrisSerializer.java
----------------------------------------------------------------------
diff --git a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UrisSerializer.java b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UrisSerializer.java
new file mode 100644
index 0000000..8b62212
--- /dev/null
+++ b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UrisSerializer.java
@@ -0,0 +1,71 @@
+/*
+ * 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.framework.ws.jackson;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.ws.rs.core.UriBuilder;
+
+import org.apache.cxf.jaxrs.impl.tl.ThreadLocalUriInfo;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+
+
+/**
+ * Serializer for a list of ids.
+ *
+ */
+public class UrisSerializer extends JsonSerializer<List<? extends Object>> {
+ Url _annotation;
+
+ public UrisSerializer(Url annotation) {
+ _annotation = annotation;
+ }
+
+ protected UrisSerializer() {
+ }
+
+ @Override
+ public void serialize(List<? extends Object> lst, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
+ Iterator<? extends Object> it = lst.iterator();
+ jgen.writeStartObject();
+ while (it.hasNext()) {
+ Object id = it.next();
+ jgen.writeStartObject();
+ jgen.writeFieldName("id");
+ jgen.writeObject(id);
+ jgen.writeFieldName("uri");
+ jgen.writeString(buildUri(_annotation.clazz(), _annotation.method(), id));
+ jgen.writeEndObject();
+ }
+ jgen.writeEndObject();
+ }
+
+ protected String buildUri(Class<?> clazz, String method, Object id) {
+ ThreadLocalUriInfo uriInfo = new ThreadLocalUriInfo();
+ UriBuilder ub = uriInfo.getAbsolutePathBuilder().path(clazz, method);
+ ub.build(id);
+ return ub.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/54cce5fa/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/Url.java
----------------------------------------------------------------------
diff --git a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/Url.java b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/Url.java
new file mode 100644
index 0000000..7094fb0
--- /dev/null
+++ b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/Url.java
@@ -0,0 +1,53 @@
+/*
+ * 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.framework.ws.jackson;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Url can be placed onto a method to construct an URL from the returned
+ * results.
+ *
+ * This annotation is supplemental to JAX-RS 2.0's annotations. JAX-RS 2.0
+ * annotations do not include a way to construct an URL. Of
+ * course, this only works with how CloudStack works.
+ *
+ */
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+public @interface Url {
+ /**
+ * @return the class that the path should belong to.
+ */
+ Class<?> clazz() default Object.class;
+
+ /**
+ * @return the name of the method that the path should call back to.
+ */
+ String method();
+
+ String name() default "";
+
+ Class<?> type() default String.class;
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/54cce5fa/framework/rest/test/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationTest.java
----------------------------------------------------------------------
diff --git a/framework/rest/test/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationTest.java b/framework/rest/test/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationTest.java
new file mode 100644
index 0000000..52b2d7f
--- /dev/null
+++ b/framework/rest/test/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationTest.java
@@ -0,0 +1,101 @@
+package org.apache.cloudstack.framework.ws.jackson;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
+import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule.Priority;
+
+public class CSJacksonAnnotationTest {
+
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ @Test
+ public void test() {
+ ObjectMapper mapper = new ObjectMapper();
+ JaxbAnnotationModule jaxbModule = new JaxbAnnotationModule();
+ jaxbModule.setPriority(Priority.SECONDARY);
+ mapper.registerModule(jaxbModule);
+ mapper.registerModule(new CSJacksonAnnotationModule());
+
+ StringWriter writer = new StringWriter();
+
+ TestVO vo = new TestVO(1000, "name");
+ vo.names = new ArrayList<String>();
+ vo.names.add("name1");
+ vo.names.add("name2");
+ vo.values = new HashMap<String, Long>();
+ vo.values.put("key1", 1000l);
+ vo.values.put("key2", 2000l);
+ vo.vo2.name = "testvoname2";
+ vo.pods="abcde";
+
+ try {
+ mapper.writeValue(writer, vo);
+ } catch (JsonGenerationException e) {
+ e.printStackTrace();
+ } catch (JsonMappingException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ System.out.print(writer.getBuffer().toString());
+
+ }
+
+ @XmlRootElement(name="xml-test2")
+ public class Test2VO {
+ public String name;
+ }
+
+ @XmlRootElement(name="abc")
+ public class TestVO {
+ public int id;
+
+ public Map<String, Long> values;
+
+ public String name;
+
+
+ public List<String> names;
+
+ public String pods;
+
+
+ @XmlElement(name="test2")
+ public Test2VO vo2 = new Test2VO();
+
+ public TestVO(int id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ @Url(clazz=TestVO.class, method="getName")
+ public String getName() {
+ return name;
+ }
+
+ @Url(clazz=TestVO.class, method="getNames", type=List.class)
+ public List<String> getNames() {
+ return names;
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/54cce5fa/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java
index 672a726..b6c92a3 100644
--- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java
+++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java
@@ -38,9 +38,14 @@ public class SolidfirePrimaryDataStoreProvider extends
DefaultPrimaryDataStore pds = DefaultPrimaryDataStore.createDataStore(dsv);
SolidfirePrimaryDataStoreDriver driver = new SolidfirePrimaryDataStoreDriver();
pds.setDriver(driver);
+<<<<<<< HEAD
DefaultPrimaryDataStoreLifeCycleImpl lifeCycle = new DefaultPrimaryDataStoreLifeCycleImpl(dataStoreDao);
+=======
+
+ DefaultPrimaryDataStoreLifeCycleImpl lifeCycle = new DefaultPrimaryDataStoreLifeCycleImpl(super.dataStoreDao, pds);
+>>>>>>> Getting things to compile
pds.setLifeCycle(lifeCycle);
return pds;
- }
+ }
}