Package org.wso2.carbon.registry.core

Examples of org.wso2.carbon.registry.core.Registry.resourceExists()


        try {
            Registry registry = GadgetServerSocialDataMgtServiceContext.getRegistry();
            String profileImagePath = SocialUtils.USER_ROOT + userId + SocialUtils.PROFILE_IMAGE_PATH;
            String defaultImagePath = SocialUtils.USER_ROOT + SocialUtils.PROFILE_IMAGE_NAME;
            Resource imageResource;
            if (registry.resourceExists(profileImagePath)) {
                imageResource = registry.get(profileImagePath);
                return Base64.encode((byte[]) imageResource.getContent());
            }
            /*else if (registry.resourceExists(defaultImagePath)) {
                imageResource = registry.get(defaultImagePath);
View Full Code Here


        boolean result = false;
        String profileImagePath = SocialUtils.USER_ROOT + userId + SocialUtils.PROFILE_IMAGE_PATH;
        Resource profileImageRes;
        try {
            Registry registry = GadgetServerSocialDataMgtServiceContext.getRegistry();
            if (registry.resourceExists(profileImagePath)) {
                profileImageRes = registry.get(profileImagePath);
            } else {
                profileImageRes = registry.newResource();
            }
            byte[] imgData = Base64.decode(profileImage);
View Full Code Here

    public boolean isProfileImageExists(String userId) {
        boolean result = false;
        String profileImagePath = SocialUtils.USER_ROOT + userId + SocialUtils.PROFILE_IMAGE_PATH;
        try {
            Registry registry = GadgetServerSocialDataMgtServiceContext.getRegistry();
            if (registry.resourceExists(profileImagePath)) {
                result = true;
            }
            else{
                result=false;
            }
View Full Code Here

    public ConsumerEntry[] getConsumerEntries() throws AxisFault {
        Collection oauthKeyCollection;
        Registry reg = getConfigSystemRegistry();
        ConsumerEntry[] entries;
        try {
            if (reg.resourceExists(DashboardConstants.OAUTH_KEY_STORE)) {
                oauthKeyCollection = (Collection) reg.get(DashboardConstants.OAUTH_KEY_STORE);
                entries = new ConsumerEntry[oauthKeyCollection.getChildCount()];
                for (int i = 0; i < oauthKeyCollection.getChildCount(); i++) {
                    Resource res = (Resource) reg.get(oauthKeyCollection.getChildren()[i]);
View Full Code Here

        Collection oauthKeyCollection;
        Registry reg = getConfigSystemRegistry();
        ConsumerEntry[] entries;
        int startEntry = pageNum * NUMBER_OF_ENTRIES_PER_PAGE;
        try {
            if (reg.resourceExists(DashboardConstants.OAUTH_KEY_STORE)) {
                oauthKeyCollection = (Collection) reg.get(DashboardConstants.OAUTH_KEY_STORE, startEntry, NUMBER_OF_ENTRIES_PER_PAGE);
                entries = new ConsumerEntry[oauthKeyCollection.getChildCount()];
                for (int i = 0; i < oauthKeyCollection.getChildCount(); i++) {
                    Resource res = (Resource) reg.get(oauthKeyCollection.getChildren()[i]);

View Full Code Here

        if (entry == null) {
            throw new AxisFault("OAuth Entry is null", new IllegalArgumentException());
        }

        try {
            if (reg.resourceExists(DashboardConstants.OAUTH_KEY_STORE + "/" + entry.getService()) && "new".equals(mode)) {
                throw new AxisFault("Consumer already exists", new IllegalArgumentException());
            } else {
                Resource res = reg.newResource();
                if ("update".equals(mode)) {
                    res = reg.get(DashboardConstants.OAUTH_KEY_STORE + "/" + entry.getService());
View Full Code Here

    public ConsumerEntry getConsumerEntry(String consumerServiceName) throws AxisFault {
        ConsumerEntry entry = new ConsumerEntry();

        Registry reg = getConfigSystemRegistry();
        try {
            if (reg.resourceExists(DashboardConstants.OAUTH_KEY_STORE + "/" + consumerServiceName)) {
                Resource res = reg.get(DashboardConstants.OAUTH_KEY_STORE + "/" + consumerServiceName);
                entry.setConsumerKey(res.getProperty(DashboardConstants.CONSUMER_KEY_KEY));
                entry.setConsumerSecret(res.getProperty(DashboardConstants.CONSUMER_SECRET_KEY));
                entry.setKeyType(res.getProperty(DashboardConstants.KEY_TYPE_KEY));
                entry.setService(res.getProperty(DashboardConstants.CONSUMER_SERVICE));
View Full Code Here

    public boolean deleteConsumerEntry(String consumerServiceName) throws AxisFault {
        ConsumerEntry entry = new ConsumerEntry();

        Registry reg = getConfigSystemRegistry();
        try {
            if (reg.resourceExists(DashboardConstants.OAUTH_KEY_STORE + "/" + consumerServiceName)) {
                reg.delete(DashboardConstants.OAUTH_KEY_STORE + "/" + consumerServiceName);
                return true;
            } else {
                throw new AxisFault("No such consumer to remove", new IllegalArgumentException());
            }
View Full Code Here

    private int getNumberOfEntries() {
        Collection oauthKeyCollection;
        Registry reg = getConfigSystemRegistry();
        ConsumerEntry[] entries;
        try {
            if (reg.resourceExists(DashboardConstants.OAUTH_KEY_STORE)) {
                oauthKeyCollection = (Collection) reg.get(DashboardConstants.OAUTH_KEY_STORE);
                return oauthKeyCollection.getChildCount();
            }
        } catch (Exception e) {
            log.error(e.getMessage(), e);
View Full Code Here

     * Duplicating the admin data populator service to fie on tenant login
     */
    public static Boolean isPortalPermissionsSet(int tenantId) {
        try {
            Registry registry = GadgetServerUserManagementContext.getRegistry(tenantId);
            return registry.resourceExists(
                    DashboardConstants.REGISTRY_ADMIN_PROPERTIES_PATH);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.