Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Java Remote Connector Server is using the same kind of connectors that midPoint itself is using. The Java Remote Connector Server is used in situations where a connector needs a local access to some resource to be able to work with it. It is usually used for connectors that require local access to files such as CSVFile Connector (legacy). This avoids the need to copy the file using FTP or a similar mechanism which is difficult to do right and it is quite error-prone (e.g. problems with partially downloaded files, error handling, atomicity, etc.) Java Remote Connector Server is also used in situations that require firewall traversal or securing insecure communication protocol.

...

  1. Download and unzip the binary distribution (or clone git repo with sources and build your own with mvn clean install command)
  2. In the installation folder (that contains bin, conf, and lib directories) create a directory for connector bundles, named bundles. In the following text, we assume /opt/connid-connector-server directory for Linux.
  3. Copy connectors you need into bundles directory (e.g. connector-csvfile-1.4.0.49.jar for CSV connector)
  4. Set the secret key by invoking the command:
    1. (on Windows): bin\ConnectorServer.bat /setkey <your secret key here>
    2. (on Linux):

      java -cp "lib/framework/connector-framework.jar:lib/framework/connector-framework-internal.jar:lib/framework/groovy-all.jar" org.identityconnectors.framework.server.Main  -setKey -key <your secret key here> -properties conf/ConnectorServer.properties

  5. Fix the logging configuration:
    1. replace the line "connectorserver.loggerClass=org.identityconnectors.common.logging.slf4j.SLF4JLog" in conf/ConnectorServer.properties file with "connectorserver.loggerClass=org.identityconnectors.common.logging.impl.JDKLogger"
    2. add "-Djava.util.logging.config.file=conf/logging.properties" to your startup parameters to actually use logging
    3. update the conf/logging.properties to log to file in logs directory:

      Code Block
      handlers=java.util.logging.FileHandler
      ##handlers=java.util.logging.ConsoleHandler
      java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
      java.util.logging.FileHandler.pattern = logs/connectorserver%u.log
      java.util.logging.FileHandler.limit = 102400
      java.util.logging.FileHandler.count = 1
      java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
      java.util.logging.FileHandler.append = true
      .level=INFO
  6. Run the connector server e.g. by invoking the command:
    1. (on Windows): bin\ConnectorServer.bat /run
    2. (on Linux): java -cp "lib/framework/connector-framework.jar:lib/framework/connector-framework-internal.jar:lib/framework/groovy-all.jar" org.identityconnectors.framework.server.Main  -run -properties conf/ConnectorServer.properties

...

Code Block
systemctl start java-connector-server
systemctl stop java-connector-server

TODO describe other ways of running the server (i.e. old init v)

SysV Init

Create start script to be run by startup script /opt/connid-connector-server/start:

Code Block
languagebash
#!/bin/bash
MAIN_DIR=/opt/connid-connector-server
cd $MAIN_DIR
exec java -Djava.util.logging.config.file=conf/logging.properties -cp "lib/framework/connector-framework.jar:lib/framework/connector-framework-internal.jar:lib/framework/groovy-all.jar" org.identityconnectors.framework.server.Main -run -properties conf/ConnectorServer.properties

Set file permissions:

Code Block
languagebash
chmod 755 /opt/connid-connector-server/start

Create startup script /etc/init.d/connid-connector-server - inspiration from: https://orrsella.com/2014/11/06/initd-and-start-scripts-for-scala-java-server-apps/

Code Block
languagebash
#!/bin/bash
START_SCRIPT=/opt/connid-connector-server/start
PID_FILE=/var/run/connid-connector-server.pid
DAEMON=$START_SCRIPT
start() {
  PID=`$DAEMON $ARGS > /dev/null 2>&1 & echo $!`
}
case "$1" in
start)
    if [ -f $PID_FILE ]; then
        PID=`cat $PID_FILE`
        if [ -z "`ps axf | grep -w ${PID} | grep -v grep`" ]; then
            start
        else
            echo "Already running [$PID]"
            exit 0
        fi
    else
        start
    fi
    if [ -z $PID ]; then
        echo "Failed starting"
        exit 3
    else
        echo $PID > $PID_FILE
        echo "Started [$PID]"
        exit 0
    fi
;;
status)
    if [ -f $PID_FILE ]; then
        PID=`cat $PID_FILE`
        if [ -z "`ps axf | grep -w ${PID} | grep -v grep`" ]; then
            echo "Not running (process dead but pidfile exists)"
            exit 1
        else
            echo "Running [$PID]"
            exit 0
        fi
    else
        echo "Not running"
        exit 3
    fi
;;
stop)
    if [ -f $PID_FILE ]; then
        PID=`cat $PID_FILE`
        if [ -z "`ps axf | grep -w ${PID} | grep -v grep`" ]; then
            echo "Not running (process dead but pidfile exists)"
            exit 1
        else
            PID=`cat $PID_FILE`
            kill -HUP $PID
            echo "Stopped [$PID]"
            rm -f $PID_FILE
            exit 0
        fi
    else
        echo "Not running (pid not found)"
        exit 3
    fi
;;
restart)
    $0 stop
    $0 start
;;
*)
    echo "Usage: $0 {status|start|stop|restart}"
    exit 1
esac

Set file permissions:

Code Block
languagebash
chmod 755 /etc/init.d/connid-connector-server

Start the service:

Code Block
languagebash
/etc/init.d/connid-connector-server start

Set the service to autostart (using your distribution command; here Red Hat-based distributions "chkconfig" is used:

Code Block
languagebash
chkconfig connid-connector-server on
Info

You may need to use different command and edit the script to use dependencies or service startup ordering.

 

Original instructions for OpenICF Connector Server: http://openicf.forgerock.org/connector-framework-internal/connector_server.html

...