@Override public void execute(final InstallContext installContext) throws TaskExecutionException { try { bootstrap(installContext, importUUIDBehavior); } catch (IOException | RepositoryException e) { throw new TaskExecutionException("Could not bootstrap: " + e.getMessage(), e); } }
@Override public void execute( @Nonnull InstallContext ctx ) throws TaskExecutionException { try { executeImpl( ctx ); } catch( Exception ex ) { throw new TaskExecutionException( ex.getLocalizedMessage(), ex ); } }
@Override public void execute( @Nonnull InstallContext ctx ) throws TaskExecutionException { try { executeImpl(); } catch( Exception ex ) { throw new TaskExecutionException( ex.getLocalizedMessage(), ex ); } }
@Override protected boolean checkNode(Node node, InstallContext ctx) throws TaskExecutionException, RepositoryException { if (node.hasProperty(propertyName)) { final Property prop = node.getProperty(propertyName); return expectedValue.equals(prop.getString()); } else if (propertyMustExist) { throw new TaskExecutionException("Property \"" + propertyName + "\" was expected to exist at " + nodePath); } else { ctx.warn("Property \"" + propertyName + "\" was expected to be found at " + nodePath + " but does not exist."); return false; } } }
@Override public void execute(InstallContext ctx) throws TaskExecutionException { try { String outputResourceName = getOutputResourceName(resource, itemPath); //bootstrap bootstrap(outputResourceName, itemName, importUUIDBehavior, getNodeStream(resource, itemPath)); } catch (IOException e) { throw new TaskExecutionException("Cant find resource file"); } catch (RepositoryException e) { throw new TaskExecutionException("Cant bootstrap resource file"); } }
@Override public void execute(InstallContext installContext) throws TaskExecutionException { try { SecurityUtil.updateKeys(SecurityUtil.generateKeyPair(1024)); } catch (NoSuchAlgorithmException e) { throw new TaskExecutionException(e.getMessage(), e); } } }));
@Override public void execute(InstallContext installContext) throws TaskExecutionException { try { SecurityUtil.updateKeys(SecurityUtil.generateKeyPair(1024)); } catch (NoSuchAlgorithmException e) { throw new TaskExecutionException(e.getMessage(), e); } } }));
@Override public void execute(InstallContext installContext) throws TaskExecutionException { try { doExecute(installContext); } catch (RepositoryException e) { throw new TaskExecutionException("Could not execute task: " + ExceptionUtil.exceptionToWords(e), e); } }
@Override protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException { try { final InputStream propsStream = ClasspathResourcesUtil.getStream(resource); final Node root = installContext.getJCRSession(workspace).getRootNode(); new PropertiesImportExport().createNodes(root, propsStream); } catch (IOException e) { throw new TaskExecutionException(String.format("Could not load properties: %s", e.getMessage()), e); } } }
@Override public void execute(InstallContext ctx) throws TaskExecutionException { try { Session session = ctx.getJCRSession(RepositoryConstants.WEBSITE); Node rootNode = session.getRootNode(); NodeUtil.visit(rootNode, nodeVisitor); } catch (RepositoryException e) { throw new TaskExecutionException(e.getMessage(), e); } }
@Override protected void processApp(InstallContext installContext) throws RepositoryException, TaskExecutionException { final Session session = installContext.getConfigJCRSession(); final Node appsNode = NodeUtil.createPath(session.getRootNode(), "/modules/data/apps", NodeTypes.Content.NAME); if (!session.itemExists(appsNode.getPath() + "/" + appName)) { throw new TaskExecutionException(String.format("An app named [%s] doesn't exists at [%s], cannot add folder support.", appName, appsNode.getPath())); } Node subApps = session.getNode(appsNode.getPath() + "/" + appName + "/subApps"); processBrowserSubapp(subApps); }
@Override public void execute(InstallContext installContext) throws TaskExecutionException { try { Session config = installContext.getJCRSession(RepositoryConstants.CONFIG); String fetcherClass = config.getNode(RSSAggregator.RSS_CONFIG_PATH + "/fetcher").getProperty("class").getString(); config.getNode(RSSAggregator.RSS_CONFIG_PATH).setProperty("fetcherClass", fetcherClass); } catch (RepositoryException e) { throw new TaskExecutionException(e.getMessage(), e); } } }
@Override protected Content getParentNode(InstallContext ctx) throws RepositoryException, TaskExecutionException { if (!ctx.hasModulesNode()) { throw new TaskExecutionException("The main /modules node does not exist in the config repository, can not proceed."); } final Node modulesNode = ctx.getModulesNode(); return ContentUtil.asContent(modulesNode); }
@Override protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException { try { this.typeDefinition = (TypeDefinition) Components.getComponent(Node2BeanProcessor.class).toBean(typeNode, TypeDefinition.class); } catch (Exception e) { throw new TaskExecutionException(e.getMessage()); } this.collectChildTypes(typeNode, childTypeDefinitions); processApp(installContext); }
protected void processApp(InstallContext installContext) throws RepositoryException, TaskExecutionException { final Session session = installContext.getConfigJCRSession(); final Node appsNode = NodeUtil.createPath(session.getRootNode(), "/modules/data/apps", NodeTypes.Content.NAME); if (session.itemExists(appsNode.getPath() + "/" + appName)) { throw new TaskExecutionException(String.format("An app named [%s] already exists at [%s], please choose a unique name for your app.", appName, appsNode.getPath())); } Node app = createAppNode(appsNode, appName, icon); Node subApps = NodeUtil.createPath(app, "subApps", NodeTypes.ContentNode.NAME); processBrowserSubapp(subApps); createDetailSubapps(subApps); addToAppLauncherLayout(session, appName); }
/** * Iterates the current Dialog definition. */ private void initDialogPathMap(Session session, Map<String, String> dialogPathMap) throws TaskExecutionException { String dialogPath = MODULE_PATH_BASE + getModuleName() + "/dialogs"; try { if (session.nodeExists(dialogPath)) { Node dialogContent = session.getNode(dialogPath); populateDialogPathMap(dialogContent, "", dialogPathMap); } } catch (RepositoryException e) { throw new TaskExecutionException("Problem initializing dialog ID map.", e); } }
@Override protected void doExecute(InstallContext installContext) throws RepositoryException, TaskExecutionException { try { final InputStream propsStream = ClasspathResourcesUtil.getStream(resource); final Content root = HierarchyManagerUtil.asHierarchyManager(installContext.getJCRSession(workspace)).getRoot(); new PropertiesImportExport().createContent(root, propsStream); } catch (IOException e) { throw new TaskExecutionException("Could not load properties: " + e.getMessage(), e); } } }
@Override public void execute(final InstallContext ctx) throws TaskExecutionException { final String moduleName = ctx.getCurrentModuleDefinition().getName(); // TODO use a separate workspace, or a different storage root, ... ? try { final Session session = ctx.getConfigJCRSession(); final MD5CheckingFileExtractor extractor = new MD5CheckingFileExtractor(new InstallContextLogger(ctx), session); extractor.extractFiles(new ModuleFileExtractorTransformer(moduleName)); } catch (IOException e) { throw new TaskExecutionException("Could not extract files for module " + ctx.getCurrentModuleDefinition() + ": " + e.getMessage(), e); } catch (RepositoryException e) { throw new TaskExecutionException("Could not extract files for module " + ctx.getCurrentModuleDefinition() + ": " + e.getMessage(), e); } }
@Override protected void doExecute(InstallContext ctx) throws RepositoryException, TaskExecutionException { final Node root = getRootNode(ctx); final ErrorHandler errorHandler = newErrorHandler(ctx); final NodeBuilder nodeBuilder = new NodeBuilder(errorHandler, root, operations); try { nodeBuilder.exec(); } catch (NodeOperationException e) { throw new TaskExecutionException(e.getMessage(), e); } }
@Override protected void doExecute(InstallContext ctx) throws RepositoryException, TaskExecutionException { final Content root = getRootNode(ctx); final ErrorHandler errorHandler = newErrorHandler(ctx); final NodeBuilder nodeBuilder = new NodeBuilder(errorHandler, root, operations); try { nodeBuilder.exec(); } catch (NodeOperationException e) { throw new TaskExecutionException(e.getMessage(), e); } }