KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > providers > gs > filters > GigaSpacesTemplateFilter


1 /*
2  * $Id: GigaSpacesTemplateFilter.java 3807 2006-11-06 13:13:36Z holger $
3  * --------------------------------------------------------------------------------------
4  * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
5  *
6  * The software in this package is published under the terms of the MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.providers.gs.filters;
12
13 import java.lang.reflect.InvocationTargetException JavaDoc;
14
15 import net.jini.core.entry.Entry;
16
17 import org.apache.commons.beanutils.BeanUtils;
18 import org.mule.providers.gs.GigaSpacesEntryConverter;
19 import org.mule.util.ClassUtils;
20
21 /**
22  * TODO document
23  */

24 public class GigaSpacesTemplateFilter extends JavaSpaceTemplateFilter
25 {
26     private GigaSpacesEntryConverter converter = new GigaSpacesEntryConverter();
27
28     public Entry getEntry()
29         throws IllegalAccessException JavaDoc, NoSuchMethodException JavaDoc, InvocationTargetException JavaDoc,
30         InstantiationException JavaDoc, ClassNotFoundException JavaDoc
31     {
32         if (entry == null)
33         {
34             if (expectedType == null)
35             {
36                 return null; // Match all template
37
}
38             Object JavaDoc entryType = ClassUtils.instanciateClass(expectedType, ClassUtils.NO_ARGS);
39             if (fields.size() > 0)
40             {
41                 BeanUtils.populate(entryType, fields);
42             }
43             entry = converter.toEntry(entryType, null);
44         }
45         return entry;
46     }
47
48 }
49
Popular Tags