private TableExtDesc convertOldTableExtToNewer(String resourceName) { ResourceStore store = getStore(); Map<String, String> attrs = Maps.newHashMap(); try { RawResource res = store.getResource( ResourceStore.TABLE_EXD_RESOURCE_ROOT + "/" + resourceName + MetadataConstants.FILE_SURFIX); InputStream is = res.content(); try { attrs.putAll(JsonUtil.readValue(is, HashMap.class)); } finally { if (is != null) is.close(); } } catch (IOException ex) { throw new RuntimeException(ex); } String cardinality = attrs.get(MetadataConstants.TABLE_EXD_CARDINALITY); // parse table identity from file name String tableIdentity = TableDesc.parseResourcePath(resourceName).getFirst(); TableExtDesc result = new TableExtDesc(); result.setIdentity(tableIdentity); result.setUuid(RandomUtil.randomUUID().toString()); result.setLastModified(0); result.setCardinality(cardinality); return result; }
tableExtDesc.setIdentity(tableDesc.getIdentity()); tableExtDesc.setUuid(RandomUtil.randomUUID().toString()); tableExtDesc.setLastModified(0);
tableExtDesc.setIdentity(tableDesc.getIdentity()); tableExtDesc.setUuid(RandomUtil.randomUUID().toString()); tableExtDesc.setLastModified(0);
tableExtDesc.setIdentity(tableDesc.getIdentity()); tableExtDesc.setUuid(UUID.randomUUID().toString()); tableExtDesc.setLastModified(0);
public TableExtDesc getTableExt(TableDesc t) { try (AutoLock lock = srcExtMapLock.lockForRead()) { TableExtDesc result = srcExtMap.get(mapKey(t.getIdentity(), t.getProject())); if (null == result) { //TODO: notice the table ext is not project-specific, seems not necessary at all result = srcExtMap.get(mapKey(t.getIdentity(), null)); } // avoid returning null, since the TableDesc exists if (null == result) { result = new TableExtDesc(); result.setIdentity(t.getIdentity()); result.setUuid(RandomUtil.randomUUID().toString()); result.setLastModified(0); result.init(t.getProject()); srcExtMap.putLocal(mapKey(t.getIdentity(), t.getProject()), result); } return result; } }
private TableExtDesc convertOldTableExtToNewer(String resourceName) { ResourceStore store = getStore(); Map<String, String> attrs = Maps.newHashMap(); try { RawResource res = store.getResource( ResourceStore.TABLE_EXD_RESOURCE_ROOT + "/" + resourceName + MetadataConstants.FILE_SURFIX); InputStream is = res.content(); try { attrs.putAll(JsonUtil.readValue(is, HashMap.class)); } finally { if (is != null) is.close(); } } catch (IOException ex) { throw new RuntimeException(ex); } String cardinality = attrs.get(MetadataConstants.TABLE_EXD_CARDINALITY); // parse table identity from file name String tableIdentity = TableDesc.parseResourcePath(resourceName).getFirst(); TableExtDesc result = new TableExtDesc(); result.setIdentity(tableIdentity); result.setUuid(RandomUtil.randomUUID().toString()); result.setLastModified(0); result.setCardinality(cardinality); return result; }
tableExtDesc.setIdentity(tableDesc.getIdentity()); tableExtDesc.setUuid(RandomUtil.randomUUID().toString()); tableExtDesc.setLastModified(0);
public TableExtDesc getTableExt(TableDesc t) { try (AutoLock lock = srcExtMapLock.lockForRead()) { TableExtDesc result = srcExtMap.get(mapKey(t.getIdentity(), t.getProject())); if (null == result) { //TODO: notice the table ext is not project-specific, seems not necessary at all result = srcExtMap.get(mapKey(t.getIdentity(), null)); } // avoid returning null, since the TableDesc exists if (null == result) { result = new TableExtDesc(); result.setIdentity(t.getIdentity()); result.setUuid(RandomUtil.randomUUID().toString()); result.setLastModified(0); result.init(t.getProject()); srcExtMap.putLocal(mapKey(t.getIdentity(), t.getProject()), result); } return result; } }