/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache 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.apache.org/licenses/LICENSE-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 com.perforce.p4camel;
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.spi.Metadata;
import org.apache.camel.spi.UriEndpoint;
import org.apache.camel.spi.UriParam;
import org.apache.camel.spi.UriPath;
import com.perforce.p4camel.producer.P4Producer;
/**
* Represents a Perforce endpoint.
*/
@UriEndpoint(scheme = "p4", syntax = "p4:depotpath", label = "api,file")
public class P4Endpoint extends DefaultEndpoint {
@UriPath
private String host;
@UriPath
private String port;
@UriPath
@Metadata(required = "true")
private P4Type type;
@UriPath
private String depotPath;
@UriParam
private String username;
@UriParam
private String password;
@UriParam
private String ticket;
/**
* CONSTRUCTOR
*
* @param endpointUri
* @param component
*/
public P4Endpoint(String endpointUri, Component component) {
super(endpointUri, component);
}
@Override
public Consumer createConsumer(Processor processor) throws Exception {
return new P4Consumer(this, processor);
}
@Override
public Producer createProducer() throws Exception {
if (type == P4Type.INFO) {
return new P4Producer(this);
}
throw new IllegalArgumentException("Cannot create producer with type "
+ type);
}
@Override
public boolean isSingleton() {
return true;
}
/******************************************************
* Generated: Getters/Setters
******************************************************/
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getPort() {
return port;
}
public void setPort(String port) {
this.port = port;
}
public P4Type getType() {
return type;
}
public void setType(P4Type type) {
this.type = type;
}
public String getDepotPath() {
return depotPath;
}
public void setDepotPath(String depotPath) {
this.depotPath = depotPath;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getTicket() {
return ticket;
}
public void setTicket(String ticket) {
this.ticket = ticket;
}
public boolean isSsl() {
return false;
}
}