KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > share > configbean > SessionEjbDCBFactory


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.sun.share.configbean;
21
22 import javax.enterprise.deploy.spi.DConfigBean JavaDoc;
23 import javax.enterprise.deploy.spi.DeploymentConfiguration JavaDoc;
24 import javax.enterprise.deploy.spi.exceptions.ConfigurationException JavaDoc;
25 import javax.enterprise.deploy.model.DDBean JavaDoc;
26 import javax.enterprise.deploy.model.DDBeanRoot JavaDoc;
27 import javax.enterprise.deploy.model.DeployableObject JavaDoc;
28 import javax.enterprise.deploy.model.J2eeApplicationObject JavaDoc;
29
30 /**
31  *
32  * @author Peter Williams
33  */

34 public class SessionEjbDCBFactory extends AbstractDCBFactory {
35     static final String JavaDoc SESSION_TYPE_KEY = "session-type"; // NOI18N
36
static final String JavaDoc STATELESS = "Stateless"; // NOI18N
37
static final String JavaDoc STATEFUL = "Stateful"; // NOI18N
38

39     protected Class JavaDoc getClass(DDBean JavaDoc ddBean, Base dcbParent) throws ConfigurationException JavaDoc {
40         Class JavaDoc retVal = Object JavaDoc.class;
41         String JavaDoc testRet[] = ddBean.getText(SESSION_TYPE_KEY);
42         if(null != testRet && testRet.length == 1 && testRet[0].indexOf(STATELESS) > -1) {
43             retVal = StatelessEjb.class;
44         } else if (null != testRet && 1 == testRet.length && testRet[0].indexOf(STATEFUL) > -1) {
45             retVal = StatefulEjb.class;
46         } else {
47             throw Utils.makeCE("ERR_UnknownSessionType", testRet, null);
48         }
49
50         return retVal;
51     }
52 }
53
Popular Tags