KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > xml > multispaced > pm > jdbc > JDBCPmMetaDataProvider


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.test.xml.multispaced.pm.jdbc;
8
9 import org.jboss.logging.Logger;
10 import org.jboss.xb.binding.MarshallingContext;
11 import org.jboss.xb.binding.ObjectModelProvider;
12
13 /**
14  * @version <tt>$Revision: 1.3.2.2 $</tt>
15  * @author <a HREF="mailto:alex@jboss.org">Alexey Loubyansky</a>
16  */

17 public class JDBCPmMetaDataProvider
18    implements ObjectModelProvider
19 {
20    private static final Logger log = Logger.getLogger(JDBCPmMetaDataFactory.class);
21
22    private final JDBCPm pm;
23
24    public JDBCPmMetaDataProvider(JDBCPm pm)
25    {
26       this.pm = pm;
27    }
28
29    public Object JavaDoc getRoot(Object JavaDoc o, MarshallingContext ctx, String JavaDoc namespaceURI, String JavaDoc localName)
30    {
31       log.debug("getRoot(): o=" + o.getClass());
32       return pm;
33    }
34
35    public Object JavaDoc getChildren(JDBCPm pm, String JavaDoc namespaceUri, String JavaDoc localName)
36    {
37       log.debug("getChildren> ns=" + namespaceUri + ", localName=" + localName);
38       return null;
39    }
40
41    public Object JavaDoc getElementValue(JDBCPm pm, String JavaDoc namespaceUri, String JavaDoc localName)
42    {
43       log.debug("getValue> ns=" + namespaceUri + ", localName=" + localName);
44       Object JavaDoc child = null;
45       if("datasource".equals(localName))
46       {
47          child = pm.getDatasource();
48       }
49       else if("table".equals(localName))
50       {
51          child = pm.getTable();
52       }
53       return child;
54    }
55 }
56
Popular Tags