/** * Deploys a .gar archive to the Registry path in REGISTRY_GADGET_STORAGE_PATH * * @param deploymentFileData - info about the deployed file * @throws DeploymentException - error while deploying .gar archive */ public void deploy(DeploymentFileData deploymentFileData) throws DeploymentException { try { // int tenantId; // try { // tenantId = // MultitenantUtils.getTenantId(DashboardContext.getConfigContext()); // } catch (Exception e) { // throw new DeploymentException(e); // } UserRegistry registry = getRegistry(tenantID); // Extracting archive String extractedArchiveDir = extractGarArchive(deploymentFileData.getAbsolutePath()); // Set permission for anonymous read. We do it here because it should happen always in order // to support mounting a remote registry. if (registry != null) { AuthorizationManager accessControlAdmin = registry.getUserRealm().getAuthorizationManager(); if (!accessControlAdmin.isRoleAuthorized( CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME, RegistryConstants.CONFIG_REGISTRY_BASE_PATH + REGISTRY_GADGET_STORAGE_PATH, ActionConstants.GET)) { accessControlAdmin.authorizeRole( CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME, RegistryConstants.CONFIG_REGISTRY_BASE_PATH + REGISTRY_GADGET_STORAGE_PATH, ActionConstants.GET); } File gadgetsDir = new File(extractedArchiveDir); if (gadgetsDir.exists()) { beginFileTansfer(gadgetsDir, tenantID); log.info( "Successfully populated gadgets from archive ." + deploymentFileData.getAbsolutePath() + " to the registry."); } else { log.info("Couldn't find contents at '" + extractedArchiveDir + "'. Giving up."); } } } catch (RegistryException e) { throw new DeploymentException("An error occured while deploying gadget archive", e); } catch (CarbonException e) { throw new DeploymentException("An error occured while deploying gadget archive", e); } catch (UserStoreException e) { throw new DeploymentException("An error occured while deploying gadget archive", e); } }
public void deploy(DeploymentFileData deploymentFileData) throws DeploymentException { String path = deploymentFileData.getAbsolutePath(); try { if (deploymentFileData.getName().contains(EventSimulatorConstant.CONFIGURATION_XML_SUFFIX)) { processDeployStreamConfig(deploymentFileData); } else if (deploymentFileData .getName() .contains(EventSimulatorConstant.DATA_SOURCE_CONFIGURATION_XML_SUFFIX)) { processDeployDatasourceConfig(deploymentFileData); } else { log.warn( "XML file : " + deploymentFileData.getName() + " not deployed. Name should contain either " + EventSimulatorConstant.CONFIGURATION_XML_SUFFIX + " or " + EventSimulatorConstant.DATA_SOURCE_CONFIGURATION_XML_SUFFIX); } } catch (Throwable t) { File file = new File(path); log.error("Could not deploy XML file : " + file.getName(), t); throw new DeploymentException( "XML file not deployed and in inactive state : " + new File(path).getName(), t); } }
@Override public void deploy(DeploymentFileData deploymentFileData) throws DeploymentException { log.info("Deploying JAX-WS/JAX-RS Web Application : " + deploymentFileData.getAbsolutePath()); super.deploy(deploymentFileData); }