Archive

Posts Tagged ‘open source’

Debuging OpenEJB’s TomEE with Eclipse WTP

No Gravatar

This is just a short description on how to use OpenEJB with Tomcat to debug it within Eclipse.

The point is to be able to debug EJB applications from within Eclipse with a lightweight Tomcat container using OpenEJB.

Read more…

Share

Hunspell4Eclipse 0.8.2 (beta) out

No Gravatar

Changes:

  • threshold feature
  • update site back to normal
  • limited Java support – reports misspelled words (underline), but no proposals
  • latest JNA

Link to project page: http://code.google.com/p/hunspell4eclipse/

Share

Eclipse Spell Checker

No Gravatar

Eclipse has a built in spell checker. It’s based on word list files. It is just fine for languages that does not use pre- and postfixes extensively. But for languages like Hungarian, it is a no go. – I’ve tried to generate a word list of Hungarian words, but when I noticed that the word list reached 35 GB (not a typo!) I’ve canceled the process. – Just imagine Eclipse loading 35+ GB of dictionary…

In my search for a spell checker for Eclipse I found eSpell, but eSpell is also a word list based engine, so that is a no go too. I left with no choice but to create one. So here it is:

Hunspell4Eclipse

Immature. In beta stage. Lot to do. But it works…

Plans

I’m planning to provide content sensitive checking for Java and XML. Actually my plan is to create extension points for that purpose, to provide possibility for others to contribute too.

Comments please

I hope you’ll enjoy the plug-in and that you found it worthy to comment.

Share

Commons Logging templates for Eclipse

No Gravatar

After my last article some folks at the company I work for asked for a Apache Commons Logging version of templates, so here it is.

Just as with the last article, import this templates: clogger-templates

The mappings are (in case you would like to use with SLF4J):

cloggercreate a logger instance with imports
cloginfocreate log entry of info level
clogerrorcreate log entry of error level
clogwarncreate log entry of warn level
clogtracecreate log entry of trace level
clogdebugcreate log entry of debug level
clogfatalcreate log entry of fatal level

Have fun.

Share

Jackrabbit with Spring

No Gravatar

I was searching for a way to use Jackrabbit with Spring. There are articles about this topic, but each of them suggests using spring-modules. Now, my problem with spring-modules jcr implementation is, that they depend on non-released or obsolete 3rd party JARs, like apravez.* and jeceira. Just take a look at the pom file, and you’ll see.

On the other hand I do not feel a need for jcrTemplate, jcrCallback or any other ORM flavor helpers. I just need a nice, easy integration of Jackrabbit, where I can easily inject JCR Session into any class with spring.

The JNDI way would do, but I do not want to use JNDI, I want to configure Jackrabbit from my spring beans.

Now with those premises, I came out with a quite easy setup, that follows below.

Spring configuration:

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="

http://www.springframework.org/schema/beans


http://www.springframework.org/schema/beans/spring-beans-2.5.xsd


http://www.springframework.org/schema/util


http://www.springframework.org/schema/util/spring-util-2.5.xsd


http://www.springframework.org/schema/context


http://www.springframework.org/schema/context/spring-context-2.5.xsd


http://www.springframework.org/schema/tx


http://www.springframework.org/schema/tx/spring-tx.xsd


http://www.springframework.org/schema/aop


http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">

  <bean name="jcrConfiguration"
    class="org.apache.jackrabbit.core.config.RepositoryConfig" 
    factory-method="create">
    <constructor-arg index="0" 
      type="java.io.InputStream" 
      value="classpath:repository.xml" />
    <constructor-arg index="1" 
      type="java.lang.String" 
      value="/tmp/repository" />
  </bean>

  <bean name="jcrRepository" factory-method="create"
    class="org.apache.jackrabbit.core.RepositoryImpl">
    <constructor-arg>
      <ref bean="jcrConfiguration"/>
    </constructor-arg>
  </bean>

  <bean name="jcrSession" 
    factory-bean="jcrRepository" 
    factory-method="login" 
    scope="session" 
    destroy-method="logout">
  </bean>

</beans>

The configuration of Jackrabbit is defined in repository.xml file, – I just took the default repository.xml, the one that is created when running TransientReposiotry for the first time. Of course for better integration and configuration define your own. There is one more configuration point and that could be seen in the XML from above. Spring bean jcrConfiguration defines where the repository.xml configuration is and the path to repository resources, – the second argument. For test purpose I just used /tmp/repository but for production you might set it to something like: repository Do not forget to set up spring RequestContextListener or you’ll be missing session (and request) scope in spring configurations. In web.xml just define a listener:

org.springframework.web.context.request.RequestContextListener

From code we’ll just going to use the jcrSession. Here is a small example for usage:

@Service
public class TopicService implements BeanFactoryAware {

  private BeanFactory beanFactory;

  public Session getJcrSession() {
    Session jcrSession = 
	  (Session) beanFactory.getBean("jcrSession");
    return jcrSession;
  }

  @Override
  public void setBeanFactory(BeanFactory beanFactory) 
      throws BeansException 
  {
    this.beanFactory = beanFactory;
  }

  public void myFucntion() {
    Session session = getJcrSession();

    // here you do what you would do with JCR...
  } 
}

As my service is singleton I inject Spring Bean Factory with the help of org.springframework.beans.factory.BeanFactoryAware mixin, so each time I call getJcrSession() I get a JCR session bind to HTTP session.

Well, that’s it. A simple configuration, easy usage.

Share

Ubuntu guy in a world of Apples… Part II: The OS and utils

No Gravatar

My adventure in the world of Apples goes on. As I mostly liked the iron of the MacBook, now it is time to go on and see if I can do usual task as simple as in Ubuntu.

So I gathered things I do mostly:

  1. Photo processing
  2. Java development
  3. Listen to music – I’ll need a good media player, an alternative to Amarok
  4. Browse the net – Firefox or better
  5. Chat through GTalk and Skype
  6. Copy files from/to FTP, SFTP, WebDAV, SMB – a twin panel, alternative to Krusader
  7. Simple text editing – jEdit should work
  8. Formated text, spreadsheet and presentation – OpenOffice.org or alternative
  9. Video playing – mplayer with front-end or alternative.

Read more…

Share

Eclipse Ganymede and P2

No Gravatar

Yesterday Ganymede arrieved. Fresh new Eclipse 3.4 and a tons of plugins as usually.

Some nice new features, feels like a bit faster. But! P2, the new “update system”… grrr. Okay, the old one was bad, I know. But it did work. It took me usually about 30 minutes to assemble an eclipse-jee with AJDT, subversive, q4e, mylyn exts and to import some of my workspaces. Today, with Ganymede and P2 it took me about 4 hours. Ouch. And I still do not have AJDT, and no dependency viewer from q4e.

I hope this will stabilize, and that this will pay off…

Share

Maven 2.0.9 dependency import and Continuum 1.1

No Gravatar

We use Maven2 for developing our huge application, (and few smaller). We have almost 200 projects which depends on each other somehow. That’s why I really like Maven2. It was a nightmare to handle all those dependencies by hand, – as we did it before moving to Maven. Of course there are other great things about Maven, like reports, site and of course the release management. – OK, there is still an annoying bug with release plugin, ranges and snapshots, but we can live with it.

With the release of 2.0.9, we got a new powerful feature for handling dependency versions. The so called “Importing Dependencies” noted in release notes and described in the documentation and in wiki.

Read more…

Share