Package org.wso2.carbon.registry.core.jdbc.handlers

Examples of org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager


        layoutManager.setVerticalLayout(true);
        layoutManager.setYSpacing(20);
        layoutManager.setYSpacing(50);
        layoutManager.layoutSVG(bpel.getRootActivity());

        SVGImpl svg = new SVGImpl();
        svg.setRootActivity(bpel.getRootActivity());
       
        return(svg);
    }
View Full Code Here


    }

    public static void registerRegistryUsagePersistingListener(RegistryContext registryContext)
            throws RegistryException {
        HandlerManager handlerManager = registryContext.getHandlerManager();
        RegistryUsagePersistingListener handler = new RegistryUsagePersistingListener();
        URLMatcher anyUrlMatcher = new URLMatcher();
        anyUrlMatcher.setPattern(".*");
        String[] applyingFilters = new String[]{
                Filter.PUT, Filter.IMPORT, Filter.GET, Filter.DUMP, Filter.RESTORE,};

        handlerManager.addHandlerWithPriority(applyingFilters, anyUrlMatcher, handler,
                HandlerLifecycleManager.DEFAULT_REPORTING_HANDLER_PHASE);
    }
View Full Code Here

        SymLinkHandler handler = new SymLinkHandler();
        handler.setMountPoint(path);
        handler.setTargetPoint(target);
        handler.setAuthor(author);

        HandlerManager hm = context.getHandlerManager();
        hm.addHandler(RegistryUtils.getMountingMethods(),
                RegistryUtils.getMountingMatcher(path), handler,
                HandlerLifecycleManager.TENANT_SPECIFIC_SYSTEM_HANDLER_PHASE);
        // now we are going to iterate through all the already available symbolic links and resolve
        // the cyclic symbolic links

        Set<SymLinkHandler> symLinkHandlers = SymLinkHandler.getSymLinkHandlers();

        List<SymLinkHandler> handlersToRemove = new ArrayList<SymLinkHandler>();
        for (SymLinkHandler symLinkHandler: symLinkHandlers) {
            String symLinkTarget = symLinkHandler.getTargetPoint();

            // and then we remove old entries for the same mount path
            String mountPath = symLinkHandler.getMountPoint();
            if (path.equals(mountPath) && !target.equals(symLinkTarget)) {
                handlersToRemove.add(symLinkHandler);
            }
        }
        // removing the symlink handlers
        for (SymLinkHandler handlerToRemove : handlersToRemove) {
            hm.removeHandler(handlerToRemove,
                HandlerLifecycleManager.TENANT_SPECIFIC_SYSTEM_HANDLER_PHASE);
        }

        // and importantly add the new entry, the currently creating symlink information..
        symLinkHandlers.add(handler);
