1 19 20 package org.netbeans.modules.j2ee.sun.share.configbean; 21 22 import java.beans.PropertyVetoException ; 23 import java.util.ArrayList ; 24 import java.util.Collection ; 25 import java.util.List ; 26 import javax.enterprise.deploy.model.DDBean ; 27 import javax.enterprise.deploy.model.XpathEvent ; 28 29 import org.netbeans.modules.j2ee.sun.dd.api.CommonDDBean; 30 import org.netbeans.modules.j2ee.sun.dd.api.ejb.Ejb; 31 32 import org.netbeans.modules.j2ee.sun.share.configbean.customizers.ejbmodule.DummyMethod; 33 import org.openide.ErrorManager; 34 35 36 40 abstract public class SessionEjb extends BaseEjb implements WebserviceOperationListInterface { 41 42 43 public SessionEjb() { 44 } 45 46 47 51 protected class SessionEjbSnippet extends BaseEjb.BaseEjbSnippet { 52 public CommonDDBean getDDSnippet() { 53 Ejb ejb = (Ejb) super.getDDSnippet(); 54 return ejb; 55 } 56 57 public boolean hasDDSnippet() { 58 if(super.hasDDSnippet()) { 59 return true; 60 } 61 return false; 62 } 63 } 64 65 Collection getSnippets() { 66 Collection snippets = new ArrayList (); 67 snippets.add(new SessionEjbSnippet()); 68 return snippets; 69 } 70 71 protected void loadEjbProperties(Ejb savedEjb) { 72 super.loadEjbProperties(savedEjb); 73 } 74 75 protected void clearProperties() { 76 super.clearProperties(); 77 } 78 79 protected void setDefaultProperties() { 80 super.setDefaultProperties(); 81 } 82 83 public void fireXpathEvent(XpathEvent xpathEvent) { 84 super.fireXpathEvent(xpathEvent); 85 87 DDBean eventBean = xpathEvent.getBean(); 88 String xpath = eventBean.getXpath(); 89 90 if("/ejb-jar/enterprise-beans/session/remote".equals(xpath)) { try { 92 if(xpathEvent.isAddEvent()) { 93 if(EjbJarVersion.EJBJAR_2_1.compareTo(getJ2EEModuleVersion()) >= 0 ) { 97 setJndiName(getDefaultJndiName()); 98 } 99 } else if(xpathEvent.isRemoveEvent()) { 100 setJndiName(null); 101 } 102 } catch(PropertyVetoException ex) { 103 ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex); 105 } 106 } 107 } 108 109 public List getOperations(String portInfoName){ 112 if(portInfoName.equals("first")){ 113 ArrayList methods = new ArrayList (); 118 DummyMethod method = new DummyMethod(); 119 method.setName("FirstMethod"); 120 String [] params = {"int"}; 121 method.setParameterTypes(params); 122 method.setIsMethod(true); 123 methods.add(method); 124 125 DummyMethod method2 = new DummyMethod(); 126 method2.setName("SecondMethod"); 127 String [] params2 = {"int", "String"}; 128 method2.setParameterTypes(params2); 129 method2.setIsMethod(true); 130 methods.add(method2); 131 132 DummyMethod method3 = new DummyMethod(); 133 method3.setName("ThirdMethod"); 134 method3.setIsMethod(false); 135 methods.add(method3); 136 return methods; 137 }else{ 138 ArrayList methods = new ArrayList (); 139 DummyMethod method = new DummyMethod(); 140 method.setName("FirstMethod"); 141 String [] params = {"String"}; 142 method.setParameterTypes(params); 143 methods.add(method); 144 return methods; 145 } 146 } 147 148 149 153 public java.util.List getServiceOperations(String portComponentName) { 154 156 java.util.List operationList = new ArrayList (); 157 operationList.add(new ConfigQuery.MethodData("ejb_ws_operation1", java.util.Arrays.asList(new String [] { "arg1", "arg2" } ))); 158 operationList.add(new ConfigQuery.MethodData("ejb_ws_operation2", java.util.Arrays.asList(new String [] { "arg1" } ))); 159 operationList.add(new ConfigQuery.MethodData("ejb_ws_operation3", java.util.Arrays.asList(new String [] { "arg1", "arg2", "arg3" } ))); 160 return operationList; 161 } 162 } 163 | Popular Tags |