Package org.wso2.carbon.registry.core

Examples of org.wso2.carbon.registry.core.Resource


    public Boolean isSelfRegistrationEnabled() {
        Boolean response = false;
        try {
            Registry registry = getConfigSystemRegistry();

            Resource regAdminDataResource;
            if (registry
                    .resourceExists(DashboardConstants.REGISTRY_ADMIN_PROPERTIES_PATH)) {
                regAdminDataResource = registry
                        .get(DashboardConstants.REGISTRY_ADMIN_PROPERTIES_PATH);

                String storedValue = regAdminDataResource
                        .getProperty(DashboardConstants.USER_SELF_REG_PROPERTY_ID);

                if ((storedValue != null) && ("true".equals(storedValue))) {
                    return true;
                }
View Full Code Here


        Boolean response = false;

        try {
            Registry registry = getConfigSystemRegistry();

            Resource regAdminDataResource;
            if (registry
                    .resourceExists(DashboardConstants.REGISTRY_ADMIN_PROPERTIES_PATH)) {
                regAdminDataResource = registry
                        .get(DashboardConstants.REGISTRY_ADMIN_PROPERTIES_PATH);

                String storedValue = regAdminDataResource
                        .getProperty(DashboardConstants.USER_EXTERNAL_GADGET_ADD_PROPERTY_ID);

                if ((storedValue != null) && ("true".equals(storedValue))) {
                    return true;
                }
View Full Code Here

            String[] qPaths = (String[]) qResults.getContent();
            ArrayList gadgetUrlsList = new ArrayList();

            for (String qPath : qPaths) {
                if (registry.resourceExists(qPath)) {
                    Resource tempRes = registry.get(qPath);
                    String gadgetUrlTmp = tempRes.getProperty(
                            DashboardConstants.GADGET_URL);
                    if (isGadgetAutharized(userId, gadgetUrlTmp)) {
                        gadgetUrlsList.add(gadgetUrlTmp);
                        try {
                            Integer userCount = Integer.parseInt(tempRes.getProperty(
                                    DashboardConstants.USER_CONTER));
                            userCount = userCount + 1;
                            tempRes.setProperty(DashboardConstants.USER_CONTER, userCount.toString());
                            registry.put(qPath, tempRes);
                        } catch (Exception e) {
                            log.error("could not increment the user count :" + e.getMessage());
                        }
                    }
View Full Code Here

    public void activate() throws GovernanceException {
        checkRegistryResourceAssociation();
        try {
            Registry registry = getAssociatedRegistry();
            String path = getPath();
            Resource r = registry.get(path);
            r.setProperty(ACTIVATE_PROPERTY_FLAG_NAME, ACTIVATE_PROPERTY_FLAG_VALUE_IN_ACTIVE);
            registry.put(path, r);
        } catch (RegistryException e) {
            String msg = "Error in activating the service: id:" + getId() +
                    ", path: " + getPath() + ".";
            log.error(msg, e);
View Full Code Here

    public void deactivate() throws GovernanceException {
        checkRegistryResourceAssociation();
        try {
            Registry registry = getAssociatedRegistry();
            String path = getPath();
            Resource r = registry.get(path);
            r.setProperty(ACTIVATE_PROPERTY_FLAG_NAME, ACTIVATE_PROPERTY_FLAG_VALUE_IN_INACTIVE);
            registry.put(path, r);
        } catch (RegistryException e) {
            String msg = "Error in activating the service: id:" + getId() +
                    ", path: " + getPath() + ".";
            log.error(msg, e);
View Full Code Here

    private Boolean tabNameExsists(String tabName, String userId) {
        Registry registry;
        try {
            registry = getConfigSystemRegistry();

            Resource comQuery = registry.newResource();

            String sql = "SELECT R.REG_NAME, R.REG_PATH_ID FROM REG_RESOURCE R, REG_PROPERTY P, REG_RESOURCE_PROPERTY RP, " +
                    "REG_PATH PA WHERE R.REG_VERSION=RP.REG_VERSION AND P.REG_NAME='tabTitle' " +
                    "AND P.REG_VALUE LIKE ? AND P.REG_ID=RP.REG_PROPERTY_ID AND PA.REG_PATH_ID=R.REG_PATH_ID " +
                    "AND PA.REG_PATH_VALUE LIKE ?";
View Full Code Here

    public void setActive(boolean isActive) throws GovernanceException {
        checkRegistryResourceAssociation();
        try {
            Registry registry = getAssociatedRegistry();
            String path = getPath();
            Resource r = registry.get(path);
            r.setProperty(ACTIVATE_PROPERTY_FLAG_NAME, isActive ?
                    ACTIVATE_PROPERTY_FLAG_VALUE_IN_ACTIVE :
                    ACTIVATE_PROPERTY_FLAG_VALUE_IN_INACTIVE);
            registry.put(path, r);
        } catch (RegistryException e) {
            String msg = "Error in activating the service: id:" + getId() +
View Full Code Here

    public String getPortalStylesUrl(String user) {
        Registry userRegistry = getConfigSystemRegistry();
        String retPath = null;
        try {
            if (userRegistry.resourceExists(DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT + user + DashboardConstants.GS_DEFAULT_THEME_PATH)) {
                Resource res = userRegistry.get(DashboardConstants.USER_DASHBOARD_REGISTRY_ROOT + user + DashboardConstants.GS_DEFAULT_THEME_PATH);
                retPath = res.getProperty("theme.location");
                return retPath;
            }
            return retPath;
        } catch (Exception e) {
            log.error("Exception when retriving Portal style URL", e);
View Full Code Here

    public boolean isActive() throws GovernanceException {
        checkRegistryResourceAssociation();
        try {
            Registry registry = getAssociatedRegistry();
            String path = getPath();
            Resource r = registry.get(path);
            // if the inactive flag is not set explicitly it is active.
            return !ACTIVATE_PROPERTY_FLAG_VALUE_IN_INACTIVE
                    .equals(r.getProperty(ACTIVATE_PROPERTY_FLAG_NAME));
        } catch (RegistryException e) {
            String msg = "Error in checking the activeness of the service: id:" + getId() +
                    ", path: " + getPath() + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
View Full Code Here

     */
    public void addEndpoint(Endpoint endpoint) throws GovernanceException {
        boolean succeeded = false;
        try {
            registry.beginTransaction();
            Resource endpointResource = registry.newResource();
            endpointResource.setMediaType(GovernanceConstants.ENDPOINT_MEDIA_TYPE);
            setContent(endpoint, endpointResource);
            String tmpPath = "/" + GovernanceUtils.getNameFromUrl(endpoint.getUrl());
            registry.put(tmpPath, endpointResource);
            endpoint.updatePath();
            succeeded = true;
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.Resource

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.