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

org.switchyard.config.model.ScannerInput Maven / Gradle / Ivy

The newest version!
/*
 * 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.config.model;

import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.switchyard.config.model.switchyard.SwitchYardNamespace;

/**
 * The input to a {@link Scanner}.
 *
 * @param  the Model type being scanned for
 *
 * @author David Ward <[email protected]> (C) 2011 Red Hat Inc.
 */
public class ScannerInput {

    private List _urls;
    private SwitchYardNamespace _switchyardNamespace;
    private String _compositeName;
    private List _includes;
    private List _excludes;

    /**
     * Constructs a new ScannerInput.
     */
    public ScannerInput() {
        _urls = new ArrayList();
        _includes = new ArrayList();
        _excludes = new ArrayList();
    }

    /**
     * Gets the URLs to scan.
     * @return the URLs
     */
    public synchronized List getURLs() {
        return Collections.unmodifiableList(_urls);
    }

    /**
     * Sets the URLs to scan.
     * @param urls the URLs
     * @return this ScannerInput (useful for chaining)
     */
    public synchronized ScannerInput setURLs(List urls) {
        _urls.clear();
        if (urls != null) {
            for (URL url : urls) {
                if (url != null) {
                    _urls.add(url);
                }
            }
        }
        return this;
    }

    /**
     * Gets the Packages to include.
     * @return the Packages
     */
    public synchronized List getIncludePackages() {
        return Collections.unmodifiableList(_includes);
    }

    /**
     * Sets the Packages to include.
     * @param includes packages to include
     * @return this ScannerInput (useful for chaining)
     */
    public synchronized ScannerInput setIncludePackages(List includes) {
        _includes.clear();
        if (includes != null) {
            for (Package p : includes) {
                if (p != null) {
                    _includes.add(p);
                }
            }
        }
        return this;
    }

    /**
     * Gets the Packages to exclude.
     * @return the Packages
     */
    public synchronized List getExcludePackages() {
        return Collections.unmodifiableList(_excludes);
    }

    /**
     * Sets the Packages to exclude.
     * @param excludes packages to exclude
     * @return this ScannerInput (useful for chaining)
     */
    public synchronized ScannerInput setExcludePackages(List excludes) {
        _excludes.clear();
        if (excludes != null) {
            for (Package p : excludes) {
                if (p != null) {
                    _excludes.add(p);
                }
            }
        }
        return this;
    }

    /**
     * If the switchyard namespace is set.
     * @return if the switchyard namespace is set
     */
    public boolean isSwitchyardNamespaceSet() {
        return _switchyardNamespace != null;
    }

    /**
     * Gets the switchyard namespace for the scan.
     * @return the switchyard namespace
     */
    public SwitchYardNamespace getSwitchyardNamespace() {
        return isSwitchyardNamespaceSet() ? _switchyardNamespace : SwitchYardNamespace.DEFAULT;
    }

    /**
     * Sets the switchyard namespace for the scan.
     * @param switchyardNamespace the switchyard namespace
     * @return this ScannerInput (useful for chaining)
     */
    public ScannerInput setSwitchyardNamespace(SwitchYardNamespace switchyardNamespace) {
        _switchyardNamespace = switchyardNamespace;
        return this;
    }

    /**
     * Gets the composite name for the scan.
     * @return the composite name
     */
    public String getCompositeName() {
        return _compositeName;
    }

    /**
     * Sets the composite name for the scan.
     * @param compositeName the composite name
     * @return this ScannerInput (useful for chaining)
     */
    public ScannerInput setCompositeName(String compositeName) {
        _compositeName = compositeName;
        return this;
    }
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy