/*
 * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors.
 *
 * Licensed 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 org.switchyard.component.camel.sap.model.v2;

import org.switchyard.component.camel.common.model.v1.V1BaseCamelModel;
import org.switchyard.component.camel.sap.model.EndpointModel;
import org.switchyard.config.Configuration;
import org.switchyard.config.model.Descriptor;

/**
 * V2 camel-sap endpoint model.
 */
public abstract class V2EndpointModel extends V1BaseCamelModel implements EndpointModel {

    private String _name;

    protected V2EndpointModel(Configuration config, Descriptor desc) {
        super(config, desc);
        _name = config.getQName().getLocalPart();
    }

    protected V2EndpointModel(String namespace, String name) {
        super(namespace, name);
        _name = name;
    }

    @Override
    public String getName() {
        return _name;
    }

    @Override
    public V2EndpointModel setName(String name) {
        _name = name;
        return this;
    }

    @Override
    public String getSchema() {
        return Constants.SAP + "-" + _name;
    }
}
