本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
示例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");
}