Bug fixes
This commit is contained in:
parent
c22c866000
commit
a199165756
10 changed files with 171 additions and 55 deletions
31
src/zutil/osal/HALLinuxImpl.java
Normal file
31
src/zutil/osal/HALLinuxImpl.java
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) 2015 Ziver
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package zutil.osal;
|
||||
|
||||
/**
|
||||
* Created by Ziver on 2015-04-07.
|
||||
*/
|
||||
public class HALLinuxImpl implements HardwareAbstractionLayer{
|
||||
|
||||
protected HALLinuxImpl(){}
|
||||
}
|
||||
29
src/zutil/osal/HardwareAbstractionLayer.java
Normal file
29
src/zutil/osal/HardwareAbstractionLayer.java
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (c) 2015 Ziver
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package zutil.osal;
|
||||
|
||||
/**
|
||||
* Created by Ziver on 2015-04-07.
|
||||
*/
|
||||
public interface HardwareAbstractionLayer {
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ public abstract class OSAbstractionLayer {
|
|||
* @param cmd the command to run
|
||||
* @return first line of the command
|
||||
*/
|
||||
protected String getFirstLineFromCommand(String cmd) {
|
||||
protected static String getFirstLineFromCommand(String cmd) {
|
||||
String[] tmp = runCommand(cmd);
|
||||
if(tmp.length > 1)
|
||||
return tmp[0];
|
||||
|
|
@ -71,7 +71,7 @@ public abstract class OSAbstractionLayer {
|
|||
* @param cmd the command to run
|
||||
* @return a String list of the output of the command
|
||||
*/
|
||||
public String[] runCommand(String cmd) {
|
||||
public static String[] runCommand(String cmd) {
|
||||
ArrayList<String> ret = new ArrayList<String>();
|
||||
try {
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
|
|
@ -125,4 +125,6 @@ public abstract class OSAbstractionLayer {
|
|||
* @return the path to the global configuration folder e.g Linux: "/etc
|
||||
*/
|
||||
public abstract File getGlobalConfigPath();
|
||||
|
||||
public abstract HardwareAbstractionLayer getHAL();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ import java.io.File;
|
|||
* User: Ziver
|
||||
*/
|
||||
public class OsalLinuxImpl extends OSAbstractionLayer {
|
||||
private static HALLinuxImpl hal;
|
||||
|
||||
@Override
|
||||
public OSType getOSType() {
|
||||
return OSType.Linux;
|
||||
|
|
@ -72,4 +74,11 @@ public class OsalLinuxImpl extends OSAbstractionLayer {
|
|||
public File getGlobalConfigPath() {
|
||||
return new File("/etc");
|
||||
}
|
||||
|
||||
@Override
|
||||
public HardwareAbstractionLayer getHAL() {
|
||||
if(hal == null)
|
||||
hal = new HALLinuxImpl();
|
||||
return hal;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,17 +30,17 @@ import java.io.File;
|
|||
public class OsalWindowsImpl extends OSAbstractionLayer {
|
||||
@Override
|
||||
public OSType getOSType() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOSName() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOSVersion() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -55,16 +55,21 @@ public class OsalWindowsImpl extends OSAbstractionLayer {
|
|||
|
||||
@Override
|
||||
public String getUsername() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getUserConfigPath() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getGlobalConfigPath() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HardwareAbstractionLayer getHAL() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue