Package org.fcrepo.server.access

Examples of org.fcrepo.server.access.FedoraAPIAMTOM


                // NEW: use new client utility class
                String baseURL =
                        protocol + "://" + hp[0] + ":"
                                + Integer.parseInt(hp[1]) + "/" + context;
                FedoraClient fc = new FedoraClient(baseURL, args[4], args[5]);
                FedoraAPIAMTOM targetRepoAPIA = fc.getAPIAMTOM();
                FedoraAPIMMTOM targetRepoAPIM = fc.getAPIMMTOM();
                fc.shutdown();
                //*******************************************

                String pid =
                        Ingest.oneFromFile(f,
                                           ingestFormat,
                                           targetRepoAPIA,
                                           targetRepoAPIM,
                                           logMessage);
                if (pid == null) {
                    System.out.print("ERROR: ingest failed for file: "
                            + args[1]);
                } else {
                    System.out.println("Ingested pid: " + pid);
                }
            } else if (kind == 'd') {
                // USAGE: fedora-ingest d[ir] path format targetHost:targetPort targetUser targetPassword targetProtocol [log] [context]
                if (args.length < 7 || args.length > 9) {
                    Ingest.badArgs("Wrong number of arguments (" + args.length
                            + ") for directory ingest.");
                    System.out
                            .println("USAGE: fedora-ingest d[ir] path format targetHost:targetPort targetUser targetPassword targetProtocol [log] [context]");
                }
                File d = new File(args[1]);
                String ingestFormat = args[2];
                String logMessage = null;

                if (args.length == 8) {
                    logMessage = args[7];
                }

                if (args.length == 9 && !args[8].equals("")) {
                    context = args[8];
                }

                String protocol = args[6];
                String[] hp = args[3].split(":");

                // ******************************************
                // NEW: use new client utility class
                String baseURL =
                        protocol + "://" + hp[0] + ":"
                                + Integer.parseInt(hp[1]) + "/" + context;
                FedoraClient fc = new FedoraClient(baseURL, args[4], args[5]);
                FedoraAPIAMTOM targetRepoAPIA = fc.getAPIAMTOM();
                FedoraAPIMMTOM targetRepoAPIM = fc.getAPIMMTOM();
                //*******************************************

                logRootName = "ingest-from-dir";
                logFile = IngestLogger.newLogFile(logRootName);
                log =
                        new PrintStream(new FileOutputStream(logFile),
                                        true,
                                        "UTF-8");
                IngestLogger.openLog(log, logRootName);
                Ingest.multiFromDirectory(d,
                                          ingestFormat,
                                          targetRepoAPIA,
                                          targetRepoAPIM,
                                          logMessage,
                                          log,
                                          counter);
                IngestLogger.closeLog(log, logRootName);
                summarize(counter, logFile);
            } else if (kind == 'r') {
                // USAGE: fedora-ingest r[epos] sourceHost:sourcePort sourceUser sourcePassword pid|* targetHost:targetPort targetUser targetPassword sourceProtocol targetProtocol [log] [context]
                if (args.length < 10 || args.length > 12) {
                    Ingest.badArgs("Wrong number of arguments for repository ingest.");
                }
                String logMessage = null;
                if (args.length == 11) {
                    logMessage = args[10];
                }

                if (args.length == 12 && !args[11].equals("")) {
                    context = args[11];
                }
                //Source repository
                String[] shp = args[1].split(":");
                String source_host = shp[0];
                String source_port = shp[1];
                String source_user = args[2];
                String source_password = args[3];
                String source_protocol = args[8];

                // ******************************************
                // NEW: use new client utility class
                String sourceBaseURL =
                        source_protocol + "://" + source_host + ":"
                                + Integer.parseInt(source_port) + "/" + context;
                FedoraClient sfc =
                        new FedoraClient(sourceBaseURL,
                                         source_user,
                                         source_password);
                FedoraAPIAMTOM sourceRepoAPIA = sfc.getAPIAMTOM();
                FedoraAPIMMTOM sourceRepoAPIM = sfc.getAPIMMTOM();
                //*******************************************

                //Target repository
                String[] thp = args[5].split(":");
                String target_host = thp[0];
                String target_port = thp[1];
                String target_user = args[6];
                String target_password = args[7];
                String target_protocol = args[9];

                // ******************************************
                // NEW: use new client utility class
                String targetBaseURL =
                        target_protocol + "://" + target_host + ":"
                                + Integer.parseInt(target_port) + "/" + context;
                FedoraClient tfc =
                        new FedoraClient(targetBaseURL,
                                         target_user,
                                         target_password);
                FedoraAPIAMTOM targetRepoAPIA = tfc.getAPIAMTOM();
                FedoraAPIMMTOM targetRepoAPIM = tfc.getAPIMMTOM();
                //*******************************************

                // Determine export format
                RepositoryInfo repoinfo = sourceRepoAPIA.describeRepository();
View Full Code Here


            // NEW: use new client utility class
            String baseURL =
                    protocol + "://" + hp[0] + ":" + Integer.parseInt(hp[1])
                            + "/" + context;
            FedoraClient fc = new FedoraClient(baseURL, args[1], args[2]);
            FedoraAPIAMTOM sourceRepoAPIA = fc.getAPIAMTOM();
            FedoraAPIMMTOM sourceRepoAPIM = fc.getAPIMMTOM();
            fc.shutdown();
            //*******************************************

            String exportFormat = args[4];
            String exportContext = args[5];
            if (!exportFormat.equals(FOXML1_1.uri)
                    && !exportFormat.equals(FOXML1_0.uri)
                    && !exportFormat.equals(METS_EXT1_1.uri)
                    && !exportFormat.equals(METS_EXT1_0.uri)
                    && !exportFormat.equals(ATOM1_1.uri)
                    && !exportFormat.equals(ATOM_ZIP1_1.uri)
                    && !exportFormat.equals("default")) {
                Export.badArgs(exportFormat + " is not a valid export format.");
            }
            if (!exportContext.equals("public")
                    && !exportContext.equals("migrate")
                    && !exportContext.equals("archive")
                    && !exportContext.equals("default")) {
                Export
                        .badArgs("econtext arg must be 'public', 'migrate', 'archive', or 'default'");
            }

            RepositoryInfo repoinfo = sourceRepoAPIA.describeRepository();
            StringTokenizer stoken =
                    new StringTokenizer(repoinfo.getRepositoryVersion(), ".");
            int majorVersion = new Integer(stoken.nextToken()).intValue();
            if (majorVersion < 2 // pre-2.0 repo
                    && !exportFormat.equals(METS_EXT1_0.uri)
View Full Code Here

        }

        @Override
        public void actionPerformed(ActionEvent evt) {
            if (m_button.isEnabled()) {
                FedoraAPIAMTOM oldAPIA = Administrator.APIA;
                FedoraAPIMMTOM oldAPIM = Administrator.APIM;
                try {
                    // pull out values and do a quick syntax check
                    String hostPort =
                            (String) m_serverComboBox.getSelectedItem();
View Full Code Here

                context = args[5];
            }

            PrintStream logFile;
            FedoraAPIMMTOM APIM;
            FedoraAPIAMTOM APIA;

            try {
                UPLOADER = new Uploader(host, port, context, user, pass);
                logFile =
                        new PrintStream(new FileOutputStream("C:\\zlogfile.txt"));
View Full Code Here

    // returns failCount
    private int listDatastreams(FedoraClient client, int numTimes) {
        LOGGER.info("Listing object datastreams via API-A SOAP {} times...", numTimes);
        int failCount = 0;
        FedoraAPIAMTOM apia = null;
        for (int i = 0; i < numTimes; i++) {
            try {
                if (apia == null) {
                    apia = client.getAPIAMTOM();
                }
                apia.listDatastreams(TEST_PID, null);
            } catch (Exception e) {
                failCount++;
            }
        }
        LOGGER.info("Failed {} times", failCount);
View Full Code Here

//        LoggingOutInterceptor log2 = new LoggingOutInterceptor(new PrintWriter(System.out));
//        clientFactory.getInInterceptors().add(log1);
//        clientFactory.getInInterceptors().add(log2);
        PrintStream syserr = System.err;
        System.setErr(System.out);
        FedoraAPIAMTOM service = (FedoraAPIAMTOM) clientFactory.create();
        System.setErr(syserr);
        syserr = null;

        if (Administrator.INSTANCE == null) {
            // if running without Administrator, don't wrap it with the statusbar stuff
View Full Code Here

TOP

Related Classes of org.fcrepo.server.access.FedoraAPIAMTOM

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.