<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello Stephen,<br>
    <br>
    please replace <b>gen808:searchScript</b> start and end tags by <b>gen808:searchScriptFileName</b>.
    Currently,
    "/opt/midpoint/config/scripted_connectors/uic_iam_scripts/SearchScript.groovy"
    is interpreted as the actual script (not its file name).<br>
    <br>
    Best regards,<br>
    Pavol<br>
    <br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 16.03.2016 15:39, Stephen Barker
      wrote:<br>
    </div>
    <blockquote cite="mid:56E97038.8050402@illinois.edu" type="cite">Sure
      Thing! It's really basic. The password has been stripped out of
      this configuration.
      <br>
      <br>
      <resource
      xmlns=<a class="moz-txt-link-rfc2396E" href="http://midpoint.evolveum.com/xml/ns/public/common/common-3">"http://midpoint.evolveum.com/xml/ns/public/common/common-3"</a>
      <br>
      <br>
xmlns:icfs=<a class="moz-txt-link-rfc2396E" href="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3">"http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"</a>
      <br>
               
      xmlns:t=<a class="moz-txt-link-rfc2396E" href="http://prism.evolveum.com/xml/ns/public/types-3">"http://prism.evolveum.com/xml/ns/public/types-3"</a>
      <br>
      <br>
xmlns:c=<a class="moz-txt-link-rfc2396E" href="http://midpoint.evolveum.com/xml/ns/public/common/common-3">"http://midpoint.evolveum.com/xml/ns/public/common/common-3"</a>
      <br>
               
      xmlns:q=<a class="moz-txt-link-rfc2396E" href="http://prism.evolveum.com/xml/ns/public/query-3">"http://prism.evolveum.com/xml/ns/public/query-3"</a>
      <br>
      <br>
xmlns:ri=<a class="moz-txt-link-rfc2396E" href="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">"http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"</a>
      <br>
                oid="fe1b0541-9b77-4019-9c76-384839cc09aa"
      <br>
                version="15">
      <br>
         <name>UIC IAM Sim</name>
      <br>
         <metadata>
      <br>
           
<modifyTimestamp>2016-03-16T08:51:09.824-05:00</modifyTimestamp><br>
            <modifierRef
      xmlns:tns=<a class="moz-txt-link-rfc2396E" href="http://midpoint.evolveum.com/xml/ns/public/common/common-3">"http://midpoint.evolveum.com/xml/ns/public/common/common-3"</a>
      <br>
                         oid="00000000-0000-0000-0000-000000000002"
      <br>
                         type="tns:UserType"/>
      <br>
      <br>
<modifyChannel><a class="moz-txt-link-freetext" href="http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user">http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user</a></modifyChannel>
      <br>
         </metadata>
      <br>
         <operationalState>
      <br>
           
      <lastAvailabilityStatus>up</lastAvailabilityStatus>
      <br>
         </operationalState>
      <br>
         <connectorRef oid="3bd53df6-3b55-4aa8-a163-7522424926ea"
      type="c:ConnectorType"><!-- ICF
      net.tirasa.connid.bundles.db.scriptedsql.ScriptedSQLConnector
      v2.2.3 --></connectorRef>
      <br>
         <connectorConfiguration
xmlns:icfc=<a class="moz-txt-link-rfc2396E" href="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3">"http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3"</a>><br>
            <icfc:configurationProperties
xmlns:gen808=<a class="moz-txt-link-rfc2396E" href="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/net.tirasa.connid.bundles.db.scriptedsql/net.tirasa.connid.bundles.db.scriptedsql.ScriptedSQLConnector">"http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/net.tirasa.connid.bundles.db.scriptedsql/net.tirasa.connid.bundles.db.scriptedsql.ScriptedSQLConnector"</a>><br>
      <br>
<gen808:searchScript>/opt/midpoint/config/scripted_connectors/uic_iam_scripts/SearchScript.groovy</gen808:searchScript>
      <br>
      <br>
<gen808:schemaScriptFileName>/opt/midpoint/config/scripted_connectors/uic_iam_scripts/SchemaScript.groovy</gen808:schemaScriptFileName>
      <br>
      <br>
