Hi Senaka,

Implementation is to introduce new backup cache in CacheBackRegistry. So if
the original cache is invalidated, request will reserve from the backup
cache and in the meantime we get the resource from the registry and update
both resource cache and backup cache. In order to get the resource from the
registry, It spawn new thread (DBResourceQueryThread). this thread will get
the resource from the registry and update both caches. To get the resource,
we need to set tenantID, user, userRealm to the new spawn thread.

CacheBackRegistry class with this change is attached here.
Please check and advice.

Thanks
Danesh

On Fri, Feb 13, 2015 at 3:40 AM, Senaka Fernando <sen...@wso2.com> wrote:

> Danesh,
>
> Sorry, but you are only extracting a portion of your code. Would you mind
> sharing the full code please? The CurrentSession is a data structure
> intended for very internal use within the repository and it only works (or
> makes sense) if it is used in such a way.
>
> Thanks,
> Senaka.
>
> On Thu, Feb 12, 2015 at 12:49 PM, Danesh Kuruppu <dan...@wso2.com> wrote:
>
>> Hi all,
>> I am doing some improvements for the CacheBackRegistry in carbon 4.1.0.
>> There I need to spawn new thread and inside the thread, I need to get
>> resource from registry. For that we need to set session parameters to call
>> the registry. In registry.core, current session parameters are retrieved
>> from CurrentSession class [1]
>>
>> 1. http://sr4.us1.wso2.com:9000/sonar/resource/index/341632?tab=source
>>
>> Is it correct to set session parameters like below.
>>
>>         public void run() {
>>>                     try {
>>>
>>>
>>> *                        CurrentSession.setTenantId(tenantID);
>>>               CurrentSession.setUser(username);
>>> CurrentSession.setUserRealm(userRealm);*
>>>
>>>                         Resource resource = registry.get(path);
>>>
>>>                     } catch (RegistryException exception) {
>>>
>>     .........
>>>
>>                     }
>>>         }
>>>
>>
>>
>> Please advice.
>> Thanks
>> --
>>
>> Danesh Kuruppu
>> Software Engineer
>> WSO2 Inc,
>> Mobile: +94 (77) 1690552
>>
>
>
>
> --
>
>
> *[image: http://wso2.com] <http://wso2.com>Senaka Fernando*
> Solutions Architect; WSO2 Inc.; http://wso2.com
>
>
>
> *Member; Apache Software Foundation; http://apache.org
> <http://apache.org>E-mail: senaka AT wso2.com <http://wso2.com>**P: +1
> 408 754 7388 <%2B1%20408%20754%207388>; ext: 51736*;
>
>
> *M: +44 782 741 1966 <%2B44%20782%20741%201966>Linked-In:
> http://linkedin.com/in/senakafernando
> <http://linkedin.com/in/senakafernando>*Lean . Enterprise . Middleware
>



-- 

Danesh Kuruppu
Software Engineer
WSO2 Inc,
Mobile: +94 (77) 1690552
/*
 * Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.wso2.carbon.registry.core.caching;

import net.sf.jsr107cache.Cache;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.caching.core.registry.GhostResource;
import org.wso2.carbon.caching.core.registry.RegistryCacheKey;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.registry.core.ActionConstants;
import org.wso2.carbon.registry.core.Aspect;
import org.wso2.carbon.registry.core.Association;
import org.wso2.carbon.registry.core.Collection;
import org.wso2.carbon.registry.core.Comment;
import org.wso2.carbon.registry.core.LogEntry;
import org.wso2.carbon.registry.core.LogEntryCollection;
import org.wso2.carbon.registry.core.Registry;
import org.wso2.carbon.registry.core.RegistryConstants;
import org.wso2.carbon.registry.core.Resource;
import org.wso2.carbon.registry.core.ResourcePath;
import org.wso2.carbon.registry.core.Tag;
import org.wso2.carbon.registry.core.TaggedResourcePath;
import org.wso2.carbon.registry.core.config.DataBaseConfiguration;
import org.wso2.carbon.registry.core.config.Mount;
import org.wso2.carbon.registry.core.config.RegistryContext;
import org.wso2.carbon.registry.core.config.RemoteConfiguration;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry;
import org.wso2.carbon.registry.core.secure.AuthorizationFailedException;
import org.wso2.carbon.registry.core.session.CurrentSession;
import org.wso2.carbon.registry.core.utils.AuthorizationUtils;
import org.wso2.carbon.registry.core.utils.RegistryUtils;
import org.wso2.carbon.user.core.UserRealm;
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;

import java.io.Reader;
import java.io.Writer;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * CacheBackedRegistry has wrapped from original Registry interface to support caching
 */
public class CacheBackedRegistry implements Registry {

    /**
     * wrapped this original registry object from CachedBackedRegistry
     */
    private Registry registry;

    private int tenantId = MultitenantConstants.INVALID_TENANT_ID;

    private Map<String, String> cacheIds =
            new HashMap<String, String>();
    private Map<String, DataBaseConfiguration> dbConfigs =
            new HashMap<String, DataBaseConfiguration>();
    private Map<String, String> pathMap =
            new HashMap<String, String>();

    /**
     * used to store cached data
     */
    private static Cache cache =
            RegistryUtils.getCommonCache(RegistryConstants.REGISTRY_CACHE_BACKED_ID);

    /**
     * used to store backup cached data
     */
    private static Cache backupCache = null;

    /**
     * used to store the DB read status for each resource path
     */
    private static volatile Map<String,Lock> dbAccessLockMap = new ConcurrentHashMap<String, Lock>();

    /**
     * used thread pool to query resource from database
     */
    private static ExecutorService dbExecutorService;

    private static final Log log = LogFactory.getLog(CacheBackedRegistry.class);


    public CacheBackedRegistry(Registry registry) {
        this.registry = registry;
        RegistryContext registryContext = RegistryContext.getBaseInstance();
        for (Mount mount : registryContext.getMounts()) {
            for(RemoteConfiguration configuration : registryContext.getRemoteInstances()) {
                if (configuration.getDbConfig() != null &&
                        mount.getInstanceId().equals(configuration.getId())) {
                    dbConfigs.put(mount.getPath(),
                            registryContext.getDBConfig(configuration.getDbConfig()));
                    pathMap.put(mount.getPath(), mount.getTargetPath());
                } else if (configuration.getCacheId() != null &&
                        mount.getInstanceId().equals(configuration.getId())) {
                    cacheIds.put(mount.getPath(), configuration.getCacheId());
                    pathMap.put(mount.getPath(), mount.getTargetPath());
                }
            }
        }

        //check the backup cache enabled in registry.xml, this is off by default.
        if(registryContext.isBackUpCacheEnabled() && backupCache == null){
            backupCache = RegistryUtils.getBackupCache(RegistryConstants.REGISTRY_BACKUP_CACHE_ID);
            dbExecutorService = Executors.newFixedThreadPool(registryContext.getThreadPoolSize());
        }
    }

    public CacheBackedRegistry(Registry registry, int tenantId) {
        this(registry);
        this.tenantId = tenantId;
    }

    /**
     * This method used to calculate the cache key
     *
     * @param registry Registry
     * @param path     Resource path
     *
     * @return RegistryCacheKey
     */
    private RegistryCacheKey getRegistryCacheKey(Registry registry, String path) {
        String connectionId = "";

        int tenantId;
        if (this.tenantId == MultitenantConstants.INVALID_TENANT_ID) {
            tenantId = CurrentSession.getTenantId();
            if (tenantId == MultitenantConstants.INVALID_TENANT_ID) {
                tenantId = CarbonContext.getCurrentContext().getTenantId();
            }
        } else {
            tenantId = this.tenantId;
        }
        String resourceCachePath;
        RegistryContext registryContext = registry.getRegistryContext();
        if (registryContext == null) {
            registryContext = RegistryContext.getBaseInstance();
        }
        if (registry instanceof EmbeddedRegistry) {
            resourceCachePath = path;
        } else {
            resourceCachePath = RegistryUtils.getAbsolutePath(registryContext, path);
        }
        DataBaseConfiguration dataBaseConfiguration = null;
        if (dbConfigs.size() > 0) {
            for (String sourcePath : dbConfigs.keySet()) {
                if (resourceCachePath.startsWith(sourcePath)) {
                    resourceCachePath = pathMap.get(sourcePath) + resourceCachePath.substring(sourcePath.length());
                    dataBaseConfiguration = dbConfigs.get(sourcePath);
                    break;
                }
            }
        } else if (cacheIds.size() > 0) {
            for (String sourcePath : cacheIds.keySet()) {
                if (resourceCachePath.startsWith(sourcePath)) {
                    resourceCachePath = pathMap.get(sourcePath) + resourceCachePath.substring(sourcePath.length());
                    connectionId = cacheIds.get(sourcePath);
                    break;
                }
            }
        }
        if (connectionId.length() == 0) {
            if (dataBaseConfiguration == null) {
                dataBaseConfiguration = registryContext.getDefaultDataBaseConfiguration();
            }
            if (dataBaseConfiguration != null) {
                connectionId = dataBaseConfiguration.getUserName() + "@" +
                        dataBaseConfiguration.getDbUrl();
            }
        }

        return RegistryUtils.buildRegistryCacheKey(connectionId, tenantId, resourceCachePath);
    }

    /**
     * path.intern() used to generate a canonical representation of the path
     * Generated hash value is unique for same registry path and different for paths
     */
    @SuppressWarnings("unchecked")
    public Resource get(String path) throws RegistryException {
        if (registry.getRegistryContext().isNoCachePath(path) || isCommunityFeatureRequest(path)) {
            return registry.get(path);
        }
        GhostResource<Resource> ghostResource;
        Resource resource;

        if (!AuthorizationUtils.authorize(path, ActionConstants.GET)) {
            String msg = "User " + CurrentSession.getUser() + " is not authorized to " +
                    "read the resource " + path + ".";
            log.warn(msg);
            throw new AuthorizationFailedException(msg);
        }

        RegistryCacheKey registryCacheKey = getRegistryCacheKey(registry, path);
        Object ghostResourceObject = cache.get(registryCacheKey);
        if(ghostResourceObject != null){
            ghostResource = (GhostResource<Resource>) ghostResourceObject;
        } else {
            ghostResource = new GhostResource<Resource>(null);
        }

        resource = ghostResource.getResource();
        if (resource == null) {
            /**
             * If the resource is null in resource cache,
             * 1. check whether the backup cache is enabled
             * 2. check whether the backup cache has the resource
             */
            if (backupCache != null && backupCache.get(registryCacheKey) != null) {
                if (dbAccessLockMap.get(path) == null) {
                    synchronized (path.intern()) {
                        if (dbAccessLockMap.get(path) == null) {
                            dbAccessLockMap.put(path, new ReentrantLock());
                        }
                    }
                }
                /**
                 *  check whether the DB read is busy
                 */
                if (dbAccessLockMap.get(path).tryLock()) {
                    try {
                        ghostResource = (GhostResource) cache.get(registryCacheKey);
                        if (ghostResource == null || ghostResource.getResource() == null) {
                            dbExecutorService.submit(new DBResourceQueryThread(path,
                                    CarbonContext.getThreadLocalCarbonContext().getTenantId(),
                                    CarbonContext.getThreadLocalCarbonContext().getTenantDomain(),
                                    CurrentSession.getUser(),
                                    CurrentSession.getUserRealm()));
                        }
                    } finally {
                        dbAccessLockMap.get(path).unlock();
                    }
                }
                ghostResource = (GhostResource) backupCache.get(registryCacheKey);
                resource = ghostResource.getResource();
                log.warn("Data is fetched from the Backup cache. This may be stale data | path: " + path);
            } else {
                synchronized (path.intern()) {
                    ghostResource = (GhostResource) cache.get(registryCacheKey);
                    if (ghostResource == null || ghostResource.getResource() == null) {
                        resource = registry.get(path);
                        if (resource.getProperty(RegistryConstants.REGISTRY_LINK) == null ||
                                resource.getProperty(RegistryConstants.REGISTRY_MOUNT) != null) {
                            ghostResource.setResource(resource);
                            cache.put(registryCacheKey, ghostResource);
                            if (backupCache != null) {
                                backupCache.put(registryCacheKey, ghostResource);
                            }
                        }
                    }
                }
            }
        }
        return resource;
    }

    @SuppressWarnings("unchecked")
    public Collection get(String path, int start, int pageSize) throws RegistryException {
        if (registry.getRegistryContext().isNoCachePath(path) || isCommunityFeatureRequest(path)) {
            return registry.get(path, start, pageSize);
        }

        GhostResource<Collection> ghostResource;
        Collection collection;

        if (!AuthorizationUtils.authorize(path, ActionConstants.GET)) {
            String msg = "User " + CurrentSession.getUser() + " is not authorized to " +
                    "read the resource " + path + ".";
            log.warn(msg);
            throw new AuthorizationFailedException(msg);
        }

        RegistryCacheKey registryCacheKey = getRegistryCacheKey(registry, path +
                ";start=" + start + ";pageSize=" + pageSize);
        Object ghostResourceObject = cache.get(registryCacheKey);
        if (ghostResourceObject != null) {
            ghostResource = (GhostResource<Collection>) ghostResourceObject;
        } else {
            ghostResource = new GhostResource<Collection>(null);
        }

        collection = ghostResource.getResource();
        if (collection == null) {
            /**
             * If the resource is null in resource cache,
             * 1. check whether the backup cache is enabled
             * 2. check whether the backup cache has the resource
             */
            if (backupCache != null && backupCache.get(registryCacheKey) != null) {
                if (dbAccessLockMap.get(path) == null) {
                    synchronized (path.intern()) {
                        if (dbAccessLockMap.get(path) == null) {
                            dbAccessLockMap.put(path, new ReentrantLock());
                        }
                    }
                }
                /**
                 *  check whether the DB read is busy
                 */
                if (dbAccessLockMap.get(path).tryLock()) {
                    ghostResource = (GhostResource) cache.get(registryCacheKey);
                    try {
                        if (ghostResource == null || ghostResource.getResource() == null) {
                            dbExecutorService.submit(new DBCollectionQueryThread(path, start, pageSize,
                                    CarbonContext.getThreadLocalCarbonContext().getTenantId(),
                                    CarbonContext.getThreadLocalCarbonContext().getTenantDomain(),
                                    CurrentSession.getUser(),
                                    CurrentSession.getUserRealm()));
                        }
                    } finally {
                        dbAccessLockMap.get(path).unlock();
                    }
                }
                ghostResource = (GhostResource) backupCache.get(registryCacheKey);
                collection = ghostResource.getResource();
                log.warn("Data is fetched from the Backup cache. This may be stale data | path: " + path);
            } else {
                synchronized (path.intern()) {
                    ghostResource = (GhostResource) cache.get(registryCacheKey);
                    if (ghostResource == null || ghostResource.getResource() == null) {
                        collection = registry.get(path, start, pageSize);
                        if (collection.getProperty(RegistryConstants.REGISTRY_LINK) == null) {
                            ghostResource.setResource(collection);
                            cache.put(registryCacheKey, ghostResource);
                            if (backupCache != null) {
                                backupCache.put(registryCacheKey, ghostResource);
                            }
                        }
                    }
                }
            }
        }
        return collection;
    }

    // test whether this request was made specifically for a tag, comment or a rating.
    private boolean isCommunityFeatureRequest(String path) {
        if (path == null) {
            return false;
        }
        String resourcePath = new ResourcePath(path).getPath();
        if (path.length() > resourcePath.length()) {
            String fragment = path.substring(resourcePath.length());
            for (String temp : new String[] {"tags", "comments", "ratings"}) {
                if (fragment.contains(temp)) {
                    return true;
                }
            }
        }
        return false;
    }

    public boolean resourceExists(String path) throws RegistryException {
        if (registry.getRegistryContext().isNoCachePath(path)) {
            return registry.resourceExists(path);
        }
        RegistryCacheKey registryCacheKey = getRegistryCacheKey(registry, path);
        if (cache.containsKey(registryCacheKey)) {
            return true;
        }else if(backupCache != null && backupCache.containsKey(registryCacheKey)){
            return true;
        } else if (registry.resourceExists(path)) {
            cache.put(registryCacheKey, new GhostResource<Resource>(null));
            return true;
        }
        return false;
    }

    /**
     * database query thread to get registry resource
     */
    private class DBResourceQueryThread extends Thread {

        private String path = null;
        private int tenantID;
        private String tenantDomain;
        private String username;
        private UserRealm userRealm;
        private RegistryCacheKey registryCacheKey = null;

        DBResourceQueryThread(String path, int tenantID, String tenantDomain, String username, UserRealm userRealm) {
            this.path = path;
            this.tenantID = tenantID;
            this.tenantDomain = tenantDomain;
            this.username = username;
            this.userRealm = userRealm;
            registryCacheKey = getRegistryCacheKey(registry, path);
        }

        @Override
        public void run() {
            Lock lock = dbAccessLockMap.get(path);
            lock.lock();
            try {
                GhostResource ghostResource = (GhostResource) cache.get(registryCacheKey);
                if (ghostResource == null || ghostResource.getResource() == null) {
                    try {
                        /**
                         * setting current session information before calling the registry.
                         */
                        CurrentSession.setTenantId(tenantID);
                        CurrentSession.setUser(username);
                        CurrentSession.setUserRealm(userRealm);
                        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(tenantID);
                        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain);

                        Resource resource = registry.get(path);
                        if (resource.getProperty(RegistryConstants.REGISTRY_LINK) == null ||
                                resource.getProperty(RegistryConstants.REGISTRY_MOUNT) != null) {
                            ghostResource = new GhostResource<Resource>(resource);
                            CacheBackedRegistry.cache.put(registryCacheKey, ghostResource);
                            CacheBackedRegistry.backupCache.put(registryCacheKey, ghostResource);
                        }
                    } catch (RegistryException exception) {
                        log.error("Error while retrieving the resource from the registry", exception);
                    }
                }
            } finally {
                lock.unlock();
            }
        }
    }

    /**
     * database query thread to get registry collection
     */
    private class DBCollectionQueryThread extends Thread {

        private String path = null;
        private int start;
        private int pageSize;
        private int tenantID;
        private String tenantDomain;
        private String username;
        private UserRealm userRealm;
        private RegistryCacheKey registryCacheKey = null;

        DBCollectionQueryThread(String path, int start, int pageSize, int tenantID, String tenantDomain, String username, UserRealm userRealm){
            this.path = path;
            this.start = start;
            this.pageSize = pageSize;
            this.tenantID = tenantID;
            this.tenantDomain = tenantDomain;
            this.username = username;
            this.userRealm = userRealm;
            this.registryCacheKey = getRegistryCacheKey(registry, path + ";start=" + start + ";pageSize=" + pageSize);
        }

        @Override
        public void run() {
            Lock lock = dbAccessLockMap.get(path);
            lock.lock();

            try {
                GhostResource ghostResource = (GhostResource) cache.get(registryCacheKey);
                if (ghostResource == null || ghostResource.getResource() == null) {
                    try {
                        /**
                         * setting current session information before calling the registry.
                         */
                        CurrentSession.setTenantId(tenantID);
                        CurrentSession.setUser(username);
                        CurrentSession.setUserRealm(userRealm);
                        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(tenantID);
                        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain);

                        Collection collection = registry.get(path, start, pageSize);
                        if (collection.getProperty(RegistryConstants.REGISTRY_LINK) == null) {
                            ghostResource = new GhostResource<Collection>(collection);
                            CacheBackedRegistry.cache.put(registryCacheKey, ghostResource);
                            CacheBackedRegistry.backupCache.put(registryCacheKey, ghostResource);
                        }
                    } catch (RegistryException exception) {
                        log.error("Error while retrieving the collection from the registry", exception);
                    }
                }
            } finally {
                lock.unlock();
            }
        }
    }

    /**
     * method shutdown the executor service when bundle deactivate
     */
    public static void stopDBExecutorService(){
        if(dbExecutorService != null){
            dbExecutorService.shutdown();
        }
    }

    public Resource getMetaData(String path) throws RegistryException {
        return registry.getMetaData(path);
    }

    public String importResource(String suggestedPath, String sourceURL, Resource resource)
            throws RegistryException {
        return registry.importResource(suggestedPath, sourceURL, resource);
    }

    public String rename(String currentPath, String newName) throws RegistryException {
        return registry.rename(currentPath, newName);
    }

    public String move(String currentPath, String newPath) throws RegistryException {
        return registry.move(currentPath, newPath);
    }

    public String copy(String sourcePath, String targetPath) throws RegistryException {
        return registry.copy(sourcePath, targetPath);
    }

    public void createVersion(String path) throws RegistryException {
        registry.createVersion(path);
    }

    public String[] getVersions(String path) throws RegistryException {
        return registry.getVersions(path);
    }

    public void restoreVersion(String versionPath) throws RegistryException {
        registry.restoreVersion(versionPath);
    }

    public void addAssociation(String sourcePath, String targetPath, String associationType)
            throws RegistryException {
        registry.addAssociation(sourcePath, targetPath, associationType);
    }

    public void removeAssociation(String sourcePath, String targetPath, String associationType)
            throws RegistryException {
        registry.removeAssociation(sourcePath, targetPath, associationType);
    }

    public Association[] getAllAssociations(String resourcePath) throws RegistryException {
        return registry.getAllAssociations(resourcePath);
    }

    public Association[] getAssociations(String resourcePath, String associationType)
            throws RegistryException {
        return registry.getAssociations(resourcePath, associationType);
    }

    public void applyTag(String resourcePath, String tag) throws RegistryException {
        registry.applyTag(resourcePath, tag);
    }

    public TaggedResourcePath[] getResourcePathsWithTag(String tag) throws RegistryException {
        return registry.getResourcePathsWithTag(tag);
    }

    public Tag[] getTags(String resourcePath) throws RegistryException {
        return registry.getTags(resourcePath);
    }

    public void removeTag(String path, String tag) throws RegistryException {
        registry.removeTag(path, tag);
    }

    public String addComment(String resourcePath, Comment comment) throws RegistryException {
        return registry.addComment(resourcePath, comment);
    }

    public void editComment(String commentPath, String text) throws RegistryException {
        registry.editComment(commentPath, text);
    }

    public void removeComment(String commentPath) throws RegistryException {
        registry.removeComment(commentPath);
    }

    public Comment[] getComments(String resourcePath) throws RegistryException {
        return registry.getComments(resourcePath);
    }

    public void rateResource(String resourcePath, int rating) throws RegistryException {
        registry.rateResource(resourcePath, rating);
    }

    public float getAverageRating(String resourcePath) throws RegistryException {
        return registry.getAverageRating(resourcePath);
    }

    public int getRating(String path, String userName) throws RegistryException {
        return registry.getRating(path, userName);
    }

    public Collection executeQuery(String path, Map parameters) throws RegistryException {
        return registry.executeQuery(path, parameters);
    }

    public LogEntry[] getLogs(String resourcePath, int action, String userName, Date from, Date to,
                              boolean recentFirst) throws RegistryException {
        return registry.getLogs(resourcePath, action, userName, from, to, recentFirst);
    }

    public LogEntryCollection getLogCollection(String resourcePath, int action, String userName,
                                               Date from, Date to, boolean recentFirst)
            throws RegistryException {
        return registry.getLogCollection(resourcePath, action, userName, from, to, recentFirst);
    }

    public String[] getAvailableAspects() {
        return registry.getAvailableAspects();
    }

    public void associateAspect(String resourcePath, String aspect) throws RegistryException {
        registry.associateAspect(resourcePath, aspect);
    }

    public void invokeAspect(String resourcePath, String aspectName, String action)
            throws RegistryException {
        registry.invokeAspect(resourcePath, aspectName, action);
    }

    public void invokeAspect(String resourcePath, String aspectName, String action,
                             Map<String, String> parameters)
            throws RegistryException {
        registry.invokeAspect(resourcePath, aspectName, action, parameters);
    }

    public String[] getAspectActions(String resourcePath, String aspectName)
            throws RegistryException {
        return registry.getAspectActions(resourcePath, aspectName);
    }

    public RegistryContext getRegistryContext() {
        return registry.getRegistryContext();
    }

    public Collection searchContent(String keywords) throws RegistryException {
        return registry.searchContent(keywords);
    }

    public void createLink(String path, String target) throws RegistryException {
        registry.createLink(path, target);
    }

    public void createLink(String path, String target, String subTargetPath)
            throws RegistryException {
        registry.createLink(path, target, subTargetPath);
    }

    public void removeLink(String path) throws RegistryException {
        registry.removeLink(path);
    }

    public void restore(String path, Reader reader) throws RegistryException {
        registry.restore(path, reader);
    }

    public void dump(String path, Writer writer) throws RegistryException {
        registry.dump(path, writer);
    }

    public String getEventingServiceURL(String path) throws RegistryException {
        return registry.getEventingServiceURL(path);
    }

    public void setEventingServiceURL(String path, String eventingServiceURL)
            throws RegistryException {
        registry.setEventingServiceURL(path, eventingServiceURL);
    }

    public boolean removeAspect(String aspect) throws RegistryException {
        return registry.removeAspect(aspect);
    }

    public boolean addAspect(String name, Aspect aspect) throws RegistryException {
        return registry.addAspect(name, aspect);
    }

    public void beginTransaction() throws RegistryException {
        registry.beginTransaction();
    }

    public void commitTransaction() throws RegistryException {
        registry.commitTransaction();
    }

    public void rollbackTransaction() throws RegistryException {
        registry.rollbackTransaction();
    }

    public Resource newResource() throws RegistryException {
        return registry.newResource();
    }

    public Collection newCollection() throws RegistryException {
        return registry.newCollection();
    }

    public String importResource(String suggestedPath, String sourceURL,
                                 org.wso2.carbon.registry.api.Resource resource)
            throws org.wso2.carbon.registry.api.RegistryException {
        return registry.importResource(suggestedPath, sourceURL, resource);
    }

    public String put(String suggestedPath, Resource resource) throws RegistryException {
        return registry.put(suggestedPath, resource);
    }

    public void delete(String path) throws RegistryException {
        registry.delete(path);
    }

    public String addComment(String resourcePath, org.wso2.carbon.registry.api.Comment comment)
            throws org.wso2.carbon.registry.api.RegistryException {
        return registry.addComment(resourcePath, comment);
    }

    public String put(String suggestedPath, org.wso2.carbon.registry.api.Resource resource)
            throws org.wso2.carbon.registry.api.RegistryException {
        return registry.put(suggestedPath, resource);
    }
    
    public boolean removeVersionHistory(String path, long snapshotId)
    		throws RegistryException {
    	return registry.removeVersionHistory(path, snapshotId);
    }
}
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to