Skip to content
This repository was archived by the owner on Oct 6, 2023. It is now read-only.

Commit 3f67242

Browse files
Dahanne AnthonyDahanne Anthony
authored andcommitted
TAB-4485 : getting rid of the xml content type for configs, simplying a lot the config entities
svn path=/trunk/ehcache/; revision=9043
1 parent 63aa95a commit 3f67242

4 files changed

Lines changed: 0 additions & 98 deletions

File tree

management-ehcache-v1/src/main/java/net/sf/ehcache/management/resource/CacheConfigEntity.java

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,7 @@
22

33
package net.sf.ehcache.management.resource;
44

5-
import com.fasterxml.jackson.annotation.JsonIgnore;
6-
import com.fasterxml.jackson.annotation.JsonProperty;
75
import org.terracotta.management.resource.VersionedEntity;
8-
import org.w3c.dom.Element;
9-
import org.xml.sax.InputSource;
10-
import org.xml.sax.SAXException;
11-
12-
import java.io.IOException;
13-
import java.io.StringReader;
14-
15-
import javax.xml.bind.annotation.XmlAnyElement;
16-
import javax.xml.bind.annotation.XmlAttribute;
17-
import javax.xml.bind.annotation.XmlRootElement;
18-
import javax.xml.bind.annotation.XmlTransient;
19-
import javax.xml.parsers.DocumentBuilder;
20-
import javax.xml.parsers.DocumentBuilderFactory;
21-
import javax.xml.parsers.ParserConfigurationException;
226

