-
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
1 parent
a2f8b7e
commit 4c93f1b
Showing
7 changed files
with
149 additions
and
1 deletion.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
jargon2-core-common/src/main/java/org/irods/jargon2/common/confg/enumz/EnumIoStyle.java
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,26 @@ | ||
package org.irods.jargon2.common.confg.enumz; | ||
|
||
/** | ||
* use standard or nio | ||
* | ||
* @author mcc | ||
* | ||
* https://thomaswabner.wordpress.com/2007/10/09/fast-stream-copy-using-javanio-channels/ | ||
* | ||
*/ | ||
public enum EnumIoStyle { | ||
NIO, Standard; | ||
|
||
public static EnumIoStyle mapIoStyleToEnum(final String ioStyle) { | ||
EnumIoStyle enumIoStyle = null; | ||
for (EnumIoStyle enumValue : EnumIoStyle.values()) { | ||
if (enumValue.toString().equals(ioStyle)) { | ||
enumIoStyle = enumValue; | ||
break; | ||
} | ||
} | ||
|
||
return enumIoStyle; | ||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
jargon2-core-common/src/main/java/org/irods/jargon2/common/confg/enumz/package-info.java
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,10 @@ | ||
/** | ||
* | ||
*/ | ||
/** | ||
* Enumerations and constants for configuration data | ||
* | ||
* @author mcc | ||
* | ||
*/ | ||
package org.irods.jargon2.common.confg.enumz; |
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
54 changes: 54 additions & 0 deletions
54
jargon2-core-common/src/main/java/org/irods/jargon2/common/confg/props/JargonProperties.java
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 |
---|---|---|
@@ -1,14 +1,68 @@ | ||
package org.irods.jargon2.common.confg.props; | ||
|
||
import org.irods.jargon2.common.confg.enumz.EnumIoStyle; | ||
|
||
/** | ||
* Interface for jargon | ||
* | ||
* @author mconway | ||
* | ||
*/ | ||
public interface JargonProperties { | ||
|
||
/* | ||
* iRODS connection properties | ||
*/ | ||
int getConnectionTimeoutInSeconds(); | ||
|
||
void setConnectionTimeoutInSeconds(int connectionTimeoutInSeconds); | ||
|
||
/* | ||
* General i/o properties | ||
*/ | ||
|
||
/** | ||
* Get the configured io style | ||
* | ||
* @return {@link EnumIoStyle} | ||
*/ | ||
EnumIoStyle getEnumIoStyle(); | ||
|
||
void setEnumIoStyle(EnumIoStyle enumIoStyle); | ||
|
||
/* | ||
* local file system i/o properties | ||
*/ | ||
|
||
/** | ||
* Check if using NIO direct buffers. Only active if NIO is the chosen IO | ||
* mode | ||
* | ||
* @return <code>boolean</code> use nio direct | ||
*/ | ||
boolean isUseNioDirect(); | ||
|
||
/** | ||
* Set nio direct | ||
* | ||
* @param useNioDirect | ||
* <code>boolean</code> if nio direct is to be used, otherwise an | ||
* indirect byte buffer is used | ||
*/ | ||
void setUseNioDirect(boolean useNioDirect); | ||
|
||
/** | ||
* Use fast channel copy between channels, only active if io style is nio | ||
* | ||
* @return <code>boolean</code> if using fast channel copy | ||
*/ | ||
boolean isUseFastChannelCopy(); | ||
|
||
/** | ||
* Set fast channel copy behavior | ||
* | ||
* @param useFastChannelCopy | ||
*/ | ||
void setUseFastChannelCopy(boolean useFastChannelCopy); | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
jargon2-core-common/src/test/java/org/irods/jargon2/common/confg/enumz/EnumIoStyleTest.java
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,15 @@ | ||
package org.irods.jargon2.common.confg.enumz; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
public class EnumIoStyleTest { | ||
|
||
@Test | ||
public void testMapIoStyleToEnum() { | ||
String test = EnumIoStyle.NIO.toString(); | ||
EnumIoStyle actual = EnumIoStyle.mapIoStyleToEnum(test); | ||
Assert.assertNotNull("null enumIoStyle", actual); | ||
} | ||
|
||
} |
3 changes: 2 additions & 1 deletion
3
jargon2-core-common/src/test/java/org/irods/jargon2/utils/unittest/AllTests.java
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 |
---|---|---|
@@ -1,12 +1,13 @@ | ||
package org.irods.jargon2.utils.unittest; | ||
|
||
import org.irods.jargon2.common.confg.enumz.EnumIoStyleTest; | ||
import org.irods.jargon2.utils.exception.bundle.MessageUtilTest; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Suite; | ||
import org.junit.runners.Suite.SuiteClasses; | ||
|
||
@RunWith(Suite.class) | ||
@SuiteClasses({ MessageUtilTest.class }) | ||
@SuiteClasses({ MessageUtilTest.class, EnumIoStyleTest.class }) | ||
public class AllTests { | ||
|
||
} |
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