7 Replies Latest reply on Mar 4, 2015 4:20 PM by Bill Robinson

    FileManagerModel copyFileToFileServer questions

    Narahari Lakshminarayana

      Friends:

       

      I am trying to use the FileManagerModel copyFileToFileServer call from inside of the Webservices.

       

      I takes 4 args.

       

      1. path ==> path of the local file

      2. prefix ==>  this is the prefix for the file on file server

      3. category ==> com.bladelogic.om.infra.app.service.file.FileServerStorageCategory

      4. preserveName ==> Boolean

       

      The question is for the 3rd parameter aka com.bladelogic.om.infra.app.service.file.FileServerStorageCategory.

       

      How do I construct that object on the Webservice client ?

       

      Any inputs is highly appreciated.

       

      -Narahari

        • 1. Re: FileManagerModel copyFileToFileServer questions
          Bill Robinson

          You don’t – you need to write a wrapper xml blcli command that creates what you need and calls this.

           

          What are you trying to do ?  why do you need to copy a file to the file server via webservices ?

          • 2. Re: Re: FileManagerModel copyFileToFileServer questions
            Narahari Lakshminarayana

            Thanks for your time Bill.

             

            I am using Jenkins for the user to type in the parameters for the NSH job.  They don't know it is for NSHScript Job.  They just type them.

             

            I capture the data and put that to a file on the Jenkins box.  I then run the web services program which accepts the parameters file as input.

             

            The format of the file containing the parameters is

            RPM_FILE_DIR=/tmp/pa128

            TAR_FILE_DIR=/tmp/tar128

            ....

            ...

             

            I currently read the file inside my java file and turn the data that you see above to the string that looks like

            RPM_FILE_DIR=/tmp/pa128:TAR_FILE_DIR=/tmp/tar128:......

             

            I then pass that covered string as an argument to my own job and the job knows what to do with this passed string.

             

            It parses the argument and extracts the diff pieces of data and then uses the extracted data to be used in  other invoked BL jobs.

             

            I am not a fan of  having to read the file, build the string pass it to the server and parse it on the other side.

             

            If possible I would like to pass the file that I build from jenkins using the FileManagerModel copyFileToFileServer approach.

             

            Hope my requirements make sense, if not provide a viable alternative please.

             

            -Narahari

            • 3. Re: Re: FileManagerModel copyFileToFileServer questions
              Bill Robinson

              so it works like:

              -> user generates file w/ stuff in it.

              -> your process finds this file(s) and builds an argument list

              -> copy the generated file(s) to the file server

              -> your process calls a bsa jobs and somehow passes the argument list (how?) to this job (of what type) and then this job reads the files copied to the file server and then calls other jobs (of what type) w/ the values in the file(s) ?

               

              what are all of these jobs doing ?

              • 4. Re: FileManagerModel copyFileToFileServer questions
                Narahari Lakshminarayana

                Bill:

                 

                Thank you for correcting me.  You are correct I am  able to call my own NSHScriptJob with the

                 

                Job executeAndWait <jobDBKey>

                 

                But I am unable to pass an argument to this job.

                 

                I  set the job params separately and then execute it.

                 

                If this FileManagerModel copyFileToFileServer  works then I should be able to transfer a file from the webservices client machine to the BL server.

                 

                What is the process to write " to write a wrapper xml blcli command" so I can make my BL NSHScriptJobs usable from both inside of BLA console and also from inside of WebServices.

                 

                Can you provide some kind of tutorial doc/video to write a wrapper xml blcli command" ?

                 

                -Narahari

                • 5. Re: FileManagerModel copyFileToFileServer questions
                  Bill Robinson

                  ok - so from your other posts you are doing some ws calls to set the nsh params, and some of those params will refer to a file on the file server to read ?

                   

                  why can't you read the tmp file directly and set the params w/ what is in the files instead of doing it in the round-about way?  eg you have RPM_FILE_DIR=/tmp/pa128, what's in /tmp/pa128 ?

                  • 6. Re: FileManagerModel copyFileToFileServer questions
                    Narahari Lakshminarayana

                    Yes I wan to set parameters from a file, but unfortunately I am unable to copy file from the WebService Client machine (in this case the jenkins box) to the BL-WebServices box.

                     

                    What I am trying to  do is to find a way to get my file across to the BL server. 

                     

                    What is the process to write " to write a wrapper xml blcli command"

                    -Narahari

                    • 7. Re: FileManagerModel copyFileToFileServer questions
                      Bill Robinson

                      'bl-webservices' box is the bsa appserver ?  what i'm saying is if you can just set the params directly based on what is in the  tmp files you generate why not do that instead of setting params to read the files you put on the appserver.

                       

                      to write the xml file take a look at the existing files in NSH/br/xml/cli - you'll make a new one of those named like <namespace>-<randomstring>-Additional.xml - so like FileManager-Narahari-Additional.xml or something and put it in NSH/br/xml/cli and NSH/br/server_xml/cli.  there should be some info here: Unreleased blcli commands and documentation

                       

                      i'm not sure if that filemanager command will work because i'm not sure how to build the 'category' object.  maybe the FileTransferr.pushFileToAppServer will do it ?

                       

                      i still think it would make more sense to set the params directly instead of copying a file up to the appserver.