<gen808:reloadScriptOnExecution>true</gen808:reloadScriptOnExecution>
      <br>
              
      <gen808:scriptingLanguage>GROOVY</gen808:scriptingLanguage>
      <br>
               <gen808:user>simuser1</gen808:user>
      <br>
               <gen808:password>
      <br>
               </gen808:password>
      <br>
              
      <gen808:jdbcDriver>com.mysql.jdbc.Driver</gen808:jdbcDriver>
      <br>
      <br>
<gen808:jdbcUrlTemplate>jdbc:mysql://localhost/uiciam</gen808:jdbcUrlTemplate>
      <br>
              
      <gen808:enableEmptyString>true</gen808:enableEmptyString>
      <br>
      <br>
<gen808:rethrowAllSQLExceptions>true</gen808:rethrowAllSQLExceptions>
      <br>
              
      <gen808:nativeTimestamps>true</gen808:nativeTimestamps>
      <br>
               <gen808:allNative>true</gen808:allNative>
      <br>
            </icfc:configurationProperties>
      <br>
         </connectorConfiguration>
      <br>
         <schema>
      <br>
            <cachingMetadata>
      <br>
      <br>
<retrievalTimestamp>2016-03-16T07:50:43.289-05:00</retrievalTimestamp>
      <br>
              
<serialNumber>79d159e001005ada-ff062151864db51c</serialNumber><br>
            </cachingMetadata>
      <br>
            <definition>
      <br>
               <xsd:schema
      xmlns:xsd=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a>
      <br>
      <br>
xmlns:ra=<a class="moz-txt-link-rfc2396E" href="http://midpoint.evolveum.com/xml/ns/public/resource/annotation-3">"http://midpoint.evolveum.com/xml/ns/public/resource/annotation-3"</a>
      <br>
      <br>
xmlns:tns=<a class="moz-txt-link-rfc2396E" href="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">"http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"</a>
      <br>
      <br>
      xmlns:a=<a class="moz-txt-link-rfc2396E" href="http://prism.evolveum.com/xml/ns/public/annotation-3">"http://prism.evolveum.com/xml/ns/public/annotation-3"</a>
      <br>
                           elementFormDefault="qualified"
      <br>
      <br>
targetNamespace=<a class="moz-txt-link-rfc2396E" href="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">"http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"</a>>
      <br>
                  <xsd:import
namespace=<a class="moz-txt-link-rfc2396E" href="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3">"http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"</a>/><br>
                  <xsd:import
      namespace=<a class="moz-txt-link-rfc2396E" href="http://prism.evolveum.com/xml/ns/public/annotation-3">"http://prism.evolveum.com/xml/ns/public/annotation-3"</a>/>
      <br>
                  <xsd:import
namespace=<a class="moz-txt-link-rfc2396E" href="http://midpoint.evolveum.com/xml/ns/public/resource/annotation-3">"http://midpoint.evolveum.com/xml/ns/public/resource/annotation-3"</a>/><br>
                  <xsd:complexType name="AccountObjectClass">
      <br>
                     <xsd:annotation>
      <br>
                        <xsd:appinfo>
      <br>
                           <ra:resourceObject/>
      <br>
                          
      <ra:identifier>icfs:uid</ra:identifier>
      <br>
      <br>
<ra:secondaryIdentifier>icfs:name</ra:secondaryIdentifier>
      <br>
      <br>
<ra:displayNameAttribute>icfs:name</ra:displayNameAttribute>
      <br>
                          
      <ra:namingAttribute>icfs:name</ra:namingAttribute>
      <br>
      <br>
<ra:nativeObjectClass>__ACCOUNT__</ra:nativeObjectClass>
      <br>
                           <ra:kind>account</ra:kind>
      <br>
                           <ra:default>true</ra:default>
      <br>
                        </xsd:appinfo>
      <br>
                     </xsd:annotation>
      <br>
                     <xsd:sequence>
      <br>
                        <xsd:element minOccurs="0" name="netid"
      type="xsd:string">
      <br>
                           <xsd:annotation>
      <br>
                              <xsd:appinfo>
      <br>
                                
      <a:displayOrder>120</a:displayOrder>
      <br>
      <br>
