use of org.identityconnectors.framework.common.objects.Schema in project midpoint by Evolveum.
the class ConnectorInstanceConnIdImpl method retrieveResourceSchema.
private void retrieveResourceSchema(List<QName> generateObjectClasses, OperationResult parentResult) throws CommunicationException, ConfigurationException, GenericFrameworkException {
// Connector operation cannot create result for itself, so we need to
// create result for it
OperationResult icfResult = parentResult.createSubresult(ConnectorFacade.class.getName() + ".schema");
icfResult.addContext("connector", connIdConnectorFacade.getClass());
org.identityconnectors.framework.common.objects.Schema icfSchema = null;
try {
// Fetch the schema from the connector (which actually gets that
// from the resource).
InternalMonitor.recordConnectorOperation("schema");
// TODO have context present
//recordIcfOperationStart(reporter, ProvisioningOperation.ICF_GET_SCHEMA, null);
icfSchema = connIdConnectorFacade.schema();
//recordIcfOperationEnd(reporter, ProvisioningOperation.ICF_GET_SCHEMA, null);
icfResult.recordSuccess();
} catch (UnsupportedOperationException ex) {
//recordIcfOperationEnd(reporter, ProvisioningOperation.ICF_GET_SCHEMA, null, ex);
// The connector does no support schema() operation.
icfResult.recordStatus(OperationResultStatus.NOT_APPLICABLE, ex.getMessage());
resetResourceSchema();
return;
} catch (Throwable ex) {
//recordIcfOperationEnd(reporter, ProvisioningOperation.ICF_GET_SCHEMA, null, ex);
// conditions.
// Therefore this kind of heavy artillery is necessary.
// ICF interface does not specify exceptions or other error
// TODO maybe we can try to catch at least some specific exceptions
Throwable midpointEx = processIcfException(ex, this, icfResult);
// exception
if (midpointEx instanceof CommunicationException) {
icfResult.recordFatalError(midpointEx.getMessage(), midpointEx);
throw (CommunicationException) midpointEx;
} else if (midpointEx instanceof ConfigurationException) {
icfResult.recordFatalError(midpointEx.getMessage(), midpointEx);
throw (ConfigurationException) midpointEx;
} else if (midpointEx instanceof GenericFrameworkException) {
icfResult.recordFatalError(midpointEx.getMessage(), midpointEx);
throw (GenericFrameworkException) midpointEx;
} else if (midpointEx instanceof RuntimeException) {
icfResult.recordFatalError(midpointEx.getMessage(), midpointEx);
throw (RuntimeException) midpointEx;
} else if (midpointEx instanceof Error) {
icfResult.recordFatalError(midpointEx.getMessage(), midpointEx);
throw (Error) midpointEx;
} else {
icfResult.recordFatalError(midpointEx.getMessage(), midpointEx);
throw new SystemException("Got unexpected exception: " + ex.getClass().getName() + ": " + ex.getMessage(), ex);
}
}
if (icfSchema == null) {
icfResult.recordStatus(OperationResultStatus.NOT_APPLICABLE, "Null schema returned");
resetResourceSchema();
return;
}
parseResourceSchema(icfSchema, generateObjectClasses);
}
use of org.identityconnectors.framework.common.objects.Schema in project midpoint by Evolveum.
the class ConnIdCapabilitiesAndSchemaParser method fetchConnIdSchema.
private Schema fetchConnIdSchema(OperationResult parentResult) throws CommunicationException, ConfigurationException, GenericFrameworkException {
// Connector operation cannot create result for itself, so we need to create result for it
OperationResult result = parentResult.createSubresult(OP_SCHEMA);
result.addContext("connector", connIdConnectorFacade.getClass());
try {
LOGGER.debug("Fetching schema from {}", connectorHumanReadableName);
// Fetch the schema from the connector (which actually gets that from the resource).
InternalMonitor.recordConnectorOperation("schema");
// TODO have context present
Schema connIdSchema = connIdConnectorFacade.schema();
if (connIdSchema == null) {
result.recordStatus(OperationResultStatus.NOT_APPLICABLE, "Null schema returned");
} else {
result.recordSuccess();
}
return connIdSchema;
} catch (UnsupportedOperationException ex) {
// recordIcfOperationEnd(reporter, ProvisioningOperation.ICF_GET_SCHEMA, null, ex);
// The connector does no support schema() operation.
result.recordStatus(OperationResultStatus.NOT_APPLICABLE, ex.getMessage());
return null;
} catch (Throwable ex) {
// recordIcfOperationEnd(reporter, ProvisioningOperation.ICF_GET_SCHEMA, null, ex);
// conditions.
// Therefore this kind of heavy artillery is necessary.
// ICF interface does not specify exceptions or other error
// TODO maybe we can try to catch at least some specific exceptions
Throwable midpointEx = ConnIdUtil.processConnIdException(ex, connectorHumanReadableName, result);
result.recordFatalError(midpointEx.getMessage(), midpointEx);
castAndThrowException(ex, midpointEx);
throw new AssertionError("not here");
} finally {
result.close();
}
}
use of org.identityconnectors.framework.common.objects.Schema in project CzechIdMng by bcvsolutions.
the class ConnIdIcConfigurationService method getSchema.
@Override
public IcSchema getSchema(IcConnectorInstance connectorInstance, IcConnectorConfiguration connectorConfiguration) {
Assert.notNull(connectorInstance.getConnectorKey());
Assert.notNull(connectorConfiguration);
if (connectorInstance.isRemote()) {
LOG.info(MessageFormat.format("Get Schema of remote connector - ConnId ({0})", connectorInstance.getConnectorServer().getFullServerName()));
} else {
LOG.info(MessageFormat.format("Get Schema - ConnId ({0})", connectorInstance.getConnectorKey().toString()));
}
ConnectorFacade conn = getConnectorFacade(connectorInstance, connectorConfiguration);
Schema schema = conn.schema();
return ConnIdIcConvertUtil.convertConnIdSchema(schema);
}
use of org.identityconnectors.framework.common.objects.Schema in project midpoint by Evolveum.
the class ConnIdCapabilitiesAndSchemaParser method retrieveResourceCapabilitiesAndSchema.
/**
* Retrieves and parses resource capabilities and schema.
*
* Schema is immutable after this method.
*/
void retrieveResourceCapabilitiesAndSchema(List<QName> generateObjectClasses, OperationResult result) throws CommunicationException, ConfigurationException, GenericFrameworkException, SchemaException {
fetchSupportedOperations(result);
// sets supportsSchema flag
processOperationCapabilities();
if (supportsSchema) {
Schema connIdSchema = fetchConnIdSchema(result);
if (connIdSchema == null) {
addBasicReadCapability();
} else {
parseResourceSchema(connIdSchema, generateObjectClasses);
}
}
}
Aggregations