Package org.jboss.dna.graph.property

Examples of org.jboss.dna.graph.property.DateTime


                Binary binary = valueFactories.getBinaryFactory().create(value);
                return new JcrValue(valueFactories, sessionCache, PropertyType.BINARY, binary);
            }

            public Value createValue( Calendar value ) {
                DateTime dateTime = valueFactories.getDateFactory().create(value);
                return new JcrValue(valueFactories, sessionCache, PropertyType.DATE, dateTime);
            }

            public Value createValue( boolean value ) {
                return new JcrValue(valueFactories, sessionCache, PropertyType.BOOLEAN, value);
View Full Code Here


        return new JcrValue(cache.factories(), cache, propertyType, value);
    }

    final JcrValue valueFrom( Calendar value ) {
        ValueFactories factories = cache.factories();
        DateTime dateTime = factories.getDateFactory().create(value);
        return new JcrValue(factories, cache, PropertyType.DATE, dateTime);
    }
View Full Code Here

            this.requests = Collections.unmodifiableList(requests);
            // Now create the results ...
            for (Request request : requests) {
                if (request instanceof ReadAllPropertiesRequest) {
                    ReadAllPropertiesRequest read = (ReadAllPropertiesRequest)request;
                    DateTime expires = computeExpirationTime(read);
                    getOrCreateNode(read.getActualLocationOfNode(), expires).setProperties(read.getPropertiesByName());
                } else if (request instanceof ReadPropertyRequest) {
                    ReadPropertyRequest read = (ReadPropertyRequest)request;
                    DateTime expires = computeExpirationTime(read);
                    getOrCreateNode(read.getActualLocationOfNode(), expires).addProperty(read.getProperty());
                } else if (request instanceof ReadNodeRequest) {
                    ReadNodeRequest read = (ReadNodeRequest)request;
                    DateTime expires = computeExpirationTime(read);
                    BatchResultsNode node = getOrCreateNode(read.getActualLocationOfNode(), expires);
                    node.setProperties(read.getPropertiesByName());
                    node.setChildren(read.getChildren());
                } else if (request instanceof ReadBlockOfChildrenRequest) {
                    throw new IllegalStateException();
                } else if (request instanceof ReadAllChildrenRequest) {
                    ReadAllChildrenRequest read = (ReadAllChildrenRequest)request;
                    DateTime expires = computeExpirationTime(read);
                    getOrCreateNode(read.getActualLocationOfNode(), expires).setChildren(read.getChildren());
                } else if (request instanceof ReadBranchRequest) {
                    ReadBranchRequest read = (ReadBranchRequest)request;
                    DateTime expires = computeExpirationTime(read);
                    for (Location location : read) {
                        BatchResultsNode node = getOrCreateNode(location, expires);
                        node.setProperties(read.getPropertiesFor(location));
                        node.setChildren(read.getChildren(location));
                    }
View Full Code Here

        /*package*/BatchResults( Request request ) {
            this.requests = Collections.singletonList(request);
            // Now create the results ...
            if (request instanceof ReadAllPropertiesRequest) {
                ReadAllPropertiesRequest read = (ReadAllPropertiesRequest)request;
                DateTime expires = computeExpirationTime(read);
                getOrCreateNode(read.getActualLocationOfNode(), expires).setProperties(read.getPropertiesByName());
            } else if (request instanceof ReadPropertyRequest) {
                ReadPropertyRequest read = (ReadPropertyRequest)request;
                DateTime expires = computeExpirationTime(read);
                getOrCreateNode(read.getActualLocationOfNode(), expires).addProperty(read.getProperty());
            } else if (request instanceof ReadNodeRequest) {
                ReadNodeRequest read = (ReadNodeRequest)request;
                DateTime expires = computeExpirationTime(read);
                BatchResultsNode node = getOrCreateNode(read.getActualLocationOfNode(), expires);
                node.setProperties(read.getPropertiesByName());
                node.setChildren(read.getChildren());
            } else if (request instanceof ReadBlockOfChildrenRequest) {
                throw new IllegalStateException();
            } else if (request instanceof ReadAllChildrenRequest) {
                ReadAllChildrenRequest read = (ReadAllChildrenRequest)request;
                DateTime expires = computeExpirationTime(read);
                getOrCreateNode(read.getActualLocationOfNode(), expires).setChildren(read.getChildren());
            } else if (request instanceof ReadBranchRequest) {
                ReadBranchRequest read = (ReadBranchRequest)request;
                DateTime expires = computeExpirationTime(read);
                for (Location location : read) {
                    BatchResultsNode node = getOrCreateNode(location, expires);
                    node.setProperties(read.getPropertiesFor(location));
                    node.setChildren(read.getChildren(location));
                }
View Full Code Here

     *      org.jboss.dna.graph.request.Request)
     */
    public void execute( ExecutionContext context,
                         final Request request ) throws RepositorySourceException {
        // Compute the current time ...
        DateTime nowInUtc = context.getValueFactories().getDateFactory().createUtc();

        // Figure out whether we should asynchronously do the forking ...
        boolean synchronousStep1 = shouldProcessSynchronously(request);
        final boolean awaitAllSubtasks = false;

View Full Code Here

        PathFactory pathFactory = executionContext.getValueFactories().getPathFactory();
        ValueFactory<Boolean> booleanFactory = executionContext.getValueFactories().getBooleanFactory();
        ValueFactory<String> stringFactory = executionContext.getValueFactories().getStringFactory();

        DateTimeFactory dateFactory = executionContext.getValueFactories().getDateFactory();
        DateTime now = dateFactory.create();
        DateTime newExpirationDate = now.plusMillis(JcrEngine.LOCK_EXTENSION_INTERVAL_IN_MILLIS);

        Path locksPath = pathFactory.createAbsolutePath(JcrLexicon.SYSTEM, DnaLexicon.LOCKS);

        Subgraph locksGraph = null;
        try {
            locksGraph = systemGraph.getSubgraphOfDepth(2).at(locksPath);
        } catch (PathNotFoundException pnfe) {
            // It's possible for this to run before the dna:locks child node gets added to the /jcr:system node.
            return;
        }

        for (Location lockLocation : locksGraph.getRoot().getChildren()) {
            Node lockNode = locksGraph.getNode(lockLocation);

            Boolean isSessionScoped = booleanFactory.create(lockNode.getProperty(DnaLexicon.IS_SESSION_SCOPED).getFirstValue());

            if (!isSessionScoped) continue;
            String lockingSession = stringFactory.create(lockNode.getProperty(DnaLexicon.LOCKING_SESSION).getFirstValue());

            // Extend locks held by active sessions
            if (activeSessionIds.contains(lockingSession)) {
                systemGraph.set(DnaLexicon.EXPIRATION_DATE).on(lockLocation).to(newExpirationDate);
            } else {
                DateTime expirationDate = dateFactory.create(lockNode.getProperty(DnaLexicon.EXPIRATION_DATE).getFirstValue());
                // Destroy expired locks (if it was still held by an active session, it would have been extended by now)
                if (expirationDate.isBefore(now)) {
                    String workspaceName = stringFactory.create(lockNode.getProperty(DnaLexicon.WORKSPACE).getFirstValue());
                    WorkspaceLockManager lockManager = lockManagers.get(workspaceName);
                    lockManager.unlock(executionContext, lockManager.createLock(lockNode));
                }
            }
View Full Code Here

                Binary binary = valueFactories.getBinaryFactory().create(value);
                return new JcrValue(valueFactories, sessionCache, PropertyType.BINARY, binary);
            }

            public Value createValue( Calendar value ) {
                DateTime dateTime = valueFactories.getDateFactory().create(value);
                return new JcrValue(valueFactories, sessionCache, PropertyType.DATE, dateTime);
            }

            public Value createValue( boolean value ) {
                return new JcrValue(valueFactories, sessionCache, PropertyType.BOOLEAN, value);
View Full Code Here

        PathFactory pathFactory = sessionContext.getValueFactories().getPathFactory();
        Property lockOwnerProp = propFactory.create(JcrLexicon.LOCK_OWNER, lockOwner);
        Property lockIsDeepProp = propFactory.create(JcrLexicon.LOCK_IS_DEEP, isDeep);

        DateTimeFactory dateFactory = sessionContext.getValueFactories().getDateFactory();
        DateTime expirationDate = dateFactory.create();
        expirationDate = expirationDate.plusMillis(JcrEngine.LOCK_EXTENSION_INTERVAL_IN_MILLIS);

        batch.create(pathFactory.create(locksPath, pathFactory.createSegment(lockUuid.toString())),
                     propFactory.create(JcrLexicon.PRIMARY_TYPE, DnaLexicon.LOCK),
                     propFactory.create(DnaLexicon.WORKSPACE, workspaceName),
                     propFactory.create(DnaLexicon.LOCKED_UUID, nodeUuid.toString()),
View Full Code Here

                        return this.getDouble() == that.getDouble();
                    case PropertyType.LONG:
                        return this.getLong() == that.getLong();
                    case PropertyType.DATE:
                        DateTimeFactory dateFactory = valueFactories.getDateFactory();
                        DateTime thisDateValue = dateFactory.create(this.value);
                        DateTime thatDateValue = dateFactory.create(that.value);
                        return thisDateValue.equals(thatDateValue);
                    case PropertyType.PATH:
                        PathFactory pathFactory = valueFactories.getPathFactory();
                        Path thisPathValue = pathFactory.create(this.value);
                        Path thatPathValue = pathFactory.create(that.value);
View Full Code Here

        return new JcrValue(cache.factories(), cache, propertyType, value);
    }

    final JcrValue valueFrom( Calendar value ) {
        ValueFactories factories = cache.factories();
        DateTime dateTime = factories.getDateFactory().create(value);
        return new JcrValue(factories, cache, PropertyType.DATE, dateTime);
    }
View Full Code Here

TOP

Related Classes of org.jboss.dna.graph.property.DateTime

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.