public boolean execute(RequestContext context, String currentState, String targetState) { String mediaType = context.getResource().getMediaType(); if (mediaType != null && mediaType.equals(serviceMediaType)) { context.setResource(null); } return true; } }
local.setProperty("version",version); requestContext.setSourceURL(uri); requestContext.setResource(local); String path = requestContext.getResourcePath().getPath(); if (path.lastIndexOf("/") != -1) {
local.setProperty("version",version); requestContext.setSourceURL(uri); requestContext.setResource(local); String path = requestContext.getResourcePath().getPath(); if (path.lastIndexOf("/") != -1) {
public void putChild(RequestContext requestContext) throws RegistryException { Resource childResource = requestContext.getResource(); if (childResource == null) { childResource = requestContext.getRegistry(). get(requestContext.getResourcePath().getPath()); requestContext.setResource(childResource); } String childMediaType = requestContext.getResource().getMediaType(); if(!(RegistryConstants.SYNAPSE_CONF_COLLECTION_MEDIA_TYPE.equals(childMediaType) || RegistryConstants.SYNAPSE_SEQUENCE_COLLECTION_MEDIA_TYPE.equals(childMediaType) || RegistryConstants.SYNAPSE_ENDPOINT_COLLECTION_MEDIA_TYPE.equals(childMediaType) || RegistryConstants.SYNAPSE_PROXY_SERVICES_COLLECTION_MEDIA_TYPE.equals(childMediaType) || RegistryConstants.SYNAPSE_TASKS_COLLECTION_MEDIA_TYPE.equals(childMediaType) || RegistryConstants.SYNAPSE_ENTRIES_COLLECTION_MEDIA_TYPE.equals(childMediaType))) { String msg = "Resources of type: " + childMediaType + " are not allowed to add as child resources of " + "the typed collection Synapse Repository."; log.error(msg); throw new RegistryException(msg); } }
local.setProperties(requestContext.getResource().getProperties()); requestContext.setSourceURL(uri); requestContext.setResource(local); String path = requestContext.getResourcePath().getPath(); if (path.lastIndexOf("/") != -1) {
public static void cleanRegistryResourceCache(String resourcePath) { try { RegistryCacheInvalidationService registryCacheCleaner = new RegistryCacheInvalidationService(); RequestContext requestContext = new RequestContext(null, null, null); ResourceImpl resource = new ResourceImpl(); resource.setPath(resourcePath); requestContext.setResource(resource); registryCacheCleaner.invalidateRegistryCache(requestContext); } catch (AppManagementException e) { log.error("Unable to invalidate the registry cache. This might cause some stale data in the store/publisher", e); } } }
local.setProperties(props); requestContext.setSourceURL(schemaUrl); requestContext.setResource(local);
@Override public boolean handleDelete(RequestContext requestContext) throws RegistryException { Resource resource = requestContext.getResource(); if (resource == null) { resource = requestContext.getRepository().get(requestContext.getResourcePath().getPath()); requestContext.setResource(resource); } if (resource != null) { String mType = resource.getMediaType(); if (mType != null){ Matcher matcher = pattern.matcher(mType); return matcher.matches(); } } return false; }
local.setProperties(requestContext.getResource().getProperties()); requestContext.setSourceURL(uri); requestContext.setResource(local); String path = requestContext.getResourcePath().getPath(); if (path.lastIndexOf("/") != -1) {
/** * This method is invoked when it is attempted to put child resources to Axis2 repository. * It blocks the operation if the child resources do not belong to allowed types. * * @param requestContext Request details. * @throws RegistryException Throws if the child resource does not belong to allowed types. */ public void putChild(RequestContext requestContext) throws RegistryException { Resource childResource = requestContext.getResource(); if (childResource == null) { childResource = requestContext.getRegistry(). get(requestContext.getResourcePath().getPath()); requestContext.setResource(childResource); } String childMediaType = requestContext.getResource().getMediaType(); if(!(RegistryConstants.AXIS2_CONF_COLLECTION_MEDIA_TYPE.equals(childMediaType) || RegistryConstants.AXIS2_SERVICES_COLLECTION_MEDIA_TYPE.equals(childMediaType) || RegistryConstants.AXIS2_MODULES_COLLECTION_MEDIA_TYPE.equals(childMediaType))) { String msg = "Resources of type: " + childMediaType + " are not allowed to add as child resources of " + "the typed collection Axis2 Repository."; log.error(msg); throw new RegistryException(msg); } } }
requestContext.setResource(tempResource); OMElement serviceElement = RESTServiceUtils.createRestServiceArtifact(wadlElement, wadlName, version, RegistryUtils.getRelativePath(requestContext.getRegistryContext(), actualPath));
@Override public boolean handleGet(RequestContext requestContext) throws RegistryException { // check if the request is for new resource ResourcePath resourcePath = requestContext.getResourcePath(); if (resourcePath.parameterExists("new")) { String mediaType = resourcePath.getParameterValue("mediaType"); if (mediaType != null){ Matcher matcher = pattern.matcher(mediaType); return matcher.matches(); } } Resource resource = requestContext.getResource(); if (resource == null) { VersionedPath versionedPath = RegistryUtils.getVersionedPath(requestContext.getResourcePath()); if (versionedPath.getVersion() == -1) { resource = requestContext.getRepository(). get(requestContext.getResourcePath().getPath()); requestContext.setResource(resource); } } if (resource != null) { String mType = resource.getMediaType(); if (mType != null){ Matcher matcher = pattern.matcher(mType); return matcher.matches(); } } return false; }
addSubscriptionAvailableProperty(newResource); requestContext.setResource(newResource); requestContext.setOldResource(resource); requestContext.setResourcePath(new ResourcePath(newPathMappings.get(resourcePath)));
if (destinationPath.equals(context.getResourcePath() .getPath())) { context.setResource(registry.get(destinationPath)); if (destinationPath.equals(context.getResourcePath() .getPath())) { context.setResource(resource);
this.requestContext.getVersionRepository()); requestContext.setResourcePath(this.requestContext.getResourcePath()); requestContext.setResource(this.requestContext.getResource()); requestContext.setOldResource(this.requestContext.getOldResource()); doProcessing(requestContext, uri);
if (registry.resourceExists(resourcePath.getPath())) { resource = registry.get(resourcePath.getPath()); context.setResource(resource); context.setProcessingComplete(true); // nothing else to do.
if (registry.resourceExists(resourcePath.getPath())) { resource = registry.get(resourcePath.getPath()); context.setResource(resource); context.setProcessingComplete(true); // nothing else to do.
requestContext.setResource(resource); requestContext.setProcessingComplete(true); return;
requestContext.setResource(newResource); requestContext.setProcessingComplete(true);
requestContext.setActualPath(path); ((ResourceImpl) resource).setPath(path); requestContext.setResource(resource); registry.put(path, resource); requestContext.setProcessingComplete(true);