Examples of UserRegistry


Examples of org.wso2.carbon.registry.core.session.UserRegistry

            // Storing the root path for future reference
            String rootPath = rootDirectory.getAbsolutePath();

            Registry registry = GadgetRepoPopulatorContext.getRegistry(tenantId);

            UserRegistry uReg = (UserRegistry) registry;

            // Creating the default gadget collection resource
            Collection defaultGadgetCollection = registry.newCollection();
            // Set permission for annonymous read
            AuthorizationManager authorizationManager = uReg.getUserRealm().getAuthorizationManager();
            authorizationManager.authorizeRole(CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME, RegistryConstants.CONFIG_REGISTRY_BASE_PATH +
                    SYSTEM_GS_GADGETS_PATH, ActionConstants.GET);

            /*authorizationManager.authorizeRole(RegistryConstants.GUESTS_ROLE,
                                             SYSTEM_GS_GADGETS_PATH, ActionConstants.GET);*/
 
View Full Code Here

Examples of org.wso2.carbon.registry.core.session.UserRegistry

    }

    public void addResource(String path, String mediaType, String description, DataHandler content,
                            String symlinkLocation)
            throws Exception {
        UserRegistry registry = (UserRegistry) getConfigUserRegistry();
        if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) {
            return;
        }
        addResourceToRegistry(path, mediaType, description, content, symlinkLocation, registry);
    }
View Full Code Here

