From b606be83f28ca20d6cad19fbc746213d94aea5e3 Mon Sep 17 00:00:00 2001 From: Areek Zillur Date: Wed, 12 Nov 2014 18:25:50 -0500 Subject: [PATCH] Add Generic ExpiredLicenseException closes elastic/elasticsearch#5 Original commit: elastic/x-pack-elasticsearch@712e40214a7b2aa29a326dfc928fdca4ea1817d7 --- .../plugin/core/ExpiredLicenseException.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/main/java/org/elasticsearch/license/plugin/core/ExpiredLicenseException.java diff --git a/src/main/java/org/elasticsearch/license/plugin/core/ExpiredLicenseException.java b/src/main/java/org/elasticsearch/license/plugin/core/ExpiredLicenseException.java new file mode 100644 index 00000000000..e771bc75597 --- /dev/null +++ b/src/main/java/org/elasticsearch/license/plugin/core/ExpiredLicenseException.java @@ -0,0 +1,24 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ +package org.elasticsearch.license.plugin.core; + +import org.elasticsearch.ElasticsearchException; +import org.elasticsearch.rest.RestStatus; + +/** + * Exception to be thrown when a feature action requires a valid license + */ +public class ExpiredLicenseException extends ElasticsearchException { + + public ExpiredLicenseException(String feature) { + super(feature + " license has expired"); + } + + @Override + public RestStatus status() { + return RestStatus.UNAUTHORIZED; + } +}