Search in sources :

Example 6 with UpgradeException

use of com.thinkbiganalytics.server.upgrade.UpgradeException in project kylo by Teradata.

the class UpgradeAction method moveNode.

private void moveNode(Session session, Node node, Node parentNode) {
    try {
        if ((node != null) && (parentNode != null)) {
            // Path may not be accurate if parent node moved recently
            final String srcPath = node.getParent().getPath() + "/" + StringUtils.substringAfterLast(node.getPath(), "/");
            session.move(srcPath, parentNode.getPath() + "/" + node.getName());
        }
    } catch (RepositoryException e) {
        throw new UpgradeException("Failed to moved node " + node + " under parent " + parentNode, e);
    }
}
Also used : UpgradeException(com.thinkbiganalytics.server.upgrade.UpgradeException) RepositoryException(javax.jcr.RepositoryException)

Example 7 with UpgradeException

use of com.thinkbiganalytics.server.upgrade.UpgradeException in project kylo by Teradata.

the class VersionableFeedUpgradeAction method upgradeTo.

@Override
public void upgradeTo(final KyloVersion startingVersion) {
    log.info("Upgrading feeds as versionable for version: {}", startingVersion);
    feedProvider.getFeeds().forEach(feed -> {
        JcrFeed jcrFeed = (JcrFeed) feed;
        Node summaryNode = jcrFeed.getFeedSummary().get().getNode();
        try {
            summaryNode.addMixin("mix:versionable");
        } catch (Exception e) {
            log.error("Failed to set a feed as versionable: {}", feed.getName(), e);
            ;
            throw new UpgradeException("Failed to set a feed summary node as versionable: " + summaryNode, e);
        }
    });
}
Also used : UpgradeException(com.thinkbiganalytics.server.upgrade.UpgradeException) JcrFeed(com.thinkbiganalytics.metadata.modeshape.feed.JcrFeed) Node(javax.jcr.Node) UpgradeException(com.thinkbiganalytics.server.upgrade.UpgradeException)

Aggregations

UpgradeException (com.thinkbiganalytics.server.upgrade.UpgradeException)7 RepositoryException (javax.jcr.RepositoryException)5 Node (javax.jcr.Node)3 JcrFeed (com.thinkbiganalytics.metadata.modeshape.feed.JcrFeed)2 Workspace (org.modeshape.jcr.api.Workspace)2 KyloVersion (com.thinkbiganalytics.KyloVersion)1 User (com.thinkbiganalytics.metadata.api.user.User)1 UserGroup (com.thinkbiganalytics.metadata.api.user.UserGroup)1 JcrMetadataAccess (com.thinkbiganalytics.metadata.modeshape.JcrMetadataAccess)1 JcrCategory (com.thinkbiganalytics.metadata.modeshape.category.JcrCategory)1 JcrUtil (com.thinkbiganalytics.metadata.modeshape.support.JcrUtil)1 JcrVersionUtil (com.thinkbiganalytics.metadata.modeshape.support.JcrVersionUtil)1 KyloUpgrader (com.thinkbiganalytics.server.upgrade.KyloUpgrader)1 UpgradeState (com.thinkbiganalytics.server.upgrade.UpgradeState)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Property (javax.jcr.Property)1 PropertyType (javax.jcr.PropertyType)1 Session (javax.jcr.Session)1