- Moved UI module into sandbox, including UI parts. - Decoupled accordingly existing modules from UI. - Fixed a few quality issues.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/07d36020 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/07d36020 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/07d36020 Branch: refs/heads/master Commit: 07d360203eac287e8197c534997d21e3abf5b9a5 Parents: 81b05eb Author: anatole <anat...@apache.org> Authored: Tue Aug 16 15:50:17 2016 +0200 Committer: Oliver B. Fischer <ple...@apache.org> Committed: Fri Sep 30 21:29:37 2016 +0200 ---------------------------------------------------------------------- pom.xml | 7 - .../org/apache/tamaya/events/ui/EventView.java | 181 ------------------- .../services/org.apache.tamaya.ui.ViewProvider | 19 -- src/main/resources/ui/lang/tamaya.properties | 24 --- .../services/org.apache.tamaya.ui.ViewProvider | 19 -- src/test/resources/config/application.yml | 31 ---- 6 files changed, 281 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/07d36020/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 7294789..d274633 100644 --- a/pom.xml +++ b/pom.xml @@ -58,13 +58,6 @@ under the License. <scope>runtime</scope> </dependency> <dependency> - <groupId>org.apache.tamaya.ext</groupId> - <artifactId>tamaya-ui</artifactId> - <version>${project.version}</version> - <optional>true</optional> - </dependency> - - <dependency> <groupId>org.hamcrest</groupId> <artifactId>java-hamcrest</artifactId> </dependency> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/07d36020/src/main/java/org/apache/tamaya/events/ui/EventView.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/tamaya/events/ui/EventView.java b/src/main/java/org/apache/tamaya/events/ui/EventView.java deleted file mode 100644 index 2c4dead..0000000 --- a/src/main/java/org/apache/tamaya/events/ui/EventView.java +++ /dev/null @@ -1,181 +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.tamaya.events.ui; - -import com.vaadin.data.Item; -import com.vaadin.data.Property; -import com.vaadin.navigator.View; -import com.vaadin.navigator.ViewChangeListener; -import com.vaadin.shared.ui.label.ContentMode; -import com.vaadin.ui.Button; -import com.vaadin.ui.CheckBox; -import com.vaadin.ui.HorizontalLayout; -import com.vaadin.ui.Label; -import com.vaadin.ui.Notification; -import com.vaadin.ui.Table; -import com.vaadin.ui.TextField; -import org.apache.tamaya.events.ConfigEvent; -import org.apache.tamaya.events.ConfigEventListener; -import org.apache.tamaya.events.ConfigEventManager; -import org.apache.tamaya.spi.ServiceContextManager; -import org.apache.tamaya.ui.UIConstants; -import org.apache.tamaya.ui.ViewProvider; -import org.apache.tamaya.ui.components.VerticalSpacedLayout; -import org.apache.tamaya.ui.services.MessageProvider; - -import javax.annotation.Priority; -import java.util.Date; - -/** - * Tamaya View for observing the current event stream. - */ -public class EventView extends VerticalSpacedLayout implements View { - - /** - * Provider used to register the view. - */ - @Priority(20) - public static final class Provider implements ViewProvider{ - - @Override - public ViewLifecycle getLifecycle() { - return ViewLifecycle.EAGER; - } - - @Override - public String getName() { - return "view.events.name"; - } - - @Override - public String getUrlPattern() { - return "/events"; - } - - @Override - public String getDisplayName() { - return getName(); - } - - @Override - public View createView(Object... params){ - return new EventView(); - } - } - - private CheckBox changeMonitorEnabled = new CheckBox(ServiceContextManager.getServiceContext() - .getService(MessageProvider.class).getMessage("view.events.button.enableMonitoring")); - private Button clearViewButton = new Button(ServiceContextManager.getServiceContext() - .getService(MessageProvider.class).getMessage("view.events.button.clearView")); - private TextField pollingInterval = new TextField(ServiceContextManager.getServiceContext() - .getService(MessageProvider.class).getMessage("view.events.field.pollingInterval")); - private Table eventsTable = new Table(ServiceContextManager.getServiceContext() - .getService(MessageProvider.class).getMessage("view.events.table.name")); - - - public EventView() { - Label caption = new Label(ServiceContextManager.getServiceContext() - .getService(MessageProvider.class).getMessage("view.events.name")); - Label description = new Label(ServiceContextManager.getServiceContext() - .getService(MessageProvider.class).getMessage("view.events.description"), - ContentMode.HTML); - - ConfigEventManager.addListener(new ConfigEventListener() { - @Override - public void onConfigEvent(ConfigEvent<?> event) { - addEvent(event); - } - }); - changeMonitorEnabled.addValueChangeListener(new Property.ValueChangeListener() { - @Override - public void valueChange(Property.ValueChangeEvent valueChangeEvent) { - ConfigEventManager.enableChangeMonitoring(changeMonitorEnabled.getValue()); - if(changeMonitorEnabled.getValue()) { - Notification.show("Event Monitoring (Polling) active."); - }else{ - Notification.show("Event Monitoring (Polling) inactive."); - } - } - }); - clearViewButton.addClickListener(new Button.ClickListener() { - @Override - public void buttonClick(Button.ClickEvent clickEvent) { - eventsTable.removeAllItems(); - Notification.show("Events cleared."); - } - }); - - HorizontalLayout eventSettings = new HorizontalLayout(); - eventSettings.addComponents(changeMonitorEnabled, new Label(" Polling Interval"), pollingInterval, clearViewButton); - changeMonitorEnabled.setValue(ConfigEventManager.isChangeMonitoring()); - pollingInterval.setValue(String.valueOf(ConfigEventManager.getChangeMonitoringPeriod())); - pollingInterval.setRequired(true); - pollingInterval.addValueChangeListener(new Property.ValueChangeListener() { - @Override - public void valueChange(Property.ValueChangeEvent valueChangeEvent) { - try{ - long millis = Long.parseLong((String)valueChangeEvent.getProperty().getValue()); - ConfigEventManager.setChangeMonitoringPeriod(millis); - Notification.show("Updated Event Monitoring Poll Interval to " + millis + " milliseconds."); - }catch(Exception e){ - Notification.show("Cannot update Event Monitoring Poll Interval to " - + valueChangeEvent.getProperty().getValue(), Notification.Type.ERROR_MESSAGE); - } - } - }); - eventsTable.addContainerProperty("Timestamp", Date.class, null); - eventsTable.addContainerProperty("Type", String.class, "?"); - eventsTable.addContainerProperty("Payload", String.class, "<empty>"); - eventsTable.addContainerProperty("Version", String.class, "?"); - eventsTable.setPageLength(20); - eventsTable.setWidth("100%"); - eventsTable.setResponsive(true); - - - caption.addStyleName(UIConstants.LABEL_HUGE); - description.addStyleName(UIConstants.LABEL_LARGE); - addComponents(caption, description, eventSettings, eventsTable); - } - - private void addEvent(ConfigEvent<?> evt){ - Object newItemId = eventsTable.addItem(); - Item row = eventsTable.getItem(newItemId); - row.getItemProperty("Timestamp").setValue(new Date(evt.getTimestamp())); - row.getItemProperty("Type").setValue(evt.getResourceType().getSimpleName()); - String value = String.valueOf(evt.getResource()); - String valueShort = value.length()<150?value:value.substring(0,147)+"..."; - row.getItemProperty("Payload").setValue(valueShort); - row.getItemProperty("Version").setValue(evt.getVersion()); - } - - - private String getCaption(String key, String value) { - int index = key.lastIndexOf('.'); - if(index<0){ - return key + " = " + value; - }else{ - return key.substring(index+1) + " = " + value; - } - } - - @Override - public void enter(ViewChangeListener.ViewChangeEvent event) { - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/07d36020/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider ---------------------------------------------------------------------- diff --git a/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider b/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider deleted file mode 100644 index f779d5c..0000000 --- a/src/main/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider +++ /dev/null @@ -1,19 +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 current 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. -# -org.apache.tamaya.events.ui.EventView$Provider \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/07d36020/src/main/resources/ui/lang/tamaya.properties ---------------------------------------------------------------------- diff --git a/src/main/resources/ui/lang/tamaya.properties b/src/main/resources/ui/lang/tamaya.properties deleted file mode 100644 index 8f83a5c..0000000 --- a/src/main/resources/ui/lang/tamaya.properties +++ /dev/null @@ -1,24 +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 current 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. -# - -view.events.name=Configuration Events -view.events.table.name=Observed Events -view.events.button.enableMonitoring=Change Monitor active -view.events.button.clearView=Clear View -view.events.description=This view shows the configuration events triggered in the system. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/07d36020/src/test/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider ---------------------------------------------------------------------- diff --git a/src/test/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider b/src/test/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider deleted file mode 100644 index f779d5c..0000000 --- a/src/test/resources/META-INF/services/org.apache.tamaya.ui.ViewProvider +++ /dev/null @@ -1,19 +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 current 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. -# -org.apache.tamaya.events.ui.EventView$Provider \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/07d36020/src/test/resources/config/application.yml ---------------------------------------------------------------------- diff --git a/src/test/resources/config/application.yml b/src/test/resources/config/application.yml deleted file mode 100644 index 00d6d43..0000000 --- a/src/test/resources/config/application.yml +++ /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 current 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. -# -server: - type: default - maxThreads: 1024 - applicationConnectors: - - type: http - port: 8090 - - type: https - port: 8453 - adminConnectors: - - type: http - port: 8091 - - type: https - port: 8453 \ No newline at end of file