当前位置: 首页>>代码示例>>Java>>正文


Java Resource.getProperty方法代码示例

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


在下文中一共展示了Resource.getProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeTrustedService

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
 * Remove trusted service
 *
 * @param groupName      Group name
 * @param serviceName    Service name
 * @param trustedService Trusted service name
 * @throws org.wso2.carbon.registry.api.RegistryException
 */
private void removeTrustedService(String groupName, String serviceName,
                                  String trustedService) throws RegistryException {

    String resourcePath = RegistryResources.SERVICE_GROUPS + groupName +
                RegistryResources.SERVICES + serviceName + "/trustedServices";
    Registry registry = getConfigSystemRegistry();
    if (registry != null) {
        if (registry.resourceExists(resourcePath)) {
            Resource resource = registry.get(resourcePath);
            if (resource.getProperty(trustedService) != null) {
                resource.removeProperty(trustedService);
            }
            registry.put(resourcePath, resource);
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:25,代码来源:ApplicationManagementServiceImpl.java

示例2: getUrl

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public static String getUrl() throws Exception {

        if (url == null) {
            ServiceHolder serviceHodler = ServiceHolder.getInstance();
            RegistryService regService = serviceHodler.getRegistryService();
            Registry systemRegistry = regService.getConfigSystemRegistry();
            Resource resource = systemRegistry.get("/carbon/connection/props");
            String servicePath = resource.getProperty("service-path");
            String contextRoot = resource.getProperty("context-root");

            String host = resource.getProperty("host-name");
            contextRoot = StringUtils.equals("/", contextRoot) ? "" : contextRoot;

            host = (host == null) ? "localhost" : host;
            String port = System.getProperty("carbon.https.port");
            StringBuilder urlValue = new StringBuilder();
            url = (urlValue.append("https://").append(host).append(":").append(port).append("/").append(contextRoot).append(servicePath).append("/")).toString();
        }

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

示例3: removeTrustedService

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
private void removeTrustedService(String groupName, String serviceName, String trustedService)
        throws SecurityConfigException {
    Registry registry;
    String resourcePath;
    Resource resource;
    try {
        resourcePath = RegistryResources.SERVICE_GROUPS + groupName
                + RegistryResources.SERVICES + serviceName + "/trustedServices";
        registry = getConfigSystemRegistry(); //TODO: Multitenancy
        if (registry != null && registry.resourceExists(resourcePath)) {
            resource = registry.get(resourcePath);
            if (resource.getProperty(trustedService) != null) {
                resource.removeProperty(trustedService);
            }
            registry.put(resourcePath, resource);
        }
    } catch (Exception e) {
        log.error("Error occured while removing trusted service for STS", e);
        throw new SecurityConfigException("Error occured while adding trusted service for STS",
                e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:23,代码来源:STSAdminServiceImpl.java

示例4: getOAuthConsumerSecret

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的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

示例5: getVerifiedChallenges

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
 * gets no of verified user challenges
 *
 * @param userDTO bean class that contains user and tenant Information
 * @return no of verified challenges
 * @throws IdentityException if fails
 */
public static int getVerifiedChallenges(UserDTO userDTO) throws IdentityException {

    int noOfChallenges = 0;

    try {
        UserRegistry registry = IdentityMgtServiceComponent.getRegistryService().
                getConfigSystemRegistry(MultitenantConstants.SUPER_TENANT_ID);
        String identityKeyMgtPath = IdentityMgtConstants.IDENTITY_MANAGEMENT_CHALLENGES +
                RegistryConstants.PATH_SEPARATOR + userDTO.getUserId() +
                RegistryConstants.PATH_SEPARATOR + userDTO.getUserId();

        Resource resource;
        if (registry.resourceExists(identityKeyMgtPath)) {
            resource = registry.get(identityKeyMgtPath);
            String property = resource.getProperty(IdentityMgtConstants.VERIFIED_CHALLENGES);
            if (property != null) {
                return Integer.parseInt(property);
            }
        }
    } catch (RegistryException e) {
        log.error("Error while processing userKey", e);
    }

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

示例6: checkEffectiveDeleteLocked

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public static boolean checkEffectiveDeleteLocked(RegistrySession session, String path) throws RegistryException {
    try {
        Resource resource = session.getUserRegistry().get(path);
        String retention = resource.getProperty("org.wso2.carbon.registry.jcr.retention.policy");
        if (retention == null) {
            return false;
        } else if (retention.equalsIgnoreCase(DELETE_LOCKED)) {
            return true;
        } else {
            return false;
        }

    } catch (RegistryException e) {
        throw new RegistryException("Registry level exception occurred while acquiring a retention lock on " + path);
    }

}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:18,代码来源:EffectiveRetentionUtil.java

示例7: isTrue

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public boolean isTrue(Resource resource) {
    String propVal = resource.getProperty(property);
    if (propVal == null) {
        return condition == ConditionEnum.isNull;
    }

    switch (condition) {
        case equals:
            return propVal.equals(value);
        case contains:
            return propVal.indexOf(value) > -1;
        case lessThan:
            return Integer.parseInt(propVal) < Integer.parseInt(value);
        case greaterThan:
            return Integer.parseInt(propVal) > Integer.parseInt(value);
        default:
            return false;
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:20,代码来源:Lifecycle.java

示例8: isCloudServiceActive

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public static boolean isCloudServiceActive(String cloudServiceName,
                                           int tenantId, UserRegistry govRegistry)
        throws Exception {
    // The cloud manager is always active
    if (StratosConstants.CLOUD_MANAGER_SERVICE.equals(cloudServiceName)) {
        return true;
    }

    String cloudServiceInfoPath = StratosConstants.CLOUD_SERVICE_INFO_STORE_PATH +
            RegistryConstants.PATH_SEPARATOR + tenantId +
            RegistryConstants.PATH_SEPARATOR + cloudServiceName;
    Resource cloudServiceInfoResource;
    if (govRegistry.resourceExists(cloudServiceInfoPath)) {
        cloudServiceInfoResource = govRegistry.get(cloudServiceInfoPath);
        String isActiveStr =
                cloudServiceInfoResource.getProperty(
                        StratosConstants.CLOUD_SERVICE_IS_ACTIVE_PROP_KEY);
        return "true".equals(isActiveStr);
    }
    return false;
}
 
开发者ID:apache,项目名称:stratos,代码行数:22,代码来源:CloudServicesUtil.java

示例9: hasVersionLabel

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public boolean hasVersionLabel(Version version, String s) throws VersionException, RepositoryException {

        try {
            Resource res = ((RegistrySession) session).getUserRegistry().get(
                    RegistryJCRSpecificStandardLoderUtil.
                            getSystemConfigVersionLabelPath((RegistrySession) session));
            if (res.getProperty(s) != null && res.getProperty(s).equals(version.getName())) {
                return true;
            } else {
                return false;
            }

        } catch (RegistryException e) {
            throw new RepositoryException("Exception occurred in registry level " + s);
        }
    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:17,代码来源:RegistryVersionHistory.java

示例10: getPropertiesAddedMediaItemObj

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
 * Adds the properties of the mediaitem resource as attributes to a MediaItem object and returns that MediaItem object
 *
 * @param itemResource The registry resource to retrieve the mediaitem properties
 * @return A MediaItem object with its attributes added
 */
private MediaItem getPropertiesAddedMediaItemObj(Resource itemResource) {
    MediaItem item = new MediaItemImpl();
    String value;
    if ((value = itemResource.getProperty(
            SocialImplConstants.ACTIVITY_MEDIA_ITEM_MIME_TYPE)) != null) {
        item.setMimeType(value);
    }
    if ((value = itemResource.getProperty(
            SocialImplConstants.ACTIVITY_MEDIA_ITEM_THUMBNAIL_URL)) != null) {
        item.setThumbnailUrl(value);
    }
    if ((value = itemResource.getProperty(
            SocialImplConstants.ACTIVITY_MEDIA_ITEM_URL)) != null) {
        item.setUrl(value);
    }
    if ((value = itemResource.getProperty(
            SocialImplConstants.ACTIVITY_MEDIA_ITEM_TYPE)) != null) {
        item.setType(MediaItem.Type.valueOf(value));   //TODO:?
    }
    return item;
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:28,代码来源:ActivityManagerImpl.java

示例11: getOAuthConsumerSecret

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
 * @param ppid
 * @return
 * @throws IdentityException
 */
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-attic,项目名称:carbon-identity,代码行数:28,代码来源:OAuthConsumerDAO.java

示例12: addVersionToHistory

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
private void addVersionToHistory(String nodePath, String nodeVersion) {
    try {

        String confPath = RegistryJCRSpecificStandardLoderUtil.
                getSystemConfigVersionPath((RegistrySession) session);
        Resource resource = ((RegistrySession) session).getUserRegistry().get(confPath);

        if (resource.getProperty(nodePath) != null) {
            resource.getPropertyValues(nodePath).add(nodeVersion);
        } else {
            List<String> list = new ArrayList<String>();
            list.add(nodeVersion);
            resource.setProperty(nodePath, list);
        }
        ((RegistrySession) session).getUserRegistry().put(confPath, resource);

    } catch (RegistryException e) {
        e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
    }

}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:22,代码来源:RegistryVersionManager.java

示例13: retrieveSubscriberIds

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public String[] retrieveSubscriberIds(String searchString) throws EntitlementException {

        try {
            if (registry.resourceExists(PDPConstants.ENTITLEMENT_POLICY_PUBLISHER +
                    RegistryConstants.PATH_SEPARATOR)) {
                Resource resource = registry.get(PDPConstants.ENTITLEMENT_POLICY_PUBLISHER +
                        RegistryConstants.PATH_SEPARATOR);
                Collection collection = (Collection) resource;
                List<String> list = new ArrayList<String>();
                if (collection.getChildCount() > 0) {
                    searchString = searchString.replace("*", ".*");
                    Pattern pattern = Pattern.compile(searchString, Pattern.CASE_INSENSITIVE);
                    for (String path : collection.getChildren()) {
                        String id = path.substring(path.lastIndexOf(RegistryConstants.PATH_SEPARATOR) + 1);
                        Matcher matcher = pattern.matcher(id);
                        if (!matcher.matches()) {
                            continue;
                        }
                        Resource childResource = registry.get(path);
                        if (childResource != null && childResource.getProperty(SUBSCRIBER_ID) != null) {
                            list.add(childResource.getProperty(SUBSCRIBER_ID));
                        }
                    }
                }
                return list.toArray(new String[list.size()]);
            }
        } catch (RegistryException e) {
            log.error("Error while retrieving subscriber of ids", e);
            throw new EntitlementException("Error while retrieving subscriber ids", e);

        }

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

示例14: readPolicy

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
 * Reads PolicyDTO for given registry resource
 *
 * @param resource Registry resource
 * @return PolicyDTO
 * @throws EntitlementException throws, if fails
 */
private PolicyDTO readPolicy(Resource resource) throws EntitlementException {

    String policy = null;
    AbstractPolicy absPolicy = null;
    PolicyDTO dto = null;

    try {
        if (resource.getContent() == null) {
            throw new EntitlementException("Error while loading entitlement policy. Policy content is null");
        }
        policy = new String((byte[]) resource.getContent(), Charset.forName("UTF-8"));
        absPolicy = PAPPolicyReader.getInstance(null).getPolicy(policy);
        dto = new PolicyDTO();
        dto.setPolicyId(absPolicy.getId().toASCIIString());
        dto.setPolicy(policy);
        String policyOrder = resource.getProperty("order");
        if (policyOrder != null) {
            dto.setPolicyOrder(Integer.parseInt(policyOrder));
        } else {
            dto.setPolicyOrder(0);
        }
        String policyActive = resource.getProperty("active");
        if (policyActive != null) {
            dto.setActive(Boolean.parseBoolean(policyActive));
        }
        PolicyAttributeBuilder policyAttributeBuilder = new PolicyAttributeBuilder();
        dto.setAttributeDTOs(policyAttributeBuilder.
                getPolicyMetaDataFromRegistryProperties(resource.getProperties()));
        return dto;
    } catch (RegistryException e) {
        log.error("Error while loading entitlement policy", e);
        throw new EntitlementException("Error while loading entitlement policy", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:42,代码来源:RegistryPolicyReader.java

示例15: persistTrustedService

import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
private void persistTrustedService(String groupName, String serviceName, String trustedService,
                                   String certAlias) throws SecurityConfigException {
    Registry registry;
    String resourcePath;
    Resource resource;
    try {
        resourcePath = RegistryResources.SERVICE_GROUPS + groupName
                + RegistryResources.SERVICES + serviceName + "/trustedServices";
        registry = getConfigSystemRegistry(); //TODO: Multitenancy
        if (registry != null) {
            if (registry.resourceExists(resourcePath)) {
                resource = registry.get(resourcePath);
            } else {
                resource = registry.newResource();
            }
            if (resource.getProperty(trustedService) != null) {
                resource.removeProperty(trustedService);
            }
            resource.addProperty(trustedService, certAlias);
            registry.put(resourcePath, resource);
        }
    } catch (Exception e) {
        log.error("Error occured while adding trusted service for STS", e);
        throw new SecurityConfigException("Error occured while adding trusted service for STS",
                e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:28,代码来源:STSAdminServiceImpl.java


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