how to implement version-control client say svn as java web-service? - java

how can I implement SVN/CVS/Mercurial/Git/TFS client as java web-service? any pointers? basically I am developing a CMS in which i want to support version controlling.
But instead of new VC system, i want to support SVC/GIT/Mercurial/CVS/TFS so that it can be used with the existing plug-ins.
EDIT:
to make it more clear, I am developing an online VCS-client as a part of CMS. Which should support uploading from popular VCS like SVN/GIT/TFS/CVS.
I guess, I need to implement different handlers for different VCS-client. but the same data should be accessible from supported clients (SVN/GIT...)

OK, so I misunderstood your question. To achieve this you have to use one library for each VCS you want to support. For SVN this will be SVNKit, for Git JGit or gitblit (I don't know those two, they are just an example). You have to learn each API to get the data from every VCS.
In your Java application (website) the UI should provide a browser like component to select a file in the repository. Dependent of the VCS the user choose the appropriate library will be used to interact with the repository.

Related

Java - retrieve sources from changeset (Team Foundation Server 2010)

Does exists any JAR which allow my JSF application:
Connect with TFS url (like tfs.company.com.br\server);
Pass destination directory and changeset as parameters;
"Download" all sources from changeset in my destination directory;
Important: we don't have any workItem, we just use TFS as repository.
I've searched for it in Google, but I just have found jars for Jenkins which allows me to make a job for it. That's not exactly what I want.
Once you've downloaded the TFS Java SDK, have a look at a an introductory post to see how you make calls to TFS using the TFS Object Model.
That sample is about work items, but once you understand the object model you should be able to work out how to make calls related to version control. Also, as the object model is consistent between Java and .NET, you should be able to look at a C# example that does something similar to what you want and adapt those as needed.

Dart: How to setup a project

Since my attempt to set up a Dart project myself I think I miss something fundamental since I didn't succeeded. So I still need the help of the community.
Coming from GWT I am used to a single application forming a single JS file which is ran and will augment a HTML element once it is recognized by the application.
There will be usually two JS files, one for the user-frontend and the web applications backend application.
I want a solution with an incremental build during development time (which I guess Dart offers when used in Dartium)
I have an inhouse web framework that I want to be started and used to send the Dart files for the Dartium session. How this will integrate and interfere with the debug sessions?
Update regarding web framework:
The web framework is a component based rendering engine, including database and uses its own resource management including everything http related like setting the cache flags etc. Its about 1.5 MB with 1200+ tests. Its simply everything you need starting with a simple servlet. Its also using an embedded jetty.
The relevance here is that I need to know how the debugger connects to Dartium and how it finds the files once an instance is running and delivered a html file containing dartium sources, so how can I start my own web server at a given port and still have dartium debug capabilities?
Update regarding the former answers:
I tried it but after two days gave up to learn more and do some other stuff. I just don't know why it is just not possible to add a simple file to the root package of my Dart module like the good old package.html (javadoc) fil. I then just add the Dart libaries to my project and the Dart plugin adds the required Dart nature to the project and creates a builder entry, done. Why do I have to do all the fuzz. Or even better why cant I just annotate my Module's main class to form a module and so I can replace the extra file completely?
I guess the Dart plugin has a model of the Dart code already so discovery is done on the fly in Eclipse.
I also do not know why I cant put my dart code in a dart source folder like src/dart/main and src/dart/test.
Or is this possible? I am still trying to get this done. I will use a fresh Eclipse 3.8 install and check if I can get Dartium to work. Just installing the plugin seams not to do the trick.
Update regarding the JS generation:
I cannot understand why Dart is not offering an incremental build of JS files. Even if it is a single file. It should not be that hard to debundle the given compile steps. I guess it will be something like compile each source file independently and link those together, do some tree shaking and done. Would be awesome if this can be made possible. Remember one can hold a model of the output file in memory (or on disk) and know what part of the js relates to what source file. Then just look up the link symbol tables and write back the part that has changed.
For me the killer feature for Dart would be the ease of configuration as I outlined and the incremental build of JS files making co-developing in JS a no-brainer. I guess in the end both JS files will be just about 750kb combined. So all the stuff with additional compression would not force me to upgrade my 8GB memory or will stress my SSD at all (350MB/sec for writes in burst mode).
Is there any work planed on this? Would be great to have Dart as the final solution for JS creation but to be honest I do not understand why GWT is the way to create JS this way. An incremental build and easy setup for GWT would be also welcome.
Seems not to be a question ...
In Dart you have usually one JS file because Dart on the server runs native (without transpiling)
With Dartium you don't have a build at all because it also runs Dart natively.
You build to JavaScript only for deployment (and of course to test the build output before deployment).
The debugging is done by Dartium itself (you can use the Chrome DevTools debugger without DartEditor if you want). DartEditor access the debugger API of Dartium and acts as a remote display/control.
Debugging web clients loaded from other webservers is supported.
What might cause some work is setting up your custom web server so that it forwards requests to source files to pub serve the web server used by DartEditor (or standalone).
pub serve runs transformers (on the fly code transformations/generation). Some framework depend on transformers being run on the code to make it functional.
I have no idea what this means but I don't use Eclipse/Dart plugin.
[Update regarding the former answers] I tried it but after two
days gave up to learn more and do some other stuff. I just dont
know why it is just not possible to add a simple file to the
root package of my module like the good old package.html file
for the java docs and then all i do is add the Dart libaries
to my project and the Dart plugin adds the nature to it and
creates a builder entry, done. Why do I have to do all the fuzz.
Or even better why cant I just annotate my Module's main class
to form a module and so I can replace the extra files?
To integrate Dart with your Java project create the Dart project independent from your project and move the Dart build output to a directory where you have your other static files.
While development configure your web server to forward to pub serve as explained above.
As already stated in my first answer, this
[Update regarding the JS generation] I can not understand why
dartium is not offering an incremental build of JS files. Even
if it is a single file. It should not be that hard to debundle
the given compile steps. I guess it will be something like
compile a single file and link those then the magical tree
shake and done
is irrelevant. You don't do anything with JavaScript while developing.
If you load the page with a non-Dartium browser pub serve will serve
built JavaScript instead of Dart. Incremental build is in the works
to improve responsiveness. But incremental build is not available
for file generation (would make sense anyway IMHO).

Adding Android SDK to an existing Java project?

I'm a fan of a fairly big open-source program which is written in Java and uses Swing as a front-end client on series of web actions. As I've been working with Android development for a few months, I had an idea that I could create a new app that works similarly to the Swing application. The program is well-organized and separates interface from implementation, also offering a command line interface as well as Swing.
So ideally I'd like to be able to just inject a new Android package into the existing file system somewhere, make use of the back end that already exists, and have it work seamlessly with new updates to the program. The closest suggestion I found was this:
Q: How can I create a new project from an existing project, using Android command line tools?
A: Copy the directory tree of the old project into a new project.
This doesn't seem like it can be feasible advice for me, since I have to work with the existing SVN repository rather than starting the whole thing from scratch. Is there any way to pull this off?
since I have to work with the existing SVN repository rather than starting the whole thing from scratch. Is there any way to pull this off?
I doubt it. Android won't like the Swing code; standard Java won't know what to do with the Android code.
I suggest that you reorganize your code base into three:
One generates a JAR file, containing the common logic
One is the rest of your existing Swing/command-line logic, which uses the JAR
One is a new Android project, which also uses the JAR
Maybe you can pull this off by having src-jar/, src-swing/ and src/ (latter for Android) and associated build scripts. Personally, I'd have three totally separate projects.
Since SVN supports move operations (at least, it used to, last I used it, oh so many years ago), you should be able to accomplish this reorganization without losing any version history.

Java crawler library - recursive HTTP subtree download with directory listing parser

My application currently reads data by copying filesystem tree from remote machine via shared disk, so it works as filesystem deep copy from application's point of view.
This solution is somewhat limiting and I want to support also second option - copy subtree via http.
The library should do something like wget --recursive which parses the directory listing and use it for traversing down the tree.
I could not find any java library doing this.
I am able to implement such functionality myself (with NekoHTML or something similar), but I don't like reinventing the wheel.
Is there such a library that I can easily use within my application ?
Ideally:
published in Maven Central Repository as I am using Maven for builds
with as few dependencies on other libraries as possible
no need for robots exclusion support - will operate on limited set of interim servers only
Thanks.
Note: please post pointers to homepages of libraries which you personally used.
The Norconex HTTP Collector traverses websites like a tree, given one or more start URLs. It can be used as a java library in your application, or as a command line application. You can decide what to do with each document it crawls. Being a full-blown web crawler, it probably does more than what you are after, but you can configure it to suit your need.
For instance, it will by default extract text found in your documents and it let's you decide what to do with that text via plugging a "Committer" (i.e. where to "commit" the extracted content). In your case I think you want to the raw documents only and ignore the text conversion part. You can do so by plugging in your own document processor, followed by "filtering out" documents so they stop being processed once you have dealt with them your own way.
The project is open-source, hosted on Github and is fully "mavenized". It supports robots.txt, but that can turn that off if you want. The only downside to you is having more than a few dependencies, but since you are using Maven, those should get resolved automatically without effort. You'll find Maven repository info on the product site.

Google App Engine "repackaged" package

What is the purpose of the classes in this package?
I want to use Base64 encoding in my app. As I'm typing away in Eclipse, I am prompted if I want to import a class called "com.google.appengine.repackaged.com.google.common.util.Base64"
I can't find any documentation about what this class does. No javadoc, or no mention in the Google App Engine manual (that I can see). Is this some kind of "hidden" API that I'm not supposed to have access to?
Is this some kind of "hidden" API that I'm not supposed to have access to?
Yes.
The purpose of repackaging Java classes is to have a private copy of a library that otherwise might conflict with another version of that some library (that the application developer adds to his project as a jar file).
It is one possible answer to JAR-hell.
Even the JDK makes use of this mechanism, e.g. with com.sun.org.apache.xerces which is an XML parsing library developed by the Apache Project that Sun choose to include (repackaged).
Do not call these classes directly. (You could, and they would probably work okay, but as they are not part of the official API, they could disappear in the next version).

Categories