Package net.handle.apps.batch
Class BatchUtil
- java.lang.Object
-
- net.handle.apps.batch.BatchUtil
-
public class BatchUtil extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description BatchUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static AbstractResponse
addAliasToHandleRecord(java.lang.String handle, java.lang.String alias, int index, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site)
static AbstractResponse
addHandleValue(java.lang.String handle, HandleValue value, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site)
static HandleValue[]
addValue(HandleValue[] values, HandleValue value)
static HandleValue[]
createExampleHandleValues(java.lang.String handle, java.lang.String url, java.lang.String adminHandle, int adminIndex)
static AbstractResponse
createHandleRecord(java.lang.String handle, HandleValue[] values, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site)
static AbstractResponse
deleteHandleRecord(java.lang.String handle, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site)
static SiteInfo
getFirstPrimarySite(HandleValue[] values)
static SiteInfo
getFirstPrimarySiteFromHserv(HandleValue[] values, HandleResolver resolver)
static java.util.List<java.lang.String>
getHandlesFromFile(java.lang.String fileName)
static HandleValue
getHandleValueAtIndex(HandleValue[] handleValues, int index)
static java.util.List<java.lang.String>
getLinesFromFile(java.lang.String fileName)
static int
getNextIndex(HandleValue[] values, int start)
static SiteInfo
getSite(java.lang.String siteHandle, HandleResolver resolver)
static java.util.List<HandleValue>
getValuesNotOfType(HandleValue[] values, java.lang.String type)
static java.util.List<HandleValue>
getValuesOfType(HandleValue[] values, java.lang.String type)
static boolean
hasHandleValueOfType(HandleValue[] values, java.lang.String type)
static AbstractResponse
homePrefix(java.lang.String prefix, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site)
static java.util.List<java.lang.String>
listAllHandlesOnSite(SiteInfo site, HandleResolver resolver, AuthenticationInfo authInfo)
static java.util.List<java.lang.String>
listHandles(java.lang.String prefix, SiteInfo site, HandleResolver resolver, AuthenticationInfo authInfo)
static java.util.List<java.lang.String>
listPrefixesOnSite(SiteInfo site, HandleResolver resolver, AuthenticationInfo authInfo)
static int
lowestAvailableIndex(java.util.List<java.lang.Integer> usedIndexes)
static int
lowestAvailableIndex(HandleValue[] values)
static AbstractResponse
modifyHandleValue(java.lang.String handle, HandleValue value, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site)
static AbstractResponse
removeValueRequest(java.lang.String handle, HandleValue value, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site)
static AbstractResponse
removeValuesAtIndices(java.lang.String handle, int[] indicesToRemove, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site)
static HandleValue[]
resolveHandle(java.lang.String handle, HandleResolver resolver, AuthenticationInfo authInfo)
static HandleValue[]
resolveHandleFromSite(java.lang.String handle, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site)
static HandleValue[]
signHandleValues(HandleValue[] values, java.lang.String handleToCreate, java.lang.String handleOfSigner, int indexOfSigner, java.security.PrivateKey privateKeyOfSigner)
static HandleValue[]
signHandleValuesWithJws(HandleValue[] values, java.lang.String handleToSign, java.lang.String handleOfSigner, int indexOfSigner, java.security.PrivateKey privateKeyOfSigner, java.util.List<java.lang.String> chain)
static void
throwIfNotSuccess(AbstractResponse response)
static AbstractResponse
unhomePrefix(java.lang.String prefix, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site)
static AbstractResponse
updateEntireHandleRecord(java.lang.String handle, java.util.List<HandleValue> values, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site)
static AbstractResponse
updateEntireHandleRecord(java.lang.String handle, HandleValue[] values, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site)
static void
writeHandlesToConsole(java.util.List<java.lang.String> handles)
static void
writeHandlesToFile(java.util.List<java.lang.String> handles, java.lang.String fileName)
-
-
-
Method Detail
-
getSite
public static SiteInfo getSite(java.lang.String siteHandle, HandleResolver resolver) throws HandleException
- Throws:
HandleException
-
getHandleValueAtIndex
public static HandleValue getHandleValueAtIndex(HandleValue[] handleValues, int index)
-
getFirstPrimarySiteFromHserv
public static SiteInfo getFirstPrimarySiteFromHserv(HandleValue[] values, HandleResolver resolver) throws HandleException
- Throws:
HandleException
-
getFirstPrimarySite
public static SiteInfo getFirstPrimarySite(HandleValue[] values)
-
listAllHandlesOnSite
public static java.util.List<java.lang.String> listAllHandlesOnSite(SiteInfo site, HandleResolver resolver, AuthenticationInfo authInfo) throws HandleException
- Throws:
HandleException
-
listPrefixesOnSite
public static java.util.List<java.lang.String> listPrefixesOnSite(SiteInfo site, HandleResolver resolver, AuthenticationInfo authInfo) throws HandleException
- Throws:
HandleException
-
listHandles
public static java.util.List<java.lang.String> listHandles(java.lang.String prefix, SiteInfo site, HandleResolver resolver, AuthenticationInfo authInfo) throws HandleException
- Throws:
HandleException
-
getHandlesFromFile
public static java.util.List<java.lang.String> getHandlesFromFile(java.lang.String fileName) throws java.io.FileNotFoundException
- Throws:
java.io.FileNotFoundException
-
getLinesFromFile
public static java.util.List<java.lang.String> getLinesFromFile(java.lang.String fileName) throws java.io.FileNotFoundException
- Throws:
java.io.FileNotFoundException
-
writeHandlesToFile
public static void writeHandlesToFile(java.util.List<java.lang.String> handles, java.lang.String fileName) throws java.io.IOException
- Throws:
java.io.IOException
-
writeHandlesToConsole
public static void writeHandlesToConsole(java.util.List<java.lang.String> handles)
-
addValue
public static HandleValue[] addValue(HandleValue[] values, HandleValue value)
-
getNextIndex
public static int getNextIndex(HandleValue[] values, int start)
-
lowestAvailableIndex
public static int lowestAvailableIndex(HandleValue[] values)
-
lowestAvailableIndex
public static int lowestAvailableIndex(java.util.List<java.lang.Integer> usedIndexes)
-
hasHandleValueOfType
public static boolean hasHandleValueOfType(HandleValue[] values, java.lang.String type)
-
getValuesOfType
public static java.util.List<HandleValue> getValuesOfType(HandleValue[] values, java.lang.String type)
-
getValuesNotOfType
public static java.util.List<HandleValue> getValuesNotOfType(HandleValue[] values, java.lang.String type)
-
addHandleValue
public static AbstractResponse addHandleValue(java.lang.String handle, HandleValue value, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site) throws HandleException
- Throws:
HandleException
-
resolveHandle
public static HandleValue[] resolveHandle(java.lang.String handle, HandleResolver resolver, AuthenticationInfo authInfo) throws HandleException
- Throws:
HandleException
-
resolveHandleFromSite
public static HandleValue[] resolveHandleFromSite(java.lang.String handle, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site) throws HandleException
- Throws:
HandleException
-
addAliasToHandleRecord
public static AbstractResponse addAliasToHandleRecord(java.lang.String handle, java.lang.String alias, int index, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site) throws HandleException
- Throws:
HandleException
-
modifyHandleValue
public static AbstractResponse modifyHandleValue(java.lang.String handle, HandleValue value, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site) throws HandleException
- Throws:
HandleException
-
updateEntireHandleRecord
public static AbstractResponse updateEntireHandleRecord(java.lang.String handle, java.util.List<HandleValue> values, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site) throws HandleException
- Throws:
HandleException
-
removeValueRequest
public static AbstractResponse removeValueRequest(java.lang.String handle, HandleValue value, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site) throws HandleException
- Throws:
HandleException
-
removeValuesAtIndices
public static AbstractResponse removeValuesAtIndices(java.lang.String handle, int[] indicesToRemove, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site) throws HandleException
- Throws:
HandleException
-
signHandleValues
public static HandleValue[] signHandleValues(HandleValue[] values, java.lang.String handleToCreate, java.lang.String handleOfSigner, int indexOfSigner, java.security.PrivateKey privateKeyOfSigner) throws java.lang.Exception
- Throws:
java.lang.Exception
-
signHandleValuesWithJws
public static HandleValue[] signHandleValuesWithJws(HandleValue[] values, java.lang.String handleToSign, java.lang.String handleOfSigner, int indexOfSigner, java.security.PrivateKey privateKeyOfSigner, java.util.List<java.lang.String> chain) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createExampleHandleValues
public static HandleValue[] createExampleHandleValues(java.lang.String handle, java.lang.String url, java.lang.String adminHandle, int adminIndex)
-
deleteHandleRecord
public static AbstractResponse deleteHandleRecord(java.lang.String handle, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site) throws HandleException
- Throws:
HandleException
-
createHandleRecord
public static AbstractResponse createHandleRecord(java.lang.String handle, HandleValue[] values, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site) throws HandleException
- Throws:
HandleException
-
updateEntireHandleRecord
public static AbstractResponse updateEntireHandleRecord(java.lang.String handle, HandleValue[] values, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site) throws HandleException
- Throws:
HandleException
-
unhomePrefix
public static AbstractResponse unhomePrefix(java.lang.String prefix, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site) throws HandleException
- Throws:
HandleException
-
homePrefix
public static AbstractResponse homePrefix(java.lang.String prefix, HandleResolver resolver, AuthenticationInfo authInfo, SiteInfo site) throws HandleException
- Throws:
HandleException
-
throwIfNotSuccess
public static void throwIfNotSuccess(AbstractResponse response) throws HandleException
- Throws:
HandleException
-
-