jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yamini Kumar, Noida" <yamini.ku...@hcl.in>
Subject Help required to write JSR 170 connector
Date Mon, 25 Feb 2008 12:41:25 GMT


My objective is to standardize the access (read/write or both) to data
content in data sources like a database (MySQL) and any other content
repository that is not JSR 170 compliant like Open CMS, live link or
share point. By standardizing access I mean that the client program will
no longer call the respository specific API like LAPI or JDBC but rather
call JCR API methods to achieve common functions like, login, logout,
read and write. 


I want to clear my concepts by writing a kind of sample connector for MY
SQL database which can be accessed by JCR API rather than JDBC. I
understand that in order to do I need to write a wrapper around JDBC API
which will perform the desired operations using JDBC (as My SQL
understand JDBC) but for a developer the entry point will be JCR API.


I have confusion while writing this wrapper. I have taken an example of
exportsystemview() of JCR API.

The client code to access this method in CRX using JCR API is 



public class ExportXMLFromCRX {

public static void main(String[] args) {

                        String propertyName = "";

                        Repository repository = null;

                        Session repSession = null;

                        FileInputStream fileInputStream = null;

                        FileOutputStream fileOutputStream = null;



                                    ClientRepositoryFactory factory =
new ClientRepositoryFactory();

                                    // This is mandatory for rmi access
to the CRX

System.setProperty("java.rmi.server.useCodebaseOnly", "true"); 

                                    repository =

                                    if(repository != null)


                                    userCredentials = new

repSession = repository.login(new SimpleCredentials("admin",
"admin".toCharArray(), "crx.default");

                                    if(repSession != null)


                                    File outputFile = new

                                    FileOutputStream out = new

repSession.exportSystemView("/MyRootNode", out, false, false);

                                    }//end if(repSession != null)

                                    }// end if(repository != null)

                        } //end try

                        catch (Exception Exc)



                        }//end catch



repSession.save(); //save to update nodes created in the CRX Session

                                    repSession.logout(); //duly log-out
of the CRX session

                                    }//end try

                        }// end finally





What I want is to have a different implementation of the same method
which will fetch data from database in an XML format & returns the XML
the way the above method does


How should I write a wrapper class for my custom method which fetches
record from DB and build an XML but exposed as JCR method? If I am able
to do so then the above client code can be used as it is for my MYSQL
wrapper code as well. The difference will be that it will no longer
fetch data from CRX and build XML but will build an XML based on my
database records.


Please suggest what are the steps I need to perform to achieve this?




The contents of this e-mail and any attachment(s) are confidential and intended for the named
recipient(s) only. 
It shall not attach any liability on the originator or HCL or its affiliates. Any views or
opinions presented in 
this email are solely those of the author and may not necessarily reflect the opinions of
HCL or its affiliates. 
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and
/ or publication of 
this message without the prior written consent of the author of this e-mail is strictly prohibited.
If you have 
received this email in error please delete it and notify the sender immediately. Before opening
any mail and 
attachments please check them for viruses and defect.
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message