use of org.identityconnectors.framework.impl.api.local.operations.ConnectorOperationalContext in project midpoint by Evolveum.
the class ConnectorInstanceConnIdImpl method getOperationalStatus.
@Override
public ConnectorOperationalStatus getOperationalStatus() throws ObjectNotFoundException {
if (!(connectorInfo instanceof LocalConnectorInfoImpl)) {
LOGGER.trace("Cannot get operational status of a remote connector {}", connectorType);
return null;
}
if (apiConfig == null) {
LOGGER.trace("Cannot get operational status of a connector {}: connector not yet configured", connectorType);
throw new IllegalStateException("Connector " + connectorType + " not yet configured");
}
ConnectorOperationalStatus status = new ConnectorOperationalStatus();
ConnectorOperationalContext connectorOperationalContext = new ConnectorOperationalContext((LocalConnectorInfoImpl) connectorInfo, (APIConfigurationImpl) apiConfig);
Class<? extends Connector> connectorClass = connectorOperationalContext.getConnectorClass();
if (connectorClass != null) {
status.setConnectorClassName(connectorClass.getName());
}
ObjectPoolConfiguration poolConfiguration = apiConfig.getConnectorPoolConfiguration();
if (poolConfiguration != null) {
status.setPoolConfigMaxSize(poolConfiguration.getMaxObjects());
status.setPoolConfigMinIdle(poolConfiguration.getMinIdle());
status.setPoolConfigMaxIdle(poolConfiguration.getMaxIdle());
status.setPoolConfigWaitTimeout(poolConfiguration.getMaxWait());
status.setPoolConfigMinEvictableIdleTime(poolConfiguration.getMinEvictableIdleTimeMillis());
status.setPoolConfigMaxIdleTime(poolConfiguration.getMaxIdleTimeMillis());
}
ObjectPool<PoolableConnector> pool = connectorOperationalContext.getPool();
if (pool != null) {
Statistics poolStats = pool.getStatistics();
if (poolStats != null) {
status.setPoolStatusNumActive(poolStats.getNumActive());
status.setPoolStatusNumIdle(poolStats.getNumIdle());
}
}
return status;
}
Aggregations