Search in sources :

Example 1 with IDBInterface

use of org.apache.manifoldcf.core.interfaces.IDBInterface in project manifoldcf by apache.

the class AmazonCloudSearchConnector method deinstall.

@Override
public void deinstall(IThreadContext threadContext) throws ManifoldCFException {
    IDBInterface mainDatabase = DBInterfaceFactory.make(threadContext, ManifoldCF.getMasterDatabaseName(), ManifoldCF.getMasterDatabaseUsername(), ManifoldCF.getMasterDatabasePassword());
    DocumentChunkManager dcmanager = new DocumentChunkManager(mainDatabase);
    dcmanager.deinstall();
}
Also used : IDBInterface(org.apache.manifoldcf.core.interfaces.IDBInterface)

Example 2 with IDBInterface

use of org.apache.manifoldcf.core.interfaces.IDBInterface in project manifoldcf by apache.

the class AmazonCloudSearchConnector method getSession.

/**
 * Set up a session
 */
protected void getSession() throws ManifoldCFException {
    if (documentChunkManager == null) {
        IDBInterface databaseHandle = DBInterfaceFactory.make(currentContext, ManifoldCF.getMasterDatabaseName(), ManifoldCF.getMasterDatabaseUsername(), ManifoldCF.getMasterDatabasePassword());
        documentChunkManager = new DocumentChunkManager(databaseHandle);
    }
    serverHost = params.getParameter(AmazonCloudSearchConfig.SERVER_HOST);
    if (serverHost == null)
        throw new ManifoldCFException("Server host parameter required");
    serverPath = params.getParameter(AmazonCloudSearchConfig.SERVER_PATH);
    if (serverPath == null)
        throw new ManifoldCFException("Server path parameter required");
    String proxyProtocol = params.getParameter(AmazonCloudSearchConfig.PROXY_PROTOCOL);
    String proxyHost = params.getParameter(AmazonCloudSearchConfig.PROXY_HOST);
    String proxyPort = params.getParameter(AmazonCloudSearchConfig.PROXY_PORT);
    // Https is OK here without a custom trust store because we know we are talking to an Amazon instance, which has certs that
    // are presumably non-custom.
    String urlStr = "https://" + serverHost + serverPath;
    poster = new HttpPost(urlStr);
    // set proxy
    if (proxyHost != null && proxyHost.length() > 0) {
        try {
            HttpHost proxy = new HttpHost(proxyHost, Integer.parseInt(proxyPort), proxyProtocol);
            RequestConfig config = RequestConfig.custom().setProxy(proxy).build();
            poster.setConfig(config);
        } catch (NumberFormatException e) {
            throw new ManifoldCFException("Number format exception: " + e.getMessage(), e);
        }
    }
    poster.addHeader("Content-Type", "application/json");
}
Also used : HttpPost(org.apache.http.client.methods.HttpPost) RequestConfig(org.apache.http.client.config.RequestConfig) HttpHost(org.apache.http.HttpHost) ManifoldCFException(org.apache.manifoldcf.core.interfaces.ManifoldCFException) IDBInterface(org.apache.manifoldcf.core.interfaces.IDBInterface)

Example 3 with IDBInterface

use of org.apache.manifoldcf.core.interfaces.IDBInterface in project manifoldcf by apache.

the class AmazonCloudSearchConnector method install.

@Override
public void install(IThreadContext threadContext) throws ManifoldCFException {
    IDBInterface mainDatabase = DBInterfaceFactory.make(threadContext, ManifoldCF.getMasterDatabaseName(), ManifoldCF.getMasterDatabaseUsername(), ManifoldCF.getMasterDatabasePassword());
    DocumentChunkManager dcmanager = new DocumentChunkManager(mainDatabase);
    dcmanager.install();
}
Also used : IDBInterface(org.apache.manifoldcf.core.interfaces.IDBInterface)

Aggregations

IDBInterface (org.apache.manifoldcf.core.interfaces.IDBInterface)3 HttpHost (org.apache.http.HttpHost)1 RequestConfig (org.apache.http.client.config.RequestConfig)1 HttpPost (org.apache.http.client.methods.HttpPost)1 ManifoldCFException (org.apache.manifoldcf.core.interfaces.ManifoldCFException)1