13 |
14 |
15 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | Changelog for Remote Support Tool
2 | =================================
3 |
4 | 1.1.2 (19 Mar 2021)
5 | -------------------
6 |
7 | - added [enhancement #33](https://github.com/OpenIndex/RemoteSupportTool/issues/33): Enable encryption via TLS 1.3
8 | - added [enhancement #46](https://github.com/OpenIndex/RemoteSupportTool/issues/46): Hide connection settings in Customer Tool via configuration
9 | - added [enhancement #49](https://github.com/OpenIndex/RemoteSupportTool/issues/49): Improved application bundles for macOS
10 | - added [enhancement #50](https://github.com/OpenIndex/RemoteSupportTool/issues/50): Provide notarized application bundles for macOS
11 | - update bundled [Java Runtime Environment](https://openjdk.java.net/) to version 11.0.10+9
12 | - update [Commons Lang](https://commons.apache.org/lang/) library to version 3.12.0
13 | - update [Commons IO](https://commons.apache.org/io) library to version 2.8.0
14 | - update [Commons Text](https://commons.apache.org/text/) library to version 1.9
15 | - update [SLF4J](https://www.slf4j.org/) library to version 1.7.30
16 | - update [Java Native Access](https://github.com/java-native-access/jna) library to version 5.7.0
17 | - minor changes, see [Milestone v1.1.2](https://github.com/OpenIndex/RemoteSupportTool/milestone/7)
18 |
19 |
20 | 1.1.1 (22 Mar 2019)
21 | -------------------
22 |
23 | - fixed [issue #28](https://github.com/OpenIndex/RemoteSupportTool/issues/28): Uppercase characters are printed in lowercase for Linux customers
24 | - fixed [issue #29](https://github.com/OpenIndex/RemoteSupportTool/issues/29): Wrong mouse position on multi monitor setups
25 | - fixed [issue #30](https://github.com/OpenIndex/RemoteSupportTool/issues/30): Wrong screen information shown in customer tool
26 | - fixed [issue #31](https://github.com/OpenIndex/RemoteSupportTool/issues/31): Staff tool on macOS doesn't send characters typed with option key
27 |
28 |
29 | 1.1.0 (20 Mar 2019)
30 | -------------------
31 |
32 | - upgrade to Java 11
33 | - update [Commons Text](https://commons.apache.org/text/) library to version 1.6
34 | - update [JSch](http://www.jcraft.com/jsch/) library to version 0.1.55
35 | - update [Simple Logging Facade for Java](https://www.slf4j.org/) library to version 1.7.26
36 | - provide sh application launcher for macOS ([issue #20](https://github.com/OpenIndex/RemoteSupportTool/issues/20))
37 | - tab key is not sent to the customer application ([issue #21](https://github.com/OpenIndex/RemoteSupportTool/issues/21))
38 | - enable / disable transfer of keyboard & mouse inputs ([issue #22](https://github.com/OpenIndex/RemoteSupportTool/issues/22))
39 | - rework transfer of keyboard inputs ([issue #23](https://github.com/OpenIndex/RemoteSupportTool/issues/23))
40 | - prefer Nimbus look & feel on Linux ([issue #25](https://github.com/OpenIndex/RemoteSupportTool/issues/25))
41 | - set awtAppClassName for Gnome / Ubuntu Unity ([issue #26](https://github.com/OpenIndex/RemoteSupportTool/issues/26))
42 |
43 |
44 | 1.0.1 (13 Mar 2019)
45 | -------------------
46 |
47 | - fixed [issue #18](https://github.com/OpenIndex/RemoteSupportTool/issues/18): Mouse is shifted on Windows clients with high resolution screen
48 |
49 |
50 | 1.0.0 (20 Oct 2018)
51 | -------------------
52 |
53 | - migrated from Tcl/Tk to Java
54 | - implement the whole support session in Java, no need for external applications (x11vnc, OSXvnc, TightVNC, OpenSSH)
55 | - provide a graphical interface for both sides of a support session (customer & support staff)
56 | - provided binaries are bundled with a stripped down version of the OpenJDK runtime environment (version 10)
57 | - provide a signed application bundle for macOS
58 | - switched from MIT to Apache License 2.0
59 |
60 |
61 | 0.5 (16 Jan 2017)
62 | -----------------
63 |
64 | - migrated from Python to Tcl/Tk
65 | - replaced Paramiko with OpenSSH
66 | - implemented a new build process based on Tclkit
67 | - updated to OSXvnc 5.0.1, which should fix problems with Retina displays on Mac OS X
68 | - rebuild x11vnc, which should fix problems with a missing libxss library on amd64 based Linux systems
69 | - added some more options for GUI configuration via config.ini
70 |
71 |
72 | 0.4.1 (10 Nov 2015)
73 | -------------------
74 |
75 | - translated into Italian (thanks to [Sjd-Risca](https://github.com/Sjd-Risca))
76 | - compatibility fixes for PyInstaller 3 (thanks to [Sjd-Risca](https://github.com/Sjd-Risca))
77 | - rebuilt with PyInstaller 3 on all supported platforms
78 |
79 | 0.4 (17 Jun 2015)
80 | -----------------
81 |
82 | - first public release
83 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 |
4 | ## Notes about branches
5 |
6 | This project follows the principles of the [GitFlow branching model](http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/) as [proposed by Vincent Driessen](http://nvie.com/posts/a-successful-git-branching-model/). According to this model you will find these branches at the GitHub project page:
7 |
8 | - The [master branch](https://github.com/OpenIndex/RemoteSupportTool/tree/master) contains the current stable releases. No development is directly taking place in that branch.
9 |
10 | - The [develop branch](https://github.com/OpenIndex/RemoteSupportTool/tree/develop) represents the current state of development. Changes from this branch are merged into [master](https://github.com/OpenIndex/RemoteSupportTool/tree/master) when a new version is released.
11 |
12 | - For more complex features you may also find different feature branches. These are derived from [develop branch](https://github.com/OpenIndex/RemoteSupportTool/tree/develop) and are merged back / removed as soon as the feature is ready for release.
13 |
14 | > **Notice:** If you like to provide changes to this project, you should always use the [develop branch](https://github.com/OpenIndex/RemoteSupportTool/tree/develop) as basis for your customization. Feel free to create separate feature branches for any custom feature you like to share.
15 |
16 |
17 | ## Create a pull request
18 |
19 | We love pull requests. Here's a quick guide.
20 |
21 | - Fork this project into you GitHub profile.
22 |
23 | - Clone the [develop branch](https://github.com/OpenIndex/RemoteSupportTool/tree/develop) of the repository to your
24 | local disk:
25 | ```
26 | git clone -b develop git@github.com:your-username/RemoteSupportTool.git
27 | ```
28 |
29 | - Do your changes to the local repository and push the changes back into your fork at GitHub.
30 |
31 | - [Submit a pull request](https://github.com/OpenIndex/RemoteSupportTool/compare/) with the changes from your fork.
32 |
33 | At this point you're waiting on us. We like to comment on pull requests as soon as possible. We may suggest some changes or improvements or alternatives.
34 |
35 | Some things that will increase the chance that your pull request is accepted:
36 |
37 | - Test your changes.
38 |
39 | - Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
40 |
--------------------------------------------------------------------------------
/Core/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 |
--------------------------------------------------------------------------------
/Core/Core.iml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Core/mvn-clean.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | #
3 | # Copyright 2015-2021 OpenIndex.de
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 | #
17 |
18 | MVN="mvn"
19 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
20 |
21 | set -e
22 | export LANG=en
23 | cd "$DIR"
24 | "$MVN" clean
25 |
--------------------------------------------------------------------------------
/Core/mvn-install.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | #
3 | # Copyright 2015-2021 OpenIndex.de
4 | #
5 | # Licensed under the Apache License, Version 2.0 (the "License");
6 | # you may not use this file except in compliance with the License.
7 | # You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing, software
12 | # distributed under the License is distributed on an "AS IS" BASIS,
13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | # See the License for the specific language governing permissions and
15 | # limitations under the License.
16 | #
17 |
18 | MVN="mvn"
19 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
20 |
21 | set -e
22 | export LANG=en
23 | cd "$DIR"
24 | "$MVN" clean install
25 |
--------------------------------------------------------------------------------
/Core/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 |
8 | RemoteSupportTool
9 | de.openindex.support
10 | 1.1.2
11 |
12 |
13 | RemoteSupportTool-Core
14 |
15 | RemoteSupportTool-Core
16 | RemoteSupportTool is a cross platform solution for remote support.
17 | https://openindex.de
18 |
19 | OpenIndex.de
20 | https://openindex.de
21 |
22 |
23 |
24 | The Apache Software License, Version 2.0
25 | http://www.apache.org/licenses/LICENSE-2.0.txt
26 | repo
27 | A business-friendly OSS license
28 |
29 |
30 |
31 |
32 |
33 | andy
34 | Andreas Rudolph
35 | andy@openindex.de
36 | OpenIndex.de
37 | https://openindex.de/
38 |
39 |
40 |
41 |
42 |
43 | commons-io
44 | commons-io
45 |
46 |
47 | org.apache.commons
48 | commons-lang3
49 |
50 |
51 | org.apache.commons
52 | commons-text
53 |
54 |
55 | ch.qos.logback
56 | logback-classic
57 |
58 |
59 | org.slf4j
60 | slf4j-api
61 |
62 |
63 |
64 |
65 |
66 |
67 | ${project.basedir}/src/main/resources
68 | true
69 |
70 | **/*.properties
71 | **/*.html
72 |
73 |
74 |
75 | ${project.basedir}/src/main/resources
76 | false
77 |
78 | **/*.properties
79 | **/*.html
80 |
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/AbstractOptions.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core;
17 |
18 | import java.io.File;
19 | import java.io.FileInputStream;
20 | import java.io.FileOutputStream;
21 | import java.io.IOException;
22 | import java.io.InputStream;
23 | import java.io.OutputStream;
24 | import java.util.Properties;
25 | import java.util.ResourceBundle;
26 | import org.apache.commons.lang3.StringUtils;
27 | import org.slf4j.Logger;
28 | import org.slf4j.LoggerFactory;
29 |
30 | /**
31 | * General application options.
32 | *
33 | * @author Andreas Rudolph
34 | */
35 | public abstract class AbstractOptions extends Properties {
36 | @SuppressWarnings("unused")
37 | private final static Logger LOGGER = LoggerFactory.getLogger(AbstractOptions.class);
38 | protected final File location;
39 | protected final ResourceBundle settings;
40 |
41 | protected AbstractOptions(File location, ResourceBundle settings) {
42 | super();
43 | this.location = location;
44 | this.settings = settings;
45 | }
46 |
47 | protected Boolean getPropertyAsBoolean(String key, Boolean defaultValue) {
48 | String value = StringUtils.trimToNull(this.getProperty(key));
49 | return (value != null) ?
50 | Boolean.valueOf(value) :
51 | defaultValue;
52 | }
53 |
54 | protected Integer getPropertyAsInteger(String key, Integer defaultValue) {
55 | String value = StringUtils.trimToNull(this.getProperty(key));
56 | try {
57 | return (value != null) ?
58 | Integer.valueOf(value) :
59 | defaultValue;
60 | } catch (NumberFormatException ex) {
61 | LOGGER.warn("Can't read option '" + key + "'!", ex);
62 | return defaultValue;
63 | }
64 | }
65 |
66 | public void read() throws IOException {
67 | if (!Boolean.parseBoolean(settings.getString("permanentOptions"))) return;
68 | if (!this.location.isFile()) return;
69 | try (InputStream input = new FileInputStream(this.location)) {
70 | this.load(input);
71 | }
72 | }
73 |
74 | public void write() throws IOException {
75 | if (!Boolean.parseBoolean(settings.getString("permanentOptions"))) return;
76 | try (OutputStream output = new FileOutputStream(this.location)) {
77 | this.store(output, null);
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/SwingUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core;
17 |
18 | import java.awt.Toolkit;
19 | import java.lang.reflect.Field;
20 | import javax.swing.UIManager;
21 | import org.apache.commons.lang3.SystemUtils;
22 | import org.slf4j.Logger;
23 | import org.slf4j.LoggerFactory;
24 |
25 | /**
26 | * Swing helper methods.
27 | *
28 | * @author Andreas Rudolph
29 | */
30 | @SuppressWarnings("WeakerAccess")
31 | public class SwingUtils {
32 | @SuppressWarnings("unused")
33 | private final static Logger LOGGER = LoggerFactory.getLogger(SwingUtils.class);
34 |
35 | private SwingUtils() {
36 | super();
37 | }
38 |
39 | public static UIManager.LookAndFeelInfo getLookAndFeelInfo(String name) {
40 | for (UIManager.LookAndFeelInfo lnf : UIManager.getInstalledLookAndFeels()) {
41 | if (lnf.getName().equalsIgnoreCase(name)) {
42 | return lnf;
43 | }
44 | }
45 | return null;
46 | }
47 |
48 | public static void installLookAndFeel() {
49 | try {
50 | if (SystemUtils.IS_OS_WINDOWS || SystemUtils.IS_OS_MAC) {
51 | // Always use system look & feel on Windows & Mac.
52 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
53 | } else {
54 | // Prefer Nimbus or Metal look & feel on other systems.
55 | UIManager.LookAndFeelInfo lnf = SwingUtils.getLookAndFeelInfo("Nimbus");
56 | if (lnf == null) lnf = SwingUtils.getLookAndFeelInfo("Metal");
57 | UIManager.setLookAndFeel((lnf != null) ?
58 | lnf.getClassName() :
59 | UIManager.getSystemLookAndFeelClassName());
60 | }
61 | } catch (Exception ex) {
62 | LOGGER.warn("Can't set look & feel!", ex);
63 | }
64 | }
65 |
66 | /**
67 | * Change application title for certain Linux desktop environments (e.g. Gnome 3, Ubuntu Unity).
68 | *
69 | * This method may not work with future Java version. In this case it might be replaced with the
70 | * window-matching-agent approach.
71 | *
72 | * @param value application title to set
73 | * @see stackoverflow.com
74 | */
75 | public static void setAwtAppClassName(String value) {
76 | try {
77 | Toolkit toolkit = Toolkit.getDefaultToolkit();
78 | if (toolkit.getClass().getName().equals("sun.awt.X11.XToolkit")) {
79 | Field awtAppClassNameField = toolkit.getClass().getDeclaredField("awtAppClassName");
80 | awtAppClassNameField.setAccessible(true);
81 | awtAppClassNameField.set(toolkit, value);
82 | }
83 | } catch (Exception ex) {
84 | LOGGER.warn("Can't set awtAppClassName!", ex);
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/gui/SidebarPanel.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core.gui;
17 |
18 | import java.awt.Dimension;
19 | import java.awt.Graphics;
20 | import java.awt.Graphics2D;
21 | import java.awt.image.BufferedImage;
22 | import javax.swing.JPanel;
23 | import org.slf4j.Logger;
24 | import org.slf4j.LoggerFactory;
25 |
26 | /**
27 | * Panel, that renders a sidebar with multiple background images.
28 | *
29 | * @author Andreas Rudolph
30 | */
31 | public class SidebarPanel extends JPanel {
32 | @SuppressWarnings("unused")
33 | private final static Logger LOGGER = LoggerFactory.getLogger(SidebarPanel.class);
34 |
35 | private final BufferedImage sidebarImage;
36 | private final BufferedImage brandingImage;
37 |
38 | public SidebarPanel(BufferedImage sidebarImage, BufferedImage brandingImage) {
39 | super();
40 | this.sidebarImage = sidebarImage;
41 | this.brandingImage = brandingImage;
42 | this.setOpaque(false);
43 | }
44 |
45 | @Override
46 | public Dimension getPreferredSize() {
47 | return new Dimension(sidebarImage.getWidth(), sidebarImage.getHeight());
48 | }
49 |
50 | @Override
51 | protected void paintComponent(Graphics g) {
52 | super.paintComponent(g);
53 |
54 | final int panelWidth = getWidth();
55 | final int panelHeight = getHeight();
56 | final Graphics2D g2d = (Graphics2D) g;
57 |
58 | g2d.drawImage(sidebarImage, 0, 0, null);
59 |
60 | if (brandingImage != null) {
61 | final int brandingWidth = brandingImage.getWidth();
62 | final int brandingHeight = brandingImage.getHeight();
63 |
64 | final int x = (panelWidth - brandingWidth) / 2;
65 | final int y = panelHeight - brandingHeight;
66 | g2d.drawImage(brandingImage, x, y, null);
67 | }
68 |
69 | g2d.dispose();
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/gui/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * General GUI classes.
19 | *
20 | * @author Andreas Rudolph
21 | */
22 | package de.openindex.support.core.gui;
23 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/io/CopyTextRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core.io;
17 |
18 | import java.io.Serializable;
19 |
20 | /**
21 | * Request for a text being copied into the clipboard of the customer.
22 | *
23 | * @author Andreas Rudolph
24 | */
25 | public class CopyTextRequest implements Serializable {
26 | private static final long serialVersionUID = 1;
27 | public final String text;
28 |
29 | public CopyTextRequest() {
30 | this(null);
31 | }
32 |
33 | public CopyTextRequest(String text) {
34 | super();
35 | this.text = text;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/io/KeyPressRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core.io;
17 |
18 | import java.awt.event.KeyEvent;
19 | import java.io.Serializable;
20 |
21 | /**
22 | * Request for a key being pressed.
23 | *
24 | * @author Andreas Rudolph
25 | */
26 | public class KeyPressRequest implements Serializable {
27 | private static final long serialVersionUID = 2;
28 | public final int keyCode;
29 |
30 | public KeyPressRequest() {
31 | this(KeyEvent.VK_UNDEFINED);
32 | }
33 |
34 | public KeyPressRequest(int keyCode) {
35 | super();
36 | this.keyCode = keyCode;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/io/KeyReleaseRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core.io;
17 |
18 | import java.awt.event.KeyEvent;
19 | import java.io.Serializable;
20 |
21 | /**
22 | * Request for a key being released.
23 | *
24 | * @author Andreas Rudolph
25 | */
26 | public class KeyReleaseRequest implements Serializable {
27 | private static final long serialVersionUID = 2;
28 | public final int keyCode;
29 |
30 | public KeyReleaseRequest() {
31 | this(KeyEvent.VK_UNDEFINED);
32 | }
33 |
34 | public KeyReleaseRequest(int keyCode) {
35 | super();
36 | this.keyCode = keyCode;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/io/KeyTypeRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core.io;
17 |
18 | import java.awt.event.KeyEvent;
19 | import java.io.Serializable;
20 |
21 | /**
22 | * Request for a key being typed.
23 | *
24 | * @author Andreas Rudolph
25 | */
26 | public class KeyTypeRequest implements Serializable {
27 | private static final long serialVersionUID = 1;
28 | public final char keyChar;
29 |
30 | public KeyTypeRequest() {
31 | this(KeyEvent.CHAR_UNDEFINED);
32 | }
33 |
34 | public KeyTypeRequest(char keyChar) {
35 | super();
36 | this.keyChar = keyChar;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/io/MouseMoveRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core.io;
17 |
18 | import java.io.Serializable;
19 |
20 | /**
21 | * Request for a mouse being moved.
22 | *
23 | * @author Andreas Rudolph
24 | */
25 | public class MouseMoveRequest implements Serializable {
26 | private static final long serialVersionUID = 1;
27 | public final int x;
28 | public final int y;
29 |
30 | public MouseMoveRequest() {
31 | this(-1, -1);
32 | }
33 |
34 | public MouseMoveRequest(int x, int y) {
35 | super();
36 | this.x = x;
37 | this.y = y;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/io/MousePressRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core.io;
17 |
18 | import java.awt.event.MouseEvent;
19 | import java.io.Serializable;
20 |
21 | /**
22 | * Request for a mouse button being pressed.
23 | *
24 | * @author Andreas Rudolph
25 | */
26 | public class MousePressRequest implements Serializable {
27 | private static final long serialVersionUID = 1;
28 | public final int buttons;
29 |
30 | public MousePressRequest() {
31 | this(MouseEvent.NOBUTTON);
32 | }
33 |
34 | public MousePressRequest(int buttons) {
35 | super();
36 | this.buttons = buttons;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/io/MouseReleaseRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core.io;
17 |
18 | import java.awt.event.MouseEvent;
19 | import java.io.Serializable;
20 |
21 | /**
22 | * Request for a mouse button being released.
23 | *
24 | * @author Andreas Rudolph
25 | */
26 | public class MouseReleaseRequest implements Serializable {
27 | private static final long serialVersionUID = 1;
28 | public final int buttons;
29 |
30 | public MouseReleaseRequest() {
31 | this(MouseEvent.NOBUTTON);
32 | }
33 |
34 | public MouseReleaseRequest(int buttons) {
35 | super();
36 | this.buttons = buttons;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/io/MouseWheelRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core.io;
17 |
18 | import java.io.Serializable;
19 |
20 | /**
21 | * Request for the mouse wheel being rotated.
22 | *
23 | * @author Andreas Rudolph
24 | */
25 | public class MouseWheelRequest implements Serializable {
26 | private static final long serialVersionUID = 1;
27 | public final int wheelAmt;
28 |
29 | public MouseWheelRequest() {
30 | this(0);
31 | }
32 |
33 | public MouseWheelRequest(int wheelAmt) {
34 | super();
35 | this.wheelAmt = wheelAmt;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/io/ResponseFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core.io;
17 |
18 | import java.io.Serializable;
19 |
20 | /**
21 | * Factory for delayed creation of responses.
22 | *
23 | * @author Andreas Rudolph
24 | */
25 | public interface ResponseFactory {
26 | Serializable create();
27 | }
28 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/io/ScreenRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core.io;
17 |
18 | import java.io.Serializable;
19 |
20 | /**
21 | * Request for a screenshot.
22 | *
23 | * @author Andreas Rudolph
24 | */
25 | public class ScreenRequest implements Serializable {
26 | private static final long serialVersionUID = 1;
27 | public final int maxWidth;
28 | public final int maxHeight;
29 |
30 | public ScreenRequest() {
31 | this(0, 0);
32 | }
33 |
34 | public ScreenRequest(int maxWidth, int maxHeight) {
35 | super();
36 | this.maxWidth = maxWidth;
37 | this.maxHeight = maxHeight;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/io/ScreenResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core.io;
17 |
18 | import java.io.Serializable;
19 |
20 | /**
21 | * Response with a screenshot.
22 | *
23 | * @author Andreas Rudolph
24 | */
25 | public class ScreenResponse implements Serializable {
26 | private static final long serialVersionUID = 1;
27 | public final ScreenTile[] tiles;
28 | public final int screenWidth;
29 | public final int screenHeight;
30 | public final int imageWidth;
31 | public final int imageHeight;
32 | public final int tileWidth;
33 | public final int tileHeight;
34 |
35 | public ScreenResponse() {
36 | this(null, 0, 0, 0, 0, 0, 0);
37 | }
38 |
39 | public ScreenResponse(ScreenTile[] tiles, int screenWidth, int screenHeight, int imageWidth, int imageHeight, int tileWidth, int tileHeight) {
40 | super();
41 | this.tiles = tiles;
42 | this.screenWidth = screenWidth;
43 | this.screenHeight = screenHeight;
44 | this.imageWidth = imageWidth;
45 | this.imageHeight = imageHeight;
46 | this.tileWidth = tileWidth;
47 | this.tileHeight = tileHeight;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/io/ScreenTile.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core.io;
17 |
18 | import java.io.Serializable;
19 |
20 | /**
21 | * Tile of a screenshot.
22 | *
23 | * @author Andreas Rudolph
24 | */
25 | public class ScreenTile implements Serializable {
26 | private static final long serialVersionUID = 1;
27 | public final byte[] data;
28 |
29 | public ScreenTile() {
30 | this(null);
31 | }
32 |
33 | public ScreenTile(byte[] data) {
34 | super();
35 | this.data = data;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/io/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * Classes for communication between the applications.
19 | *
20 | * @author Andreas Rudolph
21 | */
22 | package de.openindex.support.core.io;
23 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/monitor/DataMonitor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core.monitor;
17 |
18 | import java.util.Date;
19 | import java.util.Vector;
20 | import org.slf4j.Logger;
21 | import org.slf4j.LoggerFactory;
22 |
23 | /**
24 | * Monitor, that holds multiple statistical records about data transfer.
25 | *
26 | * @author Andreas Rudolph
27 | */
28 | @SuppressWarnings("WeakerAccess")
29 | public class DataMonitor {
30 | @SuppressWarnings("unused")
31 | private final static Logger LOGGER = LoggerFactory.getLogger(DataMonitor.class);
32 | protected Vector samples;
33 | protected final Date epoch;
34 |
35 | public DataMonitor() {
36 | samples = new Vector<>();
37 | epoch = new Date();
38 | }
39 |
40 | public void addSample(long byteCount, Date start, Date end) {
41 | samples.addElement(new DataSample(byteCount, start, end));
42 | }
43 |
44 | public float getAverageRate() {
45 | long msCount = 0;
46 | long byteCount = 0;
47 | Date start;
48 | Date finish;
49 | int sampleCount = samples.size();
50 | for (int i = 0; i < sampleCount; i++) {
51 | DataSample ds = samples.elementAt(i);
52 |
53 | if (ds.start != null)
54 | start = ds.start;
55 | else if (i > 0) {
56 | //DataSample prev = samples.elementAt(i - 1);
57 | start = ds.end;
58 | } else
59 | start = epoch;
60 |
61 | if (ds.end != null)
62 | finish = ds.end;
63 | else if (i < sampleCount - 1) {
64 | //DataSample next = samples.elementAt(i + 1);
65 | finish = ds.start;
66 | } else
67 | finish = new Date();
68 |
69 | // Only include this sample if we could figure out a start
70 | // and finish time for it.
71 | if (start != null && finish != null) {
72 | byteCount += ds.byteCount;
73 | msCount += finish.getTime() - start.getTime();
74 | }
75 | }
76 |
77 | float rate = 0;
78 | if (msCount > 0) {
79 | rate = 1000 * (float) byteCount / (float) msCount;
80 | }
81 |
82 | return rate;
83 | }
84 |
85 | @SuppressWarnings("unused")
86 | public float getLastRate() {
87 | int sampleCount = samples.size();
88 | return getRateFor(sampleCount - 1);
89 | }
90 |
91 | public float getRateFor(int sampleIndex) {
92 | float rate = 0.0f;
93 | int sampleCount = samples.size();
94 | if (sampleCount > sampleIndex && sampleIndex >= 0) {
95 | DataSample s = samples.elementAt(sampleIndex);
96 | Date start = s.start;
97 | Date end = s.end;
98 | if (start == null && sampleIndex >= 1) {
99 | DataSample prev = samples.elementAt(sampleIndex - 1);
100 | start = prev.end;
101 | }
102 |
103 | if (start != null && end != null) {
104 | long msec = end.getTime() - start.getTime();
105 | rate = 1000 * (float) s.byteCount / (float) msec;
106 | }
107 | }
108 |
109 | return rate;
110 | }
111 |
112 | public void removeOldSamples(Date olderThan) {
113 | Vector oldSamples = samples;
114 | samples = new Vector<>();
115 | for (DataSample sample : oldSamples) {
116 | if (!sample.end.before(olderThan))
117 | samples.add(sample);
118 | }
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/monitor/DataSample.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core.monitor;
17 |
18 | import java.util.Date;
19 |
20 | /**
21 | * Statistical record about data transfer.
22 | *
23 | * @author Andreas Rudolph
24 | */
25 | @SuppressWarnings("WeakerAccess")
26 | public class DataSample {
27 | public final long byteCount;
28 | public final Date start;
29 | public final Date end;
30 |
31 | public DataSample(long byteCount, Date start, Date end) {
32 | this.byteCount = byteCount;
33 | this.start = start;
34 | this.end = end;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/monitor/MonitoringInputStream.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core.monitor;
17 |
18 | import java.io.FilterInputStream;
19 | import java.io.IOException;
20 | import java.io.InputStream;
21 | import java.util.Date;
22 | import org.apache.commons.lang3.ObjectUtils;
23 | import org.slf4j.Logger;
24 | import org.slf4j.LoggerFactory;
25 |
26 | /**
27 | * InputStream, that collects statistical records about data transfer.
28 | *
29 | * @author Andreas Rudolph
30 | */
31 | public class MonitoringInputStream extends FilterInputStream {
32 | @SuppressWarnings("unused")
33 | private final static Logger LOGGER = LoggerFactory.getLogger(MonitoringInputStream.class);
34 | private final DataMonitor monitor;
35 |
36 | @SuppressWarnings("unused")
37 | public MonitoringInputStream(InputStream in) {
38 | this(in, null);
39 | }
40 |
41 | public MonitoringInputStream(InputStream in, DataMonitor monitor) {
42 | super(in);
43 | this.monitor = ObjectUtils.defaultIfNull(monitor, new DataMonitor());
44 | }
45 |
46 | @SuppressWarnings("unused")
47 | public final DataMonitor getMonitor() {
48 | return monitor;
49 | }
50 |
51 | public int read() throws IOException {
52 | Date start = new Date();
53 | int b = super.read();
54 | monitor.addSample(1, start, new Date());
55 | return b;
56 | }
57 |
58 | public int read(byte data[]) throws IOException {
59 | Date start = new Date();
60 | int cnt = super.read(data);
61 | monitor.addSample(cnt, start, new Date());
62 | return cnt;
63 | }
64 |
65 | public int read(byte data[], int off, int len) throws IOException {
66 | Date start = new Date();
67 | int cnt = super.read(data, off, len);
68 | monitor.addSample(cnt, start, new Date());
69 | return cnt;
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/monitor/MonitoringOutputStream.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package de.openindex.support.core.monitor;
17 |
18 | import java.io.FilterOutputStream;
19 | import java.io.IOException;
20 | import java.io.OutputStream;
21 | import java.util.Date;
22 | import org.apache.commons.lang3.ObjectUtils;
23 | import org.slf4j.Logger;
24 | import org.slf4j.LoggerFactory;
25 |
26 | /**
27 | * OutputStream, that collects statistical records about data transfer.
28 | *
29 | * @author Andreas Rudolph
30 | */
31 | public class MonitoringOutputStream extends FilterOutputStream {
32 | @SuppressWarnings("unused")
33 | private final static Logger LOGGER = LoggerFactory.getLogger(MonitoringOutputStream.class);
34 | private final DataMonitor monitor;
35 |
36 | @SuppressWarnings("unused")
37 | public MonitoringOutputStream(OutputStream out) {
38 | this(out, null);
39 | }
40 |
41 | public MonitoringOutputStream(OutputStream out, DataMonitor monitor) {
42 | super(out);
43 | this.monitor = ObjectUtils.defaultIfNull(monitor, new DataMonitor());
44 | }
45 |
46 | @SuppressWarnings("unused")
47 | public DataMonitor getMonitor() {
48 | return monitor;
49 | }
50 |
51 | public void write(int b) throws IOException {
52 | Date start = new Date();
53 | super.write(b);
54 | monitor.addSample(1, start, new Date());
55 | }
56 |
57 | public void write(byte data[]) throws IOException {
58 | Date start = new Date();
59 | super.write(data);
60 | monitor.addSample(data.length, start, new Date());
61 | }
62 |
63 | public void write(byte data[], int off, int len) throws IOException {
64 | Date start = new Date();
65 | super.write(data, off, len);
66 | monitor.addSample(len, start, new Date());
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/monitor/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * Classes for monitoring data transfer.
19 | *
20 | * @author Andreas Rudolph
21 | */
22 | package de.openindex.support.core.monitor;
23 |
--------------------------------------------------------------------------------
/Core/src/main/java/de/openindex/support/core/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * General classes.
19 | *
20 | * @author Andreas Rudolph
21 | */
22 | package de.openindex.support.core;
23 |
--------------------------------------------------------------------------------
/Core/src/main/java/module-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015-2021 OpenIndex.de.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * General components.
19 | *
20 | * @author Andreas Rudolph
21 | */
22 | module de.openindex.support.core {
23 | exports de.openindex.support.core;
24 | exports de.openindex.support.core.gui;
25 | exports de.openindex.support.core.io;
26 | exports de.openindex.support.core.monitor;
27 | exports org.imgscalr;
28 |
29 | requires transitive java.desktop;
30 | requires logback.classic;
31 | requires org.apache.commons.io;
32 | requires org.apache.commons.lang3;
33 | requires org.apache.commons.text;
34 | requires org.slf4j;
35 | }
36 |
--------------------------------------------------------------------------------
/Core/src/main/java/org/imgscalr/package-info.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 The Buzz Media, LLC
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | /**
18 | * Classes for image scaling.
19 | *