Package org.wso2.carbon.registry.core.config

Examples of org.wso2.carbon.registry.core.config.RegistryContext$RegURLSupplier


        RegistryService registryService = Utils.getRegistryService();
        if (registryService == null) {
            log.error("Registry Service has not been set.");
        } else {
            try {
                RegistryContext context =
                        registryService.getRegistry().getRegistryContext();
                if (context != null) {
                    return context.isReadOnly();
                }
            } catch (Exception e) {
                log.error("An error occurred while obtaining registry instance", e);
            }
        }
View Full Code Here


            log.warn(msg);
            throw new AuthorizationFailedException(msg);
        }

        // then add the new resource/collection
        RegistryContext registryContext = null;
        if (CurrentSession.getUserRegistry() != null) {
            registryContext = CurrentSession.getUserRegistry().getRegistryContext();
        }
        if (registryContext == null) {
            registryContext = RegistryContext.getBaseInstance();
        }
        if (!Boolean.FALSE.equals(CurrentSession.getAttribute(IS_LOGGING_ACTIVITY))) {
            registryContext.getLogWriter().addLog(
                    path, CurrentSession.getUser(), LogEntry.ADD, null);
        }
        if (!(resource instanceof CollectionImpl)) {
            if (resource.getMediaType() == null || resource.getMediaType().length() == 0) {
                String temp = MediaTypesUtils.getMediaType(RegistryUtils.getResourceName(path));
View Full Code Here

        }

        // we ignore the resource.isContentModified()), isPropertiesModified
        //  as we have to store the version correctly

        RegistryContext registryContext = null;
        if (CurrentSession.getUserRegistry() != null) {
            registryContext = CurrentSession.getUserRegistry().getRegistryContext();
        }
        if (registryContext == null) {
            registryContext = RegistryContext.getBaseInstance();
        }
        if (!Boolean.FALSE.equals(CurrentSession.getAttribute(IS_LOGGING_ACTIVITY))) {
            registryContext.getLogWriter().addLog(resourceID.getPath(), CurrentSession.getUser(),
                    LogEntry.UPDATE, null);
        }
        if (!(resource instanceof CollectionImpl)) {
            if (resource.getMediaType() == null || resource.getMediaType().length() == 0) {
                String temp = MediaTypesUtils.getMediaType(
View Full Code Here

     * @param requestContext Details of the request.
     *
     * @return whether the resource exists
     */
    public RegistryContext getRegistryContext(RequestContext requestContext) {
        RegistryContext registryContext = null;
        Set<Filter> filters = getRegistryContextHandlerMap.keySet();
        for (Filter filter : filters) {
            if (filter != null && filter.handleGetRegistryContext(requestContext)) {
                Set<Handler> handlerSet = getRegistryContextHandlerMap.get(filter);
                Handler[] handlers = handlerSet.toArray(new Handler[handlerSet.size()]);
View Full Code Here

            throw new RegistryException(msg);
        }


        CollectionImpl collection = new CollectionImpl();
        RegistryContext registryContext = null;
        if (CurrentSession.getUserRegistry() != null) {
            registryContext = CurrentSession.getUserRegistry().getRegistryContext();
        }
        if (registryContext == null) {
            registryContext = RegistryContext.getBaseInstance();
        }
        if (!Boolean.FALSE.equals(CurrentSession.getAttribute(IS_LOGGING_ACTIVITY))) {
            registryContext.getLogWriter().addLog(
                    path, CurrentSession.getUser(), LogEntry.ADD, null);
        }
        resourceDAO.add(path, parentResourceID, collection);
    }
View Full Code Here

        String domain = userNameWithDomain.substring(atIndex + 1, userNameWithDomain.length());
        return getTenantIdFromDomain(domain);
    }

    private static int getTenantIdFromDomain(String domain) throws RegistryException {
        RegistryContext registryContext = RegistryContext.getBaseInstance();
        RealmService realmService = registryContext.getRealmService();
        if (realmService == null) {
            String msg = "Error in getting the tenant manager. The realm service is not available.";
            log.error(msg);
            throw new RegistryException(msg);
        }
View Full Code Here

     * Method to clean the embedded registry instance, after the synchronization operation. This
     * method should only be invoked if the synchronization happens at a client that terminates soon
     * after the execution of the synchronization operation, to prevent loss of activity logs.
     */
    public static void cleanEmbeddedRegistry() {
        RegistryContext registryContext = RegistryContext.getBaseInstance();
        if (registryContext != null) {
            LogWriter logWriter = registryContext.getLogWriter();
            if (logWriter != null) {
                logWriter.interrupt();
            }
        }
    }
View Full Code Here

     *
     * @return the cache key.
     */
    public static RegistryCacheKey buildRegistryCacheKey(String connectionId, int tenantId,
                                                   String resourcePath) {
        RegistryContext registryContext = RegistryContext.getBaseInstance();
        String absoluteLocalRepositoryPath = getAbsolutePath(registryContext,
                RegistryConstants.LOCAL_REPOSITORY_BASE_PATH);
        if (resourcePath != null && resourcePath.startsWith(absoluteLocalRepositoryPath)) {
            return new RegistryCacheKey(resourcePath, tenantId,
                    registryContext.getNodeIdentifier() + ":" + connectionId);
        } else {
            return new RegistryCacheKey(resourcePath, tenantId, connectionId);
        }
    }
View Full Code Here

     *
     * @throws RegistryException if an error occurred.
     */
    public static boolean systemResourceShouldBeAdded(Registry registry, String absolutePath)
        throws RegistryException {
        RegistryContext registryContext = registry.getRegistryContext();
        if (registryContext == null) {
            registryContext = RegistryContext.getBaseInstance();
        }
        if (registryContext.isSystemResourcePathRegistered(absolutePath)) {
            return false;
        } else if (registry.resourceExists(absolutePath)) {
            registryContext.registerSystemResourcePath(absolutePath);
            return false;
        }
        return true;
    }
View Full Code Here

     * @throws RegistryException if an error occurred.
     */
    public static boolean systemResourceShouldBeAdded(ResourceDAO dataAccessObject,
                                                      String absolutePath)
            throws RegistryException {
        RegistryContext registryContext = RegistryContext.getBaseInstance();
        if (RegistryContext.getBaseInstance().isSystemResourcePathRegistered(absolutePath)) {
            return false;
        } else if (dataAccessObject.resourceExists(absolutePath)) {
            registryContext.registerSystemResourcePath(absolutePath);
            return false;
        }
        return true;
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.config.RegistryContext$RegURLSupplier

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.