org.apache.commons.weaver.CleanProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-weaver-processor Show documentation
Show all versions of commons-weaver-processor Show documentation
Defines the Apache Commons Weaver SPI as well as the basic build-time
(filesystem-based) processors that detect, configure, and invoke
available modules.
/*
* 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.commons.weaver;
import java.io.File;
import java.util.List;
import java.util.Properties;
import java.util.ServiceLoader;
import java.util.logging.Logger;
import org.apache.commons.weaver.lifecycle.WeaveLifecycle; //NOPMD used in javadoc
import org.apache.commons.weaver.model.WeaveEnvironment;
import org.apache.commons.weaver.spi.Cleaner;
/**
* Implements {@link WeaveLifecycle#CLEAN}.
*/
public class CleanProcessor extends ProcessorBase {
/**
* Create a new {@link CleanProcessor} instance using the {@link ServiceLoader} mechanism.
*
* @param classpath not {@code null}
* @param target not {@code null}
* @param configuration not {@code null}
*/
public CleanProcessor(final List classpath, final File target, final Properties configuration) {
this(classpath, target, configuration, getServiceInstances(Cleaner.class));
}
/**
* Create a new {@link CleanProcessor} instance.
*
* @param classpath not {@code null}
* @param target not {@code null}
* @param configuration not {@code null}
* @param providers not (@code null}
*/
public CleanProcessor(final List classpath, final File target, final Properties configuration,
final Iterable providers) {
super(classpath, target, configuration, providers);
}
/**
* Clean specified targets.
*/
public void clean() {
if (!target.exists()) {
log.warning("Target directory " + target + " does not exist; nothing to do!");
}
for (final Cleaner cleaner : providers) {
final WeaveEnvironment env = new LocalWeaveEnvironment(target, classLoader, configuration,
Logger.getLogger(cleaner.getClass().getName()));
cleaner.clean(env, finder);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy