You should not have to add the .jar to your build path manually.
If you place it in the userlib folder of your project, that should be enough.
Also, you import statements look suspicious. Are you using any Java ide at all?
This is what I've got now and it stops at
Core.storeFileDocumentContent(context, XLSFile,"filename", in);
no exception it just takes either 10 minutes to finish it or never does.
I really dont understand what input streams are and how they work, if I'm doing something redundant or stupid let me know.
public class JA_GetSharedFile extends CustomJavaAction<IMendixObject>
{
private IMendixObject __XLSFileParameter1;
private importutility.proxies.XLSFile XLSFileParameter1;
private java.lang.String ImportDirectory;
private java.lang.String FileExtension;
public JA_GetSharedFile(IContext context, IMendixObject XLSFileParameter1, java.lang.String ImportDirectory, java.lang.String FileExtension)
{
super(context);
this.__XLSFileParameter1 = XLSFileParameter1;
this.ImportDirectory = ImportDirectory;
this.FileExtension = FileExtension;
}
@Override
public IMendixObject executeAction() throws Exception
{
this.XLSFileParameter1 = __XLSFileParameter1 == null ? null : importutility.proxies.XLSFile.initialize(getContext(), __XLSFileParameter1);
// BEGIN USER CODE
SharedFileGetter GetHer = new SharedFileGetter();
IContext context = this.getContext();
IMendixObject ScheduledFile = null;
if (ImportDirectory == null)
{
ScheduledFile = GetHer.GetFileUnspecified(context, __XLSFileParameter1);
}
else
{
ScheduledFile = GetHer.GetFileFromDirectory(context, __XLSFileParameter1, ImportDirectory, FileExtension);
}
return ScheduledFile;
// END USER CODE
}
/**
* Returns a string representation of this action
*/
@Override
public java.lang.String toString()
{
return "JA_GetSharedFile";
}
// BEGIN EXTRA CODE
private class SharedFileGetter
{
public IMendixObject GetFileFromDirectory(IContext context, IMendixObject XLSFile, String ImportDirectory, String FileExtension) throws IOException
{
String user = "user";
String pass = "pass";
String server = "smb://server/0412_Project_Request_Form_Master_Data_export-en-us.xlsx";
// Authenticate
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, user, pass);
SmbFile dir = new SmbFile(server, auth);
SmbFileInputStream in = new SmbFileInputStream(dir);
FileOutputStream out = new FileOutputStream(dir.getName() );
Core.storeFileDocumentContent(context, XLSFile, in);
out.close();
in.close();
return XLSFile;
}
public IMendixObject GetFileUnspecified(IContext context, IMendixObject XLSFile) throws IOException
{
String user = "pass";
String pass = "user";
String server = "smb://server/0412_Project_Request_Form_Master_Data_export-en-us.xlsx";
// Authenticate
SmbFile scheduledFile = null;
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("", user, pass);
scheduledFile = new SmbFile(server, auth);
InputStream in = scheduledFile.getInputStream();
Core.storeFileDocumentContent(context, XLSFile,"0412_Project_Request_Form_Master_Data_export-en-us", in);
in.close();
return XLSFile;
}
}
// END EXTRA CODE
}