private void loadAllIIInstance() throws IOException { ResourceStore store = getStore(); List<String> paths = store.collectResourceRecursively(ResourceStore.II_RESOURCE_ROOT, ".json"); logger.debug("Loading II from folder " + store.getReadableResourcePath(ResourceStore.II_RESOURCE_ROOT)); for (String path : paths) { loadIIInstance(path); } logger.debug("Loaded " + paths.size() + " II(s)"); }
private void saveResource(IIInstance ii) throws IOException { ResourceStore store = getStore(); store.putResource(ii.getResourcePath(), ii, II_SERIALIZER); this.afterIIUpdated(ii); }
private synchronized IIInstance loadIIInstance(String path) throws IOException { ResourceStore store = getStore(); logger.debug("Loading IIInstance " + store.getReadableResourcePath(path)); IIInstance IIInstance = null; try { IIInstance = store.getResource(path, IIInstance.class, II_SERIALIZER); IIInstance.setConfig(config); if (StringUtils.isBlank(IIInstance.getName())) throw new IllegalStateException("IIInstance name must not be blank"); iiMap.putLocal(IIInstance.getName(), IIInstance); for (IISegment segment : IIInstance.getSegments()) { usedStorageLocation.add(segment.getName()); } return IIInstance; } catch (Exception e) { logger.error("Error during load ii instance " + path, e); return null; } }
private void loadAllIIInstance() throws IOException { ResourceStore store = getStore(); List<String> paths = store.collectResourceRecursively(ResourceStore.II_RESOURCE_ROOT, ".json"); logger.debug("Loading II from folder " + store.getReadableResourcePath(ResourceStore.II_RESOURCE_ROOT)); for (String path : paths) { reloadIILocalAt(path); } logger.debug("Loaded " + paths.size() + " II(s)"); }
private synchronized IIInstance reloadIILocalAt(String path) throws IOException { ResourceStore store = getStore(); logger.debug("Loading IIInstance " + store.getReadableResourcePath(path)); IIInstance ii = null; try { ii = store.getResource(path, IIInstance.class, II_SERIALIZER); ii.setConfig(config); if (StringUtils.isBlank(ii.getName())) throw new IllegalStateException("IIInstance name must not be blank"); iiMap.putLocal(ii.getName(), ii); for (IISegment segment : ii.getSegments()) { usedStorageLocation.put(ii.getName().toUpperCase(), segment.getStorageLocationIdentifier()); } return ii; } catch (Exception e) { logger.error("Error during load ii instance " + path, e); return null; } }
private void removeII(IIInstance ii) throws IOException { getStore().deleteResource(ii.getResourcePath()); iiMap.remove(ii.getName()); }
public void updateII(IIInstance ii) throws IOException { logger.info("Updating II instance : " + ii.getName()); getStore().putResource(ii.getResourcePath(), ii, II_SERIALIZER); iiMap.put(ii.getName(), ii); //this is a duplicate call to take care of scenarios where REST cache service unavailable ProjectManager.getInstance(KylinConfig.getInstanceFromEnv()).clearL2Cache(); }