diff options
author | Devan Goodwin <dgoodwin@redhat.com> | 2010-01-12 14:57:57 -0400 |
---|---|---|
committer | Devan Goodwin <dgoodwin@redhat.com> | 2010-01-12 14:57:57 -0400 |
commit | 939fee56c640dda3caffe718133ffdbd84370700 (patch) | |
tree | c84ee2deaf2ec6bc135dd35d902e60184ee60f9c | |
parent | c8c40033cac251baa86b24fba7a663b1aefccea6 (diff) | |
download | candlepin-939fee56c640dda3caffe718133ffdbd84370700.tar.gz candlepin-939fee56c640dda3caffe718133ffdbd84370700.tar.xz candlepin-939fee56c640dda3caffe718133ffdbd84370700.zip |
Start sketching out the Enforcer interface.
4 files changed, 118 insertions, 0 deletions
diff --git a/proxy/src/main/java/org/fedoraproject/candlepin/enforcer/Enforcer.java b/proxy/src/main/java/org/fedoraproject/candlepin/enforcer/Enforcer.java new file mode 100644 index 0000000..d22f869 --- /dev/null +++ b/proxy/src/main/java/org/fedoraproject/candlepin/enforcer/Enforcer.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2009 Red Hat, Inc. + * + * This software is licensed to you under the GNU General Public License, + * version 2 (GPLv2). There is NO WARRANTY for this software, express or + * implied, including the implied warranties of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 + * along with this software; if not, see + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * + * Red Hat trademarks are not licensed under GPLv2. No permission is + * granted to use or replicate Red Hat trademarks that are incorporated + * in this software or its documentation. + */ +package org.fedoraproject.candlepin.enforcer; + +import org.fedoraproject.candlepin.model.Consumer; +import org.fedoraproject.candlepin.model.Product; + +public interface Enforcer { + + /** + * Validate that a consumer can consume an entitlement for a product. + * + * Ensures sufficient entitlements remain, but also verifies all attributes + * on the product and relevant entitlement pool pass using the current + * policy. + * + * @param consumer Consumer who wishes to consume an entitlement. + * @param product Product consumer wishes to have access too. + */ + public void validate(Consumer consumer, Product product); + +} diff --git a/proxy/src/main/java/org/fedoraproject/candlepin/enforcer/ValidationError.java b/proxy/src/main/java/org/fedoraproject/candlepin/enforcer/ValidationError.java new file mode 100644 index 0000000..1d7777b --- /dev/null +++ b/proxy/src/main/java/org/fedoraproject/candlepin/enforcer/ValidationError.java @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2009 Red Hat, Inc. + * + * This software is licensed to you under the GNU General Public License, + * version 2 (GPLv2). There is NO WARRANTY for this software, express or + * implied, including the implied warranties of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 + * along with this software; if not, see + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * + * Red Hat trademarks are not licensed under GPLv2. No permission is + * granted to use or replicate Red Hat trademarks that are incorporated + * in this software or its documentation. + */ +package org.fedoraproject.candlepin.enforcer; + +public class ValidationError { + +} diff --git a/proxy/src/main/java/org/fedoraproject/candlepin/enforcer/ValidationResult.java b/proxy/src/main/java/org/fedoraproject/candlepin/enforcer/ValidationResult.java new file mode 100644 index 0000000..0034bb0 --- /dev/null +++ b/proxy/src/main/java/org/fedoraproject/candlepin/enforcer/ValidationResult.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2009 Red Hat, Inc. + * + * This software is licensed to you under the GNU General Public License, + * version 2 (GPLv2). There is NO WARRANTY for this software, express or + * implied, including the implied warranties of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 + * along with this software; if not, see + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * + * Red Hat trademarks are not licensed under GPLv2. No permission is + * granted to use or replicate Red Hat trademarks that are incorporated + * in this software or its documentation. + */ +package org.fedoraproject.candlepin.enforcer; + +import java.util.List; + +/** + * Results of an enforcer validation. Basically used to support multiple + * errors being generated by an attempt to consume (perhaps multiple attribute + * checks failed), but also the possibility of warnings, which do not actually + * prevent the entitlement from being given out. + * + */ +public class ValidationResult { + + private List<ValidationError> errors; + private List<ValidationWarning> warnings; + + public List<ValidationError> getErrors() { + return errors; + } + + public void setErrors(List<ValidationError> errors) { + this.errors = errors; + } + + public List<ValidationWarning> getWarnings() { + return warnings; + } + + public void setWarnings(List<ValidationWarning> warnings) { + this.warnings = warnings; + } +} diff --git a/proxy/src/main/java/org/fedoraproject/candlepin/enforcer/ValidationWarning.java b/proxy/src/main/java/org/fedoraproject/candlepin/enforcer/ValidationWarning.java new file mode 100644 index 0000000..2e2dd42 --- /dev/null +++ b/proxy/src/main/java/org/fedoraproject/candlepin/enforcer/ValidationWarning.java @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2009 Red Hat, Inc. + * + * This software is licensed to you under the GNU General Public License, + * version 2 (GPLv2). There is NO WARRANTY for this software, express or + * implied, including the implied warranties of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 + * along with this software; if not, see + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. + * + * Red Hat trademarks are not licensed under GPLv2. No permission is + * granted to use or replicate Red Hat trademarks that are incorporated + * in this software or its documentation. + */ +package org.fedoraproject.candlepin.enforcer; + +public class ValidationWarning { + +} |