-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
venkato
committed
Jan 17, 2022
1 parent
afedeca
commit bd136d0
Showing
691 changed files
with
29,639 additions
and
3,325 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import net.sf.jremoterun.utilities.nonjdk.quickfixsender.JrrQfDataHolder; | ||
import net.sf.jremoterun.utilities.nonjdk.quickfixsender.JrrQfHelper; | ||
import net.sf.jremoterun.utilities.nonjdk.quickfixsender.QfRstaRunnerWithStackTrace; | ||
|
||
import java.util.*; | ||
import net.sf.jremoterun.utilities.nonjdk.rstarunner.RstaRunner; | ||
import net.sf.jremoterun.utilities.nonjdk.rstarunner.RstaScriptHelper; | ||
import groovy.transform.CompileStatic; | ||
import quickfix.Message; | ||
|
||
@CompileStatic | ||
class Quickfixj_sample extends JrrQfHelper { | ||
QfRstaRunnerWithStackTrace qf; | ||
JrrQfDataHolder d; | ||
JrrQfHelper h = this; | ||
|
||
void r() { | ||
} | ||
|
||
void custom(){ | ||
sendMsg(); | ||
} | ||
|
||
void sendMsg(){ | ||
// 2.groovy | ||
String s = '|9=1|35=1'; | ||
s= h.prepareMsg(s); | ||
log.info (s.replace(d.fixMsgNativeSep,d.humanSep)); | ||
Message message = new Message(s, h.getAppDd()); | ||
d.qfSession.send(message) | ||
//qf.sendMsg2(); | ||
} | ||
|
||
void Connect(){ | ||
//qf.setAutoDisconnectTimeInSecNew(10) ; | ||
String s = """ | ||
ConnectionType=initiator | ||
#ConnectionType=acceptor | ||
ReconnectInterval=60 | ||
SenderCompID=ARCA | ||
TargetCompID=TW | ||
#SocketAcceptPort=6716 | ||
SocketConnectPort=6712 | ||
SocketConnectHost=127.0.0.1 | ||
HeartBtInt=20 | ||
StartTime=23:30:00 | ||
EndTime=23:30:00 | ||
BeginString=FIX.4.4 | ||
DataDictionary=FIX44.xml | ||
RefreshOnLogon=Y | ||
ResetOnLogon=Y | ||
""" | ||
//qf.stopCurrent(); | ||
Properties props = h.parsePropsFromString(s); | ||
h.initSession(props); | ||
} | ||
|
||
@Override | ||
void init() { | ||
qf = (QfRstaRunnerWithStackTrace) runner; | ||
d = qf.d; | ||
h.init2(); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package tcpmon | ||
|
||
import groovy.transform.CompileStatic; | ||
import net.sf.jremoterun.utilities.JrrClassUtils | ||
import net.sf.jremoterun.utilities.classpath.ClRef; | ||
|
||
import java.util.logging.Logger; | ||
|
||
@CompileStatic | ||
class extMethodTester implements Runnable { | ||
private static final Logger log = JrrClassUtils.getJdkLogForCurrentClass(); | ||
|
||
@Override | ||
void run() { | ||
// used in | ||
new ClRef('net.sf.jremoterun.utilities.nonjdk.groovy.ExtentionMethodChecker2') | ||
|
||
log.debug("test msg"); | ||
File f1 = new File('.'); | ||
File f2 = new File('.'); | ||
f1.isChildFile(f2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
149 changes: 149 additions & 0 deletions
149
src-archiver/net/sf/jremoterun/utilities/nonjdk/archiver/JrrCommonsArchiver.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
package net.sf.jremoterun.utilities.nonjdk.archiver | ||
|
||
import groovy.transform.CompileStatic; | ||
import net.sf.jremoterun.utilities.JrrClassUtils | ||
import org.apache.commons.compress.archivers.ArchiveEntry | ||
import org.apache.commons.compress.archivers.ArchiveOutputStream | ||
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream | ||
import org.rauschig.jarchivelib.ArchiveFormat | ||
import org.rauschig.jarchivelib.CommonsArchiverOriginal | ||
import org.rauschig.jarchivelib.IOUtils; | ||
|
||
import java.util.logging.Logger; | ||
|
||
@CompileStatic | ||
class JrrCommonsArchiver extends CommonsArchiverOriginal { | ||
private static final Logger log = JrrClassUtils.getJdkLogForCurrentClass(); | ||
|
||
public int maxErrorFiles = 10; | ||
public long processedFiles = 0; | ||
public long uncompressedFileSize = 0; | ||
public boolean removeArchiveOnError = true; | ||
public boolean checkOnZeroFiles = true; | ||
public List<File> errorFiles = [] | ||
public List<File> ignoreFiles = [] | ||
// path separator is / | ||
public List<File> ignoreFilesFiles = [] | ||
public List<String> ignoreFilesPattern = [] | ||
public List<String> ignoreFilesStartWithPattern = [] | ||
public File destinationFile; | ||
public volatile File lastFile; | ||
public volatile boolean needStop = false; | ||
|
||
JrrCommonsArchiver(ArchiveFormat archiveFormat) { | ||
super(archiveFormat) | ||
} | ||
|
||
|
||
@Override | ||
File create(String archive, File destinationDir, File... sources) throws IOException { | ||
try { | ||
File result = super.create(archive, destinationDir, sources) | ||
if (checkOnZeroFiles && processedFiles == 0) { | ||
throw new Exception('No files in archive') | ||
} | ||
return result; | ||
} catch (Throwable e) { | ||
if (removeArchiveOnError && destinationFile != null) { | ||
destinationFile.delete() | ||
} | ||
throw e; | ||
} | ||
} | ||
|
||
@Override | ||
protected File createNewArchiveFile(String archive, String extension, File destination) throws IOException { | ||
destinationFile = super.createNewArchiveFile(archive, extension, destination) | ||
return destinationFile; | ||
} | ||
|
||
@Override | ||
protected ArchiveOutputStream createArchiveOutputStream(File archiveFile) throws IOException { | ||
return super.createArchiveOutputStream(archiveFile) | ||
} | ||
|
||
protected static TarArchiveOutputStream createArchiveOutputStreamTarBig(File archiveFile) throws IOException { | ||
TarArchiveOutputStream archiveOutputStream = new TarArchiveOutputStream(new FileOutputStream(archiveFile)); | ||
archiveOutputStream.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX); | ||
archiveOutputStream.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX); | ||
return archiveOutputStream; | ||
} | ||
|
||
@Override | ||
protected void writeToArchive(File parent, File[] sources, ArchiveOutputStream archive) throws IOException { | ||
if(needStop){ | ||
throw new Exception('stop requested') | ||
} | ||
for (File source : sources) { | ||
lastFile = source; | ||
String relativePath = IOUtils.relativePath(parent, source); | ||
boolean needed = isNeedWriteFile(source, relativePath, archive) | ||
if (needed) { | ||
createArchiveEntry(source, relativePath, archive); | ||
if (source.isDirectory()) { | ||
File[] files = source.listFiles() | ||
writeToArchive(parent, files, archive); | ||
} | ||
} | ||
} | ||
} | ||
|
||
boolean isNeedWriteFile(File file, String relativePath, ArchiveOutputStream archive) { | ||
boolean needAccept = true | ||
if(ignoreFilesFiles.contains(file)){ | ||
needAccept = false | ||
} | ||
if(needAccept) { | ||
relativePath = relativePath.replace('\\', '/') | ||
String findIgnore1 = ignoreFilesPattern.find { relativePath.contains(it) } | ||
needAccept = findIgnore1 == null; | ||
if (needAccept) { | ||
String findIgnore2 = ignoreFilesStartWithPattern.find { relativePath.startsWith(it) } | ||
needAccept = findIgnore2 == null | ||
} | ||
} | ||
if (!needAccept) { | ||
ignoreFiles.add(file); | ||
log.info "ignoring : ${relativePath} ${file}" | ||
} | ||
return needAccept; | ||
} | ||
|
||
@Override | ||
protected void createArchiveEntry(File file, String entryName, ArchiveOutputStream archive) throws IOException { | ||
if(needStop){ | ||
throw new Exception('stop requested') | ||
} | ||
lastFile = file; | ||
ArchiveEntry entry = archive.createArchiveEntry(file, entryName); | ||
// TODO #23: read permission from file, write it to the ArchiveEntry | ||
archive.putArchiveEntry(entry); | ||
|
||
if (!entry.isDirectory()) { | ||
FileInputStream input = null; | ||
try { | ||
input = new FileInputStream(file); | ||
uncompressedFileSize += IOUtils.copy(input, archive); | ||
processedFiles++; | ||
} catch (Throwable e) { | ||
//TODO write dummy bytes, so number of written bytes matches file size | ||
onError(e, file, entryName, archive) | ||
} finally { | ||
IOUtils.closeQuietly(input); | ||
} | ||
|
||
} | ||
|
||
archive.closeArchiveEntry(); | ||
} | ||
|
||
|
||
void onError(Throwable e, File file, String entryName, ArchiveOutputStream archive) { | ||
log.info("${entryName} ${file}", e) | ||
if (errorFiles.size() > maxErrorFiles) { | ||
throw e | ||
} | ||
errorFiles.add(file); | ||
} | ||
|
||
} |
Oops, something went wrong.