View Full Code Here

    public static void registerHandlerForRemoteLinks(RegistryContext registryContext,
                                                     String path, String target,
                                                     String targetSubPath, String author,
                                                     boolean forAllTenants)
            throws RegistryException {
        HandlerManager hm = registryContext.getHandlerManager();
        List<RemoteConfiguration> remoteInstances = registryContext.getRemoteInstances();
        for (RemoteConfiguration config : remoteInstances) {
            if (config.getId().equals(target)) {
                MountHandler handler = new MountHandler();
                handler.setUserName(config.getTrustedUser());
                handler.setPassword(config.getResolvedTrustedPwd());
                handler.setDbConfig(config.getDbConfig());
                handler.setRegistryRoot(config.getRegistryRoot());
                handler.setReadOnly(config.getReadOnly() != null &&
                        Boolean.toString(true).equals(config.getReadOnly().toLowerCase()));
                handler.setId(target);
                handler.setConURL(config.getUrl());
                handler.setMountPoint(path);
                handler.setSubPath(targetSubPath);
                handler.setAuthor(author);
                if (config.getTrustedUser() == null || config.getTrustedPwd() == null) {
                    handler.setRemote(false);
                } else {
                    handler.setRemote(true);
                    handler.setRegistryType(config.getType());
                }
                if (forAllTenants) {
                    hm.addHandler(RegistryUtils.getMountingMethods(),
                            RegistryUtils.getMountingMatcher(path), handler);
                } else {
                    hm.addHandler(RegistryUtils.getMountingMethods(),
                            RegistryUtils.getMountingMatcher(path), handler,
                            HandlerLifecycleManager.TENANT_SPECIFIC_SYSTEM_HANDLER_PHASE);
                }
                return;
            }
View Full Code Here

        Registry adminRegistry = embeddedRegistryService.getUserRegistry(
            realmConfig.getAdminUserName(), realmConfig.getAdminPassword());
        RegistryContext registryContext = adminRegistry.getRegistryContext();
        MyPrivateHandler myPrivateHandler = new MyPrivateHandler();

        HandlerManager handlerManager = registryContext.getHandlerManager();

        URLMatcher myPrivateHandlerMatcher = new URLMatcher();
        myPrivateHandlerMatcher.setGetPattern(".*/to/my/private/handler");
        myPrivateHandlerMatcher.setPutPattern(".*/to/my/private/handler");
        handlerManager.addHandler(
                new String[] {Filter.GET, Filter.PUT} , myPrivateHandlerMatcher, myPrivateHandler);

        Resource r = adminRegistry.newResource();
        String originalContent = "original content";
        r.setContent(originalContent.getBytes());
View Full Code Here

    // Do tenant-specific initialization.
    private static void initializeTenant(RegistryService registryService, int tenantId) {
        try {
            UserRegistry systemRegistry = registryService.getConfigSystemRegistry();
            if (systemRegistry.getRegistryContext() != null) {
                HandlerManager handlerManager =
                        systemRegistry.getRegistryContext().getHandlerManager();
                if (handlerManager instanceof HandlerLifecycleManager) {
                    ((HandlerLifecycleManager)handlerManager).init(tenantId);
                }
            }
View Full Code Here

            log.trace("Registering the built-in handlers.");
        }
        Registry registry = registryService.getRegistry(
                CarbonConstants.REGISTRY_SYSTEM_USERNAME);
        RegistryContext registryContext = registry.getRegistryContext();
        HandlerManager handlerManager = registryContext.getHandlerManager();

        if (log.isTraceEnabled()) {
            log.trace("Engaging the Operation Statistics Handler.");
        }
        // handler to record system statistics
        OperationStatisticsHandler systemStatisticsHandler = new OperationStatisticsHandler();
        URLMatcher systemStatisticsURLMatcher = new URLMatcher();
        systemStatisticsURLMatcher.setPattern(".*");
        handlerManager.addHandler(null, systemStatisticsURLMatcher, systemStatisticsHandler);

        if (log.isTraceEnabled()) {
            log.trace("Engaging the Comment URL Handler.");
        }
        // this handler will return the comment for a path ending as ;comments:<number>
        CommentURLHandler commentURLHandler = new CommentURLHandler();
        URLMatcher commentURLMatcher = new URLMatcher();
        commentURLMatcher.setGetPattern(".+;comments:[0-9]+");
        commentURLMatcher.setDeletePattern(".+;comments:[0-9]+");
        handlerManager.addHandler(
                new String[]{Filter.GET, Filter.DELETE}, commentURLMatcher, commentURLHandler);

        if (log.isTraceEnabled()) {
            log.trace("Engaging the Comment Collection URL Handler.");
        }
        // this will return all the comments for the path if the path ending as ;comments
        CommentCollectionURLHandler commentCollectionURLHandler = new CommentCollectionURLHandler();
        URLMatcher commentCollectionURLMatcher = new URLMatcher();
        commentCollectionURLMatcher.setGetPattern(".+;comments");
        handlerManager.addHandler(new String[]{Filter.GET},
                commentCollectionURLMatcher, commentCollectionURLHandler);

        if (log.isTraceEnabled()) {
            log.trace("Engaging the Rating URL Handler.");
        }
        // this will return the rating of a user if the path is ending as ;ratings:<username>
        RatingURLHandler ratingURLHandler = new RatingURLHandler();
        URLMatcher ratingURLMatcher = new URLMatcher();
        ratingURLMatcher.setGetPattern(".+;ratings:.+");
        handlerManager.addHandler(new String[]{Filter.GET}, ratingURLMatcher, ratingURLHandler);

        if (log.isTraceEnabled()) {
            log.trace("Engaging the Rating Collection URL Handler.");
        }
        // this will return all the ratings for a path if the path is ending as ;ratings
        RatingCollectionURLHandler ratingCollectionURLHandler = new RatingCollectionURLHandler();
        URLMatcher ratingCollectionURLMatcher = new URLMatcher();
        ratingCollectionURLMatcher.setGetPattern(".+;ratings");
        handlerManager.addHandler(
                new String[]{Filter.GET}, ratingCollectionURLMatcher, ratingCollectionURLHandler);

        if (log.isTraceEnabled()) {
            log.trace("Engaging the Tag URL Handler.");
        }
        // this will return the tags for a path  if the path is ending as
        // ;tags:<tag-name>:<user-name>
        TagURLHandler tagURLHandler = new TagURLHandler();
        URLMatcher tagURLMatcher = new URLMatcher();
        tagURLMatcher.setGetPattern(".+;.+:.+:.+");
        handlerManager.addHandler(new String[]{Filter.GET}, tagURLMatcher, tagURLHandler);

        if (log.isTraceEnabled()) {
            log.trace("Engaging the SQL Query Handler.");
        }
        // this will return the results for a custom query if the resource has the
        // media type:SQL_QUERY_MEDIA_TYPE
        SQLQueryHandler sqlQueryHandler = new SQLQueryHandler();
        MediaTypeMatcher sqlMediaTypeMatcher =
                new MediaTypeMatcher(RegistryConstants.SQL_QUERY_MEDIA_TYPE);
        handlerManager.addHandler(
                new String[]{Filter.GET, Filter.PUT}, sqlMediaTypeMatcher, sqlQueryHandler);

        // Register Simulation Handler
        handlerManager.addHandler(null, new SimulationFilter(), new SimulationHandler(),
                HandlerLifecycleManager.DEFAULT_REPORTING_HANDLER_PHASE);

        if (log.isTraceEnabled()) {
            log.trace("Engaging the Cashing Registry Handler.");
        }
        // handler to cache registry operation results.
        CachingHandler cachingHandler = new CachingHandler();
        URLMatcher cachingURLMatcher = new URLMatcher();
        cachingURLMatcher.setPattern(".*");

        handlerManager.addHandler(null, cachingURLMatcher, cachingHandler);
        handlerManager.addHandler(null, cachingURLMatcher, cachingHandler,
                HandlerLifecycleManager.DEFAULT_REPORTING_HANDLER_PHASE);

        if (log.isTraceEnabled()) {
            log.trace("Engaging the RegexBase Restriction Handler.");
        }
        // handler to validate registry root's immediate directory paths prior to move and rename operations
        Handler regexBaseRestrictionHandler =  new RegexBaseRestrictionHandler();
        URLMatcher logUrlMatcher = new URLMatcher();
        logUrlMatcher.setPattern(".*");

        handlerManager.addHandler(new String[] {Filter.RENAME, Filter.MOVE}, logUrlMatcher, regexBaseRestrictionHandler,
                HandlerLifecycleManager.DEFAULT_SYSTEM_HANDLER_PHASE);

    }
View Full Code Here

            throw new RegistryException(blockedMsg);
        }
    }

    public static void registerPerRegistryRequestListener(RegistryContext registryContext) {
        HandlerManager handlerManager = registryContext.getHandlerManager();
        PerRegistryRequestListener storeBandwidthHandler = new PerRegistryRequestListener();
        URLMatcher anyUrlMatcher = new URLMatcher();
        anyUrlMatcher.setPattern(".*");
        String[] applyingFilters =
                new String[] { Filter.PUT, Filter.IMPORT, Filter.GET, Filter.DUMP, Filter.RESTORE, };

        handlerManager.addHandlerWithPriority(
                applyingFilters, anyUrlMatcher, storeBandwidthHandler);
    }
