org.jboss.ejb.client.AbstractEJBMetaData Maven / Gradle / Ivy
Go to download
This artifact provides a single jar that contains all classes required to use remote EJB and JMS, including
all dependencies. It is intended for use by those not using maven, maven users should just import the EJB and
JMS BOM's instead (shaded JAR's cause lots of problems with maven, as it is very easy to inadvertently end up
with different versions on classes on the class path).
/*
* JBoss, Home of Professional Open Source.
* Copyright 2017 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jboss.ejb.client;
import java.io.Serializable;
import jakarta.ejb.EJBHome;
import jakarta.ejb.EJBMetaData;
import jakarta.ejb.EJBObject;
import org.jboss.ejb._private.Logs;
import org.wildfly.common.Assert;
/**
* Abstract base class for all Enterprise Beans metadata.
*
* @author David M. Lloyd
*/
public abstract class AbstractEJBMetaData implements EJBMetaData, Serializable {
private static final long serialVersionUID = -5391231161942555933L;
private final Class remoteInterfaceClass;
private final EJBHomeLocator homeLocator;
AbstractEJBMetaData(final Class remoteInterfaceClass, final EJBHomeLocator homeLocator) {
Assert.checkNotNullParam("remoteInterfaceClass", remoteInterfaceClass);
Assert.checkNotNullParam("homeLocator", homeLocator);
this.remoteInterfaceClass = remoteInterfaceClass;
this.homeLocator = homeLocator;
}
/**
* Get the Enterprise Beans home interface.
*
* @return the Enterprise Beans home interface
*/
public H getEJBHome() {
return EJBClient.createProxy(homeLocator);
}
/**
* Get the remote interface class.
*
* @return the remote interface class
*/
public Class getRemoteInterfaceClass() {
return remoteInterfaceClass;
}
/**
* Get the home interface class.
*
* @return the home interface
*/
public Class getHomeInterfaceClass() {
return homeLocator.getViewType();
}
/**
* Get the primary key class.
*
* @return the primary key class
*/
public Class> getPrimaryKeyClass() {
throw Logs.MAIN.primaryKeyNotRelevantForSessionBeans();
}
/**
* Determine whether this Enterprise Bean metadata refers to a session Enterprise Bean.
*
* @return {@code true} if the Enterprise Beans is a session Enterprise Bean, {@code false} otherwise
*/
public boolean isSession() {
return true;
}
/**
* Determine whether this Enterprise Bean metadata refers to a stateless session Enterprise Bean.
*
* @return {@code true} if the Enterprise Beans is a stateless session Enterprise Bean, {@code false} otherwise
*/
public boolean isStatelessSession() {
return false;
}
/**
* Get the home locator for this metadata instance.
*
* @return the home locator for this metadata instance (not {@code null})
*/
public EJBHomeLocator getHomeLocator() {
return homeLocator;
}
}