use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.
the class AccessTimeoutHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
AccessTimeout timeout = (AccessTimeout) ainfo.getAnnotation();
for (EjbContext ejbContext : ejbContexts) {
if (ejbContext.getDescriptor() instanceof EjbSessionDescriptor) {
EjbSessionDescriptor sessionDesc = (EjbSessionDescriptor) ejbContext.getDescriptor();
if (sessionDesc.isStateless()) {
continue;
}
if (ElementType.TYPE.equals(ainfo.getElementType())) {
// Delay processing Class-level default until after methods are processed
ejbContext.addPostProcessInfo(ainfo, this);
} else {
Method annMethod = (Method) ainfo.getAnnotatedElement();
// are overridden and applies the correct .xml overriding semantics.
if (!matchesExistingAccessTimeoutMethod(annMethod, sessionDesc)) {
MethodDescriptor newMethodDesc = new MethodDescriptor(annMethod);
sessionDesc.addAccessTimeoutMethod(newMethodDesc, timeout.value(), timeout.unit());
}
}
}
}
return getDefaultProcessedResult();
}
use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.
the class AfterCompletionHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
for (EjbContext ejbContext : ejbContexts) {
EjbSessionDescriptor ejbDesc = (EjbSessionDescriptor) ejbContext.getDescriptor();
Method annMethod = (Method) ainfo.getAnnotatedElement();
checkValid(annMethod);
if (logger.isLoggable(Level.FINE)) {
logger.fine("Setting AfterCompletion method " + annMethod);
}
ejbDesc.setAfterCompletionMethodIfNotSet(new MethodDescriptor(annMethod));
}
return getDefaultProcessedResult();
}
use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.
the class PersistenceDescriptor method setQueryFor.
public void setQueryFor(Method method, QueryDescriptor query) {
// Use our own method equality check. This prevents problems
// when a different classloader was used to load the input
// method. Also note that two methods with the same name and
// signature on *different* interfaces are considered EQUAL.
// This matches the spec requirement that the same finder
// method defined on the LocalHome and RemoteHome has only
// ONE query-method declaration in the deployment descriptor.
//
MethodDescriptor md = new MethodDescriptor(method, "");
setQueryFor(md, query);
}
use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.
the class BaseAuthConfig method isMatchingMSD.
private static boolean isMatchingMSD(MethodDescriptor targetMD, MessageSecurityDescriptor mSD) {
List<MessageDescriptor> messageDescriptors = mSD.getMessageDescriptors();
if (messageDescriptors.isEmpty()) {
// element, and the deployment will be allowed to succeed.
return true;
}
for (int i = 0; i < messageDescriptors.size(); i++) {
MessageDescriptor nextMD = (MessageDescriptor) messageDescriptors.get(i);
MethodDescriptor mD = nextMD.getMethodDescriptor();
String opName = nextMD.getOperationName();
if (opName == null && (mD == null || mD.implies(targetMD))) {
return true;
}
}
return false;
}
use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.
the class BaseAuthConfig method getContextForMethod.
/*
* When method argument is null, returns the default AC if there is one, or the onePolicy shared by
* all methods if there is one, or throws an error. method is called with null argument when the
* method cannot be determined (e.g. when the message is encrypted)
*/
private Object getContextForMethod(Method m) {
Object rvalue = null;
synchronized (contextLock) {
if (defaultContext_ != null) {
rvalue = defaultContext_;
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "WSS: ForMethod returning default_context: {0}", rvalue);
}
return rvalue;
}
}
if (m != null) {
int match = -1;
MethodDescriptor targetMD = new MethodDescriptor(m);
for (int i = 0; i < messageSecurityDescriptors_.size(); i++) {
if (isMatchingMSD(targetMD, (MessageSecurityDescriptor) messageSecurityDescriptors_.get(i))) {
if (match < 0) {
match = i;
} else if (!policiesAreEqual((MessageSecurityDescriptor) messageSecurityDescriptors_.get(match), (MessageSecurityDescriptor) messageSecurityDescriptors_.get(i))) {
// set to unprotected because of conflicting policies
rvalue = explicitNull;
match = -1;
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "WSS: ForMethod detected conflicting policies: {0}.{1}", new Object[] { match, i });
}
break;
}
}
}
if (match >= 0) {
rvalue = contexts_.get(match);
if (rvalue == null) {
rvalue = explicitNull;
}
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "WSS: ForMethod returning matched context: {0}", rvalue);
}
}
} else if (onePolicy_ && contexts_.size() > 0) {
// ISSUE: since the method is undefined we will not be
// able to tell if the defined policy covers this method.
// We will be optimistic and try the policy, because
// the server will reject the call if the method is not
// covered by the policy.
// If the policy is not null, there remains a problem at the
// client on the response side, as it is possible that the
// client will enforce the wrong policy on the response.
// For this reason, messages in sun-application-client.xml
// should be keyed by operation-name.
rvalue = contexts_.get(0);
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "WSS: ForMethod resorting to first context: {0}", rvalue);
}
} else {
if (logger.isLoggable(Level.FINE)) {
logger.fine("WSS: Unable to select policy for SOAP Message");
}
throw new RuntimeException("Unable to select policy for Message");
}
return rvalue;
}
Aggregations