Project

General

Profile

« Previous | Next » 

Revision 36434

removed kind table, partial implementation of manager worker

View differences:

modules/dnet-information-service/trunk/src/main/java/eu/dnetlib/enabling/is/hib/objects/HibDnetResourcePropertyId.java
1
package eu.dnetlib.enabling.is.hib.objects;
2

  
3
import java.io.Serializable;
4

  
5
import javax.persistence.Column;
6
import javax.persistence.Embeddable;
7
import javax.persistence.JoinColumn;
8
import javax.persistence.ManyToOne;
9
import javax.persistence.Transient;
10

  
11
import org.apache.commons.lang.builder.EqualsBuilder;
12
import org.apache.commons.lang.builder.HashCodeBuilder;
13

  
14
@Embeddable
15
public class HibDnetResourcePropertyId implements Serializable {
16

  
17
	/**
18
	 * 
19
	 */
20
	@Transient
21
	private static final long serialVersionUID = 8985455596933025660L;
22

  
23
	@ManyToOne
24
	@JoinColumn(name = "resource", nullable = false)
25
	private HibDnetResource resource;
26

  
27
	@Column(name = "name", nullable = false)
28
	private String name;
29

  
30
	public HibDnetResourcePropertyId() {}
31

  
32
	public HibDnetResourcePropertyId(final HibDnetResource resource, final String name) {
33
		this.resource = resource;
34
		this.name = name;
35
	}
36

  
37
	public HibDnetResource getResource() {
38
		return resource;
39
	}
40

  
41
	public void setResource(final HibDnetResource resource) {
42
		this.resource = resource;
43
	}
44

  
45
	public String getName() {
46
		return name;
47
	}
48

  
49
	public void setName(final String name) {
50
		this.name = name;
51
	}
52

  
53
	@Override
54
	public boolean equals(final Object obj) {
55
		if (obj == this) {
56
			return true;
57
		} else if (obj instanceof HibDnetResourcePropertyId) {
58
			final HibDnetResourcePropertyId spi = (HibDnetResourcePropertyId) obj;
59
			return new EqualsBuilder().append(name, spi.name).append(resource, spi.resource).isEquals();
60
		} else {
61
			return false;
62
		}
63
	}
64

  
65
	@Override
66
	public int hashCode() {
67
		return new HashCodeBuilder().append(name).append(resource.getId()).toHashCode();
68
	}
69
}
modules/dnet-information-service/trunk/src/main/java/eu/dnetlib/enabling/is/hib/objects/HibResourceKind.java
1
package eu.dnetlib.enabling.is.hib.objects;
2

  
3
import java.io.Serializable;
4
import java.util.Set;
5

  
6
import javax.persistence.CascadeType;
7
import javax.persistence.Column;
8
import javax.persistence.Entity;
9
import javax.persistence.EnumType;
10
import javax.persistence.Enumerated;
11
import javax.persistence.FetchType;
12
import javax.persistence.Id;
13
import javax.persistence.OneToMany;
14
import javax.persistence.Table;
15
import javax.persistence.Transient;
16

  
17
import com.google.common.collect.Sets;
18

  
19
import eu.dnetlib.rmi.objects.is.DnetResourceKind;
20

  
21
@Entity(name = "resource_kinds")
22
@Table(name = "resource_kinds")
23
public class HibResourceKind extends HibDnetObject implements Serializable {
24

  
25
	@Transient
26
	private static final long serialVersionUID = 1600666516908310155L;
27

  
28
	@Id
29
	@Column(name = "id")
30
	@Enumerated(EnumType.STRING)
31
	private DnetResourceKind id;
32

  
33
	@OneToMany(mappedBy = "kind", cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
34
	private Set<HibResourceType> types = Sets.newLinkedHashSet();
35

  
36
	public HibResourceKind() {}
37

  
38
	public HibResourceKind(final DnetResourceKind id) {
39
		this.id = id;
40
	}
41

  
42
	public DnetResourceKind getId() {
43
		return id;
44
	}
45

  
46
	public void setId(final DnetResourceKind id) {
47
		this.id = id;
48
	}
49

  
50
	public Set<HibResourceType> getTypes() {
51
		return types;
52
	}
53

  
54
	public void setTypes(final Set<HibResourceType> types) {
55
		this.types = types;
56
	}
57

  
58
	@Override
59
	public int hashCode() {
60
		return id.hashCode();
61
	}
62
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/miscutils/Callback.java
1
package eu.dnetlib.miscutils;
2

  
3
public interface Callback<T> {
4

  
5
	void call(T obj);
6

  
7
}
modules/dnet-information-service/trunk/src/main/java/eu/dnetlib/enabling/is/hib/utils/HibObjectHelper.java
12 12
import eu.dnetlib.enabling.is.hib.objects.HibBlackboardMessage;
13 13
import eu.dnetlib.enabling.is.hib.objects.HibDatastructure;
14 14
import eu.dnetlib.enabling.is.hib.objects.HibDnetResourceProperty;
15
import eu.dnetlib.enabling.is.hib.objects.HibDnetResourcePropertyId;
16
import eu.dnetlib.enabling.is.hib.objects.HibResourceKind;
17 15
import eu.dnetlib.enabling.is.hib.objects.HibResourceType;
18 16
import eu.dnetlib.enabling.is.hib.objects.HibService;
19 17
import eu.dnetlib.enabling.is.hib.objects.HibServiceProtocol;
......
33 31
	private DnetSimpleDaoFactory daoFactory;
34 32

  
35 33
	public HibService createHibService(final DnetService service) throws InformationServiceException {
36
		HibResourceType type = daoFactory.getDao(HibResourceType.class).find(service.getName());
37
		if (type == null) {
38
			type = createHibResourceType(service.getName(), DnetResourceKind.SERVICE, DnetResourceFormat.SERVICE);
39
		}
40 34

  
41
		final HibService hib = new HibService(service.getId(), type, service.isValid());
35
		final HibService hib = new HibService(service.getId(), service.getName(), service.isValid());
42 36

  
43 37
		for (Entry<String, String> e : service.getProtocols().entrySet()) {
44 38
			hib.getProtocols().add(new HibServiceProtocol(new HibServiceProtocolId(hib, e.getKey()), e.getValue()));
45 39
		}
46 40
		for (Entry<String, String> e : service.getProperties().entrySet()) {
47
			hib.getProperties().add(new HibDnetResourceProperty(new HibDnetResourcePropertyId(hib, e.getKey()), e.getValue()));
41
			hib.getProperties().add(new HibDnetResourceProperty(hib, e.getKey(), e.getValue()));
48 42
		}
49 43
		for (BlackboardMessage b : service.getBlackboard()) {
50 44
			hib.getBlackboard().add(new HibBlackboardMessage(hib, b));
......
72 66

  
73 67
			System.out.println(" **************** K = " + e.getKey());
74 68

  
75
			hib.getProperties().add(new HibDnetResourceProperty(new HibDnetResourcePropertyId(hib, e.getKey()), e.getValue()));
69
			hib.getProperties().add(new HibDnetResourceProperty(hib, e.getKey(), e.getValue()));
76 70
		}
77 71

  
78 72
		if (StringUtils.isNotBlank(ds.getServiceId())) {
......
123 117
	private HibResourceType createHibResourceType(final String type,
124 118
			final DnetResourceKind kind,
125 119
			final DnetResourceFormat format) throws InformationServiceException {
126
		final DnetSimpleDao<HibResourceKind> daoKind = daoFactory.getDao(HibResourceKind.class);
127
		final HibResourceKind hibKind = daoKind.find(kind);
128
		final HibResourceType hibType = new HibResourceType(type, hibKind, format);
120
		final HibResourceType hibType = new HibResourceType(type, kind, format);
129 121
		daoFactory.getDao(HibResourceType.class).save(hibType);
130 122
		return hibType;
131 123
	}
modules/dnet-information-service/trunk/src/main/java/eu/dnetlib/enabling/is/hib/objects/HibService.java
3 3
import java.util.Set;
4 4

  
5 5
import javax.persistence.CascadeType;
6
import javax.persistence.Column;
6 7
import javax.persistence.Entity;
7 8
import javax.persistence.FetchType;
8
import javax.persistence.JoinColumn;
9
import javax.persistence.ManyToOne;
10 9
import javax.persistence.OneToMany;
11 10
import javax.persistence.PrimaryKeyJoinColumn;
12 11
import javax.persistence.Table;
......
24 23
	@Transient
25 24
	private static final long serialVersionUID = -9176477709836024551L;
26 25

  
27
	@ManyToOne
28
	@JoinColumn(name = "type", nullable = false)
29
	private HibResourceType type;
26
	@Column(name = "type", nullable = false)
27
	private String type;
30 28

  
31 29
	@OneToMany(mappedBy = "id.service", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
32 30
	private Set<HibServiceProtocol> protocols = Sets.newLinkedHashSet();
......
41 39
		super();
42 40
	}
43 41

  
44
	public HibService(final String id, final HibResourceType type, final boolean valid) {
42
	public HibService(final String id, final String type, final boolean valid) {
45 43
		super(id, valid);
46 44
		this.type = type;
47 45
	}
48 46

  
49
	public HibResourceType getType() {
47
	public String getType() {
50 48
		return type;
51 49
	}
52 50

  
53
	public void setType(final HibResourceType type) {
51
	public void setType(final String type) {
54 52
		this.type = type;
55 53
	}
56 54

  
......
81 79
	public DnetService asDnetService() {
82 80
		final DnetService service = new DnetService();
83 81
		service.setId(getId());
84
		service.setName(getType().getId());
82
		service.setName(getType());
85 83
		service.setDate(getDate());
86 84
		service.setValid(isValid());
87 85

  
......
89 87
			service.getProtocols().put(p.getId().getName(), p.getAddress());
90 88
		}
91 89
		for (HibDnetResourceProperty p : getProperties()) {
92
			service.getProperties().put(p.getId().getName(), p.getValue());
90
			service.getProperties().put(p.getName(), p.getValue());
93 91
		}
94 92
		for (HibBlackboardMessage m : getBlackboard()) {
95 93
			service.getBlackboard().add(m.asDnetBlackboardMessage());
modules/dnet-information-service/trunk/src/main/java/eu/dnetlib/enabling/is/hib/objects/HibDnetResource.java
37 37
	@Column(name = "date", nullable = false, insertable = false, updatable = false)
38 38
	private Date date;
39 39

  
40
	@OneToMany(mappedBy = "id.resource", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
40
	@OneToMany(mappedBy = "resource", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
41 41
	private Set<HibDnetResourceProperty> properties = Sets.newLinkedHashSet();
42 42

  
43 43
	public HibDnetResource() {}
modules/dnet-information-service/trunk/src/main/java/eu/dnetlib/enabling/is/hib/objects/HibDnetResourceProperty.java
3 3
import java.io.Serializable;
4 4

  
5 5
import javax.persistence.Column;
6
import javax.persistence.EmbeddedId;
7 6
import javax.persistence.Entity;
7
import javax.persistence.Id;
8
import javax.persistence.JoinColumn;
9
import javax.persistence.ManyToOne;
8 10
import javax.persistence.Table;
9 11
import javax.persistence.Transient;
10 12

  
......
15 17
	@Transient
16 18
	private static final long serialVersionUID = 612491084747663805L;
17 19

  
18
	@EmbeddedId
19
	private HibDnetResourcePropertyId id;
20
	@Id
21
	@Column(name = "id", insertable = false)
22
	private int id;
20 23

  
24
	@ManyToOne
25
	@JoinColumn(name = "resource", nullable = false)
26
	private HibDnetResource resource;
27

  
28
	@Column(name = "name", nullable = false)
29
	private String name;
30

  
21 31
	@Column(name = "value")
22 32
	private String value;
23 33

  
24 34
	public HibDnetResourceProperty() {}
25 35

  
26
	public HibDnetResourceProperty(final HibDnetResourcePropertyId id, final String value) {
36
	public HibDnetResourceProperty(final int id, final HibDnetResource resource, final String name, final String value) {
27 37
		this.id = id;
38
		this.resource = resource;
39
		this.name = name;
28 40
		this.value = value;
29 41
	}
30 42

  
43
	public HibDnetResourceProperty(final HibDnetResource resource, final String name, final String value) {
44
		this(-1, resource, name, value);
45
	}
46

  
47
	public int getId() {
48
		return id;
49
	}
50

  
51
	public void setId(final int id) {
52
		this.id = id;
53
	}
54

  
55
	public HibDnetResource getResource() {
56
		return resource;
57
	}
58

  
59
	public void setResource(final HibDnetResource resource) {
60
		this.resource = resource;
61
	}
62

  
63
	public String getName() {
64
		return name;
65
	}
66

  
67
	public void setName(final String name) {
68
		this.name = name;
69
	}
70

  
31 71
	public String getValue() {
32 72
		return value;
33 73
	}
......
36 76
		this.value = value;
37 77
	}
38 78

  
39
	public HibDnetResourcePropertyId getId() {
40
		return id;
41
	}
42

  
43
	public void setId(final HibDnetResourcePropertyId id) {
44
		this.id = id;
45
	}
46

  
47 79
	@Override
48 80
	public int hashCode() {
49
		return id.hashCode();
81
		return id;
50 82
	}
51 83
}
modules/dnet-information-service/trunk/src/main/java/eu/dnetlib/enabling/is/hib/objects/HibResourceType.java
10 10
import javax.persistence.Enumerated;
11 11
import javax.persistence.FetchType;
12 12
import javax.persistence.Id;
13
import javax.persistence.JoinColumn;
14
import javax.persistence.ManyToOne;
15 13
import javax.persistence.OneToMany;
16 14
import javax.persistence.Table;
17 15
import javax.persistence.Transient;
......
19 17
import com.google.common.collect.Sets;
20 18

  
21 19
import eu.dnetlib.rmi.objects.is.DnetResourceFormat;
20
import eu.dnetlib.rmi.objects.is.DnetResourceKind;
22 21

  
23 22
@Entity(name = "resource_types")
24 23
@Table(name = "resource_types")
......
31 30
	@Column(name = "id")
32 31
	private String id;
33 32

  
34
	@ManyToOne
35
	@JoinColumn(name = "kind", nullable = false)
36
	private HibResourceKind kind;
33
	@Column(name = "kind")
34
	@Enumerated(EnumType.STRING)
35
	private DnetResourceKind kind;
37 36

  
38 37
	@OneToMany(mappedBy = "type", cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
39
	private Set<HibService> services = Sets.newLinkedHashSet();
40

  
41
	@OneToMany(mappedBy = "type", cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
42 38
	private Set<HibDatastructure> datastructures = Sets.newLinkedHashSet();
43 39

  
44 40
	@Column(name = "format")
......
47 43

  
48 44
	public HibResourceType() {}
49 45

  
50
	public HibResourceType(final String id, final HibResourceKind kind, final DnetResourceFormat format) {
46
	public HibResourceType(final String id, final DnetResourceKind kind, final DnetResourceFormat format) {
51 47
		this.id = id;
52 48
		this.kind = kind;
53 49
		this.format = format;
......
61 57
		this.id = id;
62 58
	}
63 59

  
64
	public HibResourceKind getKind() {
60
	public DnetResourceKind getKind() {
65 61
		return kind;
66 62
	}
67 63

  
68
	public void setKind(final HibResourceKind kind) {
64
	public void setKind(final DnetResourceKind kind) {
69 65
		this.kind = kind;
70 66
	}
71 67

  
72
	public Set<HibService> getServices() {
73
		return services;
74
	}
75

  
76
	public void setServices(final Set<HibService> services) {
77
		this.services = services;
78
	}
79

  
80 68
	public Set<HibDatastructure> getDatastructures() {
81 69
		return datastructures;
82 70
	}
modules/dnet-information-service/trunk/src/main/java/eu/dnetlib/enabling/is/init/DatabaseInitializer.java
9 9
import org.springframework.core.io.ClassPathResource;
10 10
import org.springframework.core.io.Resource;
11 11

  
12
import eu.dnetlib.enabling.is.dao.DnetSimpleDao;
13 12
import eu.dnetlib.enabling.is.dao.DnetSimpleDaoFactory;
14
import eu.dnetlib.enabling.is.hib.objects.HibResourceKind;
15 13
import eu.dnetlib.enabling.is.jdbc.DatabaseUtils;
16
import eu.dnetlib.rmi.objects.is.DnetResourceKind;
17 14
import eu.dnetlib.rmi.soap.exceptions.InformationServiceException;
18 15

  
19 16
public class DatabaseInitializer {
......
34 31
		if (reset) {
35 32
			dbUtils.update(IOUtils.toString(initFile.getInputStream()));
36 33
			log.info("The IS Database has been cleaned");
37
			final DnetSimpleDao<HibResourceKind> dnetResourceKindDao = daoFactory.getDao(HibResourceKind.class);
38
			for (DnetResourceKind kind : DnetResourceKind.values()) {
39
				dnetResourceKindDao.save(new HibResourceKind(kind));
40
			}
41 34
		}
42 35
	}
43 36

  
modules/dnet-information-service/trunk/src/main/resources/eu/dnetlib/enabling/is/setup/is_base.sql
1 1
DROP SCHEMA public CASCADE;
2 2
CREATE SCHEMA public;
3 3

  
4
CREATE TABLE IF NOT EXISTS resource_kinds (
5
	id varchar(255) NOT NULL PRIMARY KEY
6
);
7

  
8 4
CREATE TABLE IF NOT EXISTS resource_types (
9 5
	id         varchar(255) NOT NULL PRIMARY KEY,
10
	kind       varchar(255) NOT NULL REFERENCES resource_kinds(id),
6
	kind       varchar(255) NOT NULL,
11 7
	format     varchar(12)  NOT NULL
12 8
);
13 9

  
......
19 15

  
20 16
CREATE TABLE IF NOT EXISTS services (
21 17
	id   varchar(255) NOT NULL PRIMARY KEY REFERENCES resources(id) ON DELETE CASCADE,
22
	type varchar(255) NOT NULL REFERENCES resource_types(id)
18
	type varchar(255) NOT NULL
23 19
);
24 20

  
25 21
CREATE TABLE IF NOT EXISTS blackboard (
......
32 28
);
33 29

  
34 30
CREATE TABLE IF NOT EXISTS resource_properties (
31
	id       serial       NOT NULL PRIMARY KEY,
35 32
	resource varchar(255) NOT NULL REFERENCES resources(id) ON DELETE CASCADE,
36 33
	name     varchar(255) NOT NULL,
37
	value    varchar(255),
38
	PRIMARY KEY (service, name)
34
	value    varchar(255)
39 35
);
40 36

  
41 37
CREATE TABLE IF NOT EXISTS service_protocols (
modules/dnet-components/trunk/src/main/java/eu/dnetlib/enabling/annotations/DnetResourceHelper.java
38 38
				throw new InformationServiceException("NOT IMPLEMENTED");
39 39
			case TEXT:
40 40
				return o.toString();
41
			case SERVICE:
42
				throw new InformationServiceException("NOT IMPLEMENTED");
43 41
			default:
44 42
				throw new InformationServiceException("Invalid format " + a.format());
45 43
			}
......
62 60
				} catch (Throwable e) {
63 61
					throw new InformationServiceException("Cannot instantiate object of Class " + clazz);
64 62
				}
65
			case SERVICE:
66
				throw new InformationServiceException("NOT IMPLEMENTED");
67 63
			default:
68 64
				throw new InformationServiceException("Invalid format " + a.format());
69 65
			}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/blackboard/LaunchWorkflowMessage.java
10 10
@Blackboard(action = "LAUNCH", serviceClass = ManagerWorkerService.class)
11 11
public class LaunchWorkflowMessage {
12 12

  
13
	private String wf;
14
	private String processId;
13
	// Input parameters
14
	private String id;
15
	private String name;
16
	private String type;
17
	private int priority;
18
	private boolean ready = false;
19
	private String workflowXml;
20
	private Map<String, String> params = Maps.newHashMap();
21

  
22
	// Output Parameters
23
	private String procId;
15 24
	private Map<String, String> logs = Maps.newHashMap();
16 25

  
17
	public LaunchWorkflowMessage() {}
26
	public String getId() {
27
		return id;
28
	}
18 29

  
19
	public LaunchWorkflowMessage(final String wf) {
20
		this.wf = wf;
30
	public void setId(final String id) {
31
		this.id = id;
21 32
	}
22 33

  
23
	public LaunchWorkflowMessage(final String wf, final String processId, final Map<String, String> logs) {
24
		this.wf = wf;
25
		this.processId = processId;
26
		this.logs = logs;
34
	public String getName() {
35
		return name;
27 36
	}
28 37

  
29
	public String getWf() {
30
		return wf;
38
	public void setName(final String name) {
39
		this.name = name;
31 40
	}
32 41

  
33
	public void setWf(final String wf) {
34
		this.wf = wf;
42
	public String getType() {
43
		return type;
35 44
	}
36 45

  
37
	public String getProcessId() {
38
		return processId;
46
	public void setType(final String type) {
47
		this.type = type;
39 48
	}
40 49

  
41
	public void setProcessId(final String processId) {
42
		this.processId = processId;
50
	public int getPriority() {
51
		return priority;
43 52
	}
44 53

  
54
	public void setPriority(final int priority) {
55
		this.priority = priority;
56
	}
57

  
58
	public boolean isReady() {
59
		return ready;
60
	}
61

  
62
	public void setReady(final boolean ready) {
63
		this.ready = ready;
64
	}
65

  
66
	public Map<String, String> getParams() {
67
		return params;
68
	}
69

  
70
	public void setParams(final Map<String, String> params) {
71
		this.params = params;
72
	}
73

  
74
	public String getWorkflowXml() {
75
		return workflowXml;
76
	}
77

  
78
	public void setWorkflowXml(final String workflowXml) {
79
		this.workflowXml = workflowXml;
80
	}
81

  
82
	public String getProcId() {
83
		return procId;
84
	}
85

  
86
	public void setProcId(final String procId) {
87
		this.procId = procId;
88
	}
89

  
45 90
	public Map<String, String> getLogs() {
46 91
		return logs;
47 92
	}
......
49 94
	public void setLogs(final Map<String, String> logs) {
50 95
		this.logs = logs;
51 96
	}
97

  
52 98
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/objects/is/DnetResourceKind.java
4 4

  
5 5
@XmlEnum(String.class)
6 6
public enum DnetResourceKind {
7
	SERVICE, UNIT, CONFIGURATION, OTHER
7
	UNIT, CONFIGURATION, OTHER
8 8
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/rmi/objects/is/DnetResourceFormat.java
4 4

  
5 5
@XmlEnum(String.class)
6 6
public enum DnetResourceFormat {
7
	XML, JSON, TEXT, SERVICE
7
	XML, JSON, TEXT
8 8
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/common/services/BlackboardAction.java
4 4

  
5 5
import com.google.gson.Gson;
6 6

  
7
import eu.dnetlib.common.ifaces.Callback;
7 8
import eu.dnetlib.enabling.annotations.Blackboard;
8
import eu.dnetlib.miscutils.Callback;
9 9

  
10 10
public abstract class BlackboardAction<T> {
11 11

  
modules/dnet-components/trunk/src/main/java/eu/dnetlib/common/ifaces/StoppableDetails.java
1
package eu.dnetlib.common.ifaces;
2

  
3
public class StoppableDetails {
4

  
5
	public enum StopStatus {
6
		RUNNING, STOPPED, STOPPING
7
	}
8

  
9
	private String name;
10
	private String message;
11
	private StopStatus status;
12

  
13
	public StoppableDetails() {}
14

  
15
	public StoppableDetails(final String name, final String message, final StopStatus status) {
16
		this.name = name;
17
		this.message = message;
18
		this.status = status;
19
	}
20

  
21
	public String getName() {
22
		return name;
23
	}
24

  
25
	public void setName(final String name) {
26
		this.name = name;
27
	}
28

  
29
	public String getMessage() {
30
		return message;
31
	}
32

  
33
	public void setMessage(final String message) {
34
		this.message = message;
35
	}
36

  
37
	public StopStatus getStatus() {
38
		return status;
39
	}
40

  
41
	public void setStatus(final StopStatus status) {
42
		this.status = status;
43
	}
44
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/common/ifaces/Stoppable.java
1
package eu.dnetlib.common.ifaces;
2

  
3
public interface Stoppable {
4

  
5
	void stop();
6

  
7
	void resume();
8

  
9
	StoppableDetails getStopDetails();
10
}
modules/dnet-components/trunk/src/main/java/eu/dnetlib/common/ifaces/Callback.java
1
package eu.dnetlib.common.ifaces;
2

  
3
public interface Callback<T> {
4

  
5
	void call(T obj);
6

  
7
}
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/test/SumAction.java
1 1
package eu.dnetlib.enabling.test;
2 2

  
3
import eu.dnetlib.common.ifaces.Callback;
3 4
import eu.dnetlib.common.services.BlackboardAction;
4
import eu.dnetlib.miscutils.Callback;
5 5
import eu.dnetlib.rmi.blackboard.SumMessage;
6 6

  
7 7
public class SumAction extends BlackboardAction<SumMessage> {
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/nodeManager/ContentInitializer.java
59 59
		for (Class<?> cl : reflections.getTypesAnnotatedWith(DnetResource.class)) {
60 60
			log.info(" - Registering/updating resourceType " + cl.getName());
61 61
			final DnetResourceType type = DnetResourceHelper.obtainResourceType(cl);
62

  
62 63
			is.addResourceType(type);
63 64
			res.add(type.getType());
64 65
		}
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/enabling/blackboard/BlackboardRegistry.java
11 11
import com.google.common.collect.Maps;
12 12
import com.google.gson.Gson;
13 13

  
14
import eu.dnetlib.common.ifaces.Callback;
14 15
import eu.dnetlib.common.services.BlackboardAction;
15
import eu.dnetlib.miscutils.Callback;
16 16
import eu.dnetlib.rmi.objects.is.BlackboardActionStatus;
17 17
import eu.dnetlib.rmi.objects.is.BlackboardMessage;
18 18
import eu.dnetlib.rmi.objects.is.Operation;
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/ProcessUtils.java
1
package eu.dnetlib.msro.worker;
2

  
3
import java.text.SimpleDateFormat;
4
import java.util.Date;
5

  
6
import org.apache.commons.logging.Log;
7
import org.apache.commons.logging.LogFactory;
8

  
9
import com.googlecode.sarasvati.GraphProcess;
10
import com.googlecode.sarasvati.NodeToken;
11

  
12
public class ProcessUtils {
13

  
14
	private static String oldGeneratedId = "";
15

  
16
	private static final Log log = LogFactory.getLog(ProcessUtils.class);
17

  
18
	public static String calculateName(final GraphProcess process) {
19
		return process.getGraph().getName();
20
	}
21

  
22
	public static String calculateFamily(final GraphProcess process) {
23
		return process.getEnv().getAttribute(WorkflowConstants.SYSTEM_WF_PROFILE_FAMILY);
24
	}
25

  
26
	public static String calculateWfId(final GraphProcess process) {
27
		return process.getEnv().getAttribute(WorkflowConstants.SYSTEM_WF_PROFILE_ID);
28
	}
29

  
30
	public static String calculateStatus(final GraphProcess process) {
31
		if (!process.isComplete()) {
32
			return process.getState().toString().toUpperCase();
33
		} else if ("true".equals(process.getEnv().getAttribute(WorkflowConstants.SYSTEM_COMPLETED_SUCCESSFULLY))) {
34
			return "SUCCESS";
35
		} else {
36
			return "FAILURE";
37
		}
38
	}
39

  
40
	public static Date calculateLastActivityDate(final GraphProcess process) {
41
		Date date = null;
42
		for (final NodeToken token : process.getNodeTokens()) {
43
			Date activity = token.getCompleteDate();
44
			if (activity == null) {
45
				activity = token.getCreateDate();
46
			}
47

  
48
			if (date == null) {
49
				date = activity;
50
			}
51

  
52
			if (activity != null && date != null && activity.compareTo(date) > 0) {
53
				date = activity;
54
			}
55
		}
56
		return date;
57
	}
58

  
59
	public static String calculateRepo(final GraphProcess process) {
60
		if (process.getEnv().hasAttribute(WorkflowConstants.DATAPROVIDER_NAME)) {
61
			return process.getEnv().getAttribute(WorkflowConstants.DATAPROVIDER_NAME);
62
		} else {
63
			return "";
64
		}
65
	}
66

  
67
	public static synchronized String generateProcessId() {
68
		String id = "";
69
		do {
70
			id = "wf_" + new SimpleDateFormat("yyyyMMdd_HHmmss_S").format(new Date());
71
			log.info("Generated processID " + id);
72
		} while (id.equals(oldGeneratedId));
73

  
74
		oldGeneratedId = id;
75

  
76
		return id;
77
	}
78

  
79
}
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/LaunchWorkflowAction.java
1 1
package eu.dnetlib.msro.worker;
2 2

  
3
import eu.dnetlib.common.ifaces.Callback;
3 4
import eu.dnetlib.common.services.BlackboardAction;
4
import eu.dnetlib.miscutils.Callback;
5 5
import eu.dnetlib.rmi.blackboard.LaunchWorkflowMessage;
6 6

  
7 7
public class LaunchWorkflowAction extends BlackboardAction<LaunchWorkflowMessage> {
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/WorkflowConstants.java
1
package eu.dnetlib.msro.worker;
2

  
3
import java.util.List;
4
import java.util.Map;
5

  
6
import org.springframework.beans.factory.annotation.Required;
7

  
8
import com.google.common.collect.Lists;
9
import com.google.common.collect.Maps;
10
import com.google.gson.Gson;
11

  
12
public class WorkflowConstants {
13

  
14
	public static final String SYSTEM_WF_NAME = "system:wfName";
15
	public static final String SYSTEM_WF_PROFILE_ID = "system:profileId";
16
	public static final String SYSTEM_WF_PROFILE_NAME = "system:profileName";
17
	public static final String SYSTEM_WF_PROFILE_FAMILY = "system:profileFamily";
18
	public static final String SYSTEM_WF_PRIORITY = "system:priority";
19
	public static final String SYSTEM_WF_PROCESS_ID = "system:processId";
20
	public static final String SYSTEM_ERROR = "system:error";
21
	public static final String SYSTEM_HAS_FAILED = "system:hasFailed";
22
	public static final String SYSTEM_START_HUMAN_DATE = "system:startHumanDate";
23
	public static final String SYSTEM_START_DATE = "system:startDate";
24
	public static final String SYSTEM_END_HUMAN_DATE = "system:endHumanDate";
25
	public static final String SYSTEM_END_DATE = "system:endDate";
26

  
27
	public static final String SYSTEM_COMPLETED_SUCCESSFULLY = "system:isCompletedSuccessfully";
28
	public static final String BLACKBOARD_IS_BLACKBOARD = "blackboard:isBlackboard";
29
	public static final String BLACKBOARD_JOB = "blackboard:job";
30
	public static final String BLACKBOARD_SERVICE_ID = "blackboard:serviceId";
31
	public static final String BLACKBOARD_IS_GOING = "blackboard:isOngoing";
32
	public static final String BLACKBOARD_PARAM_PREFIX = "blackboard:param:";
33

  
34
	public static final String DATAPROVIDER_PREFIX = "dataprovider:";
35
	public static final String DATAPROVIDER_ID = WorkflowConstants.DATAPROVIDER_PREFIX + "id";
36
	public static final String DATAPROVIDER_NAME = WorkflowConstants.DATAPROVIDER_PREFIX + "name";
37
	public static final String DATAPROVIDER_ACRONYM = WorkflowConstants.DATAPROVIDER_PREFIX + "acronym";
38
	public static final String DATAPROVIDER_URL = WorkflowConstants.DATAPROVIDER_PREFIX + "url";
39
	public static final String DATAPROVIDER_INTERFACE = WorkflowConstants.DATAPROVIDER_PREFIX + "interface";
40

  
41
	public static final int MIN_WF_PRIORITY = 0;
42
	public static final int MAX_WF_PRIORITY = 100;
43
	public static final int DEFAULT_WF_PRIORITY = 50;
44
	public static final int MAX_PENDING_PROCS_SIZE = 100;
45
	public static final int MAX_WF_THREADS = 10;
46
	public static final String MAIN_LOG_PREFIX = "mainlog:";
47

  
48
	public enum WorkflowStatus {
49
		EXECUTABLE("Executable", "icon-ok"), WAIT_USER_SETTINGS("Waiting user settings", "icon-edit"), WAIT_SYS_SETTINGS("Waiting system settings",
50
				"icon-refresh"), ASSIGNED("Assigned", "icon-ok-circle"), MISSING("Missing workflow", "icon-warning-sign");
51

  
52
		public String displayName;
53
		public String icon;
54

  
55
		WorkflowStatus(final String displayName, final String icon) {
56
			this.displayName = displayName;
57
			this.icon = icon;
58
		}
59
	}
60

  
61
	private String dataproviderProtocolsJson;
62
	private String dataproviderTypologiesJson;
63
	private List<Map<String, String>> dataproviderProtocols;
64
	private List<Map<String, String>> dataproviderTypologies;
65
	private List<Map<String, String>> dataproviderWorkflowStatuses;
66

  
67
	@SuppressWarnings("unchecked")
68
	public void init() {
69
		Gson gson = new Gson();
70
		dataproviderProtocols = gson.fromJson(dataproviderProtocolsJson, List.class);
71
		dataproviderTypologies = gson.fromJson(dataproviderTypologiesJson, List.class);
72
		dataproviderWorkflowStatuses = Lists.newArrayList();
73
		for (WorkflowStatus s : WorkflowStatus.values()) {
74
			Map<String, String> map = Maps.newHashMap();
75
			map.put("name", s.displayName);
76
			map.put("icon", s.icon);
77
			map.put("value", s.toString());
78
			dataproviderWorkflowStatuses.add(map);
79
		}
80
	}
81

  
82
	public String getDataproviderProtocolsJson() {
83
		return dataproviderProtocolsJson;
84
	}
85

  
86
	@Required
87
	public void setDataproviderProtocolsJson(final String dataproviderProtocolsJson) {
88
		this.dataproviderProtocolsJson = dataproviderProtocolsJson;
89
	}
90

  
91
	public String getDataproviderTypologiesJson() {
92
		return dataproviderTypologiesJson;
93
	}
94

  
95
	@Required
96
	public void setDataproviderTypologiesJson(final String dataproviderTypologiesJson) {
97
		this.dataproviderTypologiesJson = dataproviderTypologiesJson;
98
	}
99

  
100
	public List<Map<String, String>> getDataproviderProtocols() {
101
		return dataproviderProtocols;
102
	}
103

  
104
	public List<Map<String, String>> getDataproviderTypologies() {
105
		return dataproviderTypologies;
106
	}
107

  
108
	public List<Map<String, String>> getDataproviderWorkflowStatuses() {
109
		return dataproviderWorkflowStatuses;
110
	}
111
}
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/GraphLoader.java
1
package eu.dnetlib.msro.worker;
2

  
3
import java.io.File;
4
import java.io.FileOutputStream;
5
import java.io.StringReader;
6

  
7
import org.apache.commons.io.IOUtils;
8
import org.apache.commons.logging.Log;
9
import org.apache.commons.logging.LogFactory;
10
import org.dom4j.Document;
11
import org.dom4j.DocumentException;
12
import org.dom4j.io.SAXReader;
13
import org.springframework.beans.factory.annotation.Required;
14

  
15
import com.googlecode.sarasvati.Graph;
16
import com.googlecode.sarasvati.mem.MemEngine;
17

  
18
public class GraphLoader {
19

  
20
	private MemEngine engine;
21

  
22
	private static final Log log = LogFactory.getLog(GraphLoader.class);
23

  
24
	public Graph loadGraph(final String xml) throws Exception {
25
		final File tmpFile = File.createTempFile("wftfs", null);
26
		try {
27
			IOUtils.copy(new StringReader(xml), new FileOutputStream(tmpFile));
28

  
29
			final SAXReader reader = new SAXReader();
30
			final Document doc = reader.read(tmpFile);
31
			final String graphName = doc.valueOf("/process-definition/@name");
32

  
33
			getEngine().getLoader().load(tmpFile);
34

  
35
			final Graph graph = getEngine().getRepository().getLatestGraph(graphName);
36
			if (graph == null) { throw new IllegalArgumentException("graph called " + graphName + " doesn't exist"); }
37
			return graph;
38
		} catch (DocumentException e) {
39
			log.error("Error parsing xml: " + xml, e);
40
			throw e;
41
		} finally {
42
			tmpFile.delete();
43
		}
44
	}
45

  
46
	public MemEngine getEngine() {
47
		return engine;
48
	}
49

  
50
	@Required
51
	public void setEngine(final MemEngine engine) {
52
		this.engine = engine;
53
	}
54

  
55
}
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/GraphProcessRegistry.java
1
package eu.dnetlib.msro.worker;
2

  
3
import java.util.ArrayList;
4
import java.util.Collection;
5
import java.util.Date;
6
import java.util.HashMap;
7
import java.util.Map;
8
import java.util.Map.Entry;
9

  
10
import org.apache.commons.logging.Log;
11
import org.apache.commons.logging.LogFactory;
12
import org.springframework.beans.factory.annotation.Required;
13

  
14
import com.google.common.collect.BiMap;
15
import com.google.common.collect.HashBiMap;
16
import com.googlecode.sarasvati.GraphProcess;
17

  
18
public class GraphProcessRegistry {
19

  
20
	private static final Log log = LogFactory.getLog(GraphProcessRegistry.class);
21

  
22
	private BiMap<String, GraphProcess> procs = HashBiMap.create();
23
	private Map<String, Collection<GraphProcess>> byResource = new HashMap<String, Collection<GraphProcess>>();
24

  
25
	private int maxSize;
26

  
27
	public GraphProcess findProcess(final String identifier) {
28
		return procs.get(identifier);
29
	}
30

  
31
	public Collection<GraphProcess> findProcessesByResource(final String identifier) {
32
		synchronized (this) {
33
			final Collection<GraphProcess> res = byResource.get(identifier);
34
			if (res == null) { return new ArrayList<GraphProcess>(); }
35
			return res;
36
		}
37
	}
38

  
39
	public String associateProcessWithResource(final GraphProcess process, final String identifier) {
40
		registerProcess(process);
41
		synchronized (this) {
42
			final Collection<GraphProcess> processes = findProcessesByResource(identifier);
43
			processes.add(process);
44
			byResource.put(identifier, processes);
45
		}
46
		return identifier;
47
	}
48

  
49
	public String registerProcess(final GraphProcess process) {
50
		if (procs.containsValue(process)) { return procs.inverse().get(process); }
51
		final String id = ProcessUtils.generateProcessId();
52

  
53
		if (procs.size() >= maxSize) {
54
			removeOldestProcess();
55
		}
56

  
57
		procs.put(id, process);
58
		log.info("Registered proc " + process.getGraph().getName() + " with id " + id);
59

  
60
		return id;
61
	}
62

  
63
	public int countRunningWfs() {
64
		int count = 0;
65

  
66
		for (Entry<String, GraphProcess> e : procs.entrySet()) {
67
			final GraphProcess proc = e.getValue();
68

  
69
			if (!proc.isComplete() && !proc.isCanceled()) {
70
				count++;
71
			}
72
		}
73

  
74
		return count;
75
	}
76

  
77
	private void removeOldestProcess() {
78
		Date oldDate = new Date();
79
		String oldId = null;
80

  
81
		for (Entry<String, GraphProcess> e : procs.entrySet()) {
82
			final GraphProcess proc = e.getValue();
83

  
84
			if (proc.isComplete() || proc.isCanceled()) {
85
				final Date date = ProcessUtils.calculateLastActivityDate(proc);
86
				if (date.before(oldDate)) {
87
					oldDate = date;
88
					oldId = e.getKey();
89
				}
90
			}
91
		}
92

  
93
		if (oldId != null) {
94
			unregisterProcess(oldId);
95
		}
96

  
97
	}
98

  
99
	public void unregisterProcess(final String identifier) {
100
		final GraphProcess process = findProcess(identifier); // NOPMD
101
		procs.remove(identifier);
102

  
103
		for (final Collection<GraphProcess> processes : byResource.values()) {
104
			processes.remove(process);
105
		}
106
	}
107

  
108
	public Collection<String> listProcIds() {
109
		return procs.keySet();
110
	}
111

  
112
	public Map<String, Collection<GraphProcess>> getByResource() {
113
		return byResource;
114
	}
115

  
116
	public int getMaxSize() {
117
		return maxSize;
118
	}
119

  
120
	@Required
121
	public void setMaxSize(final int maxSize) {
122
		this.maxSize = maxSize;
123
	}
124

  
125
}
modules/dnet-node-services/trunk/src/main/java/eu/dnetlib/msro/worker/WorkflowExecutor.java
1
package eu.dnetlib.msro.worker;
2

  
3
import java.io.File;
4
import java.util.Comparator;
5
import java.util.Map;
6
import java.util.concurrent.Executors;
7
import java.util.concurrent.PriorityBlockingQueue;
8
import java.util.concurrent.ScheduledExecutorService;
9
import java.util.concurrent.TimeUnit;
10

  
11
import org.apache.commons.lang.StringUtils;
12
import org.apache.commons.lang.math.NumberUtils;
13
import org.apache.commons.logging.Log;
14
import org.apache.commons.logging.LogFactory;
15
import org.springframework.beans.factory.annotation.Required;
16

  
17
import com.googlecode.sarasvati.Graph;
18
import com.googlecode.sarasvati.GraphProcess;
19
import com.googlecode.sarasvati.mem.MemEngine;
20
import com.googlecode.sarasvati.mem.MemGraphProcess;
21

  
22
import eu.dnetlib.common.ifaces.Stoppable;
23
import eu.dnetlib.common.ifaces.StoppableDetails;
24
import eu.dnetlib.common.ifaces.StoppableDetails.StopStatus;
25
import eu.dnetlib.miscutils.DateUtils;
26
import eu.dnetlib.rmi.blackboard.LaunchWorkflowMessage;
27
import eu.dnetlib.rmi.soap.exceptions.ManagerServiceException;
28

  
29
public class WorkflowExecutor implements Stoppable {
30

  
31
	private MemEngine engine;
32
	private GraphLoader graphLoader;
33
	private GraphProcessRegistry graphProcessRegistry;
34
	private ScheduledExecutorService queueConsumers;
35

  
36
	private boolean paused = false;
37

  
38
	private static final Log log = LogFactory.getLog(WorkflowExecutor.class);
39

  
40
	private PriorityBlockingQueue<GraphProcess> pendingProcs = new PriorityBlockingQueue<GraphProcess>(20, new Comparator<GraphProcess>() {
41

  
42
		@Override
43
		public int compare(final GraphProcess p1, final GraphProcess p2) {
44
			int n1 = NumberUtils.toInt(p1.getEnv().getAttribute(WorkflowConstants.SYSTEM_WF_PRIORITY), WorkflowConstants.DEFAULT_WF_PRIORITY);
45
			int n2 = NumberUtils.toInt(p2.getEnv().getAttribute(WorkflowConstants.SYSTEM_WF_PRIORITY), WorkflowConstants.DEFAULT_WF_PRIORITY);
46
			return NumberUtils.compare(n1, n2);
47
		}
48
	});
49

  
50
	public void init() {
51
		this.queueConsumers = Executors.newScheduledThreadPool(WorkflowConstants.MAX_WF_THREADS);
52
		final int period = 60;
53
		final int step = period / WorkflowConstants.MAX_WF_THREADS;
54

  
55
		for (int i = 0; i < WorkflowConstants.MAX_WF_THREADS; i++) {
56
			this.queueConsumers.scheduleAtFixedRate(new Runnable() {
57

  
58
				@Override
59
				public void run() {
60
					if (isPaused()) {
61
					return;
62
					}
63

  
64
					final GraphProcess process = pendingProcs.poll();
65
					if (process != null) {
66
						log.info("Starting workflow: " + process);
67
						final long now = DateUtils.now();
68
						process.getEnv().setAttribute(WorkflowConstants.SYSTEM_START_DATE, now);
69
						process.getEnv().setAttribute(WorkflowConstants.SYSTEM_START_HUMAN_DATE, DateUtils.getDate_ISO8601(now));
70
						engine.startProcess(process);
71
					} else {
72
						log.debug("Process queue is empty");
73
					}
74
				}
75
			}, i * step, period, TimeUnit.SECONDS);
76
		}
77
	}
78

  
79
	public String startProcess(final LaunchWorkflowMessage wf) throws Exception {
80
		if (isPaused()) {
81
			log.warn("Wf not launched, because WorkflowExecutor is preparing for shutdown");
82
			throw new ManagerServiceException("WorkflowExecutor is preparing for shutdown");
83
		}
84

  
85
		if (pendingProcs.size() > WorkflowConstants.MAX_PENDING_PROCS_SIZE) {
86
			log.warn("Wf not launched, Max number of pending procs reached: " + WorkflowConstants.MAX_PENDING_PROCS_SIZE);
87
			throw new ManagerServiceException("Max number of pending procs reached: " + WorkflowConstants.MAX_PENDING_PROCS_SIZE);
88
		}
89

  
90
		final File tmpFile = File.createTempFile("wftfs", null);
91
		try {
92
			final Graph graph = graphLoader.loadGraph(wf.getWorkflowXml());
93
			final GraphProcess process = new MemGraphProcess(graph);
94
			final String procId = graphProcessRegistry.registerProcess(process);
95

  
96
			if (StringUtils.isNotBlank(wf.getId())) {
97
				graphProcessRegistry.associateProcessWithResource(process, wf.getId());
98
				process.getEnv().setAttribute(WorkflowConstants.SYSTEM_WF_PROFILE_ID, wf.getId());
99
			}
100

  
101
			process.getEnv().setAttribute(WorkflowConstants.SYSTEM_WF_PROCESS_ID, procId);
102
			process.getEnv().setAttribute(WorkflowConstants.SYSTEM_WF_PROFILE_NAME, wf.getName());
103
			process.getEnv().setAttribute(WorkflowConstants.SYSTEM_WF_NAME, graph.getName());
104
			process.getEnv().setAttribute(WorkflowConstants.SYSTEM_WF_PROFILE_FAMILY, wf.getType());
105
			process.getEnv().setAttribute(WorkflowConstants.SYSTEM_WF_PRIORITY, wf.getPriority());
106

  
107
			if (wf.getParams() != null) {
108
				for (Map.Entry<String, String> e : wf.getParams().entrySet()) {
109
					process.getEnv().setAttribute(e.getKey(), e.getValue());
110
				}
111
			}
112

  
113
			log.info("Process " + process + " in queue, priority=" + wf.getPriority());
114
			pendingProcs.put(process);
115

  
116
			return procId;
117
		} catch (Exception e) {
118
			log.error("Error parsing workflow xml: " + wf.getWorkflowXml(), e);
119
			throw new IllegalArgumentException("Error parsing workflow");
120
		} finally {
121
			tmpFile.delete();
122
		}
123
	}
124

  
125
	public GraphLoader getGraphLoader() {
126
		return graphLoader;
127
	}
128

  
129
	@Required
130
	public void setGraphLoader(final GraphLoader graphLoader) {
131
		this.graphLoader = graphLoader;
132
	}
133

  
134
	public MemEngine getEngine() {
135
		return engine;
136
	}
137

  
138
	@Required
139
	public void setEngine(final MemEngine engine) {
140
		this.engine = engine;
141
	}
142

  
143
	public GraphProcessRegistry getGraphProcessRegistry() {
144
		return graphProcessRegistry;
145
	}
146

  
147
	@Required
148
	public void setGraphProcessRegistry(final GraphProcessRegistry graphProcessRegistry) {
149
		this.graphProcessRegistry = graphProcessRegistry;
150
	}
151

  
152
	@Override
153
	public void stop() {
154
		this.paused = true;
155
	}
156

  
157
	@Override
158
	public void resume() {
159
		this.paused = false;
160
	}
161

  
162
	public boolean isPaused() {
163
		return paused;
164
	}
165

  
166
	public void setPaused(final boolean paused) {
167
		this.paused = paused;
168
	}
169

  
170
	@Override
171
	public StoppableDetails getStopDetails() {
172
		final int count = graphProcessRegistry.countRunningWfs();
173

  
174
		StoppableDetails.StopStatus status = StopStatus.RUNNING;
175
		if (isPaused()) {
176
			if (count == 0) {
177
				status = StopStatus.STOPPED;
178
			} else {
179
				status = StopStatus.STOPPING;
180
			}
181
		}
182
		// graphProcessRegistry.listProcIds();
183

  
184
		return new StoppableDetails("D-NET workflow manager", "Running workflows: " + count, status);
185
	}
186

  
187
}
modules/dnet-node-services/trunk/pom.xml
32 32
			<artifactId>commons-httpclient</artifactId>
33 33
			<version>3.1</version>
34 34
		</dependency>
35
				<dependency>
36
			<groupId>com.googlecode</groupId>
37
			<artifactId>sarasvati</artifactId>
38
			<version>1.0.3</version>
39
		</dependency>
40
		<dependency>
41
			<groupId>com.googlecode</groupId>
42
			<artifactId>sarasvati-visual</artifactId>
43
			<version>1.0.3</version>
44
		</dependency>
45
		
35 46
		<!-- Tests -->
36 47
		<dependency>
37 48
			<groupId>org.mockito</groupId>

Also available in: Unified diff