annotate scripts/java/org/octave/OctClassLoader.java @ 17746:c4f5c781c3ca classdef

maint: Update copyright notices.
author John W. Eaton <jwe@octave.org>
date Wed, 23 Oct 2013 22:48:29 -0400
parents d63878346099
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15753
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
1 /*
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
2
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 15753
diff changeset
3 Copyright (C) 2007, 2013 Michael Goffioul
15753
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
4
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
5 This file is part of Octave.
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
6
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
8 under the terms of the GNU General Public License as published by
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
9 the Free Software Foundation; either version 3 of the License, or (at
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
10 your option) any later version.
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
11
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
12 Octave is distributed in the hope that it will be useful, but
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
15 General Public License for more details.
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
16
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
17 You should have received a copy of the GNU General Public License
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
18 along with Octave; see the file COPYING. If not, see
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
19 <http://www.gnu.org/licenses/>.
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
20
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 */
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23 package org.octave;
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25 import java.io.File;
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 public class OctClassLoader extends java.net.URLClassLoader
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 {
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29 public OctClassLoader ()
15753
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
30 {
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
31 super (new java.net.URL[0]);
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
32 }
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 public OctClassLoader (ClassLoader parent)
15753
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
35 {
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
36 super (new java.net.URL[0], parent);
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
37 }
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39 protected Class findClass (String name) throws ClassNotFoundException
15753
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
40 {
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
41 //System.out.println ("Looking for class " + name);
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
42 return super.findClass (name);
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
43 }
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 protected String findLibrary (String libname)
15753
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
46 {
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
47 // Look dynamically into java.library.path, because Sun VM does
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
48 // not do it (seems to cache initial java.library.path instead)
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49
15753
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
50 String[] paths = System.getProperty ("java.library.path").split (File.pathSeparator);
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51
15753
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
52 libname = System.mapLibraryName (libname);
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
53 for (int i = 0; i < paths.length; i++)
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
54 {
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
55 File f = new File (paths[i], libname);
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
56 if (f.exists ())
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
57 return f.getAbsolutePath ();
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
58 }
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59
15753
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
60 return null;
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
61 }
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63 public void addClassPath (String name) throws Exception
15753
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
64 {
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
65 java.io.File f = new java.io.File (name);
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
66 addURL (f.toURI ().toURL ());
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
67 }
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69 // new -MH-
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70 public void addURL (java.net.URL url)
15753
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
71 {
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
72 super.addURL (url);
6e39fe7992d9 style fixes and copyright update for java files
John W. Eaton <jwe@octave.org>
parents: 15625
diff changeset
73 }
15625
acf0addfc610 include Octave Forge java package in core Octave
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74 }