use of com.sun.enterprise.deployment.EnvironmentProperty in project Payara by payara.
the class EjbMessageBeanDescriptor method setJmsMessageSelector.
public void setJmsMessageSelector(String selector) {
if ((selector == null) || (selector.trim().equals(""))) {
removeActivationConfigPropertyByName(MESSAGE_SELECTOR_PROPERTY);
} else {
EnvironmentProperty msgSelectorProp = new EnvironmentProperty(MESSAGE_SELECTOR_PROPERTY, selector, "");
putActivationConfigProperty(msgSelectorProp);
}
}
use of com.sun.enterprise.deployment.EnvironmentProperty in project Payara by payara.
the class FilterInitParamValue method check.
/**
* Param Value exists test.
*
* @param descriptor the Web deployment descriptor
*
* @return <code>Result</code> the results for this assertion
*/
public Result check(WebBundleDescriptor descriptor) {
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
boolean oneWarning = false, onePassed = false;
Enumeration filterEnum = descriptor.getServletFilterDescriptors().elements();
if (filterEnum.hasMoreElements()) {
// get the filters in this .war
while (filterEnum.hasMoreElements()) {
ServletFilterDescriptor filter = (ServletFilterDescriptor) filterEnum.nextElement();
Vector epVector = filter.getInitializationParameters();
if (epVector.size() != 0) {
for (int i = 0; i < epVector.size(); i++) {
EnvironmentProperty ep = (EnvironmentProperty) epVector.elementAt(i);
String epValue = ep.getValue();
if (epValue.length() != 0) {
onePassed = true;
addGoodDetails(result, compName);
result.addGoodDetails(smh.getLocalString("com.sun.enterprise.tools.verifier.tests.web.FilterInitParamValue" + ".passed", "Param value exists for the filter [ {0} ].", new Object[] { filter.getName() }));
} else {
oneWarning = true;
addWarningDetails(result, compName);
result.addWarningDetails(smh.getLocalString("com.sun.enterprise.tools.verifier.tests.web.FilterInitParamValue" + ".warning", "WARNING: Param value entry for the filter [ {0} ] should be of finite length.", new Object[] { filter.getName() }));
}
}
} else {
addNaDetails(result, compName);
result.notApplicable(smh.getLocalString("com.sun.enterprise.tools.verifier.tests.web.FilterInitParamValue" + ".notApplicable", "There are no initialization parameters for the filter [ {0} ] within the web archive [ {1} ]", new Object[] { filter.getName(), descriptor.getName() }));
}
}
if (oneWarning) {
result.setStatus(Result.WARNING);
} else if (onePassed) {
result.setStatus(Result.PASSED);
}
} else {
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString("com.sun.enterprise.tools.verifier.tests.web.FilterInitParamValue" + ".notApplicable1", "There are no filters defined within the web archive [ {0} ]", new Object[] { descriptor.getName() }));
}
return result;
}
use of com.sun.enterprise.deployment.EnvironmentProperty in project Payara by payara.
the class CheckResourceAdapterJavaBean method check.
/**
* <p>
* Test that "resourceadapter-class" is a Java Bean.
* </p>
*
* @param descriptor deployment descriptor for the rar file
* @return result object containing the result of the individual test
* performed
*/
public Result check(ConnectorDescriptor descriptor) {
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
String impl = descriptor.getResourceAdapterClass();
if (impl.equals("")) {
if (descriptor.getInBoundDefined()) {
// resourceadapter-class cannot be null
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString(getClass().getName() + ".failed1", "resourceadapter-class cannot be empty if the resource" + " adapter provides inbound communication"));
} else {
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString("com.sun.enterprise.tools.verifier.tests.connector.resourceadapter.notApp", "resourceadapter-class is not specified."));
}
return result;
}
VerifierTestContext context = getVerifierContext();
Class implClass = null;
try {
implClass = Class.forName(impl, false, getVerifierContext().getClassLoader());
} catch (ClassNotFoundException e) {
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString("com.sun.enterprise.tools.verifier.tests.connector.CheckResourceAdapter.nonexist", "Error: The class [ {0} ] as defined under resourceadapter-class in the deployment descriptor does not exist", new Object[] { impl }));
return result;
}
Set configProps = descriptor.getConfigProperties();
boolean oneFailed = false;
Iterator propIter = configProps.iterator();
BeanInfo bi = null;
try {
bi = Introspector.getBeanInfo(implClass, Object.class);
} catch (IntrospectionException ie) {
oneFailed = true;
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString(getClass().getName() + ".failed", "Error: The resourceadapter-class [ {0} ] is not JavaBeans compliant", new Object[] { impl }));
return result;
}
PropertyDescriptor[] properties = bi.getPropertyDescriptors();
Hashtable<String, PropertyDescriptor> props = new Hashtable<String, PropertyDescriptor>();
for (int i = 0; i < properties.length; i++) {
props.put(properties[i].getName(), properties[i]);
}
while (propIter.hasNext()) {
EnvironmentProperty envProp = (EnvironmentProperty) propIter.next();
String name = Introspector.decapitalize(envProp.getName());
String type = envProp.getType();
PropertyDescriptor propDesc = props.get(name);
if (propDesc != null) {
if (propDesc.getReadMethod() == null || propDesc.getWriteMethod() == null) {
oneFailed = true;
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString(getClass().getName() + ".failed1", "Error: The resourceadapter-class [ {0} ] does not provide accessor methods for [ {1} ].", new Object[] { impl, name }));
return result;
}
} else {
oneFailed = true;
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString(getClass().getName() + ".failed1", "Error: The resourceadapter-class [ {0} ] does not provide accessor methods for [ {1} ].", new Object[] { impl, name }));
return result;
}
}
if (!oneFailed) {
result.addGoodDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.passed(smh.getLocalString(getClass().getName() + ".passed", "Success: resourceadapter-class is a Java Bean"));
}
return result;
}
use of com.sun.enterprise.deployment.EnvironmentProperty in project Payara by payara.
the class ManagedConnectionFactoryProperties method check.
/**
* <p>
* Test that the class declared implementing the javax.resource.spi.ManagedConnectionFactory
* interface implements the properties declared under the config-property
* xml tag under the followind requirements :
* - Provide a getter and setter method ala JavaBeans
* - Properties should be either bound or constrained
* - PropertyListener registration/unregistration methods are public
* </p>
*
* @paramm descriptor deployment descriptor for the rar file
* @return result object containing the result of the individual test
* performed
*/
public Result check(ConnectorDescriptor descriptor) {
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
// test NA for inboundRA
if (!descriptor.getOutBoundDefined()) {
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString("com.sun.enterprise.tools.verifier.tests.connector.managed.notApplicableForInboundRA", "Resource Adapter does not provide outbound communication"));
return result;
}
boolean oneFailed = false;
OutboundResourceAdapter outboundRA = descriptor.getOutboundResourceAdapter();
Set connDefs = outboundRA.getConnectionDefs();
Iterator iter = connDefs.iterator();
while (iter.hasNext()) {
ConnectionDefDescriptor connDefDesc = (ConnectionDefDescriptor) iter.next();
Set configProperties = connDefDesc.getConfigProperties();
if (!configProperties.isEmpty()) {
Iterator propIterator = configProperties.iterator();
Class mcf = testManagedConnectionFactoryImpl(descriptor, result);
if (mcf == null) {
// set the error code now, just abandon
return result;
}
while (propIterator.hasNext()) {
EnvironmentProperty ep = (EnvironmentProperty) propIterator.next();
// Set method first
String propertyName = Character.toUpperCase(ep.getName().charAt(0)) + ep.getName().substring(1);
String setMethodName = "set" + propertyName;
Class[] parmTypes = new Class[] { ep.getValueType() };
Method m = getMethod(mcf, setMethodName, parmTypes);
if (m != null) {
result.addGoodDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addGoodDetails(smh.getLocalString(getClass().getName() + ".passed", "Found a JavaBeans compliant accessor method [ {0} ] for the config-property [ {1} ]", new Object[] { m, ep.getName() }));
} else {
oneFailed = true;
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".failed", "Error: There is no JavaBeans compliant accessor method [ {0} ] implemented in [ {1} ] for the config-property [ {2} ]", new Object[] { "public void " + setMethodName + "(" + ep.getValueType().getName() + ")", mcf.getName(), ep.getName() }));
}
String getMethodName = "get" + propertyName;
m = getMethod(mcf, getMethodName, null);
if (m != null) {
result.addGoodDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addGoodDetails(smh.getLocalString(getClass().getName() + ".passed", "Found a JavaBeans compliant accessor method [ {0} ] for the config-property [ {1} ]", new Object[] { m, ep.getName() }));
} else {
oneFailed = true;
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".failed", "Error: There is no JavaBeans compliant accessor method [ {0} ] implemented in [ {1} ] for the config-property [ {2} ]", new Object[] { "public " + ep.getValueType().getName() + " " + getMethodName, mcf.getName(), ep.getName() }));
}
}
}
}
if (oneFailed) {
result.setStatus(Result.FAILED);
} else {
result.setStatus(Result.PASSED);
}
return result;
}
use of com.sun.enterprise.deployment.EnvironmentProperty in project Payara by payara.
the class EjbBundleTracerVisitor method accept.
protected void accept(EjbDescriptor ejb) {
logInfo("==================");
logInfo(ejb.getType() + " Bean " + ejb.getName());
logInfo("\thomeClassName " + ejb.getHomeClassName());
logInfo("\tremoteClassName " + ejb.getRemoteClassName());
logInfo("\tlocalhomeClassName " + ejb.getLocalHomeClassName());
logInfo("\tlocalClassName " + ejb.getLocalClassName());
logInfo("\tremoteBusinessIntfs " + ejb.getRemoteBusinessClassNames());
logInfo("\tlocalBusinessIntfs " + ejb.getLocalBusinessClassNames());
logInfo("\tjndiName " + ejb.getJndiName());
logInfo("\tejbClassName " + ejb.getEjbClassName());
logInfo("\ttransactionType " + ejb.getTransactionType());
if (ejb.getUsesCallerIdentity() == false) {
logInfo("\trun-as role " + ejb.getRunAsIdentity());
} else {
logInfo("\tuse-caller-identity " + ejb.getUsesCallerIdentity());
}
for (EjbReference aRef : ejb.getEjbReferenceDescriptors()) {
accept(aRef);
}
for (Iterator e = ejb.getPermissionedMethodsByPermission().keySet().iterator(); e.hasNext(); ) {
MethodPermission mp = (MethodPermission) e.next();
Set methods = (Set) ejb.getPermissionedMethodsByPermission().get(mp);
accept(mp, methods);
}
if (ejb.getStyledPermissionedMethodsByPermission() != null) {
for (Iterator e = ejb.getStyledPermissionedMethodsByPermission().keySet().iterator(); e.hasNext(); ) {
MethodPermission mp = (MethodPermission) e.next();
Set methods = (Set) ejb.getStyledPermissionedMethodsByPermission().get(mp);
accept(mp, methods);
}
}
for (RoleReference roleRef : ejb.getRoleReferences()) {
accept(roleRef);
}
for (Iterator e = ejb.getMethodContainerTransactions().keySet().iterator(); e.hasNext(); ) {
MethodDescriptor md = (MethodDescriptor) e.next();
ContainerTransaction ct = (ContainerTransaction) ejb.getMethodContainerTransactions().get(md);
accept(md, ct);
}
for (EnvironmentProperty envProp : ejb.getEnvironmentProperties()) {
accept(envProp);
}
for (ResourceReferenceDescriptor next : ejb.getResourceReferenceDescriptors()) {
accept(next);
}
for (ResourceEnvReferenceDescriptor next : ejb.getResourceEnvReferenceDescriptors()) {
accept(next);
}
for (MessageDestinationReferencer next : ejb.getMessageDestinationReferenceDescriptors()) {
accept(next);
}
// referencer as well.
if (ejb.getType().equals(EjbMessageBeanDescriptor.TYPE)) {
MessageDestinationReferencer msgDestReferencer = (MessageDestinationReferencer) ejb;
if (msgDestReferencer.getMessageDestinationLinkName() != null) {
accept(msgDestReferencer);
}
}
for (ServiceReferenceDescriptor sref : ejb.getServiceReferenceDescriptors()) {
accept(sref);
}
if (ejb instanceof EjbCMPEntityDescriptor) {
EjbCMPEntityDescriptor cmp = (EjbCMPEntityDescriptor) ejb;
PersistenceDescriptor persistenceDesc = cmp.getPersistenceDescriptor();
for (Object fd : persistenceDesc.getCMPFields()) {
accept((FieldDescriptor) fd);
}
for (Object o : persistenceDesc.getQueriedMethods()) {
if (o instanceof MethodDescriptor) {
QueryDescriptor qd = persistenceDesc.getQueryFor((MethodDescriptor) o);
accept(qd);
}
}
}
}
Aggregations