Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/flexstor/ejb/setting/SettingsBean.java


1   /*
2    * SettingsBean.java
3    *
4    * Copyright $Date: 2003/08/11 02:22:48 $ FLEXSTOR.net Inc.
5    *
6    * This work is licensed for use and distribution under license terms found at
7    * http://www.flexstor.org/license.html
8    *
9    */
10  
11  package com.flexstor.ejb.setting;
12  
13  import java.rmi.RemoteException;
14  import java.util.Vector;
15  
16  import javax.ejb.CreateException;
17  import javax.ejb.RemoveException;
18  
19  import com.flexstor.common.constants.EjbHomeInterfacesI;
20  import com.flexstor.common.data.ejb.SettingData;
21  import com.flexstor.common.data.ejb.address.EmailAddressData;
22  import com.flexstor.common.data.ejb.address.FtpAddressData;
23  import com.flexstor.common.data.ejb.setting.ImportSettingData;
24  import com.flexstor.common.data.ejb.setting.SendSettingData;
25  import com.flexstor.common.exceptions.ejb.DuplicateRecordException;
26  import com.flexstor.common.exceptions.ejb.EjbException;
27  import com.flexstor.common.exceptions.ejb.NotFoundException;
28  import com.flexstor.common.exceptions.ejb.RecordUpdatedException;
29  import com.flexstor.common.keys.ejb.EmailAddressCollectionKey;
30  import com.flexstor.common.keys.ejb.EmailAddressKey;
31  import com.flexstor.common.keys.ejb.FlexKey;
32  import com.flexstor.common.keys.ejb.FtpAddressCollectionKey;
33  import com.flexstor.common.keys.ejb.FtpAddressKey;
34  import com.flexstor.common.keys.ejb.ImportSettingCollectionKey;
35  import com.flexstor.common.keys.ejb.ImportSettingKey;
36  import com.flexstor.common.keys.ejb.RoleKey;
37  import com.flexstor.common.keys.ejb.SendSettingCollectionKey;
38  import com.flexstor.common.keys.ejb.SendSettingKey;
39  import com.flexstor.common.keys.ejb.SettingKey;
40  import com.flexstor.ejb.EjbObject;
41  import com.flexstor.ejb.PersistSessionBean;
42  import com.flexstor.ejb.address.persist.EmailAddressPersist;
43  import com.flexstor.ejb.address.persist.EmailAddressPersistHome;
44  import com.flexstor.ejb.address.persist.FtpAddressPersist;
45  import com.flexstor.ejb.address.persist.FtpAddressPersistHome;
46  import com.flexstor.ejb.role.persist.RolePersist;
47  import com.flexstor.ejb.role.persist.RolePersistHome;
48  import com.flexstor.ejb.setting.persist.ImportSettingPersist;
49  import com.flexstor.ejb.setting.persist.ImportSettingPersistHome;
50  import com.flexstor.ejb.setting.persist.SendSettingPersist;
51  import com.flexstor.ejb.setting.persist.SendSettingPersistHome;
52  import com.flexstor.ejb.trace.BeanTrace;
53  
54  /**
55   *
56   * <P>
57   * Settings <BR>
58   * <BLOCKQUOTE>
59   *    This interface defines all the operations for settings such as Send Setting, Import Settings, <BR>
60   *    Email Settings and Ftp Settings <BR>
61   *    The bean implementation should use a factory object to instantiate a persist bean <BR>
62   *    corresponding to the setting type and delegate calls to this bean. <BR>
63   * </BLOCKQUOTE>
64   * </P>
65   *
66   * <P>
67   * Uses cache: no
68   *
69   * State Management Type: Stateless
70   * </P>
71   *
72   * Configurable properties in flexdm.properties: <BR>
73   * <BLOCKQUOTE>
74   * <P>
75   *    NONE <BR>
76   * </P>
77   * </BLOCKQUOTE>
78   *
79   */
80  public class SettingsBean
81      extends PersistSessionBean 
82  {
83     /** MKS identifier */
84     public final static String IDENTIFIER = "$Id: SettingsBean.java,v 1.4 2003/08/11 02:22:48 aleric Exp $";
85  
86      /**
87      * EJB container calls ejbCreate in order to create an instance of the object. ejbCreate initalizes the state of <br>
88      * the EJB object.
89      *
90      * This method corresponds to the create method in the home interface <code>PingHome</code>.
91      *
92      * @exception javax.ejb.CreateException   - The EJB server could not create an instance of this bean
93      * @exception java.rmi.RemoteException    - Some problem occured with the EJB server
94      * 
95      * @see com.flexstor.ejb.util.PingHome
96      */
97       
98      public void ejbCreate() 
99          throws CreateException, RemoteException 
100     {
101       // create an initial Context object
102       buildInitialContext("SettingsBean");
103     }
104 
105    /**
106     * Obtain a reference to a bean
107     *
108     * @return com.flexstor.ejb.EjbHome
109     *
110     * @exception com.flexstor.common.exceptions.ejb.EjbException    - Could not create EmailAddressPersist bean
111     * @exception java.rmi.RemoteException                          - Some problem occured with the EJB server
112     */
113    private EjbObject getBeanInterface( String bean )
114       throws RemoteException
115    {
116       try
117       {
118          if ( bean.equals(EjbHomeInterfacesI.EMAIL_PERSIST_HOME) )
119             return ((EmailAddressPersistHome)getBeanHome( bean, EmailAddressPersistHome.class )).create();
120          else if ( bean.equals(EjbHomeInterfacesI.FTP_PERSIST_HOME) )
121             return ((FtpAddressPersistHome)getBeanHome( bean, FtpAddressPersistHome.class )).create();
122          else if ( bean.equals(EjbHomeInterfacesI.ROLE_HOME) )
123             return ((RolePersistHome)getBeanHome( bean, RolePersistHome.class )).create();
124          else if ( bean.equals(EjbHomeInterfacesI.SEND_SETTING_HOME) )
125             return ((SendSettingPersistHome)getBeanHome( bean, SendSettingPersistHome.class )).create();
126          else if ( bean.equals(EjbHomeInterfacesI.IMPORT_SETTING_HOME) )
127             return ((ImportSettingPersistHome)getBeanHome( bean, ImportSettingPersistHome.class )).create();
128          else
129             return null;
130       }
131       catch ( Exception e )
132       {
133          throw new RemoteException( e.toString() );
134       }
135    }
136 
137    /**
138     * Add a setting to database.
139     * Transaction Attribute: Required
140     *
141     * @param  aDataObject - Object containing the setting to be added into the database
142     * @return - The new object containing the key and the time stamp
143     *
144     * @exception DuplicateRecordException - A row already exists within the database with the given key
145     * @exception EjbException - Some problem occured with the database
146     * @exception RemoteException - Some problem occured with the EJB server
147     */
148     public SettingData add(SettingData aDataObject)
149         throws DuplicateRecordException, EjbException, RemoteException
150     {
151         EjbObject ejbObject = null;
152         try
153         {
154            if ( aDataObject instanceof EmailAddressData )
155            {
156                ejbObject = getBeanInterface( EjbHomeInterfacesI.EMAIL_PERSIST_HOME );
157                return (( EmailAddressPersist )ejbObject).insert( (EmailAddressData)aDataObject );
158            }
159            else if ( aDataObject instanceof FtpAddressData )
160            {
161                ejbObject = getBeanInterface( EjbHomeInterfacesI.FTP_PERSIST_HOME );
162                return (( FtpAddressPersist )ejbObject).insert( (FtpAddressData)aDataObject );
163            }
164            else if ( aDataObject instanceof SendSettingData )
165            {
166                ejbObject = getBeanInterface( EjbHomeInterfacesI.SEND_SETTING_HOME );
167                return (( SendSettingPersist )ejbObject).insert( (SendSettingData)aDataObject );
168            }
169            else if ( aDataObject instanceof ImportSettingData )
170            {
171                ejbObject = getBeanInterface( EjbHomeInterfacesI.IMPORT_SETTING_HOME );
172                return (( ImportSettingPersist )ejbObject).insert( (ImportSettingData)aDataObject );
173            }
174            else
175                throw new RemoteException("Invalid Setting Data Object ["   + aDataObject.getClass().getName() + "] Passed to SettingsBean: add( dataObject )");
176          }
177          finally
178          {
179             if ( ejbObject != null )
180                try { ejbObject.remove(); }
181                catch ( RemoveException re ) {}
182          }
183     }
184 
185    /**
186     * Add a setting to database and assigns it to the given role in one transaction.
187     * Transaction Attribute: Required
188     *
189     * @param aDataObject - The new setting data
190     * @param aRoleKey - role that setting will be added to
191     * @return - the modified data object with the new key and time stamp
192     *
193     * @exception DuplicateRecordException - A row already exists within the database with the given key
194     * @exception EjbException - Some problem occured with the database
195     * @exception RemoteException - Some problem occured with the EJB server
196     */
197     public SettingData add(SettingData aDataObject, RoleKey aRoleKey)
198         throws DuplicateRecordException, EjbException, RemoteException
199     {
200         RolePersist rPersist = (RolePersist) getBeanInterface( EjbHomeInterfacesI.ROLE_HOME );
201         try
202         {
203            if ( aDataObject instanceof EmailAddressData )
204            {
205                EmailAddressData emailDat = (EmailAddressData)add( aDataObject );
206                rPersist.addEMailAddress( (EmailAddressKey)emailDat.getKey(), aRoleKey );
207                return emailDat;
208            }
209            else if ( aDataObject instanceof FtpAddressData )
210            {
211                FtpAddressData ftpDat = (FtpAddressData)add( aDataObject );
212                rPersist.addFtpAddress( (FtpAddressKey)ftpDat.getKey(),aRoleKey );
213                return ftpDat;
214            }
215            else if ( aDataObject instanceof SendSettingData )
216            {
217                BeanTrace.println( "#### add( SettingData aDataObject, RoleKey aRoleKey); << adding a SendSettingData", BeanTrace.DEBUG );
218                SendSettingData dat = (SendSettingData)add( aDataObject );
219                rPersist.addSendSetting( (SendSettingKey)dat.getKey(), aRoleKey );
220                return dat;
221            }
222            else if ( aDataObject instanceof ImportSettingData )
223            {
224                ImportSettingData dat = (ImportSettingData)add( aDataObject );
225                rPersist.addImportSetting( (ImportSettingKey)dat.getKey(), aRoleKey );
226                return dat;
227            }
228             else
229                throw new RemoteException("Invalid Setting Data Object ["  + aDataObject.getClass().getName() + "] Passed to SettingsBean: add( dataObject )");
230          }
231          finally
232          {
233             if ( rPersist != null )
234                try { rPersist.remove(); }
235                catch ( RemoveException re ) {}
236          }
237     }
238 
239    /**
240     * Assign an existing setting to a role.
241     * Transaction Attribute: Required
242     *
243     * @param akey - the key of the setting
244     * @param aRoleKey - role that setting will be added to
245     *
246     * @exception EjbException - Some problem occured with the database
247     * @exception RemoteException - Some problem occured with the EJB server
248     */
249     public void assignToRole(SettingKey aKey, RoleKey aRoleKey)
250         throws EjbException, RemoteException
251     {
252         RolePersist rPersist = (RolePersist) getBeanInterface( EjbHomeInterfacesI.ROLE_HOME );
253 
254         try
255         {
256            if ( aKey instanceof EmailAddressKey )
257                rPersist.addEMailAddress( (EmailAddressKey)aKey, aRoleKey );
258            else if ( aKey instanceof FtpAddressKey )
259                rPersist.addFtpAddress( (FtpAddressKey)aKey, aRoleKey );
260            else if ( aKey instanceof SendSettingKey )
261                rPersist.addSendSetting( (SendSettingKey)aKey, aRoleKey );
262            else if ( aKey instanceof ImportSettingKey )
263                rPersist.addImportSetting( (ImportSettingKey)aKey, aRoleKey );
264             else
265                throw new RemoteException("Invalid Key Object [" + aKey.getClass().getName() + "] Passed to SettingsBean: add( dataObject )");
266          }
267          finally
268          {
269             if ( rPersist != null )
270                try { rPersist.remove(); }
271                catch ( RemoveException re ) {}
272          }
273     }
274 
275    /**
276     * Removes a setting from a role.
277     * Transaction Attribute: Required
278     *
279     * @param aKey - the key of the setting
280     * @param aRoleKey - role that setting will be removed from
281     *
282     * @exception EjbException - Some problem occured with the database
283     * @exception RemoteException - Some problem occured with the EJB server
284     */
285     public void removeFromRole(SettingKey aKey, RoleKey aRoleKey)
286         throws EjbException, RemoteException
287     {
288         RolePersist rPersist = (RolePersist) getBeanInterface( EjbHomeInterfacesI.ROLE_HOME );
289 
290         try
291         {
292            if ( aKey instanceof EmailAddressKey )
293                rPersist.deleteEMailAddress( (EmailAddressKey)aKey, aRoleKey );
294            else if ( aKey instanceof FtpAddressKey )
295                rPersist.deleteFtpAddress( (FtpAddressKey)aKey, aRoleKey );
296            else if ( aKey instanceof SendSettingKey )
297                rPersist.deleteSendSetting( (SendSettingKey)aKey, aRoleKey );
298            else if ( aKey instanceof ImportSettingKey )
299                rPersist.deleteImportSetting( (ImportSettingKey)aKey, aRoleKey );
300             else
301                throw new RemoteException("Invalid Key Object [" + aKey.getClass().getName() + "] Passed to SettingsBean: add( dataObject )");
302          }
303          finally
304          {
305             if ( rPersist != null )
306                try { rPersist.remove(); }
307                catch ( RemoveException re ) {}
308          }
309    }
310 
311    /**
312     * Remove a setting from the database. Implicitly removes it from all roles.
313     * Transaction Attribute: Required
314     *
315     * @param aKey - key of the setting to be removed
316     *
317     * @exception EjbException - Some problem occured with the database
318     * @exception RemoteException - Some problem occured with the EJB server
319     */
320     public void delete(SettingKey aKey)
321         throws EjbException, RemoteException
322     {
323         EjbObject ejbObject = null;
324         try
325         {
326            if ( aKey instanceof EmailAddressKey )
327            {
328                ejbObject = getBeanInterface( EjbHomeInterfacesI.EMAIL_PERSIST_HOME );
329                (( EmailAddressPersist )ejbObject).remove( (EmailAddressKey)aKey );
330            }
331            else if ( aKey instanceof FtpAddressKey )
332            {
333                ejbObject = getBeanInterface( EjbHomeInterfacesI.FTP_PERSIST_HOME );
334                (( FtpAddressPersist )ejbObject).remove( (FtpAddressKey)aKey );
335            }
336            else if ( aKey instanceof SendSettingKey )
337            {
338                ejbObject = getBeanInterface( EjbHomeInterfacesI.SEND_SETTING_HOME );
339                (( SendSettingPersist )ejbObject).remove( (SendSettingKey)aKey );
340            }
341            else if ( aKey instanceof ImportSettingKey )
342            {
343                ejbObject = getBeanInterface( EjbHomeInterfacesI.IMPORT_SETTING_HOME );
344                (( ImportSettingPersist )ejbObject).remove( (ImportSettingKey)aKey );
345            }
346            else
347                throw new RemoteException("Invalid Setting Data Object ["   + aKey.getClass().getName() + "] Passed to SettingsBean: delete( key )");
348          }
349          finally
350          {
351             if ( ejbObject != null )
352                try { ejbObject.remove(); }
353                catch ( RemoveException re ) {}
354          }
355     }
356 
357    /**
358     * Remove a setting from the database. Implicitly removes it from all roles.
359     * Transaction Attribute: Required
360     *
361     * @param aData - Data object containing setting to be removed
362     *
363     * @exception EjbException - Some problem occured with the database
364     * @exception RemoteException - Some problem occured with the EJB server
365     * @exception NotFoundException - The setting was not found in the database
366     */
367     public void delete(SettingData aData)
368         throws EjbException, RemoteException, NotFoundException
369     {
370         SettingKey aKey = aData.getKey();
371         
372         if ( aKey != null )
373         {
374            delete ( aKey );
375         }
376         else // if the key in NULL, try Name !
377         {
378            /**
379             * This is a possible case with import setting only right now. As it is loaded from
380             * file system, its not associated with a key, hence to delete a setting we need to
381             * use the second option.. the name of the setting. Apperantly, the remove (settingName)
382             * is not available in other types of setting beans (email or ftp or send), as they
383             * are always loaded from the database so each setting object is always associated with
384             * a corresponding settingkey, though function can be added anytime.
385             */
386            String settingName = aData.getName();
387            if ( settingName != null )
388            {
389              if ( aData instanceof ImportSettingData )
390              {
391                ImportSettingPersist importSettingPersist = (ImportSettingPersist)getBeanInterface(EjbHomeInterfacesI.IMPORT_SETTING_HOME);
392                try
393                {
394                   importSettingPersist.remove( settingName );
395                }
396                finally
397                {
398                   if ( importSettingPersist != null )
399                      try { importSettingPersist.remove(); }
400                      catch ( RemoveException re ) {}
401                }
402              }
403              else
404              {
405                // Since right now only ImportSettingBean has implemented it !
406                // Appropriate functions should be called on the beans when they implement delete (settingName)
407                throw new RemoteException("Key is NULL and deletion using setting name is not supported yet" );
408              }
409            }
410            else
411            {
412              throw new RemoteException("Both key and name of setting Data Object are NULL" );
413            }
414         }
415     }
416 
417    /**
418     * Retrieves one setting for the given setting key.
419     * Transaction Attribute: Not Supported
420     *
421     * @param akey - key of the setting to be retrieved
422     * @return - specific setting subclass for the key
423     *
424     * @exception EjbException - Some problem occured with the database
425     * @exception RemoteException - Some problem occured with the EJB server
426     * @exception NotFoundException - The setting was not found in the database
427     */
428     public SettingData get(SettingKey aKey)
429         throws EjbException, RemoteException, NotFoundException
430     {
431         if ( aKey == null )
432             return null;
433 
434         EjbObject ejbObject = null;
435         try
436         {
437            if ( aKey instanceof EmailAddressKey )
438            {
439                ejbObject = getBeanInterface( EjbHomeInterfacesI.EMAIL_PERSIST_HOME );
440                return (( EmailAddressPersist )ejbObject).getEMailAddress( (EmailAddressKey)aKey );
441            }
442            else if ( aKey instanceof FtpAddressKey )
443            {
444                ejbObject = getBeanInterface( EjbHomeInterfacesI.FTP_PERSIST_HOME );
445                return (( FtpAddressPersist )ejbObject).getFtpAddress( (FtpAddressKey)aKey );
446            }
447            else if ( aKey instanceof SendSettingKey )
448            {
449                ejbObject = getBeanInterface( EjbHomeInterfacesI.SEND_SETTING_HOME );
450                return (( SendSettingPersist )ejbObject).getSendSetting( (SendSettingKey)aKey );
451            }
452            else if ( aKey instanceof ImportSettingKey )
453            {
454                ejbObject = getBeanInterface( EjbHomeInterfacesI.IMPORT_SETTING_HOME );
455                return (( ImportSettingPersist )ejbObject).getImportSetting( (ImportSettingKey)aKey );
456            }
457            else
458               throw new RemoteException("Invalid Setting Data Object ["   + aKey.getClass().getName() + "] Passed to SettingsBean: delete( key )");
459          }
460          finally
461          {
462             if ( ejbObject != null )
463                try { ejbObject.remove(); }
464                catch ( RemoveException re ) {}
465          }
466     }
467 
468    /**
469     * Retrieves settings for the given collection of settings keys.
470     * Transaction Attribute: Not Supported
471     *
472     * @param keyCollection - vector of setting keys
473     * @return - SettingData collection matching the order of the keys
474     *
475     * @exception EjbException - Some problem occured with the database
476     * @exception RemoteException - Some problem occured with the EJB server
477     */
478     public Vector get(Vector keyCollections)
479         throws EjbException, RemoteException
480     {
481         if ( keyCollections == null || keyCollections.size() == 0 )
482             return new Vector();
483             
484         FlexKey keyCollection = (FlexKey)keyCollections.elementAt(0);
485         EjbObject ejbObject = null;
486         try
487         {
488             if ( keyCollection instanceof EmailAddressCollectionKey )
489             {
490                 ejbObject = getBeanInterface( EjbHomeInterfacesI.EMAIL_PERSIST_HOME );
491                 return (( EmailAddressPersist )ejbObject).getEMailAddresses( keyCollections );
492             }
493             else if ( keyCollection instanceof FtpAddressCollectionKey )
494             {
495                 ejbObject = getBeanInterface( EjbHomeInterfacesI.FTP_PERSIST_HOME );
496                 return (( FtpAddressPersist )ejbObject).getFtpAddresses( keyCollections );
497             }
498             else if ( keyCollection instanceof SendSettingCollectionKey )
499             {
500                 ejbObject = getBeanInterface( EjbHomeInterfacesI.SEND_SETTING_HOME );
501                 return (( SendSettingPersist )ejbObject).getSendSetting( keyCollections );
502             }
503             else if ( keyCollection instanceof ImportSettingCollectionKey )
504             {
505                 ejbObject = getBeanInterface( EjbHomeInterfacesI.IMPORT_SETTING_HOME );
506                 return (( ImportSettingPersist )ejbObject).getImportSetting( keyCollections );
507             }
508             else
509                 throw new RemoteException("Invalid Setting Data Object ["   + keyCollection.getClass().getName() + "] Passed to SettingsBean: get( keyCollection )");
510         }
511         catch ( NotFoundException e )
512         {
513             return new Vector();
514         }
515         finally
516         {
517             if ( ejbObject != null )
518                try { ejbObject.remove(); }
519                catch ( RemoveException re ) {}
520         }
521     }
522 
523    /**
524     * Retrieve all settings of the given type.
525     * Transaction Attribute: Not Supported
526     *
527     * @param nType - The type of setting to retrieve: SEND, IMPORT, EMAIL, FTP
528     * @return - SettingData collection
529     *
530     * @exception EjbException - Some problem occured with the database
531     * @exception RemoteException - Some problem occured with the EJB server
532     */
533     public Vector get(int nType)
534         throws EjbException, RemoteException
535     {
536         EjbObject ejbObject = null;
537         try
538         {
539             if ( nType == SettingData.EMAIL_ADDRESS )
540             {
541                 ejbObject = getBeanInterface( EjbHomeInterfacesI.EMAIL_PERSIST_HOME );
542                 return (( EmailAddressPersist )ejbObject).getEMailAddressList();
543             }
544             else if ( nType == SettingData.FTP_ADDRESS )
545             {
546                 ejbObject = getBeanInterface( EjbHomeInterfacesI.FTP_PERSIST_HOME );
547                 return (( FtpAddressPersist )ejbObject).getFtpAddressList();
548             }
549             else if ( nType == SettingData.SEND )
550             {
551                 ejbObject = getBeanInterface( EjbHomeInterfacesI.SEND_SETTING_HOME );
552                 return (( SendSettingPersist )ejbObject).getAllSendSettings();
553             }
554             else if ( nType == SettingData.IMPORT )
555             {
556                 ejbObject = getBeanInterface( EjbHomeInterfacesI.IMPORT_SETTING_HOME );
557                 return (( ImportSettingPersist )ejbObject).getAllImportSettings();
558             }
559             else
560                 throw new RemoteException("Invalid Setting Type ["   + nType + "] Passed to SettingsBean: get( type )");
561         }
562         catch ( NotFoundException e )
563         {
564             return new Vector();
565         }
566         finally
567         {
568             if ( ejbObject != null )
569                try { ejbObject.remove(); }
570                catch ( RemoveException re ) {}
571         }
572     }
573 
574    /**
575     * Update a setting. Returned data object contains new timestamp.
576     * Transaction Attribute: Required
577     *
578     * @param aDataObject - setting to be modified
579     * @return - setting with modified timestamp
580     *
581     * @exception DuplicateRecordException - setting already exists within the database with the given name/key
582     * @exception EjbException - Some problem occured with the database
583     * @exception RemoteException - Some problem occured with the EJB server
584     * @exception RecordUpdateException - Record cannot be overriden
585     */
586     public SettingData update(SettingData aDataObject)
587         throws EjbException, RemoteException, DuplicateRecordException, RecordUpdatedException
588     {
589         EjbObject ejbObject = null;
590         try
591         {
592            if ( aDataObject instanceof EmailAddressData )
593            {
594                ejbObject = getBeanInterface( EjbHomeInterfacesI.EMAIL_PERSIST_HOME );
595                return (( EmailAddressPersist )ejbObject).update( (EmailAddressData)aDataObject );
596            }
597            else if ( aDataObject instanceof FtpAddressData )
598            {
599                ejbObject = getBeanInterface( EjbHomeInterfacesI.FTP_PERSIST_HOME );
600                return (( FtpAddressPersist )ejbObject).update( (FtpAddressData)aDataObject );
601            }
602            else if ( aDataObject instanceof SendSettingData )
603            {
604                ejbObject = getBeanInterface( EjbHomeInterfacesI.SEND_SETTING_HOME );
605                return (( SendSettingPersist )ejbObject).update( (SendSettingData)aDataObject );
606            }
607            else if ( aDataObject instanceof ImportSettingData )
608            {
609                ejbObject = getBeanInterface( EjbHomeInterfacesI.IMPORT_SETTING_HOME );
610                return (( ImportSettingPersist )ejbObject).update( (ImportSettingData)aDataObject );
611            }
612            else
613                throw new RemoteException("Invalid Setting Data Object ["   + aDataObject.getClass().getName() + "] Passed to SettingsBean: add( dataObject )");
614          }
615          finally
616          {
617             if ( ejbObject != null )
618                try { ejbObject.remove(); }
619                catch ( RemoveException re ) {}
620          }
621     }
622 
623 }