hey yunhee,

this implementation is a good start, but you need to put the property reading inside a constructor... there is a setter method in JschSftpProtocolFactory, and the way you have it, you will override any value set there by reading the java property in newInstance().

-brian

On Aug 08, 2012, at 08:10 AM, YunHee Kang <yunh.k...@gmail.com> wrote:

Hi Chris and Brian,

I really appreciate your advice. According to Brian's guideline, I
did do that as follows:
First off, I modified the method newInstance of the class
JschSftpProtocolFactory as follows:
public class JschSftpProtocolFactory implements ProtocolFactory {
public static final String PORT_PROPERTY =
"org.apache.oodt.cas.protocol.sftp.port";
private int port = -1;
public JschSftpProtocol newInstance() {

port = Integer.parseInt(System.getProperty(PORT_PROPERTY));
if (port > 0) {
return new JschSftpProtocol(port);
} else {
return new JschSftpProtocol();
}
}
}

Then I added the property PORT_PROPERTY to
push_pull_framework.properties as follows:
#set the port number of sftp
org.apache.oodt.cas.protocol.sftp.port=22

Thanks,
Yunhee

2012/8/8 Mattmann, Chris A (388J) <chris.a.mattm...@jpl.nasa.gov>:
> +1 from me, Brian!
>
> Cheers,
> Chris
>
> On Aug 6, 2012, at 11:15 AM, Brian Foster wrote:
>
>>
>> yunhee,
>>
>> let actually make the property name:
>>
>> org.apache.oodt.cas.protocol.jsch.sftp.port
>>
>> what you think chris?
>>
>> -brian
>>
>> On Aug 06, 2012, at 10:52 AM, Brian Foster <holeno...@mac.com> wrote:
>>
>>> hey yunhee,
>>>
>>> like chris said i would use the java properties he defined and modify the following class to set port to it by default to it:
>>>
>>> https://svn.apache.org/repos/asf/oodt/trunk/protocol/sftp/src/main/java/org/apache/oodt/cas/protocol/sftp/JschSftpProtocolFactory.java
>>>
>>> your change would probably look something like:
>>>
>>> public class JschSftpProtocolFactory implements ProtocolFactory {
>>>
>>> public static final String PORT_PROPERTY = "org.apache.oodt.cas.protocol.sftp.port";
>>>
>>> private int port;
>>>
>>> public JschSftpProtocolFactory() {
>>> port = System.getProperty(PORT_PROPERTY, -1);
>>> }
>>>
>>> ....
>>> }
>>>
>>> up can then add the property (commented out) to:
>>>
>>> https://svn.apache.org/repos/asf/oodt/trunk/pushpull/src/main/resources/push_pull_framework.properties
>>>
>>> -brian
>>>
>>> On Aug 06, 2012, at 08:13 AM, "Mattmann, Chris A (388J)" <chris.a.mattm...@jpl.nasa.gov> wrote:
>>>
>>>> Hi YunHee,
>>>>
>>>> On Aug 6, 2012, at 5:20 AM, YunHee Kang wrote:
>>>>
>>>> > Hi Chris,
>>>> >
>>>> > I am writing to you to ask you about how to apply a port number in a
>>>> > property file of the pushpull framework.
>>>> > Until now I didn't find how to do that in the push-pull user manual
>>>> > written by Brian.
>>>> >
>>>> > I think that we usually use a well-know port number assigned to a
>>>> > specific protocol. For instance the number 22 belongs to scp.
>>>> > But sometimes we use a different port number, instead of common port
>>>> > number, cause of a security reason.
>>>> > On the other hand, we also need to consider how to describe a port
>>>> > number that is assigned to a new protocol if we develop the protocol.
>>>>
>>>> I think the best way to do this would be to:
>>>>
>>>> 1. Suggest a system property inside of the push_pull_framework.properties
>>>> file, e.g., org.apache.oodt.cas.protocol.sftp.portNum
>>>> 2. To flow that system property down into the protocol API layer (e.g., expect
>>>> it to be read and set by the Push Pull framework, and then passed down
>>>> into the SFTP protocol; or more generally just change it to a protocol only
>>>> property and set there).
>>>>
>>>>
>>>> >
>>>> > Let me know how to add a new property for the port number.
>>>>
>>>> Let me know what you think? We can file a JIRA issue and
>>>> when we have decided on an approach, create a patch and go from there.
>>>>
>>>> Thanks!
>>>>
>>>> Cheers,
>>>> Chris
>>>>
>>>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>> Chris Mattmann, Ph.D.
>>>> Senior Computer Scientist
>>>> NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA
>>>> Office: 171-266B, Mailstop: 171-246
>>>> Email: chris.a.mattm...@nasa.gov
>>>> WWW: http://sunset.usc.edu/~mattmann/
>>>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>> Adjunct Assistant Professor, Computer Science Department
>>>> University of Southern California, Los Angeles, CA 90089 USA
>>>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Chris Mattmann, Ph.D.
> Senior Computer Scientist
> NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA
> Office: 171-266B, Mailstop: 171-246
> Email: chris.a.mattm...@nasa.gov
> WWW: http://sunset.usc.edu/~mattmann/
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Adjunct Assistant Professor, Computer Science Department
> University of Southern California, Los Angeles, CA 90089 USA
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>

Reply via email to