/**
 * Licensed to the Austrian Association for Software Tool Integration (AASTI)
 * under one or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information regarding copyright
 * ownership. The AASTI 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 org.openengsb.core.common;

import java.util.Collections;
import java.util.Map;

import org.openengsb.core.api.ConnectorInstanceFactory;
import org.openengsb.core.api.Domain;

public abstract class AbstractConnectorInstanceFactory<ConnectorType extends Domain> implements
        ConnectorInstanceFactory {

    @SuppressWarnings("unchecked")
    @Override
    public void applyAttributes(Domain instance, Map<String, String> attributes) {
        doApplyAttributes((ConnectorType) instance, attributes);
    }

    public abstract void doApplyAttributes(ConnectorType instance, Map<String, String> attributes);

    @SuppressWarnings("unchecked")
    @Override
    public Map<String, String> getValidationErrors(Domain instance, Map<String, String> attributes) {
        return getValidationErrorsInternally((ConnectorType) instance, attributes);
    }

    public Map<String, String> getValidationErrorsInternally(ConnectorType instance, Map<String, String> attributes) {
        // do nothing. override to add validation
        return Collections.emptyMap();
    }

    @Override
    public Map<String, String> getValidationErrors(Map<String, String> attributes) {
        // do nothing. override to add validation
        return Collections.emptyMap();
    }

}

@@ -1007,16 +1007,281 @@
 omain;%0A%0A
+/**%0A * Abstract baseclass that may help when implementing %7B@link ConnectorInstanceFactory%7Ds%0A *%0A * It takes care of the type-conversion and implements validation-functions that do not do anything. If validation is%0A * required these methods should be overridden.%0A */%0A
 public a
@@ -1600,32 +1600,139 @@
 ibutes);%0A    %7D%0A%0A
+    /**%0A     * should set the given attributes to the corresponding fields in the instance-object.%0A     */%0A
     public abstr

add some javadoc to AbstractConnectorInstanceFactory