Has Oracle removed Sun net.ftp classes? - java

I have an older project that uses the sun.net.ftp.FtpClient class to download a file from an ftp server. It appears that Oracle has finally removed this unsupported/deprecated feature from Java. Any suggestions on what should be used to replace it? I was considering org.apache classes but I have never used them. The best solution would be the simplest.

Dependending on your requirements i'd recommend to use either the FTP client provided by Apache Commons Net or edtFTP/j.

finj - FTP Client for Java Apps
What is finj ?
Sun provides
a FTP client written in Java as part of the standard classes.
Unfortunately, since the sun.net.ftp.* classes are not
part of the java.* packages, neither the source code
nor a complete API are available.
The goal of this project is to provide to developers a complete,
well designed, programmatically controllable Open-Source
FTP client written in the Java language. finj then simply stands for 'FTP in Java'.
It provides an API similar to sun.net.ftp.FtpClient so that you can use it without changing your code very much.

Related

why different packages or naming conventions in google cloud?

I have recently started using google cloud platform and came across various packages like
Storage storage = storageBilder.build();
storage.get("bucketname", Storage.BucketGetOption.fields())
Storage.BucketGetOption.fields();
If I use the code above i am facing The method get(String, Storage.BucketGetOption) is undefined for the type Storage.
It actually using the storage from below packages
com.google.api.services.storage.Storage storage = storageBilder.build();
(i.still.do.not.know.this.)storage.get("bucketname", Storage.BucketGetOption.fields())
com.google.cloud.storage.Storage.BucketGetOption.fields();
why this storage is implemented in various ways? what is the difference or use of com.google.api and com.google.cloud?
Could anybody please explain?
Google has released a number of Java API client libraries over the years.
The current, best Java API client is the google-cloud library. It uses the Java packages com.google.cloud. For Cloud Storage, you're using this library if the classes are under com.google.cloud.storage.
Before this library, there was another set of libraries called the Google APIs Client Libraries. These libraries put their classes in the com.google.api package. For Cloud Storage, you'd find classes in com.google.api.services.storage. Code that uses this library will also use a distinctive storage-resource-verb function pattern, like storage.buckets().objects().get() pattern.
The Google APIs Client Libraries are still supported, but I recommend preferring the google-cloud libraries for new code. Unfortunately, because of this library switch-over, some code examples you'll find online will use the former or the latter or, worse, both.

Is there a Java framework/assembly similar to the .NET Microsoft Enterprise Library?

I'm looking for a Java assembly similar to the Enterprise Library assembly that Microsoft wrote, which includes a Cryptography, Database, Logging, Security, Validation and other application blocks that wrap around the .NET framework. It's main purpose is to improve performance and to provide an API that makes it easier to build applications, so the application developer doesn't have to re-invent the wheel on the core libraries for doing common tasks. I'm primarily looking for a nice assembly for connecting to Oracle and SQL Server (for databases), as well as the other application blocks that I mentioned above. I am going to be building a bunch of reporting tools using a Java back-end and would like a jump start.
For Oracle and SQL Server, look for the JDBC drivers for each one (SQL Server here and Oracle here).
For cryptography, Java already comes with it bundled in, click here for docs.
For logging, there are many libraries:
Log4j
Logback
Java logging API
Security and validations are dependent on what kind of application you are using and there are many options other than the ones provided by Oracle itself, you need to provide more information what kind of app you are going to build so that people can provide better answers.
Also, most of the tools people use in the community are not provided by Oracle (this is a main difference between the Java and .Net ecosystem) so, you will find that there are many solutions on open source projects for the same problems and you will have to think, try and decide wich one of them to use.
I think you're describing Java EE. See:
http://en.wikipedia.org/wiki/Java_Platform,_Enterprise_Edition
http://www.oracle.com/technetwork/java/javaee/overview/index.html

Information needed to utilize TPM in Java

I'm reading up on my upcoming project that involves using my laptop's TPM on authentication software written in Java.
A few entries came out on Google, but most of them are quite old, and I have no idea which is the best tutorial. So I'd like to know what's the recommended API to use, and where is the best place to get information from.
Thanks.
To communicate with a TPM you need a Trusted Software Stack (TSS). There are two major freely available TSS: TrouSerS and jTSS.
jTSS is written in Java, whereas TrouSerS is written in C.
When using the pure Java jTSS you don't need jTSSWrapper. The wrapper is only needed when you want to access TrouSerS TSS through Java.
The jTpm Tools provide some command line tools to interact with the TPM. When looking at the source code of the tools you can figure out how to use jTSS API.
For more stuff related to Trusted Computing and Java have a look at http://trustedjava.sourceforge.net/
There's also a JSR that tries to define a high-level Java API for Trusted Computing, you can find the information as well as a reference implementation at http://jsr321.java.net/ (including public readable SVN repo).
start reading here.
http://trustedjava.sourceforge.net/
There is any Information you need. To access your TPM (I would suggest you to do first tests with the famous TPM Emulator from http://tpm-emulator.berlios.de/)
In Java you need the Package jTSSWrapper. Just look at the test-code insight the package to get a very first impression.

DLL/TLB in Java<->DCOM communication

I have to write an OpenOffice add-on (in Java) which communicates with DCOM server of some closed-source application. The major problem is that, I don't have any documentation about server's Interfaces .
All I have is a VB/C++ SDK kit for the Application. SDK contain a library in dll and a bunch of *.tlb files. In SDK documentation there is an information, I can use java, but there is no example at all. I have read provided examples and it looks like all the communication wit DCOM goes through this dll.
Is there a way to somehow import such dll/tlb functions def directly to java, bypass dll and comunicate with DCOM or I have to write a C++ wrapper(dll)? What is the best way to do it?
Any hints are welcomed.
You can use a project like j-Interop for communication with (D)COM servers.

Java's answer to PHP's SoapClient()?

There's a lot of information out there, but I can't quite figure out:
What's Java's answer to PHP's SoapClient()?
No frills, just want to create a client to access the methods described by a .wsdl document.
See this question. There are many Web Services frameworks in Java that can generate a client from a WSDL file. Eclipse has a plug-in to create a client stub from a WSDL file using the Axis2 framework. Perhaps this is the easiest option for a beginner.
If all you want is a piece of software to generate client code from an existing WSDL, you have more options than you can shake a stick at. I've tried several, and they all do pretty much the same thing in the same way, the big difference between them being the documentation. For me, the best documented of the lot is Apache CXF, which will generate JAX-WS-compliant code that you can then use with any JAX-WS library in your application (such as CXF itself, or Sun's JAX-WS-RI, and so on).
It's going to be more complex than SoapClient, I would imagine.
JAX-WS, most appserver vendors supply implementations and tooling.
See glassfish for an exmple implementation. The glassfish guide docs give details of how to go about developing, there are many variations depending upon how you would normally go about doing Java development. For me, I work with IBM tools and therefore simply load up RAD point as the WSDL and click "generate".
You can try using RCPServiceClient class in axis2.
Here is the java doc for it:
ws.apache.org/axis2/1_1_1/api/org/apache/axis2/rpc/client/RPCServiceClient.html
It doesn't require you to generate code to call web services.
Here is a decent example of how you can interact with a service using RPCServiceClient.
ws.apache.org/axis2/1_2/pojoguide.html#testingpojows
Do remember that java is strongly typed language so you can't do things like serviceClient->someRandomFunction(params), since someRandomFunction will not be defined ahead of time if you are trying to do something like PHP's SoapClient.
However, it will be equivalent to $soapClient->_soapCall function, as you will be able to do something like
serviceClient.invokeBlocking(
opProcess, -- function you are trying to call..
opResponseArgs, -- these are arguments you are passing
returnTypes); -- types that you are expecting back
Hope this helps.

Categories