/*
* DO NOT REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2012 ForgeRock Inc. All rights reserved.
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* http://forgerock.org/license/CDDLv1.0.html
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at http://forgerock.org/license/CDDLv1.0.html
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*/
package org.forgerock.openicf.mssql;
import java.util.Set;
import org.identityconnectors.common.logging.Log;
import org.identityconnectors.common.security.GuardedString;
import org.identityconnectors.framework.common.objects.Attribute;
import org.identityconnectors.framework.common.objects.ObjectClass;
import org.identityconnectors.framework.common.objects.OperationOptions;
import org.identityconnectors.framework.common.objects.ResultsHandler;
import org.identityconnectors.framework.common.objects.Schema;
import org.identityconnectors.framework.common.objects.ScriptContext;
import org.identityconnectors.framework.common.objects.Uid;
import org.identityconnectors.framework.common.objects.filter.FilterTranslator;
import org.identityconnectors.framework.spi.Configuration;
import org.identityconnectors.framework.spi.ConnectorClass;
import org.identityconnectors.framework.spi.PoolableConnector;
import org.identityconnectors.framework.spi.operations.AuthenticateOp;
import org.identityconnectors.framework.spi.operations.CreateOp;
import org.identityconnectors.framework.spi.operations.DeleteOp;
import org.identityconnectors.framework.spi.operations.SchemaOp;
import org.identityconnectors.framework.spi.operations.ScriptOnResourceOp;
import org.identityconnectors.framework.spi.operations.SearchOp;
import org.identityconnectors.framework.spi.operations.TestOp;
import org.identityconnectors.framework.spi.operations.UpdateOp;
/**
* Main implementation of the MSSQLServer Connector
*
* @author $author$
* @version $Revision$ $Date$
*/
@ConnectorClass(displayNameKey = "mssqlserver.connector.display", categoryKey = "db.category",
configurationClass = MSSQLServerConfiguration.class)
public class MSSQLServerConnector implements PoolableConnector, AuthenticateOp, CreateOp, DeleteOp,
SchemaOp, ScriptOnResourceOp, SearchOp<String>, TestOp, UpdateOp {
/**
* Setup logging for the {@link MSSQLServerConnector}.
*/
private static final Log LOGGER = Log.getLog(MSSQLServerConnector.class);
/**
* Place holder for the Connection created in the init method
*/
private MSSQLServerConnection connection;
/**
* Place holder for the {@link Configuration} passed into the init() method
* {@link MSSQLServerConnector#init(org.identityconnectors.framework.spi.Configuration)}
* .
*/
private MSSQLServerConfiguration configuration;
/**
* Gets the Configuration context for this connector.
*/
public Configuration getConfiguration() {
return this.configuration;
}
/**
* Callback method to receive the {@link Configuration}.
*
* @see org.identityconnectors.framework.spi.Connector#init(org.identityconnectors.framework.spi.Configuration)
*/
public void init(Configuration configuration1) {
this.configuration = (MSSQLServerConfiguration) configuration1;
this.connection = new MSSQLServerConnection(this.configuration);
}
/**
* Disposes of the {@link MSSQLServerConnector}'s resources.
*
* @see org.identityconnectors.framework.spi.Connector#dispose()
*/
public void dispose() {
configuration = null;
if (connection != null) {
connection.dispose();
connection = null;
}
}
/**
* {@inheritDoc}
*/
public void checkAlive() {
connection.test();
}
/******************
* SPI Operations
*
* Implement the following operations using the contract and description
* found in the Javadoc for these methods.
******************/
/**
* {@inheritDoc}
*/
public Uid authenticate(final ObjectClass objectClass, final String userName,
final GuardedString password, final OperationOptions options) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
public Uid create(final ObjectClass objectClass, final Set<Attribute> createAttributes,
final OperationOptions options) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
public void delete(final ObjectClass objectClass, final Uid uid, final OperationOptions options) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
public Schema schema() {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
public Object runScriptOnResource(ScriptContext request, OperationOptions options) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
public FilterTranslator<String> createFilterTranslator(ObjectClass objectClass,
OperationOptions options) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
public void executeQuery(ObjectClass objectClass, String query, ResultsHandler handler,
OperationOptions options) {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
public void test() {
throw new UnsupportedOperationException();
}
/**
* {@inheritDoc}
*/
public Uid update(ObjectClass objectClass, Uid uid, Set<Attribute> replaceAttributes,
OperationOptions options) {
throw new UnsupportedOperationException();
}
}