Skip to content

Commit 74a4231

Browse files
committed
closing the system-setup book for now.
1 parent ba544e4 commit 74a4231

22 files changed

+614
-138
lines changed

.idea/libraries/Maven__commons_io_commons_io_1_3_2.xml

-13
This file was deleted.

.idea/libraries/commons_collections4_4_0_alpha1.xml

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

algorithms/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
<groupId>org.jboss.spec</groupId>
2222
<artifactId>jboss-javaee-all-6.0</artifactId>
2323
</dependency>
24+
<!-- for invalid dependencies -->
25+
<dependency>
26+
<groupId>xalan</groupId>
27+
<artifactId>xalan</artifactId>
28+
</dependency>
2429
</dependencies>
2530

2631
</project>

pom.xml

+23-14
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,19 @@
7878
<dependency>
7979
<groupId>org.jboss.arquillian</groupId>
8080
<artifactId>arquillian-bom</artifactId>
81-
<version>${libraries.version.org.jboss.arquillian.arquillian-bom}</version>
81+
<version>1.1.1.Final</version>
8282
<scope>import</scope>
8383
<type>pom</type>
8484
</dependency>
8585
<dependency>
8686
<groupId>org.jboss.spec</groupId>
8787
<artifactId>jboss-javaee-all-6.0</artifactId>
88-
<version>${libraries.version.org.jboss.spec.jboss-javaee-all-6.0}</version>
88+
<version>3.0.2.Final</version>
8989
</dependency>
9090
<dependency>
9191
<groupId>org.apache.commons</groupId>
9292
<artifactId>commons-lang3</artifactId>
93-
<version>${libraries.version.org.apache.commons.commons-lang3}</version>
93+
<version>3.1</version>
9494
</dependency>
9595
<dependency>
9696
<groupId>commons-collections</groupId>
@@ -100,27 +100,32 @@
100100
<dependency>
101101
<groupId>commons-io</groupId>
102102
<artifactId>commons-io</artifactId>
103-
<version>${libraries.version.commons-io.commons-io}</version>
103+
<version>2.4</version>
104104
</dependency>
105105
<dependency>
106106
<groupId>junit</groupId>
107107
<artifactId>junit</artifactId>
108-
<version>${libraries.version.junit.junit}</version>
108+
<version>4.11</version>
109109
</dependency>
110110
<dependency>
111111
<groupId>org.jboss.spec.javax.servlet.jstl</groupId>
112112
<artifactId>jboss-jstl-api_1.2_spec</artifactId>
113-
<version>${libraries.version.org.jboss.spec.javax.servlet.jstl.jboss-jstl-api_1.2_spec}</version>
113+
<version>1.0.3.Final</version>
114114
</dependency>
115115
<dependency>
116116
<groupId>xalan</groupId>
117117
<artifactId>xalan</artifactId>
118-
<version>${libraries.version.xalan.xalan}</version>
118+
<version>2.7.1</version>
119119
</dependency>
120120
<dependency>
121121
<groupId>joda-time</groupId>
122122
<artifactId>joda-time</artifactId>
123-
<version>${libraries.version.joda-time.joda-time}</version>
123+
<version>2.2</version>
124+
</dependency>
125+
<dependency>
126+
<groupId>org.apache.commons</groupId>
127+
<artifactId>commons-vfs2</artifactId>
128+
<version>2.0</version>
124129
</dependency>
125130
<dependency>
126131
<groupId>org.slf4j</groupId>
@@ -141,19 +146,23 @@
141146
<plugin>
142147
<groupId>org.jboss.as.plugins</groupId>
143148
<artifactId>jboss-as-maven-plugin</artifactId>
144-
<version>${plugins.version.org.jboss.as.plugins.jboss-as-maven-plugin}</version>
149+
<version>7.4.Final</version>
150+
</plugin>
151+
<plugin>
152+
<groupId>org.apache.maven.plugins</groupId>
153+
<artifactId>maven-compiler-plugin</artifactId>
154+
<version>3.1</version>
155+
<configuration>
156+
<source>${thenaglecode.java.compiler.version}</source>
157+
<target>${thenaglecode.java.compiler.version}</target>
158+
</configuration>
145159
</plugin>
146160
</plugins>
147161
</pluginManagement>
148162
<plugins>
149163
<plugin>
150164
<groupId>org.apache.maven.plugins</groupId>
151165
<artifactId>maven-compiler-plugin</artifactId>
152-
<version>${plugins.version.org.apache.maven.plugins.maven-compiler-plugin}</version>
153-
<configuration>
154-
<source>${thenaglecode.java.compiler.version}</source>
155-
<target>${thenaglecode.java.compiler.version}</target>
156-
</configuration>
157166
</plugin>
158167
</plugins>
159168
</build>

system-setup/pom.xml

+35-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222
<version>2.0</version>
2323
</dependency>
2424
<dependency>
25-
<groupId>org.apache.commons</groupId>
25+
<groupId>commons-io</groupId>
2626
<artifactId>commons-io</artifactId>
27-
<version>1.3.2</version>
2827
</dependency>
2928
<dependency>
3029
<groupId>org.apache.commons</groupId>
@@ -46,6 +45,40 @@
4645
<includeEmptyDirs>true</includeEmptyDirs>
4746
</configuration>
4847
</plugin>
48+
<plugin>
49+
<groupId>org.apache.maven.plugins</groupId>
50+
<artifactId>maven-compiler-plugin</artifactId>
51+
</plugin>
52+
<plugin>
53+
<groupId>com.akathist.maven.plugins.launch4j</groupId>
54+
<artifactId>launch4j-maven-plugin</artifactId>
55+
<version>1.5.2</version>
56+
<executions>
57+
<execution>
58+
<phase>package</phase>
59+
<goals>
60+
<goal>launch4j</goal>
61+
</goals>
62+
<configuration>
63+
<headerType>gui</headerType>
64+
<jre>
65+
<path>C:\Program Files\Java\jre7</path>
66+
<minVersion>1.7.0</minVersion>
67+
<initialHeapSize>128</initialHeapSize>
68+
<maxHeapSize>1024</maxHeapSize>
69+
</jre>
70+
<jar>${project.build.directory}/${project.build.finalName}.jar</jar>
71+
<outfile>${project.build.directory}/systemsetup.exe</outfile>
72+
<classPath>
73+
<mainClass>com.thenaglecode.Start</mainClass>
74+
</classPath>
75+
<singleInstance>
76+
<mutexName>thenaglecode-system-setup</mutexName>
77+
</singleInstance>
78+
</configuration>
79+
</execution>
80+
</executions>
81+
</plugin>
4982
</plugins>
5083
</build>
5184

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.thenaglecode;
2+
3+
import javafx.application.Platform;
4+
5+
import java.io.File;
6+
import java.io.IOException;
7+
import java.io.OutputStream;
8+
import java.io.PrintWriter;
9+
10+
/**
11+
* Created with IntelliJ IDEA.
12+
* User: Macindows
13+
* Date: 9/22/13
14+
* Time: 8:19 PM
15+
*/
16+
public class CommandHelper {
17+
public static void runCommandDisplayInOutput(OutputStream messageStream, String command, String[] arguments, String workingDirectory) throws IOException {
18+
Process p = Runtime.getRuntime().exec(new String[]{"cmd"});
19+
Thread runs = new Thread(new SyncPipe(p.getInputStream(), messageStream));
20+
try (PrintWriter pw = new PrintWriter(p.getOutputStream())) {
21+
pw.println("cd " + (workingDirectory == null ? "." : workingDirectory));
22+
pw.print(command);
23+
for (String arg : arguments) {
24+
pw.print(" " + arg);
25+
}
26+
pw.println(); //enter
27+
Platform.runLater(runs);
28+
}
29+
}
30+
31+
public static void serviceMunchCommandOutput(String command, String[] arguments, String workingDirectory) throws IOException {
32+
Process p = Runtime.getRuntime().exec(new String[]{"cmd"});
33+
ServiceMuncher muncher = new ServiceMuncher(p.getInputStream());
34+
Thread runLater = new Thread(muncher);
35+
try (PrintWriter pw = new PrintWriter(p.getOutputStream())){
36+
pw.println("cd " + (workingDirectory == null ? "." : workingDirectory));
37+
pw.print(command);
38+
for(String arg : arguments){
39+
pw.print(" " + arg);
40+
}
41+
pw.println();
42+
Platform.runLater(runLater);
43+
}
44+
}
45+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.thenaglecode;
2+
3+
import javafx.scene.control.TextArea;
4+
5+
import java.io.IOException;
6+
import java.io.OutputStream;
7+
8+
/**
9+
* Created with IntelliJ IDEA.
10+
* User: Macindows
11+
* Date: 9/21/13
12+
* Time: 12:28 PM
13+
*/
14+
public class Console extends OutputStream {
15+
TextArea output;
16+
17+
Console (TextArea ta){
18+
output = ta;
19+
}
20+
21+
@Override
22+
public void write(int b) throws IOException {
23+
output.appendText(String.valueOf((char) b));
24+
}
25+
}

system-setup/src/main/java/com/thenaglecode/Context.java

+4-33
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import java.io.File;
99
import java.io.IOException;
10+
import java.net.URISyntaxException;
1011
import java.util.ArrayList;
1112
import java.util.List;
1213

@@ -24,44 +25,14 @@ public static Context getInstance(){
2425
return INSTANCE;
2526
}
2627

27-
2828
private List<SettingsFile> settings = new ArrayList<>();
2929
private List<File> mySqlHomes = new ArrayList<>();
3030

31-
public List<SettingsFile> getSettings(){
32-
if(settings == null) {
33-
settings = initializeSettings();
34-
}
35-
return settings;
36-
}
37-
38-
public void refreshSettings(){
39-
settings = initializeSettings();
40-
}
41-
42-
private List<SettingsFile> initializeSettings() {
43-
List<SettingsFile> settings = new ArrayList<>();
44-
try {
45-
FileObject file = VFS.getManager().resolveFile("file://" + SettingsFileUtil.CONFIG_FOLDER_ABSOLUTE_PATH);
46-
if(file.getChildren() != null){
47-
for(FileObject child : file.getChildren()){
48-
if(child.getName().getBaseName().endsWith(".cnf")){
49-
SettingsFile settingsFile = SettingsFile.fromFile(child);
50-
settings.add(settingsFile);
51-
}
52-
}
53-
}
54-
} catch (IOException e) {
55-
e.printStackTrace();
56-
}
57-
return settings;
58-
}
59-
60-
public List<File> getMySqlHomes() throws FileSystemException {
61-
return SettingsFileUtil.getAllMySqlHomes();
31+
public List<SettingsFile> getSettings() throws IOException {
32+
return SettingsFileUtil.getSettings();
6233
}
6334

64-
public void reloadMySqlHomes() throws FileSystemException {
35+
public void reloadMySqlHomes() throws FileSystemException, URISyntaxException {
6536
SettingsFileUtil.reloadAllMySqlHomes();
6637
}
6738

system-setup/src/main/java/com/thenaglecode/ListAndOptionsController.java

+23-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.thenaglecode;
22

3+
import javafx.beans.value.ChangeListener;
4+
import javafx.beans.value.ObservableValue;
5+
import javafx.collections.ObservableList;
36
import javafx.event.ActionEvent;
47
import javafx.event.EventHandler;
58
import javafx.fxml.FXML;
@@ -20,14 +23,15 @@
2023
* Date: 19/09/13
2124
* Time: 08:33
2225
*/
23-
public class ListAndOptionsController {
24-
@FXML public Button addButton;
25-
@FXML public Button removeButton;
26-
@FXML public Button installButton;
27-
@FXML public Button uninstallButton;
28-
@FXML public Button startButton;
29-
@FXML public Button stopButton;
30-
@FXML public Button refreshButton;
26+
public class ListAndOptionsController implements ChangeListener<String> {
27+
@FXML private Button addButton;
28+
@FXML private Button removeButton;
29+
@FXML private Button installButton;
30+
@FXML private Button uninstallButton;
31+
@FXML private Button startButton;
32+
@FXML private Button stopButton;
33+
@FXML private Button refreshButton;
34+
@FXML private Button echoButton;
3135
@FXML ListView<SettingsFile> settingsListView;
3236

3337
public Button getAddButton() {
@@ -61,4 +65,15 @@ public ListView<SettingsFile> getSettingsListView() {
6165
public Button getRefreshButton() {
6266
return refreshButton;
6367
}
68+
69+
public Button getEchoButton() {
70+
return echoButton;
71+
}
72+
73+
@Override
74+
public void changed(ObservableValue<? extends String> observableValue, String s, String s2) {
75+
ObservableList<SettingsFile> items = getSettingsListView().<SettingsFile>getItems();
76+
getSettingsListView().setItems(null);
77+
getSettingsListView().setItems(items);
78+
}
6479
}

0 commit comments

Comments
 (0)