Package org.apache.ace.client.repository

Examples of org.apache.ace.client.repository.RepositoryObject


     * @param req the servlet request to read the request data from;
     * @param resp the servlet response to write the response data to.
     * @throws IOException
     */
    private void handleWorkspaceAction(Workspace workspace, String entityType, String entityId, String action, HttpServletRequest req, HttpServletResponse resp) throws IOException {
        RepositoryObject repositoryObject = workspace.getRepositoryObject(entityType, entityId);
        if (repositoryObject == null) {
            resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Repository object of type " + entityType + " and identity " + entityId + " not found.");
            return;
        }

View Full Code Here


     * @param action the (name of the) action to apply;
     * @param resp the servlet response to write the response data to.
     * @throws IOException in case of I/O errors.
     */
    private void performWorkspaceAction(Workspace workspace, String entityType, String entityId, String action, HttpServletResponse resp) throws IOException {
        RepositoryObject repositoryObject = workspace.getRepositoryObject(entityType, entityId);
        if (repositoryObject == null) {
            resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Repository object of type " + entityType + " and identity " + entityId + " not found.");
            return;
        }

View Full Code Here

     * @param entityId the identifier of the repository object to read;
     * @param resp the servlet response to write the response data to.
     * @throws IOException in case of I/O problems.
     */
    private void readRepositoryObject(Workspace workspace, String entityType, String entityId, HttpServletResponse resp) throws IOException {
        RepositoryObject repositoryObject = workspace.getRepositoryObject(entityType, entityId);
        if (repositoryObject == null) {
            resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Repository object of type " + entityType + " and identity " + entityId + " not found.");
        }
        else {
            resp.getWriter().println(m_gson.toJson(repositoryObject));
View Full Code Here

    @Override
    public void handleEvent(Event event) {
        // We get a topic which ends in '/*', but the event contains a specialized topic.
        // for now, we chop of the star, and check whether the topic starts with that.
        RepositoryObject entity = (RepositoryObject) event.getProperty(RepositoryObject.EVENT_ENTITY);
        if ((event.getTopic().endsWith("ADDED")) || event.getTopic().endsWith("REMOVED")) {
            if (m_leftClass.isInstance(entity) && m_filterLeft.matchCase(entity.getDictionary())) {
                locateLeftEndpoint(true);
            }
            if (m_rightClass.isInstance(entity) && m_filterRight.matchCase(entity.getDictionary())) {
                locateRightEndpoint(true);
            }
        }
    }
View Full Code Here

            }
            else if (!RepositoryAdmin.PRIVATE_TOPIC_LOGIN.equals(topic) && !RepositoryAdmin.PRIVATE_TOPIC_REFRESH.equals(topic)) {
                // Something else has changed; however, the entire shop may have an influence on
                // any target, so recheck everything that is reachable from the entity...

                RepositoryObject entity = (RepositoryObject) event.getProperty(RepositoryObject.EVENT_ENTITY);
                if (entity != null) {
                    synchronized (m_repository) {
                        for (StatefulTargetObjectImpl stoi : m_repository.values()) {
                            // Check whether the entity is reachable from this target...
                            if (isReachableFrom(stoi, entity)) {
View Full Code Here

            || DISTRIBUTION2TARGET.equals(entityType)) {

            String leftAttribute = attributes.get("left");
            String rightAttribute = attributes.get("right");

            RepositoryObject left = null;
            if (leftAttribute != null) {
                left = getLeft(entityType, leftAttribute);
            }

            RepositoryObject right = null;
            if (rightAttribute != null) {
                right = getRight(entityType, rightAttribute);
            }

            if (left != null) {
                if (left instanceof StatefulTargetObject) {
                    if (((StatefulTargetObject) left).isRegistered()) {
                        attributes.put(Association.LEFT_ENDPOINT, ((StatefulTargetObject) left).getTargetObject()
                            .getAssociationFilter(attributes));
                    }
                }
                else {
                    attributes.put(Association.LEFT_ENDPOINT, left.getAssociationFilter(attributes));
                }
            }
            if (right != null) {
                if (right instanceof StatefulTargetObject) {
                    if (((StatefulTargetObject) right).isRegistered()) {
                        attributes.put(Association.RIGHT_ENDPOINT, ((StatefulTargetObject) right).getTargetObject()
                            .getAssociationFilter(attributes));
                    }
                }
                else {
                    attributes.put(Association.RIGHT_ENDPOINT, right.getAssociationFilter(attributes));
                }
            }
        }
    }
View Full Code Here

    }

    @Override
    public void updateRepositoryObject(String entityType, String entityId, Map<String, String> attributes,
        Map<String, String> tags) {
        RepositoryObject repositoryObject = getRepositoryObject(entityType, entityId);
        // first handle the attributes
        for (Entry<String, String> attribute : attributes.entrySet()) {
            String key = attribute.getKey();
            String value = attribute.getValue();
            // only add/update the attribute if it actually changed
            if (!value.equals(repositoryObject.getAttribute(key))) {
                repositoryObject.addAttribute(key, value);
            }
        }
        Enumeration<String> keys = repositoryObject.getAttributeKeys();
        while (keys.hasMoreElements()) {
            String key = keys.nextElement();
            if (!attributes.containsKey(key)) {
                repositoryObject.removeAttribute(key);
            }
        }
        updateAssociationAttributes(entityType, repositoryObject);
        updateTags(tags, repositoryObject);
    }
View Full Code Here

        if (ARTIFACT2FEATURE.equals(entityType) || FEATURE2DISTRIBUTION.equals(entityType)
            || DISTRIBUTION2TARGET.equals(entityType)) {
            String leftAttribute = repositoryObject.getAttribute("left");
            String rightAttribute = repositoryObject.getAttribute("right");

            RepositoryObject left = null;
            if (leftAttribute != null) {
                left = getLeft(entityType, leftAttribute);
            }

            RepositoryObject right = null;
            if (rightAttribute != null) {
                right = getRight(entityType, rightAttribute);
            }

            if (left != null) {
                if (left instanceof StatefulTargetObject) {
                    if (((StatefulTargetObject) left).isRegistered()) {
                        repositoryObject.addAttribute(
                            Association.LEFT_ENDPOINT,
                            ((StatefulTargetObject) left).getTargetObject().getAssociationFilter(
                                getAttributes(((StatefulTargetObject) left).getTargetObject())));
                    }
                }
                else {
                    repositoryObject.addAttribute(Association.LEFT_ENDPOINT,
                        left.getAssociationFilter(getAttributes(left)));
                }
            }
            if (right != null) {
                if (right instanceof StatefulTargetObject) {
                    if (((StatefulTargetObject) right).isRegistered()) {
                        repositoryObject.addAttribute(
                            Association.RIGHT_ENDPOINT,
                            ((StatefulTargetObject) right).getTargetObject().getAssociationFilter(
                                getAttributes(((StatefulTargetObject) right).getTargetObject())));
                    }
                }
                else {
                    repositoryObject.addAttribute(Association.RIGHT_ENDPOINT,
                        right.getAssociationFilter(getAttributes(right)));
                }
            }
        }
    }
View Full Code Here

    @Override
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public void deleteRepositoryObject(String entityType, String entityId) {
        ObjectRepository objectRepository = getGenericObjectRepository(entityType);
        RepositoryObject repositoryObject = objectRepository.get(entityId);
        // ACE-239: avoid null entities being passed in...
        if (repositoryObject == null) {
            throw new IllegalArgumentException("Could not find repository object!");
        }
View Full Code Here

             * it every time.
             */
           
            boolean wasModified = isModified();
           
            RepositoryObject object = (RepositoryObject) event.getProperty(RepositoryObject.EVENT_ENTITY);
            String topic = event.getTopic();
           
            WorkingState newState = WorkingState.Unchanged;
            if (topic.endsWith("/ADDED")) {
                newState = WorkingState.New;
View Full Code Here

TOP

Related Classes of org.apache.ace.client.repository.RepositoryObject

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.