summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authornjames <njames@us.ibm.com>2015-03-04 13:07:04 +0800
committernjames <njames@us.ibm.com>2015-03-04 13:07:04 +0800
commit795583867f997c4b04dc3c508d00e559b12e0cb7 (patch)
tree91c6d9074e9cccd1fb87c215ffe2ce7a1eeaa78a /src
parent29dd8164e7a50ece09db1f5df0148181b30164d0 (diff)
downloadserverwiz-795583867f997c4b04dc3c508d00e559b12e0cb7.tar.gz
serverwiz-795583867f997c4b04dc3c508d00e559b12e0cb7.zip
seperated library mgmt from github mgmt
Diffstat (limited to 'src')
-rw-r--r--src/com/ibm/ServerWizard2/LibraryFile.java63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/com/ibm/ServerWizard2/LibraryFile.java b/src/com/ibm/ServerWizard2/LibraryFile.java
new file mode 100644
index 0000000..396f45d
--- /dev/null
+++ b/src/com/ibm/ServerWizard2/LibraryFile.java
@@ -0,0 +1,63 @@
+package com.ibm.ServerWizard2;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import javax.swing.ProgressMonitorInputStream;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.json.simple.parser.JSONParser;
+
+public class LibraryFile {
+ private File localFile;
+ private String filepath;
+ private FileTypes type;
+ private long localFileSize=0;
+
+ public enum FileTypes {
+ ATTRIBUTE_TYPE_XML, TARGET_TYPE_XML, TARGET_INSTANCES_XML, SCRIPT
+ }
+
+ public LibraryFile(String filepath,FileTypes type) {
+ this.filepath=filepath;
+ this.type=type;
+ this.init();
+ }
+ public static String getWorkingDir() {
+ // gets working directory whether running as jar or from eclipse
+ File f = new File("").getAbsoluteFile();
+ String workingDir = f.getAbsolutePath() + System.getProperty("file.separator");
+ return workingDir;
+ }
+ public boolean localFileExists() {
+ return this.localFileSize > 0;
+ }
+ public void init() {
+ String workingDir=LibraryFile.getWorkingDir();
+ this.localFile = new File(workingDir+filepath);
+ if (this.localFile.exists()) {
+ localFileSize = this.localFile.length();
+ }
+ }
+ public String getPath() {
+ return localFile.getPath();
+ }
+ public String getFilename() {
+ return localFile.getName();
+ }
+ public FileTypes getType() {
+ return type;
+ }
+}
OpenPOWER on IntegriCloud