private Driver ActivateJdbcDriver() { string driver = (string)_keyMapper["JdbcDriverClassName"]; if (driver == null) { driver = (string)_provider.ProviderInfo [ConfigurationConsts.JdbcDriverClassName]; } if (driver != null && driver.Length != 0) { try { java.lang.ClassLoader contextLoader = (java.lang.ClassLoader)AppDomain.CurrentDomain.GetData("GH_ContextClassLoader"); if (contextLoader != null) { return((Driver)contextLoader.loadClass(driver).newInstance()); } return((Driver)java.lang.Class.forName(driver).newInstance()); } catch (java.lang.ClassNotFoundException e) { throw new TypeLoadException(e.Message, e); } catch (java.lang.InstantiationException e) { throw new MemberAccessException(e.Message, e); } catch (java.lang.IllegalAccessException e) { throw new MissingMethodException(e.Message, e); } } return(null); }
public void UnloadHandler(object sender, EventArgs e) { string shutUrl; switch (_policy) { case DerbyShutDownPolicy.Never: return; case DerbyShutDownPolicy.Database: shutUrl = GetConnectionProperty(_connectionString, "JdbcURL"); break; case DerbyShutDownPolicy.System: shutUrl = "JdbcURL=jdbc:derby:"; break; default: case DerbyShutDownPolicy.Default: java.lang.ClassLoader contextLoader = (java.lang.ClassLoader)AppDomain.CurrentDomain.GetData(J2EEConsts.CLASS_LOADER); java.lang.Class klass = contextLoader.loadClass("org.apache.derby.jdbc.EmbeddedDriver"); if (klass == null) { return; } shutUrl = (klass.getClassLoader() == contextLoader) ? "JdbcURL=jdbc:derby:" : GetConnectionProperty(_connectionString, "JdbcURL"); break; } const string shuttingConnection = "JdbcDriverClassName=org.apache.derby.jdbc.EmbeddedDriver;{0};shutdown=true"; if (!String.IsNullOrEmpty(shutUrl)) { try { new OleDbConnection(String.Format(shuttingConnection, shutUrl)).Open(); } catch (Exception ex) { Trace.Write(ex.ToString()); } } }
/// <summary> /// Loads the class with the specified name, optionally linking it after /// loading. /// </summary> /// <remarks> /// Loads the class with the specified name, optionally linking it after /// loading. The following steps are performed: /// <ol> /// <li> Call /// <see cref="findLoadedClass(string)">findLoadedClass(string)</see> /// to determine if the requested /// class has already been loaded.</li> /// <li>If the class has not yet been loaded: Invoke this method on the /// parent class loader.</li> /// <li>If the class has still not been loaded: Call /// <see cref="findClass(string)">findClass(string)</see> /// to find the class.</li> /// </ol> /// <p> /// <strong>Note:</strong> In the Android reference implementation, the /// <code>resolve</code> /// parameter is ignored; classes are never linked. /// </p> /// </remarks> /// <returns> /// the /// <code>Class</code> /// object. /// </returns> /// <param name="className">the name of the class to look for.</param> /// <param name="resolve"> /// Indicates if the class should be resolved after loading. This /// parameter is ignored on the Android reference implementation; /// classes are not resolved. /// </param> /// <exception cref="ClassNotFoundException">if the class can not be found.</exception> /// <exception cref="java.lang.ClassNotFoundException"></exception> protected internal virtual System.Type loadClass(string className, bool resolve) { System.Type clazz = findLoadedClass(className); if (clazz == null) { try { clazz = parent.loadClass(className, false); } catch (java.lang.ClassNotFoundException) { } // Don't want to see this. if (clazz == null) { clazz = findClass(className); } } return(clazz); }
/// <summary> /// Perform instantiation of the process's /// <see cref="Activity">Activity</see> /// object. The /// default implementation provides the normal system behavior. /// </summary> /// <param name="cl">The ClassLoader with which to instantiate the object.</param> /// <param name="className"> /// The name of the class implementing the Activity /// object. /// </param> /// <param name="intent"> /// The Intent object that specified the activity class being /// instantiated. /// </param> /// <returns>The newly instantiated Activity object.</returns> /// <exception cref="java.lang.InstantiationException"></exception> /// <exception cref="System.MemberAccessException"></exception> /// <exception cref="java.lang.ClassNotFoundException"></exception> public virtual android.app.Activity newActivity(java.lang.ClassLoader cl, string className, android.content.Intent intent) { return((android.app.Activity)System.Activator.CreateInstance(cl.loadClass(className ))); }