WLST define array in properties file and access in WLST

Hi Guys,
Just had a question, I am developing WLST script to configure WebLogic manage server instances and want to do in much way that user need to update properties file and then WLST/python reads it and logic in the script will configure # of manage server instances specified in properties file..
properties.txt:
mserver = ['MS1','MS2','Ms3'] ## define array in properties file
WLST.py ( i am having trouble reading array from properties.txt)
from jarray import array
load('properties.txt') # load the properties file in script
Is there standard way I can read array from the file the way we do normal variable.. or any new suggestions will highly be welcomed?
Regards..

You don't have to define you parameter as an array (a=['one'],['two'], etc) at the properties file. I think that this is a good way to do what you want:
file.prop file >
var=one two threewlst file >
loadProperties('file.prop')
sepVar=String(var).split(" ")
for i in sepVar:
  print "- Separated var: " + iIt should print something like
- Separated var: one
- Separated var: two
- Separated var: threeEdited by: 904641 on Mar 29, 2012 2:38 PM

Similar Messages

  • Need to Put Some data in Properties File and Access it

    HI Friends,
    I want to store the data (servername,User id ) in Archana.properties file from WebDYnpro Application
    Pls let e know where to place the properties file and also let me know how to access the properties file from WD application and Modify it.
    I have tried placing in: src/mimes, Configuration etc...but i am unale to access it.
    Also If i access the properties file and update it, do i again need to deploy the WD application.
    Kindly let me know if there are any better methods to store key value pairs from the application.
    Regards,
    Archana

    HI,
    The better approch will be to store the .properties file into a known folder manually created in the server  where the Application is deployed?
    That means where?
    Itried placing my .prpoerties file at several places in my Project(Not server)- Mimes, Configuration, Packages.
    I tried the same kind of  code u specifed.
    But the file.exists returns false, though there is a file in the location.
    When i am trying with javaproject, it works but in webdynpro project, its says file not found
    Below is the code:
    package com.sap.demo.casestudy.wd;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.util.Properties;
    public class ReadWriteArc {
    @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              WriteProperty("Key3", "Value3");
              String value=ReaddProperty("key2");
         public static void WriteProperty(String key,String value) {
              try {
                        Properties pro = new Properties();
                        File f = new File("C:/Users/i067753/workspace/720/workspaceSetUp.jdi/LocalDevelopment/DCs/demo.sap.com/casestudy/_comp/src/configuration/Archana.Properties");
                        //File f = new File("C:/Users/i067753/workspace/720/workspaceSetUp.jdi/LocalDevelopment/DCs/demo.sap.com/casestudy/_comp/src/mimes/Components/com.sap.demo.casestudy.wd.comp.webdynproappln.WebDynproAppln/Archana.Properties");
                        //File f = new File("C:/Users/i067753/workspace/720/workspaceSetUp.jdi/LocalDevelopment/DCs/demo.sap.com/casestudy/_comp/src/packages/com/sap/demo/casestudy/wd/Archana.Properties");
                        if (!f.exists()) {
                             System.out.println("File not found!");
                        } else {
                             FileInputStream in = new FileInputStream(f);
                             pro.load(in);
                             pro.setProperty(key, value);
                             pro.store(new FileOutputStream("Properties"), null);
                             System.out.println("Operation completly successfuly!");
               catch (IOException e) {
                   System.out.println(e.getMessage());
         public static String ReaddProperty(String key) {
              try {
                   String valuemessage=null;
                        Properties pro = new Properties();
                        File f = new File("C:/Users/i067753/workspace/720/workspaceSetUp.jdi/LocalDevelopment/DCs/demo.sap.com/casestudy/_comp/src/configuration/Archana.Properties");
                        //File f = new File("C:/Users/i067753/workspace/720/workspaceSetUp.jdi/LocalDevelopment/DCs/demo.sap.com/casestudy/_comp/src/mimes/Components/com.sap.demo.casestudy.wd.comp.webdynproappln.WebDynproAppln/Archana.Properties");
                        //File f = new File("C:/Users/i067753/workspace/720/workspaceSetUp.jdi/LocalDevelopment/DCs/demo.sap.com/casestudy/_comp/src/packages/com/sap/demo/casestudy/wd/Archana.Properties");
                        if (!f.exists()) {
                             System.out.println("File not found!");
                        } else {
                             FileInputStream in = new FileInputStream(f);
                             pro.load(in);
                              valuemessage = pro.getProperty(key);
                             System.out.println("Read completly successfuly! and the value is "+valuemessage);
                        return valuemessage;
               catch (IOException e) {
                   System.out.println(e.getMessage());
               return null;
    And from WD Application i called the class as:
    ReadWriteArc.WriteProperty(engname, reserveEngine1);
    Pls suggest if am making any mistake here
    U say Server, how can i do that?
    Regards,
    Archana:)

  • I used MobileMe/idisk to hold all of my files and access from my iPad.  It worked beautifully.  What is the best way to do that now?

    I used MobileMe/idisk to hold all of my files and access from my iPad.  It worked beautifully.  What is the best way to do that now?
    In particular, I am having issues with documents that already exist on my Mac and trying to get my iPad to access them. 

    A popular option seems to be DropBox.

  • War file and access control with WebLogic

    I am trying to put some access control on different files in my war-file, but just can't get it to work... It seems like all roles defined in weblogic.properties gives the user access to all files in the war. I just don't understand the connections between the security realm, the weblogicURL.policy file and the web.xml file... If I do not specify a weblogic.security.URLAclFile, no access control is done at all.
    This is how my weblogic.properties file looks like:
    weblogic.security.URLAclFile=e:\\weblogic\\weblogicURL.policy
    weblogic.password.koko=kokokoko
    weblogic.password.arnebelinda=arne1234
    weblogic.security.group.ppuseradmins=arnebelinda
    and my weblogicURL.policy:
    deny Principal weblogic.security.acl.GroupImpl "everyone" {
    Permission weblogic.security.acl.URLAcl "weblogic.url", "/admin/-";
    and finally, my web.xml-file:
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
         <session-config>
              <session-timeout>30</session-timeout>
         </session-config>
         <welcome-file-list>
              <welcome-file>index.jsp</welcome-file>
         </welcome-file-list>
         <security-constraint>
              <web-resource-collection>
                   <web-resource-name>admin</web-resource-name>
                   <url-pattern>index.jsp</url-pattern>          </web-resource-collection>
              <auth-constraint>
                   <role-name>ppuseradmins</role-name>
              </auth-constraint>
         </security-constraint>
         <login-config>
              <auth-method>BASIC</auth-method>
              <realm-name>WebLogic Server</realm-name>
         </login-config>
         <security-role>
              <role-name>ppuseradmins</role-name>
         </security-role>
    </web-app>
    it does not matter which user is part of the ppuseradmins group. The user koko is not a member, but is given access to my whole .war anyway (after submitting correct username/password). Omitting the <realm-name> does not seem to work either; the default realm is not used, instead null is used.
    Does anybody have a clue? I would really appreciate it!
    I am using WebLogic 5.1 sp 9
    best regards,
    PJ

    In you pocily file entry, you have specified "/admin/-"
    However, in the <security-constraint> element in web.xml, your <url-pattern> is not set to /admin
    Could that be the problem ?

  • War file and access control

              I am trying to put some access control on different files in my war-file, but just
              can't get it to work... It seems like all roles defined in weblogic.properties
              gives the user access to all files in the war. I just don't understand the connections
              between the security realm, the weblogicURL.policy file and the web.xml file...
              If I do not specify a weblogic.security.URLAclFile, no access control is done
              at all.
              This is how my weblogic.properties file looks like:
              weblogic.security.URLAclFile=e:\\weblogic\\weblogicURL.policy
              weblogic.password.koko=kokokoko
              weblogic.password.arnebelinda=arne1234
              weblogic.security.group.ppuseradmins=arnebelinda
              and my weblogicURL.policy:
              deny Principal weblogic.security.acl.GroupImpl "everyone" {
              Permission weblogic.security.acl.URLAcl "weblogic.url", "/admin/-";
              and finally, my web.xml-file:
              <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
              "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
              <web-app>
              <session-config>
              <session-timeout>30</session-timeout>
              </session-config>
              <welcome-file-list>
              <welcome-file>index.jsp</welcome-file>
              </welcome-file-list>
              <security-constraint>
              <web-resource-collection>
              <web-resource-name>admin</web-resource-name>
              <url-pattern>index.jsp</url-pattern> </web-resource-collection>
              <auth-constraint>
              <role-name>ppuseradmins</role-name>
              </auth-constraint>
              </security-constraint>
              <login-config>
              <auth-method>BASIC</auth-method>
              <realm-name>WebLogic Server</realm-name>
              </login-config>
              <security-role>
              <role-name>ppuseradmins</role-name>
              </security-role>
              </web-app>
              it does not matter which user is part of the ppuseradmins group. The user koko
              is not a member, but is given access to my whole .war anyway (after submitting
              correct username/password). Omitting the <realm-name> does not seem to work either;
              the default realm is not used, instead null is used.
              Does anybody have a clue? I would really appreciate it!
              I am using WebLogic 5.1 sp 9
              best regards,
              PJ
              

    In you pocily file entry, you have specified "/admin/-"
    However, in the <security-constraint> element in web.xml, your <url-pattern> is not set to /admin
    Could that be the problem ?

  • Loading a CSV file and accessing the variables

    Hi guys,
    I'm new to AS3 and dealt with AS2 before (just getting the grasp when the change it).
    Is it possible in AS3 to load an excel .csv file into Flash using the URLLoader (or ???) and the data as variables?
    I can get the .csv to load and trace the values (cell1,cell2,cell3....) but I'm not sure how to collect the data and place it into variables.
    Can I just create an array and access it like so.... myArray[0], myArray[1]? If so, I'm not sure why it's not working.
    I must be on the completely wrong path. Here's what I have so far....
    var loader:URLLoader = new URLLoader();
    loader.dataFormat = URLLoaderDataFormat.VARIABLES;
    loader.addEventListener(Event.COMPLETE, dataLoaded);
    var request:URLRequest = new URLRequest("population.csv");
    loader.load(request);
    function dataLoaded(evt:Event):void {
        var myData:Array = new Array(loader.data);
        trace(myData[i]);
    Thanks for any help,
    Sky

    just load your csv file and use the flash string methods to allocate those values to an array:
    var myDate:Array = loader.data.split(",");

  • Problems with properties files and war files in weblogic 5.1

              I work with WebLogic 5.1 and I'm trying to deploy a web application which gets
              a properties file. If I deploy it as an expanded directory hierarchy (with the
              properties files into WEB-INF/classes) I have no problems. While deploying it
              by a .war file I get this message: "en_GB java.util.MissingResourceException:
              Can't find resource for base name Agent, locale en " (the getBundle() method is
              trying to get an english property file). What could I do? Is it really a weblogic
              5.1 bug?
              Thanks,
              David
              

    This issue comes up repeatably. It's a real bug.
              I believe this problem was fixed in a 5.1 service pack, but I'm trying to
              find out the exact disposition of the issue. Noone seems to be complaining
              about this under 6.x, so a fix seems to have been made, the only question is
              whether or not it got back-ported to a 5.1 service pack.
              Gary
              david <[email protected]> wrote in message
              news:3ac4a39a$[email protected]..
              >
              > I work with WebLogic 5.1 and I'm trying to deploy a web application which
              gets
              > a properties file. If I deploy it as an expanded directory hierarchy (with
              the
              > properties files into WEB-INF/classes) I have no problems. While deploying
              it
              > by a .war file I get this message: "en_GB
              java.util.MissingResourceException:
              > Can't find resource for base name Agent, locale en " (the getBundle()
              method is
              > trying to get an english property file). What could I do? Is it really a
              weblogic
              > 5.1 bug?
              > Thanks,
              > David
              

  • Special characters from textfield to properties file and back

    Hi,
    The character "o with two dots above it" is being read from a file into a String then written to a proerties file.
    It is stored in the proerties file as \uFFFD
    When I read this character from the proerties file, and place it in a JTextField, it is displayed as a box character.
    Is the character \uFFFD a box ?, or is the corruption happening in the JTextField ?
    So my question is,
    Is the Properties object useless or is the JTextfield useless ?
    Cheers

    \uFFFD is a replacement character; it is the substitute for characters that could not be converted to Unicode. This means that the problem is most likely in the code where you read the original file, in effect, that the character encoding you are using to read is different from the encoding of the text file.
    Can you post the code where you read the file? It should look something like this if the original file is encoded in UTF-8:
    http://javaalmanac.com/egs/java.io/ReadFromUTF8.html

  • Array in Properties File

    I thought I could make a properties file that looked like this:
    my.array.values=blah
    my.array.values=blah blah
    my.array.values=oh blahbady blah...then I can get the properties out as an array. Did I just imaging that or something? How would I get an array in a properties file?

    You'll either have to write your own or find one on the web.
    %yeah, i was afraid of that
    for now i might do comma delimited string entry in props file
    i don't want to parse xml or write anything special for this

  • How can configure .properties file and  log4j on weblogic 8.1 SP5

    Hi,
    I know this is not right forum for post this question.But I hope I'll get my perfect answer here.
    I have 2 questions.
    1. Where I'll keep my .properties file in weblogic 8.1 SP 5. means I have one own .properties file which is contains some proxy settings and this .properties resides on .war file(now), But I want move this propeties file outside .war file. So Where I'll keep in weblogic 8.1 SP 5.
    2. How can we configure log4j in weblogic?
    Please reply me.
    Regards,
    Pattanaik

    You can add your.properties and log4j.properties to the classpath cant you?
    You just need to edit setEnv.cmd (if i remember correctly) in your weblogic server folder to add the folder containing the properties files to the classpath variable.

  • How to save a 4D Array in a File and load it later on?

    Hello,
    I am trying to save a 4D Array (Array[4000] [3] [20] [5]) of UINT in a File. I can do it through "write in binary File". But then I can´t load it. I know I can transform my Array down to 1D Array of 1.200.000 Elements (4000*3*20*5) of UINT. When I load it, I have to transform it back (with a lot of "for-looping") back to 4D. But is there an easier way of doing that?
    I was not able to find a solution in this forum - I am sorry if I made a new thread if there is already a solution in this forum.
    Best regards
    LabVIEW 2011
    Solved!
    Go to Solution.

    As Lynn said, there should be no extra code required.
    When writing, make sure that "prepend size" is true (true is default) and when reading, wire an empty 4D array of the correct representation to the "data type" input.
    (I also assume that your LabVIEW version is not extremely ancient)
    LabVIEW Champion . Do more with less code and in less time .

  • I have 5 different flash files that i am trying to insert all in one file and access them through 5 buttons. please shoot any advice or just the name of the actionscript 2.0. thank you.

    i am doing an assignment for my class and i need to insert all of my 5 different flash files into one and create 5 buttons apply related actionscript 2 in order to play a particular animation. please help me out. thank you.

    Provide the name of the program you are using so a Moderator may move this message to the correct program forum
    The Cloud is not a program, it is a delivery process... a program would be Photoshop or Lighroom or Muse or ???

  • Loading external SWF fila and accessing variables/functions

    Hello everybody!
    My first post here. Actually I do search google for answers all the time, but now - it's tough one.
    public function loadScreen(swf:File):void {
         _content = swf;
         var swfBytes:ByteArray = new ByteArray();
         var file:File = _content;  
         var loadStream:FileStream = new FileStream();
              loadStream.open( file, FileMode.READ );
              loadStream.readBytes( swfBytes );
              loadStream.close();
         var loader:Loader = new Loader();
         var loaderContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
              loaderContext.allowLoadBytesCodeExecution = true;
              loader.loadBytes( swfBytes, loaderContext);
              loader.contentLoaderInfo.addEventListener(Event.INIT, accessSWF);
              loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
    public function errorHandler(e:Event):void {
         trace("PROBLEM LOADING BYTES");
    public function accessSWF(e:Event):void {
         var moduleLoader:LoaderInfo = LoaderInfo(e.target);
         moduleLoader.content.addEventListener(Event.INIT, readyHandler);
    public function readyHandler(e:Event):void {
         _initOptions = new NativeWindowInitOptions();
         with(_initOptions) {
              resizable = true;
              transparent = false;
         var boundsWin:Rectangle = new Rectangle(100, 100, 423, 430);
         _window = new NativeWindow(_initOptions);
         with(_window) {
              activate();
              bounds = boundsWin;
              stage.scaleMode = "noScale";
    The problem is that application loads the external swf with loadBytes, but it's not executing the script. Actually, I'm not able to use the loaded swf. I'm not able even to add it to Stage. But message in output still shows, that the swf file is loaded "[SWF] file.swf/[[DYNAMIC]]/1 - 2746 bytes after decompression"
    There are many solutions for this problem on the internet, but they're old (written in 2008 most of all) and not working either, because those solutions work only in older AIR versions
    Any help?

    Well I got a bit further:
    public function loadScreen(swf:File):void {
         var loadStream:FileStream = new FileStream();
         with(loadStream) {
              openAsync( swf, FileMode.READ );
              addEventListener(ProgressEvent.PROGRESS, loadProgress);
              addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
              addEventListener(Event.COMPLETE, loadComplete);
    public function loadProgress(e:ProgressEvent):void {
         trace("Loading " + e.target.bytesAvailable);
    public function errorHandler(e:IOErrorEvent):void {
         trace("Error ");
    public function loadComplete(e:Event):void {
         var swfBytes:ByteArray = new ByteArray();
         FileStream(e.target).readBytes( swfBytes );
         var loaderContext:LoaderContext = new LoaderContext();
         with(loaderContext) {
              allowLoadBytesCodeExecution = true;
         var loader:Loader = new Loader();
         with(loader) {
              loadBytes( swfBytes, loaderContext);
              contentLoaderInfo.addEventListener(Event.INIT, completedSWF);
    public function completedSWF(e:Event):void {
         var moduleLoader:LoaderInfo = LoaderInfo(e.target);
         moduleLoader.addEventListener(Event.COMPLETE, initiatedFinally);
    public function initiatedFinally(e:Event):void {
         _initOptions = new NativeWindowInitOptions();
         with(_initOptions) {
              resizable = true;
              transparent = false;
         var boundsWin:Rectangle = new Rectangle(100, 100, 423, 430);
         _window = new NativeWindow(_initOptions);
         with(_window) {
              activate();
              bounds = boundsWin;
              stage.scaleMode = "noScale";
         var loader:Loader = e.target.loader;
         loader.addEventListener(Event.ADDED_TO_STAGE, irAdded);
         _window.stage.addChild(loader);
    public function irAdded(e:Event):void {
         trace(e.target.content.vars); // Object Dictionary
    At this point ( function irAdded ) I'm able to retrieve external SWF's variables. But stil, it's not visible on the stage. And yet - there's another problem - rendering the same script , every second time application unloads the external swf movie.

  • Error reading Properties file

    I have a main method which i am using to call a servlet located in the same Development Component. Until recently i had the servlet location hard coded and it was working without issues. Now i decided to make the location configurable. For this i created an sap.application.global.properties file in the EAR DC which contains the WAR of this DC.
    The contents of the above file are as follows:
    SAP application properties
    SERVLET.LOCATION=http://<server-name>/ControllerServlet/servlet/com.nike.xapps.eqptsp.swem.controller.ControllerServlet
    The code i am using in the main method to call this properties file and access the property is as follows:
    Context ctx = new InitialContext();
    ApplicationConfigHandlerFactory cfgHdlr = (ApplicationConfigHandlerFactory)ctx.lookup("ApplicationConfiguration");          
    Properties props = cfgHdlr.getApplicationProperties();
    String servlet = props.getProperty("SERVLET.LOCATION");
    contained in a try...catch block.
    On dubugging i get a NoInitialContextException repeatedly in the statement where the lookup is performed.
    These are all the additions i have made for reading this properties file. Does anyone know if there is anything more that needs to be done for this to work.
    Thanks,
    Murtaza.

    thank for the help mangst. i guess the IO approach is also applicable ^^; i changed my code to:
    configFile.load( new FileInputStream( ".\\resources\\config.properties" ) );but i had a little trouble in debugging it since it starts the file search from the main project directory. however it works fine upon deployment. ^^; thanks again.
    Edited by: xnofate on Sep 23, 2008 6:21 PM

  • WEB-INF and properties files

    okay, this may be really naive and maybe i'm missing some key piece of
    documentation, but i'm missing something regarding the file structure with
    iplanet enterprise 4.1 on solaris.
    in my /usr/local/netscape/suitespot there's a docs directory that is the
    default docs directory.
    I've created a /WEB-INF directory under docs and a /classes directory under
    that. I've placed a jay.properties file in the /WEB-INF/classes directory,
    but when I try to access that through a servlet instantiated bean, I get an
    error from the ResourceBundle call, telling me that it can't load that
    properties file.
    I have two questions:
    1. did i build the WEB-INF directory in the correct place (ie - is this the
    standard way of working under the iplanet server) - this doesn't seem to be
    supported by the admin server in the sense that i can browse this directory,
    when i'd expect that iplanet would build in some basic security around the
    WEB-INF directory
    2. what do i name and where do i put the properties file? should it be
    jay_en.properties? i've tried a number of different scenarios with no luck.
    thanks...
    jay

    Why would you create a WEB-INF directory on the web tier?
    WEB-INF is a directory with a special meaning to the web container. All
    of your properties files and such will need to be placed on the
    application server tier, in the WEB-INF directory that was automatically
    created there. And you can do that just be properly placing them in the
    WAR file.
    David
    Jay Wright wrote:
    > okay, this may be really naive and maybe i'm missing some key piece
    > of documentation, but i'm missing something regarding the file
    > structure with iplanet enterprise 4.1 on solaris.
    >
    > in my /usr/local/netscape/suitespot there's a docs directory that is
    > the default docs directory.
    >
    > I've created a /WEB-INF directory under docs and a /classes
    > directory under that. I've placed a jay.properties file in the
    > /WEB-INF/classes directory, but when I try to access that through a
    > servlet instantiated bean, I get an error from the ResourceBundle
    > call, telling me that it can't load that properties file.
    >
    > I have two questions: 1. did i build the WEB-INF directory in the
    > correct place (ie - is this the standard way of working under the
    > iplanet server) - this doesn't seem to be supported by the admin
    > server in the sense that i can browse this directory, when i'd
    > expect that iplanet would build in some basic security around the WEB-INF
    > directory
    >
    > 2. what do i name and where do i put the properties file? should it
    > be jay_en.properties? i've tried a number of different scenarios
    > with no luck.
    >
    > thanks... jay
    >
    >
    >

Maybe you are looking for