/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package socius.telas.util; import java.rmi.Naming; import socius.autenticacao.AutenticacaoRemota; import socius.modelo.Usuario; import socius.util.ConfigSistema; /** * * @author lucas */ public class CadastroHandler { public boolean enviarServidor(Usuario u) { try { int porta = Integer.parseInt( ConfigSistema.getProperty("servidor.porta_escuta") ); System.setProperty( "java.rmi.server.hostname", ConfigSistema.getProperty("cliente.ip_servidor") ); StringBuilder urlRMI = new StringBuilder(); urlRMI.append("rmi://"); urlRMI.append(ConfigSistema.getProperty("cliente.ip_servidor")); urlRMI.append(":"); urlRMI.append(ConfigSistema.getProperty("cliente.porta_servidor")); urlRMI.append("/"); urlRMI.append(ConfigSistema.getProperty("cliente.servico_servidor")); // Tenta conexão com servidor AutenticacaoRemota auth = (AutenticacaoRemota) Naming.lookup(urlRMI.toString()); return auth.cadastrar(u); } catch(Exception e) { e.printStackTrace(); return false; } } }