what is the best strategy for a log analyze applications - java

i will develop a web application to view and analyze log files from both remote machines and locally and planning to use java. At first glance it seems like application must work with big data sets effectively. For example to list a log file on browser i should implement a paginated list working with ajax (server will give data accordingly with current page number). Also i like to use AJAX.
My question is how should i design an application like this. i have three possibilities:
AJAX with RESTful service.
JSP and servlet
JSF with AJAX

I would suggest you have a look at Chainsaw - http://logging.apache.org/chainsaw/index.html - and Lilith - http://lilith.huxhorn.de/ - to see how others have approached this.

The released version of Chainsaw is pretty old - a MAJOR update will be released shortly. If you want to try out a pre-release version, you can see a screenshot and get the tarball or Mac DMG here:
http://people.apache.org/~sdeboy/

Related

How to create java web form with spring, bootsrap, javascript that calls java method?

this is my first question on stackoverflow and I'm really confused..
I'm new with java and very confused at this moment. I'm planning to create a java web service with spring that handles a webform and a portable scanner device. I get this project for my first in new workplace but I can't move on. I don't know what are the neccesery steps to succeed.
What I want from the Application running step-by-step:
Open in an executable file that
Open a new browser window on localhost and shows a form
Filling out form with input fields, checkbox items, dropdown list,
commentbox,
AND Option for file upload from local and/or call startScan() java method.
startScan() = take photo from device and saves it to project's root folder and rename it as formatted date: "yymmdd_hhmmss"
submitButton()
onSubmitButton() the form data should be saved in database that
later i can download as xml
I have read lot of blogs and watch tutorials but that causes me confused. JPA? Hibernate? REST? REACT? I would like to create a very simple app that can display the form on window browser that is easy to access with bootsrap.
What is the neccesery toolset for doing this as simple as possible?
mysql? postgresql? which of these I can implement, what should i install locally?
If I could came out from back end to front that would be awesome..
Goal: Create a localhost database system that handles the form and scanner device method in a fancy css view.
Now, I'm using eclipse with spring. What are the neccesery dependencies? what are the local requirements for this kind of project? Please, help me with any advices..
I am very grateful for everything
Thank you in advance
I designed something similar, a simple two-page web application with login functionality and application main page that supports database operations and scanning functionality.
I would recommend you to go step-by-step since documentation is also as important, to be able to clearly visualize the project objectives, to know the constraints before-hand, make modifications on-the-fly and as a reference for your peers.
As a newbie with Java development, these are some basic steps and links which I feel would be helpful:
Project Scope Document (Web based tool: Draw.io)
Project Plan Document
Site Map (Web based tool: Draw.io)
Front-end Wireframing (Web-based tool: Balsamiq)
Back-end Wireframing (Microsoft Excel)
Back-end Flow chart (Web-based tool: Draw.io)
Front-end development (Technologies: HTML5, CSS3, Bootstrap 3, JavaScript; Tool: Brackets)
Back-end development (Technologies: PL/SQL or MySQL, Java, JDBC, Servlet, JSP, JSTL; Tools: SQL Developer, JBoss Studio)
Integrating Scanner (Third-party Java APIs)
Technology Stack: This is a simple and very generalized stack preference. You could customize it according to your needs.
Helpful Links on getting started: Java Web Terminology, JBoss Hello-world tutorial, Simple Java web application
Tools: Draw.io and Balsamiq are easy to use web based tools. You could use Bootstrap to make a quick fancy front-end. Brackets is a nice front-end code-editor supporting live-previews. SQL Developer is a wonderful tool if you're using Oracle SQL. JBoss Eclipse IDE has in-built application server which you can use for testing on localhost.
Note: All tools and technologies listed here are either free or include a trial version.
Hope that helps!

Difference between alfresco webscript and Java servlet

Recently I've discovered that document upload feature in Alfresco backed with a simple Java Servlet (UploadContentServlet.java). I don't understand why it is a servlet not a webscript. Since everwhere in Alfresco webscripts are used.
Another question which pops up is what's the difference between Alfresco webscript and Java Servlet? They look almost the same, except the procedure to create them and that Alfresco WebScript response could be customized with some ftl template.
Is there any other differences?
As you can find here Alfresco UploadContentServlet, UploadContentServlet is
Responsible for streaming content directly from servers into the repository using the HTTP PUT command. The NodeRef of the node onto which the content will be streamed can be encoded into the URL. In this situation the content of the property can be considered to be updated once the servlet has returned.
It is related to URL addressability, a topic that seems to be discontinued on newer Alfresco versions.
By the way, I think that the reason could be that using a servlet is more efficient especially when uploading huge files.
Mainly webscripts are easier to write and to mantain than servlets. Moreover if you change something in your server side javascript file all you have to do is to reload the container, instead of reloading the context of your application.
This link may show you the architecture Web Script Framework and even if it is quite old the information is still valid for newer versions of the platform.
Ftl templates are very useful and remember that the platform gives you a lot of root objects that you can use in your webscripts.

How to modify search result page given by Solr?

I intend to make a niche search engine. I am using apache-nutch-1.6 as the crawler and apache-solr-3.6.2 as the searcher. I must say there is very less updated information on web about these technologies.
I followed this tutorial http://wiki.apache.org/nutch/NutchTutorial and have successfully installed apache and solr on my ubuntu system. I was also successful in injecting seed url to webdb and perform the crawl.
Using solr interface at http://localhost:8983/solr/admin, I can also query the crawled results. But this is the output I receive. .
Am I missing something here, the earlier apache-nutch-0.7 had a war which generated a clear html output like this. . How do I achieve this... Or if anyone could point me to a latest tutorial or guidebook, highly appreciated.
A couple of things:
If you are just starting, do not use Solr 3.6, go straight to latest 4.1+. A bunch of things have changed and a lot of new features are added.
You seem to be saying that you will expose Solr + UI directly to general web - that's a really bad idea, as Solr is completely unsecured and allows web-based delete queries. You really want a business layer in a middle.
With Solr 4.1, there is a pretty Admin UI and, also, there is a /browse page that shows how to use Velocity to do the pages backed by Solr. Or have a look at something like Project Blacklight for an example of how to get UI over Solr.
I found below link
http://cmusphinx.sourceforge.net/2012/06/building-a-java-application-with-apache-nutch-and-solr/
which answered my query.
I agree after reading the content available on above link, I felt very angry at me.
Solr package provides all the required objects to query solr.
Infact, the essential jars are just solr-solrj-3.4.0.jar, commons-httpclient-3.1.jar and slf4j-api-1.6.4.jar.
Anyone can build a java search engine using these objects to query the database and have a fancy UI.
Thanks again.

Adding content to Liferay via API

I am starting using Liferay Portal and I have two basic needs which I would like to achieve with Liferay.
Is there a posibility to add content to CMS through API level? I would like to insert some data "from code".
More important. How to achieve such situation that for every created user there will be its own homepage generated with some predefined template elements on it?
I have tried to Google something so far, but I did not find it helpful. Maybe some keywords?
After some analysis of documentation devoted to services and ServiceBuilder I realized that it is not what I want.
Let me show an example based on Websphere.
In Websphere we have bunch of EJB components available to perform some actions, exchange information with portal, easy to use. Isn't there any similar mechanism in Liferay not involving web services?
My recommendation for this kind of question is to take a look at the sevencogs-hook sourcecode. The structure of this hook is basically just a long script that runs once, setting up a complete demo site with users, sites, pages, content etc. The code runs once (after the first deployment) and then never again. There are no (obvious) conditionals, no context to understand etc.
You can basically just step through everything and - in that process - understand how content (and pages, images, blog posts, etc.) are created and positioned on pages in Liferay.
This hook accesses the Java API, a very similar API is available through Webservices. Basically all of Liferay's portlets also use the same API to do their business.
Edit: Additional information to keep this answer valuable/current: Sevencogs is discontinued, but still available in old releases (source & binary). The API has slightly changed, so compiling/running it will need a bit of work. James Falkner has blogged about the leftovers and lessons learnt - those snippets are extracted from sevencogs and contain the relevant code pieces to work with the API.
Looking at this page from the documentation: It smells like a SOAP interface (they mention some sort of document uploader service and I've read axis).
You'll find some url examples that should give a list of available webservices.
For number 1, you can use the one of the:
JournalArticleLocalServiceUtil.addArticle()
methods to programmatically add Liferay Web Content from a portlet. If you download the Liferay Portal Source you can see the structure of these methods.
For number 2, can create page templates with preconfigured portlets on them (through the Plugins-SDK), and then use the API to programmatically create the pages using one of the:
LayoutLocalServiceUtil.addLayout()
methods.
If you have any more speific questions about these comment back, and I hope this helps!

Automatic sitemap generation

We have recently installed a Google Search Appliance in order to power our internal search (via the Java API), and all seems to be well, however I have a question regarding 'automatic' site-map generation that I'm hoping you guys may know the answer to.
We are aware of the GSA's ability to auto-generate site maps for each of its collections, however this process is rather manual, and considering that we have around 10 regional sites that need to be updated as often as possible, its not ideal to have to log into the admin interface on a regular basis in order to export them to the site root where search engines can find them.
Unfortunately there doesn't seem to be any API support for this, at least none that I can find, so I was wondering if anyone had any ideas for a solution/workaround or, if all else fails, the best alternative.
At present I'm thinking that if we can get the full index back from the API in the form of a list, then we can write an XML file out using that the old fashioned way using a chronjob or similar, however this seems like a bit of a clumsy solution - any better ideas.
You could try the GSA Admin Toolkit, or simply write some code yourself which just logs in on the administration page and then uses that session to invoke the sitemap export URL (which is basically what the Admin Toolkit does).

Categories