Instantiating the ContinuumStore

View: New views
1 Messages — Rating Filter:   Alert me  

Instantiating the ContinuumStore

by nikolay-8 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

I am trying to create a kind of a plugin for Continuum, that is a servlet which provides some statistical information about the projects.

In order to achieve that I need to connect to the database of the Continuum, which I'm trying to do by getting the right      org.apache.maven.continuum.store.ContinuumStore implementation from the plexus environment, but I just can't get my reference instantiated. It is still null  (the field store from the class that is shown) when I start the  servlet.

Since I have no experience with plexus and writing Continuum plugins I assume that I'm missing something substantial. Here is what I'm trying to do:

My class looks like:
public class AtomServlet extends HttpServlet {

        String ROLE = AtomServlet.class.getName();
        /**
         * @plexus.requirement
         */
        private IContinuumInfo getInfo;

        @Override
        protected void service(HttpServletRequest arg0, HttpServletResponse res)
                        throws ServletException, IOException {

                // setting the type of the response
                res.setContentType("text/html");
                // getting the response writer
                PrintWriter writeResponse = res.getWriter();
                                              writeResponse.write(getInfo.getInfo(ContinuumInfo.FeedType.ATOM));
        }

}

I define my component through a components.xml that looks like this :
<component-set>
  <components>
    <component>
      <role>cotinuuminfo.IContinuumInfo</role>
      <role-hint>info</role-hint>
      <implementation>cotinuuminfo.ContinuumInfo</implementation>
      <description>A utility class for parsing the build information of the projects of the Continuum</description>
      <isolated-realm>false</isolated-realm>
      <requirements>
        <requirement>
          <role>org.apache.maven.continuum.store.ContinuumStore</role>
          <role-hint>jdo</role-hint>
          <field-name>store</field-name>
        </requirement>
      </requirements>
    </component>
  </components>
</component-set>

Any help will be appreciated.

regards: Nikolay