• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Policy File

 
Gurpreet Saini
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi reader,
Do I grant "all permissions" to my policy file or supply it with certain parameters ?. Secondly, I do feel to retrieve the name of Server before binding the object with rmiregistry at the time of starting the server.. What opinion do you hold about this issue, please let me know.
Thank you,
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gurpreet,

Do I grant "all permissions" to my policy file or supply it with certain parameters ?.

That's the safest thing to do and that's what I and most others have done. You won't lose any points for granting full permission, so take advantage of that fact.

Secondly, I do feel to retrieve the name of Server before binding the object with rmiregistry at the time of starting the server..

If you mean the name of the service that clients use to look up your server, there's only one reason I can see for doing that: security. The client would also have to be supplied with the name at runtime. Furthermore, if you plan on supplying the name on the command line, you will be going contrary to the instructions which say you may only use the following command line parameters:
  • DNS name of the server
  • Port number used by the server
  • Data file name(s)
  • java.rmi.server.codebase
  • security manager policy file


  • So that leaves you with creating a properties file to extract the name of the service. So my advise would be to create a public static constant that holds the name of the service and use that instead.
    Hope this helps,
    Michael Morris
     
    John Smith
    Ranch Hand
    Posts: 2937
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Secondly, I do feel to retrieve the name of Server before binding the object with rmiregistry at the time of starting the server.

    You don't need the name of the server to bind an object to registry.
    registry.rebind("yourServiceName", yourRemoteObject);
    Eugene.
     
    Gurpreet Saini
    Ranch Hand
    Posts: 295
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi eugene,
    I mean to say the name of server is required to retrieve as, it is necessary for the client to hook witht the server. For example :
    rmi://<Server Name>:<port>/object refname
    As, for the server name, dont you suggest that it is not always neccessary that it would be localhost. Apart from localhost there can be any name of machine where examiner would require the server to run. For, that case I was speaking of retrieving of the server name. Please give suggestions on this issue.
    Thank you,
     
    John Smith
    Ranch Hand
    Posts: 2937
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    I mean to say the name of server is required to retrieve as, it is necessary for the client to hook witht the server. For example :
    rmi://<Server Name>:<port>/object refname

    Ok, but that doesn't mean that you should somehow retreve the name of the server programmatically. When your client program starts, the name of the server should either be passed as a command line parameter or the user should specify it before (s)he can be connected to the server. It's just like JavaRanch server, -- you can get great services from here, but you must know the site URL.
    Eugene.
     
    Jim Bedenbaugh
    Ranch Hand
    Posts: 171
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Do we really need a policy file? Isn't that a leftover of the project before they changed it to the current requirements?
     
    Michael Morris
    Ranch Hand
    Posts: 3451
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Jim,
    It's all according to whether or not you will need to load RMI stubs dynamically, use a port lower than 1024, or engage in some other risky behaviour. I used one on the server, even though it was probably not necessary. If both client and server run fine without a policy file in all possible configurations (taking into consideration optional command line parameters) then don't use one and don't worry about it.
    Hope this helps,
    Michael Morris
     
    Jim Bedenbaugh
    Ranch Hand
    Posts: 171
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Originally posted by Michael Morris:
    Hi Jim,
    It's all according to whether or not you will need to load RMI stubs dynamically, use a port lower than 1024, or engage in some other risky behaviour.

    I'm married. . .all my risky behavior ceased over 20 years ago
    Anyway, thanks for the response. I went ahead and implemented a policy file for the server and client. I force the use of port 1099 (the default) and I don't dynamically load the stubs, so I really don't have to have it, but the practice was good anyway.
    The only reason I asked was because it was in the list of possible parameters. I figured if it was there, they probably meant for you to use it.

    I think I'm finally done. I will be posting my final implementation solution either later today or tommorrow. . .just to make sure I haven't completely missed something or improperly implemented because I didn't understand the requirements.
    Any comments you might have would be greatly appreciated.
    [ August 20, 2002: Message edited by: Jim Bedenbaugh ]
     
    Michael Morris
    Ranch Hand
    Posts: 3451
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Jim,

    I figured if it was there, they probably meant for you to use it.

    To quote Miss Motley my sixth grade teacher, "Better safe than sorry." That's always a good approach in life provided the addition doesn't result in unintended consequences. In this case it does not.
    As for as further comments before your upload, I'm sure you've gone thru the litany ten or more times. Make sure the Readme.txt is properly organzied, make sure you have your most recently built jars, make sure you have your most current source, etc. If you are like me, you will check it to the point of absurdity before you upload and you will still sweat bullets until you get the results. The little demons will taunt you with the things you may have left out or fogotten to mention in Readme. Take my advice, ignore them and as long as you have been conscientious you'll have your certification.
    Hope this helps,
    Michael Morris
     
    Gurpreet Saini
    Ranch Hand
    Posts: 295
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi konovo,
    Ok, but that doesn't mean that you should somehow retreve the name of the server programmatically.

    First, of all I am sorry as I was not able to answer, for the reason my internet was down. Now, to the buisness.
    So, you say it is "ok" to retrieve the name of the server programmatically. When examiner would run server code on machine. For client the examiner must know the server name, as he or she would supply from command line. In client case no need for retrieving server name. Just plug and play. Am I right ?.
    Thank yu,
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic