Skip to main content

Posts

Showing posts from 2009

Shindig Open Social Gadget Container from Apache

http://incubator.apache.org/shindig/ Apache Shindig is an OpenSocial container and helps you to start hosting OpenSocial apps quickly by providing the code to render gadgets, proxy requests, and handle REST and RPC requests. Apache Shindig's goal is to allow new sites to start hosting social apps in under an hour's worth of work. It has Java and PHP versions.

Java API for HBase Indexing (Pigi)

http://pigi-project.org/ Pigi is: HBase native API based Configurable index system Designed for web application Simple object to HBase  mapping framework    Pigi isn't: Solution for all relation modeling problems (Pigi doesn't support constraint checks) Hibernate for HBase SQL for HBase

Xmlbean Maven plugin

 <plugin> <groupId> org.codehaus.mojo</groupId> <artifactId> xmlbeans-maven-plugin</artifactId> <version> 2.3.3</version> <executions>     <execution>         <goals>             <goal> xmlbeans</goal>         </goals>     </execution> </executions> <inherited> true</inherited> <configuration>     <schemaDirectory> src/main/xsd</schemaDirectory> </configuration> </plugin>

CXF client with XmlBean binding using Maven

Here is the sample code to generate CXF client with xmlbean binding using maven. <plugin> <groupId> org.apache.cxf</groupId> <artifactId> cxf-codegen-plugin</artifactId> <version> 2.2.4</version> <executions> <execution> <id> generate-sources</id> <phase> generate-sources</phase> <configuration> <sourceRoot> ${basedir}/target/generated-sources/cxf</sourceRoot> <wsdlOptions>     <wsdlOption>         <wsdl> ${basedir}/src/main/resources/wsdl/SampleService.wsdl</wsdl>         <extraargs>             <extraarg> -p</extraarg>             <extraarg> uk.co.card.cms.bureau</extraarg>             <extraarg> -impl</extraarg>             <extraarg> -client</extraarg>             <extraarg> -db</extraarg>             <extraarg> xmlbeans</extraarg>         </extraargs>     &l

Persistence API : JDO or JPA ?

http://www.datanucleus.org/products/accessplatform_2_0/persistence_api.html There are two standard API's for persistence - Java Data Objects (JDO) and Java Persistence API (JPA). The former (JDO) is designed for all datastores, and the latter is designed for RDBMS datastores only. When choosing the API to use in your application you should bear the following factors in mind Target datastore : JDO is designed for all datastores, whereas JPA is just designed around RDBMS and explicitly uses RDBMS/SQL terminology. If using RDBMS then you have the choice. If using, for example, an ODBMS then JDO makes much more sense Datastore interoperability : are you likely to change your datastore type at some point in the future ? If so you likely ought to use JDO due to i

Subversion Best practices

http://svnbook.red-bean.com/en/1.5/svn-book.pdf There are some standard, recommended ways to organize a repository. Most people create a trunk directory to hold the “main line” of development, a branches directory to contain branch copies, and a tags directory to contain tag copies. If a repository holds only one project, often people create these top-level directories: /trunk /branches /tags If a repository contains multiple projects, admins typically index their layout by project (see Branching and Merging 111 the section called “Planning Your Repository Organization” to read more about “project roots”): /paint/trunk /paint/branches /paint/tags /calc/trunk /calc/branches /calc/tags Of course, you're free to ignore these common layouts. You can create any sort of variation, whatever works best for you or your team. Remember that whatever you choose, it's not a permanent commitment. You can reorganize your repository at any time. Because branches and tag

XmlBean Ant script

Here is an example ant script to generate xmlbeans from XSD. < ?xml version="1.0" encoding="UTF-8"?> < project name="xmlbean" basedir="." default="xmlbean"> < echo message="${basedir}" /> < path id="xbean.path" > < fileset dir="${basedir}\lib"> < include name="*.jar"/> < /fileset> < /path> < echo message="${xbean.path}"/> < taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean" classpathref="xbean.path" /> < target name="xmlbean"> < xmlbean destfile="${basedir}\schema.jar" classpathref="xbean.path" failonerror="true" javasource="1.5"> < fileset dir="${basedir}\schemas" casesensitive="yes"> < include name="*.xsd" /> < /fileset> < /xmlbean> < /ta

