securityEnv = new SFSecurityEnvironmentImpl();
securityEnv = new SFSecurityEnvironmentImpl(null);
    synchronized public static void initSecurity()        throws SFGeneralSecurityException {        try {            if (alreadyInit == false) {                // Add the new RMIClassLoaderSpi                System.setProperty("java.rmi.server.RMIClassLoaderSpi",                    "org.smartfrog.sfcore.security." + "SFRMIClassLoaderSpi");                SFSecurityProperties.readSecurityProperties();                if (Boolean.getBoolean(SFSecurityProperties.propSecurityOn)) {                    // Activate the real security manager.                    System.setSecurityManager(new SecurityManager());                    // Add JSSE sun provider. Need to make this more sun independent..                    /* Already included in JDK1.4                       Security.addProvider(                                       new com.sun.net.ssl.internal.ssl.Provider());                     */                    securityEnv = new SFSecurityEnvironmentImpl();                    /*Make sure that we restrict downloading of stubs/RMIClientFactory                       Note that this only works if this is called before RMI                       classes are loaded... */                    /* Not needed after using SFRMIClassLoaderSpi                       System.setProperty(SFSecurityProperties.propUseCodebaseOnly,"true");                     */                    /* Set the java.rmi.server.codebase to the value of                       org.smartfrog.codebase unless it was explicitly set. This                       allow us to respect propUseCodebaseOnly by just setting the                       SF codebase. */                    /* No longer can rely on  java.rmi.server.codebase because                       it is *static*                       if (SFClassLoader.getTargetClassBase() != null) {                         String currentCodebase =                           System.getProperty("java.rmi.server.codebase");                         if (currentCodebase == null) {                           System.setProperty("java.rmi.server.codebase",                                              SFClassLoader.getTargetClassBase());                         } else if (!(currentCodebase.equals(SFClassLoader.                                                             getTargetClassBase()))) {                           System.out.println("WARNING: java.rmi.server.codebase "+                                              "already set to " + currentCodebase +                                               " that is different to  " +                                              "org.smartfrog.codebase set to " +                                              SFClassLoader.getTargetClassBase());                         }                       }                       //Make objectIDs difficult to guess.                       System.setProperty(SFSecurityProperties.propRandomIDs,"true");                       /* Activate a safe default RMISocketFactory. This could be                          modified by the one in the object reference, provided that                          its class can be found in our codebase. For this reason,                          we have to be *very* careful on what RMIClientSocketFactory                          classes are available in our codebase...*/                    RMISocketFactory.setSocketFactory(securityEnv.getRMISocketFactory());                    securityOn = true;                } else {                    // Activate a security manager that allows everything.                    System.setSecurityManager(new DummySecurityManager());                    securityOn = false;                    //Notification moved to SFSyten after the ini file is read.                }            }        } catch (IOException e) {            // Problems setting up RMI.            throw new SFGeneralSecurityException(e.getMessage());        }    }