public ConnectorDescriptor getConnectorDescriptorFromUri(String rarName, String raLoc) { try { String appName = rarName.substring(0, rarName.indexOf(ConnectorConstants.EMBEDDEDRAR_NAME_DELIMITER)); //String actualRarName = rarName.substring(rarName.indexOf(ConnectorConstants.EMBEDDEDRAR_NAME_DELIMITER) + 1); String appDeployLocation = ResourcesUtil.createInstance().getApplicationDeployLocation(appName); FileArchive in = ConnectorRuntime.getRuntime().getFileArchive(); in.open(new URI(appDeployLocation)); ApplicationArchivist archivist = ConnectorRuntime.getRuntime().getApplicationArchivist(); com.sun.enterprise.deployment.Application application = archivist.open(in); return application.getRarDescriptorByUri(raLoc); } catch (Exception e) { Object params[] = new Object[]{rarName, e}; _logger.log(Level.WARNING, "error.getting.connector.descriptor", params); } return null; }
public void createActiveResourceAdapterForEmbeddedRar(String rarModuleName) throws ConnectorRuntimeException { ConnectorDescriptor cdesc = loadConnectorDescriptorForEmbeddedRAR(rarModuleName); String appName = ConnectorAdminServiceUtils.getApplicationName(rarModuleName); String rarFileName = ConnectorAdminServiceUtils .getConnectorModuleName(rarModuleName) + ".rar"; String loc = getResourcesUtil().getApplicationDeployLocation(appName); loc = loc + File.separator + FileUtils.makeFriendlyFilename(rarFileName); String path = null; try { URI uri = new URI(loc); path = uri.getPath(); } catch (URISyntaxException use) { ConnectorRuntimeException cre = new ConnectorRuntimeException("Invalid path [ "+use.getMessage()+" ]"); cre.setStackTrace(use.getStackTrace()); _logger.log(Level.WARNING, cre.getMessage(), cre); throw cre; } // start RA _runtime.createActiveResourceAdapter(cdesc, rarModuleName, path); }