Returning Apache XMLBeans from a Jdbc Control

This topic assumes a strong understanding of Apache XML Beans. For additional information about XML Bean see the Apache XML Beans Site http://xmlbeans.apache.org/. The following topic explains how to return XMLBean types from custom Jdbc controls. An XMLBean is essentially an XML document with a Java API attached to it. The API is used for parsing and manipulating the data in the XML document. The data can be accessed and manipulated using the XMLBean's API. For example, assume that custBean represents the XML document above. The following Java code extracts the Fred Williams from the document. String name = custBean.getXCustomer().getXCustomerRowArray(1).getNAME(); Retrofitting database controls to return XMLBeans rather than RowSets, ResultSets, or Iterators, is a powerful technique because there are few restrictions on where XMLBeans can be imported. This is not the case with ResultSets and I

Create Apache Beehive control's instance out of beehive controller & controls

As we know beehive controls are powerful like Database control. We will access the control in a controller or control using @Control but in normal Java classes we can use this annotation. We can access control object outside beehive context by following: ControlTestContainerContext ctcc = new ControlTestContainerContext(); ctcc.beginContext(); SampleCTL CTL = Controls.instantiate(SampleCTLBean.class, null, ctcc, null); SampleCTL - control interface SampleCTLBean - Control's Bean class, which generated by beehive apt compiler. In this way we can use the beehive system controls, in Restful services, Servlet and Java application. Happy coding.

Xmlbean Vs JAXB

As we know JAXB is used for XML binding with Java. Also Apache XmlBeans also used to XML binding with JAVA. Here I am going to say (Prove) which best to use? JAXB Advantages: Sun's Implementation well known with JAX-WS & JAX-RPC Disadvantages: To Marshall & UnMarshall we to write manual code. XmlBean Advantages: No need to write code to Marshall & UnMarshall Inbuilt support for Saxon xQuery & XPath All Bea products using (Weblogic Portal, Aqualogic Service Bus) Disadvantages: Not known by many developers JAXB sample code to bind XML: public class Main { public static void main(String[] args) { Object pud = unmarshall(some.pkg", TestDocument.class); marshall("poc.act.cms.poc", pud); } public static void marshall(String namesapce, Object object) { try { JAXBContext jc = JAXBContext.newInstance(namesapce); Marshaller m = jc.createMarshaller(); m.setProp

Why JPA?

A fundamental question for many Java developers is "Why JPA? Why do I need to know how to use this API when object-relational mapping tools like Hibernate and Toplink are already available?" The answer is that JPA is not a new technology; rather, it has collected the best ideas from existing persistence technologies like Hibernate, TopLink, and JDO. The result is a standardized specification that helps you build a persistence layer that is independent of any particular persistence provider.

Create Thread Pool in JAVA is Easy now

By using ExecutorService we can create a pool of threads and run in parallel. This feature has introduced in JAVA5. see the below links. ExecutorService ThreadPoolExecutor here is an example: ExecutorService exec = Executors.newFixedThreadPool(10); for (int i=0;i<100;i++) { exec.execute(new DoSomething(data)); } in this example we have created a pool of threads contains 10. Here new DoSomething(data) will be executed 10times parallel. this can be used, where we need to call Web services since we cannot create webservice connection pool.

Develope & deploy, debug JSR168 portlet with netbeans

As we know netbeans have portalpack plug in to develop JSR168 & 286 portlets. But we need portlet container to deploy & debug portlets. GateIn give a simple portlet container where we can test our portlets. To download click here Followed the below steps: Install portalpack plugin in netbeans Download and unzip GateIn Portlet Container Add new server(Tomcat) in netbeans as Unzipped folder like E:\jeeva\gatein-portletcontainer-2.1.0-Beta01-tomcat6 Create new web application and select Portlet support in netbeans For our webapp select server as created one. Develop portlet and deploy. this will deploy our app as normal webapp deployment in tomcat The GateIn Portlet Container will read this app and register with the container. Add the portlet in demo JSP of GateIn Portlet Container's simple-portal Access the url http://localhost:8080/simple-portal/demo/demo.jsp To debug our app start the server in debug mode from netbeans. So we can easily develop, deploy & debug our JSR p