Package org.wso2.carbon.registry.core

Examples of org.wso2.carbon.registry.core.ResourceIDImpl


                }
            }
        }

        // creating the resourceID
        ResourceIDImpl resourceID = resourceDAO.getResourceID(path, isCollection);
        if (resourceID == null) {
            // need to create a resourceID
            String parentPath = RegistryUtils.getParentPath(path);

            ResourceIDImpl parentResourceID = resourceDAO.getResourceID(parentPath, true);
            if (parentResourceID == null || !resourceDAO.resourceExists(parentResourceID)) {
                addEmptyCollection(parentPath);
                if (parentResourceID == null) {
                    parentResourceID = resourceDAO.getResourceID(parentPath, true);
                }
View Full Code Here


        // archiving the old root resource
        createVersionForResource(resourceImpl, isRenewing, keepProperties);

        long version = resourceImpl.getVersionNumber();
        boolean isCollection = resourceImpl instanceof CollectionImpl;
        ResourceIDImpl rootResourceID = resourceImpl.getResourceIDImpl();
        ArrayList<Long> versionList = new ArrayList<Long>();
        versionList.add(version);
        if (isCollection) {
            // for collection we have to iterate through children
            addDescendants(rootResourceID, versionList, isRenewing, keepProperties);
        }
        // wrap the array list into stream
        InputStream versionsInputStream = new VersionInputStream(versionList);

        int pathId = rootResourceID.getPathID();
        String resourceName = rootResourceID.getName();
        long snapshotID =
                resourceVersionDAO.createSnapshot(pathId, resourceName, versionsInputStream);
        // Associations can be created only once we have created the snapshot, since we need to know
        // the snapshotID.
        if (snapshotID != -1) {
View Full Code Here

        }

        String path = resourcePath.getPath();
        path = RegistryUtils.getPureResourcePath(path);

        ResourceIDImpl resourceID = resourceDAO.getResourceID(path);
        if (resourceID == null) {
            String msg = "Failed to get resource id to create a snapshot to the resource " +
                    path + ". ";
            throw new RegistryException(msg);
View Full Code Here

     *
     * @return Resource referred by the given path. Resource can be a file or a collection.
     * @throws RegistryException if the operation failed.
     */
    public Resource getMetaData(VersionedPath versionedPath) throws RegistryException {
        ResourceIDImpl resourceID = resourceDAO.getResourceID(versionedPath.getPath());

        if (!AuthorizationUtils.authorize(versionedPath.getPath(), ActionConstants.GET)) {
            String msg = "User " + CurrentSession.getUser() + " is not authorized to " +
                    "read the resource " + versionedPath + ".";
            log.warn(msg);
View Full Code Here

     *
     * @return true if a resource exists in the given path. false otherwise.
     * @throws RegistryException if the operation failed.
     */
    public boolean resourceExists(VersionedPath versionedPath) throws RegistryException {
        ResourceIDImpl resourceID = resourceDAO.getResourceID(versionedPath.getPath());

        long snapshotID = versionedPath.getVersion();
        return resourceVersionDAO.resourceExists(resourceID, snapshotID);
    }
View Full Code Here

     *
     * @return Resource referred by the given path. Resource can be a file or a collection.
     * @throws RegistryException if the operation failed.
     */
    public Resource get(VersionedPath versionedPath) throws RegistryException {
        ResourceIDImpl resourceID = resourceDAO.getResourceID(versionedPath.getPath());

        if (!AuthorizationUtils.authorize(versionedPath.getPath(), ActionConstants.GET)) {
            String msg = "User " + CurrentSession.getUser() + " is not authorized to " +
                    "read the resource " + versionedPath + ".";
            log.warn(msg);
View Full Code Here

     * @throws RegistryException if the operation failed.
     */
    public Collection get(VersionedPath versionedPath, int start, int pageLen)
            throws RegistryException {

        ResourceIDImpl resourceID = resourceDAO.getResourceID(versionedPath.getPath());

        long snapshotID = versionedPath.getVersion();

        CollectionImpl collectionImpl =
                resourceVersionDAO.get(resourceID, snapshotID, start, pageLen);
View Full Code Here

        String versionedResourcePath = versionedPath.getPath();
        long snapshotID = versionedPath.getVersion();


        ResourceIDImpl resourceID = resourceDAO.getResourceID(versionedResourcePath);
        if (!AuthorizationUtils.authorize(versionedResourcePath, ActionConstants.PUT)) {
            String msg = "User " + CurrentSession.getUser() + " is not authorized to " +
                    "restore the resource " + versionedResourcePath + ".";
            log.warn(msg);
            throw new AuthorizationFailedException(msg);
View Full Code Here

            String path = resourcePath.getPath();
            String tagName = queries[0];
            String userName = queries[1];

            TaggingDO taggingDO = null;
            ResourceIDImpl resourceIDImpl = resourceDAO.getResourceID(path);
            if (resourceIDImpl != null) {
                ResourceImpl resourceImpl = resourceDAO.getResourceMetaData(resourceIDImpl);
                if (resourceImpl != null) {
                    TaggingDO[] taggingDOs = tagsDAO.getTagging(resourceImpl, tagName, userName);
                    taggingDO = taggingDOs[0];
View Full Code Here

                resourcePath.getParameterValue("tags") == null) {

            String path = resourcePath.getPath();
            String tagStr = "";

            ResourceIDImpl resourceIDImpl = resourceDAO.getResourceID(path);
            if (resourceIDImpl != null) {
                ResourceImpl resourceImpl = resourceDAO.getResourceMetaData(resourceIDImpl);
                if (resourceImpl != null) {
                    String[] tags = tagsDAO.getTags(resourceImpl);
                    StringBuffer sb = new StringBuffer(tagStr);
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.ResourceIDImpl

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.