Package org.wso2.carbon.registry.core.service

Examples of org.wso2.carbon.registry.core.service.RegistryService


        }
    }

    public static void registerRegistryServiceListener(RegistryServiceListener listener) {
        synchronized (dsComponentLock) {
            RegistryService registryService = getRegistryService();
            if (registryService == null) {
                registryServiceListeners.add(listener);
            } else {
                listener.setRegistryService(registryService);
            }
View Full Code Here


     */
    public static X509CredentialImpl getX509CredentialImplForTenant(String domainName, String alias)
            throws IdentitySAML2SSOException {

        int tenantID = 0;
        RegistryService registryService = SAMLSSOUtil.getRegistryService();
        RealmService realmService = SAMLSSOUtil.getRealmService();

        // get the tenantID
        if (domainName != null) {
            try {
                tenantID = realmService.getTenantManager().getTenantId(domainName);
            } catch (org.wso2.carbon.user.api.UserStoreException e) {
                String errorMsg = "Error getting the TenantID for the domain name";
                log.error(errorMsg, e);
                throw new IdentitySAML2SSOException(errorMsg, e);
            }
        }

        KeyStoreManager keyStoreManager;
        try {
            // get an instance of the corresponding Key Store Manager instance
            keyStoreManager = KeyStoreManager.getInstance(registryService.getGovernanceSystemRegistry(tenantID));
        } catch (RegistryException e) {
            String errorMsg = "Error getting a KeyStore Manager instance.";
            log.error(errorMsg, e);
            throw new IdentitySAML2SSOException(errorMsg, e);
        }
View Full Code Here

            }
        }
    }

    private void populateConnectionProperties() throws Exception {
        RegistryService registryService = dataHolder.getRegistryService();
        Registry registry = registryService.getConfigSystemRegistry();
        Resource resource = registry.newResource();
        String contextRoot = serverConfigContext.getContextRoot();
        String servicePath = serverConfigContext.getServicePath();
        resource.setProperty("service-path", servicePath);
        resource.setProperty("bundleContext-root", contextRoot);
View Full Code Here

        String serverURL = CarbonUIUtil.getServerURL(serverConfig);
        String indexPageURL = CarbonUIUtil.getIndexPageURL(serverConfig);
        if (indexPageURL == null) {
            indexPageURL = "/carbon/admin/index.jsp";
        }
        RegistryService registryService = getRegistryService();
        Registry registry = registryService.getLocalRepository();

        UIBundleDeployer uiBundleDeployer = new UIBundleDeployer();
        UIResourceRegistry uiResourceRegistry = new UIResourceRegistry();
        uiResourceRegistry.initialize(bundleContext);
        uiResourceRegistry.setDefaultUIResourceProvider(
View Full Code Here

    }

    public static void update(int tenantId) {
        try {
            initializeRegistry(tenantId);
            RegistryService registryService = dataHolder.getRegistryService();
            AuthorizationManager authzManager = getAuthzManager(tenantId, registryService);
            if (authzManager instanceof JDBCAuthorizationManager) {
                if (log.isDebugEnabled()) {
                    log.debug("Updating  permission cache for tenant: " + tenantId);
                }
                ((JDBCAuthorizationManager) authzManager).populatePermissionTreeFromDB();
            }
            UserRegistry registry = registryService.getGovernanceSystemRegistry(tenantId);
            Long lastModifiedTime = System.currentTimeMillis();
            if (registry.resourceExists(PERM_TREE_TIMESTAMP_LOC)) {
                Resource resource = registry.get(PERM_TREE_TIMESTAMP_LOC);
                lastModifiedTime =
                        new Long(resource.getProperty(PERM_TREE_TIMESTAMP_PROP).trim());
View Full Code Here

        return authznManager;
    }

    public static void remove(int tenantId) {
        try {
            RegistryService registryService = dataHolder.getRegistryService();
            AuthorizationManager authzManager = getAuthzManager(tenantId, registryService);
            if (authzManager instanceof JDBCAuthorizationManager) {
                if (log.isDebugEnabled()) {
                    log.debug("Updating  permission cache for tenant: " + tenantId);
                }
View Full Code Here

     * @param tenantId The ID of the tenant
     * @return true - if the tenant's cache needs update, false - otherwise
     * @throws RegistryException If an error occurs when retrieving Registry resources
     */
    public static boolean needsUpdating(int tenantId) throws Exception {
        RegistryService registryService = dataHolder.getRegistryService();
        UserRegistry registry = registryService.getGovernanceSystemRegistry(tenantId);

        if (!registry.resourceExists(PERM_TREE_TIMESTAMP_LOC)) {
            return false;
        }

View Full Code Here

    public AxisConfiguration populateAxisConfiguration(InputStream in) throws DeploymentException {
        axisConfig = new AxisConfiguration();

        //set the registry instance in AxisConfiguration
        try {
            RegistryService rs = CarbonCoreDataHolder.getInstance().getRegistryService();
            SuperTenantCarbonContext carbonContext =
                    SuperTenantCarbonContext.getCurrentContext(axisConfig);
            carbonContext.setRegistry(RegistryType.SYSTEM_CONFIGURATION,
                    rs.getConfigSystemRegistry());
            carbonContext.setRegistry(RegistryType.SYSTEM_GOVERNANCE,
                    rs.getGovernanceSystemRegistry());
            carbonContext.setRegistry(RegistryType.LOCAL_REPOSITORY,
                    rs.getLocalRepository());
            carbonContext.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
            CarbonContextHolder.getThreadLocalCarbonContextHolder().setTenantId(MultitenantConstants.SUPER_TENANT_ID);

        } catch (Exception e) {
            String msg = "Error occurred while populating the CarbonContext on the " +
View Full Code Here

                CarbonAuthenticationUtil.onFailedAdminLogin(httpSession, username, -1,
                        remoteAddress, "Data");
                return false;
            }

            RegistryService registryService = CarbonServicesServiceComponent.getRegistryService();
            RealmService realmService = CarbonServicesServiceComponent.getRealmService();

            String tenantDomain = UserCoreUtil.getTenantDomain(realmService, username);
            int tenantId = realmService.getTenantManager().getTenantId(tenantDomain);
            handleAuthenticationStarted(tenantId);
View Full Code Here

        boolean isLoggedIn = false;
        isLoggedIn = login(username, password, remoteAddress);
        if (isLoggedIn) {
            String key = UUIDGenerator.getUUID();
            try {
                RegistryService registryService = TokenAuthBEDataHolder.getInstance().getRegistryService();
                RealmService realmService = TokenAuthBEDataHolder.getInstance().getRealmService();
                String tenantDomain = UserCoreUtil.getTenantDomain(realmService, username);
                int tenantId = realmService.getTenantManager().getTenantId(tenantDomain);
                UserRealm realm = registryService.getUserRealm(tenantId);
                int userId = realm.getUserStoreManager().getUserId(username);

                String baseString = "TenantId:=" + tenantId + "&UserId:=" + userId;
                String signature = getHMAC(key,baseString);
                baseString = baseString + "&Signature:=" + signature;

                Registry registry = registryService.getConfigSystemRegistry(tenantId);
                String path = RegistryConstants.PROFILES_PATH + username;
                Collection profile = null;
                if (!registry.resourceExists(path)) {
                    profile = registry.newCollection();
                    registry.put(path, profile);
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.service.RegistryService

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.