public class EntryTransforms extends Object
AddeServer to a
RemoteAddeEntry.| Modifier and Type | Field and Description |
|---|---|
static Function<AddeServer,RemoteAddeEntry> |
convertIdvServer
|
private static String |
cygwinPrefix |
private static int |
cygwinPrefixLength |
private static Matcher |
hostMatcher
No sense in rebuilding things that don't need to be rebuilt.
|
private static Pattern |
hostPattern
Matches "host" declarations in a MCTABLE file.
|
private static org.slf4j.Logger |
logger
Logger object.
|
private static Matcher |
routeMatcher
No sense in rebuilding things that don't need to be rebuilt.
|
private static Pattern |
routePattern
Matches dataset routing information in a MCTABLE file.
|
| Modifier | Constructor and Description |
|---|---|
private |
EntryTransforms()
This is a utility class.
|
private static final org.slf4j.Logger logger
private static final Pattern routePattern
private static final Pattern hostPattern
private static final Matcher routeMatcher
private static final Matcher hostMatcher
private static final String cygwinPrefix
private static final int cygwinPrefixLength
public static final Function<AddeServer,RemoteAddeEntry> convertIdvServer
private EntryTransforms()
public static Set<AddeEntry.EntryType> findEntryTypes(Collection<? extends AddeEntry> entries)
public static Set<RemoteAddeEntry> convertIdvServers(List<AddeServer> idvServers)
public static Set<AddeServer> convertMcvServers(Collection<AddeEntry> entries)
protected static Set<RemoteAddeEntry> convertUserXml(Element root)
root - "Root" of the XML to convert.Set of RemoteAddeEntrys described by
root.public static Set<RemoteAddeEntry> createEntriesFrom(RemoteAddeEntry entry)
protected static Set<AddeEntry> convertAddeServerXml(Element root, AddeEntry.EntrySource source)
root - XML to convert.source - Used to "bulk set" the origin of whatever
RemoteAddeEntrys get created.Set of RemoteAddeEntrys contained within
root.public static String entryTypeToStr(AddeEntry.EntryType type)
AddeEntry.EntryType to its String representation}.
Note that the resulting String is lowercase.type - The type to convert. Cannot be null.NullPointerException - if type is null.public static AddeEntry.EntryType strToEntryType(String s)
String to a AddeEntry.EntryType.s - Value whose EntryType is wanted. Cannot be null.EntryType. If there was no "sensible"
conversion, the method returns AddeEntry.EntryType.UNKNOWN.NullPointerException - if s is null.public static AddeEntry.EntrySource strToEntrySource(String s)
String to an AddeEntry.EntrySource.s - String representation of an EntrySource.
Cannot be null.AddeEntry.EntrySource.valueOf(String) to convert s
to an EntrySource and returns. If no conversion was possible,
returns AddeEntry.EntrySource.USER.NullPointerException - if s is null.public static AddeEntry.EntryValidity strToEntryValidity(String s)
String to an AddeEntry.EntryValidity.s - String representation of an EntryValidity.
Cannot be null.AddeEntry.EntryValidity.valueOf(String) to convert
s to an EntryValidity and returns. If no conversion
was possible, returns AddeEntry.EntryValidity.UNVERIFIED.NullPointerException - if s is null.public static AddeEntry.EntryStatus strToEntryStatus(String s)
String into an AddeEntry.EntryStatus.s - String representation of an EntryStatus.
Cannot be null.AddeEntry.EntryStatus.valueOf(String) to convert s
into an EntryStatus and returns. If no conversion was possible,
returns AddeEntry.EntryStatus.DISABLED.NullPointerException - if s is null.public static LocalAddeEntry.AddeFormat strToAddeFormat(String s)
String into a member of LocalAddeEntry.AddeFormat.
This method does a little bit of magic with the incoming String:
s - String representation of an AddeFormat. Cannot
be null.LocalAddeEntry.AddeFormat.valueOf(String) to convert the modified
String into an AddeFormat and returns. If no conversion
was possible, returns LocalAddeEntry.AddeFormat.INVALID.NullPointerException - if s is null.protected static Set<RemoteAddeEntry> extractMctableEntries(String path, String username, String project)
private static List<RemoteAddeEntry> mapDatasetsToName(Map<String,String> datasetToHost, Map<String,String> hostToIp, String username, String project)
Basically create RemoteAddeEntrys by using a hostname to
determine which dataset belongs to which IP.
datasetToHost - Map of ADDE groups to host names.hostToIp - Map of host names to IP addresses.username - project - private static Map<String,String> mapDatasetsToIp(Map<String,String> datasets, Map<String,String> hostMap)
public static Set<LocalAddeEntry> readResolvFile(String filename) throws IOException
Set of LocalAddeEntrys.filename - Filename containing desired LocalAddeEntrys.
Cannot be null.Set of LocalAddeEntrys contained within
filename.IOException - if there was a problem reading from filename.readResolvLine(String)public static LocalAddeEntry readResolvLine(String line)
String containing a "RESOLV.SRV" entry into
a LocalAddeEntry.public static void writeResolvFile(String filename, Collection<LocalAddeEntry> entries) throws IOException
Collection of LocalAddeEntrys to a "RESOLV.SRV"
file. This method discards the current contents of filename!filename - Filename that will contain the LocalAddeEntrys within
entries. Cannot be null.entries - Set of entries to be written to filename.
Cannot be null.IOException - if there was a problem writing to filename.appendResolvFile(String, Collection)public static void appendResolvFile(String filename, Collection<LocalAddeEntry> entries) throws IOException
Collection of LocalAddeEntrys to a "RESOLV.SRV"
file. This method will append the contents of entries to
filename.filename - Filename that will contain the LocalAddeEntrys within
entries. Cannot be null.entries - Collection of entries to be written to filename.
Cannot be null.IOException - if there was a problem writing to filename.writeResolvFile(String, Collection)private static void writeResolvFile(String filename, boolean append, Collection<LocalAddeEntry> entries) throws IOException
Collection of LocalAddeEntrys to a "RESOLV.SRV"
file.filename - Filename that will contain the LocalAddeEntrys within
entries. Cannot be null.append - If true, append entries to filename. Otherwise discards contents of filename.entries - Collection of entries to be written to filename.
Cannot be null.IOException - if there was a problem writing to filename.appendResolvFile(String, Collection),
asResolvEntry(LocalAddeEntry)public static String demungeFileMask(String path)
NullPointerException - if path is null.public static String mungeFileMask(String mask)
String into something "RESOLV.SRV"
expects.
Munging is only needed for Windows users--the process converts back slashes into forward slashes and prefixes with "/cygdrive/".
NullPointerException - if mask is null.public static List<String> asResolvEntries(Collection<LocalAddeEntry> entries)
entries - Collection of entries to convert. Should not be null.entries represented as Strings.asResolvEntry(LocalAddeEntry)public static String asResolvEntry(LocalAddeEntry entry)
LocalAddeEntry into a String that is
suitable for including in a "RESOLV.SRV" file. This method
does not append a newline to the end of the String.entry - The LocalAddeEntry to convert. Should not be null.entry as a "RESOLV.SRV" entry.