Search in sources :

Example 1 with MethodInfo

use of org.apache.openejb.assembler.classic.MethodInfo in project tomee by apache.

the class EjbJarInfoBuilder method getMethodInfo.

private MethodInfo getMethodInfo(final Method method, final Map ejbds) {
    final MethodInfo methodInfo = new MethodInfo();
    final EjbDeployment d = (EjbDeployment) ejbds.get(method.getEjbName());
    methodInfo.description = method.getDescription();
    methodInfo.ejbDeploymentId = d == null ? null : d.getDeploymentId();
    methodInfo.ejbName = method.getEjbName();
    methodInfo.methodIntf = method.getMethodIntf() == null ? null : method.getMethodIntf().toString();
    methodInfo.methodName = method.getMethodName();
    if (methodInfo.methodName == null || methodInfo.methodName.isEmpty()) {
        methodInfo.methodName = "*";
    }
    methodInfo.className = method.getClassName();
    if (methodInfo.className == null || methodInfo.className.isEmpty()) {
        methodInfo.className = "*";
    }
    final MethodParams mp = method.getMethodParams();
    if (mp != null) {
        methodInfo.methodParams = mp.getMethodParam();
    }
    return methodInfo;
}
Also used : MethodParams(org.apache.openejb.jee.MethodParams) MethodInfo(org.apache.openejb.assembler.classic.MethodInfo) InitMethodInfo(org.apache.openejb.assembler.classic.InitMethodInfo) NamedMethodInfo(org.apache.openejb.assembler.classic.NamedMethodInfo) RemoveMethodInfo(org.apache.openejb.assembler.classic.RemoveMethodInfo) EjbDeployment(org.apache.openejb.jee.oejb3.EjbDeployment)

Example 2 with MethodInfo

use of org.apache.openejb.assembler.classic.MethodInfo in project tomee by apache.

the class EjbJarInfoBuilder method getMethodInfos.

private List<MethodInfo> getMethodInfos(final List<Method> ms, final Map ejbds) {
    if (ms == null) {
        return Collections.emptyList();
    }
    final List<MethodInfo> mi = new ArrayList<>(ms.size());
    for (final Method method : ms) {
        final MethodInfo methodInfo = getMethodInfo(method, ejbds);
        mi.add(methodInfo);
    }
    return mi;
}
Also used : ArrayList(java.util.ArrayList) MethodInfo(org.apache.openejb.assembler.classic.MethodInfo) InitMethodInfo(org.apache.openejb.assembler.classic.InitMethodInfo) NamedMethodInfo(org.apache.openejb.assembler.classic.NamedMethodInfo) RemoveMethodInfo(org.apache.openejb.assembler.classic.RemoveMethodInfo) RemoveMethod(org.apache.openejb.jee.RemoveMethod) AsyncMethod(org.apache.openejb.jee.AsyncMethod) CallbackMethod(org.apache.openejb.jee.CallbackMethod) QueryMethod(org.apache.openejb.jee.QueryMethod) ConcurrentMethod(org.apache.openejb.jee.ConcurrentMethod) Method(org.apache.openejb.jee.Method) NamedMethod(org.apache.openejb.jee.NamedMethod) InitMethod(org.apache.openejb.jee.InitMethod)

Example 3 with MethodInfo

use of org.apache.openejb.assembler.classic.MethodInfo in project tomee by apache.

the class SystemAppInfo method preComputedInfo.

