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


Java Resource.getProperty方法代码示例

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


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

示例1: getLatestChecksum

import org.wso2.carbon.registry.api.Resource; //导入方法依赖的package包/类
/**
 * Get the checksum of latest deployment for given deployment name
 *
 * @param deploymentName
 * @return
 * @throws BPSFault
 */
public String getLatestChecksum(String deploymentName) throws BPSFault {

    try {
        Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        RegistryService registryService = BPMNServerHolder.getInstance().getRegistryService();
        Registry tenantRegistry = registryService.getConfigSystemRegistry(tenantId);
        String deploymentRegistryPath = BPMNConstants.BPMN_REGISTRY_PATH + BPMNConstants.REGISTRY_PATH_SEPARATOR
                + deploymentName;
        if (tenantRegistry.resourceExists(deploymentRegistryPath)) {
            Resource deploymentEntry = tenantRegistry.get(deploymentRegistryPath);
            return deploymentEntry.getProperty(BPMNConstants.LATEST_CHECKSUM_PROPERTY);
        } else {
            return null;
        }
    } catch (RegistryException e) {
        String msg = "Error while accessing registry to get latest checksum for package : " + deploymentName;
        throw new BPSFault(msg, e);
    }
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:27,代码来源:BPMNDeploymentService.java

示例2: getAllTrustedServices

import org.wso2.carbon.registry.api.Resource; //导入方法依赖的package包/类
/**
 * Get all trusted services
 *
 * @return
 * @throws Exception
 */
public ClaimDTO[] getAllTrustedServices() throws Exception {
    try {
        Registry registry = IdentityPassiveSTSServiceComponent.getConfigSystemRegistry();
        List<ClaimDTO> trustedServices = new ArrayList<ClaimDTO>();

        if (!registry.resourceExists(registryTrustedServicePath)) {
            return new ClaimDTO[0];
        }
        Collection trustedServiceCollection = (Collection) registry.get(registryTrustedServicePath);
        for (String resourcePath : trustedServiceCollection.getChildren()) {
            Resource resource = registry.get(resourcePath);
            ClaimDTO claimDTO = new ClaimDTO();
            claimDTO.setRealm(resource.getProperty(REALM_NAME).replace(SLASH_REPLACE_CHARACTER, "/"));

            String claims = resource.getProperty(CLAIMS);
            if (claims.startsWith("[")) {
                claims = claims.replaceFirst("\\[", "");
            }
            if (claims.endsWith("]")) {
                claims = claims.substring(0, claims.length() - 2);
            }
            claimDTO.setDefaultClaims(claims.split(","));

            claimDTO.setClaimDialect(resource.getProperty(CLAIM_DIALECT));

            trustedServices.add(claimDTO);
        }

        return trustedServices.toArray(new ClaimDTO[trustedServices.size()]);
    } catch (RegistryException e) {
        String error = "Error occurred when getting all trusted services due to error in accessing registry.";
        throw new Exception(error, e);
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:41,代码来源:RegistryBasedTrustedServiceStore.java

示例3: getTrustedServiceClaims

import org.wso2.carbon.registry.api.Resource; //导入方法依赖的package包/类
/**
 * Get default claims for given trusted service
 *
 * @param realmName - trusted service realm name
 * @return - default claims for given trusted service
 * @throws Exception
 */
public ClaimDTO getTrustedServiceClaims(String realmName) throws Exception {
    realmName = replaceSlashWithConstantString(realmName);
    try {
        Registry registry = IdentityPassiveSTSServiceComponent.getConfigSystemRegistry();
        String trustedServicePath = registryTrustedServicePath + realmName;

        if (!registry.resourceExists(trustedServicePath)) {
            log.info("No trusted service found with name:" + realmName);
            return new ClaimDTO();
        }
        Resource resource = registry.get(trustedServicePath);
        ClaimDTO claimDTO = new ClaimDTO();
        claimDTO.setRealm(realmName.replace(SLASH_REPLACE_CHARACTER, "/"));
        String claims = resource.getProperty(CLAIMS);

        if (claims.startsWith("[")) {
            claims = claims.replaceFirst("\\[", "");
        }
        if (claims.endsWith("]")) {
            // replace ] and , too. handle better way. ugly code
            claims = claims.substring(0, claims.length() - 3);
        }

        claimDTO.setDefaultClaims(claims.split(","));

        claimDTO.setClaimDialect(resource.getProperty(CLAIM_DIALECT));
        return claimDTO;
    } catch (RegistryException e) {
        String error = "Error occurred when getting a trusted service due to error in accessing registry.";
        throw new Exception(error, e);
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:40,代码来源:RegistryBasedTrustedServiceStore.java

示例4: outputResources

import org.wso2.carbon.registry.api.Resource; //导入方法依赖的package包/类
public static String outputResources(List<Resource> paths,Registry oRegistry) throws RegistryException {
String retVal = null;

 for (Resource oResource : paths) {
		// we've got all the services here
	 	System.out.println("-------");
	 	System.out.println("resource path:"+oResource.getPath());
	 	System.out.println("description:"+oResource.getDescription());
	 	System.out.println("media type:"+oResource.getMediaType());
	 	System.out.println("created time:"+oResource.getCreatedTime());
	 	System.out.println("last modified time:"+oResource.getLastModified());
	 	Object oObjectR = oResource.getContent();
	 	String stRegValue = null;
	 	if (oObjectR.getClass() == String.class )
			stRegValue = (String)oObjectR;
		else
			stRegValue = new String((byte[])oObjectR);
	 	System.out.println("content:"+stRegValue);

    	Properties props = oResource.getProperties();
	    for (Object prop : props.keySet()) {
	    	//		System.out.println(prop + " - " + props.get(prop));
			String stPropName = (String)prop;
			String stPropertyValue = oResource.getProperty(stPropName);
			System.out.println(stPropName+":"+stPropertyValue);
		}

	    Association[] associations = oRegistry.getAssociations(oResource.getPath(), "Documentation");
	    for (Association association : associations) {
			System.out.println(association.getAssociationType());
		}
	}
 
 return retVal;
}
 
开发者ID:karux,项目名称:CarbonSaaSTest,代码行数:36,代码来源:RegUtils.java

示例5: addUIPermissionFromBundle

import org.wso2.carbon.registry.api.Resource; //导入方法依赖的package包/类
public void addUIPermissionFromBundle(Bundle bundle) throws Exception {
    BundleContext bundleContext = bundle.getBundleContext();
    if (bundleContext == null) { // If the bundle got uninstalled, the bundleContext will be null
        return;
    }

    URL url = bundleContext.getBundle().getEntry("META-INF/component.xml");
    if (url == null) {
        return;
    }

    InputStream xmlStream = url.openStream();
    if (xmlStream == null) {
        return;
    }

    if (log.isDebugEnabled()) {
        log.debug("Adding permissions in bundle" + 
                bundle.getSymbolicName());
    }

    Component component = ComponentConfigFactory.build(xmlStream);
    ManagementPermission[] uiPermissions = null;
    if (component != null) {
        uiPermissions = (ManagementPermission[]) component
                .getComponentConfig(ManagementPermissionsBuilder.LOCALNAME_MGT_PERMISSIONS);
    }

    if (uiPermissions != null) {
        // at the starup we are only adding permission only to tenant 0
        Registry registry = UserMgtDSComponent.getRegistryService().getGovernanceSystemRegistry();
        for (ManagementPermission uiPermission : uiPermissions) {
            if (registry.resourceExists(uiPermission.getResourceId())) {
                Resource existingResource = registry.get(uiPermission.getResourceId());
                if (existingResource.getProperty(UserMgtConstants.DISPLAY_NAME) == null) {
                    existingResource.setProperty(UserMgtConstants.DISPLAY_NAME, uiPermission.getDisplayName());
                    registry.put(uiPermission.getResourceId(), existingResource);
                }
                continue;
            }
            Collection resource = registry.newCollection();
            resource.setProperty(UserMgtConstants.DISPLAY_NAME, uiPermission.getDisplayName());
            registry.put(uiPermission.getResourceId(), resource);
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:47,代码来源:ManagementPermissionsAdder.java

示例6: getUIPermissionNode

import org.wso2.carbon.registry.api.Resource; //导入方法依赖的package包/类
private UIPermissionNode getUIPermissionNode(Resource resource,
                                             boolean isSelected) throws RegistryException {
    String displayName = resource.getProperty(UserMgtConstants.DISPLAY_NAME);
    return new UIPermissionNode(resource.getPath(), displayName, isSelected);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:6,代码来源:UserRealmProxy.java

示例7: getLCState

import org.wso2.carbon.registry.api.Resource; //导入方法依赖的package包/类
private String getLCState(Resource resource) {
    return resource.getProperty("registry.lifecycle." + resource.getProperty("registry.LC.name") + ".state");
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:4,代码来源:StateMachineLifecycle.java


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