private static Map<String, ModelSkullBase> getModels() {
Map<String, ModelSkullBase> modelMap = Maps.newHashMap();
modelMap.put("enderman_skull", ModelSkullBase.Enderman.getInstance());
modelMap.put("frienderman_skull", ModelSkullBase.Frienderman.getInstance());
modelMap.put("enderman_evolved_skull", ModelSkullBase.Enderman2.getInstance());
return modelMap;
}
java类com.google.common.collect.Maps的实例源码
TileBlockSkull.java 文件源码
项目:EndermanEvolution
阅读 22
收藏 0
点赞 0
评论 0
PrintMessageFile.java 文件源码
项目:saluki
阅读 39
收藏 0
点赞 0
评论 0
private Map<String, Pair<DescriptorProto, List<FieldDescriptorProto>>> transform(
DescriptorProto sourceMessageDesc) {
Map<String, Pair<DescriptorProto, List<FieldDescriptorProto>>> nestedFieldMap =
Maps.newHashMap();
sourceMessageDesc.getNestedTypeList().forEach(new Consumer<DescriptorProto>() {
@Override
public void accept(DescriptorProto t) {
nestedFieldMap.put(t.getName(),
new ImmutablePair<DescriptorProto, List<FieldDescriptorProto>>(t, t.getFieldList()));
}
});
return nestedFieldMap;
}
UserServiceImpl.java 文件源码
项目:Equella
阅读 36
收藏 0
点赞 0
评论 0
@Override
public Map<String, String[]> getAdditionalLogonState(HttpServletRequest request)
{
Map<String, String[]> extraState = Maps.newHashMap();
Collection<UserManagementLogonFilter> filters = getCurrentState().filters;
for( UserManagementLogonFilter filter : filters )
{
filter.addStateParameters(request, extraState);
}
return extraState;
}
HiveTestDataGenerator.java 文件源码
项目:dremio-oss
阅读 30
收藏 0
点赞 0
评论 0
private HiveTestDataGenerator(final String dbDir, final String whDir) {
this.dbDir = dbDir;
this.whDir = whDir;
config = Maps.newHashMap();
config.put("hive.metastore.uris", "");
config.put("javax.jdo.option.ConnectionURL", String.format("jdbc:derby:;databaseName=%s;create=true", dbDir));
config.put("hive.metastore.warehouse.dir", whDir);
config.put(FileSystem.FS_DEFAULT_NAME_KEY, "file:///");
}
TestFileChannelFormatRegression.java 文件源码
项目:flume-release-1.7.0
阅读 20
收藏 0
点赞 0
评论 0
/**
* This is regression test with files generated by a file channel
* with the FLUME-1432 patch.
*/
@Test
public void testFileFormatV2postFLUME1432()
throws Exception {
TestUtils.copyDecompressed("fileformat-v2-checkpoint.gz",
new File(checkpointDir, "checkpoint"));
for (int i = 0; i < dataDirs.length; i++) {
int fileIndex = i + 1;
TestUtils.copyDecompressed("fileformat-v2-log-" + fileIndex + ".gz",
new File(dataDirs[i], "log-" + fileIndex));
}
Map<String, String> overrides = Maps.newHashMap();
overrides.put(FileChannelConfiguration.CAPACITY, String.valueOf(10));
overrides.put(FileChannelConfiguration.TRANSACTION_CAPACITY,
String.valueOf(10));
channel = createFileChannel(overrides);
channel.start();
Assert.assertTrue(channel.isOpen());
Set<String> events = takeEvents(channel, 1);
Set<String> expected = new HashSet<String>();
expected.addAll(Arrays.asList(
(new String[]{
"2684", "2685", "2686", "2687", "2688", "2689", "2690", "2691"
})));
compareInputAndOut(expected, events);
}
BackupRestoreUtil.java 文件源码
项目:dremio-oss
阅读 30
收藏 0
点赞 0
评论 0
private static Map<String, BackupFileInfo> scanInfoFiles(FileSystem fs, Path backupDir) throws IOException {
final Map<String, BackupFileInfo> tableToInfo = Maps.newHashMap();
final FileStatus[] backupFiles = fs.listStatus(backupDir, BACKUP_INFO_FILES_GLOB);
for (FileStatus backupFile : backupFiles) {
final String tableName = getTableName(backupFile.getPath().getName(), BACKUP_INFO_FILE_SUFFIX);
// read backup info file
final byte[] headerBytes = new byte[(int) backupFile.getLen()];
IOUtils.readFully(fs.open(backupFile.getPath()), headerBytes, 0, headerBytes.length);
final BackupFileInfo backupFileInfo = new BackupFileInfo();
ProtostuffUtil.fromJSON(headerBytes, backupFileInfo, BackupFileInfo.getSchema(), false);
tableToInfo.put(tableName, backupFileInfo);
}
return tableToInfo;
}
LtiConsumerUserStateHook.java 文件源码
项目:Equella
阅读 18
收藏 0
点赞 0
评论 0
/**
* The workaround for Moodle and Canvas OAuth.<br>
* If we have a duplicate, and it came from Moodle, it's worth presuming a
* different reality applies. Hopefully by version moodle-3 they'll have
* fixed this. ext_lms for moodle 2.3, 2.4, 2.5 was literally "moodle-2".
* Use startsWith in case future moodle 2.x has an extended string. Read:
* Dodgical hax
*
* @param request
* @return
*/
@Override
protected OAuthMessage getOAuthMessage(HttpServletRequest request)
{
boolean dupe = false;
String extlms = request.getParameter(ExternalToolConstants.EXT_LMS);
String product = request.getParameter(ExternalToolConstants.TOOL_CONSUMER_INFO_PRODUCT_FAMILY_CODE);
Set<Entry<String, String[]>> params = request.getParameterMap().entrySet();
Map<String, String> newParams = Maps.newHashMap();
if( "canvas".equalsIgnoreCase(product)
|| (extlms != null && extlms.startsWith("moodle-2") && "moodle".equalsIgnoreCase(product))
//hack for canvas ContentItemPlacements
|| (request.getParameter("lti_message_type") != null
&& request.getParameter("lti_message_type").equals("ContentItemSelectionRequest")) )
{
for( Entry<String, String[]> p : params )
{
String[] values = p.getValue();
if( values.length == 2 && Objects.equal(values[0], values[1]) )
{
dupe = true;
}
newParams.put(p.getKey(), values[0]);
}
if( dupe )
{
return new OAuthMessage(request.getMethod(), urlService.getUriForRequest(request, null).toString(),
newParams.entrySet());
}
}
return OAuthServlet.getMessage(request, urlService.getUriForRequest(request, null).toString());
}
ClientDatanodeProtocolTranslatorPB.java 文件源码
项目:hadoop
阅读 27
收藏 0
点赞 0
评论 0
@Override
public ReconfigurationTaskStatus getReconfigurationStatus() throws IOException {
GetReconfigurationStatusResponseProto response;
Map<PropertyChange, Optional<String>> statusMap = null;
long startTime;
long endTime = 0;
try {
response = rpcProxy.getReconfigurationStatus(NULL_CONTROLLER,
VOID_GET_RECONFIG_STATUS);
startTime = response.getStartTime();
if (response.hasEndTime()) {
endTime = response.getEndTime();
}
if (response.getChangesCount() > 0) {
statusMap = Maps.newHashMap();
for (GetReconfigurationStatusConfigChangeProto change :
response.getChangesList()) {
PropertyChange pc = new PropertyChange(
change.getName(), change.getNewValue(), change.getOldValue());
String errorMessage = null;
if (change.hasErrorMessage()) {
errorMessage = change.getErrorMessage();
}
statusMap.put(pc, Optional.fromNullable(errorMessage));
}
}
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
return new ReconfigurationTaskStatus(startTime, endTime, statusMap);
}
TestStorageBasedHiveAuthorization.java 文件源码
项目:dremio-oss
阅读 20
收藏 0
点赞 0
评论 0
private static Map<String, String> getHivePluginConfig() {
final Map<String, String> hiveConfig = Maps.newHashMap();
hiveConfig.put(METASTOREURIS.varname, hiveConf.get(METASTOREURIS.varname));
hiveConfig.put(FS_DEFAULT_NAME_KEY, dfsConf.get(FS_DEFAULT_NAME_KEY));
hiveConfig.put(HIVE_SERVER2_ENABLE_DOAS.varname, hiveConf.get(HIVE_SERVER2_ENABLE_DOAS.varname));
hiveConfig.put(METASTORE_EXECUTE_SET_UGI.varname, hiveConf.get(METASTORE_EXECUTE_SET_UGI.varname));
return hiveConfig;
}
ItemOverride.java 文件源码
项目:CustomWorldGen
阅读 26
收藏 0
点赞 0
评论 0
protected Map<ResourceLocation, Float> makeMapResourceValues(JsonObject p_188025_1_)
{
Map<ResourceLocation, Float> map = Maps.<ResourceLocation, Float>newLinkedHashMap();
JsonObject jsonobject = JsonUtils.getJsonObject(p_188025_1_, "predicate");
for (Entry<String, JsonElement> entry : jsonobject.entrySet())
{
map.put(new ResourceLocation((String)entry.getKey()), Float.valueOf(JsonUtils.getFloat((JsonElement)entry.getValue(), (String)entry.getKey())));
}
return map;
}