Java 8 RMISecurityManager - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 RMISecurityManager class.

This code example shows how to use the following methods:
    } 
     
    public static JavaSpace findSpace(String url, String spaceName) throws Exception {
 
        if (System.getSecurityManager() == null) {
            System.setSecurityManager(new RMISecurityManager());
        } 
 
        Class<?>[] classes = new Class<?>[] {net.jini.space.JavaSpace.class};
        Name sn = new Name(spaceName);
        ServiceTemplate tmpl = new ServiceTemplate(null/* serviceID */, classes, new Entry[] {sn});
 
        LookupLocator locator = new LookupLocator(url); // <protocol>://<hostname>
        ServiceRegistrar sr = locator.getRegistrar();
        JavaSpace space = (JavaSpace) sr.lookup(tmpl);
 
        return space;
    } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        return tCreated;
    } 
 
    private TransactionManager findTransactionManager(String uri) throws IOException, ClassNotFoundException {
        if (System.getSecurityManager() == null) {
            System.setSecurityManager(new RMISecurityManager());
        } 
 
        // Creating service template to find transaction manager service by matching fields. 
        Class<?>[] classes = new Class<?>[] {net.jini.core.transaction.server.TransactionManager.class};
        // Name sn = new Name("*"); 
        ServiceTemplate tmpl = new ServiceTemplate(null, classes, new Entry[] {});
 
        // Creating a lookup locator 
        LookupLocator locator = new LookupLocator(uri);
        ServiceRegistrar sr = locator.getRegistrar();
 
        TransactionManager tm = (TransactionManager) sr.lookup(tmpl);
        return tm;
    } 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    public static void main(String[] args) {
 
        System.err.println("\nRegression test for bug 4180392\n");
 
        System.err.println("Setting RMISecurityManager.");
        System.setSecurityManager(new RMISecurityManager());
 
        try { 
            System.err.println("Attempting to acquire restricted class " +
                restrictedClassName);
            Class restrictedClass = Class.forName(restrictedClassName);
            throw new RuntimeException(
                "TEST FAILED: successfully acquired restricted class " + 
                    restrictedClass);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(
                "TEST FAILED: couldn't find (but was allowed to look for) " + 
                    "restricted class " + restrictedClassName);
        } catch (SecurityException e) {
            System.err.println("TEST PASSED: ");
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 
    private String serverClassName = null;
 
    protected long pollingFrequency = 1000L;
 
    private SecurityManager securityManager = new RMISecurityManager();
     
    public RmiConnector(MuleContext context)
    { 
        super(context);
    } 
 
    @Override 
    protected void doInitialise() throws InitialisationException 
    { 
 
        if (securityPolicy != null)
        { 
            System.setProperty("java.security.policy", securityPolicy);
        } 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        /* As of 1.4, it is too late to set the security policy 
         * file at this point so these line have been commented out. 
         */ 
        //System.setProperty("java.security.policy", 
        //      Main.class.getResource("/bench/rmi/policy.all").toString()); 
        System.setSecurityManager(new RMISecurityManager());
    } 
 
    /** 
     * Set up configuration file and report streams, if not set already. 
     */ 
    static void setupStreams() { 
        if (repstr == null)
            repstr = System.out;
        if (confstr == null)
            confstr = (new Main()).getClass().getResourceAsStream(CONFFILE);
        if (confstr == null)
            die("Error: unable to find default config file"); 
    } 
 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 
		try { 
			Resource policy = new ClassPathResource("policy");
			System.out.println("policy is " + policy);
			System.setProperty("java.security.policy", policy.getFile().getAbsolutePath());
			System.setSecurityManager(new RMISecurityManager());
			System.setSecurityManager(null);
		} 
		finally { 
			System.setSecurityManager(securityManager);
		} 
	} 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    public static void main(String[] args) {
 
        System.err.println("\nRegression test for bug 4180392\n");
 
        System.err.println("Setting RMISecurityManager.");
        System.setSecurityManager(new RMISecurityManager());
 
        try { 
            System.err.println("Attempting to acquire restricted class " +
                restrictedClassName);
            Class restrictedClass = Class.forName(restrictedClassName);
            throw new RuntimeException(
                "TEST FAILED: successfully acquired restricted class " + 
                    restrictedClass);
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(
                "TEST FAILED: couldn't find (but was allowed to look for) " + 
                    "restricted class " + restrictedClassName);
        } catch (SecurityException e) {
            System.err.println("TEST PASSED: ");
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    } 
 
    public static void main(final String[] args)
        throws RemoteException, MalformedURLException {
        if (null == System.getSecurityManager() ) {
            System.setSecurityManager(new RMISecurityManager());
        } 
 
        final EchoServer server = new EchoServer();
        Naming.rebind(ADDRESS, server);
    } 
} 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        /* As of 1.4, it is too late to set the security policy 
         * file at this point so these line have been commented out. 
         */ 
        //System.setProperty("java.security.policy", 
        //      Main.class.getResource("/bench/rmi/policy.all").toString()); 
        System.setSecurityManager(new RMISecurityManager());
    } 
 
    /** 
     * Set up configuration file and report streams, if not set already. 
     */ 
    static void setupStreams() { 
        if (repstr == null)
            repstr = System.out;
        if (confstr == null)
            confstr = (new Main()).getClass().getResourceAsStream(CONFFILE);
        if (confstr == null)
            die("Error: unable to find default config file"); 
    } 
 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    public static RMIConnection createConnection() {
        RMISessionBrokerServerManager serverManager = null;
 
        // Set the client security manager 
        try { 
            System.setSecurityManager(new RMISecurityManager());
        } catch (Exception exception) {
            System.out.println("Security violation " + exception.toString());
        } 
 
        // Get the remote factory object from the Registry 
        try { 
            serverManager = (RMISessionBrokerServerManager)Naming.lookup("SERVER-BROKER-MANAGER");
        } catch (Exception exception) {
            throw new TestProblemException(exception.toString());
        } 
 
        RMIConnection rmiConnection = null;
        try { 
            rmiConnection = new RMIConnection(serverManager.createRemoteSessionController());
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 RMISecurityManager Methods: