@Activate public void activate(BundleContext bundleContext) { // This config property will be read by Carbon-Security-Component only once at @Activate. // Hence need to set before activating Carbon-Security-Component. //TODO: Check once carbon-security component is adapted Startup-Order-Resolver System.setProperty("java.security.auth.login.config", Utils.getCarbonConfigHome().resolve("security").resolve("carbon-jaas.config").toString() ); }
public static List<String> loadStreamDefinitionXML() throws DataBridgeConfigurationException { List<String> streamDefinitionList = new ArrayList<String>(); // String carbonHome = System.getProperty(ServerConstants.CARBON_CONFIG_DIR_PATH); // String path = carbonHome + File.separator + DataBridgeConstants.DATA_BRIDGE_DIR + // File.separator + DataBridgeConstants.STREAM_DEFINITIONS_XML; String path = Utils.getCarbonHome().toString() + File.separator + "deployment" + File.separator + "stream-definitions.yaml"; Yaml yaml = new Yaml(); File file = new File(path); try { FileInputStream fileInputStream = new FileInputStream(file); Map<String, List<String>> streams = (Map<String, List<String>>) yaml.load(fileInputStream); streamDefinitionList.addAll(streams.get(DataBridgeConstants.STREAM_DEFINITIONS_ELEMENT)); } catch (FileNotFoundException e) { log.error("File " + path + " could not be found", e); } return streamDefinitionList; } }
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings("DMI_NONSERIALIZABLE_OBJECT_WRITTEN") public static void backUpOauthData(Map<String, OAuthApplication> applications, Map<String, OAuthApplication> appsByClientId) { String backUpPath = Utils.getCarbonHome() + File.separator + "database" + File.separator; FileOutputStream fos = null; ObjectOutputStream oos = null; try { fos = new FileOutputStream(backUpPath + "applications.data"); oos = new ObjectOutputStream(fos); oos.writeObject(applications); oos.close(); fos = new FileOutputStream(backUpPath + "appsByClientId.data"); oos = new ObjectOutputStream(fos); oos.writeObject(appsByClientId); } catch (IOException e) { log.error("Error while backing up token data", e); } finally { if (oos != null) { try { oos.close(); } catch (IOException e) { log.error("Error while closing the stream", e); } } } }
@Activate protected void init() { if (Boolean.parseBoolean(SystemVariableUtil.getValue(METRICS_ENABLED, Boolean.FALSE.toString()))) { String dataAgentConfigPath = SystemVariableUtil.getValue(METRICS_REPORTING_DAS_DATAAGENTCONFIGPATH, Utils.getCarbonConfigHome() + File.separator + "data-bridge" + File.separator + "data-agent-conf.xml"); System.setProperty(METRICS_REPORTING_DAS_DATAAGENTCONFIGPATH, dataAgentConfigPath); Metrics.init(MetricReporter.JMX, MetricReporter.DAS); } }
public static Map<String, OAuthApplication> getBackedUpData(String fileName) { String backUpPath = Utils.getCarbonHome() + File.separator + "database" + File.separator + fileName; File file = new File(backUpPath); if (!file.exists()) { return new HashMap<>(); } ObjectInputStream ois = null; Map<String, OAuthApplication> applications = null; try { FileInputStream fis = new FileInputStream(backUpPath); ois = new ObjectInputStream(fis); applications = (Map) ois.readObject(); } catch (IOException e) { log.error("Error while getting backed up token data", e); } catch (ClassNotFoundException e) { log.error("Error while getting backed up token data", e); } finally { if (ois != null) { try { ois.close(); } catch (IOException e) { log.error("Error while closing the stream", e); } } } return applications; }
@Activate protected void init() { if (Boolean.parseBoolean(SystemVariableUtil.getValue(HTTP_MONITORING_ENABLED, Boolean.FALSE.toString()))) { String dataAgentConfigPath = SystemVariableUtil.getValue(HTTP_MONITORING_DAS_DATAAGENTCONFIGPATH, Utils.getCarbonConfigHome() + File.separator + "data-bridge" + File.separator + "data-agent-conf.xml"); System.setProperty(HTTP_MONITORING_DAS_DATAAGENTCONFIGPATH, dataAgentConfigPath); HTTPMonitoringDataPublisher.init(); } }
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings("DMI_NONSERIALIZABLE_OBJECT_WRITTEN") public static void backUpTokenData() { String backUpPath = Utils.getCarbonHome() + File.separator + "database" + File.separator; FileOutputStream fos = null; ObjectOutputStream oos = null; try { fos = new FileOutputStream(backUpPath + "token.data"); oos = new ObjectOutputStream(fos); oos.writeObject(tokenMap); oos.close(); fos = new FileOutputStream(backUpPath + "refresh.data"); oos = new ObjectOutputStream(fos); oos.writeObject(refreshTokenMap); oos.close(); } catch (FileNotFoundException e) { log.error("Error while backing up token data", e); } catch (IOException e) { log.error("Error while backing up token data", e); } finally { if (oos != null) { try { oos.close(); } catch (IOException e) { log.error("Error while closing the stream", e); } } } }
private static void getBackedUpTokenData(String fileName) { String backUpPath = Utils.getCarbonHome() + File.separator + "database" + File.separator + fileName; File file = new File(backUpPath); if (!file.exists()) {
(currentBatchSize * 1000) / (endTime - startTime) + " Total Event Count : " + totalEventCounter + " \n"; File file = new File(Utils.getCarbonHome() + File.separator + "receiver-perf.txt"); if (!file.exists()) { log.info("Creating the performance measurement file at : " + file.getAbsolutePath());