// 
// 
// DONT MODIFY IT WITHOUT UPDATING org.apache.openejb.config.SystemApps
// 
// 
public static AppInfo preComputedInfo(final ConfigurationFactory factory) {
    final String singletonContainerId;
    try {
        singletonContainerId = findSingletonContainer(factory);
    } catch (final OpenEJBException e) {
        throw new IllegalStateException(e);
    }
    final EjbJarInfo ejbJarInfo = new EjbJarInfo();
    ejbJarInfo.moduleId = "openejb";
    ejbJarInfo.moduleName = ejbJarInfo.moduleId;
    ejbJarInfo.moduleUri = URI.create(ejbJarInfo.moduleId);
    ejbJarInfo.properties.setProperty("openejb.deploymentId.format", "{ejbName}");
    ejbJarInfo.properties.setProperty("openejb.jndiname.format", "{deploymentId}{interfaceType.openejbLegacyName}");
    final SingletonBeanInfo deployer = new SingletonBeanInfo();
    deployer.ejbDeploymentId = "openejb/Deployer";
    deployer.ejbName = deployer.ejbDeploymentId;
    deployer.ejbClass = "org.apache.openejb.assembler.DeployerEjb";
    deployer.businessRemote.add("org.apache.openejb.assembler.Deployer");
    deployer.parents.add(deployer.ejbClass);
    deployer.transactionType = "BEAN";
    deployer.concurrencyType = "CONTAINER";
    deployer.containerId = singletonContainerId;
    ejbJarInfo.enterpriseBeans.add(deployer);
    final SingletonBeanInfo configuration = new SingletonBeanInfo();
    configuration.ejbDeploymentId = "openejb/ConfigurationInfo";
    configuration.ejbName = deployer.ejbDeploymentId;
    configuration.ejbClass = "org.apache.openejb.assembler.classic.cmd.ConfigurationInfoEjb";
    configuration.businessRemote.add("org.apache.openejb.assembler.classic.cmd.ConfigurationInfo");
    configuration.parents.add(deployer.ejbClass);
    configuration.transactionType = "CONTAINER";
    configuration.concurrencyType = "CONTAINER";
    configuration.containerId = singletonContainerId;
    ejbJarInfo.enterpriseBeans.add(configuration);
    final SingletonBeanInfo mejb = new SingletonBeanInfo();
    mejb.ejbDeploymentId = "MEJB";
    mejb.ejbName = deployer.ejbDeploymentId;
    mejb.ejbClass = "org.apache.openejb.mgmt.MEJBBean";
    mejb.home = "javax.management.j2ee.ManagementHome";
    mejb.remote = "javax.management.j2ee.Management";
    mejb.parents.add(deployer.ejbClass);
    mejb.transactionType = "CONTAINER";
    mejb.concurrencyType = "CONTAINER";
    mejb.containerId = singletonContainerId;
    ejbJarInfo.enterpriseBeans.add(mejb);
    for (final EnterpriseBeanInfo ebi : ejbJarInfo.enterpriseBeans) {
        final MethodInfo methodInfo = new MethodInfo();
        methodInfo.ejbDeploymentId = ebi.ejbDeploymentId;
        methodInfo.ejbName = ebi.ejbName;
        methodInfo.methodName = "*";
        methodInfo.className = ebi.ejbClass;
        final MethodConcurrencyInfo methodConcurrencyInfo = new MethodConcurrencyInfo();
        methodConcurrencyInfo.concurrencyAttribute = "READ";
        methodConcurrencyInfo.methods.add(methodInfo);
        ejbJarInfo.methodConcurrency.add(methodConcurrencyInfo);
    }
    final CallbackInfo callbackInfo = new CallbackInfo();
    callbackInfo.className = "org.apache.openejb.security.internal.InternalSecurityInterceptor";
    callbackInfo.method = "invoke";
    final InterceptorInfo interceptorInfo = new InterceptorInfo();
    interceptorInfo.clazz = "org.apache.openejb.security.internal.InternalSecurityInterceptor";
    interceptorInfo.aroundInvoke.add(callbackInfo);
    ejbJarInfo.interceptors.add(interceptorInfo);
    final InterceptorBindingInfo interceptorBindingInfo = new InterceptorBindingInfo();
    interceptorBindingInfo.ejbName = "*";
    interceptorBindingInfo.interceptors.add("org.apache.openejb.security.internal.InternalSecurityInterceptor");
    ejbJarInfo.interceptorBindings.add(interceptorBindingInfo);
    ejbJarInfo.mbeans.add("org.apache.openejb.assembler.monitoring.JMXDeployer");
    // we start at 1 so no conflict using 0
    ejbJarInfo.uniqueId = "0";
    final AppInfo appInfo = new AppInfo();
    appInfo.appId = ejbJarInfo.moduleId;
    appInfo.path = appInfo.appId;
    appInfo.ejbJars.add(ejbJarInfo);
    return appInfo;
}
Also used : EnterpriseBeanInfo(org.apache.openejb.assembler.classic.EnterpriseBeanInfo) OpenEJBException(org.apache.openejb.OpenEJBException) CallbackInfo(org.apache.openejb.assembler.classic.CallbackInfo) InterceptorBindingInfo(org.apache.openejb.assembler.classic.InterceptorBindingInfo) InterceptorInfo(org.apache.openejb.assembler.classic.InterceptorInfo) MethodInfo(org.apache.openejb.assembler.classic.MethodInfo) SingletonBeanInfo(org.apache.openejb.assembler.classic.SingletonBeanInfo) EjbJarInfo(org.apache.openejb.assembler.classic.EjbJarInfo) MethodConcurrencyInfo(org.apache.openejb.assembler.classic.MethodConcurrencyInfo) AppInfo(org.apache.openejb.assembler.classic.AppInfo)