Examples of org.wso2.carbon.registry.core.session.UserRegistry

    public void deploy(DeploymentFileData deploymentFileData) throws DeploymentException {
        try {
            // todo:Temporarily using tenant 0 till we sort out the multi-tenant deployment.
            int tenantId = 0;

            UserRegistry registry = getRegistry(tenantId);

            // Extracting archive
            String extractedArchiveDir = extractGarArchive(deploymentFileData.getAbsolutePath());

            // Set permission for anonymous read. We do it here because it should happen always in order
            // to support mounting a remote registry.

            if (registry != null) {
                AuthorizationManager accessControlAdmin =
                        registry.getUserRealm().getAuthorizationManager();

                if (!accessControlAdmin.isRoleAuthorized(CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME, RegistryConstants.CONFIG_REGISTRY_BASE_PATH +
                        REGISTRY_GADGET_STORAGE_PATH, ActionConstants.GET)) {
                    accessControlAdmin.authorizeRole(CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME, RegistryConstants.CONFIG_REGISTRY_BASE_PATH +
                            REGISTRY_GADGET_STORAGE_PATH, ActionConstants.GET);
View Full Code Here

Examples of org.wso2.carbon.registry.core.session.UserRegistry

    public static void beginFileTansfer(File rootDirectory, int tenantId) throws RegistryException {

        // Storing the root path for future reference
        String rootPath = rootDirectory.getAbsolutePath();

        UserRegistry registry = getRegistry(tenantId);

        // Creating the default gadget collection resource
        Collection defaultGadgetCollection = registry.newCollection();
        try {
            registry.beginTransaction();
            registry.put(REGISTRY_GADGET_STORAGE_PATH, defaultGadgetCollection);

            transferDirectoryContentToRegistry(rootDirectory, registry, rootPath, tenantId);
            registry.commitTransaction();
        } catch (Exception e) {
            registry.rollbackTransaction();
            log.error(e.getMessage(), e);
        }

    }
View Full Code Here

Examples of org.wso2.carbon.registry.core.session.UserRegistry

                        registry.put(directoryRegistryPath, newCollection);
                    }

                    // Set permission for anonymous read. We do it here because it should happen always in order
                    // to support mounting a remote registry.
                    UserRegistry userRegistry = getRegistry(tenantId);
                    AuthorizationManager accessControlAdmin =
                            userRegistry.getUserRealm().getAuthorizationManager();

                    if (!accessControlAdmin.isRoleAuthorized(CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME, RegistryConstants.CONFIG_REGISTRY_BASE_PATH +
                            REGISTRY_GADGET_STORAGE_PATH, ActionConstants.GET)) {
                        accessControlAdmin.authorizeRole(CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME, RegistryConstants.CONFIG_REGISTRY_BASE_PATH +
                                REGISTRY_GADGET_STORAGE_PATH, ActionConstants.GET);
View Full Code Here

Examples of org.wso2.carbon.registry.core.session.UserRegistry

     * Getting the service either from the Registry service or other means.
     *
     * @return UserRegistry - The registry instance.
     */
    private static UserRegistry getRegistry(int tenantId) {
        UserRegistry registry = null;
        try {
            registry = (UserRegistry) GadgetRepoPopulatorContext.getRegistry(tenantId);
        } catch (Exception e) {
            // During startup, we can't get a registry instance from declarative services.
            // But the deployer gets called. Using instance stored in CarbonContext in that case.
View Full Code Here

Examples of org.wso2.carbon.registry.core.session.UserRegistry

    private Log log = LogFactory.getLog(ThrottlingAxis2ConfigurationContextObserver.class);

    public void createdConfigurationContext(ConfigurationContext configurationContext) {
        int tenantId = TenantUtils.getTenantId(configurationContext);
        try {
            UserRegistry registry =
                    ThrottleServiceComponent.getRegistryService().getConfigSystemRegistry(tenantId);
            ThrottlingUtils.saveTemplatePoliciesToRegistry(registry);
        } catch (Exception e) {
            log.error("Could not persist throttling templat policies for tenant " + tenantId);
        }
View Full Code Here

Examples of org.wso2.carbon.registry.core.session.UserRegistry

    private boolean isKeyStoreExisting(String keyStorePath) throws ServerException {
        String keyStoreName = new File(keyStorePath).getName();
        String keyStoreLocation = SecurityConstants.KEY_STORES + "/" + keyStoreName;
        boolean isKeyStoreExisting = false;
        try {
            UserRegistry govRegistry = IdentityProviderServiceComponent.getRegistryService().
                    getGovernanceSystemRegistry();
            if(govRegistry.resourceExists(keyStoreLocation)){
                isKeyStoreExisting = true;
            }
        } catch (RegistryException e) {
            String errorMsg = "Error when checking the existence of " + keyStorePath + " in the Governance" +
                              "Registry.";
View Full Code Here

Examples of org.wso2.carbon.registry.core.session.UserRegistry

//                tenantId = MultitenantUtils.getTenantId(DashboardContext.getConfigContext());
//            } catch (Exception e) {
//                throw new DeploymentException(e);
//            }

            UserRegistry registry = getRegistry(tenantID);

            // Extracting archive
            String extractedArchiveDir = extractGarArchive(deploymentFileData.getAbsolutePath());

            // Set permission for anonymous read. We do it here because it should happen always in order
            // to support mounting a remote registry.

            if (registry != null) {
                AuthorizationManager accessControlAdmin =
                        registry.getUserRealm().getAuthorizationManager();

                if (!accessControlAdmin.isRoleAuthorized(CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME, RegistryConstants.CONFIG_REGISTRY_BASE_PATH +
                        REGISTRY_GADGET_STORAGE_PATH, ActionConstants.GET)) {
                    accessControlAdmin.authorizeRole(CarbonConstants.REGISTRY_ANONNYMOUS_ROLE_NAME, RegistryConstants.CONFIG_REGISTRY_BASE_PATH +
                            REGISTRY_GADGET_STORAGE_PATH, ActionConstants.GET);
View Full Code Here

Examples of org.wso2.carbon.registry.core.session.UserRegistry

    public static void beginFileTansfer(File rootDirectory, int tenantId) throws RegistryException {

        // Storing the root path for future reference
        String rootPath = rootDirectory.getAbsolutePath();

        UserRegistry registry = getRegistry(tenantId);

        // Creating the default gadget collection resource
        Collection defaultGadgetCollection = registry.newCollection();
        try {
            registry.beginTransaction();
            registry.put(REGISTRY_GADGET_STORAGE_PATH, defaultGadgetCollection);

            transferDirectoryContentToRegistry(rootDirectory, registry, rootPath, tenantId);
            registry.commitTransaction();
        } catch (Exception e) {
            registry.rollbackTransaction();
            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.