/** * {@inheritDoc} */ public boolean handles(ConnectorDescriptor cd, String moduleName) { boolean canHandle = false; boolean adminObjectsDefined = false; Set adminObjects = cd.getAdminObjects(); if (adminObjects != null && adminObjects.size() > 0) { adminObjectsDefined = true; } /* this class can handle Connector 1.0 Spec. compliant RAR criteria for 1.0 RAR : * No inbound artifacts * No admin-objects * There should be only one connection-definition * RA Class should not be present (equivalent to "") */ if(!cd.getInBoundDefined() && !adminObjectsDefined && (cd.getOutBoundDefined() && cd.getOutboundResourceAdapter().getConnectionDefs().size() < 2 && "".equals(cd.getResourceAdapterClass())) ){ canHandle = true; } return canHandle; }
/** * get the list of resource-adapters that support this message-listener-type * @param messageListener message-listener class-name * @return List of resource-adapters */ public List<String> getConnectorsSupportingMessageListener(String messageListener){ List<String> rars = new ArrayList<String>(); for(ActiveResourceAdapter ara : resourceAdapters.values()){ ConnectorDescriptor desc = ara.getDescriptor(); if(desc.getInBoundDefined()){ if(desc.getInboundResourceAdapter().getMessageListener(messageListener) != null){ rars.add(ara.getModuleName()); } } } return rars; } }
public void accept(ConnectorDescriptor descriptor) { if (!descriptor.getValidConnectorAnnotationProcessed()) { Set<AnnotationInfo> annotations = descriptor.getConnectorAnnotations(); String raClass = descriptor.getResourceAdapterClass(); Connector connector = (Connector) annotationInfo.getAnnotation(); ConnectorAnnotationHandler.processDescriptor(claz, connector, descriptor); Collection<AnnotationInfo> configProperties = descriptor.getConfigPropertyAnnotations(claz.getName()); if (configProperties != null) { for (AnnotationInfo ai : configProperties) { if(descriptor.getOutBoundDefined()){ Set connectionDefinitions = descriptor.getOutboundResourceAdapter().getConnectionDefs(); if(connectionDefinitions.size() == 0){ throw new RuntimeException("Invalid connector descriptor for RAR [ "+descriptor.getName()+" ], when " + "outbound-resource-adapter is specified," + "atleast one connection-definition must be specified either via annotation or via descriptor"); _logger.log(Level.FINEST, descriptor.toString()); descriptor.getConnectorAnnotations().clear(); descriptor.getAllConfigPropertyAnnotations().clear(); descriptor.getConfigPropertyProcessedClasses().clear();
public static boolean processConnector(ConnectorDescriptor desc, ConnectorConfigProperty ep, Class declaringClass) { // make sure that the RA Class considered here is the one specified in descriptor // If not, it will be processed once the @Connector is selected during post-processing // handle the annotation specified on a ResourceAdapter JavaBean // make sure that the property is not already specified in DD if(desc.getResourceAdapterClass().equals(declaringClass.getName())){ if (!(isConfigDefined(desc.getConfigProperties(), ep))) { desc.addConfigProperty(ep); } if(!desc.getConfigPropertyProcessedClasses().contains(declaringClass.getName())){ processParent(declaringClass.getSuperclass(), desc.getConfigProperties()); desc.addConfigPropertyProcessedClass(declaringClass.getName()); } //indicate that the config-property is processed return true; }else{ //indicate that the config-property is not processed and need to be processed during post-processing return false; } }
if (desc.getDescription().equals("") && connector.description().length > 0) { desc.setDescription(convertStringArrayToStringBuffer(connector.description())); if (desc.getDisplayName().equals("") && connector.displayName().length > 0) { desc.setDisplayName(convertStringArrayToStringBuffer(connector.displayName())); if ((desc.getSmallIconUri() == null || desc.getSmallIconUri().equals("")) && connector.smallIcon().length > 0) { desc.setSmallIconUri(convertStringArrayToStringBuffer(connector.smallIcon())); if ((desc.getLargeIconUri() == null || desc.getLargeIconUri().equals("")) && connector.largeIcon().length > 0) { desc.setLargeIconUri(convertStringArrayToStringBuffer(connector.largeIcon())); if (desc.getVendorName().equals("") && !connector.vendorName().equals("")) { desc.setVendorName(connector.vendorName()); if (desc.getEisType().equals("") && !connector.eisType().equals("")) { desc.setEisType(connector.eisType()); if (desc.getVersion().equals("") && !connector.version().equals("")) { desc.setVersion(connector.version()); if (desc.getLicenseDescriptor() == null) { ld.setDescription(convertStringArrayToStringBuffer(licenseDescriptor)); ld.setLicenseRequired(licenseRequired); desc.setLicenseDescriptor(ld);
String raClass = desc.getResourceAdapterClass(); if (raClass != null && !raClass.equals("")) { if (!desc.getConfigPropertyProcessedClasses().contains(raClass)) { Class claz = getClass(raClass); ConfigPropertyHandler.processParent(claz, desc.getConfigProperties()); if (desc.getOutBoundDefined()) { OutboundResourceAdapter ora = desc.getOutboundResourceAdapter(); Set connectionDefs = ora.getConnectionDefs(); Iterator it = connectionDefs.iterator(); if (!desc.getConfigPropertyProcessedClasses().contains(connectionFactoryClass)) { Class claz = getClass(connectionDef.getManagedConnectionFactoryImpl()); ConfigPropertyHandler.processParent(claz, connectionDef.getConfigProperties()); if (desc.getInBoundDefined()) { InboundResourceAdapter ira = desc.getInboundResourceAdapter(); Set messageListeners = ira.getMessageListeners(); Iterator it = messageListeners.iterator(); String activationSpecClass = ml.getActivationSpecClass(); if (activationSpecClass != null && !activationSpecClass.equals("")) { if (!desc.getConfigPropertyProcessedClasses().contains(activationSpecClass)) { Class claz = getClass(activationSpecClass); ConfigPropertyHandler.processParent(claz, ml.getConfigProperties()); Set adminObjects = desc.getAdminObjects(); Iterator it = adminObjects.iterator(); while (it.hasNext()) {
/** * write the descriptor class to a DOM tree and return it * * @param parent node for the DOM tree * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, ConnectorDescriptor conDesc) { conDesc.setSpecVersion(VERSION_15); Node connectorNode = super.writeDescriptor(parent, conDesc); appendTextChild(connectorNode, ConnectorTagNames.VENDOR_NAME, conDesc.getVendorName()); appendTextChild(connectorNode, ConnectorTagNames.EIS_TYPE, conDesc.getEisType()); appendTextChild(connectorNode, ConnectorTagNames.RESOURCEADAPTER_VERSION, conDesc.getResourceAdapterVersion()); Iterator requiredInflowContexts = conDesc.getRequiredWorkContexts().iterator(); for (; requiredInflowContexts.hasNext();) { String className = (String) requiredInflowContexts.next(); appendTextChild(connectorNode, ConnectorTagNames.REQUIRED_WORK_CONTEXT, className); } //license info LicenseNode licenseNode = new LicenseNode(); connectorNode = licenseNode.writeDescriptor(connectorNode, conDesc); // resource adapter node RANode raNode = new RANode(); connectorNode = raNode.writeDescriptor(connectorNode, conDesc); return connectorNode; }
Node raNode = appendChild(connectorNode, ConnectorTagNames.RESOURCE_ADAPTER); appendTextChild(raNode, ConnectorTagNames.RESOURCE_ADAPTER_CLASS, conDesc.getResourceAdapterClass()); raNode = config.writeDescriptor(raNode, conDesc); if (conDesc.getOutBoundDefined() == true) { if (conDesc.getInBoundDefined() == true) {
connectorDescriptor.getOutboundResourceAdapter().getConnectionDefs(); ConnectionDefDescriptor cdd = null; Iterator it = connectionDefs.iterator(); cdi.setResourceAdapterClassName(connectorDescriptor.getResourceAdapterClass()); cdi.setConnectionDefinitionName(cdd.getConnectionFactoryIntf()); cdi.setManagedConnectionFactoryClass(cdd.getManagedConnectionFactoryImpl()); Set mergedProps = mergeProps(props, cdd.getConfigProperties(), rarName); cdi.setMCFConfigProperties(mergedProps); cdi.setResourceAdapterConfigProperties(connectorDescriptor.getConfigProperties()); ccp.setConnectorDescriptorInfo(cdi); ccp.setSecurityMaps(SecurityMapUtils.getConnectorSecurityMaps(securityMaps));
if (!desc.getInBoundDefined()) { desc.setInboundResourceAdapter(new InboundResourceAdapter()); InboundResourceAdapter ira = desc.getInboundResourceAdapter();
private void processActivation(AnnotationInfo element, ConnectorDescriptor desc, ConnectorConfigProperty ep, Class declaringClass) { InboundResourceAdapter ira = desc.getInboundResourceAdapter(); if (declaringClass.getAnnotation(Activation.class) != null) { if (desc.getInBoundDefined()) { Activation activation = (Activation) declaringClass.getAnnotation(Activation.class); Class[] messageListeners = activation.messageListeners(); ml.addConfigProperty(ep); if (!desc.getConfigPropertyProcessedClasses().contains(declaringClass.getName())) { processParent(declaringClass.getSuperclass(), ml.getConfigProperties()); desc.addConfigPropertyProcessedClass(declaringClass.getName()); if(desc.getInBoundDefined()){ Set messageListeners = desc.getInboundResourceAdapter().getMessageListeners(); Iterator mlItr = messageListeners.iterator(); while(mlItr.hasNext()){ ml.addConfigProperty(ep); if(!desc.getConfigPropertyProcessedClasses().contains(declaringClass.getName())){ processParent(declaringClass.getSuperclass(), ml.getConfigProperties()); desc.addConfigPropertyProcessedClass(declaringClass.getName());
if (getLicenseDescriptor() != null) { buf.append("\n license_description : " + getLicenseDescriptor().getDescription()); buf.append("\n licenseRequired : " + getLicenseDescriptor().getLicenseRequiredValue()); appendConfigProperties(this.configProperties, buf); conDef.getManagedConnectionFactoryImpl() + "] config properties :"); appendConfigProperties(conDef.getConfigProperties(), buf); getSecurityPermissions().iterator(); i.hasNext();) buf.append("[Type : " + a.getAdminObjectInterface() + "], "); buf.append("[Class : " + a.getAdminObjectClass() + "]"); appendConfigProperties(a.getConfigProperties(), buf); buf.append("\n------------ ");
Collection<ConnectorDescriptor> rarDescriptors = dolApp.getRarDescriptors(); for (ConnectorDescriptor desc : rarDescriptors) { SunConnector sunraDesc = desc.getSunDescriptor(); if (sunraDesc != null) { String sunRAJndiName = (String) sunraDesc.getResourceAdapter(). getValue(ResourceAdapter.JNDI_NAME); if (jndiName.equals(sunRAJndiName)) { app.addResourceAdapter(desc.getName()); found = true; break; if (desc.getDefaultResourcesNames().contains(jndiName)) { app.addResourceAdapter(desc.getName()); found = true; break;
public List<AdminObject> getAdminObjectsByClass(String adminObjectClass) { List<AdminObject> adminObjects = new ArrayList<AdminObject>(); Iterator i = getAdminObjects().iterator(); while (i.hasNext()) { AdminObject ao = (AdminObject) i.next(); if (adminObjectClass.equals(ao.getAdminObjectClass())) adminObjects.add(ao); } return adminObjects; }
/** * Deletes both the default connector connection pools and resources */ protected void destroyAllConnectorResources() { if (!(isSystemRar(moduleName_))) { deleteDefaultConnectorResources(); deleteDefaultConnectorConnectionPools(); // Added to ensure clean-up of the Sun RA connection pool if (desc_.getSunDescriptor() != null && desc_.getSunDescriptor().getResourceAdapter() != null) { // sun-ra.xml exists String jndiName = (String) desc_.getSunDescriptor(). getResourceAdapter().getValue(ResourceAdapter.JNDI_NAME); if (jndiName == null || jndiName.equals("")) { // jndiName is empty, sunRA pool not created, so don't need to delete } else { // jndiName is not empty, need to delete pool deleteSunRAConnectionPool(); } } } }
/** * check whether the <i>required-work-context</i> list mandated by the resource-adapter * is supported by the application server * @param desc ConnectorDescriptor * @throws ConnectorRuntimeException when unable to support any of the requested work-context type. */ private void validateWorkContextSupport(ConnectorDescriptor desc) throws ConnectorRuntimeException { Set workContexts = desc.getRequiredWorkContexts(); Iterator workContextsIterator = workContexts.iterator(); WorkContextHandler workContextHandler = connectorRuntime_.getWorkContextHandler(); workContextHandler.init(moduleName_, jcl_); while(workContextsIterator.hasNext()){ String ic = (String)workContextsIterator.next(); boolean supported = workContextHandler.isContextSupported(true, ic ); if(!supported){ String errorMsg = "Unsupported work context [ "+ ic + " ] "; Object params[] = new Object[]{ic, desc.getName()}; _logger.log(Level.WARNING,"unsupported.work.context", params); throw new ConnectorRuntimeException(errorMsg); } } }
Set ddVals = desc.getConfigProperties(); Properties mergedVals = null; String className = desc.getResourceAdapterClass(); Properties introspectedVals = null; if (className != null && className.length() != 0) {
/** * Returns all the message listeners present in the connectorDescriptor * which abstracts the ra.xml * @param desc connectorDescriptor which abstracts the ra.xml * @return Array of MessageListener objects */ public MessageListener[] getMessageListeners(ConnectorDescriptor desc) { InboundResourceAdapter inboundRA = null; Set messageListenerSet = null; if(desc != null && (inboundRA = desc.getInboundResourceAdapter()) != null) { messageListenerSet = inboundRA.getMessageListeners(); } if(messageListenerSet == null) { return null; } int size = messageListenerSet.size(); MessageListener[] messageListeners = new MessageListener[size]; Iterator iter = messageListenerSet.iterator(); for(int i=0;i<size;++i){ messageListeners[i] = (MessageListener)iter.next(); } return messageListeners; } }
/** * Creates connector connection pool pertaining to sun-ra.xml. This is * only for 1.0 complient rars. * * @throws ConnectorRuntimeException Thrown when pool creation fails. */ private void createSunRAConnectionPool() throws ConnectorRuntimeException { String defaultPoolName = connectorRuntime_.getDefaultPoolName( moduleName_, connectionDefs_[0].getConnectionFactoryIntf()); String sunRAPoolName = defaultPoolName + ConnectorConstants.SUN_RA_POOL; PoolInfo poolInfo = new PoolInfo(sunRAPoolName); ConnectorDescriptorInfo connectorDescriptorInfo = ConnectorDDTransformUtils.getConnectorDescriptorInfo(connectionDefs_[0]); connectorDescriptorInfo.setRarName(moduleName_); connectorDescriptorInfo.setResourceAdapterClassName(desc_.getResourceAdapterClass()); ConnectorConnectionPool connectorPoolObj = ConnectionPoolObjectsUtils.createSunRaConnectorPoolObject(poolInfo, desc_, moduleName_); connectorPoolObj.setConnectorDescriptorInfo(connectorDescriptorInfo); connectorRuntime_.createConnectorConnectionPool(connectorPoolObj); if(_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "Created SUN-RA connection pool:", poolInfo); } String jndiName = (String) desc_.getSunDescriptor(). getResourceAdapter().getValue(ResourceAdapter.JNDI_NAME); ResourceInfo resourceInfo = new ResourceInfo(jndiName); connectorRuntime_.createConnectorResource(resourceInfo, poolInfo, null); if(_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "Created SUN-RA connector resource : ", resourceInfo); } }
ConnectorDescriptor descriptor = registry.getDescriptor(rarName); if (descriptor != null) { isDefaultResource = descriptor.getDefaultResourcesNames().contains(resourceInfo.getName()); if (descriptor.getSunDescriptor() != null) { com.sun.enterprise.deployment.runtime.connector.ResourceAdapter rar = descriptor.getSunDescriptor().getResourceAdapter(); if (rar != null) { String sunRAJndiName = (String)