本文整理汇总了Java中net.handle.hdllib.Util.encodeString方法的典型用法代码示例。如果您正苦于以下问题:Java Util.encodeString方法的具体用法?Java Util.encodeString怎么用?Java Util.encodeString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.handle.hdllib.Util
的用法示例。
在下文中一共展示了Util.encodeString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildResolutionRequest
import net.handle.hdllib.Util; //导入方法依赖的package包/类
private ResolutionRequest buildResolutionRequest(final String handle) {
String handlePrefix = handle.substring(0,handle.indexOf("/"));
PublicKeyAuthenticationInfo auth = getAuthInfo(handlePrefix);
byte[][] types = null;
int[] indexes = null;
ResolutionRequest req =
new ResolutionRequest(Util.encodeString(handle),
types, indexes,
auth);
req.certify = false;
req.cacheCertify = true;
req.authoritative = false;
req.ignoreRestrictedValues = true;
return req;
}
开发者ID:pengchengluo,项目名称:Peking-University-Open-Research-Data-Platform,代码行数:18,代码来源:HandlenetServiceBean.java
示例2: createAdminRecord
import net.handle.hdllib.Util; //导入方法依赖的package包/类
/**
* Create the NA admin record for a new handle. The NA admin is provided
* all permissions bar ADD_NA and DELETE_NA
*
* @return AdminRecord
* an AdminRecord object representing the NA handle admin
* @param handle
* the NA admin handle in byte form
* @param idx
* the handle index the of the NA handle's HS_VLIST entry
*/
public AdminRecord createAdminRecord(String handle, int idx)
{
return new AdminRecord(Util.encodeString(handle),
idx,
AdminRecord.PRM_ADD_HANDLE,
AdminRecord.PRM_DELETE_HANDLE,
AdminRecord.PRM_NO_ADD_NA,
AdminRecord.PRM_NO_DELETE_NA,
AdminRecord.PRM_READ_VALUE,
AdminRecord.PRM_MODIFY_VALUE,
AdminRecord.PRM_REMOVE_VALUE,
AdminRecord.PRM_ADD_VALUE,
AdminRecord.PRM_MODIFY_ADMIN,
AdminRecord.PRM_REMOVE_ADMIN,
AdminRecord.PRM_ADD_ADMIN,
AdminRecord.PRM_LIST_HANDLES);
}
示例3: deleteValue
import net.handle.hdllib.Util; //导入方法依赖的package包/类
/**
* Delete a value from the handle
*
* @return boolean
* <code>true</code> if the value was deleted else <code>false</code>
* @param index
* the index of the value to delete
* @throws HandleException
*/
public boolean deleteValue(int index) throws HandleException
{
byte idHandle[] = Util.encodeString(Constants.NA_HANDLE_PREFIX + handleConfig.getPrefix());
PublicKeyAuthenticationInfo pubKeyAuthInfo = new PublicKeyAuthenticationInfo(idHandle,
Constants.SEC_KEY_IDX,
handleConfig.getPrivateKey());
RemoveValueRequest req = new RemoveValueRequest(Util.encodeString(this.getHandle()), index, pubKeyAuthInfo);
AbstractResponse response = resolver.getResolver().processRequest(req);
if (response.responseCode == AbstractMessage.RC_SUCCESS)
{
return true;
}
else
{
log.error("Error deleting handle value from handle " + getHandle() + ": " + AbstractMessage.getResponseCodeMessage(response.responseCode));
return false;
}
}
示例4: getAuthInfo
import net.handle.hdllib.Util; //导入方法依赖的package包/类
private PublicKeyAuthenticationInfo getAuthInfo(String handlePrefix) {
byte[] key = null;
String adminCredFile = System.getProperty("dataverse.handlenet.admcredfile");
key = readKey(adminCredFile);
PrivateKey privkey = null;
privkey = readPrivKey(key, adminCredFile);
String authHandle = getHandleAuthority(handlePrefix);
PublicKeyAuthenticationInfo auth =
new PublicKeyAuthenticationInfo(Util.encodeString(authHandle), 300, privkey);
return auth;
}
开发者ID:pengchengluo,项目名称:Peking-University-Open-Research-Data-Platform,代码行数:13,代码来源:HandlenetServiceBean.java
示例5: createHandle
import net.handle.hdllib.Util; //导入方法依赖的package包/类
/**
* Create a new handle record on the handle server
*
* @return AbstractResponse
* the handle server response to the create request
* @param HandleValue[]
* An array of HandleValue objects
* @throws HandleException
*/
private AbstractResponse createHandle(HandleValue[] hv) throws HandleException
{
byte idHandle[] = Util.encodeString(Constants.NA_HANDLE_PREFIX + handleConfig.getPrefix());
PublicKeyAuthenticationInfo pubKeyAuthInfo = new PublicKeyAuthenticationInfo(idHandle,
Constants.SEC_KEY_IDX,
handleConfig.getPrivateKey());
CreateHandleRequest req = new CreateHandleRequest(Util.encodeString(this.getHandle()), hv, pubKeyAuthInfo);
HandleResolver resolver = new HandleResolver();
resolver.traceMessages = true;
return resolver.processRequest(req);
}
示例6: modifyValue
import net.handle.hdllib.Util; //导入方法依赖的package包/类
/**
* Modify a handle value
*
* @return boolean
* <code>true</code> if the value was deleted else <code>false</code>
* @param index
* the index of the value to modify
* @param value
* a string value to replace the existing value
* @throws HandleException
*/
public boolean modifyValue(int index,
String value) throws HandleException
{
boolean modified = false;
HandleValue[] hv = getValues(index);
if (hv.length == 0)
{
return modified;
}
if (hv[0].getTypeAsString().equals("URL"))
{
if (!HandleSupport.isValidURL(value))
{
log.error("Invalid value for URL type: " + value);
return modified;
}
}
hv[0].setData(Util.encodeString(value));
hv[0].setTTL(Constants.DEFAULT_TTL);
byte idHandle[] = Util.encodeString(Constants.NA_HANDLE_PREFIX + handleConfig.getPrefix());
PublicKeyAuthenticationInfo pubKeyAuthInfo = new PublicKeyAuthenticationInfo(idHandle,
Constants.SEC_KEY_IDX,
handleConfig.getPrivateKey());
ModifyValueRequest req = new ModifyValueRequest(Util.encodeString(this.getHandle()), hv, pubKeyAuthInfo);
AbstractResponse response = resolver.getResolver().processRequest(req);
if (response.responseCode == AbstractMessage.RC_SUCCESS)
{
modified = true;
}
else
{
log.error("Error modifying handle value for " + getHandle() + ": " + AbstractMessage.getResponseCodeMessage(response.responseCode));
modified = false;
}
return modified;
}