public ConnectorArchivist getConnectorArchvist() throws ConnectorRuntimeException { try{ ArchivistFactory archivistFactory = habitat.getComponent(ArchivistFactory.class); return (ConnectorArchivist)archivistFactory.getArchivist(XModuleType.RAR); }catch(IOException ioe){ _logger.log(Level.WARNING, "unable to get Connector Archivist : ", ioe); ConnectorRuntimeException cre = new ConnectorRuntimeException(ioe.getMessage()); cre.setStackTrace(ioe.getStackTrace()); throw cre; } }
/** * given the location of .rar (archive / exploded dir), the specified class will be loaded * @param pathToDeployableUnit location of .rar (archive / exploded dir) * @param beanClassName class that has to be loaded * @return loaded class * @throws ConnectorRuntimeException when unable to load the class */ private static Class loadClass(String pathToDeployableUnit, String beanClassName) throws ConnectorRuntimeException { Class cls = null; ClassLoader cl = getClassLoader(pathToDeployableUnit); try { //Only if RA is a 1.5 RAR, we need to get RA JavaBean properties, else //return an empty map. if (beanClassName != null && beanClassName.trim().length() != 0) { cls = cl.loadClass(beanClassName); } return cls; } catch (ClassNotFoundException e) { _logger.info(e.getMessage()); if(_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "Unable to find class while trying to read connector" + "descriptor to get resource-adapter properties", e); } ConnectorRuntimeException cre = new ConnectorRuntimeException("unable to find class : " + beanClassName); cre.setStackTrace(e.getStackTrace()); throw cre; } }
cre.setStackTrace(ioe.getStackTrace()); throw cre;
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); }