All Downloads are FREE. Search and download functionalities are using the official Maven repository.

metridoc.camel.component.sqlplus.SqlPlusEndpoint Maven / Gradle / Ivy

There is a newer version: 0.12
Show newest version
/*
 * Copyright 2010 Trustees of the University of Pennsylvania Licensed under the
 * Educational Community License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License. You may
 * obtain a copy of the License at
 *
 * http://www.osedu.org/licenses/ECL-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an "AS IS"
 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */
package metridoc.camel.component.sqlplus;

import org.apache.camel.Component;
import org.apache.camel.Consumer;
import org.apache.camel.Processor;
import org.apache.camel.Producer;
import org.apache.camel.impl.DefaultEndpoint;
import org.apache.camel.impl.ProcessorEndpoint;

import javax.sql.DataSource;

/**
 * 
 * @author Narine Ghochikyan
 * 
 */
public class SqlPlusEndpoint extends DefaultEndpoint {
	private DataSource dataSource;
	private String query;
	private int fetchSize;
	private int batchSize;
	private boolean detailedOutput;

	public SqlPlusEndpoint(String endpointUri, Component component,
			DataSource dataSource, String query) {
		super(endpointUri, component);
		this.dataSource = dataSource;
		this.query = query;
	}

	public DataSource getDataSource() {
		return dataSource;
	}

	public void setDataSource(DataSource dataSource) {
		this.dataSource = dataSource;
	}

	public String getQuery() {
		return query;
	}

	public void setQuery(String query) {
		this.query = query;
	}

	public int getFetchSize() {
		return fetchSize;
	}

	public void setFetchSize(int fetchSize) {
		this.fetchSize = fetchSize;
	}

	public int getBatchSize() {
		return batchSize;
	}

	public void setBatchSize(int batchSize) {
		this.batchSize = batchSize;
	}

	public boolean isDetailedOutput() {
		return detailedOutput;
	}

	public void setDetailedOutput(boolean detailedOutput) {
		this.detailedOutput = detailedOutput;
	}

	@Override
	public Consumer createConsumer(Processor processor) throws Exception {
		return new SqlStreamConsumer(this, processor);
	}

	@Override
	public Producer createProducer() throws Exception {
		return new ProcessorEndpoint(getEndpointUri(), getComponent(), new SqlPlusUpdateProcessor(dataSource, query, batchSize,
				detailedOutput)).createProducer();
	}

	@Override
	public boolean isSingleton() {
		return false;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy