Skip to content

Commit 6fdb560

Browse files
authored
cmd (#334)
- main method added to cmd app ``` java --class-path "jag3d.jar;./resources;./lib;" org.applied_geodesy.adjustment.cmd.OpenAdjustmentCMD ```
1 parent bf0d70f commit 6fdb560

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

JAG3D/src/org/applied_geodesy/adjustment/cmd/OpenAdjustmentCMD.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323

2424
import java.beans.PropertyChangeEvent;
2525
import java.beans.PropertyChangeListener;
26+
import java.io.IOException;
27+
import java.nio.file.Files;
28+
import java.nio.file.Paths;
29+
import java.util.logging.LogManager;
2630

2731
import org.applied_geodesy.adjustment.EstimationStateType;
2832
import org.applied_geodesy.adjustment.network.NetworkAdjustment;
@@ -93,4 +97,40 @@ private void destroyNetworkAdjustment(NetworkAdjustment adjustment) {
9397
adjustment = null;
9498
}
9599
}
100+
101+
public static void main(String[] args) {
102+
try {
103+
System.setProperty("com.github.fommil.netlib.BLAS", "com.github.fommil.netlib.F2jBLAS");
104+
System.setProperty("com.github.fommil.netlib.LAPACK", "com.github.fommil.netlib.F2jLAPACK");
105+
System.setProperty("com.github.fommil.netlib.ARPACK", "com.github.fommil.netlib.F2jARPACK");
106+
107+
System.setProperty("hsqldb.reconfig_logging", "false");
108+
109+
LogManager.getLogManager().reset();
110+
}
111+
catch (Exception e) {
112+
e.printStackTrace();
113+
}
114+
115+
int status = -1;
116+
117+
if (args.length == 0)
118+
throw new IllegalArgumentException("Error, no database specified!");
119+
120+
String dataBaseName = args[0];
121+
boolean displayState = args.length > 1 && args[1].equalsIgnoreCase("TRUE") ? Boolean.TRUE : Boolean.FALSE;
122+
try {
123+
if (!Files.isRegularFile(Paths.get(dataBaseName + ".script")) ||
124+
!Files.isRegularFile(Paths.get(dataBaseName + ".properties")) ||
125+
!Files.isRegularFile(Paths.get(dataBaseName + ".data")))
126+
throw new IOException("Error, related database files (e.g. script, properties or data) not found! " + dataBaseName);
127+
128+
OpenAdjustmentCMD openAdjustment = new OpenAdjustmentCMD(dataBaseName, displayState);
129+
status = openAdjustment.process();
130+
}
131+
catch (Exception e) {
132+
e.printStackTrace();
133+
}
134+
System.exit(status);
135+
}
96136
}

0 commit comments

Comments
 (0)