/** * Get table extended info. Keys are defined in {@link MetadataConstants} * * @param tableName * @return */ public Map<String, String> getTableDescExd(String tableName) { String tableIdentity = tableName; Map<String, String> result = new HashMap<String, String>(); if (srcTableExdMap.containsKey(tableIdentity)) { Map<String, String> tmp = srcTableExdMap.get(tableIdentity); Iterator<Entry<String, String>> it = tmp.entrySet().iterator(); while (it.hasNext()) { Entry<String, String> entry = it.next(); result.put(entry.getKey(), entry.getValue()); } result.put(MetadataConstants.TABLE_EXD_STATUS_KEY, "true"); } else { result.put(MetadataConstants.TABLE_EXD_STATUS_KEY, "false"); } return result; }
public DataModelDesc createDataModelDesc(DataModelDesc dataModelDesc) throws IOException { String name = dataModelDesc.getName(); if (dataModelDescMap.containsKey(name)) throw new IllegalArgumentException("DataModelDesc '" + name + "' already exists"); return saveDataModelDesc(dataModelDesc); }
public DataModelDesc updateDataModelDesc(DataModelDesc desc) throws IOException { String name = desc.getName(); if (!dataModelDescMap.containsKey(name)) { throw new IllegalArgumentException("DataModelDesc '" + name + "' does not exist."); } return saveDataModelDesc(desc); }
private void reloadAllIIDesc() throws IOException { ResourceStore store = getStore(); logger.info("Reloading all II desc from folder " + store.getReadableResourcePath(ResourceStore.II_DESC_RESOURCE_ROOT)); iiDescMap.clear(); List<String> paths = store.collectResourceRecursively(ResourceStore.II_DESC_RESOURCE_ROOT, MetadataConstants.FILE_SURFIX); for (String path : paths) { logger.info("loading II Desc from path" + path); IIDesc desc; try { desc = loadIIDesc(path); } catch (Exception e) { logger.error("Error loading II desc " + path, e); continue; } if (!path.equals(desc.getResourcePath())) { logger.error("Skip suspicious desc at " + path + ", " + desc + " should be at " + desc.getResourcePath()); continue; } if (iiDescMap.containsKey(desc.getName())) { logger.error("Dup IIDesc name '" + desc.getName() + "' on path " + path); continue; } iiDescMap.putLocal(desc.getName(), desc); } logger.debug("Loaded " + iiDescMap.size() + " II desc(s)"); }
private void reloadAllCubeDesc() throws IOException { ResourceStore store = getStore(); logger.info("Reloading Cube Metadata from folder " + store.getReadableResourcePath(ResourceStore.CUBE_DESC_RESOURCE_ROOT)); cubeDescMap.clear(); List<String> paths = store.collectResourceRecursively(ResourceStore.CUBE_DESC_RESOURCE_ROOT, MetadataConstants.FILE_SURFIX); for (String path : paths) { CubeDesc desc; try { desc = loadCubeDesc(path); } catch (Exception e) { logger.error("Error loading cube desc " + path, e); continue; } if (path.equals(desc.getResourcePath()) == false) { logger.error("Skip suspicious desc at " + path + ", " + desc + " should be at " + desc.getResourcePath()); continue; } if (cubeDescMap.containsKey(desc.getName())) { logger.error("Dup CubeDesc name '" + desc.getName() + "' on path " + path); continue; } cubeDescMap.putLocal(desc.getName(), desc); } logger.debug("Loaded " + cubeDescMap.size() + " Cube(s)"); }
/** * Create a new IIDesc * * @param iiDesc * @return * @throws IOException */ public IIDesc createIIDesc(IIDesc iiDesc) throws IOException { if (iiDesc.getUuid() == null || iiDesc.getName() == null) throw new IllegalArgumentException(); if (iiDescMap.containsKey(iiDesc.getName())) throw new IllegalArgumentException("IIDesc '" + iiDesc.getName() + "' already exists"); iiDesc.init(getMetadataManager()); // Check base validation // Semantic validation // TODO iiDesc.setSignature(iiDesc.calculateSignature()); String path = iiDesc.getResourcePath(); getStore().putResource(path, iiDesc, II_DESC_SERIALIZER); iiDescMap.put(iiDesc.getName(), iiDesc); return iiDesc; }
/** * Update IIDesc with the input. Broadcast the event into cluster * * @param desc * @return * @throws IOException */ public IIDesc updateIIDesc(IIDesc desc) throws IOException { // Validate IIDesc if (desc.getUuid() == null || desc.getName() == null) { throw new IllegalArgumentException(); } String name = desc.getName(); if (!iiDescMap.containsKey(name)) { throw new IllegalArgumentException("IIDesc '" + name + "' does not exist."); } desc.init(getMetadataManager()); // TODO: Semantic validation desc.setSignature(desc.calculateSignature()); // Save Source String path = desc.getResourcePath(); getStore().putResource(path, desc, II_DESC_SERIALIZER); // Reload the IIDesc IIDesc ndesc = loadIIDesc(path); // Here replace the old one iiDescMap.put(ndesc.getName(), desc); return ndesc; }
if (cubeDesc.getUuid() == null || cubeDesc.getName() == null) throw new IllegalArgumentException(); if (cubeDescMap.containsKey(cubeDesc.getName())) throw new IllegalArgumentException("CubeDesc '" + cubeDesc.getName() + "' already exists");
if (!cubeDescMap.containsKey(name)) { throw new IllegalArgumentException("CubeDesc '" + name + "' does not exist.");
public DataModelDesc updateDataModelDesc(DataModelDesc desc) throws IOException { String name = desc.getName(); if (!dataModelDescMap.containsKey(name)) { throw new IllegalArgumentException("DataModelDesc '" + name + "' does not exist."); } return saveDataModelDesc(desc); }
/** * Get table extended info. Keys are defined in {@link MetadataConstants} * * @param tableName * @return */ public Map<String, String> getTableDescExd(String tableName) { String tableIdentity = tableName; Map<String, String> result = new HashMap<String, String>(); if (srcTableExdMap.containsKey(tableIdentity)) { Map<String, String> tmp = srcTableExdMap.get(tableIdentity); Iterator<Entry<String, String>> it = tmp.entrySet().iterator(); while (it.hasNext()) { Entry<String, String> entry = it.next(); result.put(entry.getKey(), entry.getValue()); } result.put(MetadataConstants.TABLE_EXD_STATUS_KEY, "true"); } else { result.put(MetadataConstants.TABLE_EXD_STATUS_KEY, "false"); } return result; }
public DataModelDesc createDataModelDesc(DataModelDesc dataModelDesc) throws IOException { String name = dataModelDesc.getName(); if (dataModelDescMap.containsKey(name)) throw new IllegalArgumentException("DataModelDesc '" + name + "' already exists"); return saveDataModelDesc(dataModelDesc); }
public StreamingConfig saveStreamingConfig(StreamingConfig streamingConfig) throws IOException { if (streamingConfig == null || StringUtils.isEmpty(streamingConfig.getName())) { throw new IllegalArgumentException(); } if (streamingMap.containsKey(streamingConfig.getName())) throw new IllegalArgumentException("StreamingConfig '" + streamingConfig.getName() + "' already exists"); String path = StreamingConfig.concatResourcePath(streamingConfig.getName()); getStore().putResource(path, streamingConfig, StreamingConfig.SERIALIZER); streamingMap.put(streamingConfig.getName(), streamingConfig); return streamingConfig; }
private void reloadAllIIDesc() throws IOException { ResourceStore store = getStore(); logger.info("Reloading all II desc from folder " + store.getReadableResourcePath(ResourceStore.II_DESC_RESOURCE_ROOT)); iiDescMap.clear(); List<String> paths = store.collectResourceRecursively(ResourceStore.II_DESC_RESOURCE_ROOT, MetadataConstants.FILE_SURFIX); for (String path : paths) { logger.info("loading II Desc from path" + path); IIDesc desc; try { desc = loadIIDesc(path); } catch (Exception e) { logger.error("Error loading II desc " + path, e); continue; } if (!path.equals(desc.getResourcePath())) { logger.error("Skip suspicious desc at " + path + ", " + desc + " should be at " + desc.getResourcePath()); continue; } if (iiDescMap.containsKey(desc.getName())) { logger.error("Dup IIDesc name '" + desc.getName() + "' on path " + path); continue; } iiDescMap.putLocal(desc.getName(), desc); } logger.debug("Loaded " + iiDescMap.size() + " II desc(s)"); }
private void reloadAllStreaming() throws IOException { ResourceStore store = getStore(); logger.info("Reloading Streaming Metadata from folder " + store.getReadableResourcePath(ResourceStore.STREAMING_RESOURCE_ROOT)); streamingMap.clear(); List<String> paths = store.collectResourceRecursively(ResourceStore.STREAMING_RESOURCE_ROOT, MetadataConstants.FILE_SURFIX); for (String path : paths) { StreamingConfig streamingConfig; try { streamingConfig = loadStreamingConfigAt(path); } catch (Exception e) { logger.error("Error loading streaming desc " + path, e); continue; } if (path.equals(streamingConfig.getResourcePath()) == false) { logger.error("Skip suspicious desc at " + path + ", " + streamingConfig + " should be at " + streamingConfig.getResourcePath()); continue; } if (streamingMap.containsKey(streamingConfig.getName())) { logger.error("Dup StreamingConfig name '" + streamingConfig.getName() + "' on path " + path); continue; } streamingMap.putLocal(streamingConfig.getName(), streamingConfig); } logger.debug("Loaded " + streamingMap.size() + " StreamingConfig(s)"); } }
private void reloadAllCubeDesc() throws IOException { ResourceStore store = getStore(); logger.info("Reloading Cube Metadata from folder " + store.getReadableResourcePath(ResourceStore.CUBE_DESC_RESOURCE_ROOT)); cubeDescMap.clear(); List<String> paths = store.collectResourceRecursively(ResourceStore.CUBE_DESC_RESOURCE_ROOT, MetadataConstants.FILE_SURFIX); for (String path : paths) { CubeDesc desc; try { desc = loadCubeDesc(path); } catch (Exception e) { logger.error("Error loading cube desc " + path, e); continue; } if (path.equals(desc.getResourcePath()) == false) { logger.error("Skip suspicious desc at " + path + ", " + desc + " should be at " + desc.getResourcePath()); continue; } if (cubeDescMap.containsKey(desc.getName())) { logger.error("Dup CubeDesc name '" + desc.getName() + "' on path " + path); continue; } cubeDescMap.putLocal(desc.getName(), desc); } logger.debug("Loaded " + cubeDescMap.size() + " Cube(s)"); }
/** * Update CubeDesc with the input. Broadcast the event into cluster * * @param desc * @return * @throws IOException */ public StreamingConfig updateStreamingConfig(StreamingConfig desc) throws IOException { // Validate CubeDesc if (desc.getUuid() == null || desc.getName() == null) { throw new IllegalArgumentException("SteamingConfig Illegal."); } String name = desc.getName(); if (!streamingMap.containsKey(name)) { throw new IllegalArgumentException("StreamingConfig '" + name + "' does not exist."); } // Save Source String path = desc.getResourcePath(); getStore().putResource(path, desc, STREAMING_SERIALIZER); // Reload the StreamingConfig StreamingConfig ndesc = loadStreamingConfigAt(path); // Here replace the old one streamingMap.put(ndesc.getName(), desc); return ndesc; }
/** * Create a new IIDesc * * @param iiDesc * @return * @throws IOException */ public IIDesc createIIDesc(IIDesc iiDesc) throws IOException { if (iiDesc.getUuid() == null || iiDesc.getName() == null) throw new IllegalArgumentException(); if (iiDescMap.containsKey(iiDesc.getName())) throw new IllegalArgumentException("IIDesc '" + iiDesc.getName() + "' already exists"); iiDesc.init(getMetadataManager()); // Check base validation // Semantic validation // TODO iiDesc.setSignature(iiDesc.calculateSignature()); String path = iiDesc.getResourcePath(); getStore().putResource(path, iiDesc, II_DESC_SERIALIZER); iiDescMap.put(iiDesc.getName(), iiDesc); return iiDesc; }
/** * Update IIDesc with the input. Broadcast the event into cluster * * @param desc * @return * @throws IOException */ public IIDesc updateIIDesc(IIDesc desc) throws IOException { // Validate IIDesc if (desc.getUuid() == null || desc.getName() == null) { throw new IllegalArgumentException(); } String name = desc.getName(); if (!iiDescMap.containsKey(name)) { throw new IllegalArgumentException("IIDesc '" + name + "' does not exist."); } desc.init(getMetadataManager()); // TODO: Semantic validation desc.setSignature(desc.calculateSignature()); // Save Source String path = desc.getResourcePath(); getStore().putResource(path, desc, II_DESC_SERIALIZER); // Reload the IIDesc IIDesc ndesc = loadIIDesc(path); // Here replace the old one iiDescMap.put(ndesc.getName(), desc); return ndesc; }
if (cubeDesc.getUuid() == null || cubeDesc.getName() == null) throw new IllegalArgumentException(); if (cubeDescMap.containsKey(cubeDesc.getName())) throw new IllegalArgumentException("CubeDesc '" + cubeDesc.getName() + "' already exists");