<!ELEMENT extension (resourceAdapter* | resourceFactory*)+>
<!ATTLIST extension
point CDATA #REQUIRED
id CDATA #IMPLIED
name CDATA #IMPLIED>
<!ELEMENT resourceAdapter EMPTY>
<!ATTLIST resourceAdapter
resource_adapter CDATA #IMPLIED>
<!ELEMENT resourceFactory EMPTY>
<!ATTLIST resourceFactory
resource_factory CDATA #IMPLIED>
public class ReadOnlyEAResourceAdapter extends AdapterImpl {
@Override
public void notifyChanged(Notification notification) {
if (notification.getEventType() == Notification.SET && notification.getNotifier() instanceof EAResource) {
final EAResource resource = (EAResource) notification.getNotifier();
// no further need for this adapter
resource.eAdapters().remove(this);
// always load models read-only
resource.getDefaultLoadOptions().put(EAResource.OPTION_READONLY, Boolean.TRUE);
}
}
}