237
/**
248
* <p>
@@ -28,17 +12,13 @@
2812
* @author brandony
2913
*
3014
*/
31-
@XmlRootElement(name = "configuration")
3215
public class CacheConfigEntity extends VersionedEntity {
3316
private String cacheName;
3417
private String cacheManagerName;
3518
private String agentId;
3619

37-
// include this only in JSON
38-
@JsonProperty
3920
private String xml;
4021

41-
@XmlAttribute
4222
public String getCacheManagerName() {
4323
return cacheManagerName;
4424
}
@@ -47,16 +27,6 @@ public void setCacheManagerName(String cacheManagerName) {
4727
this.cacheManagerName = cacheManagerName;
4828
}
4929

50-
// include this only in XML
51-
@XmlAnyElement
52-
@JsonIgnore
53-
public Element getParsedXml() throws ParserConfigurationException, IOException, SAXException {
54-
DocumentBuilderFactory domFact = DocumentBuilderFactory.newInstance();
55-
DocumentBuilder domBuilder = domFact.newDocumentBuilder();
56-
return domBuilder.parse(new InputSource(new StringReader(xml))).getDocumentElement();
57-
}
58-
59-
@XmlTransient
6030
public String getXml() {
6131
return xml;
6232
}
@@ -65,7 +35,6 @@ public void setXml(String xml) {
6535
this.xml = xml;
6636
}
6737

68-
@XmlAttribute
6938
public String getCacheName() {
7039
return cacheName;
7140
}
@@ -75,7 +44,6 @@ public void setCacheName(String cacheName) {
7544
}
7645

7746
@Override
78-
@XmlAttribute
7947
public String getAgentId() {
8048
return agentId;
8149
}

management-ehcache-v1/src/main/java/net/sf/ehcache/management/resource/CacheManagerConfigEntity.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,16 @@
11
package net.sf.ehcache.management.resource;
22

3-
import com.fasterxml.jackson.annotation.JsonIgnore;
4-
import com.fasterxml.jackson.annotation.JsonProperty;
53
import org.terracotta.management.resource.VersionedEntity;
6-
import org.w3c.dom.Element;
7-
import org.xml.sax.InputSource;
8-
import org.xml.sax.SAXException;
9-
10-
import java.io.IOException;
11-
import java.io.StringReader;
12-
13-
import javax.xml.bind.annotation.XmlAnyElement;
14-
import javax.xml.bind.annotation.XmlAttribute;
15-
import javax.xml.bind.annotation.XmlRootElement;
16-
import javax.xml.bind.annotation.XmlTransient;
17-
import javax.xml.parsers.DocumentBuilder;
18-
import javax.xml.parsers.DocumentBuilderFactory;
19-
import javax.xml.parsers.ParserConfigurationException;
204

215
/**
226
* @author brandony
237
*/
24-
@XmlRootElement(name = "configuration")
258
public class CacheManagerConfigEntity extends VersionedEntity {
269
private String cacheManagerName;
2710
private String agentId;
2811

29-
// include this only in JSON
30-
@JsonProperty
3112
private String xml;
3213

33-
@XmlAttribute
3414
public String getCacheManagerName() {
3515
return cacheManagerName;
3616
}
@@ -39,16 +19,6 @@ public void setCacheManagerName(String cacheManagerName) {
3919
this.cacheManagerName = cacheManagerName;
4020
}
4121

42-
// include this only in XML
43-
@XmlAnyElement
44-
@JsonIgnore
45-
public Element getParsedXml() throws ParserConfigurationException, IOException, SAXException {
46-
DocumentBuilderFactory domFact = DocumentBuilderFactory.newInstance();
47-
DocumentBuilder domBuilder = domFact.newDocumentBuilder();
48-
return domBuilder.parse(new InputSource(new StringReader(xml))).getDocumentElement();
49-
}
50-
51-
@XmlTransient
5222
public String getXml() {
5323
return xml;
5424
}
@@ -58,7 +28,6 @@ public void setXml(String xml) {
5828
}
5929

6030
@Override
61-
@XmlAttribute
6231
public String getAgentId() {
6332
return agentId;
6433
}

management-ehcache-v1/src/main/java/net/sf/ehcache/management/resource/services/CacheConfigsResourceServiceImpl.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import java.util.HashSet;
1616
import java.util.Set;
1717

18-
import javax.ws.rs.Consumes;
1918
import javax.ws.rs.GET;
2019
import javax.ws.rs.Path;
2120
import javax.ws.rs.Produces;
@@ -70,22 +69,4 @@ public Collection<CacheConfigEntity> getCacheConfigs(@Context UriInfo info) {
7069
throw new ResourceRuntimeException("Failed to get cache configs", see, Response.Status.BAD_REQUEST.getStatusCode());
7170
}
7271
}
73-
74-
/**
75-
* Get a {@code Collection} of {@link net.sf.ehcache.management.resource.CacheConfigEntity} objects representing the
76-
* cache manager configuration information provided by the associated monitorable entity's agent given the request
77-
* path.
78-
*
79-
*
80-
* @param {@link UriInfo} for this resource request
81-
* @return a collection of CacheConfigEntity objects. {@link net.sf.ehcache.management.resource.CacheConfigEntity}
82-
* objects
83-
*/
84-
@Deprecated
85-
@GET
86-
@Consumes(MediaType.APPLICATION_XML)
87-
@Produces(MediaType.APPLICATION_XML)
88-
public Collection<CacheConfigEntity> getXMLCacheConfigs(@Context UriInfo info) {
89-
return getCacheConfigs(info);
90-
}
9172
}

management-ehcache-v1/src/main/java/net/sf/ehcache/management/resource/services/CacheManagerConfigsResourceServiceImpl.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import java.util.HashSet;
1616
import java.util.Set;
1717

18-
import javax.ws.rs.Consumes;
1918
import javax.ws.rs.GET;
2019
import javax.ws.rs.Path;
2120
import javax.ws.rs.Produces;
@@ -67,19 +66,4 @@ public Collection<CacheManagerConfigEntity> getCacheManagerConfigs(@Context UriI
6766
}
6867
}
6968

70-
/**
71-
* Get a {@code Collection} of {@link CacheManagerConfigEntity} objects representing the cache manager configuration
72-
* information provided by the associated monitorable entity's agent given the request path.
73-
*
74-
*
75-
* @param {@link UriInfo} for this resource request
76-
* @return a collection of {@link CacheManagerConfigEntity} objects
77-
*/
78-
@Deprecated
79-
@GET
80-
@Consumes(MediaType.APPLICATION_XML)
81-
@Produces(MediaType.APPLICATION_XML)
82-
public Collection<CacheManagerConfigEntity> getXMLCacheManagerConfigs(@Context UriInfo info) {
83-
return getCacheManagerConfigs(info);
84-
}
8569
}

0 commit comments

Comments
 (0)