Example 4 with MethodInfo

use of org.apache.openejb.assembler.classic.MethodInfo in project tomee by apache.

the class EjbJarInfoBuilder method initEntityBean.

private EnterpriseBeanInfo initEntityBean(final EntityBean e, final Map m) throws OpenEJBException {
    final EntityBeanInfo bean = new EntityBeanInfo();
    final EjbDeployment d = (EjbDeployment) m.get(e.getEjbName());
    if (d == null) {
        throw new OpenEJBException("No deployment information in openejb-jar.xml for bean " + e.getEjbName() + ". Please redeploy the jar");
    }
    bean.ejbDeploymentId = d.getDeploymentId();
    bean.containerId = d.getContainerId();
    final Icon icon = e.getIcon();
    bean.largeIcon = icon == null ? null : icon.getLargeIcon();
    bean.smallIcon = icon == null ? null : icon.getSmallIcon();
    bean.description = e.getDescription();
    bean.displayName = e.getDisplayName();
    bean.ejbClass = e.getEjbClass();
    bean.abstractSchemaName = e.getAbstractSchemaName();
    bean.ejbName = e.getEjbName();
    bean.home = e.getHome();
    bean.remote = e.getRemote();
    bean.localHome = e.getLocalHome();
    bean.local = e.getLocal();
    bean.transactionType = "Container";
    bean.primKeyClass = e.getPrimKeyClass();
    bean.primKeyField = e.getPrimkeyField();
    bean.persistenceType = e.getPersistenceType().toString();
    bean.reentrant = String.valueOf(e.getReentrant());
    bean.properties.putAll(d.getProperties());
    final CmpVersion cmpVersion = e.getCmpVersion();
    if (e.getPersistenceType() == PersistenceType.CONTAINER) {
        if (cmpVersion != null && cmpVersion == CmpVersion.CMP1) {
            bean.cmpVersion = 1;
        } else {
            bean.cmpVersion = 2;
        }
    }
    final List<CmpField> cmpFields = e.getCmpField();
    for (final CmpField cmpField : cmpFields) {
        bean.cmpFieldNames.add(cmpField.getFieldName());
    }
    if (bean.persistenceType.equalsIgnoreCase("Container")) {
        for (final Query q : e.getQuery()) {
            final QueryInfo query = new QueryInfo();
            query.queryStatement = q.getEjbQl().trim();
            final MethodInfo method = new MethodInfo();
            method.ejbName = bean.ejbName;
            method.className = "*";
            final QueryMethod qm = q.getQueryMethod();
            method.methodName = qm.getMethodName();
            if (qm.getMethodParams() != null) {
                method.methodParams = qm.getMethodParams().getMethodParam();
            }
            query.method = method;
            final ResultTypeMapping resultType = q.getResultTypeMapping();
            if (ResultTypeMapping.REMOTE.equals(resultType)) {
                query.remoteResultType = true;
            }
            bean.queries.add(query);
        }
        for (final org.apache.openejb.jee.oejb3.Query q : d.getQuery()) {
            final QueryInfo query = new QueryInfo();
            query.description = q.getDescription();
            query.queryStatement = q.getObjectQl().trim();
            final MethodInfo method = new MethodInfo();
            method.ejbName = bean.ejbName;
            method.className = "*";
            final org.apache.openejb.jee.oejb3.QueryMethod qm = q.getQueryMethod();
            method.methodName = qm.getMethodName();
            if (qm.getMethodParams() != null) {
                method.methodParams = qm.getMethodParams().getMethodParam();
            }
            query.method = method;
            bean.queries.add(query);
        }
    }
    return bean;
}
Also used : OpenEJBException(org.apache.openejb.OpenEJBException) ResultTypeMapping(org.apache.openejb.jee.ResultTypeMapping) Query(org.apache.openejb.jee.Query) QueryMethod(org.apache.openejb.jee.QueryMethod) QueryInfo(org.apache.openejb.assembler.classic.QueryInfo) CmpField(org.apache.openejb.jee.CmpField) EjbDeployment(org.apache.openejb.jee.oejb3.EjbDeployment) MethodInfo(org.apache.openejb.assembler.classic.MethodInfo) InitMethodInfo(org.apache.openejb.assembler.classic.InitMethodInfo) NamedMethodInfo(org.apache.openejb.assembler.classic.NamedMethodInfo) RemoveMethodInfo(org.apache.openejb.assembler.classic.RemoveMethodInfo) EntityBeanInfo(org.apache.openejb.assembler.classic.EntityBeanInfo) Icon(org.apache.openejb.jee.Icon) CmpVersion(org.apache.openejb.jee.CmpVersion)

