KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > opensubsystems > core > logic > impl > DataControllerImpl


1 /*
2  * Copyright (c) 2005 - 2007 OpenSubsystems s.r.o. Slovak Republic. All rights reserved.
3  *
4  * Project: OpenSubsystems
5  *
6  * $Id: DataControllerImpl.java,v 1.7 2007/01/28 06:54:51 bastafidli Exp $
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; version 2 of the License.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */

21
22 package org.opensubsystems.core.logic.impl;
23
24 import org.opensubsystems.core.data.DataObject;
25 import org.opensubsystems.core.error.OSSException;
26 import org.opensubsystems.core.logic.DataController;
27 import org.opensubsystems.core.persist.DataFactory;
28 import org.opensubsystems.core.util.CallContext;
29
30 /**
31  * Implementation of DataController interface to access data. It can be used
32  * by any component which provides DataFactory to access the data. If this
33  * class is used in J2EE environment each method implementation may create
34  * transaction boundary.
35  *
36  * We do not want to generate EJB for this class since it is abstract base
37  * class for real EJBs
38  * @ejb.bean generate="false"
39  *
40  * We need to generate interface since xdoclet will require them for interfaces
41  * derived from DataController. Since remote and local interfaces have to
42  * extend different ejb interfaces and we have only one base interface, the
43  * extends tags have to except our controller contain also the interfaces
44  * required by the spec
45  * @ejb.interface
46  * local-extends="javax.ejb.EJBLocalObject, org.opensubsystems.core.logic.DataController"
47  * extends="javax.ejb.EJBObject, org.opensubsystems.core.logic.DataController"
48  *
49  * @version $Id: DataControllerImpl.java,v 1.7 2007/01/28 06:54:51 bastafidli Exp $
50  * @author Miro Halas
51  * @code.reviewer Miro Halas
52  * @code.reviewed 1.1 2005/08/15 13:39:10 bastafidli
53  */

54 public abstract class DataControllerImpl extends StatelessControllerImpl
55                                          implements DataController
56 {
57    /**
58     * This implementation will get only the default data object supported
59     * by this controller in case the controller supports multiple data types.
60     *
61     * @ejb.interface-method
62     * @ejb.transaction type="Supports"
63     *
64     * @param iId {@inheritDoc}
65     * @return DataObject {@inheritDoc}
66     * @throws OSSException {@inheritDoc}
67     */

68    public DataObject get(
69       int iId
70    ) throws OSSException
71    {
72       return getDataFactory().get(iId,
73                 CallContext.getInstance().getCurrentDomainId());
74    }
75    
76    // Helper methods ///////////////////////////////////////////////////////////
77

78    /**
79     * Get data factory which can be used to access persistence layer for a data
80     * object managed by this controller. In case the controller supports
81     * multiple data types this method should return the factory for the default
82     * data type.
83     *
84     * @return DataFactory
85     */

86    protected abstract DataFactory getDataFactory(
87    );
88 }
89
Popular Tags