Sponsored Content
Top Forums Programming Remote login UNIX box from java passing parameters to the custom script called in the profile Post 302993905 by grabbitmedia on Thursday 16th of March 2017 05:35:35 AM
Old 03-16-2017
Question Nice Question

Passing object as parameter to method?
Passing object as parameter to Constructor?
In the above two cases it’s the same thing. You didn’t ask the difference between the parameter and constructor, so not gonna dig into that. Constructor is just a special kind of method that has the same name as that of the class.
Passing objects as parameters simply means you are giving some custom datatype value, any value to the method or constructor, for the code inside this method to use.
You make any custom object. You pass this object to your function, for it’s code to work upon. This, in summary, means Passing object as parameter.
and using object as argument inside invoking method or constructor?
Parameters and arguments are mostly used interchangeably. In most texts, and mostly all concepts, they mean the same thing. The fundamental difference is that parameters are the variables defined in the function definition, arguments are the values being passed to the function definition in function call statement.
The language of this part of your question is kinda confusing, but in essence, I think it means that using the object to invoke a function

Last edited by RudiC; 03-16-2017 at 06:43 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing parameters form unix to Oracle procedure

Hi, I have screen which was desined in PL/SQL Catridges in apps. In that screen some enterable fields these values r the passing parameters to create value sets, functions, menus etc in apps by using front end screens. Now in that screen i have a button. when i click that button it have to... (0 Replies)
Discussion started by: rajasekharamy
0 Replies

2. Shell Programming and Scripting

passing a variables value from the called script to calling script using ksh

How do i get the value of the variable from the called script(script2) to the calling script(script1) in ksh ? I've given portion of the script here to explain the problem. Portion of Script 1 ============= ----- ----- tmp=`a.ksh p1 p2 p3` if then # error processing fi -----... (10 Replies)
Discussion started by: rajarkumar
10 Replies

3. Linux

How to find remote Linux box login account without login in to that box?

Hi, How to find remote Linux box login account without login in to that box? I don't have login account at my remote Linux box. But I need who are all having login account. How do I findout? Thanks, --Muthu. (3 Replies)
Discussion started by: Muthuselvan
3 Replies

4. Shell Programming and Scripting

Passing unix variable to oracle parameters

Please help me how to pass some unix vairable to oracle. I have used below , but not displaying passed (inval) value. calling() { sqlplus -s $1/$2@$3 <<EOF begin exec call_sql($4); end; exit EOF } calling user pwd inst value1... (17 Replies)
Discussion started by: Jairaj
17 Replies

5. UNIX for Advanced & Expert Users

Why only partiial shell script got executed when called in Java

I'm trying to call shell scripts from Java for DB operations. Using a very simple test, for some reason, one line of (ALTER TABLE) in the shell simply won't be executed while the exit value from the call is "0" (valid exit). When I run the script directly in Unix, it gets executed perfectly fine!!... (4 Replies)
Discussion started by: zmwang
4 Replies

6. Shell Programming and Scripting

Issues for script that login to a unix box

Hi, I have a script that should login to a different box then the box that i am in and run the commands. I have the script sample below that logins to a unix box and get the files .Looks like ls-lrt command is not running or its wrongly used. #!/bin/bash # Ask the user for build month... (5 Replies)
Discussion started by: learninguser235
5 Replies

7. Shell Programming and Scripting

Passing the value of variable which is read from command line in called script

Hi, I am calling a Perl script in my shell script. When Perl script is executed it asks for a answer to be entered by user from terminal. How can i pass that value from my shell script ?? I know I can change perl script to default the answer but i dont have access to do that so only option i... (5 Replies)
Discussion started by: varun22486
5 Replies

8. Shell Programming and Scripting

Passing variable from called script to the caller script

Hi all, Warm regards! I am in a difficult situation here. I have been trying to create a shell script which calls another shell script inside. Here is a simplified version of the same. Calling Script. #!/bin/ksh # want to run as a different process... (6 Replies)
Discussion started by: LoneRanger
6 Replies

