Package org.apache.stanbol.cmsadapter.servicesapi.model.web.decorated

Examples of org.apache.stanbol.cmsadapter.servicesapi.model.web.decorated.AdapterMode


            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();
View Full Code Here

TOP

Related Classes of org.apache.stanbol.cmsadapter.servicesapi.model.web.decorated.AdapterMode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.