Date: 2004-07-16T08:25:35
Editor: KurtHoehn <[EMAIL PROTECTED]>
Wiki: Jakarta HiveMind Wiki
Page: ExtendingSmartTranslator
URL: http://wiki.apache.org/jakarta-hivemind/ExtendingSmartTranslator
no comment
Change Log:
------------------------------------------------------------------------------
@@ -170,3 +170,61 @@
HowardLewisShip: This is very good, however I have one criticsm. The
!PropertyEditorLoader service should implement java.lang.Runnable and be
contributed into
the {{{hivemind.Startup}}} configuration. Even as coded here, the methods
{{{setPropertyEditors()}}} and {{{register()}}} can be part of the service
implementation
''but not the service interface'', because it doesn't make sense for other
code to call these methods.
+
+----
+KurtHoehn: Thank You, I understand but I'm trying to show the many different
things that you can do with hivemind creating a service, schema, configuration,
contribution, etc.
+----
+= Alternative PropertyEditorLoader Service =
+== PropertyEditorLoader Implementation (PropertyEditorLoaderImpl.java) ==
+{{{
+public class PropertyEditorLoaderImpl implements Runnable
+{
+ private List _editors;
+ private ClassResolver _resolver;
+
+ public void run()
+ {
+ for( int i=0; i < _editors.size(); i++ )
+ {
+ PropertyEditorParameters editors = (PropertyEditorParameters)
_editors.get(i);
+
+ Class targetType = _resolver.findClass( editors.getTargetType() );
+ Class editorClass = _resolver.findClass( editors.getEditorClass() );
+
+ PropertyEditorManager.registerEditor( targetType, editorClass );
+ }
+ }
+
+ public void setPropertyEditors(List editors)
+ {
+ _editors = editors;
+ }
+
+ public void setClassResolver( ClassResolver resolver )
+ {
+ _resolver = resolver;
+ }
+}
+}}}
+== hivemind.sdl ==
+{{{
+...
+service-point ( id=PropertyEditorLoader interface=java.lang.Runnable)
+{
+ "Register an editor class to be used to edit values of a given target class"
+
+ invoke-factory( service-id=hivemind.BuilderFactory )
+ {
+ construct ( class=propertyeditor.PropertyEditorLoaderImpl
class-resolver-property=classResolver )
+ {
+ set-configuration( property=propertyEditors
configuration-id=PropertyEditors )
+ }
+ }
+}
+...
+contribution (configuration-id=hivemind.Startup)
+{
+ service ( service-id=PropertyEditorLoader )
+}
+...
+}}}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]