Implement repository service in java - java

I want to have a repository of Url to music(audio and video) with different file types (mp3,ogg,flv,avi) which can be used as a web-service.
Is there a free or open source solution for a repository (for example written in Java) which could help me, or do you have some recommendations, or patterns that could help me?

I'm not completely clear on what you are asking, but this sounds like a good use case for a NoSQL document store. If I were you, I'd be looking into things like CouchDB, MongoDB, Amazon S3 , etc.
CouchDB provides an HTTP interface via RESTful calls to your documents. So you could store your media in it, and you'd have a URL for each media element. There are Java libraries to support it, plus it's just REST with JSON, so it is really easy to get it working with Java. Personally, I use Jackson for JSON processing.
I'm not sure about a pure Java solution, perhaps JackRabbit? But it seems it may be overkill for your needs. It wouldn't be hard to roll your own. Perhaps use Jersey to implement REST, and then just store files on the filesystem. I guess it all depends on the scale you need.
Hope this helps.

Related

Does SonarQube have client libraries for web api with classes to store JSON?

First timer here and just starting with (the latest) SonarQube. Are there client libraries to download through the web-api already written and available? And is there a set of JAVA classes established that map to the structure of the JSON that will be returned that already exist? I was able to write my own test JAVA code to connect and to parse using the web api provided for one call I wanted, by building my own classes. But it seems like a lot of work to do this for all the data I hoped to pull and wondered if someone had done it already and/or Sonar provided it. And the web-api is a bit cryptic. Had to hover over values to figure out the exact call. I didn't see what I was looking for in the documentation or here. Or is there a better way to dump the data efficiently out of the GUI? Thank you!
Concerning, JAVA client library to request the SonarQube web services, we do not provide such library. There are lot of great tools to do a HTTP request and parse the JSON (see for instance OkHTTP and GSON).
Concerning "the web-api is a bit cryptic", I would be very interested to hear all your feedbacks about this, please share these feedbacks on the Google Group in order to discuss them and improve SonarQube web services.

Is it possible to have my app communicate with moodle?

I am thinking about building a student app, that would use Moodle data, and notify the user when a new file has been uploaded, and perhaps do something like checking your grades etc.
I'm quite new to android programming and can get easily confused with the technical terms. I've looked around the web and found that there is an API, but I dont really 100% know what that means. Which is weird since I've communicated with API's like the OpenWeatherMap one and uTorrent. Would Moodle's api do the same? Make it easier for me to get their data? Their descriptions are really technical and I can not understand much.
Please note that "API" in moodle does not automatically refer to webservices like you are used to communicate with.
See https://docs.moodle.org/32/en/Mobile_web_services and https://docs.moodle.org/32/en/Using_web_services and https://docs.moodle.org/dev/Web_service_API_functions
These docs might be interesting for you.
Beside the existing webservice methods, you can also create your own moodle plugin, which provides the methods required, some info can be found here https://docs.moodle.org/dev/Adding_a_web_service_to_a_plugin

How do I use java to fetch dynamic web content?

I've been programming in java for a little while and I've found no real way to even come close to this goal. My googling has been pretty fruitless as well.
I'm looking for a way to essentially download current weather (or other but weather is a good start I suppose) and save the current temp / humidity / dewpoint / next day forecast for those numbers into an array of strings
I have no idea where to start, but I figure that this will be a good place to start learning how to use java to fetch.
Thanks!
How would you approach this task in other language?
In the case of weather you would probably look for some API exposed by the site you're trying to get the weather from.
Here come some clues:
1. If you want to just issue an HTTP request, get a result (kind-of ajax style) and parse the web page you can use java.net package or if you want a (much more powerful) thirdparty lib, use Apache HTTP Client.
2. If you're looking for API exposed via WebServices (which I believe is a better approach here) then they're language agnostic, so you just turn to web services (SOAP/Rest) in Java just like in any other language.
I know, the answer is a little bit 'common', so please clarify 'how' are you planning to solve this issue (even in any other language)...
Hope, this helps
A good source for weather information is METAR. There is also a Java library jweather available which should encapsulate all network/protocol/api issues to a limited set of methods to retrieve the required weather information

How to consume ad hoc web services (non-SOAP, schemaless XML)?

I need to write integrations to multiple external web services. Some of them are SOAP (have WSDL), some of them pretty much ad hoc - HTTP(s), authentication either by basic auth or parameters in URL (!), natural-language like XML which does not really map nicely to domain classes..
For now, I've done the spike integrations using Spring Web 3.0 RestTemplate and binding using JAXB2 (Jaxb2Marshaller). Some kind of binding is needed because domain classes need to be cleaner than the XML.
It works, but it kind of feels bad. Obviously this partially just because how the services are built. And one minor issue I have is naming of RestTemplate as services have nothing to do with REST. This I can live with. JAXB2 feels a bit heavy though.
So, I'm looking for some other alternatives. Ideas? I'd like to have a simple solution (so RestTemplate is fine), not too enterprisey..
While some of your services may be schemaless XML, they will still probably have a well-documented API. One of the techniques that the Spring folks seem to be pushing, at least from the web-service server side, is to use XPath/XQuery for retrieving only the information you really need from a request. I know that this may only end up being part of your solution, but I'm not sure that this is a situation where one particular binding framework is going to meet all your needs.
If I understand correctly you have 1 application that has to make calls to various external (web) services by use of different technologies. The first thing that comes to mind is to have some intermediate level. While this could be something as elaborate as en ESB-solution, my guess is that is not what you're looking for.
You could for example achieve this intermediate level by having a class hierarchy with at its top an interface 'Consumer'. Method to be implemented: doConsume() and so on.
If you look into it you'll probably have the opportunity to make use of several design patterns like Strategy or Template. Remember to be pro-active and try to ask a few times 'What if ..' (As in: what if they need me to consume yet another service? etc.)
If JAXB feels too heavy there are other API's to be found:
Axis
JAX-WS
CXF
other
It'll depend on the situation which one would be better. If you run into troubles with any of them I'm sure you'll be able to find help here on SO (and from people who have more hands-on experience with them than me ;-)

Whats the best way to implement a simple document management system?

I am planning to build a simple document management system. Preferably built around the java platform. Are there are best practices around this? The requirements are :
Ability to upload documents
Ability to Tag documents
Version the documents
Comment on documents
There are a couple of options that I am currently considering. The first option would be a simple API on top of SVN or CVS and use a DB backend to track tags, uploader, comments etc
Another option is to use the filesystem. Version the documents as copies in a versions folder and work with filenames.
Or, if there is an Open non GPL'ed doc management system, we could customize it to our needs and package it in our application. Does anybody have any experience building something like this?
You may want to take a look at Content repository API for Java and the several implementations (some of them free).
Take a look at the many Document Oriented Database systems out there. I can't speak about MongoDB or any of the others, but my experience with Couchdb has been fantastic.
http://couchdb.apache.org/
best part of it is that you communicate with it via a REST protocol.
The best way is to reuse the efforts of others. This particular wheel has been invented quite a bit of times.
Who will use this and for what purpose?

Categories

Resources