org.apache.sling.feature.Include Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.apache.sling.feature Show documentation
Show all versions of org.apache.sling.feature Show documentation
A feature describes an OSGi system
/*
* 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 org.apache.sling.feature;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* A include is an inclusion of a feature with optional removals of
*
* - Configurations / configuration properties
*
- Bundles
*
- Framework properties
*
- Extensions or artifacts from extensions
*
*
* TODO - requirement, capabilities
*/
public class Include implements Comparable {
private final ArtifactId id;
private final List configurationRemovals = new ArrayList<>();
private final List bundleRemovals = new ArrayList<>();
private final List frameworkPropertiesRemovals = new ArrayList<>();
private final List extensionRemovals = new ArrayList<>();
private final Map> artifactExtensionRemovals = new HashMap<>();
/**
* Construct a new Include.
* @param id The id of the feature.
* @throws IllegalArgumentException If id is {@code null}.
*/
public Include(final ArtifactId id) {
if ( id == null ) {
throw new IllegalArgumentException("id must not be null.");
}
this.id = id;
}
/**
* Get the id of the artifact.
* @return The id.
*/
public ArtifactId getId() {
return this.id;
}
public List getConfigurationRemovals() {
return configurationRemovals;
}
public List getBundleRemovals() {
return bundleRemovals;
}
public List getFrameworkPropertiesRemovals() {
return frameworkPropertiesRemovals;
}
public List getExtensionRemovals() {
return extensionRemovals;
}
public Map> getArtifactExtensionRemovals() {
return artifactExtensionRemovals;
}
@Override
public int compareTo(final Include o) {
return this.id.compareTo(o.id);
}
@Override
public int hashCode() {
return this.id.hashCode();
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
return this.id.equals(((Include)obj).id);
}
@Override
public String toString() {
return "Include [id=" + id.toMvnId()
+ "]";
}
}