summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/.cvsignore1
-rwxr-xr-xtools/Makefile.am6
-rw-r--r--tools/README3
-rw-r--r--tools/gnu/classpath/tools/giop/GRMIC.java18
-rw-r--r--tools/gnu/classpath/tools/giop/IorParser.java18
-rw-r--r--tools/gnu/classpath/tools/giop/grmic/CompilationError.java18
-rw-r--r--tools/gnu/classpath/tools/giop/grmic/Generator.java18
-rw-r--r--tools/gnu/classpath/tools/giop/grmic/GiopIo.java18
-rw-r--r--tools/gnu/classpath/tools/giop/grmic/GiopRmicCompiler.java18
-rw-r--r--tools/gnu/classpath/tools/giop/grmic/HashFinder.java22
-rw-r--r--tools/gnu/classpath/tools/giop/grmic/MethodGenerator.java18
-rw-r--r--tools/gnu/classpath/tools/jarsigner/HashUtils.java27
-rw-r--r--tools/gnu/classpath/tools/jarsigner/JarSigner.java23
-rw-r--r--tools/gnu/classpath/tools/jarsigner/JarVerifier.java21
-rw-r--r--tools/gnu/classpath/tools/jarsigner/Main.java204
-rw-r--r--tools/gnu/classpath/tools/jarsigner/SFHelper.java25
-rw-r--r--tools/gnu/classpath/tools/jarsigner/jarsigner.txt2
-rw-r--r--tools/gnu/classpath/tools/rmi/Persistent.java87
-rw-r--r--tools/gnu/classpath/tools/rmi/PersistentBidiHashTable.java268
-rw-r--r--tools/gnu/classpath/tools/rmi/PersistentHashTable.java246
-rw-r--r--tools/gnu/classpath/tools/rmi/REGISTRY.java165
-rw-r--r--tools/gnu/classpath/tools/rmi/REGISTRY.txt28
-rw-r--r--tools/gnu/classpath/tools/rmi/RMIC.java19
-rw-r--r--tools/gnu/classpath/tools/rmi/RMID.java189
-rw-r--r--tools/gnu/classpath/tools/rmi/RMID.txt30
-rw-r--r--tools/gnu/classpath/tools/rmi/registry/RegistryImpl.java139
-rw-r--r--tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Skel.java278
-rw-r--r--tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Stub.java263
-rw-r--r--tools/gnu/classpath/tools/rmi/registry/package.html46
-rw-r--r--tools/gnu/classpath/tools/rmi/rmic/RmiMethodGenerator.java14
-rw-r--r--tools/gnu/classpath/tools/rmi/rmic/RmicCompiler.java13
-rw-r--r--tools/gnu/classpath/tools/rmi/rmic/WrapUnWrapper.java19
-rw-r--r--tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12Method.jav2
-rw-r--r--tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12MethodVoid.jav2
-rw-r--r--tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl.java244
-rw-r--r--tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl_Stub.java556
-rw-r--r--tools/jarsigner.sh.in46
37 files changed, 2792 insertions, 322 deletions
diff --git a/tools/.cvsignore b/tools/.cvsignore
index eaae7d326..ed63b49d8 100644
--- a/tools/.cvsignore
+++ b/tools/.cvsignore
@@ -1,3 +1,4 @@
+jarsigner.sh
Makefile.in
Makefile
tools.zip
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 57a22de88..5a47d18e4 100755
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,11 +1,13 @@
## Input file for automake to generate the Makefile.in used by configure
+GLIBJ_CLASSPATH='$(top_builddir)/lib':'$(top_builddir)/lib/glibj.zip'
+
# Setup the compiler to use the GNU Classpath library we just build
if FOUND_GCJX
-JCOMPILER = $(GCJX) -bootclasspath '' -sourcepath '' -classpath $(top_builddir)/lib:.
+JCOMPILER = $(GCJX) -encoding UTF-8 -bootclasspath '' -sourcepath '' -classpath $(GLIBJ_CLASSPATH):.
else
if FOUND_ECJ
-JCOMPILER = $(ECJ) -bootclasspath '$(top_builddir)/lib' -classpath .
+JCOMPILER = $(ECJ) -1.5 -encoding UTF-8 -bootclasspath $(GLIBJ_CLASSPATH) -classpath .
else
error dunno how to setup the JCOMPILER and compile
endif
diff --git a/tools/README b/tools/README
index 54f682859..dc049d3b5 100644
--- a/tools/README
+++ b/tools/README
@@ -39,6 +39,9 @@ in gnu.classpath.tools.rmi package):
research and backward-compatibile applications, as
Classpath supports the 1.5 feature to replace such
stubs by proxy classes.
+* REGISTRY - The persistent RMI naming service.
+* RMID - The persistent RMI activation daemon, supports the
+ java.rmi.activation package.
== Security tools ==
diff --git a/tools/gnu/classpath/tools/giop/GRMIC.java b/tools/gnu/classpath/tools/giop/GRMIC.java
index bb0ef9cdc..a372cfd66 100644
--- a/tools/gnu/classpath/tools/giop/GRMIC.java
+++ b/tools/gnu/classpath/tools/giop/GRMIC.java
@@ -17,23 +17,7 @@ You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+*/
package gnu.classpath.tools.giop;
diff --git a/tools/gnu/classpath/tools/giop/IorParser.java b/tools/gnu/classpath/tools/giop/IorParser.java
index 7d70c8aca..411b8997d 100644
--- a/tools/gnu/classpath/tools/giop/IorParser.java
+++ b/tools/gnu/classpath/tools/giop/IorParser.java
@@ -17,23 +17,7 @@ You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+*/
package gnu.classpath.tools.giop;
diff --git a/tools/gnu/classpath/tools/giop/grmic/CompilationError.java b/tools/gnu/classpath/tools/giop/grmic/CompilationError.java
index c6b3e56e8..d1fa814ee 100644
--- a/tools/gnu/classpath/tools/giop/grmic/CompilationError.java
+++ b/tools/gnu/classpath/tools/giop/grmic/CompilationError.java
@@ -17,23 +17,7 @@ You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+*/
package gnu.classpath.tools.giop.grmic;
diff --git a/tools/gnu/classpath/tools/giop/grmic/Generator.java b/tools/gnu/classpath/tools/giop/grmic/Generator.java
index a45e8d398..17ab821ec 100644
--- a/tools/gnu/classpath/tools/giop/grmic/Generator.java
+++ b/tools/gnu/classpath/tools/giop/grmic/Generator.java
@@ -17,23 +17,7 @@ You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+*/
package gnu.classpath.tools.giop.grmic;
diff --git a/tools/gnu/classpath/tools/giop/grmic/GiopIo.java b/tools/gnu/classpath/tools/giop/grmic/GiopIo.java
index 3714c4ce4..0e0df7bc5 100644
--- a/tools/gnu/classpath/tools/giop/grmic/GiopIo.java
+++ b/tools/gnu/classpath/tools/giop/grmic/GiopIo.java
@@ -17,23 +17,7 @@ You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+*/
package gnu.classpath.tools.giop.grmic;
diff --git a/tools/gnu/classpath/tools/giop/grmic/GiopRmicCompiler.java b/tools/gnu/classpath/tools/giop/grmic/GiopRmicCompiler.java
index 62456fd51..4beba1c9f 100644
--- a/tools/gnu/classpath/tools/giop/grmic/GiopRmicCompiler.java
+++ b/tools/gnu/classpath/tools/giop/grmic/GiopRmicCompiler.java
@@ -17,23 +17,7 @@ You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+*/
package gnu.classpath.tools.giop.grmic;
diff --git a/tools/gnu/classpath/tools/giop/grmic/HashFinder.java b/tools/gnu/classpath/tools/giop/grmic/HashFinder.java
index 216e73953..2efdb1e76 100644
--- a/tools/gnu/classpath/tools/giop/grmic/HashFinder.java
+++ b/tools/gnu/classpath/tools/giop/grmic/HashFinder.java
@@ -1,3 +1,25 @@
+/* HashFinder.java -- finds the hash character.
+ Copyright (C) 2006 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+*/
+
+
package gnu.classpath.tools.giop.grmic;
import java.util.HashSet;
diff --git a/tools/gnu/classpath/tools/giop/grmic/MethodGenerator.java b/tools/gnu/classpath/tools/giop/grmic/MethodGenerator.java
index 9a44fad79..80148d51a 100644
--- a/tools/gnu/classpath/tools/giop/grmic/MethodGenerator.java
+++ b/tools/gnu/classpath/tools/giop/grmic/MethodGenerator.java
@@ -17,23 +17,7 @@ You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+*/
package gnu.classpath.tools.giop.grmic;
diff --git a/tools/gnu/classpath/tools/jarsigner/HashUtils.java b/tools/gnu/classpath/tools/jarsigner/HashUtils.java
index 7591b3c57..a81a0d34d 100644
--- a/tools/gnu/classpath/tools/jarsigner/HashUtils.java
+++ b/tools/gnu/classpath/tools/jarsigner/HashUtils.java
@@ -16,38 +16,21 @@ General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+02110-1301 USA. */
package gnu.classpath.tools.jarsigner;
+import gnu.java.security.hash.Sha160;
+import gnu.java.security.util.Base64;
+import gnu.java.util.jar.JarUtils;
+
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.logging.Logger;
-import gnu.java.security.hash.Sha160;
-import gnu.java.security.util.Base64;
-import gnu.java.util.jar.JarUtils;
-
/**
* Collection of utility methods used in JAR file signing and verification.
*/
diff --git a/tools/gnu/classpath/tools/jarsigner/JarSigner.java b/tools/gnu/classpath/tools/jarsigner/JarSigner.java
index 8babdcc30..1b58c5072 100644
--- a/tools/gnu/classpath/tools/jarsigner/JarSigner.java
+++ b/tools/gnu/classpath/tools/jarsigner/JarSigner.java
@@ -16,24 +16,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+02110-1301 USA. */
package gnu.classpath.tools.jarsigner;
@@ -45,8 +28,6 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.security.cert.CRLException;
-import java.security.cert.CertificateEncodingException;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
@@ -69,7 +50,7 @@ public class JarSigner
this.main = main;
}
- void start() throws IOException, CertificateEncodingException, CRLException
+ void start() throws Exception
{
log.entering("JarSigner", "start");
diff --git a/tools/gnu/classpath/tools/jarsigner/JarVerifier.java b/tools/gnu/classpath/tools/jarsigner/JarVerifier.java
index 06ebe64fe..8bca89270 100644
--- a/tools/gnu/classpath/tools/jarsigner/JarVerifier.java
+++ b/tools/gnu/classpath/tools/jarsigner/JarVerifier.java
@@ -16,24 +16,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+02110-1301 USA. */
package gnu.classpath.tools.jarsigner;
@@ -92,7 +75,7 @@ public class JarVerifier
this.main = main;
}
- void start() throws IOException, CRLException, CertificateException
+ void start() throws Exception
{
log.entering("JarVerifier", "start");
diff --git a/tools/gnu/classpath/tools/jarsigner/Main.java b/tools/gnu/classpath/tools/jarsigner/Main.java
index df5c3bb08..794055f45 100644
--- a/tools/gnu/classpath/tools/jarsigner/Main.java
+++ b/tools/gnu/classpath/tools/jarsigner/Main.java
@@ -16,41 +16,32 @@ General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+02110-1301 USA. */
package gnu.classpath.tools.jarsigner;
+import gnu.classpath.SystemProperties;
+import gnu.classpath.tools.HelpPrinter;
+import gnu.java.security.OID;
+import gnu.java.security.Registry;
+import gnu.javax.security.auth.callback.ConsoleCallbackHandler;
+
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.security.AccessController;
import java.security.Key;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
+import java.security.PrivilegedAction;
import java.security.Provider;
+import java.security.Security;
import java.security.UnrecoverableKeyException;
-import java.security.cert.CRLException;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.util.Locale;
@@ -62,11 +53,6 @@ import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
-import gnu.classpath.SystemProperties;
-import gnu.java.security.OID;
-import gnu.java.security.Registry;
-import gnu.javax.security.auth.callback.ConsoleCallbackHandler;
-
/**
* The GNU Classpath implementation of the <i>jarsigner</i> tool.
* <p>
@@ -103,32 +89,27 @@ public class Main
private String jarFileName;
private String alias;
- private Provider provider;
+ protected Provider provider;
+ private boolean providerInstalled;
private char[] ksPasswordChars;
private KeyStore store;
private char[] passwordChars;
private PrivateKey signerPrivateKey;
private Certificate[] signerCertificateChain;
- private Main(String[] args) throws KeyStoreException, InstantiationException,
- IllegalAccessException, ClassNotFoundException, NoSuchAlgorithmException,
- CertificateException, IOException, UnrecoverableKeyException,
- UnsupportedCallbackException
+ private Main()
{
super();
-
- processArgs(args);
}
- public static final void main(String[] args) throws IOException,
- CRLException, CertificateException
+ public static final void main(String[] args)
{
log.entering("Main", "main", args);
- Main tool;
+ Main tool = new Main();
try
{
- tool = new Main(args);
+ tool.processArgs(args);
tool.start();
}
catch (SecurityException x)
@@ -142,6 +123,8 @@ public class Main
System.err.println("jarsigner error: " + x);
}
+ tool.teardown();
+
log.exiting("Main", "main");
// System.exit(0);
}
@@ -149,24 +132,20 @@ public class Main
// helper methods -----------------------------------------------------------
/**
- * @param args
- * @throws KeyStoreException
- * @throws ClassNotFoundException
- * @throws IllegalAccessException
- * @throws InstantiationException
- * @throws IOException
- * @throws CertificateException
- * @throws NoSuchAlgorithmException
- * @throws UnsupportedCallbackException
- * @throws UnrecoverableKeyException
+ * Read the command line arguments setting the tool's parameters in
+ * preparation for the user desired action.
+ *
+ * @param args an array of options (strings).
+ * @throws Exception if an exceptio occurs during the process.
*/
- private void processArgs(String[] args) throws KeyStoreException,
- InstantiationException, IllegalAccessException, ClassNotFoundException,
- NoSuchAlgorithmException, CertificateException, IOException,
- UnrecoverableKeyException, UnsupportedCallbackException
+ private void processArgs(String[] args) throws Exception
{
log.entering("Main", "processArgs", args);
+ HelpPrinter.checkHelpKey(args, HELP_PATH);
+ if (args == null || args.length == 0)
+ HelpPrinter.printHelpAndExit(HELP_PATH);
+
int limit = args.length;
log.finest("args.length=" + limit);
int i = 0;
@@ -252,7 +231,15 @@ public class Main
log.exiting("Main", "processArgs");
}
- private void start() throws IOException, CRLException, CertificateException
+ /**
+ * Invokes the <code>start()</code> method of the concrete handler.
+ * <p>
+ * Depending on the result of processing the command line arguments, this
+ * handler may be one for signing the jar, or verifying it.
+ *
+ * @throws Exception if an exception occurs during the process.
+ */
+ private void start() throws Exception
{
log.entering("Main", "start");
@@ -270,11 +257,64 @@ public class Main
log.exiting("Main", "start");
}
+ /**
+ * Ensures that the underlying JVM is left in the same state as we found it
+ * when we first launched the tool. Specifically, if we have installed a new
+ * security provider then now is the time to remove it.
+ * <p>
+ * Note (rsn): this may not be necessary if we terminate the JVM; i.e. call
+ * {@link System#exit(int)} at the end of the tool's invocation. Nevertheless
+ * it's good practive to return the JVM to its initial state.
+ */
+ private void teardown()
+ {
+ log.entering("Main", "teardown");
+
+ if (providerInstalled)
+ {
+ final String providerName = provider.getName();
+ log.info("About to remove provider: " + providerName);
+ // remove it. again we need to override security checks
+ AccessController.doPrivileged(new PrivilegedAction()
+ {
+ public Object run()
+ {
+ Security.removeProvider(providerName);
+ return null;
+ }
+ });
+ }
+
+ log.exiting("Main", "teardown");
+ }
+
+ /**
+ * After processing the command line arguments, this method is invoked to
+ * process the common parameters which may have been encountered among the
+ * actual arguments.
+ * <p>
+ * Common parameters are those which are allowed in both signing and
+ * verification modes.
+ *
+ * @throws InstantiationException if a security provider class name is
+ * specified but that class name is that of either an interface or
+ * an abstract class.
+ * @throws IllegalAccessException if a security provider class name is
+ * specified but no 0-arguments constructor is defined for that
+ * class.
+ * @throws ClassNotFoundException if a security provider class name is
+ * specified but no such class was found in the classpath.
+ * @throws IOException if the JAR file name for signing, or verifying, does
+ * not exist, exists but denotes a directory, or is not readable.
+ */
private void setupCommonParams() throws InstantiationException,
IllegalAccessException, ClassNotFoundException, IOException
{
log.entering("Main", "setupCommonParams");
+ if (jarFileName == null)
+ HelpPrinter.printHelpAndExit(HELP_PATH);
+
File jar = new File(jarFileName);
if (! jar.exists())
throw new FileNotFoundException(jarFileName);
@@ -286,7 +326,16 @@ public class Main
throw new IOException("JAR file [" + jarFileName + "] is NOT readable");
if (providerClassName != null && providerClassName.length() > 0)
- provider = (Provider) Class.forName(providerClassName).newInstance();
+ {
+ provider = (Provider) Class.forName(providerClassName).newInstance();
+ // is it already installed?
+ String providerName = provider.getName();
+ Provider installedProvider = Security.getProvider(providerName);
+ if (installedProvider != null)
+ log.info("Provider " + providerName + " is already installed");
+ else // install it
+ installNewProvider();
+ }
if (! verbose && certs)
{
@@ -297,6 +346,51 @@ public class Main
log.exiting("Main", "setupCommonParams");
}
+ /**
+ * Install the user defined security provider in the underlying JVM.
+ * <p>
+ * Also record this fact so we can remove it when we exit the tool.
+ */
+ private void installNewProvider()
+ {
+ log.entering("Main", "installNewProvider");
+
+ String providerName = provider.getName();
+ log.info("About to install new provider: " + providerName);
+ // we need to override security checks
+ Boolean result = (Boolean) AccessController.doPrivileged(new PrivilegedAction()
+ {
+ public Object run()
+ {
+ int actualPosition = Security.insertProviderAt(provider, 1);
+ return new Boolean(actualPosition != - 1);
+ }
+ });
+ log.info("Provider " + providerName + " installed successfully? " + result);
+ providerInstalled = result.booleanValue();
+
+ log.exiting("Main", "installNewProvider");
+ }
+
+ /**
+ * After processing the command line arguments, this method is invoked to
+ * process the parameters which may have been encountered among the actual
+ * arguments, and which are specific to the signing action of the tool.
+ *
+ * @throws KeyStoreException if no implementation of the designated (or
+ * default type) of a key store is availabe.
+ * @throws IOException if an I/O related exception occurs during the process.
+ * @throws NoSuchAlgorithmException if an implementation of an algorithm used
+ * by the key store is not available.
+ * @throws CertificateException if an exception occurs while reading a
+ * certificate from the key store.
+ * @throws UnsupportedCallbackException if no implementation of a password
+ * callback is available.
+ * @throws UnrecoverableKeyException if the wrong password was used to unlock
+ * the key store.
+ * @throws SecurityException if the designated alias is not known to the key
+ * store or is not an Alias of a Key Entry.
+ */
private void setupSigningParams() throws KeyStoreException, IOException,
NoSuchAlgorithmException, CertificateException,
UnsupportedCallbackException, UnrecoverableKeyException
@@ -324,10 +418,7 @@ public class Main
else
ksType = ksType.trim();
- if (provider != null)
- store = KeyStore.getInstance(ksType, provider);
- else
- store = KeyStore.getInstance(ksType);
+ store = KeyStore.getInstance(ksType);
if (ksPassword == null)
{
@@ -345,6 +436,9 @@ public class Main
InputStream stream = url.openStream();
store.load(stream, ksPasswordChars);
+ if (alias == null)
+ HelpPrinter.printHelpAndExit(HELP_PATH);
+
if (! store.containsAlias(alias))
throw new SecurityException("Designated alias [" + alias
+ "] MUST be known to the key store in use");
diff --git a/tools/gnu/classpath/tools/jarsigner/SFHelper.java b/tools/gnu/classpath/tools/jarsigner/SFHelper.java
index cbf5f356b..38caa44aa 100644
--- a/tools/gnu/classpath/tools/jarsigner/SFHelper.java
+++ b/tools/gnu/classpath/tools/jarsigner/SFHelper.java
@@ -16,24 +16,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+02110-1301 USA. */
package gnu.classpath.tools.jarsigner;
@@ -331,7 +314,7 @@ public class SFHelper
manifest.getEntries().put(name, mainfestAttributes);
}
- mainfestAttributes.putValue(Main.DIGEST_ATTR, hash);
+ mainfestAttributes.putValue(Main.DIGEST, hash);
// hash the newly added 2-header block and add it as an attribute to .SF
@@ -343,7 +326,7 @@ public class SFHelper
sfEntries.put(name, sfAttributes);
}
- sfAttributes.putValue(Main.DIGEST_ATTR, sfHash);
+ sfAttributes.putValue(Main.DIGEST, sfHash);
log.finest("Name: " + name);
log.finest(Main.DIGEST + ": " + sfHash);
log.finest("");
@@ -366,7 +349,7 @@ public class SFHelper
baos.flush();
String manifestHash = util.hashByteArray(baos.toByteArray());
log.fine("Hashed Manifest " + manifestHash);
- sfMainAttributes.putValue(Main.DIGEST_MANIFEST_ATTR, manifestHash);
+ sfMainAttributes.putValue(Main.DIGEST_MANIFEST, manifestHash);
this.state = FINISHED;
}
diff --git a/tools/gnu/classpath/tools/jarsigner/jarsigner.txt b/tools/gnu/classpath/tools/jarsigner/jarsigner.txt
index 167f6301e..a4e4c02ef 100644
--- a/tools/gnu/classpath/tools/jarsigner/jarsigner.txt
+++ b/tools/gnu/classpath/tools/jarsigner/jarsigner.txt
@@ -99,3 +99,5 @@ Usage:
implementation of the Security Provider capable of managing a
Key Store of the designated, or default, type.
+ -help Prints this help text.
+
diff --git a/tools/gnu/classpath/tools/rmi/Persistent.java b/tools/gnu/classpath/tools/rmi/Persistent.java
new file mode 100644
index 000000000..5cd1efe91
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/Persistent.java
@@ -0,0 +1,87 @@
+/* PersistentBidiHasthable.java -- Constants for the persistent tables.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath.tools.rmi;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+/**
+ * The static fields, shared by the multiple classes, implementing the
+ * persistent work.
+ *
+ * @author Audrius Meskauskas (audriusa@bioinformatics.org)
+ */
+public interface Persistent
+{
+ /**
+ * Sheduled termination task.
+ */
+ static class ExitTask extends TimerTask
+ {
+ public void run()
+ {
+ System.exit(0);
+ }
+ }
+
+ /**
+ * The timer, sheduling all disk database update events, shared by all
+ * instances.
+ */
+ static Timer timer = new Timer(true);
+
+ /**
+ * The longest time, in ms, after that the database content on the disk must
+ * be updated. The algorithm is written to avoid the very frequent writings to
+ * the disk.
+ */
+ static long SAVE_AT_MOST_AFTER = 5000;
+
+ /**
+ * States how long the database may stay not updated during the intensive
+ * operations, in ms. Otherwise the intensively used structure may never
+ * be stored to the disk.
+ */
+ static long ALWAYS_UPDATE = 300000;
+
+ /**
+ * Write the database content to the disk.
+ */
+ void writeContent();
+
+}
diff --git a/tools/gnu/classpath/tools/rmi/PersistentBidiHashTable.java b/tools/gnu/classpath/tools/rmi/PersistentBidiHashTable.java
new file mode 100644
index 000000000..94b5bcbee
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/PersistentBidiHashTable.java
@@ -0,0 +1,268 @@
+/* PersistentBidiHasthable.java -- Bidirectional persistent hash table.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath.tools.rmi;
+
+import gnu.classpath.tools.rmi.rmid.ActivationSystemImpl;
+import gnu.java.rmi.activation.BidiTable;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TimerTask;
+
+/**
+ * The persistent bidirectional hash table, maps both a to b and b to a. The
+ * changes are written to dist after SAVE_AT_MOST_AFTER time from the latest
+ * database change or at most after ALWAYS_UPDATE, if the database is updated
+ * very frequently. To ensure that no information is lost, the shutdown method
+ * must be called before exit.
+ *
+ * @author Audrius Meskauskas (audriusa@bioinformatics.org)
+ */
+public class PersistentBidiHashTable extends BidiTable implements
+ Persistent
+{
+ class WriteToDiskTask extends TimerTask
+ {
+ /**
+ * Save the database.
+ */
+ public void run()
+ {
+ writeContent();
+ sheduled = null;
+ }
+ }
+
+ /**
+ * Replaces instances of ActivationSystemImpl into the currently active
+ * instance of the ActivationSystemImpl
+ */
+ class AdaptedReader extends ObjectInputStream
+ {
+ AdaptedReader(InputStream in) throws IOException
+ {
+ super(in);
+ enableResolveObject(true);
+ }
+
+ protected Object resolveObject(Object obj) throws IOException
+ {
+ if (obj instanceof ActivationSystemImpl)
+ return ActivationSystemImpl.singleton2;
+ else
+ return obj;
+ }
+ }
+
+ /**
+ * The database file.
+ */
+ File database;
+
+ /**
+ * The currently sheduled write to disk task, null if none.
+ */
+ WriteToDiskTask sheduled = null;
+
+ /**
+ * The time, when the disk database was last updated.
+ */
+ long lastUpdated;
+
+ /**
+ * Create the unitialised instance that must be initalised when
+ * ActivationSystemImpl.singleton2 is assigned.
+ */
+ public PersistentBidiHashTable()
+ {
+ // Do not initalise the table fields - the initalise method must be
+ // called later.
+ super(0);
+ }
+
+ /**
+ * Create a new persistent table that stores its information into the given
+ * file. The ActivationSystemImpl.singleton2 must be assigned.
+ *
+ * @param file
+ * the file, where the table stores its information.
+ * @param coldStart
+ * if true, the existing file with this name will be erased and
+ * ignored. Otherwise, it will be assumed that the file contains the
+ * persistent table information.
+ */
+ public void init(File file, boolean coldStart)
+ {
+ try
+ {
+ database = file;
+ if (database.exists())
+ {
+ if (coldStart)
+ {
+ k2v = new Hashtable();
+ v2k = new Hashtable();
+ database.delete();
+ }
+ else
+ {
+ FileInputStream fi = new FileInputStream(file);
+ BufferedInputStream b = new BufferedInputStream(fi);
+ ObjectInputStream oin = new AdaptedReader(b);
+
+ k2v = (Map) oin.readObject();
+ oin.close();
+
+ v2k = new Hashtable(k2v.size());
+
+ // Reguild v2k from k2v:
+ Iterator en = k2v.keySet().iterator();
+ Object key;
+ while (en.hasNext())
+ {
+ key = en.next();
+ v2k.put(k2v.get(key), key);
+ }
+ }
+ }
+ else
+ {
+ k2v = new Hashtable();
+ v2k = new Hashtable();
+ }
+ }
+ catch (Exception ioex)
+ {
+ InternalError ierr = new InternalError("Unable to intialize with file "
+ + file);
+ ierr.initCause(ioex);
+ throw ierr;
+ }
+ }
+
+ /**
+ * Write the database content to the disk.
+ */
+ public synchronized void writeContent()
+ {
+ try
+ {
+ FileOutputStream fou = new FileOutputStream(database);
+ BufferedOutputStream b = new BufferedOutputStream(fou);
+ ObjectOutputStream oout = new ObjectOutputStream(b);
+ oout.writeObject(k2v);
+ oout.close();
+ }
+ catch (Exception ioex)
+ {
+ InternalError ierr = new InternalError(
+ "Failed to write database to disk: "
+ + database);
+ ierr.initCause(ioex);
+ throw ierr;
+ }
+ }
+
+ /**
+ * Mark the modified database as modified. The database will be written after
+ * several seconds, unless another modification occurs.
+ */
+ public void markDirty()
+ {
+ if (System.currentTimeMillis() - lastUpdated > ALWAYS_UPDATE)
+ {
+ // Force storing to disk under intensive operation.
+ writeContent();
+ lastUpdated = System.currentTimeMillis();
+ if (sheduled != null)
+ {
+ sheduled.cancel();
+ sheduled = null;
+ }
+ }
+ else
+ {
+ // Otherwise coalesce the disk database copy update events.
+ if (sheduled != null)
+ sheduled.cancel();
+ sheduled = new WriteToDiskTask();
+ timer.schedule(sheduled, SAVE_AT_MOST_AFTER);
+ }
+ }
+
+ /**
+ * Save the current database state to the disk before exit.
+ */
+ public void shutdown()
+ {
+ if (sheduled != null)
+ {
+ writeContent();
+ sheduled = null;
+ }
+ }
+
+ /**
+ * Update the memory maps and mark as should be written to the disk.
+ */
+ public void put(Object key, Object value)
+ {
+ super.put(key, value);
+ markDirty();
+ }
+
+ /**
+ * Update the memory maps and mark as should be written to the disk.
+ */
+ public void removeKey(Object key)
+ {
+ super.removeKey(key);
+ markDirty();
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/rmi/PersistentHashTable.java b/tools/gnu/classpath/tools/rmi/PersistentHashTable.java
new file mode 100644
index 000000000..925e829ff
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/PersistentHashTable.java
@@ -0,0 +1,246 @@
+/* PersistentHasthable.java -- Persistent hash table.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath.tools.rmi;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.TimerTask;
+
+/**
+ * The persistent hash table. The changes are written to dist after
+ * SAVE_AT_MOST_AFTER time from the latest database change or at most after
+ * ALWAYS_UPDATE, if the database is updated very frequently. To ensure that no
+ * information is lost, the shutdown method must be called before exit.
+ *
+ * @author Audrius Meskauskas (audriusa@bioinformatics.org)
+ */
+public class PersistentHashTable
+ extends Hashtable
+ implements Serializable, Persistent
+{
+
+ /**
+ * Use serialVersionUID for interoperability
+ */
+ private static final long serialVersionUID = 1;
+
+ class WriteToDiskTask extends TimerTask
+ {
+ /**
+ * Save the database.
+ */
+ public void run()
+ {
+ writeContent();
+ sheduled = null;
+ }
+ }
+
+ /**
+ * The database file.
+ */
+ File database;
+
+ /**
+ * The currently sheduled write to disk task, null if none.
+ */
+ WriteToDiskTask sheduled = null;
+
+ /**
+ * The time, when the disk database was last updated.
+ */
+ long lastUpdated;
+
+ /**
+ * Setting to false prevents the automated disk update.
+ * The initial value is true to prevent writing while reading and is set
+ * to false in createInstance.
+ */
+ transient boolean ready;
+
+ /**
+ * Use static method to obtain the instance.
+ */
+ private PersistentHashTable(File file)
+ {
+ if (file == null)
+ throw new NullPointerException("Null file provided");
+ database = file;
+ }
+
+ /**
+ * Create a new persistent table that stores its information into the given
+ * file.
+ *
+ * @param file
+ * the file, where the table stores its information.
+ * @param coldStart
+ * if true, the existing file with this name will be erased and
+ * ignored. Otherwise, it will be assumed that the file contains the
+ * persistent table information.
+ */
+ public static Map createInstance(File file, boolean coldStart)
+ {
+ try
+ {
+ PersistentHashTable k2v;
+ if (file.exists())
+ {
+ if (coldStart)
+ {
+ file.delete();
+ k2v = new PersistentHashTable(file);
+ }
+ else
+ {
+ FileInputStream fi = new FileInputStream(file);
+ BufferedInputStream b = new BufferedInputStream(fi);
+ ObjectInputStream oin = new ObjectInputStream(b);
+
+ k2v = (PersistentHashTable) oin.readObject();
+ oin.close();
+ }
+ }
+ else
+ k2v = new PersistentHashTable(file);
+
+ k2v.ready = true;
+ return k2v;
+ }
+ catch (Exception ioex)
+ {
+ InternalError ierr = new InternalError("Unable to intialize with file "
+ + file);
+ ierr.initCause(ioex);
+ throw ierr;
+ }
+ }
+
+
+ /**
+ * Write the database content to the disk.
+ */
+ public synchronized void writeContent()
+ {
+ try
+ {
+ FileOutputStream fou = new FileOutputStream(database);
+ BufferedOutputStream b = new BufferedOutputStream(fou);
+ ObjectOutputStream oout = new ObjectOutputStream(b);
+ oout.writeObject(this);
+ oout.close();
+ }
+ catch (Exception ioex)
+ {
+ InternalError ierr = new InternalError(
+ "Failed to write database to disk: "+ database);
+ ierr.initCause(ioex);
+ throw ierr;
+ }
+ }
+
+ /**
+ * Mark the modified database as modified. The database will be written after
+ * several seconds, unless another modification occurs.
+ */
+ public void markDirty()
+ {
+ if (System.currentTimeMillis() - lastUpdated > ALWAYS_UPDATE)
+ {
+ // Force storing to disk under intensive operation.
+ writeContent();
+ lastUpdated = System.currentTimeMillis();
+ if (sheduled != null)
+ {
+ sheduled.cancel();
+ sheduled = null;
+ }
+ }
+ else
+ {
+ // Otherwise coalesce the disk database copy update events.
+ if (sheduled != null)
+ sheduled.cancel();
+ sheduled = new WriteToDiskTask();
+ timer.schedule(sheduled, SAVE_AT_MOST_AFTER);
+ }
+ }
+
+ /**
+ * Save the current database state to the disk before exit.
+ */
+ public void shutdown()
+ {
+ if (sheduled != null)
+ {
+ writeContent();
+ sheduled = null;
+ }
+ }
+
+ /**
+ * Update the memory maps and mark as should be written to the disk.
+ */
+ public Object put(Object key, Object value)
+ {
+ super.put(key, value);
+ if (ready)
+ markDirty();
+ return value;
+ }
+
+ /**
+ * Update the memory maps and mark as should be written to the disk.
+ */
+ public Object remove(Object key)
+ {
+ Object removed = super.remove(key);
+ if (ready)
+ markDirty();
+ return removed;
+ }
+
+}
diff --git a/tools/gnu/classpath/tools/rmi/REGISTRY.java b/tools/gnu/classpath/tools/rmi/REGISTRY.java
new file mode 100644
index 000000000..63f633f99
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/REGISTRY.java
@@ -0,0 +1,165 @@
+/* REGISTY.java -- RMI registry starter.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.tools.rmi;
+
+import gnu.classpath.tools.HelpPrinter;
+import gnu.classpath.tools.rmi.registry.RegistryImpl;
+import gnu.java.rmi.server.UnicastServerRef;
+
+import java.io.File;
+import java.rmi.NotBoundException;
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.rmi.server.ObjID;
+import java.rmi.server.RMIServerSocketFactory;
+import java.util.Hashtable;
+import java.util.Map;
+
+/**
+ * The optionally persistent RMI registry implementation.
+ *
+ * @author Audrius Meskauskas (audriusa@bioinformatics.org)
+ */
+public class REGISTRY
+{
+ /**
+ * The stop command.
+ */
+ public static String STOP = "gnu.classpath.tools.rmi.registry.command.STOP";
+
+ /**
+ * If true, the registry prints registration events to console.
+ */
+ public static boolean verbose = false;
+
+ /**
+ * The RMI registry implementation entry point.
+ */
+ public static void main(String[] args)
+ {
+ String HelpPath = "rmi/REGISTRY.txt";
+ HelpPrinter.checkHelpKey(args, HelpPath);
+
+ // Parse parameters:
+ String folder = ".";
+ boolean cold = false;
+ boolean trans = false;
+ boolean stop = false;
+
+ int port = Registry.REGISTRY_PORT;
+ RMIServerSocketFactory ssf = null;
+
+ for (int i = 0; i < args.length; i++)
+ {
+ String a = args[i];
+ if (a.equals("-restart"))
+ cold = true;
+ else if (a.equals("-transient"))
+ trans = true;
+ else if (a.equals("-verbose"))
+ verbose = true;
+ else if (a.equals("-stop"))
+ stop = true;
+ else if (i < args.length - 1)
+ {
+ // The additional key parameter is possible.
+ if (a.equals("-port"))
+ port = Integer.parseInt(args[++i]);
+ else if (a.equals("-folder"))
+ folder = args[++i];
+ }
+ }
+
+ if (!stop)
+ {
+ Map table;
+ if (trans)
+ table = new Hashtable();
+ else
+ {
+ // Start the system.
+ File dataFolder = new File(folder);
+ if (!dataFolder.exists())
+ dataFolder.mkdirs();
+ table = PersistentHashTable.createInstance(
+ new File(dataFolder, "rmiregistry.data"), cold);
+ }
+
+ RegistryImpl system = new RegistryImpl(table);
+
+ // We must export with the specific activation id that is only
+ // possible when going into the gnu.java.rmi
+ try
+ {
+ UnicastServerRef sref = new UnicastServerRef(
+ new ObjID(ObjID.REGISTRY_ID), port, ssf);
+
+ sref.exportObject(system);
+ System.out.println("The RMI naming service is listening at " + port);
+ }
+ catch (Exception ex)
+ {
+ System.out.println("Failed to start RMI naming service at " + port);
+ }
+ }
+ else
+ {
+ // Stop the naming service.
+ try
+ {
+ Registry r = LocateRegistry.getRegistry(port);
+ // Search for this specific line will command to stop the registry.
+
+ // Our service returns null, but any other service will thrown
+ // NotBoundException.
+ r.unbind(STOP);
+ }
+ catch (RemoteException e)
+ {
+ System.out.println("Failed to stop RMI naming service at " + port);
+ }
+ catch (NotBoundException e)
+ {
+ System.out.println("The naming service at port "+port+" is not a "+
+ REGISTRY.class.getName());
+ }
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/rmi/REGISTRY.txt b/tools/gnu/classpath/tools/rmi/REGISTRY.txt
new file mode 100644
index 000000000..7d8e19232
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/REGISTRY.txt
@@ -0,0 +1,28 @@
+The persistent RMI naming service, required for the remote method invocations
+(packages java.rmi.*, java.rmi.Registry.*).
+
+Copyright 2006 Free Software Foundation, Inc.
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+
+Usage: rmiregistry <options>
+
+ where <options> includes:
+ -port N Start the registry on the given local port. If this key
+ is not specified, the service starts on the port 1099.
+ -verbose Log binding events to stdout.
+ -stop Stop the running naming service at the given port.
+
+ -transient Start transient registry service that does not write any
+ data to the disk. Such service looses the stored bindings if
+ restarted. If this key is not specified, the
+ persistent naming service is started.
+ -restart "Cold start:, clear the persistent naming database, if any.
+ -folder Folder Store the persistent binding file in the given folder. If this
+ key is not specified, the file with persistent bindings is
+ stored into the current folder.
+
+
+
diff --git a/tools/gnu/classpath/tools/rmi/RMIC.java b/tools/gnu/classpath/tools/rmi/RMIC.java
index ffcd0db0e..c44453011 100644
--- a/tools/gnu/classpath/tools/rmi/RMIC.java
+++ b/tools/gnu/classpath/tools/rmi/RMIC.java
@@ -17,30 +17,13 @@ You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+*/
package gnu.classpath.tools.rmi;
import gnu.classpath.tools.HelpPrinter;
import gnu.classpath.tools.giop.GRMIC;
-import gnu.classpath.tools.giop.grmic.GiopRmicCompiler;
import gnu.classpath.tools.rmi.rmic.RmicCompiler;
import java.io.File;
diff --git a/tools/gnu/classpath/tools/rmi/RMID.java b/tools/gnu/classpath/tools/rmi/RMID.java
new file mode 100644
index 000000000..81d09671a
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/RMID.java
@@ -0,0 +1,189 @@
+/* RMID.java -- the RMI activation daemon.
+ Copyright (c) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath.tools.rmi;
+
+import gnu.classpath.tools.HelpPrinter;
+import gnu.classpath.tools.rmi.rmid.ActivationSystemImpl;
+import gnu.java.rmi.activation.ActivationSystemTransient;
+import gnu.java.rmi.server.UnicastServerRef;
+
+import java.io.File;
+import java.net.InetAddress;
+import java.rmi.Remote;
+import java.rmi.activation.ActivationSystem;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.rmi.server.ObjID;
+import java.rmi.server.RMIServerSocketFactory;
+
+
+/**
+ * The persistent RMI activation daemon.
+ *
+ * @author Audrius Meskauskas (audriusa@bioinformatics.org)
+ */
+public class RMID
+{
+ /**
+ * The RMI server socket factory.
+ */
+ static RMIServerSocketFactory ACTIVATION_REGISTY_SOCKET_FACTORY = null;
+
+ /**
+ * The activation registry port.
+ */
+ static int ACTIVATION_REGISTRY_PORT = ActivationSystem.SYSTEM_PORT;
+
+ /**
+ * The activation system name.
+ */
+ static String ACTIVATION_SYSTEM_NAME = "java.rmi.activation.ActivationSystem";
+
+ /**
+ * The RMI activation daemon entry point.
+ */
+ public static void main(String[] args)
+ {
+ String HelpPath = "rmi/RMID.txt";
+ HelpPrinter.checkHelpKey(args, HelpPath);
+
+ // Parse parameters:
+ boolean stop = false;
+ String folder = ".";
+ boolean cold = false;
+ boolean trans = false;
+
+ for (int i = 0; i < args.length; i++)
+ {
+ String a = args[i];
+ if (a.equals("-verbose"))
+ ActivationSystemTransient.debug = true;
+ else if (a.equals("-stop"))
+ stop = true;
+ else if (a.equals("-restart"))
+ cold = true;
+ else if (a.equals("-transient"))
+ trans = true;
+ else if (i < args.length - 1)
+ {
+ // The additional key parameter is possible.
+ if (a.equals("-port"))
+ ACTIVATION_REGISTRY_PORT = Integer.parseInt(args[++i]);
+ else if (a.equals("-folder"))
+ folder = args[++i];
+ }
+ }
+
+ try
+ {
+ if (!stop)
+ {
+ // Start the system.
+ File dataFolder = new File(folder);
+ if (!dataFolder.exists())
+ dataFolder.mkdirs();
+ ActivationSystem system;
+
+ if (trans)
+ system = ActivationSystemTransient.getInstance();
+ else
+ system = ActivationSystemImpl.getInstance(dataFolder, cold);
+
+ // We must export with the specific activation id that is only
+ // possible when going into the gnu.java.rmi.activation.
+ UnicastServerRef sref = new UnicastServerRef(
+ new ObjID(ObjID.ACTIVATOR_ID), ACTIVATION_REGISTRY_PORT,
+ ACTIVATION_REGISTY_SOCKET_FACTORY);
+ Remote systemStub = sref.exportObject(system);
+
+ // Start the naming system on the activation system port
+ // (if not already running).
+
+ Registry r;
+ try
+ {
+ // Expect the naming service running first.
+ // The local host may want to use the shared registry
+ r = LocateRegistry.getRegistry(ACTIVATION_REGISTRY_PORT);
+ r.rebind(ACTIVATION_SYSTEM_NAME, systemStub);
+ }
+ catch (Exception ex)
+ {
+ // The naming service is not running. Start it.
+ r = LocateRegistry.createRegistry(ACTIVATION_REGISTRY_PORT);
+ r.rebind(ACTIVATION_SYSTEM_NAME, systemStub);
+ }
+ String host = InetAddress.getLocalHost().getCanonicalHostName();
+ System.out.println("The RMI daemon is listening on " + host +
+ " (port "
+ + ACTIVATION_REGISTRY_PORT + ")");
+
+ }
+ else
+ {
+ // Stop the activation system.
+ Registry r;
+ try
+ {
+ System.out.print("Stopping RMI daemon at "
+ + ACTIVATION_REGISTRY_PORT+" ... ");
+ // Expect the naming service running first.
+ // The local host may want to use the shared registry
+ r = LocateRegistry.getRegistry(ACTIVATION_REGISTRY_PORT);
+ ActivationSystem asys =
+ (ActivationSystem) r.lookup(ACTIVATION_SYSTEM_NAME);
+ asys.shutdown();
+ System.out.println("OK.");
+ }
+ catch (Exception ex)
+ {
+ System.out.println("The RMI daemon seems not running at "
+ + ACTIVATION_REGISTRY_PORT);
+ if (ActivationSystemTransient.debug)
+ ex.printStackTrace();
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ System.out.println("Failed to start the RMI daemon.");
+ if (ActivationSystemTransient.debug)
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/rmi/RMID.txt b/tools/gnu/classpath/tools/rmi/RMID.txt
new file mode 100644
index 000000000..a62613fd4
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/RMID.txt
@@ -0,0 +1,30 @@
+The persistent RMI activation daemon, support RMI object activation
+(package java.rmi.activation.*).
+
+Copyright 2006 Free Software Foundation, Inc.
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+Please report bugs at http://www.gnu.org/software/classpath/bugs.html
+
+Usage: rmid <options>
+
+ where <options> includes:
+ -port N Start the service on the given local port. If this key
+ is not specified, the service starts on the port 1098.
+ -verbose Log registration events to stdout.
+ -stop Stop the running activation service at the given port.
+
+ -transient Start transient activation service that does not write any
+ data to the disk. Such service looses the stored activation
+ descriptors, if restarted. If this key is not specified, the
+ persistent naming service is started.
+ -restart "Cold start:, clear the activation descriptor database, if any.
+ -folder Folder Store the persistent descriptor file in the given folder. If this
+ key is not specified, the file with persistent activation
+ information is stored into the current folder.
+
+All activation groups are activated on the same virtual machine, where the
+daemon is running. For security reasons, all the classes, required for
+activation, must be available in the classpath of that machine.
+ \ No newline at end of file
diff --git a/tools/gnu/classpath/tools/rmi/registry/RegistryImpl.java b/tools/gnu/classpath/tools/rmi/registry/RegistryImpl.java
new file mode 100644
index 000000000..90bd3a6bd
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/registry/RegistryImpl.java
@@ -0,0 +1,139 @@
+/* RegistryImpl.java -- the RMI registry implementation
+ Copyright (c) 1996, 1997, 1998, 1999, 2002, 2005, 2006
+ Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath.tools.rmi.registry;
+
+import gnu.classpath.tools.rmi.Persistent;
+import gnu.classpath.tools.rmi.REGISTRY;
+
+import java.rmi.AccessException;
+import java.rmi.AlreadyBoundException;
+import java.rmi.NotBoundException;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.registry.Registry;
+import java.util.ArrayList;
+import java.util.Map;
+
+/**
+ * The optionally persistent registry implementation.
+ *
+ * @author Audrius Meskauskas (audriusa@bioinformatics.org)
+ */
+public class RegistryImpl implements Registry
+{
+ /**
+ * The binding table.
+ */
+ Map bindings;
+
+ /**
+ * Create the registry implementation that uses the given bidirectinal
+ * table to keep the data.
+ */
+ public RegistryImpl(Map aTable)
+ {
+ bindings = aTable;
+ }
+
+ /** @inheritDoc */
+ public Remote lookup(String name) throws RemoteException, NotBoundException,
+ AccessException
+ {
+ Object obj = bindings.get(name);
+ if (obj == null)
+ throw new NotBoundException(name);
+ return ((Remote) obj);
+ }
+
+ /** @inheritDoc */
+ public void bind(String name, Remote obj) throws RemoteException,
+ AlreadyBoundException, AccessException
+ {
+ if (REGISTRY.verbose)
+ System.out.println("Bind "+name);
+ if (bindings.containsKey(name))
+ throw new AlreadyBoundException(name);
+ bindings.put(name, obj);
+ }
+
+ /** @inheritDoc */
+ public void unbind(String name) throws RemoteException, NotBoundException,
+ AccessException
+ {
+ if (name.equals(REGISTRY.STOP))
+ {
+ if (bindings instanceof Persistent)
+ ((Persistent) bindings).writeContent();
+ // Terminate in 10 seconds.
+ System.out.println("Shutdown command received. Will terminate in 10 s");
+ Persistent.timer.schedule(new Persistent.ExitTask(), 10000);
+ }
+ else
+ {
+ if (REGISTRY.verbose)
+ System.out.println("Unbind "+name);
+
+ if (!bindings.containsKey(name))
+ throw new NotBoundException(name);
+ else
+ bindings.remove(name);
+ }
+ }
+
+ /** @inheritDoc */
+ public void rebind(String name, Remote obj) throws RemoteException,
+ AccessException
+ {
+ if (REGISTRY.verbose)
+ System.out.println("Rebind "+name);
+ bindings.put(name, obj);
+ }
+
+ /** @inheritDoc */
+ public String[] list() throws RemoteException, AccessException
+ {
+ // Create a separated array to prevent race conditions.
+ ArrayList keys = new ArrayList(bindings.keySet());
+ int n = keys.size();
+ String[] rt = new String[n];
+ for (int i = 0; i < n; i++)
+ rt[i] = (String) keys.get(i);
+ return rt;
+ }
+}
diff --git a/tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Skel.java b/tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Skel.java
new file mode 100644
index 000000000..36b7d94a5
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Skel.java
@@ -0,0 +1,278 @@
+/* RegistryImpl_Skel.java
+ Copyright (C) 2002, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.tools.rmi.registry;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.rmi.MarshalException;
+import java.rmi.Remote;
+import java.rmi.UnmarshalException;
+import java.rmi.server.Operation;
+import java.rmi.server.RemoteCall;
+import java.rmi.server.SkeletonMismatchException;
+
+/**
+ * This skeleton supports unlikely cases when the naming service is
+ * contacted from other interoperable java implementation that still uses
+ * the old style skeleton-dependent invocations.
+ */
+public final class RegistryImpl_Skel
+ implements java.rmi.server.Skeleton
+{
+ private static final long interfaceHash = 4905912898345647071L;
+
+ /**
+ * Repeated multiple times.
+ */
+ static final String EUM = "error unmarshalling arguments for Registry";
+
+ /**
+ * Repeated multiple times.
+ */
+ static final String EMR = "error marshalling return from Registry";
+
+ private static final Operation[] operations =
+ {
+ new Operation("void bind(java.lang.String, Remote"),
+ new Operation("java.lang.String[] list("),
+ new Operation("Remote lookup(java.lang.String"),
+ new Operation("void rebind(java.lang.String, Remote"),
+ new Operation("void unbind(java.lang.String")
+ };
+
+ public Operation[] getOperations()
+ {
+ return ((Operation[]) operations.clone());
+ }
+
+ public void dispatch(Remote obj, RemoteCall call,
+ int opnum, long hash) throws java.lang.Exception
+ {
+ if (opnum < 0)
+ {
+ if (hash == 7583982177005850366L)
+ opnum = 0;
+ else if (hash == 2571371476350237748L)
+ opnum = 1;
+ else if (hash == -7538657168040752697L)
+ opnum = 2;
+ else if (hash == -8381844669958460146L)
+ opnum = 3;
+ else if (hash == 7305022919901907578L)
+ opnum = 4;
+ else
+ throw new SkeletonMismatchException("interface hash mismatch");
+ }
+ else if (hash != interfaceHash)
+ throw new SkeletonMismatchException("interface hash mismatch");
+
+ RegistryImpl server = (RegistryImpl) obj;
+ switch (opnum)
+ {
+ case 0:
+ {
+ java.lang.String $param_0;
+ Remote $param_1;
+ try
+ {
+ ObjectInput in = call.getInputStream();
+ $param_0 = (java.lang.String) in.readObject();
+ $param_1 = (Remote) in.readObject();
+
+ }
+ catch (IOException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ catch (java.lang.ClassCastException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ finally
+ {
+ call.releaseInputStream();
+ }
+ server.bind($param_0, $param_1);
+ try
+ {
+ ObjectOutput out = call.getResultStream(true);
+ }
+ catch (IOException e)
+ {
+ throw new MarshalException(EMR, e);
+ }
+ break;
+ }
+
+ case 1:
+ {
+ try
+ {
+ ObjectInput in = call.getInputStream();
+
+ }
+ catch (IOException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ finally
+ {
+ call.releaseInputStream();
+ }
+ java.lang.String[] $result = server.list();
+ try
+ {
+ ObjectOutput out = call.getResultStream(true);
+ out.writeObject($result);
+ }
+ catch (IOException e)
+ {
+ throw new MarshalException(EMR, e);
+ }
+ break;
+ }
+
+ case 2:
+ {
+ java.lang.String $param_0;
+ try
+ {
+ ObjectInput in = call.getInputStream();
+ $param_0 = (java.lang.String) in.readObject();
+
+ }
+ catch (IOException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ catch (java.lang.ClassCastException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ finally
+ {
+ call.releaseInputStream();
+ }
+ Remote $result = server.lookup($param_0);
+ try
+ {
+ ObjectOutput out = call.getResultStream(true);
+ out.writeObject($result);
+ }
+ catch (IOException e)
+ {
+ throw new MarshalException(EMR, e);
+ }
+ break;
+ }
+
+ case 3:
+ {
+ java.lang.String $param_0;
+ Remote $param_1;
+ try
+ {
+ ObjectInput in = call.getInputStream();
+ $param_0 = (java.lang.String) in.readObject();
+ $param_1 = (Remote) in.readObject();
+
+ }
+ catch (IOException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ catch (java.lang.ClassCastException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ finally
+ {
+ call.releaseInputStream();
+ }
+ server.rebind($param_0, $param_1);
+ try
+ {
+ ObjectOutput out = call.getResultStream(true);
+ }
+ catch (IOException e)
+ {
+ throw new MarshalException(EMR, e);
+ }
+ break;
+ }
+
+ case 4:
+ {
+ java.lang.String $param_0;
+ try
+ {
+ ObjectInput in = call.getInputStream();
+ $param_0 = (java.lang.String) in.readObject();
+
+ }
+ catch (IOException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ catch (java.lang.ClassCastException e)
+ {
+ throw new UnmarshalException(EUM, e);
+ }
+ finally
+ {
+ call.releaseInputStream();
+ }
+ server.unbind($param_0);
+ try
+ {
+ ObjectOutput out = call.getResultStream(true);
+ }
+ catch (IOException e)
+ {
+ throw new MarshalException(EMR, e);
+ }
+ break;
+ }
+
+ default:
+ throw new UnmarshalException("invalid method number");
+ }
+ }
+}
diff --git a/tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Stub.java b/tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Stub.java
new file mode 100644
index 000000000..d8cac5bfc
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/registry/RegistryImpl_Stub.java
@@ -0,0 +1,263 @@
+/* RegistryImpl_Stub.java -- Registry stub.
+ Copyright (c) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath.tools.rmi.registry;
+
+import java.rmi.AccessException;
+import java.rmi.AlreadyBoundException;
+import java.rmi.NotBoundException;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.registry.Registry;
+
+import java.lang.reflect.Method;
+import java.rmi.server.RemoteRef;
+import java.rmi.server.RemoteStub;
+import java.rmi.UnexpectedException;
+
+/**
+ * This class delegates its method calls to the remote RMI object, referenced
+ * by {@link RemoteRef}.
+ *
+ * It is normally generated with rmic.
+ */
+public final class RegistryImpl_Stub
+ extends RemoteStub
+ implements Registry
+{
+ /**
+ * Use serialVersionUID for interoperability
+ */
+ private static final long serialVersionUID = 3;
+
+ /**
+ * The explaining message for {@ling UnexpectedException}.
+ */
+ private static final String exception_message =
+ "undeclared checked exception";
+
+ /* All remote methods, invoked by this stub: */
+ private static final Method met_list;
+ private static final Method met_rebind;
+ private static final Method met_unbind;
+ private static final Method met_lookup;
+ private static final Method met_bind;
+ private static final Object[] NO_ARGS = new Object[0];
+ static
+ {
+ final Class[] NO_ARGSc = new Class[0];
+ try
+ {
+ met_list =
+ Registry.class.getMethod("list", NO_ARGSc);
+ met_rebind =
+ Registry.class.getMethod("rebind", new Class[]
+ {
+ String.class, Remote.class
+ });
+ met_unbind =
+ Registry.class.getMethod("unbind", new Class[]
+ {
+ String.class
+ });
+ met_lookup =
+ Registry.class.getMethod("lookup", new Class[]
+ {
+ String.class
+ });
+ met_bind =
+ Registry.class.getMethod("bind", new Class[]
+ {
+ String.class, Remote.class
+ });
+
+ }
+ catch (NoSuchMethodException nex)
+ {
+ NoSuchMethodError err = new NoSuchMethodError(
+ "RegistryImpl_Stub class initialization failed");
+ err.initCause(nex);
+ throw err;
+ }
+ }
+
+ /**
+ * Create the instance for _RegistryImpl_Stub that forwards method calls to the
+ * remote object.
+ *
+ * @para the reference to the remote object.
+ */
+ public RegistryImpl_Stub(RemoteRef reference)
+ {
+ super(reference);
+ }
+
+ /* Methods */
+ /** @inheritDoc */
+ public String [] list()
+ throws RemoteException, AccessException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_list,
+ NO_ARGS,
+ 2571371476350237748L);
+ return (String []) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void rebind(String p0, Remote p1)
+ throws RemoteException, AccessException
+ {
+ try
+ {
+ ref.invoke(this, met_rebind,
+ new Object[] {p0, p1},
+ -8381844669958460146L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void unbind(String p0)
+ throws RemoteException, NotBoundException, AccessException
+ {
+ try
+ {
+ ref.invoke(this, met_unbind,
+ new Object[] {p0},
+ 7305022919901907578L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public Remote lookup(String p0)
+ throws RemoteException, NotBoundException, AccessException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_lookup,
+ new Object[] {p0},
+ -7538657168040752697L);
+ return (Remote) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void bind(String p0, Remote p1)
+ throws RemoteException, AlreadyBoundException, AccessException
+ {
+ try
+ {
+ ref.invoke(this, met_bind,
+ new Object[] {p0, p1},
+ 7583982177005850366L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+
+}
diff --git a/tools/gnu/classpath/tools/rmi/registry/package.html b/tools/gnu/classpath/tools/rmi/registry/package.html
new file mode 100644
index 000000000..71df83b61
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/registry/package.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in gnu.java.rmi.registry package.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - gnu.classpath.tools.rmi.registry</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
diff --git a/tools/gnu/classpath/tools/rmi/rmic/RmiMethodGenerator.java b/tools/gnu/classpath/tools/rmi/rmic/RmiMethodGenerator.java
index 9b7f9358b..8da486571 100644
--- a/tools/gnu/classpath/tools/rmi/rmic/RmiMethodGenerator.java
+++ b/tools/gnu/classpath/tools/rmi/rmic/RmiMethodGenerator.java
@@ -22,18 +22,7 @@
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
-
- As a special exception, the copyright holders of this library give you
- permission to link this library with independent modules to produce an
- executable, regardless of the license terms of these independent
- modules, and to copy and distribute the resulting executable under
- terms of your choice, provided that you also meet, for each linked
- independent module, the terms and conditions of the license of that
- module. An independent module is a module which is not derived from
- or based on this library. If you modify this library, you may extend
- this exception to your version of the library, but you are not
- obligated to do so. If you do not wish to do so, delete this
- exception statement from your version. */
+*/
package gnu.classpath.tools.rmi.rmic;
@@ -43,7 +32,6 @@ import gnu.java.rmi.server.RMIHashes;
import java.lang.reflect.Method;
import java.util.Properties;
-import java.util.zip.Adler32;
/**
* Keeps information about the single method and generates the code fragments,
diff --git a/tools/gnu/classpath/tools/rmi/rmic/RmicCompiler.java b/tools/gnu/classpath/tools/rmi/rmic/RmicCompiler.java
index 498dff7b2..bc51aad38 100644
--- a/tools/gnu/classpath/tools/rmi/rmic/RmicCompiler.java
+++ b/tools/gnu/classpath/tools/rmi/rmic/RmicCompiler.java
@@ -22,18 +22,7 @@ Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+*/
package gnu.classpath.tools.rmi.rmic;
diff --git a/tools/gnu/classpath/tools/rmi/rmic/WrapUnWrapper.java b/tools/gnu/classpath/tools/rmi/rmic/WrapUnWrapper.java
index 6451a7074..8ee4fa5f2 100644
--- a/tools/gnu/classpath/tools/rmi/rmic/WrapUnWrapper.java
+++ b/tools/gnu/classpath/tools/rmi/rmic/WrapUnWrapper.java
@@ -17,28 +17,11 @@ You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
+*/
package gnu.classpath.tools.rmi.rmic;
-import java.lang.reflect.Method;
public class WrapUnWrapper
{
diff --git a/tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12Method.jav b/tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12Method.jav
index 1069884b9..9aaf8f5ad 100644
--- a/tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12Method.jav
+++ b/tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12Method.jav
@@ -19,7 +19,7 @@
catch (Exception e)
{
UnexpectedException uex = new UnexpectedException(exception_message);
- uex.initCause(e);
+ uex.detail = e;
throw uex;
}
}
diff --git a/tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12MethodVoid.jav b/tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12MethodVoid.jav
index f67098a4f..860a93c84 100644
--- a/tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12MethodVoid.jav
+++ b/tools/gnu/classpath/tools/rmi/rmic/templates/Stub_12MethodVoid.jav
@@ -18,7 +18,7 @@
catch (Exception e)
{
UnexpectedException uex = new UnexpectedException(exception_message);
- uex.initCause(e);
+ uex.detail = e;
throw uex;
}
}
diff --git a/tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl.java b/tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl.java
new file mode 100644
index 000000000..dda40b06c
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl.java
@@ -0,0 +1,244 @@
+/* ActivationSystemImpl.java -- implementation of the activation system.
+ Copyright (c) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath.tools.rmi.rmid;
+
+import gnu.classpath.tools.rmi.Persistent;
+import gnu.classpath.tools.rmi.PersistentBidiHashTable;
+import gnu.java.rmi.activation.ActivationSystemTransient;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.rmi.MarshalledObject;
+import java.rmi.RemoteException;
+import java.rmi.activation.ActivationDesc;
+import java.rmi.activation.ActivationException;
+import java.rmi.activation.ActivationGroupDesc;
+import java.rmi.activation.ActivationGroupID;
+import java.rmi.activation.ActivationID;
+import java.rmi.activation.ActivationInstantiator;
+import java.rmi.activation.ActivationMonitor;
+import java.rmi.activation.ActivationSystem;
+import java.rmi.activation.Activator;
+import java.rmi.activation.UnknownGroupException;
+import java.rmi.activation.UnknownObjectException;
+
+/**
+ * Implements the rmid activation system.
+ *
+ * @author Audrius Meskauskas (audriusa@bioinformatics.org)
+ */
+public class ActivationSystemImpl extends ActivationSystemTransient implements
+ ActivationSystem, Activator, ActivationMonitor, Serializable
+{
+ /**
+ * Use for interoperability.
+ */
+ private static final long serialVersionUID = 1;
+
+ /**
+ * The singleton instance of this class.
+ */
+ public static ActivationSystemImpl singleton2;
+
+ /**
+ * Obtain the singleton instance of this class.
+ *
+ * @param folder the folder, where the activation system will keep its files.
+ * @param cold do the cold start if true, hot (usual) if false.
+ */
+ public static ActivationSystem getInstance(File folder, boolean cold)
+ {
+ if (singleton2 == null)
+ singleton2 = new ActivationSystemImpl(folder, cold);
+ return singleton2;
+ }
+
+ /**
+ * Creates the group with transient maps.
+ *
+ * @param folder
+ * the folder, where the activation system will keep its files.
+ * @param cold
+ * do the cold start if true, hot (usual) if false.
+ */
+ protected ActivationSystemImpl(File folder, boolean cold)
+ {
+ super(new PersistentBidiHashTable(), new PersistentBidiHashTable());
+ singleton2 = this;
+ ((PersistentBidiHashTable) groupDescs).init(
+ new File(folder, "asi_objects.data"), cold);
+ ((PersistentBidiHashTable) descriptions).init(
+ new File(folder, "asi_groups.data"), cold);
+ }
+
+ /** @inheritDoc */
+ public MarshalledObject activate(ActivationID id, boolean force)
+ throws ActivationException, UnknownObjectException, RemoteException
+ {
+ return super.activate(id, force);
+ }
+
+ /** @inheritDoc */
+ public ActivationMonitor activeGroup(ActivationGroupID id,
+ ActivationInstantiator group,
+ long incarnation)
+ throws UnknownGroupException, ActivationException, RemoteException
+ {
+ return super.activeGroup(id, group, incarnation);
+ }
+
+ /** @inheritDoc */
+ public void activeObject(ActivationID id, MarshalledObject obj)
+ throws UnknownObjectException, RemoteException
+ {
+ super.activeObject(id, obj);
+ }
+
+ /** @inheritDoc */
+ public ActivationDesc getActivationDesc(ActivationID id)
+ throws ActivationException, UnknownObjectException, RemoteException
+ {
+ return super.getActivationDesc(id);
+ }
+
+ public ActivationGroupDesc getActivationGroupDesc(ActivationGroupID groupId)
+ throws ActivationException, UnknownGroupException, RemoteException
+ {
+ return super.getActivationGroupDesc(groupId);
+ }
+
+ /** @inheritDoc */
+ public void inactiveGroup(ActivationGroupID groupId, long incarnation)
+ throws UnknownGroupException, RemoteException
+ {
+ super.inactiveGroup(groupId, incarnation);
+ }
+
+ /** @inheritDoc */
+ public void inactiveObject(ActivationID id) throws UnknownObjectException,
+ RemoteException
+ {
+ super.inactiveObject(id);
+ }
+
+ /** @inheritDoc */
+ public ActivationGroupID registerGroup(ActivationGroupDesc groupDesc)
+ throws ActivationException, RemoteException
+ {
+ return super.registerGroup(groupDesc);
+ }
+
+ /** @inheritDoc */
+ public ActivationID registerObject(ActivationDesc desc)
+ throws ActivationException, UnknownGroupException, RemoteException
+ {
+ return super.registerObject(desc);
+ }
+
+ /** @inheritDoc */
+ public ActivationDesc setActivationDesc(ActivationID id, ActivationDesc desc)
+ throws ActivationException, UnknownObjectException,
+ UnknownGroupException, RemoteException
+ {
+ return super.setActivationDesc(id, desc);
+ }
+
+ /** @inheritDoc */
+ public ActivationGroupDesc setActivationGroupDesc(
+ ActivationGroupID groupId, ActivationGroupDesc groupDesc)
+ throws ActivationException, UnknownGroupException, RemoteException
+ {
+ return super.setActivationGroupDesc(groupId, groupDesc);
+ }
+
+ /**
+ * This method saves the state of the activation system and then
+ * terminates in 10 seconds.
+ */
+ public void shutdown() throws RemoteException
+ {
+ super.shutdown();
+ System.out.println("Shutdown command received. Will terminate in 10 s");
+ Persistent.timer.schedule(new Persistent.ExitTask(), 10000);
+ }
+
+ /** @inheritDoc */
+ public void unregisterGroup(ActivationGroupID groupId)
+ throws ActivationException, UnknownGroupException, RemoteException
+ {
+ super.unregisterGroup(groupId);
+ }
+
+ /** @inheritDoc */
+ public void unregisterObject(ActivationID id) throws ActivationException,
+ UnknownObjectException, RemoteException
+ {
+ super.unregisterObject(id);
+ }
+
+ /**
+ * Read the object from the input stream.
+ *
+ * @param in the stream to read from
+ *
+ * @throws IOException if thrown by the stream
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream in) throws IOException,
+ ClassNotFoundException
+ {
+ // Read no fields.
+ }
+
+ /**
+ * Write the object to the output stream.
+ *
+ * @param out the stream to write int
+ * @throws IOException if thrown by the stream
+ * @throws ClassNotFoundException
+ */
+ private void writeObject(ObjectOutputStream out) throws IOException,
+ ClassNotFoundException
+ {
+ // Write no fields.
+ };
+
+}
diff --git a/tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl_Stub.java b/tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl_Stub.java
new file mode 100644
index 000000000..22fa10e4b
--- /dev/null
+++ b/tools/gnu/classpath/tools/rmi/rmid/ActivationSystemImpl_Stub.java
@@ -0,0 +1,556 @@
+/* ActivationSystemImpl.java -- implementation of the activation system.
+ Copyright (c) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.classpath.tools.rmi.rmid;
+
+import java.rmi.MarshalledObject;
+import java.rmi.RemoteException;
+import java.rmi.activation.ActivationDesc;
+import java.rmi.activation.ActivationException;
+import java.rmi.activation.ActivationGroupDesc;
+import java.rmi.activation.ActivationGroupID;
+import java.rmi.activation.ActivationID;
+import java.rmi.activation.ActivationInstantiator;
+import java.rmi.activation.ActivationMonitor;
+import java.rmi.activation.ActivationSystem;
+import java.rmi.activation.Activator;
+import java.rmi.activation.UnknownGroupException;
+import java.rmi.activation.UnknownObjectException;
+
+import java.lang.reflect.Method;
+import java.rmi.server.RemoteRef;
+import java.rmi.server.RemoteStub;
+import java.rmi.UnexpectedException;
+
+/**
+ * This class delegates its method calls to the remote RMI object, referenced
+ * by {@link RemoteRef}.
+ *
+ * It is normally generated with rmic.
+ */
+public final class ActivationSystemImpl_Stub
+ extends RemoteStub
+ implements ActivationMonitor, Activator, ActivationSystem
+{
+ /**
+ * Use serialVersionUID for interoperability
+ */
+ private static final long serialVersionUID = 2;
+
+ /**
+ * The explaining message for {@ling UnexpectedException}.
+ */
+ private static final String exception_message =
+ "undeclared checked exception";
+
+ /* All remote methods, invoked by this stub: */
+ private static final Method met_setActivationGroupDesc;
+ private static final Method met_inactiveGroup;
+ private static final Method met_unregisterObject;
+ private static final Method met_getActivationDesc;
+ private static final Method met_setActivationDesc;
+ private static final Method met_shutdown;
+ private static final Method met_activate;
+ private static final Method met_activeGroup;
+ private static final Method met_registerGroup;
+ private static final Method met_getActivationGroupDesc;
+ private static final Method met_activeObject;
+ private static final Method met_registerObject;
+ private static final Method met_inactiveObject;
+ private static final Method met_unregisterGroup;
+ private static final Object[] NO_ARGS = new Object[0];
+ static
+ {
+ final Class[] NO_ARGSc = new Class[0];
+ try
+ {
+ met_setActivationGroupDesc =
+ ActivationSystem.class.getMethod("setActivationGroupDesc", new Class[]
+ {
+ ActivationGroupID.class, ActivationGroupDesc.class
+ });
+ met_inactiveGroup =
+ ActivationMonitor.class.getMethod("inactiveGroup", new Class[]
+ {
+ ActivationGroupID.class, long.class
+ });
+ met_unregisterObject =
+ ActivationSystem.class.getMethod("unregisterObject", new Class[]
+ {
+ ActivationID.class
+ });
+ met_getActivationDesc =
+ ActivationSystem.class.getMethod("getActivationDesc", new Class[]
+ {
+ ActivationID.class
+ });
+ met_setActivationDesc =
+ ActivationSystem.class.getMethod("setActivationDesc", new Class[]
+ {
+ ActivationID.class, ActivationDesc.class
+ });
+ met_shutdown =
+ ActivationSystem.class.getMethod("shutdown", NO_ARGSc);
+ met_activate =
+ Activator.class.getMethod("activate", new Class[]
+ {
+ ActivationID.class, boolean.class
+ });
+ met_activeGroup =
+ ActivationSystem.class.getMethod("activeGroup", new Class[]
+ {
+ ActivationGroupID.class, ActivationInstantiator.class, long.class
+ });
+ met_registerGroup =
+ ActivationSystem.class.getMethod("registerGroup", new Class[]
+ {
+ ActivationGroupDesc.class
+ });
+ met_getActivationGroupDesc =
+ ActivationSystem.class.getMethod("getActivationGroupDesc", new Class[]
+ {
+ ActivationGroupID.class
+ });
+ met_activeObject =
+ ActivationMonitor.class.getMethod("activeObject", new Class[]
+ {
+ ActivationID.class, MarshalledObject.class
+ });
+ met_registerObject =
+ ActivationSystem.class.getMethod("registerObject", new Class[]
+ {
+ ActivationDesc.class
+ });
+ met_inactiveObject =
+ ActivationMonitor.class.getMethod("inactiveObject", new Class[]
+ {
+ ActivationID.class
+ });
+ met_unregisterGroup =
+ ActivationSystem.class.getMethod("unregisterGroup", new Class[]
+ {
+ ActivationGroupID.class
+ });
+
+ }
+ catch (NoSuchMethodException nex)
+ {
+ NoSuchMethodError err = new NoSuchMethodError(
+ "ActivationSystemImpl_Stub class initialization failed");
+ err.initCause(nex);
+ throw err;
+ }
+ }
+
+ /**
+ * Create the instance for _ActivationSystemImpl_Stub that forwards method calls to the
+ * remote object.
+ *
+ * @para the reference to the remote object.
+ */
+ public ActivationSystemImpl_Stub(RemoteRef reference)
+ {
+ super(reference);
+ }
+
+ /* Methods */
+ /** @inheritDoc */
+ public ActivationGroupDesc setActivationGroupDesc(ActivationGroupID p0,
+ ActivationGroupDesc p1)
+ throws ActivationException, UnknownGroupException, RemoteException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_setActivationGroupDesc,
+ new Object[] { p0, p1 },
+ 1213918527826541191L);
+ return (ActivationGroupDesc) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void inactiveGroup(ActivationGroupID p0, long p1)
+ throws UnknownGroupException, RemoteException
+ {
+ try
+ {
+ ref.invoke(this, met_inactiveGroup, new Object[] { p0, new Long(p1) },
+ -399287892768650944L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void unregisterObject(ActivationID p0) throws ActivationException,
+ UnknownObjectException, RemoteException
+ {
+ try
+ {
+ ref.invoke(this, met_unregisterObject, new Object[] { p0 },
+ -6843850585331411084L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public ActivationDesc getActivationDesc(ActivationID p0)
+ throws ActivationException, UnknownObjectException, RemoteException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_getActivationDesc,
+ new Object[] { p0 }, 4830055440982622087L);
+ return (ActivationDesc) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public ActivationDesc setActivationDesc(ActivationID p0, ActivationDesc p1)
+ throws ActivationException, UnknownObjectException,
+ UnknownGroupException, RemoteException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_setActivationDesc,
+ new Object[] { p0, p1 },
+ 7128043237057180796L);
+ return (ActivationDesc) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void shutdown() throws RemoteException
+ {
+ try
+ {
+ ref.invoke(this, met_shutdown, NO_ARGS, -7207851917985848402L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public MarshalledObject activate(ActivationID p0, boolean p1)
+ throws ActivationException, UnknownObjectException, RemoteException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_activate,
+ new Object[] { p0, new Boolean(p1) },
+ -8767355154875805558L);
+ return (MarshalledObject) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public ActivationMonitor activeGroup(ActivationGroupID p0,
+ ActivationInstantiator p1, long p2)
+ throws UnknownGroupException, ActivationException, RemoteException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_activeGroup,
+ new Object[] { p0, p1, new Long(p2) },
+ -4575843150759415294L);
+ return (ActivationMonitor) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public ActivationGroupID registerGroup(ActivationGroupDesc p0)
+ throws ActivationException, RemoteException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_registerGroup,
+ new Object[] { p0 }, 6921515268192657754L);
+ return (ActivationGroupID) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public ActivationGroupDesc getActivationGroupDesc(ActivationGroupID p0)
+ throws ActivationException, UnknownGroupException, RemoteException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_getActivationGroupDesc,
+ new Object[] { p0 }, -8701843806548736528L);
+ return (ActivationGroupDesc) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void activeObject(ActivationID p0, MarshalledObject p1)
+ throws UnknownObjectException, RemoteException
+ {
+ try
+ {
+ ref.invoke(this, met_activeObject, new Object[] { p0, p1 },
+ 2543984342209939736L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public ActivationID registerObject(ActivationDesc p0)
+ throws ActivationException, UnknownGroupException, RemoteException
+ {
+ try
+ {
+ Object result = ref.invoke(this, met_registerObject,
+ new Object[] { p0 }, -3006759798994351347L);
+ return (ActivationID) result;
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void inactiveObject(ActivationID p0) throws UnknownObjectException,
+ RemoteException
+ {
+ try
+ {
+ ref.invoke(this, met_inactiveObject, new Object[] { p0 },
+ -4165404120701281807L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+ /** @inheritDoc */
+ public void unregisterGroup(ActivationGroupID p0) throws ActivationException,
+ UnknownGroupException, RemoteException
+ {
+ try
+ {
+ ref.invoke(this, met_unregisterGroup, new Object[] { p0 },
+ 3768097077835970701L);
+ }
+ catch (RuntimeException e)
+ {
+ throw e;
+ }
+ catch (RemoteException e)
+ {
+ throw e;
+ }
+ catch (Exception e)
+ {
+ UnexpectedException uex = new UnexpectedException(exception_message);
+ uex.detail = e;
+ throw uex;
+ }
+ }
+
+
+}
diff --git a/tools/jarsigner.sh.in b/tools/jarsigner.sh.in
new file mode 100644
index 000000000..ced5c8cd0
--- /dev/null
+++ b/tools/jarsigner.sh.in
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+## Copyright 2006 Free Software Foundation, Inc.
+##
+## This file is a part of GNU Classpath.
+##
+## GNU Classpath is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or (at
+## your option) any later version.
+##
+## GNU Classpath is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with GNU Classpath; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+## USA.
+##
+##
+## A simple shell script to launch the GNU Classpath jarsigner tool.
+##
+
+prefix=@prefix@
+tools_dir=@datadir@/@PACKAGE@
+tools_cp=${tools_dir}/tools.zip
+
+# find the java executable...
+if [ -z "${JAVA}" ] ; then
+ if [ -n "${JAVA_HOME}" ] ; then
+ if [ -x "${JAVA_HOME}/jre/sh/java" ] ; then
+ JAVA="${JAVA_HOME}/jre/sh/java"
+ else
+ JAVA="${JAVA_HOME}/bin/java"
+ fi
+ else
+ JAVA=`which java 2> /dev/null `
+ if [ -z "${JAVA}" ] ; then
+ JAVA=java
+ fi
+ fi
+fi
+
+exec "${JAVA}" -cp "${tools_cp}" gnu.classpath.tools.jarsigner.Main $@