Package org.fcrepo.server.storage

Examples of org.fcrepo.server.storage.DOReader


        long startTime = new Date().getTime();
        long stopTime;
        long interval;
        ServiceDeploymentReader deploymentReader = null;

        DOReader reader =
                m_manager.getReader(asOfDateTime == null, context, PID);
        String authzAux_objState = reader.GetObjectState();

        // DYNAMIC!! If service deployment is defined as dynamic, then
        // perform the dissemination via the DynamicAccess module.
        if (m_dynamicAccess.isDynamicService(context, PID, sDefPID)) {
            m_authorizationModule.enforceGetDissemination(context,
                                                          PID,
                                                          sDefPID,
                                                          methodName,
                                                          asOfDateTime,
                                                          authzAux_objState,
                                                          "A",
                                                          "fedora-system:4",
                                                          "A",
                                                          "A");
            MIMETypedStream retVal =
                    m_dynamicAccess.getDissemination(context,
                                                     PID,
                                                     sDefPID,
                                                     methodName,
                                                     userParms,
                                                     asOfDateTime);
            stopTime = new Date().getTime();
            interval = stopTime - startTime;
            logger.debug("Roundtrip DynamicDisseminator: " + interval
                         + " milliseconds.");
            return retVal;
        }

        /*
         * Find the service deployment that is contractor for a model this
         * object has, and deploys the requested service. If object<->model
         * mappings are ever stored in the registry, this may be simplified.
         */
        String serviceDeploymentPID = null;
        for (String cModelURI: reader.getContentModels()){
            String cModelPID = cModelURI.substring("info:fedora/".length());

/*
        for (RelationshipTuple rel : reader.getRelationships(MODEL.HAS_MODEL,
                                                             null)) {
            String cModelPID = rel.getObjectPID();
*/
            String foundDeploymentPID =
                    m_manager.lookupDeploymentForCModel(cModelPID, sDefPID);

            if (foundDeploymentPID != null) {
                if (serviceDeploymentPID != null
                    && !foundDeploymentPID.equals(serviceDeploymentPID)) {
                    throw new DisseminationException("More than one deployment ("
                                                     + foundDeploymentPID
                                                     + ", "
                                                     + serviceDeploymentPID
                                                     + ") found for service "
                                                     + sDefPID
                                                     + " in model "
                                                     + cModelPID);

                }

                serviceDeploymentPID = foundDeploymentPID;
            } else {
                logger.debug("No deployment for (" + cModelPID + ", " + sDefPID
                             + ")");
            }
        }

        if (serviceDeploymentPID != null) {
            deploymentReader =
                    m_manager.getServiceDeploymentReader(false,
                                                         context,
                                                         serviceDeploymentPID);
        }

        ServiceDefinitionReader sDefReader =
                m_manager.getServiceDefinitionReader(asOfDateTime == null,
                                                     context,
                                                     sDefPID);

        String authzAux_sdefState = sDefReader.GetObjectState();

        String authzAux_dissState = "unknown";

        /*
         * if reader is null, it means that no suitable deployments have been
         * found. This can happen if (a), the object does not have any models
         * that have that service, or (b) the object has a suitable model, but
         * no implementation of that service has been deployed. We do a bit of
         * checking here to determine which case this represents, as the error
         * message could be very useful.
         */
        if (deploymentReader == null) {

            boolean suitableModelFound = false;
            String cModelPID = null;
            String message = null;

/*
            models: for (RelationshipTuple rel : reader
                    .getRelationships(MODEL.HAS_MODEL, null)) {
                cModelPID = rel.getObjectPID();
*/
            models: for (String cm:reader.getContentModels()){
                cModelPID = cm.substring(12);

                /* Skip over system models */
                if (Models.contains("info:fedora/" + cModelPID)) {
                    continue;
                }

                /* Open up each model and peek at its sDefs for a match */
                for (RelationshipTuple r : m_manager.getReader(false,
                                                               context,
                                                               cModelPID)
                        .getRelationships(MODEL.HAS_SERVICE, null)) {
                    if (sDefPID.equals(r.getObjectPID())) {
                        suitableModelFound = true;
                        break models;
                    }
                }
            }

            if (suitableModelFound) {
                message =
                        "Unable to find deployment for service " + sDefPID
                        + " on " + reader.GetObjectPID() + " in model "
                        + cModelPID;
            } else {
                message =
                        reader.GetObjectPID()
                        + " does not have a model with service "
                        + sDefPID;
            }
            throw new DisseminatorNotFoundException(message);
        }