<ra:frameworkAttributeName>netid</ra:frameworkAttributeName>
      <br>
                              </xsd:appinfo>
      <br>
                           </xsd:annotation>
      <br>
                        </xsd:element>
      <br>
                        <xsd:element ref="icfs:name">
      <br>
                           <xsd:annotation>
      <br>
                              <xsd:appinfo>
      <br>
                                 <a:displayName>ConnId
      Name</a:displayName>
      <br>
                                
      <a:displayOrder>110</a:displayOrder>
      <br>
      <br>
<ra:frameworkAttributeName>__NAME__</ra:frameworkAttributeName>
      <br>
                              </xsd:appinfo>
      <br>
                           </xsd:annotation>
      <br>
                        </xsd:element>
      <br>
                        <xsd:element minOccurs="0" name="identity_id"
      type="xsd:string">
      <br>
                           <xsd:annotation>
      <br>
                              <xsd:appinfo>
      <br>
                                
      <a:displayOrder>130</a:displayOrder>
      <br>
      <br>
<ra:frameworkAttributeName>identity_id</ra:frameworkAttributeName>
      <br>
                              </xsd:appinfo>
      <br>
                           </xsd:annotation>
      <br>
                        </xsd:element>
      <br>
                        <xsd:element minOccurs="0" name="uin"
      type="xsd:string">
      <br>
                           <xsd:annotation>
      <br>
                              <xsd:appinfo>
      <br>
                                
      <a:displayOrder>140</a:displayOrder>
      <br>
      <br>
<ra:frameworkAttributeName>uin</ra:frameworkAttributeName>
      <br>
                              </xsd:appinfo>
      <br>
                           </xsd:annotation>
      <br>
                        </xsd:element>
      <br>
                        <xsd:element minOccurs="0" name="netid_id"
      type="xsd:string">
      <br>
                           <xsd:annotation>
      <br>
                              <xsd:appinfo>
      <br>
                                
      <a:displayOrder>150</a:displayOrder>
      <br>
      <br>
<ra:frameworkAttributeName>netid_id</ra:frameworkAttributeName>
      <br>
                              </xsd:appinfo>
      <br>
                           </xsd:annotation>
      <br>
                        </xsd:element>
      <br>
                        <xsd:element minOccurs="0" ref="icfs:uid">
      <br>
                           <xsd:annotation>
      <br>
                              <xsd:appinfo>
      <br>
                                 <a:displayName>ConnId
      UID</a:displayName>
      <br>
                                
      <a:displayOrder>100</a:displayOrder>
      <br>
                                 <a:access>read</a:access>
      <br>
                              </xsd:appinfo>
      <br>
                           </xsd:annotation>
      <br>
                        </xsd:element>
      <br>
                     </xsd:sequence>
      <br>
                  </xsd:complexType>
      <br>
               </xsd:schema>
      <br>
            </definition>
      <br>
         </schema>
      <br>
         <capabilities>
      <br>
            <cachingMetadata>
      <br>
      <br>
<retrievalTimestamp>2016-03-16T07:50:43.293-05:00</retrievalTimestamp>
      <br>
              
<serialNumber>b830b522bf88fde3-65dceef39aa140d</serialNumber><br>
            </cachingMetadata>
      <br>
            <native
