Hi Thanuja, If this file is not loading before this initScript runs.... can't we call this property file inside the initScript using java (We can write java inside a Jaggery) and then set the properties.... and then we can use Process method in jag to access the properties .. ???
Here's how we can read the property file using Java http://crunchify.com/java-properties-file-how-to-read-config-properties-values-in-java/ here is some other suggestions i came across.... they are not that reliable ... but FYI 1. http://stackoverflow.com/questions/19310951/how-to-read-a-properties-file-in-javascript-from-project-directory 2. http://stackoverflow.com/questions/20416185/read-properties-file-using-jquery-or-java-script 3. http://stackoverflow.com/questions/9665214/want-to-read-key-value-from-properties-file Regards, On Mon, Nov 9, 2015 at 1:42 PM, Thanuja Uruththirakodeeswaran < [email protected]> wrote: > Hi Manu, > > Metering dashboard url is in cartridge-config.properties file[1]. Is there > a way to read this property file directly using jaggery? > > I can load the file using carbon module (carbon.server.loadConfig( > 'cartridge-config.properties');). But don't know how to read a property > within this file. > > [1]. > https://github.com/wso2/product-private-paas/blob/master/products/ppaas/modules/distribution/src/main/conf/cartridge-config.properties > > Thanks. > > On Mon, Nov 9, 2015 at 7:00 AM, Manuranga Perera <[email protected]> wrote: > >> as I understand metering Dashboard URL is not read from a file. is that >> correct? if you can read it from a file it's the better way to go. >> >> On Fri, Nov 6, 2015 at 3:28 PM, Nipuna Chandradasa <[email protected]> >> wrote: >> >>> Hi, >>> >>> May be we can try loading this property file in the app.js (Init script >>> as we discuss earlier). >>> But if that is not working the best way is to put a timeout. Because we >>> have no any other way to get these properties in the init script. >>> >>> Let's ask manu is there any better way to do this using jaggery ?? ... >>> (If we can read the property file without too much file processing) >>> >>> adding manu .... >>> >>> Regards, >>> >>> On Fri, Nov 6, 2015 at 2:28 PM, Thanuja Uruththirakodeeswaran < >>> [email protected]> wrote: >>> >>>> Hi All, >>>> >>>> In the current implementation, we are reading dasStatsPublisherEnabled >>>> and meteringDashboardUrl in login.jag file [1] and adding them to session. >>>> But since these values are common to all users, we should read these values >>>> at web application startup and add them to application object. So I tried >>>> to do that in web application initScripts js file (app.js) [2] as follows: >>>> >>>> var carbon = require('carbon'), >>>> process = require('process'), >>>> server = new carbon.server.Server(), >>>> conf = carbon.server.loadConfig('thrift-client-config.xml'), >>>> dasConfig = conf. *::['config']. *::['das'], >>>> dasStatsPublisherEnabled = false; >>>> >>>> >>>> for (var i = 0; i < dasConfig.node.length(); i++) { >>>> dasStatsPublisherEnabled = >>>> dasConfig.node[i].statsPublisherEnabled.text(); >>>> if (dasStatsPublisherEnabled == true) { >>>> break; >>>> } >>>> } >>>> application.put("dasStatsPublisherEnabled",dasStatsPublisherEnabled); >>>> >>>> setTimeout(function(){ >>>> application.put("meteringDashboardUrl", >>>> process.getProperty("das.metering.dashboard.url")) >>>> },30000); >>>> >>>> We can read thirift-client-config.xml file and adding >>>> dasStataPublisherEnabled variable to application without any problems. But >>>> we have problem in reading metering dashboard url which is in >>>> cartridge-config.properties at web app initialization. >>>> >>>> Here since* webapp is started before stratos-manager component gets >>>> activated (which reads cartridge-config.properties file and set values in >>>> that file as system properties [3])*, we need to have a timeout to >>>> wait for stratos-manager component to be activated before reading >>>> meteringDashboardUrl using jaggery process module. >>>> >>>> Is there a better way to do this without having a timeout? Please give >>>> your suggestions. >>>> >>>> [1]. >>>> https://github.com/wso2/product-private-paas/blob/master/components/org.wso2.ppaas.manager.console/console/controllers/login/login.jag >>>> [2]. >>>> https://github.com/wso2/product-private-paas/blob/master/components/org.wso2.ppaas.manager.console/console/app.js >>>> [3]. >>>> https://github.com/apache/stratos/blob/stratos-4.1.x/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/StratosManagerServiceComponent.java#L117 >>>> >>>> Thanks. >>>> -- >>>> Thanuja Uruththirakodeeswaran >>>> Software Engineer >>>> WSO2 Inc.;http://wso2.com >>>> lean.enterprise.middleware >>>> >>>> mobile: +94 774363167 >>>> >>>> _______________________________________________ >>>> Dev mailing list >>>> [email protected] >>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>> >>>> >>> >>> >>> -- >>> Nipuna Marcus >>> *Software Engineer* >>> WSO2 Inc. >>> http://wso2.com/ - "lean . enterprise . middleware" >>> Mobile : +94 (0) 713 667906 >>> [email protected] >>> >> >> >> >> -- >> With regards, >> *Manu*ranga Perera. >> >> phone : 071 7 70 20 50 >> mail : [email protected] >> > > > > -- > Thanuja Uruththirakodeeswaran > Software Engineer > WSO2 Inc.;http://wso2.com > lean.enterprise.middleware > > mobile: +94 774363167 > -- Nipuna Marcus *Software Engineer* WSO2 Inc. http://wso2.com/ - "lean . enterprise . middleware" Mobile : +94 (0) 713 667906 [email protected]
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
