Topic
  • 3 replies
  • Latest Post - ‏2013-03-21T15:14:28Z by VolkerFriedrich
SystemAdmin
SystemAdmin
1316 Posts

Pinned topic Using the JCU, or best way to pass in username and password in Java API

‏2013-03-20T21:20:29Z |
Hello! We're using C:D to keep directories on two different network storage locations synced up. I am trying to develop a process that will be run every so often that will call some Java code that will compare configured directories for differences between the primary and secondary node. If a file exists on the secondary node but not on the primary node, the file will be deleted. If a file exists on primary node but not on the secondary node for some reason, the Java code will call a copy process in C:D to transfer the file (let's say someone accidentally deletes the file on the secondary node).

I have looked through the Java API documentation and one way to construct a Node object is to pass in a file constructed by the Java Connection Utility. However, I can't find where the JCU lives or how to call it. Can anyone point me to that documentation?

Is this the best way to create a Node without having your username/password either hardcoded or visible in any way? I was hoping there would be a way to define a user/password for the process that will call the Java code, and pass that to the application, but I don't see how to do that. So it sounds like creating a JCU file may be the best way, assuming that file is not just an ascii file that anyone can read.
Updated on 2013-03-21T15:14:28Z at 2013-03-21T15:14:28Z by VolkerFriedrich
  • VolkerFriedrich
    VolkerFriedrich
    175 Posts

    Re: Using the JCU, or best way to pass in username and password in Java API

    ‏2013-03-21T08:26:03Z  
    Look for the 'JCU' class in the javadoc documentation (doc\index.html). You'll find it the lower left window where all classes are listed or from the Index.

    You can run the JCU from a command line as follows:
    
    java -classpath CDJAI.jar com.sterlingcommerce.cd.sdk.JCU
    

    It will prompt you for:
    • The host name, or IP address, for a system running the Connect:Direct server to be connected to,
    • The Connect:Direct server's API port value,
    • A user id,
    • A password, and
    • The protocol to use when making a connection. (Valid values are TCPIP, TLS, and SSL.)

    Once it created an output file, you can pass it to your node object, like
    
    Node cdNode = New Node(
    "C:\CCDEF.BIN");
    
  • SystemAdmin
    SystemAdmin
    1316 Posts

    Re: Using the JCU, or best way to pass in username and password in Java API

    ‏2013-03-21T15:01:42Z  
    Look for the 'JCU' class in the javadoc documentation (doc\index.html). You'll find it the lower left window where all classes are listed or from the Index.

    You can run the JCU from a command line as follows:
    <pre class="jive-pre"> java -classpath CDJAI.jar com.sterlingcommerce.cd.sdk.JCU </pre>
    It will prompt you for:
    • The host name, or IP address, for a system running the Connect:Direct server to be connected to,
    • The Connect:Direct server's API port value,
    • A user id,
    • A password, and
    • The protocol to use when making a connection. (Valid values are TCPIP, TLS, and SSL.)

    Once it created an output file, you can pass it to your node object, like
    <pre class="jive-pre"> Node cdNode = New Node( "C:\CCDEF.BIN"); </pre>
    Thank you Volker. I completely missed a class named JCU. I was looking for ConnectionUtility, looked at Connection and was like "This isn't it", etc. Painfully missing the obvious lol.

    Here's another question. I see in the .bin that it defines the user preceded by the node id. Does this mean the user must be defined as a user for that node? Or can the user be in a group that is defined a users for that node? Our Sys Admins are loathe to add specific users to servers, instead preferring group access controls. Will the node connection established in the Java code use C:D defined Functional Authorities for that node?
  • VolkerFriedrich
    VolkerFriedrich
    175 Posts

    Re: Using the JCU, or best way to pass in username and password in Java API

    ‏2013-03-21T15:14:28Z  
    Thank you Volker. I completely missed a class named JCU. I was looking for ConnectionUtility, looked at Connection and was like "This isn't it", etc. Painfully missing the obvious lol.

    Here's another question. I see in the .bin that it defines the user preceded by the node id. Does this mean the user must be defined as a user for that node? Or can the user be in a group that is defined a users for that node? Our Sys Admins are loathe to add specific users to servers, instead preferring group access controls. Will the node connection established in the Java code use C:D defined Functional Authorities for that node?
    It is fine as long as the userid can be authenticated by the node somehow. Whether this is through an user or a group functional authority definition doesn't matter.

    It is just the syntax of the bin file.