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

ch.openchvote.printingauthority.PrintingAuthority Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (C) 2024 Berner Fachhochschule https://e-voting.bfh.ch
 *
 *  - This program is free software: you can redistribute it and/or modify                           -
 *  - it under the terms of the GNU Affero General Public License as published by                    -
 *  - the Free Software Foundation, either version 3 of the License, or                              -
 *  - (at your option) any later version.                                                            -
 *  -                                                                                                -
 *  - This program is distributed in the hope that it will be useful,                                -
 *  - but WITHOUT ANY WARRANTY; without even the implied warranty of                                 -
 *  - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                                   -
 *  - GNU General Public License for more details.                                                   -
 *  -                                                                                                -
 *  - You should have received a copy of the GNU Affero General Public License                       -
 *  - along with this program. If not, see .                           -
 */
package ch.openchvote.printingauthority;

import ch.openchvote.framework.party.Party;
import ch.openchvote.framework.annotations.party.EncryptionKeys;
import ch.openchvote.framework.annotations.party.Role;
import ch.openchvote.framework.services.MessagingService;
import ch.openchvote.printingauthority.plain.PublicData;

/**
 * This class implements the 'Printing Authority' party of the CHVote protocol. It is a direct subclass of {@link Party}
 * with no particular extensions. The specific role of the printing authority in the protocol is implemented in the
 * classes {@link PublicData} (plain protocol) and {@link ch.openchvote.printingauthority.writein.PublicData} (write-in
 * protocol) and in corresponding state and task classes.
 */
@EncryptionKeys
@Role(ch.openchvote.protocol.roles.PrintingAuthority.class)
public final class PrintingAuthority extends Party {

    /**
     * Constructs a new instance of this class.
     *
     * @param id            The id of this printing authority
     * @param loggerLevel   The logger's mode of operation
     */
    public PrintingAuthority(String id, System.Logger.Level loggerLevel) {
        super(id, loggerLevel);
    }

    @Override
    public void subscribeToServices() {
        super.subscribeToServices();

        // subscribe to messaging service
        this.getService(MessagingService.Target.class).subscribe(this);
    }

    @Override
    public void unsubscribeFromServices() {
        super.unsubscribeFromServices();

        // unsubscribe from messaging service
        this.getService(MessagingService.Target.class).unsubscribe(this);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy