Package org.wso2.carbon.registry.core.exceptions

Examples of org.wso2.carbon.registry.core.exceptions.ResourceNotFoundException


    public Resource get(RequestContext requestContext) throws RegistryException {
        String path = requestContext.getResourcePath().getPath();
        String stateKey = RegistryUtils.getResourceName(path);
        if (!states.containsKey(stateKey)) {
            throw new ResourceNotFoundException("The given key, " + stateKey + " does not " +
                    "correspond to a lifecycle state.");
        }
        String servicePath = RegistryUtils.getParentPath(path);
        Registry registry = requestContext.getRegistry();
        for (String majorVersion : getSortedChildrenList(servicePath, registry)) {
            try {
                Integer.parseInt(RegistryUtils.getResourceName(majorVersion));
                for (String minorVersion : getSortedChildrenList(majorVersion, registry)) {
                    try {
                        Integer.parseInt(RegistryUtils.getResourceName(minorVersion));
                        for (String patchVersion : getSortedChildrenList(minorVersion, registry)) {
                            try {
                                Integer.parseInt(RegistryUtils.getResourceName(patchVersion));
                                String serviceResourcePath = patchVersion +
                                        RegistryConstants.PATH_SEPARATOR + resourceKey;
                                Resource resource = registry.get(serviceResourcePath);
                                for (Object propKey : resource.getProperties().keySet()) {
                                    if (((String)propKey).matches(
                                            "^registry[.]lifecycle.*[.]state$")) {
                                        if (states.get(stateKey).equals(
                                                resource.getProperty((String)propKey))) {
                                            resource.setProperty(RegistryConstants.REGISTRY_LINK,
                                                    "true");
                                            resource.setProperty(
                                                    RegistryConstants.REGISTRY_MOUNT_POINT,
                                                    path);
                                            resource.setProperty(
                                                    RegistryConstants.REGISTRY_TARGET_POINT,
                                                    serviceResourcePath);
                                            resource.setProperty(RegistryConstants.REGISTRY_AUTHOR,
                                                    resource.getAuthorUserName());
                                            resource.setProperty(
                                                    RegistryConstants.REGISTRY_ACTUAL_PATH,
                                                    serviceResourcePath);
                                            requestContext.setProcessingComplete(true);
                                            return resource;
                                        }
                                        break;
                                    }

                                }
                            } catch (NumberFormatException ignored) {
                                break;
                            }
                        }
                    } catch (NumberFormatException ignored) {
                        break;
                    }
                }
            } catch (NumberFormatException ignored) {
                break;
            }
        }
        throw new ResourceNotFoundException("No Resources found to be in the given " +
                "lifecycle state: " + stateKey);
    }
View Full Code Here


                    resourcePath + ". " + e.getMessage();
            log.error(msg, e);
            throw e;
        }
        if (entryBean == null) {
            throw new ResourceNotFoundException("The resource does not exist");
        }
        return entryBean;
    }
View Full Code Here

                if (log.isTraceEnabled()) {
                    log.trace("Could not mount remote instance " + this.conURL +
                            ". Resource doesn't exist at " + actualPath + ".");
                }
                setInExecution(false);
                throw new ResourceNotFoundException(fullPath);
            }
        } catch (Exception e) {
            log.debug("Could not mount remote instance " + this.conURL + " " + e.getMessage());
            setInExecution(false);
            if (e instanceof ResourceNotFoundException) {
                throw (ResourceNotFoundException)e;
            }
            throw new ResourceNotFoundException(fullPath, e);
        }

        ((ResourceImpl) tempResource).addPropertyWithNoUpdate(RegistryConstants.REGISTRY_LINK, "true");
        ((ResourceImpl) tempResource).removePropertyWithNoUpdate(RegistryConstants.REGISTRY_NON_RECURSIVE);
        ((ResourceImpl) tempResource).removePropertyWithNoUpdate(RegistryConstants.REGISTRY_LINK_RESTORATION);
View Full Code Here

                        resource = versionRepository.get(versionedPath);
                    }
                }

                if (resource == null) {
                    throw new ResourceNotFoundException(path);
                }

                context.setResource(resource);

                // transaction successfully finished
View Full Code Here

            } else {
                resource = versionRepository.getMetaData(versionedPath);
            }

            if (resource == null) {
                throw new ResourceNotFoundException(path);
            }

            // transaction successfully finished
            transactionSucceeded = true;
View Full Code Here

                    resourcePath + ". " + e.getMessage();
            log.error(msg, e);
            throw e;
        }
        if (entryBean == null) {
            throw new ResourceNotFoundException("The resource does not exist");
        }
        return entryBean;
    }
View Full Code Here

        }

        public void run() {
            try {
                MessageContext msgCtx = ((Axis2MessageContext) synCtx).getAxis2MessageContext();
                Event<MessageContext> event = new Event(msgCtx);
                subscriptions = subscriptionManager.getMatchingSubscriptions(event);
            } catch (EventException e) {
                handleException("Matching subscriptions fetching error", e);
            }
View Full Code Here

     * @throws EventException event
     */
    private void processGetStatusRequest(MessageContext mc,
                                         ResponseMessageBuilder messageBuilder)
            throws AxisFault, EventException {
        Subscription subscription =
                SubscriptionMessageBuilder.createGetStatusMessage(mc);
        if (log.isDebugEnabled()) {
            log.debug("GetStatus request recived for SynapseSubscription ID : " +
                    subscription.getId());
        }
        subscription = subscriptionManager.getSubscription(subscription.getId());
        if (subscription != null) {
            if (log.isDebugEnabled()) {
                log.debug("Sending GetStatus responce for SynapseSubscription ID : " +
                        subscription.getId());
            }
            //send the responce
            SOAPEnvelope soapEnvelope = messageBuilder.genGetStatusResponse(subscription);
            dispatchResponse(soapEnvelope, EventingConstants.WSE_GET_STATUS_RESPONSE,
                    mc, false);
View Full Code Here

            // Adding static subscriptions
            List<Subscription> staticSubscriptionList =
                    eventSource.getSubscriptionManager().getStaticSubscriptions();
            for (Iterator<Subscription> iterator = staticSubscriptionList.iterator();
                 iterator.hasNext();) {
                Subscription staticSubscription = iterator.next();
                OMElement staticSubElem =
                        fac.createOMElement("subscription", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                staticSubElem.addAttribute(
                        fac.createOMAttribute("id", nullNS, staticSubscription.getId()));
                OMElement filterElem =
                        fac.createOMElement("filter", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                filterElem.addAttribute(fac.createOMAttribute("source", nullNS,
                        (String) staticSubscription.getFilterValue()));
                filterElem.addAttribute(fac.createOMAttribute("dialect", nullNS,
                        (String) staticSubscription.getFilterDialect()));
                staticSubElem.addChild(filterElem);
                OMElement endpointElem =
                        fac.createOMElement("endpoint", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                OMElement addressElem =
                        fac.createOMElement("address", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                addressElem.addAttribute(
                        fac.createOMAttribute("uri", nullNS, staticSubscription.getEndpointUrl()));
                endpointElem.addChild(addressElem);
                staticSubElem.addChild(endpointElem);
                if (staticSubscription.getExpires() != null) {
                    OMElement expiresElem =
                            fac.createOMElement("expires", XMLConfigConstants.SYNAPSE_OMNAMESPACE);
                    fac.createOMText(expiresElem,
                            ConverterUtil.convertToString(staticSubscription.getExpires()));
                    staticSubElem.addChild(expiresElem);
                }
                evenSourceElem.addChild(staticSubElem);
            }
View Full Code Here


    public SynapseSubscription() {
        this.setId(UIDGenerator.generateURNString());
        this.setDeliveryMode(EventingConstants.WSE_DEFAULT_DELIVERY_MODE);
        SubscriptionData subscriptionData = new SubscriptionData();
        subscriptionData.setProperty(SynapseEventingConstants.STATIC_ENTRY, "false");
        this.setSubscriptionData(subscriptionData);
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.exceptions.ResourceNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.