Search in sources :

Example 1 with Severity

use of org.teiid.adminapi.impl.ModelMetaData.Message.Severity in project teiid by teiid.

the class VDBStatusChecker method checkStatus.

private void checkStatus(List<Runnable> runnables, VDBMetaData vdb, ModelMetaData model, ConnectorManager cm) {
    // get the pending metadata load
    model.removeAttachment(VDBStatusChecker.class);
    Runnable r = model.removeAttachment(Runnable.class);
    if (r != null) {
        runnables.add(r);
    } else {
        String status = cm.getStausMessage();
        if (status != null && status.length() > 0) {
            Severity severity = vdb.getStatus() == Status.LOADING ? Severity.WARNING : Severity.ERROR;
            model.addRuntimeMessage(severity, status);
            LogManager.logInfo(LogConstants.CTX_RUNTIME, status);
        } else if (vdb.getStatus() != Status.LOADING) {
            model.clearRuntimeMessages();
        } else {
            // mark the model to indicate that it should be reloaded if it
            // is currently failing a load
            model.addAttchment(VDBStatusChecker.class, this);
        }
    }
}
Also used : Severity(org.teiid.adminapi.impl.ModelMetaData.Message.Severity)

Example 2 with Severity

use of org.teiid.adminapi.impl.ModelMetaData.Message.Severity in project teiid by teiid.

the class VDBStatusChecker method dataSourceRemoved.

/**
 * @param dataSourceName
 * @param vdbKey which cannot be null
 */
public void dataSourceRemoved(String dataSourceName, VDBKey vdbKey) {
    dataSourceName = stripContext(dataSourceName);
    CompositeVDB cvdb = getVDBRepository().getCompositeVDB(vdbKey);
    if (cvdb == null) {
        return;
    }
    VDBMetaData vdb = cvdb.getVDB();
    if (vdb.getStatus() == Status.FAILED) {
        return;
    }
    synchronized (vdb) {
        ConnectorManagerRepository cmr = vdb.getAttachment(ConnectorManagerRepository.class);
        for (ModelMetaData model : vdb.getModelMetaDatas().values()) {
            String sourceName = getSourceName(dataSourceName, model);
            if (sourceName == null) {
                continue;
            }
            Severity severity = Severity.WARNING;
            ConnectorManager cm = cmr.getConnectorManager(sourceName);
            if (cm.getExecutionFactory().isSourceRequired() && vdb.getStatus() == Status.ACTIVE) {
                severity = Severity.ERROR;
            }
            String msg = RuntimePlugin.Util.gs(RuntimePlugin.Event.TEIID40012, vdb.getName(), vdb.getVersion(), dataSourceName);
            model.addRuntimeMessage(severity, msg);
            LogManager.logInfo(LogConstants.CTX_RUNTIME, msg);
        }
    }
}
Also used : ConnectorManagerRepository(org.teiid.dqp.internal.datamgr.ConnectorManagerRepository) VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) Severity(org.teiid.adminapi.impl.ModelMetaData.Message.Severity) ConnectorManager(org.teiid.dqp.internal.datamgr.ConnectorManager) ModelMetaData(org.teiid.adminapi.impl.ModelMetaData)

Aggregations

Severity (org.teiid.adminapi.impl.ModelMetaData.Message.Severity)2 ModelMetaData (org.teiid.adminapi.impl.ModelMetaData)1 VDBMetaData (org.teiid.adminapi.impl.VDBMetaData)1 ConnectorManager (org.teiid.dqp.internal.datamgr.ConnectorManager)1 ConnectorManagerRepository (org.teiid.dqp.internal.datamgr.ConnectorManagerRepository)1