Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3836,7 +3836,6 @@ lazy val `engine-runner` = project
`database-polyglot-root`
.listFiles("*.jar")
.map(_.getAbsolutePath()) ++
`std-aws-polyglot-root`.listFiles("*.jar").map(_.getAbsolutePath()) ++
`std-tableau-polyglot-root`
.listFiles("*.jar")
.map(_.getAbsolutePath()) ++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import project.AWS_Region.AWS_Region
polyglot java import org.enso.aws.AwsCredential
polyglot java import org.enso.aws.ClientBuilder
polyglot java import org.enso.aws.ProfileReader
polyglot java import org.enso.base.enso_cloud.HideableValue

type AWS_Credential
## Access AWS using the default credential method.
Expand Down Expand Up @@ -63,7 +64,9 @@ type AWS_Credential
AWS_Credential.Default -> AwsCredential.Default.new
AWS_Credential.Profile profile -> AwsCredential.Profile.new profile
AWS_Credential.Key access_key_id secret_access_key ->
AwsCredential.Key.new (as_hideable_value access_key_id) (as_hideable_value secret_access_key)
key = as_hideable_value access_key_id factory=HideableValue
secret = as_hideable_value secret_access_key factory=HideableValue
AwsCredential.Key.new key secret
AWS_Credential.With_Configuration base_credential _ ->
base_credential.as_java

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ private

from Standard.Base import all
import Standard.Base.Errors.File_Error.File_Error
from Standard.Base.System.File import file_as_java

polyglot java import java.io.File as Java_File
polyglot java import software.amazon.awssdk.core.sync.RequestBody

## ---
private: true
---
from_local_file (file : File) = File_Error.handle_java_exceptions file <|
java_file = file_as_java file
java_file = Java_File.new file.absolute.normalize.path
RequestBody.fromFile java_file
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
- with_output_stream self open_options:Standard.Base.Data.Vector.Vector action:Standard.Base.Any.Any -> Standard.Base.Any.Any
- type File_System_SPI
- new protocol:Standard.Base.Data.Text.Text typ:Standard.Base.Any.Any -> Standard.Base.Any.Any
- file_as_java file:Standard.Base.System.File.File -> Standard.Base.Any.Any
- find_extension_from_name name:Standard.Base.Any.Any -> Standard.Base.Any.Any
- get_child_widget file:Standard.Base.Any.Any -> Standard.Base.Any.Any
- list_descendants file:Standard.Base.Any.Any -> Standard.Base.Any.Any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1182,12 +1182,6 @@ find_extension_from_name name =
Convert from a Text to a File.
File.from (that:Text) = File.new that

## ---
private: true
---
file_as_java : File -> Java_File
file_as_java (file : File) = Java_File.new file.absolute.normalize.path

## ---
private: true
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Standard.Base.Errors.Illegal_Argument.Illegal_Argument
import Standard.Base.Errors.Illegal_State.Illegal_State
import Standard.Base.Runtime.Context
import Standard.Base.System.File.Generic.Writable_File.Writable_File
from Standard.Base.System.File import file_as_java

import project.Excel.Excel_File_Format.Excel_File_Format
import project.Excel.Excel_Range.Excel_Range
Expand Down Expand Up @@ -70,19 +69,22 @@ write_file (file : Writable_File) (table : Table) (on_existing_file : Existing_F
private: true
---
write_local_file (file:File) table on_existing_file section match_columns xls_format =
java_file = file_as_java file
to_java f:File =
Java_File.new f.absolute.normalize.path

java_file = to_java file
file_format = xls_format.to_java

ExcelWriter.setEnsoToTextCallbackIfUnset (.to_text)
is_dry_run = Context.Output.is_enabled.not

Panic.recover File_Error <| File_Error.handle_java_exceptions file <| handle_writer <|
possible_backup_file = if on_existing_file == Existing_File_Behavior.Backup then file_as_java (find_bak_file file) else Nothing
possible_backup_file = if on_existing_file == Existing_File_Behavior.Backup then to_java (find_bak_file file) else Nothing
possible_dry_run_file = if is_dry_run.not then Nothing else
preexisting_dry_run_file = DryRunFileManager.preExistingTemporaryFile file.absolute.normalize.path
preexisting_dry_run_file.if_not_nothing <|
Java_File.new preexisting_dry_run_file

## Make sure all of the files we may touch as part of the write operation are not open for reading in the cache
possible_backup_file.if_not_nothing <| ExcelReader.closeFile possible_backup_file file_format
possible_dry_run_file.if_not_nothing <| ExcelReader.closeFile possible_dry_run_file file_format
Expand All @@ -95,8 +97,8 @@ write_local_file (file:File) table on_existing_file section match_columns xls_fo
doesn't exist we also ensure that the temp file is not polluted with data from previous (dry-run) writes.
Context.Output.with_enabled <| Panic.rethrow <|
if file.exists then (file.copy_to temp_file replace_existing=True) else (temp_file.delete_if_exists)
write_to_workbook (file_as_java temp_file) file_format table section on_existing_file match_columns

write_to_workbook (to_java temp_file) file_format table section on_existing_file match_columns

Context.Output.with_enabled <|
result_file = if is_dry_run then temp_file else
Expand Down
Loading