--- /dev/null
+/*
+ * Copyright (C) 2016 Cho-Time GmbH
+ *
+ * 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 Affero 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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.features;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.faces.context.FacesContext;
+import javax.inject.Named;
+import org.mxchange.pizzaapplication.beans.BasePizzaController;
+
+/**
+ * A feature bean
+ * <p>
+ * @author Roland Haeder<rhaeder@cho-time.de>
+ */
+@Named ("featureController")
+@ApplicationScoped
+public class PizzaFeatureWebApplicationBean extends BasePizzaController implements PizzaFeaturesWebApplicationController {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 64_237_512_690_168_674L;
+
+ @Override
+ public boolean isFeatureEnabled (final String feature) {
+ // The parameter must be set
+ if (null == feature) {
+ // Throw NPE
+ throw new NullPointerException("feature is null"); //NOI18N
+ } else if (feature.isEmpty()) {
+ // Is empty
+ throw new IllegalArgumentException("feature is empty"); //NOI18N
+ }
+
+ // Get context parameter
+ String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter(String.format("is_feature_%s_enabled", feature)); //NOI18N
+
+ // Is it set?
+ boolean isEnabled = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N
+
+ // Return value
+ return isEnabled;
+ }
+
+}