this.ontModel = conf.getOntModel();
} else {
this.ontModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM);
}
AdapterMode adapterMode = conf.getAdapterMode();
if (adapterMode == null) {
adapterMode = AdapterMode.ONLINE;
}
ConnectionInfo connectionInfo = conf.getConnectionInfo();
if (connectionInfo == null) {
if (!adapterMode.equals(AdapterMode.STRICT_OFFLINE)) {
connectionInfo = OntologyResourceHelper.getConnectionInfo(this.ontModel);
if (connectionInfo == null) {
logger.warn("Failed to retrieve connection info from ontmodel");
throw new RuntimeException("Failed to retrieve connection info from ontmodel");
}
}
}
List<Object> offlineObjects = conf.getObjects();
if (adapterMode.equals(AdapterMode.ONLINE)) {
accessor = accessManager.getRepositoryAccessor(connectionInfo);
this.session = accessor.getSession(connectionInfo);
this.adapter = new DObjectFactoryImp(accessor, session);
} else if (adapterMode.equals(AdapterMode.TOLERATED_OFFLINE)) {
try {
accessor = accessManager.getRepositoryAccessor(connectionInfo);
this.session = accessor.getSession(connectionInfo);
RepositoryAccess offlineAccess = accessManager.getRepositoryAccess(offlineObjects);
this.adapter = new DObjectFactoryImp(accessor, offlineAccess, session, adapterMode);
} catch (RepositoryAccessException e) {
accessor = accessManager.getRepositoryAccess(offlineObjects);
this.adapter = new DObjectFactoryImp(accessor, session, AdapterMode.STRICT_OFFLINE);
}
} else if (adapterMode.equals(AdapterMode.STRICT_OFFLINE)) {
accessor = accessManager.getRepositoryAccess(offlineObjects);
this.adapter = new DObjectFactoryImp(accessor, session, adapterMode);
}
this.bridgeDefinitions = conf.getBridgeDefinitions();