<commit_before>/*
 * 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.apache.aries.subsystem;

import java.io.InputStream;
import java.net.URL;

/**
 * Event sent to listeners when an operation has been performed on a subsystem.
 */
public class SubsystemEvent {

    /**
     * The subsystem lifecycle event types that can be produced by a subsystem.
     * See {@link Subsystem} and {@link SubsystemAdmin} for details on the
     * circumstances under which these events are fired.
     */
    public enum Type {
        
        /**
         * Event type used to indicate a subsystem has been installed.
         */
        INSTALLED,

        /**
         * Event type used to indicate a subsystem has been started.
         */
        STARTED,

        /**
         * Event type used to indicate a subsystem has been stopped.
         */
        STOPPED,
        
        /**
         * Event type used to indicate a subsystem has been updated.
         */
        UPDATED,
        
        /**
         * Event type used to indicate a subsystem has been uninstalled.
         */
        UNINSTALLED,
        
        /**
         * Event type used to indicate a subsystem has been resolved.
         */
        RESOLVED,
        
        /**
         * Event type used to indicate a subsystem is starting.
         */
        STARTING,
        
        /**
         * Event type used to indicate a subsystem is stopping.
         */
        STOPPING,
        
        /**
         * Event type used to indicate that the operation failed (e.g. an exception was thrown during installation).
         */
        FAILED,
        
        /**
         * Event type used to indicate that the operations was cancelled (e.g. an install was cancelled).
         */
        CANCELLED
    }
    private final Type type;

    private final long timestamp;

    private final Subsystem subsystem;
    
    private final String location;

    /**
     * Constructs a new subsystem event.
     * 
     * @param type The type of the event.  For example, INSTALLED.  See {@link SubsystemEvent.Type} for the list of event types.
     * @param timestamp The timestamp for the event.
     * @param subsystem The subsystem for which the event is being created.
     */
    public SubsystemEvent(Type type, long timestamp, Subsystem subsystem) {
        this.type = type;
        this.timestamp = timestamp;
        this.subsystem = subsystem;
        this.location = subsystem.getLocation();
    }

    /**
     * Constructs a new subsystem event.
     * 
     * @param type The type of the event.  For example, INSTALLED.  See {@link SubsystemEvent.Type} for the list of event types.
     * @param timestamp The timestamp for the event.
     * @param location The location of the subsystem for failure/cancellation cases.
     */
    public SubsystemEvent(Type type, long timestamp, String location) {
        this.type = type;
        this.timestamp = timestamp;
        this.location = location;
        this.subsystem = null;
    }

    /**
     * Gets the type of the subsystem event.  See {@link SubsystemEvent.Type} for the list of event types.
     * @return the type of the subsystem event.
     */
    public Type getType() {
        return type;
    }

    /**
     * Gets the timestamp for the subsystem event.
     * 
     * @return the timestamp for the subsystem event.
     */
    public long getTimestamp() {
        return timestamp;
    }

    /**
     * Gets the subsystem for which the event was created.
     * 
     * @return the subsystem for which the event was created.
     */
    public Subsystem getSubsystem() {
        return subsystem;
    }

    /**
     * Gets the location for the subsystem.
     * 
     * @return the location of the subsystem.
     */
    public String getLocation() {
        return location;
    }

}<commit_msg>revert r1021324 in subsystem-api project since Graham told me he doesn't need the Future stuff anyway<commit_after>/*
 * 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.apache.aries.subsystem;

import java.io.InputStream;

/**
 * Event sent to listeners when an operation has been performed on a subsystem.
 */
public class SubsystemEvent {

    /**
     * The subsystem lifecycle event types that can be produced by a subsystem.
     * See {@link Subsystem} and {@link SubsystemAdmin} for details on the
     * circumstances under which these events are fired.
     */
    public enum Type {
        
        /**
         * Event type used to indicate a subsystem has been installed.
         */
        INSTALLED,

        /**
         * Event type used to indicate a subsystem has been started.
         */
        STARTED,

        /**
         * Event type used to indicate a subsystem has been stopped.
         */
        STOPPED,
        
        /**
         * Event type used to indicate a subsystem has been updated.
         */
        UPDATED,
        
        /**
         * Event type used to indicate a subsystem has been uninstalled.
         */
        UNINSTALLED,
        
        /**
         * Event type used to indicate a subsystem has been resolved.
         */
        RESOLVED,
        
        /**
         * Event type used to indicate a subsystem is starting.
         */
        STARTING,
        
        /**
         * Event type used to indicate a subsystem is stopping.
         */
        STOPPING
    }
    private final Type type;

    private final long timestamp;

    private final Subsystem subsystem;

    /**
     * Constructs a new subsystem event.
     * 
     * @param type The type of the event.  For example, INSTALLED.  See {@link SubsystemEvent.Type} for the list of event types.
     * @param timestamp The timestamp for the event.
     * @param subsystem The subsystem for which the event is being created.
     */
    public SubsystemEvent(Type type, long timestamp, Subsystem subsystem) {
        this.type = type;
        this.timestamp = timestamp;
        this.subsystem = subsystem;
    }

    /**
     * Gets the type of the subsystem event.  See {@link SubsystemEvent.Type} for the list of event types.
     * @return the type of the subsystem event.
     */
    public Type getType() {
        return type;
    }

    /**
     * Gets the timestamp for the subsystem event.
     * 
     * @return the timestamp for the subsystem event.
     */
    public long getTimestamp() {
        return timestamp;
    }

    /**
     * Gets the subsystem for which the event was created.
     * 
     * @return the subsystem for which the event was created.
     */
    public Subsystem getSubsystem() {
        return subsystem;
    }

}
{'fraction_non_alphanumeric': 0.07302785732882063, 'fraction_numerical': 0.0019526165061181985, 'mean_word_length': 1.947065592635213, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6820274', 'n_tokens_mistral': 1990, 'n_tokens_neox': 1881, 'n_words': 837}