Skip to content
Snippets Groups Projects
Commit fb403f8c authored by Nils Christian Ehmke's avatar Nils Christian Ehmke
Browse files

Refactoring and added Apache 2 License header to the source files

parent 322612b6
No related branches found
No related tags found
No related merge requests found
Showing
with 374 additions and 70 deletions
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui;
import kieker.gui.controller.MainViewController;
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui.controller;
import kieker.gui.model.AggregatedTracesSubViewModel;
......@@ -9,7 +25,7 @@ import kieker.gui.view.AggregatedTracesSubView;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
public class AggregatedTracesSubViewController implements SelectionListener {
public class AggregatedTracesSubViewController implements SelectionListener, ISubController {
private final DataModel model;
private final AggregatedTracesSubView view;
......@@ -22,6 +38,7 @@ public class AggregatedTracesSubViewController implements SelectionListener {
this.view = new AggregatedTracesSubView(this.model, this.aggregatedTracesSubViewModel, propertiesModel, this);
}
@Override
public AggregatedTracesSubView getView() {
return this.view;
}
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui.controller;
import kieker.gui.model.DataModel;
......@@ -9,7 +25,7 @@ import kieker.gui.view.TracesSubView;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
public class FailedTracesSubViewController implements SelectionListener {
public class FailedTracesSubViewController implements SelectionListener, ISubController {
private final TracesSubViewModel tracesSubViewModel;
private final TracesSubView view;
......@@ -19,6 +35,7 @@ public class FailedTracesSubViewController implements SelectionListener {
this.view = new TracesSubView(TracesSubView.Type.SHOW_JUST_FAILED_TRACES, model, this.tracesSubViewModel, propertiesModel, this);
}
@Override
public TracesSubView getView() {
return this.view;
}
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui.controller;
import kieker.gui.model.DataModel;
......@@ -9,7 +25,7 @@ import kieker.gui.view.TracesSubView;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
public class FailureContainingTracesSubViewController implements SelectionListener {
public class FailureContainingTracesSubViewController implements SelectionListener, ISubController {
private final TracesSubViewModel tracesSubViewModel;
private final TracesSubView view;
......@@ -19,6 +35,7 @@ public class FailureContainingTracesSubViewController implements SelectionListen
this.view = new TracesSubView(TracesSubView.Type.SHOW_JUST_FAILURE_CONTAINING_TRACES, model, this.tracesSubViewModel, propertiesModel, this);
}
@Override
public TracesSubView getView() {
return this.view;
}
......
......@@ -14,32 +14,12 @@
* limitations under the License.
***************************************************************************/
package kieker.gui.model.importer.stages;
package kieker.gui.controller;
import teetime.framework.AbstractConsumerStage;
import teetime.framework.OutputPort;
import kieker.gui.view.ISubView;
/**
* Distributes incoming elements to the two output ports.
*
* @author Nils Christian Ehmke
*/
public final class Cloner<T> extends AbstractConsumerStage<T> {
private final OutputPort<T> firstOutputPort = super.createOutputPort();
private final OutputPort<T> secondOutputPort = super.createOutputPort();
@Override
protected void execute(final T element) {
this.firstOutputPort.send(element);
this.secondOutputPort.send(element);
}
public interface ISubController {
public OutputPort<T> getFirstOutputPort() {
return this.firstOutputPort;
}
public ISubView getView();
public OutputPort<T> getSecondOutputPort() {
return this.secondOutputPort;
}
}
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui.controller;
import kieker.gui.model.DataModel;
import kieker.gui.model.MainViewModel;
import kieker.gui.model.MainViewModel.SubView;
import kieker.gui.model.PropertiesModel;
import kieker.gui.view.AggregatedTracesSubView;
import kieker.gui.view.ISubView;
import kieker.gui.view.MainView;
import kieker.gui.view.RecordsSubView;
import kieker.gui.view.TracesSubView;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
public class MainViewController implements SelectionListener {
public final class MainViewController implements SelectionListener {
private final DataModel dataModel;
private final MainViewModel mainViewModel;
......@@ -20,23 +34,27 @@ public class MainViewController implements SelectionListener {
private final MainView view;
public MainViewController() {
// Create the top models
this.dataModel = new DataModel();
this.mainViewModel = new MainViewModel();
this.propertiesModel = new PropertiesModel();
final RecordsSubViewController subView1Controller = new RecordsSubViewController(this.dataModel);
final TracesSubViewController subView2Controller = new TracesSubViewController(this.dataModel, this.propertiesModel);
final AggregatedTracesSubViewController subView3Controller = new AggregatedTracesSubViewController(this.dataModel, this.propertiesModel);
final FailedTracesSubViewController subView4Controller = new FailedTracesSubViewController(this.dataModel, this.propertiesModel);
final FailureContainingTracesSubViewController subView5Controller = new FailureContainingTracesSubViewController(this.dataModel, this.propertiesModel);
final RecordsSubView subView1 = subView1Controller.getView();
final TracesSubView subView2 = subView2Controller.getView();
final AggregatedTracesSubView subView3 = subView3Controller.getView();
final TracesSubView subView4 = subView4Controller.getView();
final TracesSubView subView5 = subView5Controller.getView();
this.view = new MainView(this.dataModel, this.mainViewModel, this, subView1, subView2, subView4, subView3, subView5);
// Create the sub-controllers
final ISubController subViewController1 = new RecordsSubViewController(this.dataModel);
final ISubController subViewController2 = new TracesSubViewController(this.dataModel, this.propertiesModel);
final ISubController subViewController3 = new FailedTracesSubViewController(this.dataModel, this.propertiesModel);
final ISubController subViewController4 = new AggregatedTracesSubViewController(this.dataModel, this.propertiesModel);
final ISubController subViewController5 = new FailureContainingTracesSubViewController(this.dataModel, this.propertiesModel);
// Get the sub-views from the controllers
final ISubView subView1 = subViewController1.getView();
final ISubView subView2 = subViewController2.getView();
final ISubView subView3 = subViewController3.getView();
final ISubView subView4 = subViewController4.getView();
final ISubView subView5 = subViewController5.getView();
// Create the main model and the main view
this.mainViewModel = new MainViewModel();
this.view = new MainView(this.dataModel, this.mainViewModel, this, subView1, subView2, subView3, subView4, subView5);
}
public void showView() {
......@@ -45,25 +63,27 @@ public class MainViewController implements SelectionListener {
@Override
public void widgetSelected(final SelectionEvent e) {
if (e.item == this.view.getTrtmExplorer()) {
this.mainViewModel.setCurrentActiveSubView(SubView.NONE);
}
if (e.item == this.view.getTrtmRecords()) {
this.mainViewModel.setCurrentActiveSubView(SubView.RECORDS_SUB_VIEW);
}
if (e.item == this.view.getTrtmTraces()) {
this.mainViewModel.setCurrentActiveSubView(SubView.TRACES_SUB_VIEW);
this.handlePotentialTreeSelection(e);
this.handlePotentialMenuSelection(e);
this.handlePotentialPropertiesSelection(e);
}
private void handlePotentialPropertiesSelection(final SelectionEvent e) {
if (e.widget == this.view.getMntmShortOperationNames()) {
this.propertiesModel.setShortOperationNames(true);
}
if (e.item == this.view.getTrtmAggregatedTraces()) {
this.mainViewModel.setCurrentActiveSubView(SubView.AGGREGATED_TRACES_SUB_VIEW);
if (e.widget == this.view.getMntmLongOperationNames()) {
this.propertiesModel.setShortOperationNames(false);
}
if (e.item == this.view.getTrtmJustFailedTraces()) {
this.mainViewModel.setCurrentActiveSubView(SubView.FAILED_TRACES_SUB_VIEW);
if (e.widget == this.view.getMntmShortComponentNames()) {
this.propertiesModel.setShortComponentNames(true);
}
if (e.item == this.view.getTrtmJustTracesContaining()) {
this.mainViewModel.setCurrentActiveSubView(SubView.FAILURE_CONTAINING_TRACES_SUB_VIEW);
if (e.widget == this.view.getMntmLongComponentNames()) {
this.propertiesModel.setShortComponentNames(false);
}
}
private void handlePotentialMenuSelection(final SelectionEvent e) {
if (e.widget == this.view.getMntmOpenMonitoringLog()) {
final String selectedDirectory = this.view.getDialog().open();
......@@ -71,21 +91,30 @@ public class MainViewController implements SelectionListener {
this.dataModel.loadMonitoringLogFromFS(selectedDirectory);
}
}
if (e.widget == this.view.getMntmExit()) {
this.view.close();
}
}
if (e.widget == this.view.getMntmShortOperationNames()) {
this.propertiesModel.setShortOperationNames(true);
private void handlePotentialTreeSelection(final SelectionEvent e) {
if (e.item == this.view.getTrtmExplorer()) {
this.mainViewModel.setCurrentActiveSubView(SubView.NONE);
}
if (e.widget == this.view.getMntmLongOperationNames()) {
this.propertiesModel.setShortOperationNames(false);
if (e.item == this.view.getTrtmRecords()) {
this.mainViewModel.setCurrentActiveSubView(SubView.RECORDS_SUB_VIEW);
}
if (e.widget == this.view.getMntmShortComponentNames()) {
this.propertiesModel.setShortComponentNames(true);
if (e.item == this.view.getTrtmTraces()) {
this.mainViewModel.setCurrentActiveSubView(SubView.TRACES_SUB_VIEW);
}
if (e.widget == this.view.getMntmLongComponentNames()) {
this.propertiesModel.setShortComponentNames(false);
if (e.item == this.view.getTrtmAggregatedTraces()) {
this.mainViewModel.setCurrentActiveSubView(SubView.AGGREGATED_TRACES_SUB_VIEW);
}
if (e.item == this.view.getTrtmJustFailedTraces()) {
this.mainViewModel.setCurrentActiveSubView(SubView.FAILED_TRACES_SUB_VIEW);
}
if (e.item == this.view.getTrtmJustTracesContaining()) {
this.mainViewModel.setCurrentActiveSubView(SubView.FAILURE_CONTAINING_TRACES_SUB_VIEW);
}
}
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui.controller;
import kieker.gui.model.DataModel;
import kieker.gui.view.RecordsSubView;
public class RecordsSubViewController {
public class RecordsSubViewController implements ISubController {
private final DataModel model;
private final RecordsSubView view;
......@@ -13,6 +29,7 @@ public class RecordsSubViewController {
this.view = new RecordsSubView(this.model, this);
}
@Override
public RecordsSubView getView() {
return this.view;
}
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui.controller;
import kieker.gui.model.DataModel;
......@@ -9,7 +25,7 @@ import kieker.gui.view.TracesSubView;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
public class TracesSubViewController implements SelectionListener {
public class TracesSubViewController implements SelectionListener, ISubController {
private final TracesSubViewModel tracesSubViewModel;
private final TracesSubView view;
......@@ -19,6 +35,7 @@ public class TracesSubViewController implements SelectionListener {
this.view = new TracesSubView(TracesSubView.Type.SHOW_ALL_TRACES, model, this.tracesSubViewModel, propertiesModel, this);
}
@Override
public TracesSubView getView() {
return this.view;
}
......
/****************************import java.util.Observable;
import kieker.gui.model.domain.AggregatedExecutionEntry;
kieker-monitoring.net)
*
* Licensed 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 kieker.gui.model;
import java.util.Observable;
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui.model;
import java.io.File;
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui.model;
import java.util.Observable;
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui.model;
import java.util.Observable;
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui.model;
import java.util.Observable;
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui.model.domain;
import java.util.ArrayList;
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui.model.importer.stages;
import kieker.gui.model.domain.ExecutionEntry;
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui.model.importer.stages;
import kieker.gui.model.domain.ExecutionEntry;
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui.view;
import java.util.List;
......@@ -298,7 +314,7 @@ public class AggregatedTracesSubView implements Observer, ISubView {
item.setText(new String[] { executionEntry.getContainer(), componentName, operationString, "", minDuration, avgDuration, maxDuration });
} else {
item.setText(new String[] { executionEntry.getContainer(), componentName, operationString, Integer.toString(executionEntry.getCalls()), minDuration, avgDuration,
maxDuration });
maxDuration });
}
if (executionEntry.isFailed()) {
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui.view;
import org.eclipse.swt.widgets.Composite;
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui.view;
import java.util.Observable;
......
/***************************************************************************
* Copyright 2014 Kieker Project (http://kieker-monitoring.net)
*
* Licensed 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 kieker.gui.view;
import java.util.List;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment