You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openaz.apache.org by pd...@apache.org on 2016/03/17 02:13:12 UTC
[08/23] incubator-openaz git commit: Revert "Ported original att
source to openaz"
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/components/SQLPIPConfigurationComponent.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/components/SQLPIPConfigurationComponent.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/components/SQLPIPConfigurationComponent.java
deleted file mode 100644
index 7b2b501..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/components/SQLPIPConfigurationComponent.java
+++ /dev/null
@@ -1,763 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.components;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.sql.DataSource;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.apache.openaz.xacml.admin.jpa.PIPConfigParam;
-import org.apache.openaz.xacml.admin.jpa.PIPConfiguration;
-import org.apache.openaz.xacml.admin.view.events.FormChangedEventListener;
-import org.apache.openaz.xacml.admin.view.events.FormChangedEventNotifier;
-import com.vaadin.addon.jpacontainer.EntityItem;
-import com.vaadin.annotations.AutoGenerated;
-import com.vaadin.data.Buffered.SourceException;
-import com.vaadin.data.Item;
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
-import com.vaadin.data.Validator.InvalidValueException;
-import com.vaadin.server.Page;
-import com.vaadin.ui.Alignment;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Button.ClickListener;
-import com.vaadin.ui.ComboBox;
-import com.vaadin.ui.CustomComponent;
-import com.vaadin.ui.Notification;
-import com.vaadin.ui.Notification.Type;
-import com.vaadin.ui.PasswordField;
-import com.vaadin.ui.TextField;
-import com.vaadin.ui.VerticalLayout;
-
-public class SQLPIPConfigurationComponent extends CustomComponent implements FormChangedEventNotifier {
-
- @AutoGenerated
- private VerticalLayout mainLayout;
-
- @AutoGenerated
- private Button buttonTest;
-
- @AutoGenerated
- private PasswordField textFieldPassword;
-
- @AutoGenerated
- private TextField textFieldUser;
-
- @AutoGenerated
- private TextField textFieldConnectionURL;
-
- @AutoGenerated
- private ComboBox comboBoxSQLDriver;
-
- @AutoGenerated
- private TextField textFieldDataSource;
-
- @AutoGenerated
- private ComboBox comboBoxConnectionType;
-
- public static final String CLASSNAME = "org.apache.openaz.xacml.std.pip.engines.jdbc.JDBCEngine";
-
- public static final String SQL_TYPE = "type";
- public static final String SQL_TYPE_JDBC = "jdbc";
- public static final String SQL_TYPE_JNDI = "jndi";
- public static final String SQL_DATASOURCE = "datasource";
- public static final String SQL_DRIVER = "jdbc.driver";
- public static final String SQL_URL = "jdbc.url";
- public static final String SQL_USER = "jdbc.conn.user";
- public static final String SQL_PASSWORD = "jdbc.conn.password";
-
- //
- // These are the drivers that we are initially supporting and testing.
- // Other JDBC drivers may work fine, but we will wait until we test
- // with those drivers before adding them to this list.
- //
- public static final String SQL_DRIVER_MYSQL = "com.mysql.jdbc.Driver";
- public static final String SQL_DRIVER_POSTGRESQL = "org.postgresql.Driver";
- public static final String SQL_DRIVER_H2 = "org.h2.Driver";
- public static final String SQL_DRIVER_HYPER = "org.hsqldb.jdbc.JDBCDriver";
- public static final String SQL_DRIVER_SQL_SERVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
- public static String[] SQL_DRIVERS = new String[] {SQL_DRIVER_MYSQL, SQL_DRIVER_POSTGRESQL, SQL_DRIVER_H2, SQL_DRIVER_HYPER, SQL_DRIVER_SQL_SERVER};
-
- public static final String SQL_DRIVER_MYSQL_URL = "jdbc:mysql://localhost:3306/";
- public static final String SQL_DRIVER_POSTGRESQL_URL = "jdbc:postgresql://localhost:5432/";
- public static final String SQL_DRIVER_H2_URL = "jdbc:h2:file:/";
- public static final String SQL_DRIVER_HYPER_URL = "jdbc:hsqldb:file:/";
- public static final String SQL_DRIVER_SQL_SERVER_URL = "jdbc:sqlserver://localhost:1433/";
-
- /*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private static final Log logger = LogFactory.getLog(SQLPIPConfigurationComponent.class);
-
- private final SQLPIPConfigurationComponent self = this;
- private final BasicNotifier notifier = new BasicNotifier();
- private final EntityItem<PIPConfiguration> entity;
- /**
- * The constructor should first build the main layout, set the
- * composition root and then do any custom initialization.
- *
- * The constructor will not be automatically regenerated by the
- * visual editor.
- * @param configParamField
- */
- public SQLPIPConfigurationComponent(EntityItem<PIPConfiguration> entity) {
- buildMainLayout();
- setCompositionRoot(mainLayout);
- //
- // Save
- //
- this.entity = entity;
- //
- // Initialize
- //
- this.initialize();
- //
- // Finish
- //
- this.reset();
- }
-
- protected void initialize() {
- if (logger.isDebugEnabled()) {
- logger.debug("initializing " + this.entity.getEntity().toString());
- }
- //
- // Iterate any existing values, save them in the data field for each
- // GUI object.
- //
- Set<PIPConfigParam> unneeded = new HashSet<PIPConfigParam>();
- for (PIPConfigParam param : this.entity.getEntity().getPipconfigParams()) {
- //
- // Sanity check
- //
- if (param.getParamName() == null) {
- logger.warn("Null parameter name found.");
- unneeded.add(param);
- continue;
- }
- if (param.getParamName().equals(SQL_TYPE)) {
- this.comboBoxConnectionType.setData(param);
- } else if (param.getParamName().equals(SQL_DATASOURCE)) {
- this.textFieldDataSource.setData(param);
- } else if (param.getParamName().equals(SQL_DRIVER)) {
- this.comboBoxSQLDriver.setData(param);
- } else if (param.getParamName().equals(SQL_URL)) {
- this.textFieldConnectionURL.setData(param);
- } else if (param.getParamName().equals(SQL_USER)) {
- this.textFieldUser.setData(param);
- } else if (param.getParamName().equals(SQL_PASSWORD)) {
- this.textFieldPassword.setData(param);
- } else {
- unneeded.add(param);
- }
- }
- //
- // Get rid of parameters that are not needed
- //
- if (unneeded.isEmpty() == false) {
- this.entity.getEntity().getPipconfigParams().removeAll(unneeded);
- }
- //
- // Now finish initializing the GUI objects
- //
- this.initializeEntity();
- this.initializeTypeCombo();
- this.initializeSQLDriverCombo();
- this.initializeText();
- this.initializeButtons();
- }
-
- protected void initializeEntity() {
- //
- // Initialize the entity
- //
- this.entity.getEntity().setClassname(CLASSNAME);
- this.entity.getEntity().setRequiresResolvers(true);
- }
-
- protected void initializeTypeCombo() {
- //
- // Setup GUI properties
- //
- this.comboBoxConnectionType.setImmediate(true);
- this.comboBoxConnectionType.setNullSelectionAllowed(false);
- this.comboBoxConnectionType.setRequired(true);
- this.comboBoxConnectionType.setRequiredError("You must select a connection type.");
- //
- // Add the possible items
- //
- this.comboBoxConnectionType.addItem(SQL_TYPE_JDBC);
- this.comboBoxConnectionType.addItem(SQL_TYPE_JNDI);
- //
- // Respond to events
- //
- this.comboBoxConnectionType.addValueChangeListener(new ValueChangeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- PIPConfigParam param = (PIPConfigParam) self.comboBoxConnectionType.getData();
- if (param == null) {
- param = new PIPConfigParam(SQL_TYPE);
- self.entity.getEntity().addPipconfigParam(param);
- self.comboBoxConnectionType.setData(param);
- }
- param.setParamValue(self.comboBoxConnectionType.getValue().toString());
- self.reset();
- self.fireFormChangedEvent();
- }
- });
- //
- // Set its default selection. If there isn't one, then we default to JDBC.
- //
- PIPConfigParam param = (PIPConfigParam) this.comboBoxConnectionType.getData();
- if (param == null) {
- param = new PIPConfigParam(SQL_TYPE, SQL_TYPE_JDBC);
- this.entity.getEntity().addPipconfigParam(param);
- this.comboBoxConnectionType.setData(param);
- }
- this.comboBoxConnectionType.select(param.getParamValue());
- }
-
- protected void initializeSQLDriverCombo() {
- //
- // GUI properties
- //
- this.comboBoxSQLDriver.setImmediate(true);
- this.comboBoxSQLDriver.setRequired(true);
- this.comboBoxConnectionType.setRequiredError("You must select a JDBC Driver");
- this.comboBoxSQLDriver.setInputPrompt("Eg. com.mysql.jdbc.Driver");
- //
- // Add some common driver values. These are the drivers we have tested with so far.
- //
- for (String driver : SQL_DRIVERS) {
- this.comboBoxSQLDriver.addItem(driver);
- }
- //
- // Setup the default selection
- //
- PIPConfigParam param = (PIPConfigParam) this.comboBoxSQLDriver.getData();
- if (param != null) {
- this.comboBoxSQLDriver.setValue(param.getParamValue());
- //
- // Check if its there (the value could be something other than what we
- // have setup in our list of defaults.)
- //
- boolean bFound = false;
- for (Object id : this.comboBoxSQLDriver.getItemIds()) {
- Item item = this.comboBoxSQLDriver.getItem(id);
- if (item.toString().equals(param.getParamValue())) {
- bFound = true;
- break;
- }
- }
- if (! bFound) {
- //
- // It's not one of our defaults, no problem. Add it in.
- //
- this.comboBoxSQLDriver.addItem(param.getParamValue());
- this.comboBoxSQLDriver.setValue(param.getParamValue());
- }
- }
- //
- // Allow new items
- //
- this.comboBoxSQLDriver.setNewItemsAllowed(true);
- //
- // Respond to selection changes
- //
- this.comboBoxSQLDriver.addValueChangeListener(new ValueChangeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- PIPConfigParam param = (PIPConfigParam) self.comboBoxSQLDriver.getData();
- if (param == null) {
- param = new PIPConfigParam(SQL_DRIVER, self.comboBoxSQLDriver.getValue().toString());
- self.entity.getEntity().addPipconfigParam(param);
- self.comboBoxSQLDriver.setData(param);
- }
- //
- // Was something unselected?
- //
- if (self.comboBoxSQLDriver.getValue() == null) {
- param.setParamValue(null);
- } else {
- param.setParamValue(self.comboBoxSQLDriver.getValue().toString());
- //
- // See if we should pre-populate the driver URL
- //
- self.setupDriverURL(self.comboBoxSQLDriver.getValue().toString());
- }
- //
- // Fire
- //
- self.fireFormChangedEvent();
- }
- });
- }
-
- protected void initializeText() {
- //
- // GUI properties
- //
- this.textFieldDataSource.setImmediate(true);
- this.textFieldDataSource.setNullRepresentation("");
- this.textFieldDataSource.setRequired(true);
- this.textFieldDataSource.setRequiredError("The name of the JNDI Resource is needed.");
- //
- // Get its initial value
- //
- PIPConfigParam param = (PIPConfigParam) this.textFieldDataSource.getData();
- if (param != null) {
- this.textFieldDataSource.setValue(param.getParamValue());
- }
- //
- // Respond to value changes
- //
- this.textFieldDataSource.addValueChangeListener(new ValueChangeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- PIPConfigParam param = (PIPConfigParam) self.textFieldDataSource.getData();
- if (param == null) {
- param = new PIPConfigParam(SQL_DATASOURCE, self.textFieldDataSource.getValue());
- self.entity.getEntity().addPipconfigParam(param);
- self.textFieldDataSource.setData(param);
- }
- param.setParamValue(self.textFieldDataSource.getValue());
- self.fireFormChangedEvent();
- }
- });
- //
- // Setup GUI properties
- //
- this.textFieldConnectionURL.setImmediate(true);
- this.textFieldConnectionURL.setNullRepresentation("");
- this.textFieldConnectionURL.setRequired(true);
- this.textFieldConnectionURL.setRequiredError("A URL is needed to connect to the database.");
- //
- // Set its default value
- //
- param = (PIPConfigParam) this.textFieldConnectionURL.getData();
- if (param != null) {
- this.textFieldConnectionURL.setValue(param.getParamValue());
- }
- //
- // Respond to value changes
- //
- this.textFieldConnectionURL.addValueChangeListener(new ValueChangeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- PIPConfigParam param = (PIPConfigParam) self.textFieldConnectionURL.getData();
- if (param == null) {
- param = new PIPConfigParam(SQL_URL);
- self.entity.getEntity().addPipconfigParam(param);
- self.textFieldConnectionURL.setData(param);
- }
- param.setParamValue(self.textFieldConnectionURL.getValue());
- self.fireFormChangedEvent();
- }
- });
- //
- // Set GUI properties
- //
- this.textFieldUser.setImmediate(true);
- this.textFieldUser.setNullRepresentation("");
- this.textFieldUser.setRequired(true);
- this.textFieldUser.setRequiredError("User name is required.");
- //
- // Setup its default value
- //
- param = (PIPConfigParam) self.textFieldUser.getData();
- if (param != null) {
- this.textFieldUser.setValue(param.getParamValue());
- }
- //
- // Respond to value changes
- //
- this.textFieldUser.addValueChangeListener(new ValueChangeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- PIPConfigParam param = (PIPConfigParam) self.textFieldUser.getData();
- if (param == null) {
- param = new PIPConfigParam(SQL_USER);
- self.entity.getEntity().addPipconfigParam(param);
- self.textFieldUser.setData(param);
- }
- param.setParamValue(self.textFieldUser.getValue());
- self.fireFormChangedEvent();
- }
- });
- //
- // Initialize GUI properties
- //
- this.textFieldPassword.setImmediate(true);
- this.textFieldPassword.setNullRepresentation("");
- //
- // Set its default value
- //
- param = (PIPConfigParam) self.textFieldPassword.getData();
- if (param != null) {
- this.textFieldPassword.setValue(param.getParamValue());
- }
- //
- // Respond to value change events
- //
- this.textFieldPassword.addValueChangeListener(new ValueChangeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void valueChange(ValueChangeEvent event) {
- PIPConfigParam param = (PIPConfigParam) self.textFieldPassword.getData();
- if (param == null) {
- param = new PIPConfigParam(SQL_PASSWORD);
- self.entity.getEntity().addPipconfigParam(param);
- self.textFieldPassword.setData(param);
- }
- param.setParamValue(self.textFieldPassword.getValue());
- self.fireFormChangedEvent();
- }
- });
- }
-
- protected void initializeButtons() {
- this.buttonTest.setImmediate(true);
- this.buttonTest.addClickListener(new ClickListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void buttonClick(ClickEvent event) {
- Object id = self.comboBoxConnectionType.getValue();
- if (id == null) {
- logger.warn("No combo box selection");
- return;
- }
- if (id.toString().equals(SQL_TYPE_JDBC)) {
- self.testJDBCConnection();
- } else if (id.toString().equals(SQL_TYPE_JNDI)) {
- self.testJNDIConnection();
- }
- }
- });
- }
-
- protected void setupDriverURL(String value) {
- if (value.equals(SQL_DRIVER_MYSQL)) {
- this.textFieldConnectionURL.setValue(SQL_DRIVER_MYSQL_URL);
- } else if (value.equals(SQL_DRIVER_POSTGRESQL)) {
- this.textFieldConnectionURL.setValue(SQL_DRIVER_POSTGRESQL_URL);
- } else if (value.equals(SQL_DRIVER_H2)) {
- this.textFieldConnectionURL.setValue(SQL_DRIVER_H2_URL);
- } else if (value.equals(SQL_DRIVER_HYPER)) {
- this.textFieldConnectionURL.setValue(SQL_DRIVER_HYPER_URL);
- } else if (value.equals(SQL_DRIVER_SQL_SERVER)) {
- this.textFieldConnectionURL.setValue(SQL_DRIVER_SQL_SERVER_URL);
- }
- }
-
- protected void testJNDIConnection() {
- try {
- Context initialContext = new InitialContext();
- DataSource dataSource = (DataSource) initialContext.lookup(this.textFieldDataSource.getValue());
- try (Connection connection = dataSource.getConnection()) {
- new Notification("Success!",
- "Connection Established!",
- Type.HUMANIZED_MESSAGE, true)
- .show(Page.getCurrent());
- }
- } catch (NamingException e) {
- logger.error(e);
- new Notification("JNDI Naming Exception",
- "<br/>" + e.getLocalizedMessage() + "<br/>Is the context defined in this J2EE Container instance?",
- Type.ERROR_MESSAGE, true)
- .show(Page.getCurrent());
- } catch (SQLException e) {
- logger.error(e);
- new Notification("SQL Exception",
- "<br/>" + e.getLocalizedMessage() + "<br/>Are the configuration parameters correct?",
- Type.ERROR_MESSAGE, true)
- .show(Page.getCurrent());
- }
- }
-
- protected void testJDBCConnection() {
- try {
- if (this.comboBoxSQLDriver.getValue() != null) {
- Class.forName(this.comboBoxSQLDriver.getValue().toString());
- } else {
- throw new ClassNotFoundException("Please select a JDBC driver to load.");
- }
- } catch (ClassNotFoundException e) {
- logger.error(e);
- new Notification("Driver Exception",
- "<br/>" + e.getLocalizedMessage() + "<br/>Is the JDBC driver's jar in the J2EE container path?",
- Type.ERROR_MESSAGE, true)
- .show(Page.getCurrent());
- return;
- }
- Connection connection = null;
- try {
- connection = DriverManager.getConnection(this.textFieldConnectionURL.getValue(), this.textFieldUser.getValue(), this.textFieldPassword.getValue());
- new Notification("Success!",
- "Connection Established!",
- Type.HUMANIZED_MESSAGE, true)
- .show(Page.getCurrent());
- } catch (SQLException e) {
- logger.error(e);
- new Notification("SQL Exception",
- "<br/>" + e.getLocalizedMessage() + "<br/>Are the configuration parameters correct?",
- Type.ERROR_MESSAGE, true)
- .show(Page.getCurrent());
- } finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException idontcare) { //NOPMD
- }
- }
- }
- }
-
- protected void reset() {
- Object id = this.comboBoxConnectionType.getValue();
- if (id == null) {
- logger.warn("Can't reset combo hasn't selected anything.");
- return;
- }
- if (id.toString().equals(SQL_TYPE_JDBC)) {
- //
- //
- //
- this.textFieldDataSource.setVisible(false);
- this.textFieldDataSource.setRequired(false);
- //
- //
- //
- this.textFieldConnectionURL.setVisible(true);
- this.textFieldConnectionURL.setRequired(true);
- this.comboBoxSQLDriver.setVisible(true);
- this.comboBoxSQLDriver.setRequired(true);
- this.textFieldUser.setVisible(true);
- this.textFieldUser.setRequired(true);
- this.textFieldPassword.setVisible(true);
- } else if (id.toString().equals(SQL_TYPE_JNDI)) {
- //
- //
- //
- this.textFieldDataSource.setVisible(true);
- this.textFieldDataSource.setRequired(true);
- //
- //
- //
- this.textFieldConnectionURL.setVisible(false);
- this.textFieldConnectionURL.setRequired(false);
- this.comboBoxSQLDriver.setVisible(false);
- this.comboBoxSQLDriver.setRequired(false);
- this.textFieldUser.setVisible(false);
- this.textFieldUser.setRequired(false);
- this.textFieldPassword.setVisible(false);
- } else {
- logger.warn("Unknown SQL type selection: " + id);
- }
- }
-
- public void validate() throws InvalidValueException {
- if (logger.isDebugEnabled()) {
- logger.debug("validate");
- }
- this.comboBoxConnectionType.validate();
- this.textFieldDataSource.validate();
- this.textFieldConnectionURL.validate();
- this.comboBoxSQLDriver.validate();
- this.textFieldPassword.validate();
- this.textFieldUser.validate();
- }
-
- public void commit() throws SourceException, InvalidValueException {
- if (logger.isDebugEnabled()) {
- logger.debug("commit");
- }
- this.comboBoxConnectionType.commit();
-
- Object id = this.comboBoxConnectionType.getValue();
- if (id == null) {
- logger.warn("Can't reset combo hasn't selected anything.");
- return;
- }
- if (id.toString().equals(SQL_TYPE_JDBC)) {
- this.textFieldConnectionURL.commit();
- this.comboBoxSQLDriver.commit();
- this.textFieldPassword.commit();
- this.textFieldUser.commit();
-
- this.textFieldDataSource.setData(null);
- this.entity.getEntity().getPipconfigParams().remove(SQL_DATASOURCE);
-
- } else if (id.toString().equals(SQL_TYPE_JNDI)) {
-
- this.textFieldDataSource.commit();
-
- this.textFieldConnectionURL.setData(null);
- this.comboBoxSQLDriver.setData(null);
- this.textFieldPassword.setData(null);
- this.textFieldUser.setData(null);
- /* ???
- this.entity.getEntity().getPipconfigParams().remove(SQL_TYPE);
- this.entity.getEntity().getPipconfigParams().remove(SQL_DRIVER);
- this.entity.getEntity().getPipconfigParams().remove(SQL_URL);
- this.entity.getEntity().getPipconfigParams().remove(SQL_USER);
- this.entity.getEntity().getPipconfigParams().remove(SQL_PASSWORD);
- */
- }
- }
-
- public void discard() throws SourceException {
- if (logger.isDebugEnabled()) {
- logger.debug("discard");
- }
- this.textFieldDataSource.setData(null);
- this.textFieldConnectionURL.setData(null);
- this.comboBoxSQLDriver.setData(null);
- this.textFieldPassword.setData(null);
- this.textFieldUser.setData(null);
-
- this.entity.getEntity().getPipconfigParams().remove(SQL_TYPE);
- this.entity.getEntity().getPipconfigParams().remove(SQL_DATASOURCE);
- this.entity.getEntity().getPipconfigParams().remove(SQL_DRIVER);
- this.entity.getEntity().getPipconfigParams().remove(SQL_URL);
- this.entity.getEntity().getPipconfigParams().remove(SQL_USER);
- this.entity.getEntity().getPipconfigParams().remove(SQL_PASSWORD);
- }
-
- @Override
- public boolean addListener(FormChangedEventListener listener) {
- return this.notifier.addListener(listener);
- }
-
- @Override
- public boolean removeListener(FormChangedEventListener listener) {
- return this.notifier.removeListener(listener);
- }
-
- @Override
- public void fireFormChangedEvent() {
- this.notifier.fireFormChangedEvent();
- }
-
- @AutoGenerated
- private VerticalLayout buildMainLayout() {
- // common part: create layout
- mainLayout = new VerticalLayout();
- mainLayout.setImmediate(false);
- mainLayout.setWidth("-1px");
- mainLayout.setHeight("-1px");
- mainLayout.setMargin(false);
- mainLayout.setSpacing(true);
-
- // top-level component properties
- setWidth("-1px");
- setHeight("-1px");
-
- // comboBoxConnectionType
- comboBoxConnectionType = new ComboBox();
- comboBoxConnectionType.setCaption("Type of SQL Connection");
- comboBoxConnectionType.setImmediate(false);
- comboBoxConnectionType.setWidth("-1px");
- comboBoxConnectionType.setHeight("-1px");
- mainLayout.addComponent(comboBoxConnectionType);
-
- // textFieldDataSource
- textFieldDataSource = new TextField();
- textFieldDataSource.setCaption("Data Source");
- textFieldDataSource.setImmediate(false);
- textFieldDataSource.setWidth("-1px");
- textFieldDataSource.setHeight("-1px");
- mainLayout.addComponent(textFieldDataSource);
- mainLayout.setExpandRatio(textFieldDataSource, 1.0f);
-
- // comboBoxSQLDriver
- comboBoxSQLDriver = new ComboBox();
- comboBoxSQLDriver.setCaption("JDBC Driver");
- comboBoxSQLDriver.setImmediate(false);
- comboBoxSQLDriver.setWidth("-1px");
- comboBoxSQLDriver.setHeight("-1px");
- mainLayout.addComponent(comboBoxSQLDriver);
- mainLayout.setExpandRatio(comboBoxSQLDriver, 1.0f);
-
- // textFieldConnectionURL
- textFieldConnectionURL = new TextField();
- textFieldConnectionURL.setCaption("Connection URL");
- textFieldConnectionURL.setImmediate(false);
- textFieldConnectionURL.setWidth("-1px");
- textFieldConnectionURL.setHeight("-1px");
- mainLayout.addComponent(textFieldConnectionURL);
- mainLayout.setExpandRatio(textFieldConnectionURL, 1.0f);
-
- // textFieldUser
- textFieldUser = new TextField();
- textFieldUser.setCaption("User");
- textFieldUser.setImmediate(false);
- textFieldUser.setWidth("-1px");
- textFieldUser.setHeight("-1px");
- mainLayout.addComponent(textFieldUser);
- mainLayout.setExpandRatio(textFieldUser, 1.0f);
-
- // textFieldPassword
- textFieldPassword = new PasswordField();
- textFieldPassword.setCaption("Password");
- textFieldPassword.setImmediate(false);
- textFieldPassword.setWidth("-1px");
- textFieldPassword.setHeight("-1px");
- mainLayout.addComponent(textFieldPassword);
- mainLayout.setExpandRatio(textFieldPassword, 1.0f);
-
- // buttonTest
- buttonTest = new Button();
- buttonTest.setCaption("Test Connection");
- buttonTest.setImmediate(true);
- buttonTest.setWidth("-1px");
- buttonTest.setHeight("-1px");
- mainLayout.addComponent(buttonTest);
- mainLayout.setComponentAlignment(buttonTest, new Alignment(48));
-
- return mainLayout;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/ApplyParametersChangedListener.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/ApplyParametersChangedListener.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/ApplyParametersChangedListener.java
deleted file mode 100644
index da86e03..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/ApplyParametersChangedListener.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.events;
-
-import org.apache.openaz.xacml.admin.jpa.FunctionArgument;
-
-import oasis.names.tc.xacml._3_0.core.schema.wd_17.ApplyType;
-
-public interface ApplyParametersChangedListener {
-
- void applyParameterChanged(ApplyType apply, ApplyType parent, FunctionArgument argument, Object container);
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/ApplyParametersChangedNotifier.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/ApplyParametersChangedNotifier.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/ApplyParametersChangedNotifier.java
deleted file mode 100644
index 2491e18..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/ApplyParametersChangedNotifier.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.events;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.apache.openaz.xacml.admin.jpa.FunctionArgument;
-
-import oasis.names.tc.xacml._3_0.core.schema.wd_17.ApplyType;
-
-public interface ApplyParametersChangedNotifier {
-
- boolean addListener(ApplyParametersChangedListener listener);
-
- boolean removeListener(ApplyParametersChangedListener listener);
-
- void fireEvent(ApplyType apply, ApplyType parent, FunctionArgument argument, Object container);
-
- class BasicNotifier implements ApplyParametersChangedNotifier {
- Collection<ApplyParametersChangedListener> listeners = null;
-
- @Override
- public boolean addListener(ApplyParametersChangedListener listener) {
- if (this.listeners == null) {
- this.listeners = new ArrayList<ApplyParametersChangedListener>();
- }
- return this.listeners.add(listener);
- }
-
- @Override
- public boolean removeListener(ApplyParametersChangedListener listener) {
- if (this.listeners == null) {
- return false;
- }
- return this.listeners.remove(listener);
- }
-
- @Override
- public void fireEvent(ApplyType apply, ApplyType parent, FunctionArgument argument, Object container) {
- if (this.listeners == null) {
- return;
- }
- for (ApplyParametersChangedListener listener : this.listeners) {
- listener.applyParameterChanged(apply, parent, argument, container);
- }
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/AttributeChangedEventListener.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/AttributeChangedEventListener.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/AttributeChangedEventListener.java
deleted file mode 100644
index 10fb9a2..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/AttributeChangedEventListener.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.events;
-
-import org.apache.openaz.xacml.admin.jpa.Attribute;
-
-public interface AttributeChangedEventListener {
- void attributeChanged(Attribute attribute);
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/AttributeChangedEventNotifier.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/AttributeChangedEventNotifier.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/AttributeChangedEventNotifier.java
deleted file mode 100644
index da7606f..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/AttributeChangedEventNotifier.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.events;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.apache.openaz.xacml.admin.jpa.Attribute;
-
-public interface AttributeChangedEventNotifier {
-
- boolean addListener(AttributeChangedEventListener listener);
-
- boolean removeListener(AttributeChangedEventListener listener);
-
- void fireAttributeChanged(Attribute attribute);
-
- void commit();
-
- Attribute getAttribute();
-
- class BasicNotifier implements AttributeChangedEventNotifier {
- Collection<AttributeChangedEventListener> listeners = null;
-
- @Override
- public boolean addListener(AttributeChangedEventListener listener) {
- if (this.listeners == null) {
- this.listeners = new ArrayList<AttributeChangedEventListener>();
- }
- return this.listeners.add(listener);
- }
-
- @Override
- public boolean removeListener(AttributeChangedEventListener listener) {
- if (this.listeners == null) {
- return false;
- }
- return this.listeners.remove(listener);
- }
-
- @Override
- public void fireAttributeChanged(Attribute attribute) {
- if (this.listeners == null) {
- return;
- }
- for (AttributeChangedEventListener listener : this.listeners) {
- listener.attributeChanged(attribute);
- }
- }
-
- public void commit() {
-
- }
-
- public Attribute getAttribute() {
- return null;
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/FormChangedEventListener.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/FormChangedEventListener.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/FormChangedEventListener.java
deleted file mode 100644
index 4637ee7..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/FormChangedEventListener.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.events;
-
-public interface FormChangedEventListener {
- void onFormChanged();
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/FormChangedEventNotifier.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/FormChangedEventNotifier.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/FormChangedEventNotifier.java
deleted file mode 100644
index 1b8ba9d..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/events/FormChangedEventNotifier.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.events;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-public interface FormChangedEventNotifier {
- boolean addListener(FormChangedEventListener listener);
- boolean removeListener(FormChangedEventListener listener);
- void fireFormChangedEvent();
-
- class BasicNotifier implements FormChangedEventNotifier {
- Collection<FormChangedEventListener> listeners = null;
-
- @Override
- public boolean addListener(FormChangedEventListener listener) {
- if (this.listeners == null) {
- this.listeners = new ArrayList<FormChangedEventListener>();
- }
- return this.listeners.add(listener);
- }
-
- @Override
- public boolean removeListener(FormChangedEventListener listener) {
- if (this.listeners == null) {
- this.listeners = new ArrayList<FormChangedEventListener>();
- }
- return this.listeners.remove(listener);
- }
-
- @Override
- public void fireFormChangedEvent() {
- if (this.listeners == null) {
- return;
- }
- for (FormChangedEventListener listener : this.listeners) {
- listener.onFormChanged();
- }
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/ConfigParamField.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/ConfigParamField.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/ConfigParamField.java
deleted file mode 100644
index c91a192..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/ConfigParamField.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.fields;
-
-import java.util.Collection;
-
-import org.apache.openaz.xacml.admin.jpa.PIPConfiguration;
-import org.apache.openaz.xacml.admin.jpa.PIPType;
-import org.apache.openaz.xacml.admin.view.components.CSVPIPConfigurationComponent;
-import org.apache.openaz.xacml.admin.view.components.CustomPIPConfigurationComponent;
-import org.apache.openaz.xacml.admin.view.components.HyperCSVPIPConfigurationComponent;
-import org.apache.openaz.xacml.admin.view.components.LDAPPIPConfigurationComponent;
-import org.apache.openaz.xacml.admin.view.components.SQLPIPConfigurationComponent;
-import org.apache.openaz.xacml.admin.view.events.FormChangedEventListener;
-import com.vaadin.addon.jpacontainer.EntityItem;
-import com.vaadin.data.Validator.InvalidValueException;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.CustomField;
-import com.vaadin.ui.VerticalLayout;
-
-public class ConfigParamField extends CustomField<Object> implements FormChangedEventListener {
- private static final long serialVersionUID = 1L;
- private final EntityItem<PIPConfiguration> entityConfig;
- private VerticalLayout mainLayout = new VerticalLayout();
-
- public ConfigParamField(EntityItem<PIPConfiguration> config) {
- //
- // Save
- //
- this.entityConfig = config;
- //
- // Make sure we can auto-fit
- //
- this.setWidth("-1px");
- this.mainLayout.setWidth("-1px");
- }
-
- public Component resetContent(PIPType pipType) {
- //
- // Remove all the layout
- //
- this.mainLayout.removeAllComponents();
- this.mainLayout.setDescription("Custom Field Layout");
- //
- // Is there a type?
- //
- if (pipType == null) {
- return this.mainLayout;
- }
- //
- // Setup the layout based on the type
- //
- Component c = null;
- String type = pipType.getType();
- if (type.equals(PIPType.TYPE_SQL)) {
- SQLPIPConfigurationComponent comp = new SQLPIPConfigurationComponent(this.entityConfig);
- comp.addListener(this);
- c = comp;
- } else if (type.equals(PIPType.TYPE_LDAP)) {
- LDAPPIPConfigurationComponent comp = new LDAPPIPConfigurationComponent(this.entityConfig);
- comp.addListener(this);
- c = comp;
- } else if (type.equals(PIPType.TYPE_CSV)) {
- CSVPIPConfigurationComponent comp = new CSVPIPConfigurationComponent(this.entityConfig);
- comp.addListener(this);
- c = comp;
- } else if (type.equals(PIPType.TYPE_HYPERCSV)) {
- HyperCSVPIPConfigurationComponent comp = new HyperCSVPIPConfigurationComponent(this.entityConfig);
- comp.addListener(this);
- c = comp;
- } else if (type.equals(PIPType.TYPE_CUSTOM)) {
- CustomPIPConfigurationComponent comp = new CustomPIPConfigurationComponent(this.entityConfig);
- comp.addListener(this);
- c = comp;
- }
- if (c != null) {
- this.mainLayout.addComponent(c);
- }
- //
- // Done
- //
- return this.mainLayout;
- }
-
- @Override
- protected Component initContent() {
- return this.resetContent(this.entityConfig.getEntity().getPiptype());
- }
-
- @Override
- public void validate() throws InvalidValueException {
- if (this.mainLayout.getComponentCount() == 0) {
- return;
- }
- Component c = this.mainLayout.getComponent(0);
- if (c instanceof SQLPIPConfigurationComponent) {
- ((SQLPIPConfigurationComponent)c).validate();
- } else if (c instanceof LDAPPIPConfigurationComponent) {
- ((LDAPPIPConfigurationComponent)c).validate();
- } else if (c instanceof CSVPIPConfigurationComponent) {
- ((CSVPIPConfigurationComponent)c).validate();
- } else if (c instanceof HyperCSVPIPConfigurationComponent) {
- ((HyperCSVPIPConfigurationComponent)c).validate();
- } else if (c instanceof CustomPIPConfigurationComponent) {
- ((CustomPIPConfigurationComponent)c).validate();
- }
- super.validate();
- }
-
- @Override
- public void commit() throws SourceException, InvalidValueException {
- if (this.mainLayout.getComponentCount() == 0) {
- return;
- }
- Component c = this.mainLayout.getComponent(0);
- if (c instanceof SQLPIPConfigurationComponent) {
- ((SQLPIPConfigurationComponent)c).commit();
- } else if (c instanceof LDAPPIPConfigurationComponent) {
- ((LDAPPIPConfigurationComponent)c).commit();
- } else if (c instanceof CSVPIPConfigurationComponent) {
- ((CSVPIPConfigurationComponent)c).commit();
- } else if (c instanceof HyperCSVPIPConfigurationComponent) {
- ((HyperCSVPIPConfigurationComponent)c).commit();
- } else if (c instanceof CustomPIPConfigurationComponent) {
- ((CustomPIPConfigurationComponent)c).commit();
- }
- super.commit();
- }
-
- @Override
- public Class<?> getType() {
- return Collection.class;
- }
-
- @Override
- public void onFormChanged() {
- this.fireEvent(new com.vaadin.ui.Field.ValueChangeEvent(this));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/ConstraintField.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/ConstraintField.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/ConstraintField.java
deleted file mode 100644
index 2004510..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/ConstraintField.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.fields;
-
-import java.util.Collection;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.apache.openaz.xacml.admin.jpa.Attribute;
-import org.apache.openaz.xacml.admin.jpa.ConstraintType;
-import org.apache.openaz.xacml.admin.view.components.EnumerationEditorComponent;
-import org.apache.openaz.xacml.admin.view.components.RangeEditorComponent;
-import org.apache.openaz.xacml.admin.view.components.RegexpEditorComponent;
-import org.apache.openaz.xacml.api.Identifier;
-import com.vaadin.addon.jpacontainer.EntityItem;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.CustomField;
-import com.vaadin.ui.VerticalLayout;
-
-public class ConstraintField extends CustomField<Object> {
- private static final long serialVersionUID = 1L;
- private static final Log logger = LogFactory.getLog(ConstraintField.class);
-
- private VerticalLayout mainLayout = new VerticalLayout();
- private EntityItem<Attribute> attributeEntity;
-
- /**
- * The constructor should first build the main layout, set the
- * composition root and then do any custom initialization.
- *
- * The constructor will not be automatically regenerated by the
- * visual editor.
- */
- public ConstraintField(EntityItem<Attribute> entityItem) {
- //
- // Save our Attribute that we are editing
- //
- this.attributeEntity = entityItem;
- }
-
- public void resetDatatype(Identifier id) {
- if (logger.isDebugEnabled()) {
- logger.debug("resetDatatype " + id);
- }
- if (this.mainLayout.getComponentCount() == 0) {
- return;
- }
- Component component = this.mainLayout.getComponent(0);
- if (component != null && component instanceof RangeEditorComponent) {
- ((RangeEditorComponent) component).setupDatatype(id);
- }
- if (component != null && component instanceof EnumerationEditorComponent) {
- ((EnumerationEditorComponent) component).setupDatatype(id);
- }
- }
-
- public Component resetContent(ConstraintType type, Identifier datatype) {
- //
- // Remove all existing components
- //
- this.mainLayout.removeAllComponents();
- //
- // What are we constrained to?
- //
- if (type == null || type.getConstraintType() == null) {
- //
- // No constraint defined
- //
- this.attributeEntity.getEntity().removeAllConstraintValues();
- return mainLayout;
- }
- if (type.getConstraintType().equals("Enumeration")) {
- mainLayout.addComponent(new EnumerationEditorComponent(this.attributeEntity.getEntity(), datatype));
- } else if (type.getConstraintType().equals("Range")) {
- mainLayout.addComponent(new RangeEditorComponent(this.attributeEntity.getEntity(), datatype));
- } else if (type.getConstraintType().equals("Regular Expression")) {
- mainLayout.addComponent(new RegexpEditorComponent(this.attributeEntity.getEntity()));
- }
- return mainLayout;
- }
-
- @Override
- protected Component initContent() {
- return this.resetContent(this.attributeEntity.getEntity().getConstraintType(), this.attributeEntity.getEntity().getDatatypeBean().getIdentifer());
- }
-
- @Override
- public Class<?> getType() {
- return Collection.class;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/DesignatorSelectorField.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/DesignatorSelectorField.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/DesignatorSelectorField.java
deleted file mode 100644
index 62c7ffa..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/DesignatorSelectorField.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.fields;
-
-import org.apache.openaz.xacml.admin.jpa.Attribute;
-import com.vaadin.addon.jpacontainer.EntityItem;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.CustomField;
-import com.vaadin.ui.OptionGroup;
-
-public class DesignatorSelectorField extends CustomField<Object> {
- private static final long serialVersionUID = 1L;
- private final DesignatorSelectorField self = this;
- private final OptionGroup selectDesignator = new OptionGroup("Type of attribute");
-
- public DesignatorSelectorField(EntityItem<Attribute> attributeEntity) {
- this.selectDesignator.setImmediate(true);
- this.selectDesignator.addItem(Attribute.ATTRIBUTE_DESIGNATOR);
- this.selectDesignator.addItem(Attribute.ATTRIBUTE_SELECTOR);
- if (attributeEntity.getEntity().isDesignator()) {
- this.selectDesignator.select(Attribute.ATTRIBUTE_DESIGNATOR);
- } else {
- this.selectDesignator.select(Attribute.ATTRIBUTE_SELECTOR);
- }
- //
- // Listen when designator vs selector changes
- //
- this.selectDesignator.addValueChangeListener(new ValueChangeListener() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void valueChange(
- com.vaadin.data.Property.ValueChangeEvent event) {
- Object value = self.selectDesignator.getValue();
- if (value != null) {
- if (value.toString().equals(Attribute.ATTRIBUTE_DESIGNATOR)) {
- self.setValue('1');
- } else if (value.toString().equals(Attribute.ATTRIBUTE_SELECTOR)) {
- self.setValue('0');
- }
- }
- }
- });
- }
-
- @Override
- protected Component initContent() {
- return this.selectDesignator;
- }
-
- @Override
- public Class<? extends Object> getType() {
- return Character.class;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/ExpressionField.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/ExpressionField.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/ExpressionField.java
deleted file mode 100644
index d1f250b..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/ExpressionField.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.fields;
-
-import java.util.Collection;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import com.vaadin.ui.Component;
-import com.vaadin.ui.CustomField;
-
-
-public class ExpressionField extends CustomField<Object> {
- private static final long serialVersionUID = 1L;
- private static final Log logger = LogFactory.getLog(ExpressionField.class); //NOPMD
-
- @Override
- protected Component initContent() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Class<? extends Object> getType() {
- return Collection.class;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/OaExpressionsField.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/OaExpressionsField.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/OaExpressionsField.java
deleted file mode 100644
index f5ca9fd..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/OaExpressionsField.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.fields;
-
-import java.util.Collection;
-
-import org.apache.openaz.xacml.admin.XacmlAdminUI;
-import org.apache.openaz.xacml.admin.jpa.Obadvice;
-import org.apache.openaz.xacml.admin.view.components.OaExpressionsEditorComponent;
-import com.vaadin.addon.jpacontainer.EntityItem;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.CustomField;
-import com.vaadin.ui.UI;
-
-public class OaExpressionsField extends CustomField<Object> {
- private static final long serialVersionUID = 1L;
- private final EntityItem<Obadvice> obad;
-
- public OaExpressionsField(EntityItem<Obadvice> obad) {
- this.obad = obad;
- }
-
- @Override
- protected Component initContent() {
- return new OaExpressionsEditorComponent(this.obad, ((XacmlAdminUI)UI.getCurrent()).getObadviceExpressions());
- }
-
- @Override
- public Class<? extends Object> getType() {
- return Collection.class;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/ResolverParamField.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/ResolverParamField.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/ResolverParamField.java
deleted file mode 100644
index 9986dc7..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/fields/ResolverParamField.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.fields;
-
-import java.util.Collection;
-
-import org.apache.openaz.xacml.admin.jpa.PIPResolver;
-import org.apache.openaz.xacml.admin.view.components.PIPParameterComponent;
-import org.apache.openaz.xacml.admin.view.events.FormChangedEventListener;
-import org.apache.openaz.xacml.admin.view.windows.PIPSQLResolverEditorWindow;
-import com.vaadin.addon.jpacontainer.EntityItem;
-import com.vaadin.data.Validator.InvalidValueException;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.CustomField;
-import com.vaadin.ui.VerticalLayout;
-
-public class ResolverParamField extends CustomField<Object> implements FormChangedEventListener {
- private static final long serialVersionUID = 1L;
- private final EntityItem<PIPResolver> entity;
- private VerticalLayout mainLayout = new VerticalLayout();
-
- public ResolverParamField(EntityItem<PIPResolver> entity) {
- this.entity = entity;
- //
- // Make sure we can auto-fit
- //
- this.setWidth("-1px");
- this.mainLayout.setWidth("-1px");
- }
-
- @Override
- public void onFormChanged() {
- this.fireEvent(new com.vaadin.ui.Field.ValueChangeEvent(this));
- }
-
- @Override
- protected Component initContent() {
- Component c = null;
- if (this.entity.getEntity().getPipconfiguration().getPiptype().isSQL() ||
- this.entity.getEntity().getPipconfiguration().getPiptype().isHyperCSV() ||
- this.entity.getEntity().getPipconfiguration().getPiptype().isLDAP() ||
- this.entity.getEntity().getPipconfiguration().getPiptype().isCSV() ) {
- //
- //
- //
- PIPSQLResolverEditorWindow comp = new PIPSQLResolverEditorWindow(this.entity);
- comp.addListener(this);
- c = comp;
- } else {
- //
- //
- //
- PIPParameterComponent comp = new PIPParameterComponent(this.entity.getEntity());
- comp.addListener(this);
- c = comp;
- }
- if (c != null) {
- this.mainLayout.addComponent(c);
- }
- return this.mainLayout;
- }
-
-
- @Override
- public void discard() throws SourceException {
- if (this.mainLayout.getComponentCount() == 0) {
- return;
- }
- Component c = this.mainLayout.getComponent(0);
- if (c instanceof PIPSQLResolverEditorWindow) {
- ((PIPSQLResolverEditorWindow)c).discard();
- }
- super.discard();
- }
-
- @Override
- public void validate() throws InvalidValueException {
- if (this.mainLayout.getComponentCount() == 0) {
- return;
- }
- Component c = this.mainLayout.getComponent(0);
- if (c instanceof PIPSQLResolverEditorWindow) {
- ((PIPSQLResolverEditorWindow)c).validate();
- }
- super.validate();
- }
-
- @Override
- public void commit() throws SourceException, InvalidValueException {
- if (this.mainLayout.getComponentCount() == 0) {
- return;
- }
- Component c = this.mainLayout.getComponent(0);
- if (c instanceof PIPSQLResolverEditorWindow) {
- ((PIPSQLResolverEditorWindow)c).commit();
- }
- super.commit();
- }
-
- @Override
- public Class<? extends Object> getType() {
- return Collection.class;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/AnyURIValidator.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/AnyURIValidator.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/AnyURIValidator.java
deleted file mode 100644
index 1101f23..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/AnyURIValidator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.validators;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import com.vaadin.data.Validator;
-
-public class AnyURIValidator implements Validator {
- private static final long serialVersionUID = 1L;
-
- public AnyURIValidator() {
- }
-
- @Override
- public void validate(Object value) throws InvalidValueException {
- if (value instanceof String) {
- try {
- new URI((String) value);
- } catch (URISyntaxException e) {
- throw new InvalidValueException(e.getLocalizedMessage());
- }
- } else
- throw new InvalidValueException("Unrecognized URI");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/Base64BinaryValidator.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/Base64BinaryValidator.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/Base64BinaryValidator.java
deleted file mode 100644
index 362a5d9..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/Base64BinaryValidator.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.validators;
-
-// import org.apache.commons.codec.DecoderException;
-import org.apache.commons.codec.binary.Base64;
-
-import com.vaadin.data.Validator;
-
-public class Base64BinaryValidator implements Validator {
- private static final long serialVersionUID = 1L;
-
- public Base64BinaryValidator() {
- }
-
- @Override
- public void validate(Object value) throws InvalidValueException {
- if (value instanceof String) {
- // try {
- new Base64().decode((String) value);
- // Base64().decode(String) inherited from
- // org.apache.commons.codec.binary.BaseNCodec
- // does not throw DecoderException in version 1.10
- // of org.apache.commons.codec (the version we are
- // using). This may need to be uncommented in later
- // versions.
- //
- // TODO - Since this does not throw an exception under
- // any circumstance, I question whether it is
- // a valid method of validating the input value.
- //
- // } catch (DecoderException e) {
- // throw new InvalidValueException(e.getLocalizedMessage());
- // }
- } else
- throw new InvalidValueException("Unrecognized Base64 Binary");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/BooleanValidator.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/BooleanValidator.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/BooleanValidator.java
deleted file mode 100644
index 0e2c8c1..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/BooleanValidator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.validators;
-
-import com.vaadin.data.Validator;
-
-public class BooleanValidator implements Validator {
- private static final long serialVersionUID = 1L;
-
- public BooleanValidator() {
- }
-
- @Override
- public void validate(Object value) throws InvalidValueException {
- if (value instanceof Boolean) {
- return;
- }
- if (value.toString().equalsIgnoreCase("true") ||
- value.toString().equalsIgnoreCase("false") ||
- value.toString().equalsIgnoreCase("0") ||
- value.toString().equalsIgnoreCase("1")) {
- return;
- }
- throw new InvalidValueException("Unrecognized boolean");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DNSNameValidator.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DNSNameValidator.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DNSNameValidator.java
deleted file mode 100644
index 3d2c8d0..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DNSNameValidator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.validators;
-
-import java.text.ParseException;
-
-import org.apache.openaz.xacml.std.datatypes.RFC2396DomainName;
-import com.vaadin.data.Validator;
-
-public class DNSNameValidator implements Validator {
- private static final long serialVersionUID = 1L;
-
- public DNSNameValidator() {
- }
-
- @Override
- public void validate(Object value) throws InvalidValueException {
- if (value instanceof String) {
- try {
- RFC2396DomainName.newInstance((String) value);
- } catch (ParseException e) {
- throw new InvalidValueException(e.getLocalizedMessage());
- }
- } else
- throw new InvalidValueException("Unrecognized DNS Name");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DateTimeValidator.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DateTimeValidator.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DateTimeValidator.java
deleted file mode 100644
index 4bdea6e..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DateTimeValidator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.validators;
-
-import java.text.ParseException;
-
-import org.apache.openaz.xacml.std.datatypes.ISO8601DateTime;
-import com.vaadin.data.Validator;
-
-public class DateTimeValidator implements Validator {
- private static final long serialVersionUID = 1L;
-
- public DateTimeValidator() {
- }
-
- @Override
- public void validate(Object value) throws InvalidValueException {
- if (value instanceof String) {
- try {
- ISO8601DateTime.fromISO8601DateTimeString((String) value);
- } catch (ParseException e) {
- throw new InvalidValueException(e.getLocalizedMessage());
- }
- } else
- throw new InvalidValueException("Unrecognized DateTime");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DateValidator.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DateValidator.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DateValidator.java
deleted file mode 100644
index 0d217e4..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DateValidator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.validators;
-
-import java.text.ParseException;
-
-import org.apache.openaz.xacml.std.datatypes.ISO8601Date;
-import com.vaadin.data.Validator;
-
-public class DateValidator implements Validator {
- private static final long serialVersionUID = 1L;
-
- public DateValidator() {
- }
-
- @Override
- public void validate(Object value) throws InvalidValueException {
- if (value instanceof String) {
- try {
- ISO8601Date.fromISO8601DateString((String) value);
- } catch (ParseException e) {
- throw new InvalidValueException(e.getLocalizedMessage());
- }
- } else
- throw new InvalidValueException("Unrecognized Date");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DayTimeDurationValidator.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DayTimeDurationValidator.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DayTimeDurationValidator.java
deleted file mode 100644
index f8aaa6b..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DayTimeDurationValidator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.validators;
-
-import java.text.ParseException;
-
-import org.apache.openaz.xacml.std.datatypes.XPathDayTimeDuration;
-import com.vaadin.data.Validator;
-
-public class DayTimeDurationValidator implements Validator {
- private static final long serialVersionUID = 1L;
-
- public DayTimeDurationValidator() {
- }
-
- @Override
- public void validate(Object value) throws InvalidValueException {
- if (value instanceof String) {
- try {
- XPathDayTimeDuration.newInstance((String) value);
- } catch (ParseException e) {
- throw new InvalidValueException(e.getLocalizedMessage());
- }
- } else
- throw new InvalidValueException("Unrecognized DayTimeDuration");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DoubleValidator.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DoubleValidator.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DoubleValidator.java
deleted file mode 100644
index a0fc0dd..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/DoubleValidator.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.validators;
-
-import com.vaadin.data.Validator;
-
-public class DoubleValidator implements Validator {
- private static final long serialVersionUID = 1L;
-
- public DoubleValidator() {
- }
-
- @Override
- public void validate(Object value) throws InvalidValueException {
- if (value instanceof Double) {
- return;
- }
- try {
- Double.parseDouble(value.toString());
- } catch (NumberFormatException e) {
- throw new InvalidValueException(e.getLocalizedMessage());
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/HexBinaryValidator.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/HexBinaryValidator.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/HexBinaryValidator.java
deleted file mode 100644
index e8065b1..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/HexBinaryValidator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.validators;
-
-import org.apache.commons.codec.DecoderException;
-
-import org.apache.openaz.xacml.std.datatypes.HexBinary;
-import com.vaadin.data.Validator;
-
-public class HexBinaryValidator implements Validator {
- private static final long serialVersionUID = 1L;
-
- public HexBinaryValidator() {
- }
-
- @Override
- public void validate(Object value) throws InvalidValueException {
- if (value instanceof String) {
- try {
- HexBinary.newInstance((String) value);
- } catch (DecoderException e) {
- throw new InvalidValueException(e.getLocalizedMessage());
- }
- } else
- throw new InvalidValueException("Unrecognized HexBinary");
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/IntegerValidator.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/IntegerValidator.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/IntegerValidator.java
deleted file mode 100644
index 3996819..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/IntegerValidator.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.validators;
-
-import com.vaadin.data.Validator;
-
-public class IntegerValidator implements Validator {
- private static final long serialVersionUID = 1L;
-
- public IntegerValidator() {
- }
-
- @Override
- public void validate(Object value) throws InvalidValueException {
- if (value instanceof Integer) {
- return;
- }
- try {
- Integer.parseInt(value.toString());
- } catch (NumberFormatException e) {
- throw new InvalidValueException(e.getLocalizedMessage());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-openaz/blob/c68f98c5/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/IpAddressValidator.java
----------------------------------------------------------------------
diff --git a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/IpAddressValidator.java b/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/IpAddressValidator.java
deleted file mode 100644
index 72aa772..0000000
--- a/openaz-xacml-pap-admin/src/main/java/org/apache/openaz/xacml/admin/view/validators/IpAddressValidator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.openaz.xacml.admin.view.validators;
-
-import java.text.ParseException;
-
-import org.apache.openaz.xacml.std.datatypes.IPAddress;
-import com.vaadin.data.Validator;
-
-public class IpAddressValidator implements Validator {
- private static final long serialVersionUID = 1L;
-
- public IpAddressValidator() {
- }
-
- @Override
- public void validate(Object value) throws InvalidValueException {
- if (value instanceof String) {
- try {
- IPAddress.newInstance((String) value);
- } catch (ParseException e) {
- throw new InvalidValueException(e.getLocalizedMessage());
- }
- } else
- throw new InvalidValueException("Unrecognized IP Address");
- }
-}