Aggregations

MethodInfo (org.apache.openejb.assembler.classic.MethodInfo)4 InitMethodInfo (org.apache.openejb.assembler.classic.InitMethodInfo)3 NamedMethodInfo (org.apache.openejb.assembler.classic.NamedMethodInfo)3 RemoveMethodInfo (org.apache.openejb.assembler.classic.RemoveMethodInfo)3 OpenEJBException (org.apache.openejb.OpenEJBException)2 QueryMethod (org.apache.openejb.jee.QueryMethod)2 EjbDeployment (org.apache.openejb.jee.oejb3.EjbDeployment)2 ArrayList (java.util.ArrayList)1 AppInfo (org.apache.openejb.assembler.classic.AppInfo)1 CallbackInfo (org.apache.openejb.assembler.classic.CallbackInfo)1 EjbJarInfo (org.apache.openejb.assembler.classic.EjbJarInfo)1 EnterpriseBeanInfo (org.apache.openejb.assembler.classic.EnterpriseBeanInfo)1 EntityBeanInfo (org.apache.openejb.assembler.classic.EntityBeanInfo)1 InterceptorBindingInfo (org.apache.openejb.assembler.classic.InterceptorBindingInfo)1 InterceptorInfo (org.apache.openejb.assembler.classic.InterceptorInfo)1 MethodConcurrencyInfo (org.apache.openejb.assembler.classic.MethodConcurrencyInfo)1 QueryInfo (org.apache.openejb.assembler.classic.QueryInfo)1 SingletonBeanInfo (org.apache.openejb.assembler.classic.SingletonBeanInfo)1 AsyncMethod (org.apache.openejb.jee.AsyncMethod)1 CallbackMethod (org.apache.openejb.jee.CallbackMethod)1