public virtual void add(java.net.URL url, string str, org.openrdf.rio.RDFFormat rdff, params org.openrdf.model.Resource[] rarr) { Object obj = SesameHelper.LoadFromUri(url, str, rdff); IEnumerable <Uri> contexts = rarr.ToContexts(this._mapping); this.AddInternal(obj, contexts); }
MainFrame(java.net.URL host) { // create the main frame and its components this.host = host; // hook window open events and flag the frame as exit-on-close getToolkit().addAWTEventListener(this, java.awt.AWTEvent.WINDOW_EVENT_MASK); setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE); // set the title and frame icons setTitle(Application.ProductName); setIconImages(new java.util.ArrayList() { getImage("IconLarge.png"), getImage("IconSmall.png") }); // position and size the frame appropriately var screenSize = getToolkit().getScreenSize(); setSize((int)(screenSize.width * 0.75), (int)(screenSize.height * 0.75)); setLocationRelativeTo(null); // create and initialize the Consens applet var applet = new Applet(this); applet.setStub(this); applet.init(); applet.start(); }
/// <summary>Returns the URL of the resource with the specified name.</summary> /// <remarks> /// Returns the URL of the resource with the specified name. This /// implementation first tries to use the parent class loader to find the /// resource; if this fails then /// <see cref="findResource(string)">findResource(string)</see> /// is called to /// find the requested resource. /// </remarks> /// <param name="resName">the name of the resource to find.</param> /// <returns> /// the /// <code>URL</code> /// object for the requested resource or /// <code>null</code> /// if the resource can not be found /// </returns> /// <seealso cref="Type{T}.getResource(string)">Type<T>.getResource(string)</seealso> public virtual java.net.URL getResource(string resName) { java.net.URL resource = parent.getResource(resName); if (resource == null) { resource = findResource(resName); } return(resource); }
public virtual bool isSealed(java.net.URL arg0) { global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv; if (!IsClrObject) { return(@__env.CallBooleanMethod(this.JvmHandle, global::java.lang.Package._isSealed13097, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))); } else { return(@__env.CallNonVirtualBooleanMethod(this.JvmHandle, global::java.lang.Package.staticClass, global::java.lang.Package._isSealed13097, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))); } }
protected virtual global::java.net.InetAddress getHostAddress(java.net.URL arg0) { global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv; if (!IsClrObject) { return(global::MonoJavaBridge.JavaBridge.WrapJavaObject(@__env.CallObjectMethod(this.JvmHandle, global::java.net.URLStreamHandler._getHostAddress13973, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as java.net.InetAddress); } else { return(global::MonoJavaBridge.JavaBridge.WrapJavaObject(@__env.CallNonVirtualObjectMethod(this.JvmHandle, global::java.net.URLStreamHandler.staticClass, global::java.net.URLStreamHandler._getHostAddress13973, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as java.net.InetAddress); } }
protected virtual void setURL(java.net.URL arg0, java.lang.String arg1, java.lang.String arg2, int arg3, java.lang.String arg4, java.lang.String arg5) { global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv; if (!IsClrObject) { @__env.CallVoidMethod(this.JvmHandle, global::java.net.URLStreamHandler._setURL13976, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg3), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg4), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg5)); } else { @__env.CallNonVirtualVoidMethod(this.JvmHandle, global::java.net.URLStreamHandler.staticClass, global::java.net.URLStreamHandler._setURL13976, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg3), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg4), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg5)); } }
protected virtual int hashCode(java.net.URL arg0) { global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv; if (!IsClrObject) { return(@__env.CallIntMethod(this.JvmHandle, global::java.net.URLStreamHandler._hashCode13966, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))); } else { return(@__env.CallNonVirtualIntMethod(this.JvmHandle, global::java.net.URLStreamHandler.staticClass, global::java.net.URLStreamHandler._hashCode13966, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))); } }
protected virtual bool sameFile(java.net.URL arg0, java.net.URL arg1) { global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv; if (!IsClrObject) { return(@__env.CallBooleanMethod(this.JvmHandle, global::java.net.URLStreamHandler._sameFile13968, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1))); } else { return(@__env.CallNonVirtualBooleanMethod(this.JvmHandle, global::java.net.URLStreamHandler.staticClass, global::java.net.URLStreamHandler._sameFile13968, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1))); } }
protected virtual global::java.lang.String toExternalForm(java.net.URL arg0) { global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv; if (!IsClrObject) { return(global::MonoJavaBridge.JavaBridge.WrapJavaObject(@__env.CallObjectMethod(this.JvmHandle, global::java.net.URLStreamHandler._toExternalForm13969, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as java.lang.String); } else { return(global::MonoJavaBridge.JavaBridge.WrapJavaObject(@__env.CallNonVirtualObjectMethod(this.JvmHandle, global::java.net.URLStreamHandler.staticClass, global::java.net.URLStreamHandler._toExternalForm13969, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0))) as java.lang.String); } }
/** * Retrieves the contents of a specified {@link java.net.URL}. If successful, this places the URL * contents in a specified session cache with a specified key. This either marks the resource as available or * missing, depending on whether the retrieval succeeds or fails. Finally, this optionally notifies the caller that * the retrieval has succeeded by firing a property change event. If either the property listener or property name * are null, that functionality is disabled. * * @param url the URL contents to retrieve. * @param cache the cache which receives the retrieved data. * @param cacheKey the cache key which identifies where the retrieved data is placed in the session * cache. * @param absentResourceList the absent resource list to update. * @param resourceID the resource ID to use in the absent resource list. * @param propertyListener the property change listener which is fired when the retrieved data is available. * @param propertyName the property name to fire when retrieved data is available. * * @throws ArgumentException if any of the url, retrieval service, cache, or cache key are null. */ public static void retrieveSessionData(java.net.URL url, SessionCache cache, Object cacheKey, AbsentResourceList absentResourceList, long resourceID, PropertyChangeListener propertyListener, String propertyName) { if (url == null) { String message = Logging.getMessage("nullValue.URLIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } if (cache == null) { String message = Logging.getMessage("nullValue.CacheIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } if (cacheKey == null) { String message = Logging.getMessage("nullValue.CacheKeyIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } if (WorldWind.getNetworkStatus().isHostUnavailable(url)) { if (absentResourceList != null) { absentResourceList.markResourceAbsent(resourceID); } return; } SessionCacheRetrievalPostProcessor postProcessor = new SessionCacheRetrievalPostProcessor(cache, cacheKey, absentResourceList, resourceID, propertyListener, propertyName); postProcessor.setName(url.ToString()); Retriever retriever = URLRetriever.createRetriever(url, postProcessor); try { retriever.call(); } catch (Exception e) { String message = Logging.getMessage("layers.TiledImageLayer.ExceptionRetrievingResources", url.ToString()); Logging.logger().log(java.util.logging.Level.SEVERE, message, e); } }
/// <summary> /// Specify the dir containing your docx4j properties file /// </summary> /// <param name="dir"></param> public static void setDocx4jPropertiesDir(string dir) { ILog log = LogManager.GetCurrentClassLogger(); java.net.URL url = (new java.io.File(dir)).toURL(); //java.net.URL url = new java.net.URL("file:///C:/Users/jharrop/Documents/Visual%20Studio%202010/Projects/docx4j.NET/docx4j.NET/src/samples/resources/"); // also OK java.lang.ClassLoader contextCL = java.lang.Thread.currentThread().getContextClassLoader(); java.lang.ClassLoader urlCL = java.net.URLClassLoader.newInstance(new java.net.URL[] { url }, contextCL); java.lang.Thread.currentThread().setContextClassLoader(urlCL); // you can delete the below if the properties file is being found if (log.IsWarnEnabled && urlCL.getResource("docx4j.properties") == null) { log.Warn(url.toString() + " dir does not appear to contain docx4j.properties!"); } }
public static PDDocument GetPDDocument(string uri) { PDDocument doc; if (uri.StartsWith("http")) { java.net.URL url = new java.net.URL(uri); doc = PDDocument.load(url); } else { doc = PDDocument.load(uri); } if (doc == null) { throw new Exception(string.Format("Exception loading PDF document {0}.", uri)); } return doc; }
private java.lang.ClassLoader createClassLoader() { java.io.File[] jarFiles = this.getGroovyClasspath(); java.net.URL[] jarFilesAsURLs = new java.net.URL[jarFiles.Length]; for (int i = 0; i < jarFiles.Length; i++) { jarFilesAsURLs[i] = jarFiles[i].toURI().toURL(); } java.net.URLClassLoader urlClassLoader = new java.net.URLClassLoader(jarFilesAsURLs, java.lang.ClassLoader.getSystemClassLoader()); java.lang.Class groovyClassLoaderClass = java.lang.Class.forName("groovy.lang.GroovyClassLoader", true, urlClassLoader); java.lang.reflect.Method addClassPathMethod = groovyClassLoaderClass.getMethod("addClasspath", java.lang.Class.forName("java.lang.String")); java.lang.ClassLoader groovyClassLoader = (java.lang.ClassLoader)groovyClassLoaderClass.newInstance(); foreach (java.io.File file in jarFiles) { addClassPathMethod.invoke(groovyClassLoader, file.getAbsolutePath()); } this._groovyClassLoaderClass = groovyClassLoaderClass; return(groovyClassLoader); }
/** * Checks a session cache for a specified key, and if present attempts to interpret the cache entry as a {@link * WMSCapabilities} document. If the key does not map to a Capabilities document for any reason, this attempts to * asynchronously retrieve the Capabilities from a specified URL, and returns null. * * @param url the URL contents to retrieve. * @param cache the session cache. * @param cacheKey the key to identify the object in the session cache. * @param absentResourceList the absent resource list to update. * @param resourceID the resource ID to use in the absent resource list. * @param propertyListener the property change listener which is fired when the retrieved data is available. * @param propertyName the property name to fire when retrieved data is available. * * @return the Capabilities document in the session cache, or null if the document is not in the cache. * * @throws ArgumentException if either the url, retrieval service, cache or cache key are null. */ public static WMSCapabilities getOrRetrieveSessionCapabilities(java.net.URL url, SessionCache cache, Object cacheKey, AbsentResourceList absentResourceList, long resourceID, PropertyChangeListener propertyListener, String propertyName) { if (url == null) { String message = Logging.getMessage("nullValue.URLIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } if (cache == null) { String message = Logging.getMessage("nullValue.CacheIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } if (cacheKey == null) { String message = Logging.getMessage("nullValue.CacheKeyIsNull"); Logging.logger().severe(message); throw new ArgumentException(message); } WMSCapabilities caps = getSessionCapabilities(cache, cacheKey, url.ToString()); if (caps != null) { return(caps); } retrieveSessionData(url, cache, cacheKey, absentResourceList, resourceID, propertyListener, propertyName); // Try to get the caps after the retrieval attempt. return(getSessionCapabilities(cache, cacheKey, url.ToString())); }
internal Resource(java.net.URL url, AssemblyClassLoader loader) { this.URL = url; this.Loader = loader; }
/// <summary> /// Gets the site's content without any html content. /// </summary> /// <param name="url"> /// The <c>Uri</c> to the site from which to fetch content. /// </param> /// <returns> /// Returns the html stripped content of a given <c>Uri</c>. /// </returns> private static string GetStrippedHtmlContent(Uri url) { // Parse the url to a java.net.URL. javaUrl = new java.net.URL(url.AbsoluteUri); // Return the article from the javaUrl. try { return BoilerPipeExtractor.getText(javaUrl); } catch (BoilerpipeProcessingException) { } return ""; }
private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { while (true) { System.Threading.Thread.Sleep(125); lock(this) { if(this._queue.Count > 0) { string cmd = this._queue.Dequeue(); if (cmd != null) { System.Uri uri = new Uri(cmd); if (uri.Scheme == "voicewebbrowsing") { if (uri.Host == "receivehackernews") { ReadHackerNewsFeed(); } else if (uri.Host == "stop") { this._ttsVoice.SpeakAsyncCancelAll(); } else if (uri.Host == "readarticle" || uri.Host == "savearticle") { string articleNumberStr = System.IO.Path.GetFileName(uri.AbsolutePath); int articleNumber = int.Parse(articleNumberStr); if (articleNumber > articleList.Count) { Say("please retrieve hacker news articles first"); } else { articleNumber--; // 0-based index string link = articleList[articleNumber]; java.net.URL url = new java.net.URL(link); string article = de.l3s.boilerpipe.extractors.ArticleExtractor.INSTANCE.getText(url); if (uri.Host == "readarticle") { Say(article); } else if (uri.Host == "savearticle") { SaveArticle(link, article); } } } } } } } } }
internal virtual object GetProtectionDomain() { #if STATIC_COMPILER || FIRST_PASS || STUB_GENERATOR return null; #else if (protectionDomain == null) { java.net.URL codebase; try { codebase = new java.net.URL(assemblyLoader.Assembly.CodeBase); } catch (NotSupportedException) { // dynamic assemblies don't have a codebase codebase = null; } catch (java.net.MalformedURLException) { codebase = null; } java.security.Permissions permissions = new java.security.Permissions(); permissions.add(new java.security.AllPermission()); object pd = new java.security.ProtectionDomain(new java.security.CodeSource(codebase, (java.security.cert.Certificate[])null), permissions, (java.lang.ClassLoader)GetJavaClassLoader(), null); lock (this) { if (protectionDomain == null) { protectionDomain = pd; } } } return protectionDomain; #endif }
/// <summary> /// <para> /// Finds the resource URL closure for the given starting assembly list. /// </para> /// The closure is computed recursively from the referenced assemblies; /// satellite assemblies for the current culture are included also. /// </summary> /// <remarks> /// Referenced System, IKVM, Hsqldb core and NUnit assemblies are excluded. /// </remarks> /// <param name="startingList">The starting assembly list.</param> /// <returns> /// An array of <c>ikvmres:</c> protocol URLs describing the useful portion /// of the reference closure for the starting list. /// </returns> //[CLSCompliant(false)] public static URL[] FindResourceURLClosure(List<Assembly> startingList) { if (startingList == null) { throw new ArgumentNullException("startingList"); } Set included = new HashSet(); Set encountered = new HashSet(); foreach (Assembly entry in startingList) { AddAssembly(encountered, included, entry); } Assembly[] assemblies = new Assembly[included.size()]; included.toArray(assemblies); URL[] urls = new URL[included.size()]; for (int i = 0; i < assemblies.Length; i++) { Assembly entry = assemblies[i]; string entryName = URLEncoder.encode(entry.FullName, "UTF-8"); string entryUrl = string.Concat("ikvmres://", entryName, "/"); try { urls[i] = new URL(entryUrl); } catch (Exception ex) { #if DEBUG Debug.WriteLine("URL: " + entryUrl); Debug.WriteLine(ex); #endif } } return urls; }