Package org.wso2.carbon.registry.core

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


                        Resource resourceImpl = ((RegistryResource) resource).getUnderLineResource();
                        boolean isCollection = resourceImpl instanceof Collection;
                        // 'resourceImpl == null' indicates it's a new non-collection resource created by the client
                        // @see:  org.wso2.carbon.registry.webdav.RegistryServlet.doMkCol()
                        if (null == resourceImpl) {
                            resourceImpl = isCollection ? new CollectionImpl() : new ResourceImpl();
                            //setting path and underline resource only for newly created resources
                            ((ResourceImpl) resourceImpl).setPath(resource.getResourcePath());
                            ((RegistryResource) resource).setUnderLineResource(resourceImpl);
                            //if (!isCollection) {
                            resourceCache.updateDavResourceMimeType((RegistryResource) resource);
View Full Code Here


    }

    public boolean hasProperties() throws RepositoryException {

        boolean hasProperties = true;
        CollectionImpl coll = null;
        try {
            coll = (CollectionImpl) registrySession.getUserRegistry().get(nodePath);

        } catch (RegistryException e) {

            String msg = "failed to resolve the path of the given node or violation of repository syntax " + this;
            log.debug(msg);
            throw new RepositoryException(msg, e);

        }

        Properties propyList = coll.getProperties();
        Set<String> propNames = getCollectionProperties(propyList);

        if (propNames.size() == 0) {

            hasProperties = false;
View Full Code Here

    }

    public NodeType getPrimaryNodeType() throws RepositoryException {

        NodeType nt = null;
        CollectionImpl collec = null;
        String priType = null;
        try {
            if (registrySession.getUserRegistry().get(nodePath) instanceof CollectionImpl) {
                collec = (CollectionImpl) registrySession.getUserRegistry().get(nodePath);
                priType = collec.getProperty("jcr:primaryType");
            }

            Iterator it = registrySession.getRepository().getNodeTypeList().iterator();

            while (it.hasNext()) {
View Full Code Here

    public boolean isNodeType(String s) throws RepositoryException {
        boolean isNodeType = false;

        try {

            CollectionImpl collec = (CollectionImpl) registrySession.getUserRegistry().get(nodePath);

            if ((collec.getPropertyValues("jcr:mixinTypes") != null) && (collec.getPropertyValues("jcr:mixinTypes").contains(s))) {

                isNodeType = true;

            } else if ((getPrimaryNodeType() != null) && (getPrimaryNodeType().getName().equals(s))) {
View Full Code Here

    public void setPrimaryType(String s) throws NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException {

        try {

            CollectionImpl collec = (CollectionImpl) registrySession.getUserRegistry().get(nodePath);
            collec.setProperty("jcr:primaryType", s);
            registrySession.getUserRegistry().put(nodePath, collec);

        } catch (RegistryException e) {
            String msg = "failed to resolve the path of the given node or violation of repository syntax " + this;
            log.debug(msg);
View Full Code Here

    public void addMixin(String s) throws NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException {

        try {

            CollectionImpl collec = (CollectionImpl) registrySession.getUserRegistry().get(nodePath);

            if (collec.getPropertyValues("jcr:mixinTypes") == null) {

                List list = new ArrayList();
                list.add(s);
                collec.setProperty("jcr:mixinTypes", list);

            } else {

                collec.getPropertyValues("jcr:mixinTypes").add(s);

            }
            registrySession.getUserRegistry().put(nodePath, collec);

        } catch (RegistryException e) {
View Full Code Here

    }

    public void removeMixin(String s) throws NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException {

        try {
            CollectionImpl collec = (CollectionImpl) registrySession.getUserRegistry().get(nodePath);
            collec.getPropertyValues("jcr:mixinTypes").remove(s);
            registrySession.getUserRegistry().put(nodePath, collec);

        } catch (RegistryException e) {
            String msg = "failed to resolve the path of the given node or violation of repository syntax " + this;
            log.debug(msg);
View Full Code Here

                sess = (RegistrySession) aa;

                if (sess.getWorkspaceName() != null) {
                    if (sess.getWorkspaceName().equals(s)) {

                        CollectionImpl collec = (CollectionImpl) sess.getUserRegistry().get(nodePath);
                        npath = collec.getPath();
                    }
                } else {

                    throw new NoSuchWorkspaceException();
                }
View Full Code Here

            if (!registrySession.getUserRegistry().resourceExists(nodePath)) {
                throw new InvalidItemStateException();
            }

            CollectionImpl col = (CollectionImpl) registrySession.getUserRegistry().get(nodePath);

            if (col != null) {

                if (nodePath.split("/").length == 2) {
                    parent = "/";

                } else {
                    parent = col.getParentPath();
                }
                par = new RegistryNode(parent, registrySession);
            }

        } catch (RegistryException e) {
View Full Code Here

        //  This piece of code was added as fix for the CARBON-9041 BUG, and proper code refactoring
        //  needs to happen in the RegistryResource.java
        //  TODO: This is a CARBON-9041 fix and remove with proper code refactoring.
        if (resource instanceof RegistryResource) {
            ((RegistryResource) resource).setUnderLineResource(new CollectionImpl());
        }
        super.doMkCol(request, response, resource);
    }
View Full Code Here

TOP

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

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.