本文整理汇总了Java中org.wso2.carbon.registry.core.utils.RegistryUtils.getAbsolutePath方法的典型用法代码示例。如果您正苦于以下问题:Java RegistryUtils.getAbsolutePath方法的具体用法?Java RegistryUtils.getAbsolutePath怎么用?Java RegistryUtils.getAbsolutePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.carbon.registry.core.utils.RegistryUtils
的用法示例。
在下文中一共展示了RegistryUtils.getAbsolutePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveEndpoint
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
private static void saveEndpoint(RequestContext context, Registry registry, String url, String associatedPath,
Map<String, String> properties, Registry systemRegistry, String environment)
throws RegistryException {
String pathExpression = getEndpointLocation(context, url, systemRegistry, environment);
String urlToPath = deriveEndpointFromUrl(url);
String endpointAbsoluteBasePath = RegistryUtils.getAbsolutePath(registry.getRegistryContext(),
org.wso2.carbon.registry.core.RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH +
environment);
if (!systemRegistry.resourceExists(endpointAbsoluteBasePath)) {
systemRegistry.put(endpointAbsoluteBasePath, systemRegistry.newCollection());
}
String relativePath = environment + urlToPath;
String endpointAbsolutePath = pathExpression;
saveEndpointValues(context, registry, url, associatedPath, properties, systemRegistry, relativePath,
endpointAbsolutePath);
}
示例2: getRestServicePath
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
/**
* Generate REST service path
* @param requestContext Request Context
* @param data REST Service content(OMElement)
* @param serviceName REST Service name
* @param serviceProvider Service Provider(current user)
* @return Populated Path
*/
private static String getRestServicePath(RequestContext requestContext, OMElement data, String serviceName,
String serviceProvider) {
String pathExpression = Utils.getRxtService().getStoragePath(CommonConstants.REST_SERVICE_MEDIA_TYPE);
pathExpression = CommonUtil.replaceExpressionOfPath(pathExpression, "name", serviceName);
pathExpression = RegistryUtils.getAbsolutePath(requestContext.getRegistryContext(), CommonUtil
.getPathFromPathExpression(pathExpression, data, requestContext.getResource().getProperties()));
pathExpression = CommonUtil
.getPathFromPathExpression(pathExpression, requestContext.getResource().getProperties(), null);
pathExpression = RegistryUtils.getAbsolutePath(requestContext.getRegistryContext(), CommonUtil
.replaceExpressionOfPath(pathExpression, "provider", serviceProvider));
String servicePath = pathExpression;
/**
* Fix for the REGISTRY-3052 : validation is to check the whether this invoked by ZIPWSDLMediaTypeHandler
* Setting the registry and absolute paths to current session to avoid incorrect resource path entry in REG_LOG table
*/
if (CurrentSession.getLocalPathMap() != null && !Boolean.valueOf(CurrentSession.getLocalPathMap().get(CommonConstants.ARCHIEVE_UPLOAD))) {
servicePath = CommonUtil.getRegistryPath(requestContext.getRegistry().getRegistryContext(), pathExpression);
if (log.isDebugEnabled()) {
log.debug("Saving current session local paths, key: " + servicePath + " | value: " + pathExpression);
}
CurrentSession.getLocalPathMap().put(servicePath, pathExpression);
}
return servicePath;
}
示例3: isAuthorized
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public boolean isAuthorized(String resourceId,
AuthorizationManager authorizationManager) throws
UserStoreException {
int tenantId = authorizationManager.getTenantId();
if (tenantId == CarbonConstants.SUPER_TENANT_ID) {
// no restrictions for the super tenant
return true;
}
// so don't allow the rest of the tenants to set any permission to protected nodes
String protectedPermissionPath = RegistryUtils.getAbsolutePath(null,
RegistryConstants.CONFIG_REGISTRY_BASE_PATH +
CarbonConstants.UI_PROTECTED_PERMISSION_COLLECTION);
return !(resourceId.startsWith(protectedPermissionPath));
}
示例4: getWadlLocation
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
private String getWadlLocation(RequestContext context, OMElement wadlElement, String wadlName,
String version) {
if (Utils.getRxtService() != null) {
String pathExpression = Utils.getRxtService().getStoragePath(wadlMediaType);
pathExpression = CommonUtil.replaceExpressionOfPath(pathExpression, "name", wadlName);
pathExpression = CommonUtil.getPathFromPathExpression(pathExpression,
context.getResource().getProperties(), null);
String namespace = CommonUtil.derivePathFragmentFromNamespace(
wadlElement.getNamespace().getNamespaceURI()).replace("//", "/");
namespace = namespace.replace(".", "/");
pathExpression = CommonUtil.replaceExpressionOfPath(pathExpression, "namespace", namespace);
pathExpression = pathExpression.replace("//", "/");
pathExpression = CommonUtil.replaceExpressionOfPath(pathExpression, "version", version);
String wadlPath = RegistryUtils.getAbsolutePath(context.getRegistryContext(), pathExpression.replace("//", "/"));
/**
* Fix for the REGISTRY-3052 : validation is to check the whether this invoked by ZIPWSDLMediaTypeHandler
* Setting the registry and absolute paths to current session to avoid incorrect resource path entry in REG_LOG table
*/
if (CurrentSession.getLocalPathMap() != null && !Boolean.valueOf(CurrentSession.getLocalPathMap().get(CommonConstants.ARCHIEVE_UPLOAD))) {
wadlPath = CommonUtil.getRegistryPath(context.getRegistry().getRegistryContext(), wadlPath);
CurrentSession.getLocalPathMap().remove(context.getResourcePath().getCompletePath());
if (log.isDebugEnabled()) {
log.debug("Saving current session local paths, key: " + wadlPath + " | value: " + pathExpression);
}
CurrentSession.getLocalPathMap().put(wadlPath, pathExpression);
}
return wadlPath;
} else {
String wadlNamespace = wadlElement.getNamespace().getNamespaceURI();
String namespaceSegment = CommonUtil.derivePathFragmentFromNamespace(
wadlNamespace).replace("//", "/");
String actualPath = getChrootedWadlLocation(context.getRegistryContext()) +
namespaceSegment + version + "/" + wadlName;
return actualPath;
}
}
示例5: DefaultLifeCycle
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public DefaultLifeCycle(OMElement config) throws RegistryException {
initialize();
String currentAspectName = config.getAttributeValue(new QName(LifecycleConstants.NAME));
aspectName = currentAspectName;
currentAspectName = currentAspectName.replaceAll("\\s", "");
stateProperty = LifecycleConstants.REGISTRY_LIFECYCLE + currentAspectName + ".state";
lifecycleProperty = lifecycleProperty + "." + currentAspectName ;
Iterator configChildElements = config.getChildElements();
while (configChildElements.hasNext()) {
OMElement configChildEl = (OMElement) configChildElements.next();
if (configChildEl.getAttribute(new QName(LifecycleConstants.TYPE)) != null) {
String type = configChildEl.getAttributeValue(new QName(LifecycleConstants.TYPE));
if (type.equalsIgnoreCase("resource")) {
isConfigurationFromResource = true;
configurationResourcePath = RegistryUtils.getAbsolutePath(
RegistryContext.getBaseInstance(), configChildEl.getText());
clearAll();
break;
} else if (type.equalsIgnoreCase("literal")) {
isConfigurationFromResource = false;
configurationElement = configChildEl.getFirstElement();
clearAll();
break;
}
}
}
}
示例6: init
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public void init(RegistryContext registryContext, String subStoreContext) {
this.subStoreContext = RegistryUtils.getAbsolutePath(registryContext, subStoreContext);
}
示例7: addSoapService
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
/**
* This method will populate the registry path and store the SOAP service.
* Afterwards create an association between WSDL and SOAP service.
* @param service XML representation of the SOAP service.
* @param context RequestContext
* @throws RegistryException
*/
public static void addSoapService(OMElement service, RequestContext context) throws RegistryException {
Registry registry = context.getRegistry();
Resource resource = registry.newResource();
String path;
if (Utils.getRxtService() == null){
String version = context.getResource().getProperty(RegistryConstants.VERSION_PARAMETER_NAME);
String tempNamespace = CommonUtil.derivePathFragmentFromNamespace(
CommonUtil.getServiceNamespace(service));
path = getChrootedServiceLocation(registry, context.getRegistryContext()) + tempNamespace + version +
RegistryConstants.PATH_SEPARATOR + CommonUtil.getServiceName(service);
} else {
String pathExpression = Utils.getRxtService().getStoragePath(CommonConstants.SOAP_SERVICE_MEDIA_TYPE);
String absolutePath = RegistryUtils.getAbsolutePath(context.getRegistryContext(),getPathFromPathExpression(pathExpression, service, context.getResource().getProperties()));
/**
* Fix for the REGISTRY-3052 : validation is to check the whether this invoked by ZIPWSDLMediaTypeHandler
* Setting the registry and absolute paths to current session to avoid incorrect resource path entry in REG_LOG table
*/
if (CurrentSession.getLocalPathMap() != null && !Boolean.valueOf(CurrentSession.getLocalPathMap().get(CommonConstants.ARCHIEVE_UPLOAD))) {
path = CommonUtil.getRegistryPath(context.getRegistry().getRegistryContext(), absolutePath);
if (log.isDebugEnabled()) {
log.debug("Saving current session local paths, key: " + path + " | value: " + absolutePath);
}
CurrentSession.getLocalPathMap().put(path, absolutePath);
} else {
path = absolutePath;
}
}
String content = service.toString();
resource.setContent(RegistryUtils.encodeString(content));
resource.setMediaType(CommonConstants.SOAP_SERVICE_MEDIA_TYPE);
// when saving the resource we are expecting to call the service media type handler, so
// we intentionally release the lock here.
boolean lockAlreadyAcquired = !CommonUtil.isUpdateLockAvailable();
CommonUtil.releaseUpdateLock();
try {
// We check for an existing resource and add its UUID here.
if (registry.resourceExists(path)) {
Resource existingResource = registry.get(path);
resource.setUUID(existingResource.getUUID());
} else {
resource.setUUID(UUID.randomUUID().toString());
}
resource.setProperty(CommonConstants.SOURCE_PROPERTY, CommonConstants.SOURCE_AUTO);
resource.setProperty("registry.DefinitionImport", "true");
registry.put(path, resource);
String defaultLifeCycle = getDefaultLifecycle(registry, "soapservice");
applyDefaultLifeCycle(registry, resource, path, defaultLifeCycle);
} finally {
if (lockAlreadyAcquired) {
CommonUtil.acquireUpdateLock();
}
}
registry.addAssociation(path, RegistryUtils.getAbsolutePath(registry.getRegistryContext(),
CommonUtil.getDefinitionURL(service)),
CommonConstants.DEPENDS);
registry.addAssociation(RegistryUtils.getAbsolutePath(registry.getRegistryContext(),
CommonUtil.getDefinitionURL(service)), path,
CommonConstants.USED_BY);
}
示例8: getChrootedWSDLLocation
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public static String getChrootedWSDLLocation(RegistryContext registryContext) {
return RegistryUtils.getAbsolutePath(registryContext,
RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH + HandlerConstants.WSDL_LOCATION);
}
示例9: getChrootedSchemaLocation
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
private String getChrootedSchemaLocation(RegistryContext registryContext) {
return RegistryUtils.getAbsolutePath(registryContext,
RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH + schemaLocation);
}
示例10: getChrootedLocation
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
private String getChrootedLocation(RegistryContext registryContext) {
return RegistryUtils.getAbsolutePath(registryContext,
RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH + location);
}
示例11: getChrootedSchemaLocation
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
private String getChrootedSchemaLocation(RegistryContext registryContext) {
return RegistryUtils.getAbsolutePath(registryContext,
RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH + commonSchemaLocation);
}
示例12: getChrootedPolicyLocation
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
private String getChrootedPolicyLocation(RegistryContext registryContext) {
return RegistryUtils.getAbsolutePath(registryContext,
RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH + commonPolicyLocation);
}
示例13: getChrootedSchemaLocation
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
private String getChrootedSchemaLocation(RegistryContext registryContext) {
return RegistryUtils.getAbsolutePath(registryContext,
RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH + HandlerConstants.XSD_LOCATION);
}
示例14: getChrootedLocation
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
private String getChrootedLocation(RegistryContext registryContext) {
return RegistryUtils.getAbsolutePath(registryContext,
RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH + HandlerConstants.XSD_LOCATION);
}
示例15: getSwaggerDocumentPath
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
/**
* Configures the swagger resource path form its content and returns the swagger document path.
*
* @param rootLocation root location of the swagger files.
* @param content swagger content.
* @return Common resource path.
*/
private String getSwaggerDocumentPath(String rootLocation, JsonObject content) throws RegistryException {
String swaggerDocPath = requestContext.getResourcePath().getPath();
String swaggerDocName = swaggerDocPath.substring(swaggerDocPath.lastIndexOf(RegistryConstants.PATH_SEPARATOR) + 1);
JsonElement infoElement = content.get(SwaggerConstants.INFO);
JsonObject infoObject = (infoElement != null) ? infoElement.getAsJsonObject() : null;
if (infoObject == null || infoElement.isJsonNull()) {
throw new RegistryException("Invalid swagger document.");
}
String serviceName = infoObject.get(SwaggerConstants.TITLE).getAsString().replaceAll("\\s", "");
String serviceProvider = CarbonContext.getThreadLocalCarbonContext().getUsername();
swaggerResourcesPath = rootLocation + serviceProvider + RegistryConstants.PATH_SEPARATOR + serviceName +
RegistryConstants.PATH_SEPARATOR + documentVersion;
String pathExpression = getSwaggerRegistryPath(swaggerDocName, serviceProvider);
return RegistryUtils.getAbsolutePath(registry.getRegistryContext(),pathExpression);
}