use of es.bsc.compss.types.data.LogicalData in project compss by bsc-wdc.
the class Comm method registerValue.
/**
* Registers a new value @value for the data with id @dataId dataId must exist
*
* @param dataId
* @param value
* @return
*/
public static synchronized LogicalData registerValue(String dataId, Object value) {
LOGGER.debug("Register value " + value + " for data " + dataId);
String targetPath = Protocol.OBJECT_URI.getSchema() + dataId;
DataLocation location = null;
try {
SimpleURI uri = new SimpleURI(targetPath);
location = DataLocation.createLocation(appHost, uri);
} catch (IOException e) {
ErrorManager.error(DataLocation.ERROR_INVALID_LOCATION + " " + targetPath, e);
}
LogicalData logicalData = data.get(dataId);
logicalData.addLocation(location);
logicalData.setValue(value);
// Register PSCO Location if needed it's PSCO and it's persisted
if (value instanceof StubItf) {
String id = ((StubItf) value).getID();
if (id != null) {
Comm.registerPSCO(dataId, id);
}
}
return logicalData;
}
use of es.bsc.compss.types.data.LogicalData in project compss by bsc-wdc.
the class Comm method clearValue.
/**
* Clears the value of the data id @dataId
*
* @param dataId
* @return
*/
public static synchronized Object clearValue(String dataId) {
LOGGER.debug("Clear value of data " + dataId);
LogicalData logicalData = data.get(dataId);
return logicalData.removeValue();
}
use of es.bsc.compss.types.data.LogicalData in project compss by bsc-wdc.
the class Comm method registerPSCO.
/**
* Registers a new PSCO id @id for the data with id @dataId dataId must exist
*
* @param dataId
* @param id
* @return
*/
public static synchronized LogicalData registerPSCO(String dataId, String id) {
String targetPath = Protocol.PERSISTENT_URI.getSchema() + id;
DataLocation location = null;
try {
SimpleURI uri = new SimpleURI(targetPath);
location = DataLocation.createLocation(appHost, uri);
} catch (IOException ioe) {
ErrorManager.error(DataLocation.ERROR_INVALID_LOCATION + " " + targetPath, ioe);
}
LogicalData logicalData = data.get(dataId);
logicalData.addLocation(location);
return logicalData;
}
use of es.bsc.compss.types.data.LogicalData in project compss by bsc-wdc.
the class Comm method registerLocation.
/**
* Registers a new location @location for the data with id @dataId dataId must exist
*
* @param dataId
* @param location
* @return
*/
public static synchronized LogicalData registerLocation(String dataId, DataLocation location) {
LOGGER.debug("Registering new Location for data " + dataId + ":");
LOGGER.debug(" * Location: " + location);
LogicalData logicalData = data.get(dataId);
logicalData.addLocation(location);
return logicalData;
}
use of es.bsc.compss.types.data.LogicalData in project compss by bsc-wdc.
the class Comm method removeData.
/**
* Removes the data with id @renaming
*
* @param renaming
*/
public static synchronized void removeData(String renaming) {
LOGGER.debug("Remove data " + renaming);
LogicalData ld = data.remove(renaming);
ld.isObsolete();
for (DataLocation dl : ld.getLocations()) {
MultiURI uri = dl.getURIInHost(appHost);
if (uri != null) {
File f = new File(uri.getPath());
if (f.exists()) {
LOGGER.info("Deleting file " + f.getAbsolutePath());
if (!f.delete()) {
LOGGER.error("Cannot delete file " + f.getAbsolutePath());
}
}
}
}
}
Aggregations