Skip to content

Instantly share code, notes, and snippets.

@grahamb
Created January 12, 2024 00:11
Show Gist options
  • Save grahamb/f9cc16a28de7b29665f3bd9b81aa34af to your computer and use it in GitHub Desktop.
Save grahamb/f9cc16a28de7b29665f3bd9b81aa34af to your computer and use it in GitHub Desktop.
ScriptedSQL
<!--Adapted from https://github.com/Evolveum/midpoint-samples/blob/master/samples/resources/scriptedsql/ScriptedSQL.xml-->
<resource xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3"
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3"
oid="df8f7ccc-6e2f-4ad2-a7e1-5222dc23ab1c"
version="0"
>
<!-- Tell midPoint what kind of connector this is-->
<connectorRef type="ConnectorType">
<filter>
<q:equal>
<q:path>connectorType</q:path>
<q:value>com.evolveum.polygon.connector.scripted.sql.ScriptedSQLConnector</q:value>
</q:equal>
</filter>
</connectorRef>
<!-- Resource name as it will be displayd in the GUI-->
<name>SORObjectDB ScriptedSQL</name>
<!-- Connector configuration -->
<c:connectorConfiguration>
<icfc:resultsHandlerConfiguration>
<icfc:enableNormalizingResultsHandler>false</icfc:enableNormalizingResultsHandler>
<icfc:enableFilteredResultsHandler>false</icfc:enableFilteredResultsHandler>
<icfc:filteredResultsHandlerInValidationMode>true</icfc:filteredResultsHandlerInValidationMode>
<icfc:enableAttributesToGetSearchResultsHandler>false</icfc:enableAttributesToGetSearchResultsHandler>
</icfc:resultsHandlerConfiguration>
<!-- Configuration specific for the ScriptedSQL connector - database connection details, script paths, etc -->
<icfc:configurationProperties
xmlns:icscscriptedsql="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/com.evolveum.polygon.connector-scripted-sql/com.evolveum.polygon.connector.scripted.sql.ScriptedSQLConnector">
<!-- <icscscriptedsql:createScriptFileName>CreateScript.groovy</icscscriptedsql:createScriptFileName>-->
<!-- <icscscriptedsql:updateScriptFileName>UpdateScript.groovy</icscscriptedsql:updateScriptFileName>-->
<!-- <icscscriptedsql:deleteScriptFileName>DeleteScript.groovy</icscscriptedsql:deleteScriptFileName>-->
<!-- <icscscriptedsql:schemaScriptFileName>SchemaScript.groovy</icscscriptedsql:schemaScriptFileName>-->
<!-- <icscscriptedsql:searchScriptFileName>SearchScript.groovy</icscscriptedsql:searchScriptFileName>-->
<icscscriptedsql:testScriptFileName>TestScript.groovy</icscscriptedsql:testScriptFileName>
<!-- <icscscriptedsql:syncScriptFileName>SyncScript.groovy</icscscriptedsql:syncScriptFileName>-->
<icscscriptedsql:scriptRoots>/opt/midpoint/midpoint_home/sorobject-scripted-sql/
</icscscriptedsql:scriptRoots>
<icscscriptedsql:classpath>.</icscscriptedsql:classpath>
<icscscriptedsql:scriptBaseClass>BaseScript</icscscriptedsql:scriptBaseClass>
<icscscriptedsql:username>midpoint</icscscriptedsql:username>
<icscscriptedsql:password>
<clearValue>$(SORObjectDB_Password)</clearValue>
</icscscriptedsql:password>
<icscscriptedsql:driverClassName>org.postgresql.Driver</icscscriptedsql:driverClassName>
<icscscriptedsql:url>jdbc:postgresql://pgserver:5432/sorobject</icscscriptedsql:url>
</icfc:configurationProperties>
</c:connectorConfiguration>
<!-- Resource Schema Handling definition.
This part defines how the schema defined above will be used by
midPoint. It defines expressions and limitations for individual
schema attributes.
The expressions that describe both inbound and outbound flow of
the attributes are defined in this section.
This is the part where most of the customization takes place.
-->
<schemaHandling>
<!-- Definition of the default account type. This is now the only account type that midPoint can work with. -->
<objectType>
<displayName>Default Account</displayName>
<kind>account</kind>
<intent>default</intent>
<objectClass>ri:AccountObjectClass</objectClass>
<attribute>
<displayName>name</displayName>
<ref>icfs:name</ref>
<limitations>
<access>
<read>true</read>
<add>false</add>
<modify>false</modify>
</access>
</limitations>
<inbound>
<target>
<path>name</path>
</target>
</inbound>
<fetchStrategy>implicit</fetchStrategy>
</attribute>
</objectType>
</schemaHandling>
<capabilities xmlns:cap="http://midpoint.evolveum.com/xml/ns/public/resource/capabilities-3">
<configured>
<cap:pagedSearch/>
<cap:countObjects/>
<cap:create>
<cap:enabled>false</cap:enabled>
</cap:create>
<cap:update>
<cap:enabled>false</cap:enabled>
</cap:update>
<cap:delete>
<cap:enabled>false</cap:enabled>
</cap:delete>
<cap:liveSync>
<cap:preciseTokenValue>false</cap:preciseTokenValue>
</cap:liveSync>
<cap:testConnection>
<cap:enabled>true</cap:enabled>
</cap:testConnection>
</configured>
</capabilities>
</resource>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment