Revision 43856
Added by Claudio Atzori about 8 years ago
modules/dnet-actionmanager-api/tags/dnet-actionmanager-api-4.0.0/deploy.info | ||
---|---|---|
1 |
{"type_source": "SVN", "goal": "package -U -T 4C source:jar", "url": "http://svn-public.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-actionmanager-api/trunk/", "deploy_repository": "dnet4-snapshots", "version": "4", "mail": "sandro.labruzzo@isti.cnr.it,michele.artini@isti.cnr.it, claudio.atzori@isti.cnr.it, alessia.bardi@isti.cnr.it", "deploy_repository_url": "http://maven.research-infrastructures.eu/nexus/content/repositories/dnet4-snapshots", "name": "dnet-actionmanager-api"} |
modules/dnet-actionmanager-api/tags/dnet-actionmanager-api-4.0.0/src/main/java/eu/dnetlib/actionmanager/rmi/ActionManagerException.java | ||
---|---|---|
1 |
package eu.dnetlib.actionmanager.rmi; |
|
2 |
|
|
3 |
import eu.dnetlib.common.rmi.RMIException; |
|
4 |
|
|
5 |
public class ActionManagerException extends RMIException { |
|
6 |
|
|
7 |
/** |
|
8 |
* |
|
9 |
*/ |
|
10 |
private static final long serialVersionUID = 9156582199919910574L; |
|
11 |
|
|
12 |
public ActionManagerException(String s) { |
|
13 |
super(s); |
|
14 |
} |
|
15 |
|
|
16 |
public ActionManagerException(String s, Throwable exception) { |
|
17 |
super(s, exception); |
|
18 |
} |
|
19 |
|
|
20 |
public ActionManagerException(Throwable exception) { |
|
21 |
super(exception); |
|
22 |
} |
|
23 |
|
|
24 |
} |
modules/dnet-actionmanager-api/tags/dnet-actionmanager-api-4.0.0/src/main/java/eu/dnetlib/actionmanager/rmi/ActionManagerService.java | ||
---|---|---|
1 |
package eu.dnetlib.actionmanager.rmi; |
|
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
import javax.jws.WebParam; |
|
6 |
import javax.jws.WebService; |
|
7 |
|
|
8 |
import eu.dnetlib.actionmanager.common.Agent; |
|
9 |
import eu.dnetlib.actionmanager.common.Operation; |
|
10 |
import eu.dnetlib.actionmanager.common.Provenance; |
|
11 |
import eu.dnetlib.actionmanager.set.ActionManagerSet; |
|
12 |
import eu.dnetlib.common.rmi.BaseService; |
|
13 |
|
|
14 |
@WebService(targetNamespace = "http://services.dnetlib.eu/") |
|
15 |
public interface ActionManagerService extends BaseService { |
|
16 |
|
|
17 |
String createSet(@WebParam(name = "set") ActionManagerSet set) throws ActionManagerException; |
|
18 |
|
|
19 |
boolean deleteSet(@WebParam(name = "setId") String setId) throws ActionManagerException; |
|
20 |
|
|
21 |
List<ActionManagerSet> ListSets() throws ActionManagerException; |
|
22 |
|
|
23 |
} |
modules/dnet-actionmanager-api/tags/dnet-actionmanager-api-4.0.0/src/main/java/eu/dnetlib/actionmanager/common/Operation.java | ||
---|---|---|
1 |
package eu.dnetlib.actionmanager.common; |
|
2 |
|
|
3 |
public enum Operation { |
|
4 |
INSERT, UPDATE |
|
5 |
} |
modules/dnet-actionmanager-api/tags/dnet-actionmanager-api-4.0.0/src/main/java/eu/dnetlib/actionmanager/common/Provenance.java | ||
---|---|---|
1 |
package eu.dnetlib.actionmanager.common; |
|
2 |
|
|
3 |
public enum Provenance { |
|
4 |
sysimport_crosswalk_repository, |
|
5 |
sysimport_crosswalk_aggregator, |
|
6 |
sysimport_crosswalk_entityregistry, |
|
7 |
sysimport_crosswalk_datasetarchive, |
|
8 |
sysimport_crosswalk_cris, |
|
9 |
sysimport_mining_repository, |
|
10 |
sysimport_mining_aggregator, |
|
11 |
sysimport_mining_entityregistry, |
|
12 |
sysimport_mining_datasetarchive, |
|
13 |
sysimport_mining_cris, |
|
14 |
|
|
15 |
user_claim_pid, |
|
16 |
user_claim_search, |
|
17 |
user_insert; |
|
18 |
|
|
19 |
/** |
|
20 |
* Use this instead of original valueOf if term contain ":". |
|
21 |
* |
|
22 |
* @param s |
|
23 |
* @return |
|
24 |
*/ |
|
25 |
public static Provenance convert(String s) { |
|
26 |
return Provenance.valueOf(s.replaceAll(":", "_")); |
|
27 |
} |
|
28 |
|
|
29 |
@Override |
|
30 |
public String toString() { |
|
31 |
return super.toString().replaceAll("_", ":"); |
|
32 |
} |
|
33 |
} |
modules/dnet-actionmanager-api/tags/dnet-actionmanager-api-4.0.0/src/main/java/eu/dnetlib/actionmanager/common/Agent.java | ||
---|---|---|
1 |
package eu.dnetlib.actionmanager.common; |
|
2 |
|
|
3 |
import java.io.Serializable; |
|
4 |
|
|
5 |
import javax.xml.bind.annotation.XmlRootElement; |
|
6 |
|
|
7 |
@XmlRootElement |
|
8 |
public class Agent implements Serializable { |
|
9 |
|
|
10 |
/** |
|
11 |
* |
|
12 |
*/ |
|
13 |
private static final long serialVersionUID = 1307812329829682737L; |
|
14 |
|
|
15 |
public enum AGENT_TYPE { |
|
16 |
human, service, algo |
|
17 |
} |
|
18 |
|
|
19 |
private String id; |
|
20 |
private String name; |
|
21 |
private AGENT_TYPE type; |
|
22 |
|
|
23 |
public Agent() { |
|
24 |
super(); |
|
25 |
} |
|
26 |
|
|
27 |
public Agent(String id, String name, AGENT_TYPE type) { |
|
28 |
super(); |
|
29 |
this.id = id; |
|
30 |
this.name = name; |
|
31 |
this.type = type; |
|
32 |
} |
|
33 |
|
|
34 |
public String getId() { |
|
35 |
return id; |
|
36 |
} |
|
37 |
|
|
38 |
public void setId(String id) { |
|
39 |
this.id = id; |
|
40 |
} |
|
41 |
|
|
42 |
public String getName() { |
|
43 |
return name; |
|
44 |
} |
|
45 |
|
|
46 |
public void setName(String name) { |
|
47 |
this.name = name; |
|
48 |
} |
|
49 |
|
|
50 |
public AGENT_TYPE getType() { |
|
51 |
return type; |
|
52 |
} |
|
53 |
|
|
54 |
public void setType(AGENT_TYPE type) { |
|
55 |
this.type = type; |
|
56 |
} |
|
57 |
|
|
58 |
} |
modules/dnet-actionmanager-api/tags/dnet-actionmanager-api-4.0.0/src/main/java/eu/dnetlib/actionmanager/set/ActionManagerSet.java | ||
---|---|---|
1 |
package eu.dnetlib.actionmanager.set; |
|
2 |
|
|
3 |
import java.io.Serializable; |
|
4 |
import java.text.ParseException; |
|
5 |
import java.util.*; |
|
6 |
|
|
7 |
import javax.xml.bind.annotation.XmlRootElement; |
|
8 |
|
|
9 |
import com.google.common.collect.Collections2; |
|
10 |
import com.google.common.collect.Lists; |
|
11 |
import org.apache.commons.lang.time.DateUtils; |
|
12 |
|
|
13 |
@XmlRootElement |
|
14 |
public class ActionManagerSet implements Serializable { |
|
15 |
|
|
16 |
/** |
|
17 |
* |
|
18 |
*/ |
|
19 |
private static final long serialVersionUID = 7262893241919858735L; |
|
20 |
public static final String[] DATE_PATTERNS = new String[]{"yyyy-MM-dd\'T\'hh:mm:ss+00:00", "yyyy-MM-dd\'T\'hh:mm:ssXXX"}; |
|
21 |
|
|
22 |
public enum ImpactTypes { |
|
23 |
ONLY_INSERT, INSERT_UPDATE |
|
24 |
} |
|
25 |
|
|
26 |
private String id; |
|
27 |
private String name; |
|
28 |
private ImpactTypes impact = ImpactTypes.INSERT_UPDATE; |
|
29 |
private String directory; |
|
30 |
private String pathToLatest; |
|
31 |
private RawSet latest; |
|
32 |
private TreeSet<RawSet> expired; |
|
33 |
|
|
34 |
public ActionManagerSet() { |
|
35 |
this.expired = new TreeSet<RawSet>(getRawSetComparator()); |
|
36 |
} |
|
37 |
|
|
38 |
public ActionManagerSet(final String id, final String name) { |
|
39 |
this(id, name, ImpactTypes.INSERT_UPDATE, null); |
|
40 |
} |
|
41 |
|
|
42 |
public ActionManagerSet(final String id, final String name, final ImpactTypes impact, final RawSet latest) { |
|
43 |
this(id, name, impact, null, latest); |
|
44 |
} |
|
45 |
|
|
46 |
public ActionManagerSet(final String id, final String name, final ImpactTypes impact, final String pathToLatest, final RawSet latest) { |
|
47 |
super(); |
|
48 |
this.id = id; |
|
49 |
this.name = name; |
|
50 |
this.impact = impact; |
|
51 |
this.pathToLatest = pathToLatest; |
|
52 |
this.latest = latest; |
|
53 |
this.expired = new TreeSet<RawSet>(getRawSetComparator()); |
|
54 |
} |
|
55 |
|
|
56 |
public String getId() { |
|
57 |
return id; |
|
58 |
} |
|
59 |
|
|
60 |
public void setId(final String id) { |
|
61 |
this.id = id; |
|
62 |
} |
|
63 |
|
|
64 |
public String getName() { |
|
65 |
return name; |
|
66 |
} |
|
67 |
|
|
68 |
public void setName(final String name) { |
|
69 |
this.name = name; |
|
70 |
} |
|
71 |
|
|
72 |
public ImpactTypes getImpact() { |
|
73 |
return impact; |
|
74 |
} |
|
75 |
|
|
76 |
public void setImpact(final ImpactTypes impact) { |
|
77 |
this.impact = impact; |
|
78 |
} |
|
79 |
|
|
80 |
public String getPathToLatest() { |
|
81 |
return pathToLatest; |
|
82 |
} |
|
83 |
|
|
84 |
public void setPathToLatest(final String pathToLatest) { |
|
85 |
this.pathToLatest = pathToLatest; |
|
86 |
} |
|
87 |
|
|
88 |
@Override |
|
89 |
public String toString() { |
|
90 |
return "[ id: " + id + ", name: " + name + ", impact: " + impact + " ]"; |
|
91 |
} |
|
92 |
|
|
93 |
public RawSet getLatest() { |
|
94 |
return latest; |
|
95 |
} |
|
96 |
|
|
97 |
public void setLatest(final RawSet latest) { |
|
98 |
this.latest = latest; |
|
99 |
} |
|
100 |
|
|
101 |
public void setLatest(final String rawSetId, final String creationDate, final String lastUpdate) { |
|
102 |
setLatest(new RawSet(rawSetId.trim(), creationDate.trim(), lastUpdate.trim())); |
|
103 |
} |
|
104 |
|
|
105 |
private Comparator<RawSet> getRawSetComparator() { |
|
106 |
return new Comparator<RawSet>() { |
|
107 |
@Override |
|
108 |
public int compare(final RawSet o1, final RawSet o2) { |
|
109 |
try { |
|
110 |
final Date d1 = DateUtils.parseDate(o1.getLastUpdate(), DATE_PATTERNS); |
|
111 |
final Date d2 = DateUtils.parseDate(o2.getLastUpdate(), DATE_PATTERNS); |
|
112 |
return d1.compareTo(d2); |
|
113 |
} catch (ParseException e) { |
|
114 |
throw new RuntimeException( |
|
115 |
String.format("unable to parse dates: %s, %s. Known patterns: %s", o1.getLastUpdate(), o2.getLastUpdate(), Arrays.asList(DATE_PATTERNS))); |
|
116 |
} |
|
117 |
} |
|
118 |
}; |
|
119 |
} |
|
120 |
|
|
121 |
public Set<RawSet> getExpired() { |
|
122 |
return expired; |
|
123 |
} |
|
124 |
|
|
125 |
public void addExpired(final String rawSetId, final String creationDate, final String lastUpdate) { |
|
126 |
addExpired(new RawSet(rawSetId.trim(), creationDate.trim(), lastUpdate.trim())); |
|
127 |
} |
|
128 |
|
|
129 |
public void addExpired(final RawSet rawSet) { |
|
130 |
getExpired().add(rawSet); |
|
131 |
} |
|
132 |
|
|
133 |
public String getDirectory() { |
|
134 |
return directory; |
|
135 |
} |
|
136 |
|
|
137 |
public void setDirectory(final String directory) { |
|
138 |
this.directory = directory; |
|
139 |
} |
|
140 |
} |
modules/dnet-actionmanager-api/tags/dnet-actionmanager-api-4.0.0/src/main/java/eu/dnetlib/actionmanager/set/RawSet.java | ||
---|---|---|
1 |
package eu.dnetlib.actionmanager.set; |
|
2 |
|
|
3 |
import java.util.UUID; |
|
4 |
|
|
5 |
import javax.xml.bind.annotation.XmlRootElement; |
|
6 |
|
|
7 |
import eu.dnetlib.miscutils.datetime.DateUtils; |
|
8 |
|
|
9 |
@XmlRootElement |
|
10 |
public class RawSet { |
|
11 |
|
|
12 |
public static final String RAWSET_PREFIX = "rawset"; |
|
13 |
|
|
14 |
private String id = null; |
|
15 |
private String creationDate = null; |
|
16 |
private String lastUpdate = null; |
|
17 |
|
|
18 |
public RawSet() { |
|
19 |
|
|
20 |
} |
|
21 |
|
|
22 |
protected RawSet(final String id, final String creationDate, final String lastUpdate) { |
|
23 |
super(); |
|
24 |
this.id = id; |
|
25 |
this.creationDate = creationDate; |
|
26 |
this.lastUpdate = lastUpdate; |
|
27 |
} |
|
28 |
|
|
29 |
public String getId() { |
|
30 |
return id; |
|
31 |
} |
|
32 |
|
|
33 |
public void setId(final String id) { |
|
34 |
this.id = id; |
|
35 |
} |
|
36 |
|
|
37 |
public String getCreationDate() { |
|
38 |
return creationDate; |
|
39 |
} |
|
40 |
|
|
41 |
public void setCreationDate(final String creationDate) { |
|
42 |
this.creationDate = creationDate; |
|
43 |
} |
|
44 |
|
|
45 |
public String getLastUpdate() { |
|
46 |
return lastUpdate; |
|
47 |
} |
|
48 |
|
|
49 |
public void setLastUpdate(final String lastUpdate) { |
|
50 |
this.lastUpdate = lastUpdate; |
|
51 |
} |
|
52 |
|
|
53 |
public static RawSet newInstance() { |
|
54 |
long now = DateUtils.now(); |
|
55 |
return new RawSet(RAWSET_PREFIX + "_" + UUID.randomUUID() + "_" + now, DateUtils.calculate_ISO8601(now), null); |
|
56 |
} |
|
57 |
|
|
58 |
public static RawSet newInstance(final String id, final String creationDate, final String lastUpdate) { |
|
59 |
return new RawSet(id, creationDate, lastUpdate); |
|
60 |
} |
|
61 |
|
|
62 |
} |
modules/dnet-actionmanager-api/tags/dnet-actionmanager-api-4.0.0/pom.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<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/maven-v4_0_0.xsd"> |
|
3 |
<parent> |
|
4 |
<groupId>eu.dnetlib</groupId> |
|
5 |
<artifactId>dnet-parent</artifactId> |
|
6 |
<version>1.0.0</version> |
|
7 |
<relativePath /> |
|
8 |
</parent> |
|
9 |
<modelVersion>4.0.0</modelVersion> |
|
10 |
<groupId>eu.dnetlib</groupId> |
|
11 |
<artifactId>dnet-actionmanager-api</artifactId> |
|
12 |
<packaging>jar</packaging> |
|
13 |
<version>4.0.0</version> |
|
14 |
<scm> |
|
15 |
<developerConnection>scm:svn:https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/dnet-actionmanager-api/tags/dnet-actionmanager-api-4.0.0</developerConnection> |
|
16 |
</scm> |
|
17 |
<dependencies> |
|
18 |
<dependency> |
|
19 |
<groupId>eu.dnetlib</groupId> |
|
20 |
<artifactId>cnr-rmi-api</artifactId> |
|
21 |
<version>[2.0.0,3.0.0)</version> |
|
22 |
</dependency> |
|
23 |
<dependency> |
|
24 |
<groupId>eu.dnetlib</groupId> |
|
25 |
<artifactId>cnr-misc-utils</artifactId> |
|
26 |
<version>[1.0.0,2.0.0)</version> |
|
27 |
</dependency> |
|
28 |
</dependencies> |
|
29 |
</project> |
Also available in: Unified diff
[maven-release-plugin] copy for tag dnet-actionmanager-api-4.0.0