/**
* {@inheritDoc}
*/
public EJBBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
EJBBinding ejbBinding = ejbBindingFactory.createEJBBinding();
// Read the policies
policyProcessor.readPolicies(ejbBinding, reader);
// Read the name
String name = reader.getAttributeValue(null, EJBBinding.NAME);
if (name != null) {
ejbBinding.setName(name);
}
// Read binding URI
String uri = reader.getAttributeValue(null, EJBBinding.URI);
if (uri != null) {
ejbBinding.setURI(uri);
}
String homeInterface = reader.getAttributeValue(null, EJBBinding.HOME_INTERFACE);
if (homeInterface != null) {
ejbBinding.setHomeInterface(homeInterface);
}
String ejbLinkName = reader.getAttributeValue(null, EJBBinding.EJB_LINK_NAME);
if (ejbLinkName != null) {
ejbBinding.setEjbLinkName(ejbLinkName);
}
String sessionType = reader.getAttributeValue(null, EJBBinding.SESSION_TYPE);
if (sessionType != null) {
if (sessionType.equals("stateless")) {
ejbBinding.setSessionType(EJBBinding.SessionType.STATELESS);
} else if (sessionType.equals("stateful")) {
ejbBinding.setSessionType(EJBBinding.SessionType.STATEFUL);
} else {
error("UnknownEJBSessionType", reader, sessionType, name);
//throw new ContributionReadException("Unknown EJB Session Type of " + sessionType + " for " + name);
}
}
String ejbVersion = reader.getAttributeValue(null, EJBBinding.EJB_VERSION);
if (ejbVersion != null) {
if (ejbVersion.equals("EJB2")) {
ejbBinding.setEjbVersion(EJBBinding.EJBVersion.EJB2);
} else if (ejbVersion.equals("EJB3")) {
ejbBinding.setEjbVersion(EJBBinding.EJBVersion.EJB3);
} else {
error("UnknownEJBVersion", reader, ejbVersion, name);
//throw new ContributionReadException("Unknown EJB Version of " + ejbVersion + " for " + name);
}
}
// TODO: Read requires
String requires = reader.getAttributeValue(null, EJBBinding.REQUIRES);
if (requires != null) {
ejbBinding.setRequires(requires);
}
return ejbBinding;
}