org.apacheextras.camel.component.exist.ExistComponent Maven / Gradle / Ivy
/**************************************************************************************
http://code.google.com/a/apache-extras.org/p/camel-extra
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
http://www.gnu.org/licenses/gpl-2.0-standalone.html
***************************************************************************************/
package org.apacheextras.camel.component.exist;
import java.util.Map;
import org.apache.camel.Endpoint;
import org.apache.camel.impl.DefaultComponent;
import org.xmldb.api.DatabaseManager;
import org.xmldb.api.base.Collection;
import org.xmldb.api.base.Database;
public class ExistComponent extends DefaultComponent {
private Database database;
private String username;
private String password;
protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception {
Collection collection;
if (database != null) {
collection = database.getCollection(remaining, username, password);
} else {
collection = DatabaseManager.getCollection(uri);
}
return new ExistEndpoint(uri, this, collection);
}
public Database getDatabase() {
return database;
}
public void setDatabase(Database database) {
this.database = database;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy