Return-Path: Delivered-To: apmail-jakarta-hivemind-cvs-archive@www.apache.org Received: (qmail 27462 invoked from network); 16 Jul 2004 15:25:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 16 Jul 2004 15:25:58 -0000 Received: (qmail 4900 invoked by uid 500); 16 Jul 2004 15:25:40 -0000 Delivered-To: apmail-jakarta-hivemind-cvs-archive@jakarta.apache.org Received: (qmail 4826 invoked by uid 500); 16 Jul 2004 15:25:39 -0000 Mailing-List: contact hivemind-cvs-help@jakarta.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: hivemind-dev@jakarta.apache.org Delivered-To: mailing list hivemind-cvs@jakarta.apache.org Received: (qmail 4733 invoked by uid 99); 16 Jul 2004 15:25:38 -0000 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.27.1) with SMTP; Fri, 16 Jul 2004 08:25:37 -0700 Received: (qmail 27204 invoked from network); 16 Jul 2004 15:25:35 -0000 Received: from localhost.hyperreal.org (HELO minotaur.apache.org) (127.0.0.1) by localhost.hyperreal.org with SMTP; 16 Jul 2004 15:25:35 -0000 Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: hivemind-cvs@jakarta.apache.org To: hivemind-cvs@jakarta.apache.org Subject: =?iso-8859-1?q?=5BJakarta_HiveMind_Wiki=5D_Updated=3A__ExtendingSmartTran?= =?iso-8859-1?q?slator?= Date: Fri, 16 Jul 2004 15:25:35 -0000 Message-ID: <20040716152535.27199.3603@minotaur.apache.org> X-Spam-Rating: localhost.hyperreal.org 1.6.2 0/1000/N X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Date: 2004-07-16T08:25:35 Editor: KurtHoehn 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 !Pro= pertyEditorLoader service should implement java.lang.Runnable and be contri= buted 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 differ= ent things that you can do with hivemind creating a service, schema, config= uration, contribution, etc. +---- +=3D Alternative PropertyEditorLoader Service =3D +=3D=3D PropertyEditorLoader Implementation (PropertyEditorLoaderImpl.java)= =3D=3D +{{{ +public class PropertyEditorLoaderImpl implements Runnable +{ + private List _editors; + private ClassResolver _resolver; + = + public void run() + { + for( int i=3D0; i < _editors.size(); i++ ) + { + PropertyEditorParameters editors =3D (PropertyEditorParameters) _edi= tors.get(i); + + Class targetType =3D _resolver.findClass( editors.getTargetType() ); + Class editorClass =3D _resolver.findClass( editors.getEditorClass() = ); + = + PropertyEditorManager.registerEditor( targetType, editorClass ); + } + } + + public void setPropertyEditors(List editors) + { + _editors =3D editors; + } + = + public void setClassResolver( ClassResolver resolver ) + { + _resolver =3D resolver; + } +} +}}} +=3D=3D hivemind.sdl =3D=3D +{{{ +... +service-point ( id=3DPropertyEditorLoader interface=3Djava.lang.Runnable) +{ + "Register an editor class to be used to edit values of a given target cl= ass" + = + invoke-factory( service-id=3Dhivemind.BuilderFactory ) + { + construct ( class=3Dpropertyeditor.PropertyEditorLoaderImpl class-reso= lver-property=3DclassResolver ) + { + set-configuration( property=3DpropertyEditors configuration-id=3DPro= pertyEditors ) + } = + } +} +... +contribution (configuration-id=3Dhivemind.Startup) +{ + service ( service-id=3DPropertyEditorLoader ) = +} +... +}}} --------------------------------------------------------------------- To unsubscribe, e-mail: hivemind-cvs-unsubscribe@jakarta.apache.org For additional commands, e-mail: hivemind-cvs-help@jakarta.apache.org