Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // generando el nombre y extensión, Naming the file
- String fileUri = FILE_URI;
- String nameDomain = NAME_DOMAIN;
- String fileName= START_NAME_FILE +"_"+formatCalToday+ FILE_EXTENSION;
- String credentialsUserName = getConfigurationValue(delegator, "inventoryManagementPharmacyApp", "inventoryGeneral", "pathRouteConfigurableUserforUsername");
- String credentialsPassword = getConfigurationValue(delegator, "inventoryManagementPharmacyApp", "inventoryGeneral", "pathRouteConfigurableUserforPassword");
- String pathRuta = getConfigurationValue(delegator, "inventoryManagementPharmacyApp", "inventoryGeneral", "pathRouteConfigurableUserLevel");
- final String user = credentialsUserName + ":" + credentialsPassword;
- final NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(user);
- String path = fileUri+pathRuta+fileName;
- final SmbFile sFile = new SmbFile(path, auth);
- final SmbFileOutputStream salida2 = new SmbFileOutputStream(sFile);
- fileUri = "smb:"
- fileName = "archivo.txt"
- credentialUserName = "username" de la red compartida
- credentialPassword = "password" de la red compartida
- pathRuta= \ipInforme Ventas
- path = smb:\ipInforme Ventas archivo.txt
- fileUri + pathRuta + fileName;
- String commandConnect = "cmd /c net use \\" + ip
- + "\ipc$ /user:" + credentialsUserName + " " + credentialsPassword;
- //He expects the process to finalize
- try {
- Process process = Runtime.getRuntime().exec(commandConnect);
- int exitCode = process.waitFor();
- if (exitCode != 0) {
- throw new IOException("Command exited with " + exitCode);
- }
- } catch (Exception ex) {
- ex.getMessage();
- }
- String commandDisconnect = "cmd /c net use \\" + ip
- + "\ipc$ /d";
- //He expects the process to finalize
- try {
- Process process = Runtime.getRuntime().exec(commandDisconnect);
- int exitCode = process.waitFor();
- if (exitCode != 0) {
- throw new IOException("Command exited with " + exitCode);
- }
- } catch (Exception ex) {
- ex.getMessage();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement