Package org.metricshub.wmi.shares
Class WinTempShare
java.lang.Object
org.metricshub.wmi.windows.remote.share.WindowsTempShare
org.metricshub.wmi.shares.WinTempShare
- All Implemented Interfaces:
AutoCloseable
Class representing a connection to a Windows share
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Check if it's connected.void
close()
static WinTempShare
getInstance
(String hostname, String username, char[] password, long timeout) Create or get a cached instance of a shared temporary directory on the specified host.boolean
Methods inherited from class org.metricshub.wmi.windows.remote.share.WindowsTempShare
createRemoteDirectory, getOrCreateShare, getRemotePath, getShareName, getUncSharePath, getWindowsDirectory, getWindowsRemoteExecutor
-
Method Details
-
getInstance
public static WinTempShare getInstance(String hostname, String username, char[] password, long timeout) throws TimeoutException, WmiComException Create or get a cached instance of a shared temporary directory on the specified host.This method ensures only one instance of this class is created per host.
- Parameters:
hostname
- Host to connect tousername
- Username (may be null)password
- Password (may be null)timeout
- Timeout in milliseconds- Returns:
- the WinTempShare instance
- Throws:
TimeoutException
- To notify userName of timeout.WmiComException
- For any problem encountered with JNA.
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
isConnected
public boolean isConnected()- Returns:
- whether we are connected to this share and can interact with it
-
checkConnectedFirst
public void checkConnectedFirst()Check if it's connected. If not, throw an IllegalStateException.
-