View Full Code Here

        String fullPath = requestContext.getResourcePath().getPath();
        RegistryContext registryContext = requestContext.getRegistryContext();
        if (fullPath.equals(this.mountPoint)) {
            requestContext.getRegistry().removeLink(requestContext.getResource().getPath());
            if (registryContext != null) {
                HandlerManager hm = registryContext.getHandlerManager();
                hm.removeHandler(this,
                        HandlerLifecycleManager.TENANT_SPECIFIC_SYSTEM_HANDLER_PHASE);
            }
        } else {
            String actualPath = fullPath.substring(this.mountPoint.length(), fullPath.length());
            if (subPath != null) {
View Full Code Here

            newPath = requestContext.getRepository()
                    .rename(new ResourcePath(fullResourcePath), fullTargetPath);
            requestContext.getRegistry().createLink(fullTargetPath, this.id);
            requestContext.getRegistry().removeLink(this.mountPoint);
            if (registryContext != null) {
                HandlerManager hm = registryContext.getHandlerManager();
                hm.removeHandler(this,
                        HandlerLifecycleManager.TENANT_SPECIFIC_SYSTEM_HANDLER_PHASE);
            }
        } else {
            String actualResourcePath = fullResourcePath.substring(
                    this.mountPoint.length(), fullResourcePath.length());
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.