Open DBEntry using AL5 URI with legacy parametersΒΆ
This example focuses on opening DBEntry using legacy parameters in URI.
See also
API documentation for imas.open
public static void openDBEntryURI() throws Exception {
String user = System.getenv("USER");
String dbName = "test";
String ddMajorVersion = "3";
int pulse = 1;
int run = 10;
String backend = "hdf5";
/*
Format URI with required data.
Available backends:
ascii - only for debugging purposes
mdsplus
hdf5
memory - data is lost after entry is closed
uda
*/
String uri = String.format("imas:%s?user=%s;pulse=%s;run=%s;database=%s;version=%s",
backend,user,pulse,run,dbName,ddMajorVersion);
int entry = 0;
try {
/*
Open existing entry with given mode, catch exceptions if failed
Available modes:
OPEN_PULSE - Opens the access to the data only if the Data Entry exists, returns error otherwise.
FORCE_OPEN_PULSE - Opens access to the data, creates the Data Entry if it does not exists yet.
CREATE_PULSE - Creates a new empty Data Entry (returns error if Data Entry already exists) and opens it at the same time.
FORCE_CREATE_PULSE - Creates an empty Data Entry (overwrites if Data Entry already exists) and opens it at the same time.
*/
entry = imas.open(uri, LowLevel.OPEN_PULSE);
/*
* You can access IDSes in here - take a look at sample code dealing with IDSes for details
*/
} catch (Exception e) {
System.err.println("\nFailed to open DBEntry with URI\n" + e.getMessage());
throw e;
} finally {
imas.close(entry);
}
}