abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pratimat <ptummala...@yahoo.com>
Subject Unable to retrieve service document - Abdera server on tomcat
Date Wed, 03 Sep 2008 04:32:59 GMT

I wish to run ABDERA on TOMCAT. The thing runs correctly when i have Jetty as
well as tomcat.
But fails when i try to just use TOMCAT. This is what i have so far.
-------
web.xml
-------
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>AbderaServlet</servlet-name>
<servlet-class>org.apache.abdera.protocol.server.servlet.AbderaServlet</servlet-class>
<init-param>
<param-name>org.apache.abdera.protocol.server.Provider</param-name>
<param-value>AbderaServer.CustomProvider</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>AbderaServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
</web-app>

-------------------
CustomProvider.java  [ This is CustomProvider from Abdera website ]
-------------------
public class CustomProvider extends AbstractWorkspaceProvider
{
   
   public EmployeeCollectionAdapter ca = new EmployeeCollectionAdapter();
   
   public CustomProvider()
   {
     setTargetResolver(      
                        new RegexTargetResolver()
                           .setPattern("/services(\\?[^#]*)?",
TargetType.TYPE_SERVICE)
                           .setPattern("/services/([^/#?]+);categories",
TargetType.TYPE_CATEGORIES, "collection")
                           .setPattern("/services/([^/#?;]+)(\\?[^#]*)?",
TargetType.TYPE_COLLECTION, "collection")
                          
.setPattern("/services/([^/#?]+)/([^/#?]+)(\\?[^#]*)?",
TargetType.TYPE_ENTRY, "collection","entry")
                           .setPattern("/search",
OpenSearchFilter.TYPE_OPENSEARCH_DESCRIPTION)
                      );
                      .
                      .
                      .

     /* Adding my workspace information */
     SimpleWorkspaceInfo workspaceInfo = new SimpleWorkspaceInfo();
     workspaceInfo.setTitle("My Workspace");
     workspaceInfo.addCollection(ca);    
     addWorkspace(workspaceInfo);
                           .
                           .
                           .
// End CustomProvider.java
}

------------------------------
EmployeeCollectionAdapter.java
------------------------------
public class EmployeeCollectionAdapter extends
AbstractEntityCollectionAdapter<Employee> {
        // Feed metadata
        // Entry metadata
        // Methods - PostEntry, PutEntry, DeleteEntry

}

-----------------------
SingletonAbdera.java
--------------------------

public class SingletonAbdera {
   
    private static Abdera abderaInstance = null;
    private static int instanceCounter = 0;
   
    /* Constructor */
    protected Client(){
    }
   
    public static synchronized Abdera getInstance() {
        if (abderaInstance == null) {
            abderaInstance = new Abdera(); instanceCounter++;
System.out.println("INSTANCE COUNTER FROM client.java: "+instanceCounter);
        }
        return abderaInstance;
    }
   
    public static synchronized UtilityObjects getUtilityObjects(Abdera
abderaInstance){
        UtilityObjects utilityObject = new UtilityObjects();
        utilityObject.setAbdera(abderaInstance);
        utilityObject.setAbderaClient(abderaInstance);
        utilityObject.setFactory(abderaInstance);
        utilityObject.setServiceDoc();
        return utilityObject;  
    }

}

-------------------
UtilityObjects.java
-------------------
public class UtilityObjects {
    private Abdera abderaUtilityObject;
    private AbderaClient abderaClientUtilityObject;
    private Service serviceDocumentUtilityObject;
   
    public Abdera getAbdera(){
        return abderaUtilityObject;
    }
   
    public void setAbdera(Abdera abdera){
        this.abderaUtilityObject = abdera;
    }
   
    public AbderaClient getAbderaClient(){
        return abderaClientUtilityObject;
    }
       
    public void setAbderaClient(Abdera abdera){
        this.abderaClientUtilityObject = new AbderaClient(abdera);  
    }
   
    public Service getServiceDoc(){
        return serviceDocumentUtilityObject;
    }
   
    public void setServiceDoc(){
        Document<Service> introspection =
this.abderaClientUtilityObject.get("http://localhost:8080/services").getDocument();
        this.serviceDocumentUtilityObject = introspection.getRoot();
    }
// End UtilityObjects.java  
  }




===============================================
 UtilityOnjects.java instance is used elsewhere.  
SingletonAbdera.java is used to get the abderInstance and the
abderaClientInstance
  [ Document<Service> introspection =
this.abderaClientUtilityObject.get("http://localhost:8080/services").getDocument();
] is   constantly throwing Null pointer Exception
  or some error. So, eventually
utilityObjectInstance.getServiceDoc().getCollection("My Workspace", "My
database") -FAILS.
  I should at least get the service document, and then i can proceed
further.

Can anyone please give suggestions here?

Thanks..

                          
-- 
View this message in context: http://www.nabble.com/Unable-to-retrieve-service-document---Abdera-server-on-tomcat-tp19282771p19282771.html
Sent from the abdera-user mailing list archive at Nabble.com.


Mime
View raw message