ScriptedCRESTConnector.template revision 3437677679324afd5af50dac4de68ae39418c655
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson/*
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson * DO NOT REMOVE COPYRIGHT NOTICES OR THIS HEADER.
ea8874ec3578a02d5d71b08217ac74d7588db10aMark Andrews *
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson * Copyright (c) 2015 ForgeRock AS All rights reserved.
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson *
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson * The contents of this file are subject to the terms
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson * of the Common Development and Distribution License
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson * (the License). You may not use this file except in
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson * compliance with the License.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews *
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * You can obtain a copy of the License at
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * http://forgerock.org/license/CDDLv1.0.html
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * See the License for the specific language governing
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * permission and limitations under the License.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews *
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * When distributing Covered Code, include this CDDL
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson * Header Notice in each file and include the License file
ea8874ec3578a02d5d71b08217ac74d7588db10aMark Andrews * at http://forgerock.org/license/CDDLv1.0.html
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson * If applicable, add the following below the CDDL Header,
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson * with the fields enclosed by brackets [] replaced by
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson * your own identifying information:
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson * "Portions Copyrighted [year] [name of copyright owner]"
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson */
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelsonpackage org.forgerock.openicf.connectors.{{lower packageName}};
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelsonimport java.util.Set;
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelsonimport org.forgerock.openicf.connectors.scriptedcrest.RemoteConnection;
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neilimport org.forgerock.openicf.misc.scriptedcommon.OperationType;
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelsonimport org.forgerock.openicf.misc.scriptedcommon.ScriptedConnectorBase;
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelsonimport org.identityconnectors.common.StringUtil;
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelsonimport org.identityconnectors.framework.common.objects.Attribute;
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelsonimport org.identityconnectors.framework.common.objects.ObjectClass;
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neilimport org.identityconnectors.framework.common.objects.OperationOptions;
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neilimport org.identityconnectors.framework.common.objects.Uid;
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neilimport org.identityconnectors.framework.spi.Configuration;
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neilimport org.identityconnectors.framework.spi.ConnectorClass;
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neilimport org.identityconnectors.framework.spi.PoolableConnector;
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neil
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neilimport groovy.lang.Binding;
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neil
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neil/**
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neil * Main implementation of the {{displayName}} Connector.
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neil *
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neil * @author {{author}}
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson * @description {{description}}
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson * @version {{version}}
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson */
f65a42f3771c00e935a13860bd1066dffa2ce0bcAndreas Gustafsson@ConnectorClass(displayNameKey = "groovy.{{lower packageName}}.connector.display",
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson configurationClass = {{packageName}}Configuration.class,
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neil messageCatalogPaths = {
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neil "org/forgerock/openicf/connectors/{{lower packageName}}/Messages"
d76ed813a51465e5c47d521ab09ea20c06f1428dMark Andrews })
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neilpublic class {{packageName}}Connector extends ScriptedConnectorBase<{{packageName}}Configuration>
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson implements PoolableConnector {
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neil
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neil @Override
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson public void checkAlive() {
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson }
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neil
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neil @Override
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neil protected Binding createBinding(Binding arguments, OperationType action, ObjectClass objectClass,
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson Uid uid, Set<Attribute> attributes, OperationOptions options) {
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neil Binding b = super.createBinding(arguments, action, objectClass, uid, attributes, options);
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neil b.setVariable(CONNECTION, new RemoteConnection(({{packageName}}Configuration) getScriptedConfiguration()));
3e42d5b2bb13bfdab3db7ca60cd0691705618ffbAndreas Gustafsson if (!OperationType.SCHEMA.equals(action) && StringUtil.isNotBlank(getScriptedConfiguration()
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson .getSchemaScriptFileName())) {
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson arguments.setVariable(SCHEMA, schema());
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson }
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson return b;
cf1dd934916200df2fbd0f55c5bb4c691d9dc6d0Matt Nelson }
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neil}
2f5f42596b37bf6c88fd50abc0ddb56240d6bca6Damien Neil