View Full Code Here


            String dsPid =
                    dsBindRule.pid == null ? dObj.GetObjectPID()
                                           : dsBindRule.pid;
            String dsId = dsBindRule.bindingKeyName;

            DOReader reader = m_manager.getReader(false, context, dsPid);
            Datastream ds = reader.GetDatastream(dsId, versDateTime);

            if (ds != null) {
                DisseminationBindingInfo bindingInfo =
                        new DisseminationBindingInfo();
                bindingInfo.DSBindKey = dsId;
View Full Code Here

                                          Date asOfDateTime)
            throws ServerException {
        long startTime = new Date().getTime();
        PID = Server.getPID(PID).toString();
        m_authorizationModule.enforceListMethods(context, PID, asOfDateTime);
        DOReader reader =
                m_manager.getReader(Server.USE_DEFINITIVE_STORE, context, PID);

        ObjectMethodsDef[] methodDefs = reader.listMethods(asOfDateTime);
        long stopTime = new Date().getTime();
        long interval = stopTime - startTime;
        logger.debug("Roundtrip listMethods: " + interval + " milliseconds.");

        // DYNAMIC!! Grab any dynamic method definitions and merge them with
View Full Code Here

            throws ServerException {
        long startTime = new Date().getTime();
        PID = Server.getPID(PID).toString();
        m_authorizationModule
                .enforceListDatastreams(context, PID, asOfDateTime);
        DOReader reader =
                m_manager.getReader(Server.USE_DEFINITIVE_STORE, context, PID);

        Datastream[] datastreams = reader.GetDatastreams(asOfDateTime, null);
        DatastreamDef[] dsDefs = new DatastreamDef[datastreams.length];
        for (int i = 0; i < datastreams.length; i++) {
            dsDefs[i] =
                    new DatastreamDef(datastreams[i].DatastreamID,
                                      datastreams[i].DSLabel,
View Full Code Here

            throws ServerException {
        PID = Server.getPID(PID).toString();
        m_authorizationModule.enforceGetObjectProfile(context,
                                                      PID,
                                                      asOfDateTime);
        DOReader reader =
                m_manager.getReader(asOfDateTime == null, context, PID);

        Date versDateTime = asOfDateTime;
        ObjectProfile profile = new ObjectProfile();
        profile.PID = reader.GetObjectPID();
        profile.objectLabel = reader.GetObjectLabel();
        profile.objectOwnerId = reader.getOwnerId();
        profile.objectModels = new HashSet<String>();
        profile.objectCreateDate = reader.getCreateDate();
        profile.objectLastModDate = reader.getLastModDate();
        profile.objectState = reader.GetObjectState();

        profile.objectModels.addAll(reader.getContentModels());

/*
        for (RelationshipTuple rel : reader
                .getRelationships(Constants.MODEL.HAS_MODEL, null)) {
            profile.objectModels.add(rel.object);
        }
*/
        // "bootstrap" context won't have the uri to determine security
        String securityUri = context
                .getEnvironmentValue(Constants.HTTP_REQUEST.SECURITY.uri);

        if (securityUri != null) {
            String reposBaseURL =
                    getReposBaseURL(securityUri
                                            .equals(Constants.HTTP_REQUEST.SECURE.uri) ? "https"
                                                                                       : "http",
                                    context
                                            .getEnvironmentValue(Constants.HTTP_REQUEST.SERVER_PORT.uri));
            profile.dissIndexViewURL =
                    getDissIndexViewURL(reposBaseURL,
                                        context
                                                .getEnvironmentValue(Constants.FEDORA_APP_CONTEXT_NAME),
                                        reader.GetObjectPID(),
                                        versDateTime);
            profile.itemIndexViewURL =
                    getItemIndexViewURL(reposBaseURL,
                                        context
                                                .getEnvironmentValue(Constants.FEDORA_APP_CONTEXT_NAME),
                                        reader.GetObjectPID(),
                                        versDateTime);
        }
        return profile;
    }
View Full Code Here

        logger.debug("Getting attribute for resource " + resourceID);

        try{
            SubjectNode snode = new SimpleURIReference(new URI(resourceID));
            PredicateNode pnode = new SimpleURIReference(new URI(attribute));
            DOReader reader = m_doManager.getReader(false, getContext(), pid);
            Set<RelationshipTuple> triples = reader.getRelationships(snode, pnode, null);
            results = new HashSet<String>();

            for (RelationshipTuple triple:triples){
                results.add(triple.object);
            }
View Full Code Here

            obj.setPid(TEST_PID);
            for (int i = 0; i < dsData.length; i+=2) {
                ObjectBuilder.addXDatastream(obj, dsData[i], dsData[i+1]);
            }
            repo.putObject(obj);
            DOReader reader = repo.getReader(false, ReadOnlyContext.EMPTY, TEST_PID);
            return reader;
        } catch (Exception wontHappen) {
            throw new FaultException(wontHappen);
        }
    }
View Full Code Here

        // add one object to index
        String pid1 = "test:1";
        DigitalObject obj1 = getTestObject(pid1, pid1);
        setDates(obj1, new Date());
        m_repo.putObject(obj1);
        DOReader reader1 = m_repo.getReader(false, null, pid1);
        m_impl.update(reader1);

        // query for everything several times
        // should get 1 page w/1 result each time
        // and cPool shouldn't be exhausted because the impl should
View Full Code Here

        String dcContent = "<dc:identifier>" + pid1 + "</dc:identifier>";
        addXDatastream(obj1, "DC", getDC(dcContent));

        setDates(obj1, new Date());
        m_repo.putObject(obj1);
        DOReader reader1 = m_repo.getReader(false, null, pid1);
        m_impl.update(reader1);

        // query for it via dc:identifier
        FieldSearchQuery query = new FieldSearchQuery(Condition.getConditions("identifier~" + pid1));
        int[] expected = new int[] { 1, 1 };
View Full Code Here

TOP

Related Classes of org.fcrepo.server.storage.DOReader

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.