added json annotation for jersey
added javax.json at compile git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/dataminer-invocation-model@174731 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
9f00c0ad69
commit
31ebf86917
15
pom.xml
15
pom.xml
|
@ -41,9 +41,17 @@
|
|||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>gcube-bom</artifactId>
|
||||
<version>LATEST</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
||||
<properties>
|
||||
<distroDirectory>${project.basedir}/distro</distroDirectory>
|
||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||
|
@ -75,7 +83,7 @@
|
|||
<groupId>org.glassfish</groupId>
|
||||
<artifactId>javax.json</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<scope>provided</scope>
|
||||
<!-- <scope>provided</scope> -->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -84,6 +92,11 @@
|
|||
<version>2.7.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
|
|
@ -17,6 +17,8 @@ import lombok.NoArgsConstructor;
|
|||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
/**
|
||||
* The Class DataMinerInputParams.
|
||||
|
@ -26,6 +28,7 @@ import lombok.ToString;
|
|||
*/
|
||||
@XmlRootElement(name = "dataminer-inputparams")
|
||||
@XmlAccessorType (XmlAccessType.FIELD)
|
||||
//@JsonIgnoreProperties(ignoreUnknown=true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
|
@ -39,6 +42,7 @@ public class DataMinerInputParams implements Serializable{
|
|||
private static final long serialVersionUID = -7241629940190729604L;
|
||||
|
||||
@XmlElement(name = "param", required=true, nillable=false)
|
||||
@JsonProperty(value="param", required=true)
|
||||
private List<DataMinerParam> listParam;
|
||||
|
||||
|
||||
|
|
|
@ -18,6 +18,10 @@ import lombok.ToString;
|
|||
|
||||
import org.gcube.data.analysis.dminvocation.ActionType;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||
|
||||
/**
|
||||
* The Class DataMinerInvocation.
|
||||
*
|
||||
|
@ -25,7 +29,9 @@ import org.gcube.data.analysis.dminvocation.ActionType;
|
|||
* Dec 4, 2018
|
||||
*/
|
||||
@XmlRootElement(name = "dataminer-invocation")
|
||||
@JsonRootName(value = "dataminer-invocation")
|
||||
@XmlAccessorType (XmlAccessType.FIELD)
|
||||
@JsonIgnoreProperties(ignoreUnknown=true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
|
@ -40,12 +46,15 @@ public class DataMinerInvocation implements Serializable{
|
|||
|
||||
|
||||
@XmlElement(name = "operator-id", required=true, nillable=false)
|
||||
@JsonProperty(value="operator-id", required=true)
|
||||
private String operatorId;
|
||||
|
||||
@XmlElement(name = "action", required=true, nillable=false)
|
||||
@JsonProperty(value="action", required=true)
|
||||
private ActionType actionType = ActionType.RUN;
|
||||
|
||||
@XmlElement(name = "parameters", required=false, nillable=true)
|
||||
@JsonProperty(required=false)
|
||||
private DataMinerParameters parameters;
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@ import lombok.NoArgsConstructor;
|
|||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
/**
|
||||
* The Class DataMinerOutputParams.
|
||||
|
@ -26,6 +28,7 @@ import lombok.ToString;
|
|||
*/
|
||||
@XmlRootElement(name = "dataminer-outputparams")
|
||||
@XmlAccessorType (XmlAccessType.FIELD)
|
||||
//@JsonIgnoreProperties(ignoreUnknown=true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
|
@ -39,6 +42,7 @@ public class DataMinerOutputParams implements Serializable{
|
|||
private static final long serialVersionUID = -683773454747370184L;
|
||||
|
||||
@XmlElement(name = "param")
|
||||
@JsonProperty(value="param", required=true)
|
||||
private List<DataMinerParam> params;
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,9 @@ import lombok.NoArgsConstructor;
|
|||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -26,6 +29,7 @@ import lombok.ToString;
|
|||
*/
|
||||
@XmlRootElement(name = "dataminer-parameters")
|
||||
@XmlAccessorType (XmlAccessType.FIELD)
|
||||
@JsonIgnoreProperties(ignoreUnknown=true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
|
@ -38,8 +42,10 @@ public class DataMinerParameters implements Serializable{
|
|||
*/
|
||||
private static final long serialVersionUID = 8298755690515099551L;
|
||||
@XmlElement(name = "input", required=true, nillable=false)
|
||||
@JsonProperty(required=true)
|
||||
private DataMinerInputParams input;
|
||||
@XmlElement(name = "output", required=false, nillable=true)
|
||||
@JsonProperty(required=false)
|
||||
private DataMinerOutputParams output;
|
||||
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public class DataMinerInvocationTest {
|
|||
System.out.println(new String(outStreamXML.toByteArray()));
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
public void unmarshallingXMLTest() throws JAXBException, IOException, SAXException{
|
||||
System.out.println(DataMinerInvocationTest.class.getMethods()[1].getName()+" called");
|
||||
FileInputStream dmInvocationXMLFile = new FileInputStream(new File("./src/test/resources/DataMinerInvocation.xml"));
|
||||
|
@ -90,8 +90,8 @@ public class DataMinerInvocationTest {
|
|||
DataMinerInvocation dmInvocation = dmMng.unmarshaling(dmInvocationJSONFile, MediaType.ApplicationJSON, true);
|
||||
System.out.println(dmInvocation);
|
||||
|
||||
ByteArrayOutputStream outStreamXML = dmMng.marshaling(dmInvocation, MediaType.ApplicationXML, true);
|
||||
System.out.println(new String(outStreamXML.toByteArray()));
|
||||
// ByteArrayOutputStream outStreamXML = dmMng.marshaling(dmInvocation, MediaType.ApplicationXML, true);
|
||||
// System.out.println(new String(outStreamXML.toByteArray()));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -15,4 +15,4 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue