Package org.apache.slide.lock

Examples of org.apache.slide.lock.NodeLock


               
                while (locksList.hasMoreElements()) {
                    writer.print("<tr" + (shade ? " bgcolor=\"eeeeee\""
                                              : " bgcolor=\"dddddd\"") +
                                     ">\r\n");
                    NodeLock currentLock = (NodeLock) locksList.nextElement();
                    writer.print("<td align=\"left\"><tt>");
                    writer.print(currentLock.getSubjectUri());
                    writer.print("</tt></td>\r\n");
                    writer.print("<td align=\"left\"><tt>");
                    writer.print(currentLock.getTypeUri());
                    writer.print("</tt></td>\r\n");
                    writer.print("<td align=\"right\"><tt>");
                    writer.print
                        (formatter.format(currentLock.getExpirationDate()));
                    writer.print("</tt></td>\r\n");
                    writer.print("<td align=\"right\"><tt>");
                    writer.print(currentLock.isInheritable());
                    writer.print("</tt></td>\r\n");
                    writer.print("<td align=\"right\"><tt>");
                    writer.print(currentLock.isExclusive());
                    writer.print("</tt></td>\r\n");
                }
            }
        }
    }
View Full Code Here


            return locksVector;
        } else {
            locksVector = new Vector();
            Enumeration lockList = super.enumerateLocks(uri);
            while (lockList.hasMoreElements()) {
                NodeLock tempLock = (NodeLock) lockList.nextElement();
                tempLock.validate(uri.toString());
                locksVector.addElement(tempLock);
            }
            locksCache.put(uri.toString(), locksVector);
            return locksVector;
        }
View Full Code Here

     */
    private XMLValue computeLockDiscovery(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String slideContextPath) throws ServiceAccessException, LinkedObjectNotFoundException, ObjectNotFoundException, LockTokenNotFoundException {
       
        XMLValue xmlValue = new XMLValue();
        Lock lock = nsaToken.getLockHelper();
        NodeLock objectLockToken = null;
        Enumeration lockTokens = lock.enumerateLocks(sToken, revisionDescriptors.getUri(), true);
        Set addedLockIDs = new HashSet();
        while (lockTokens.hasMoreElements()) {
            objectLockToken = (NodeLock) lockTokens.nextElement();
            if (revisionDescriptors.getUri().equals(objectLockToken.getObjectUri()) ||
                objectLockToken.isInheritable()
               ) {
               
                if (!addedLockIDs.contains(objectLockToken.getLockId())) {
                    Element activelock = createActiveLockElement(objectLockToken,
                            slideContextPath);
                    if (activelock != null) {
                        xmlValue.add(activelock);
                        addedLockIDs.add(objectLockToken.getLockId());
                    }
                }
            }
        }
       
View Full Code Here

               
                while (locksList.hasMoreElements()) {
                    writer.print("<tr" + (shade ? " bgcolor=\"eeeeee\""
                                              : " bgcolor=\"dddddd\"") +
                                     ">\r\n");
                    NodeLock currentLock = (NodeLock) locksList.nextElement();
                    writer.print("<td align=\"left\"><tt>");
                    writer.print(currentLock.getSubjectUri());
                    writer.print("</tt></td>\r\n");
                    writer.print("<td align=\"left\"><tt>");
                    writer.print(currentLock.getTypeUri());
                    writer.print("</tt></td>\r\n");
                    writer.print("<td align=\"right\"><tt>");
                    writer.print
                        (formatter.format(currentLock.getExpirationDate()));
                    writer.print("</tt></td>\r\n");
                    writer.print("<td align=\"right\"><tt>");
                    writer.print(currentLock.isInheritable());
                    writer.print("</tt></td>\r\n");
                    writer.print("<td align=\"right\"><tt>");
                    writer.print(currentLock.isExclusive());
                    writer.print("</tt></td>\r\n");
                }
            }
        }
    }
View Full Code Here

    public Element encodeLocks() {
        Element aElementLocks=new Element("locks");
        if (locks==null) return aElementLocks;
       
        for (int aSize=locks.size(),i=0;i<aSize;i++) {
            NodeLock aLock=(NodeLock)locks.elementAt(i);
            Element aElementLock=new Element("lock");
            aElementLock.setAttribute("subjectUri",aLock.getSubjectUri());
            aElementLock.setAttribute("typeUri",aLock.getTypeUri());
            aElementLock.setAttribute("date",dateFormat.format(aLock.getExpirationDate()));
            aElementLock.setAttribute("inheritance",booleanToString(aLock.isInheritable()));
            aElementLock.setAttribute("exclusive",booleanToString(aLock.isExclusive()));
            aElementLock.setAttribute("lockId",aLock.getLockId());
            aElementLock.setAttribute("owner",aLock.getOwnerInfo());
            aElementLocks.addContent(aElementLock);
        }
        return aElementLocks;
    }
View Full Code Here

                boolean aInheritable=new Boolean(aChild.getAttributeValue("inheritance")).booleanValue();
                boolean aNegative=new Boolean(aChild.getAttributeValue("exclusive")).booleanValue();
                String aLockId=aChild.getAttributeValue("lockId");

                locks.addElement(
                    new NodeLock(aLockId,object.getUri(),aSubject,aType,aDateExpiration,aInheritable,aNegative)
                );
            }
        }
        catch (Exception e) {
            e.printStackTrace();
View Full Code Here

                    expirationDate = new Date(timeValue.longValue());
                } catch (NumberFormatException e) {
                    getLogger().log(e, LOG_CHANNEL, Logger.WARNING);
                    expirationDate = new Date();
                }
                NodeLock lock =
                    new NodeLock(
                        res.getString("LCK"),
                        uri.toString(),
                        res.getString("SUBJECT"),
                        res.getString("TYPE"),
                        expirationDate,
View Full Code Here

                boolean aInheritable = new Boolean(aChild.getAttributeValue("inheritance")).booleanValue();
                boolean aNegative = new Boolean(aChild.getAttributeValue("exclusive")).booleanValue();
                String aLockId = aChild.getAttributeValue("lockId");
                String ownerInfo = aChild.getAttributeValue("owner");

                locks.addElement(new NodeLock(aLockId, uri, aSubject, aType, aDateExpiration, aInheritable, aNegative, ownerInfo));
            }
        } catch (Exception e) {
            e.printStackTrace();
            throw new ServiceAccessException(null, e);
        }
View Full Code Here

                                              (LOCKS_EXPIRATIONDATE));
                    expirationDate = new Date(timeValue.longValue());
                } catch (NumberFormatException e) {
                    expirationDate = new Date();
                }
                NodeLock lock =
                    new NodeLock(res.getString(LOCKS_ID),
                                 res.getString(LOCKS_OBJECT),
                                 res.getString(LOCKS_SUBJECT),
                                 res.getString(LOCKS_TYPE),
                                 expirationDate,
                                 (res.getInt(LOCKS_INHERITABLE) == 1),
View Full Code Here

     */
    private XMLValue computeLockDiscovery(NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, String contextPath, String servletPath) throws ServiceAccessException, LinkedObjectNotFoundException, ObjectNotFoundException, LockTokenNotFoundException {
       
        XMLValue xmlValue = new XMLValue();
        Lock lock = nsaToken.getLockHelper();
        NodeLock objectLockToken = null;
        Enumeration lockTokens = lock.enumerateLocks(readonlySlideToken(), revisionDescriptors.getUri(), true);
        Set addedLockIDs = new HashSet();
        while (lockTokens.hasMoreElements()) {
            objectLockToken = (NodeLock) lockTokens.nextElement();
            if (revisionDescriptors.getUri().equals(objectLockToken.getObjectUri()) ||
                objectLockToken.isInheritable()
               ) {
               
                if (!addedLockIDs.contains(objectLockToken.getLockId())) {
                    Element activelock = createActiveLockElement(objectLockToken,servletPath, contextPath);
                    if (activelock != null) {
                        xmlValue.add(activelock);
                        addedLockIDs.add(objectLockToken.getLockId());
                    }
                }
            }
        }
       
View Full Code Here

TOP

Related Classes of org.apache.slide.lock.NodeLock

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.