-
Notifications
You must be signed in to change notification settings - Fork 5
Data Access Manager
calltl edited this page Feb 25, 2013
·
5 revisions
The data access manager is a core Gumtree API service to retrieving resources(text, image, data object, service object etc) using a uniform resource identifier (URI). This programming style is known as resource oriented architecture, and is commonly used for RESTful web services.
The data access manager can be extended by providing:
- IDataProvider to accept new URI schemes
- IDataConverter to convert new representations
Clients can register IDataChangeListener to the data access manager for getting data update events from the manager.
import org.eclipse.swt.graphics.Image;
import org.gumtree.core.service.ServiceUtils;
import org.gumtree.service.dataaccess.IDataAccessManager;
// Get data access manager
IDataAccessManager dam = ServiceUtils.getService(IDataAccessManager.class);
// Load an online image into a SWT image object
Image webImage = dam.(URI.create("http://somehost/image.png"), Image.class);
// Create listener
IDataChangeListener listener = new DataChangeAdapter<String>("sics://hdb/user/name") {
public void handleData(String data) {
updateText(data);
}
};
// Register to the manager
dataAccessManager.addDataChangeListener(listener);
Home | Developer Guide | Copyright © 2013 ANSTO