9. Shell Programming and Scripting

Notify when the script run(hourly)on my jump-box only when there is a failure on my remote-box

Team, Presently I have a script, which i have set up cron on one of my Jump-boxes,and gives me the output on every hourly basis,fetching the data from the remote machine.Basically it gives me the list of all active users logged and its count once we execute the script.Here the count is... (6 Replies)
Discussion started by: whizkidash
6 Replies

10. Shell Programming and Scripting

Getopt eval set parameters not happening when the script is called through an application!

Hi, There is an Informatica tool through which unix scripts can be called. Now the requirement in my project is that a parent script calls a child script but this parent script has to be called through the Informatica tool. In Parent script I'm using TEMP=`getopt -o x:y: -l area:,volume:... (1 Reply)
Discussion started by: Panna
1 Replies
LockedFile(3pm) 					User Contributed Perl Documentation					   LockedFile(3pm)

NAME
IO::LockedFile - supply object methods for locking files SYNOPSIS
use IO::LockedFile; # create new locked file object. $file will hold a file handle. # if the file is already locked, the method will not return until the # file is unlocked my $file = new IO::LockedFile(">locked1.txt"); # when we close the file - it become unlocked. $file->close(); # suppose we did not have the line above, we can also delete the # object, and the file is automatically unlocked and closed. $file = undef; DESCRIPTION
In its simplistic use, the IO::LockedFile class gives us the same interface of the IO::File class with the unique difference that the files we deal with are locked using the Flock mechanism (using the "flock" function). If during the running of the process, it crashed - the file will be automatically unlocked. Actually - if the IO::LockedFile object goes out of scope, the file is automatically closed and unlocked. So, if you are just interested in having locked files with "flock", you can skip most of the documentation below. If, on the other hand, you are interested in locking files with other schemes then Flock, or you want to control the behavior of the locking (having non blocking lock for example), read on. Actually the class IO::LockedFile is kind of abstract class. Why abstract? Because methods of this class call the methods "lock" and "unlock". But those methods are not really implemented in this class. They suppose to be implemented in the derived classes of IO::LockedFile. Why "kind" of abstract? Because the constructor of this class will return an object! How abstract class can create objects? This is done by having the constructor returning object that is actually an object of one of the derived classes of IO::LockedFile. So by default the constructor of IO::LockedFile will return an object of IO::LockedFile::Flock. For example, the following: use IO::LockedFile; $lock = new IO::LockedFile(">bla"); print ref($lock); Will give: IO::LockedFile::Flock So what are the conclusions here? First of all - do not be surprised to get object of derived class from the constructor of IO::LockedFile. Secondly - by changing the default behavior of the constructor of IO::LockedFile, we can get object of other class which means that we have a locked file that is locked with other scheme. The default behavior of the constructor is determined by the global options. We can access this global options, or the options per object using the method "set_option" and "get_option". We can set the global options in the use line: use IO::LockedFile 'Flock'; # set the default scheme to be Flock use IO::LockedFile ( scheme => Flock ); We can also set the options of a new object by passing the options to the constructor, as we will see below. We can change the options of an existing object by using the "set_option" method. Which options are available? scheme The scheme let us define which derived class we use for the object we create. See below which derived classes are available. The default scheme is 'Flock'. block The block option can be 1 or 0 (true or false). If it is 1, a call to the "open" method or to the constructor will be blocked if the file we try to open is already locked. This means that those methods will not return till the file is unlocked. If the value of the block option is 0, the "open" and the constructor will return immediately in any case. If the file is locked, those methods will return undef. The default value of the block option is 1. lock The lock option can be 1 or 0 (true or false). It defines if the file we open when we create the object will be opened locked. Sometimes, we want to have a file that can be locked, yet we do not want to open it locked from the beginning. For example if we want to print into a log file, usually we want to lock that file only when we print into it. Yet, it might be that when we open the file in the beginning we do not print into it immediately. In that case we will prefer to open the file as unlocked, and later we will lock it when needed. The default value of the lock option is 1. There might be extra options that are used by one of the derived classes. So according to the scheme you choose to use, please look in the manual page of the class that implement that scheme. Finally, some information that is connected to a certain scheme will be found in the classes that are derived from this class. For example, compatibility issues will be discussed in each derived classes. The classes that currently implement the interface that IO::LockedFile defines are: o IO::LockedFile::Flock CONSTRUCTOR
new ( FILENAME [,MODE [,PERMS]] ) Creates an object that belong to one of the derived classes of "IO::LockedFile". If it receives any parameters, they are passed to the method "open". if the "open" fails, the object is destroyed. Otherwise, it is returned to the caller. The object will be the file handle of that opened file. new ( OPTIONS, FILENAME [,MODE [,PERMS]] ) This version of the constructor is the same as above, with the difference that we send as the first parameter a reference to a hash - OPTIONS. This hash let us change for this object only, the options from the default options. So for example if we want to change the lock option from its default we can do it as follow: $file = new IO::LockedFile( { lock => 0 }, ">locked_later.txt" ); METHODS
open ( FILENAME [,MODE [,PERMS]] ) The method let us open the file FILENAME. By default, the file will be opened as a locked file, and if the file that is opened is already locked, the method will not return until the file is unlocked. Of course this default behavior can be controlled by setting other options. The object will be the file handle of that opened file. The parameters that should be provided to this method are the same as the parameters that the method "open" of IO::File accepts. (like ">file.txt" for example). Note that the open method checks if the file is opened for reading or for writing, and only then calls the lock method of the derived class that is being used. This way, for example, when using the Flock scheme, the lock will be a shared lock for a file that is being read, and exclusive lock for a file that is opened to be write. close ( ) The file will be closed and unlocked. The method returns the same as the close method of IO::File. lock ( ) Practically this method does nothing, and returns 1 (true). This method will be overridden by the derived class that implements the scheme we use. When it is overridden, the method suppose to lock the file according to the scheme we use. If the file is already locked, and the block option is 1 (true), the method will not return until the file is unlocked, and locked again by the method. If the block option is 0 (false), the method will return 0 immediately. Besides, the lock method is aware if the file was opened for reading or for writing. Thus, for example, when using the Flock scheme, the method will create a shared lock for a file that is being read, and exclusive lock for a file that is opened to be write. unlock ( ) Practically this method does nothing, and returns 1 (true). This method will be overridden by the derived class that implements the scheme we use. When it is overridden, the method suppose to unlock the file according to the scheme we use, and return 1 (true) on success and 0 (false) on failure. have_lock ( ) Will return 1 (true) if the file is already locked by this object. Will return 0 (false) otherwise. Note that this will not tell us anything about the situation of the file itself - thus we should not use this method in order to check if the file is locked by someone else. print ( ) This method is exactly like the "print" method of IO::Handle, with the difference that when using this method, if the file is unlocked, then before printing to it, it will be locked and afterward it will be unlocked. truncate ( ) This method is exactly like the "truncate" method of IO::Handle, with the difference that when using this method, if the file is unlocked, then before truncating it, it will be locked and afterward it will be unlocked. is_writable ( ) This method will return 1 (true) if the file was opened to write. Will return 0 (false) otherwise. should_block ( ) This method will return 1 (true) if the block option set to 1. Will return 0 (false) otherwise. should_lock ( ) This method will return 1 (true) if the lock option set to 1. Will return 0 (false) otherwise. get_scheme ( ) This method will return the name of the scheme that is currently used. AUTHORS
Rani Pinchuk, rani@cpan.org Rob Napier, rnapier@employees.org COPYRIGHT
Copyright (c) 2001-2002 Ockham Technology N.V. & Rani Pinchuk. All rights reserved. This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
IO::File(3), IO::LockedFile::Flock(3) perl v5.14.2 2012-05-19 LockedFile(3pm)
All times are GMT -4. The time now is 10:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy