Examples of PID


Examples of org.fcrepo.common.PID

     * @param policyName
     * @return
     * @throws PolicyIndexException
     */
    private File nameToFile(String policyName) throws PolicyIndexException {
        PID pid;
        try {
            pid = new PID(policyName);
        } catch (MalformedPIDException e) {
            throw new PolicyIndexException("Invalid policy name.  Policy name must be a valid PID - " + policyName);
        }
        return new File(DB_HOME + "/" + pid.toFilename() + ".xml");

    }
View Full Code Here

Examples of org.fcrepo.common.PID

        } else {
            strippedRes = res;
        }
        // split into pid + datastream (if present), validate PID and then recombine datastream back in using URI form of PID
        String parts[] = strippedRes.split("/");
        PID pid;
        try {
            pid = new PID(parts[0]);
        } catch (MalformedPIDException e1) {
            logger.warn("Invalid Fedora resource identifier: {}. PID part of URI is malformed", res);
            return null;
        }

        String resURI;
        if (parts.length == 1) {
            resURI = pid.toURI();
        } else if (parts.length == 2) {
            resURI = pid.toURI() + "/" + parts[1]; // add datastream ID back
        } else {
            logger.warn("Invalid Fedora resource identifier: {}. Should be pid or datastream (URI form optional", res);
            return null;
        }
        return resURI;
View Full Code Here

Examples of org.fcrepo.common.PID

     * is replaced with the new one.
     */
    private void preIngestIfNeeded(boolean firstRun,
                                   DOManager doManager,
                                   RDFName objectName) throws Exception {
        PID pid = new PID(objectName.uri.substring("info:fedora/".length()));
        boolean exists = doManager.objectExists(pid.toString());
        if (exists && firstRun) {
            logger.info("Purging old system object: " + pid.toString());
            Context context = ReadOnlyContext.getContext(null,
                                                         null,
                                                         null,
                                                         false);
            DOWriter w = doManager.getWriter(USE_DEFINITIVE_STORE,
                                             context,
                                             pid.toString());
            w.remove();
            try {
                w.commit("Purged by Fedora at startup (to be re-ingested)");
                exists = false;
            } finally {
                doManager.releaseWriter(w);
            }
        }
        if (!exists) {
            logger.info("Ingesting new system object: " + pid.toString());
            InputStream xml = getStream("org/fcrepo/server/resources/"
                                        + pid.toFilename() + ".xml");
            Context context = ReadOnlyContext.getContext(null,
                                                         null,
                                                         null,
                                                         false);
            DOWriter w = doManager.getIngestWriter(USE_DEFINITIVE_STORE,
View Full Code Here

Examples of org.fcrepo.common.PID

            }

            Set<String> parents = mapping.get(relationship);
            if (parents != null) {
                for (String parent : parents) {
                    PID parentPID = PID.getInstance(parent);
                    // we want the parents in demo:123 form, not info:fedora/demo:123
                    parentPIDs.add(parentPID.toString());
                    if (logger.isDebugEnabled()) {
                        logger.debug("added parent " + parentPID.toString());
                    }
                }
            }
        }
        return parentPIDs;
View Full Code Here

Examples of org.fcrepo.common.PID

            strippedSubject = subject.substring(Constants.FEDORA.uri.length());
        } else {
            strippedSubject = subject;
        }
        String parts[] = strippedSubject.split("/");
        PID pid = new PID(parts[0]);
        String subjectURI;
        if (parts.length == 1) {
            subjectURI = pid.toURI();
        } else if (parts.length == 2) {
            subjectURI = pid.toURI() + "/" + parts[1]; // add datastream
        } else {
            logger.warn("Invalid subject argument for getRelationships: " + subject + ". Should be pid or datastream (URI form optional");
            subjectURI = null;
        }
View Full Code Here

Examples of org.fcrepo.common.PID


    // Wraps PID constructor, throwing a ServerException instead
    public static PID getPID(String pidString) throws MalformedPidException {
        try {
            return new PID(pidString);
        } catch (MalformedPIDException e) {
            throw new MalformedPidException(e.getMessage());
        }
    }
View Full Code Here

Examples of org.fcrepo.common.PID

    public synchronized PID generatePID(String namespace) throws IOException {
        int i = getHighestID(namespace);
        i++;

        try {
            m_lastPID = new PID(namespace + ":" + i);
        } catch (MalformedPIDException e) {
            throw new IOException(e.getMessage());
        }

        setHighestID(namespace, i);
View Full Code Here

Examples of org.fcrepo.common.PID

     * Cause the given PID to never be generated by the PID generator.
     */
    public synchronized void neverGeneratePID(String pid) throws IOException {
        logger.debug("Never generating PID: " + pid);
        try {
            PID p = new PID(pid);
            String ns = p.getNamespaceId();
            int id = Integer.parseInt(p.getObjectId());
            if (id > getHighestID(ns)) {
                setHighestID(ns, id);
            }
        } catch (MalformedPIDException mpe) {
            throw new IOException(mpe.getMessage());
View Full Code Here

Examples of org.fcrepo.common.PID

                                                "testManagedDatastreams",
                                                false);
    }

    private Feed createAtomObject(String spid, String contentLocation) throws Exception {
        PID pid = PID.getInstance(spid);
        Date date = new Date(1);
        String title = "title";
        String author = "org.fcrepo.test.api.TestManagedDatastreams";

        Feed feed = abdera.newFeed();
        feed.setId(pid.toURI());
        feed.setTitle(title);
        feed.setUpdated(date);
        feed.addAuthor(author);

        if (contentLocation != null && contentLocation.length() > 0) {
View Full Code Here

Examples of org.fcrepo.common.PID

        dsvEntry.setSummary("summary");
        dsvEntry.setContent(new IRI(contentLocation), "text/plain");
    }

    private Foxml11Document createFoxmlObject(String spid, String contentLocation) throws Exception {
        PID pid = PID.getInstance(spid);
        Date date = new Date(1);

        Foxml11Document doc = new Foxml11Document(pid.toString());
        doc.addObjectProperty(Property.STATE, "A");

        if (contentLocation != null && contentLocation.length() > 0) {
            String ds = "DS";
            String dsv = "DS1.0";
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.