Package jcifs.context
Class SingletonContext
- java.lang.Object
-
- java.lang.Thread
-
- jcifs.context.AbstractCIFSContext
-
- jcifs.context.BaseContext
-
- jcifs.context.SingletonContext
-
- All Implemented Interfaces:
Runnable
,CIFSContext
public class SingletonContext extends BaseContext implements CIFSContext
Global singleton context- Author:
- mbechler
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SingletonContext
getInstance()
Get singleton context The singleton context will use system properties for configuration as well as values specified in a file specified through this jcifs.properties system property.static void
init(Properties props)
Initialize singleton context using custom properties This method can only be called once.static void
registerSmbURLHandler()
This static method registers the SMB URL protocol handler which is required to use SMB URLs with the java.net.URL class.-
Methods inherited from class jcifs.context.BaseContext
close, get, getBufferCache, getConfig, getDefaultCredentials, getDfs, getNameServiceClient, getPipe, getSIDResolver, getTransportPool, getUrlHandler
-
Methods inherited from class jcifs.context.AbstractCIFSContext
getCredentials, hasDefaultCredentials, renewCredentials, run, withAnonymousCredentials, withCredentials, withDefaultCredentials, withGuestCrendentials
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jcifs.CIFSContext
close, get, getBufferCache, getConfig, getCredentials, getDfs, getNameServiceClient, getPipe, getSIDResolver, getTransportPool, getUrlHandler, hasDefaultCredentials, renewCredentials, withAnonymousCredentials, withCredentials, withDefaultCredentials, withGuestCrendentials
-
-
-
-
Method Detail
-
init
public static final void init(Properties props) throws CIFSException
Initialize singleton context using custom properties This method can only be called once.- Parameters:
props
-- Throws:
CIFSException
-
getInstance
public static final SingletonContext getInstance()
Get singleton context The singleton context will use system properties for configuration as well as values specified in a file specified through this jcifs.properties system property.- Returns:
- a global context, initialized on first call
-
registerSmbURLHandler
public static void registerSmbURLHandler()
This static method registers the SMB URL protocol handler which is required to use SMB URLs with the java.net.URL class. If this method is not called before attempting to create an SMB URL with the URL class the following exception will occur:Exception MalformedURLException: unknown protocol: smb at java.net.URL.<init>(URL.java:480) at java.net.URL.<init>(URL.java:376) at java.net.URL.<init>(URL.java:330) at jcifs.smb.SmbFile.<init>(SmbFile.java:355) ...
-
-