• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RegistryException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.wso2.carbon.registry.core.exceptions.RegistryException的典型用法代码示例。如果您正苦于以下问题:Java RegistryException类的具体用法?Java RegistryException怎么用?Java RegistryException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RegistryException类属于org.wso2.carbon.registry.core.exceptions包,在下文中一共展示了RegistryException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createRegistryService

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
private void createRegistryService(Class realClass, WithRegistry withRegistry) {
    try {
        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(withRegistry.tenantDomain());
        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(withRegistry.tenantId());
        RegistryContext registryContext = RegistryContext.getBaseInstance(IdentityTenantUtil.getRealmService());
        DataSource dataSource = MockInitialContextFactory
                .initializeDatasource(REG_DB_JNDI_NAME, realClass, new String[] { REG_DB_SQL_FILE });
        registryContext.setDataAccessManager(new JDBCDataAccessManager(dataSource));
        RegistryService registryService = new EmbeddedRegistryService(registryContext);

        OSGiDataHolder.getInstance().setRegistryService(registryService);
        PrivilegedCarbonContext.getThreadLocalCarbonContext()
                .setRegistry(RegistryType.USER_GOVERNANCE, registryService.getRegistry());
        Class[] singletonClasses = withRegistry.injectToSingletons();
        injectSingletonVariables(registryService, RegistryService.class, singletonClasses);
    } catch (RegistryException e) {
        log.error("Error creating the registry.", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:20,代码来源:CarbonBasedTestListener.java


示例2: getChildResources

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
/**
 * This helps to find resources un a recursive manner
 *
 * @param node           attribute value node
 * @param parentResource parent resource Name
 * @return child resource set
 * @throws RegistryException throws
 */
private EntitlementTreeNodeDTO getChildResources(EntitlementTreeNodeDTO node,
                                                 String parentResource) throws RegistryException {

    if (registry.resourceExists(parentResource)) {
        String[] resourcePath = parentResource.split("/");
        EntitlementTreeNodeDTO childNode =
                new EntitlementTreeNodeDTO(resourcePath[resourcePath.length - 1]);
        node.addChildNode(childNode);
        Resource root = registry.get(parentResource);
        if (root instanceof Collection) {
            Collection collection = (Collection) root;
            String[] resources = collection.getChildren();
            for (String resource : resources) {
                getChildResources(childNode, resource);
            }
        }
    }
    return node;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:28,代码来源:CarbonEntitlementDataFinder.java


示例3: getPolicy

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
/**
 * This returns given policy as Registry resource
 *
 * @param policyId   policy id
 * @param collection
 * @return policy as Registry resource
 * @throws EntitlementException throws, if fails
 */
public Resource getPolicy(String policyId, String collection) throws EntitlementException {
    String path = null;

    if (log.isDebugEnabled()) {
        log.debug("Retrieving entitlement policy");
    }

    try {
        path = collection + policyId;

        if (!registry.resourceExists(path)) {
            if (log.isDebugEnabled()) {
                log.debug("Trying to access an entitlement policy which does not exist");
            }
            return null;
        }
        return registry.get(path);
    } catch (RegistryException e) {
        log.error("Error while retrieving entitlement policy " + policyId + " PAP policy store", e);
        throw new EntitlementException("Error while retrieving entitlement policy " + policyId
                                       + " PAP policy store");
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:32,代码来源:PAPPolicyStore.java


示例4: removePolicy

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
/**
 * @param policyId
 * @throws EntitlementException
 */
public void removePolicy(String policyId) throws EntitlementException {
    String path = null;

    if (log.isDebugEnabled()) {
        log.debug("Removing entitlement policy");
    }

    try {
        path = PDPConstants.ENTITLEMENT_POLICY_PAP + policyId;
        if (!registry.resourceExists(path)) {
            if (log.isDebugEnabled()) {
                log.debug("Trying to access an entitlement policy which does not exist");
            }
            return;
        }
        registry.delete(path);
    } catch (RegistryException e) {
        log.error("Error while removing entitlement policy " + policyId + " from PAP policy store", e);
        throw new EntitlementException("Error while removing policy " + policyId + " from PAP policy store");
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:26,代码来源:PAPPolicyStore.java


示例5: deleteSubscriber

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
public void deleteSubscriber(String subscriberId) throws EntitlementException {

        String subscriberPath;

        if (subscriberId == null) {
            log.error("Subscriber Id can not be null");
            throw new EntitlementException("Subscriber Id can not be null");
        }

        if (EntitlementConstants.PDP_SUBSCRIBER_ID.equals(subscriberId.trim())) {
            log.error("Can not delete PDP publisher");
            throw new EntitlementException("Can not delete PDP publisher");
        }

        try {
            subscriberPath = PDPConstants.ENTITLEMENT_POLICY_PUBLISHER +
                    RegistryConstants.PATH_SEPARATOR + subscriberId;

            if (registry.resourceExists(subscriberPath)) {
                registry.delete(subscriberPath);
            }
        } catch (RegistryException e) {
            log.error("Error while deleting subscriber details", e);
            throw new EntitlementException("Error while deleting subscriber details", e);
        }
    }
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:27,代码来源:PolicyPublisher.java


示例6: retrieveSubscriber

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
public PublisherDataHolder retrieveSubscriber(String id, boolean returnSecrets) throws EntitlementException {

        try {
            if (registry.resourceExists(PDPConstants.ENTITLEMENT_POLICY_PUBLISHER +
                    RegistryConstants.PATH_SEPARATOR + id)) {
                Resource resource = registry.get(PDPConstants.ENTITLEMENT_POLICY_PUBLISHER +
                        RegistryConstants.PATH_SEPARATOR + id);

                return new PublisherDataHolder(resource, returnSecrets);
            }
        } catch (RegistryException e) {
            log.error("Error while retrieving subscriber detail of id : " + id, e);
            throw new EntitlementException("Error while retrieving subscriber detail of id : " + id, e);
        }

        throw new EntitlementException("No Subscriber is defined for given Id");
    }
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:18,代码来源:PolicyPublisher.java


示例7: getPolicyResource

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
/**
 * This returns given policy as Registry resource
 *
 * @param policyId policy id
 * @return policy as Registry resource
 * @throws EntitlementException throws, if fails
 */
private Resource getPolicyResource(String policyId) throws EntitlementException {
    String path = null;

    if (log.isDebugEnabled()) {
        log.debug("Retrieving entitlement policy");
    }

    try {
        path = policyStorePath + policyId;

        if (!registry.resourceExists(path)) {
            if (log.isDebugEnabled()) {
                log.debug("Trying to access an entitlement policy which does not exist");
            }
            return null;
        }
        return registry.get(path);
    } catch (RegistryException e) {
        log.error("Error while retrieving entitlement policy : " + policyId, e);
        throw new EntitlementException("Error while retrieving entitlement policy : " + policyId, e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:30,代码来源:RegistryPolicyReader.java


示例8: isPolicyExist

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
@Override
public boolean isPolicyExist(String policyId) {

    Registry registry;
    String policyPath;
    int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();

    if (policyId == null || policyId.trim().length() == 0) {
        return false;
    }

    try {
        registry = EntitlementServiceComponent.getRegistryService().
                getGovernanceSystemRegistry(tenantId);

        policyPath = policyStorePath + policyId;
        return registry.resourceExists(policyPath);
    } catch (RegistryException e) {
        //ignore
        return false;
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:23,代码来源:RegistryPolicyStoreManageModule.java


示例9: deletePolicy

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
@Override
public boolean deletePolicy(String policyIdentifier) {

    Registry registry;
    String policyPath;
    int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();

    if (policyIdentifier == null || policyIdentifier.trim().length() == 0) {
        return false;
    }

    try {
        registry = EntitlementServiceComponent.getRegistryService().
                getGovernanceSystemRegistry(tenantId);

        policyPath = policyStorePath + policyIdentifier;
        registry.delete(policyPath);
        return true;
    } catch (RegistryException e) {
        log.error(e);
        return false;
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:24,代码来源:RegistryPolicyStoreManageModule.java


示例10: addKeystores

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
private void addKeystores() throws RegistryException {
    Registry registry = SecurityServiceHolder.getRegistryService().getGovernanceSystemRegistry();
    try {
        boolean transactionStarted = Transaction.isStarted();
        if (!transactionStarted) {
            registry.beginTransaction();
        }
        if (!registry.resourceExists(SecurityConstants.KEY_STORES)) {
            Collection kstores = registry.newCollection();
            registry.put(SecurityConstants.KEY_STORES, kstores);

            Resource primResource = registry.newResource();
            if (!registry.resourceExists(RegistryResources.SecurityManagement.PRIMARY_KEYSTORE_PHANTOM_RESOURCE)) {
                registry.put(RegistryResources.SecurityManagement.PRIMARY_KEYSTORE_PHANTOM_RESOURCE,
                        primResource);
            }
        }
        if (!transactionStarted) {
            registry.commitTransaction();
        }
    } catch (Exception e) {
        registry.rollbackTransaction();
        throw e;
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:26,代码来源:SecurityDeploymentInterceptor.java


示例11: getIdentityResource

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
@Override
public Resource getIdentityResource(String path,
                                    String tenantDomain) throws IdentityRuntimeException {
    startTenantFlow(tenantDomain);
    try {
        Registry registry = getRegistryForTenant(tenantDomain);
        Resource resource = null;

        if (registry.resourceExists(path)) {
            resource = registry.get(path);
        }
        return resource;
    } catch (RegistryException e) {
        String errorMsg = String.format(ERROR_GET_RESOURCE, path, tenantDomain);
        throw IdentityRuntimeException.error(errorMsg, e);
    } finally {
        PrivilegedCarbonContext.endTenantFlow();
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:20,代码来源:RegistryResourceMgtServiceImpl.java


示例12: putIdentityResource

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
@Override
public void putIdentityResource(Resource identityResource,
                                String path,
                                String tenantDomain) throws IdentityRuntimeException {
    startTenantFlow(tenantDomain);
    try {
        Registry registry = getRegistryForTenant(tenantDomain);
        registry.put(path, identityResource);
        if (log.isDebugEnabled()) {
            log.debug(String.format(MSG_RESOURCE_PERSIST, path, tenantDomain));
        }
    } catch (RegistryException e) {
        String errorMsg = String.format(ERROR_PERSIST_RESOURCE, tenantDomain, path);
        throw IdentityRuntimeException.error(errorMsg, e);
    } finally {
        PrivilegedCarbonContext.endTenantFlow();
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:19,代码来源:RegistryResourceMgtServiceImpl.java


示例13: getServiceProviders

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
public SAMLSSOServiceProviderDO[] getServiceProviders() throws IdentityException {
    SAMLSSOServiceProviderDO[] serviceProvidersList = new SAMLSSOServiceProviderDO[0];
    try {
        if (registry.resourceExists(IdentityRegistryResources.SAML_SSO_SERVICE_PROVIDERS)) {
            String[] providers = (String[]) registry.get(
                    IdentityRegistryResources.SAML_SSO_SERVICE_PROVIDERS).getContent();
            if (providers != null) {
                serviceProvidersList = new SAMLSSOServiceProviderDO[providers.length];
                for (int i = 0; i < providers.length; i++) {
                    serviceProvidersList[i] = resourceToObject(registry.get(providers[i]));
                }
            }
        }
    } catch (RegistryException e) {
        log.error("Error reading Service Providers from Registry", e);
        throw IdentityException.error("Error reading Service Providers from Registry", e);
    }
    return serviceProvidersList;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:20,代码来源:SAMLSSOServiceProviderDAO.java


示例14: getXmppSettings

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
/**
 * retrieve XMPP Settings of a user by providing the userId
 *
 * @param userId
 * @return
 */
public XMPPSettingsDO getXmppSettings(String userId) {

    XMPPSettingsDO xmppSettings = null;

    try {
        if (registry.resourceExists(IdentityRegistryResources.XMPP_SETTINGS_ROOT + userId)) {
            xmppSettings = resourceToObject(registry
                    .get(IdentityRegistryResources.XMPP_SETTINGS_ROOT + userId));
        }

    } catch (RegistryException e) {
        log.error("Cannot retrieve the XMPP Settings for the user " + userId, e);
    }
    return xmppSettings;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:22,代码来源:XMPPSettingsDAO.java


示例15: isXmppSettingsEnabled

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
/**
 * Checks whether the given user has enabled XMPP based multifactor auth.
 *
 * @param userId
 * @return
 */
public boolean isXmppSettingsEnabled(String userId) {

    boolean isEnabled = false;
    XMPPSettingsDO xmppSettings;
    try {
        if (registry.resourceExists(IdentityRegistryResources.XMPP_SETTINGS_ROOT + userId)) {
            xmppSettings = resourceToObject(registry
                    .get(IdentityRegistryResources.XMPP_SETTINGS_ROOT + userId));
            isEnabled = xmppSettings.isXmppEnabled();
        }
    } catch (RegistryException e) {
        log.error("Error when checking the availability of the user " + userId, e);
    }

    return isEnabled;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:23,代码来源:XMPPSettingsDAO.java


示例16: getOAuthConsumerSecret

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
/**
 * Returns oAuth consumer secret for a give consumer key.
 *
 * @param consumerKey consumer key
 * @return oAuth consumer secret
 * @throws IdentityException if error occurs while obtaining the consumer secret
 */
public String getOAuthConsumerSecret(String consumerKey) throws IdentityException {
    String path = null;
    Resource resource = null;

    if (log.isDebugEnabled()) {
        log.debug("Retreiving user for OAuth consumer key  " + consumerKey);
    }

    try {
        path = RegistryConstants.PROFILES_PATH + consumerKey;
        if (registry.resourceExists(path)) {
            resource = registry.get(path);
            return resource.getProperty(IdentityRegistryResources.OAUTH_CONSUMER_PATH);
        } else {
            return null;
        }
    } catch (RegistryException e) {
        log.error("Error while retreiving user for OAuth consumer key  " + consumerKey, e);
        throw IdentityException.error("Error while retreiving user for OAuth consumer key  "
                + consumerKey, e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:30,代码来源:OAuthConsumerDAO.java


示例17: getUserIdForAssociation

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
public String getUserIdForAssociation(String openId) {

        try {
            if (registry
                    .resourceExists(IdentityRegistryResources.OPENID_SIGN_UP
                            + getOpenIdModified(openId))) {
                return resourceToObject(
                        registry.get(IdentityRegistryResources.OPENID_SIGN_UP
                                + getOpenIdModified(openId))).getUserName();
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("Unable to find an Sign-Up for " + openId);
                }
            }
        } catch (RegistryException e) {
            log.error("Error retrieving a resource from Registry", e);
        }

        return null;
    }
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:21,代码来源:OpenIDUserDAO.java


示例18: getOpenIDAdminDO

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
/**
 * Retrieve OpenID admin for a tenant.
 *
 * @return open id admin of the tenant
 * @throws IdentityException if error occurs while retrieving the OpenID admin
 */
public OpenIDAdminDO getOpenIDAdminDO() throws IdentityException {
    OpenIDAdminDO opdo = null;
    Resource resource = null;

    if (log.isDebugEnabled()) {
        log.debug("Retrieving OpenID admin for tenant");
    }
    try {
        if (registry.resourceExists(IdentityRegistryResources.OPEN_ID_ADMIN_SETTINGS)) {
            resource = registry.get(IdentityRegistryResources.OPEN_ID_ADMIN_SETTINGS);
            return resourceToObject(resource);
        }
    } catch (RegistryException e) {
        log.error("Error while retreiving openid admin", e);
        throw IdentityException.error("Error while retreiving openid admin", e);
    }
    return opdo;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:25,代码来源:OpenIDAdminDAO.java


示例19: getParameter

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
/**
 * @param paramName
 * @return
 * @throws IdentityException
 */
public ParameterDO getParameter(String paramName) throws IdentityException {
    ParameterDO param = null;
    String path = null;
    Resource resource = null;

    if (log.isDebugEnabled()) {
        log.debug("Retrieving parameter " + paramName);
    }

    try {
        path = IdentityRegistryResources.CARD_ISSUER;
        param = new ParameterDO();
        if (registry.resourceExists(path)) {
            resource = registry.get(path);
            if (resource != null) {
                param.setName(paramName);
                param.setValue(resource.getProperty(paramName));
            }
        }
    } catch (RegistryException e) {
        log.error("Error while retrieving parameter " + paramName, e);
        throw IdentityException.error("Error while retrieving parameter " + paramName, e);
    }
    return param;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:31,代码来源:ParameterDAO.java


示例20: removeParameter

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入依赖的package包/类
/**
 * @param parameterDO
 * @throws IdentityException
 */
public void removeParameter(ParameterDO parameterDO) throws IdentityException {
    String path = null;
    Resource resource = null;

    if (log.isDebugEnabled()) {
        log.debug("Removing parameter");
    }

    try {
        path = IdentityRegistryResources.CARD_ISSUER;
        if (registry.resourceExists(path)) {
            resource = registry.get(path);
            if (resource != null) {
                resource.removeProperty(parameterDO.getName());
                registry.put(path, resource);
            }
        }
    } catch (RegistryException e) {
        log.error("Error while removing parameter", e);
        throw IdentityException.error("Error while removing parameter", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:27,代码来源:ParameterDAO.java



注:本文中的org.wso2.carbon.registry.core.exceptions.RegistryException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FeaturesService类代码示例发布时间:2022-05-21
下一篇:
Java WildcardType类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap