Project

General

Profile

« Previous | Next » 

Revision 42200

introduced creation/deletion of ActionSet directory on HDFS

View differences:

modules/dnet-actionmanager-service/trunk/src/main/java/eu/dnetlib/actionmanager/hbase/HBaseClient.java
54 54
	@Resource
55 55
	private HadoopServiceCore hadoopServiceCore;
56 56

  
57
	@Autowired
58
	private UniqueServiceLocator serviceLocator;
59

  
60 57
	private final Function<Result, Map<String, String>> transformRow = new Function<Result, Map<String, String>>() {
61 58

  
62 59
		@Override
......
109 106
	}
110 107

  
111 108
	private void prepareBasePath() throws ISLookUpException, HadoopServiceException {
112
		final String basePath = serviceLocator.getService(ISLookUpService.class).getResourceProfileByQuery(
113
				"/RESOURCE_PROFILE[./HEADER/RESOURCE_TYPE/@value='ActionManagerServiceResourceType']//SERVICE_PROPERTIES/PROPERTY[@key='basePath']/@value/string()");
114

  
109
		final String basePath = hadoopServiceCore.getBasePathHDFS();
115 110
		hadoopServiceCore.createHdfsDir(ClusterName.DM, basePath, false);
116 111
	}
117 112

  
modules/dnet-actionmanager-service/trunk/src/main/java/eu/dnetlib/actionmanager/ActionManagerServiceImpl.java
2 2

  
3 3
import java.util.List;
4 4

  
5
import javax.annotation.Resource;
5 6
import javax.jws.WebParam;
6 7

  
8
import eu.dnetlib.data.hadoop.HadoopServiceCore;
9
import eu.dnetlib.data.hadoop.config.ClusterName;
10
import eu.dnetlib.data.hadoop.rmi.HadoopServiceException;
11
import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
12
import org.apache.hadoop.fs.Path;
7 13
import org.springframework.beans.factory.annotation.Required;
8 14

  
9 15
import eu.dnetlib.actionmanager.actions.XsltInfoPackageAction;
......
23 29

  
24 30
	private NotificationHandler notificationHandler;
25 31

  
32
	@Resource
33
	private HadoopServiceCore hadoopServiceCore;
34

  
26 35
	@Override
27 36
	public String createSet(@WebParam(name = "set") final ActionManagerSet set) throws ActionManagerException {
28
		return core.getInformationServiceClient().registerSetProfile(set);
37
		try {
38
			final String basePath = hadoopServiceCore.getBasePathHDFS();
39
			final Path actionSetPath = new Path(basePath + "/" + set.getId());
40
			hadoopServiceCore.createHdfsDir(ClusterName.DM, actionSetPath.toString(), true);
41
			return core.getInformationServiceClient().registerSetProfile(set);
42
		} catch (HadoopServiceException e) {
43
			throw new ActionManagerException(e);
44
		} catch (ISLookUpException e) {
45
			throw new ActionManagerException(e);
46
		}
29 47
	}
30 48

  
31 49
	@Override
32 50
	public boolean deleteSet(@WebParam(name = "set") final String setId) throws ActionManagerException {
33
		return core.getInformationServiceClient().deleteSetProfile(setId);
51
		try {
52
			final String basePath = hadoopServiceCore.getBasePathHDFS();
53
			final Path actionSetPath = new Path(basePath + "/" + setId);
54
			hadoopServiceCore.deleteFromHdfs(ClusterName.DM, actionSetPath.toString());
55
			return core.getInformationServiceClient().deleteSetProfile(setId);
56
		} catch (HadoopServiceException e) {
57
			throw new ActionManagerException(e);
58
		} catch (ISLookUpException e) {
59
			throw new ActionManagerException(e);
60
		}
34 61
	}
35 62

  
36 63
	@Override

Also available in: Unified diff