xmlns:cap=<a class="moz-txt-link-rfc2396E" href="http://midpoint.evolveum.com/xml/ns/public/resource/capabilities-3">"http://midpoint.evolveum.com/xml/ns/public/resource/capabilities-3"</a>><br>
               <cap:addRemoveAttributeValues/>
      <br>
               <cap:activation>
      <br>
                  <cap:status/>
      <br>
                  <cap:lockoutStatus/>
      <br>
               </cap:activation>
      <br>
               <cap:credentials>
      <br>
                  <cap:password>
      <br>
                    
      <cap:returnedByDefault>false</cap:returnedByDefault>
      <br>
                  </cap:password>
      <br>
               </cap:credentials>
      <br>
               <cap:liveSync/>
      <br>
               <cap:testConnection/>
      <br>
               <cap:create/>
      <br>
               <cap:read/>
      <br>
               <cap:update/>
      <br>
               <cap:delete/>
      <br>
               <cap:script>
      <br>
                  <cap:host>
      <br>
                     <cap:type>connector</cap:type>
      <br>
                  </cap:host>
      <br>
               </cap:script>
      <br>
            </native>
      <br>
         </capabilities>
      <br>
      </resource>
      <br>
      <br>
      Thanks,
      <br>
      Stephen Barker
      <br>
      Senior Software Engineer - AITS
      <br>
      University of Illinois
      <br>
      <a class="moz-txt-link-abbreviated" href="mailto:sbarker@uillinois.edu">sbarker@uillinois.edu</a>
      <br>
      265-0942
      <br>
      --
      <br>
      "we tend to be masters of our own fate, the only thing that stops
      us from doing really cool things is time." -- Monty Oum
      <br>
      <br>
      On 03/16/2016 09:36 AM, Ivan Noris wrote:
      <br>
      <blockquote type="cite">Hi Stephen,
        <br>
        <br>
        could you please also share the resource XML? (Anonymized if
        needed).
        <br>
        Thank you.
        <br>
        <br>
        Regards,
        <br>
        Ivan
        <br>
        <br>
        On 03/16/2016 03:03 PM, Stephen Barker wrote:
        <br>
        <blockquote type="cite">Hi All,
          <br>
          <br>
          I could use some help with the scripted SQL Connector.
          <br>
          <br>
          I am using midpoint 3.3 and the scripted connector from
          <br>
          net.tirasa.connid.bundles.db.scriptedsql.ScriptedSQLConnector.
          <br>
          <br>
          I have created a very simple schema and search script of which
          I can
          <br>
          see the schema script is working well. When I go to "Accounts"
          though
          <br>
          in the List Resources menu I get the error:
          <br>
          <br>
          2016-03-16 08:28:58,305 [MODEL] [http-bio-8080-exec-7] ERROR
          <br>
          (com.evolveum.midpo
          <br>
          int.model.impl.controller.ModelController): Couldn't search
          objects in
          <br>
          provision
          <br>
          ing, reason: Generic error in the connector:
          <br>
          org.identityconnectors.framework.co
          <br>
          mmon.exceptions.ConnectorException(Search script
          <br>
          error)->groovy.lang.MissingProp
          <br>
          ertyException(No such property: midpoint for class: Script1)
          (class
          <br>
          com.evolveum
          <br>
          .midpoint.util.exception.SystemException)
          <br>
          <br>
          <br>
          My search script is pretty simple basically just returning all
          results
          <br>
          from a table.
          <br>
          <br>
          I'll include the contents at the bottom of this email.
          <br>
          <br>
          What am I missing in getting this set up?
          <br>
          <br>
          -----
          <br>
          SEARCH SCRIPT
          <br>
          -----
          <br>
          <br>
          import groovy.sql.Sql;
          <br>
          import groovy.sql.DataSet;
          <br>
          import groovy.text.SimpleTemplateEngine;
          <br>
          <br>
          log.info("Entering " + action + " Script");
          <br>
          <br>
          def sql = new Sql(connection);
          <br>
          def result = []
          <br>
          def where = "";
          <br>
          <br>
          if (query != null){
          <br>
          <br>
          //To implement...
          <br>
          <br>
          }
          <br>
          <br>
          switch ( objectClass ) {
          <br>
          <br>
          case "__ACCOUNT__":
          <br>
             sql.eachRow("SELECT * from identity",
          <br>
          {result.add([__ENABLE__:true,__UID__:it.id, __NAME__:it.uin,
          <br>
          uin:it.uin)} );
          <br>
             break;
          <br>
          <br>
          case "__GROUP__":
          <br>
             log.info("Search Group");
          <br>
             break;
          <br>
          <br>
          default:
          <br>
             result;
          <br>
          }
          <br>
          <br>
          return result;
          <br>
          <br>
        </blockquote>
        <br>
      </blockquote>
      _______________________________________________
      <br>
      midPoint mailing list
      <br>
      <a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
      <br>
      <a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
      <br>
    </blockquote>
    <br>
  </body>
</html>