Package org.fcrepo.client

Examples of org.fcrepo.client.FedoraClient


        String hostName = null;
        String username = null;
        String password = null;
        int portNum = 0;
        boolean isValidateOnly = true;
        FedoraClient fc = null;

        try {
            if (args.length < 6 || args.length > 8) {
                AutoModify
                        .showUsage("You must provide either 6, 7 or 8 arguments.");
            } else {

                String[] hostPort = args[0].split(":");
                if (hostPort.length != 2) {
                    AutoModify
                            .showUsage("First argument must contain target"
                                    + " Fedora server hostname and port using the syntax"
                                    + " \"hostname:port\"");
                }
                hostName = hostPort[0];
                portNum = Integer.parseInt(hostPort[1]);
                username = args[1];
                password = args[2];
                directivesFilePath = args[3];
                logFilePath = args[4];
                protocol = args[5];

                if (args.length >= 7) {
                    isValidateOnly = false;
                } else {
                    isValidateOnly = true;
                }

                String context = Constants.FEDORA_DEFAULT_APP_CONTEXT;
                if (args.length == 8 && !args[7].equals("")){
                    context = args[7];
                }

                if (new File(directivesFilePath).exists()) {
                    System.out.println("\nCONNECTING to Fedora server....");

                    // ******************************************
                    // NEW: use new client utility class
                    String baseURL =
                            protocol + "://" + hostName + ":" + portNum
                                    + "/" + context;
                    fc = new FedoraClient(baseURL, username, password);
                    APIA = fc.getAPIAMTOM();
                    APIM = fc.getAPIMMTOM();
                    //*******************************************

                    AutoModify am =
                            new AutoModify(APIA,
                                           APIM,
                                           protocol,
                                           hostName,
                                           portNum,
                                           context,
                                           username,
                                           password);

                    if (isValidateOnly) {
                        System.out
                                .println("\n----- VALIDATING DIRECTIVES FILE ONLY -----\n");
                    } else {
                        System.out
                                .println("\n----- PROCESSING DIRECTIVES FILE -----\n");
                    }
                    am.modify(directivesFilePath, logFilePath, isValidateOnly);
                } else {
                    AutoModify
                            .showUsage("Directives input file does not exist: "
                                    + directivesFilePath + " .");
                }
            }
        } catch (Exception e) {
            AutoModify.showUsage(e.getClass().getName()
                    + " - "
                    + (e.getMessage() == null ? "(no detail provided)" : e
                            .getMessage()));
        } finally {
            if (fc != null) {
                fc.shutdown();
            }
        }
    }
View Full Code Here


        }

        // ******************************************
        // NEW: use new client utility class for SOAP stubs
        String baseURL = protocol + "://" + host + ":" + port + "/" + context;
        FedoraClient fc = new FedoraClient(baseURL, username, password);
        APIA = fc.getAPIAMTOM();
        APIM = fc.getAPIMMTOM();
        fc.shutdown();
        //*******************************************

    }
View Full Code Here

        this.username = username;
        this.password = password;
        this.context = context;

        String baseURL = "http://" + host + ":" + port + "/" + context;
        FedoraClient fedoraClient = new FedoraClient(baseURL, username, password);
        apim = fedoraClient.getAPIMMTOM();
        apia = fedoraClient.getAPIAMTOM();
        fedoraClient.shutdown();

        PIDS = apim.getNextPID(new BigInteger(Integer.valueOf(iterations).toString()), "demo").toArray(new String[]{});
        FOXML = new byte[iterations][];
        for (int i = 0; i < iterations; i++) {
            FOXML[i] = DEMO_FOXML_TEXT.replaceAll(pid, PIDS[i]).getBytes("UTF-8");
View Full Code Here

                // ******************************************
                // NEW: use new client utility class
                String baseURL =
                        protocol + "://" + host + ":" + port + "/" + context;
                FedoraClient fc = new FedoraClient(baseURL, user, pass);
                APIA = fc.getAPIAMTOM();
                APIM = fc.getAPIMMTOM();
                fc.shutdown();
                //*******************************************

                InputStream file =
                        new FileInputStream("c:\\fedora\\mellon\\dist\\client\\demo\\batch-demo\\modify-batch-directives-valid.xml");
                BatchModifyParser bmp =
View Full Code Here

                // ******************************************
                // NEW: use new client utility class
                String baseURL =
                        protocol + "://" + hostName + ":" + portNum + "/"
                                + context;
                FedoraClient fc = new FedoraClient(baseURL, username, password);
                APIA = fc.getAPIAMTOM();
                APIM = fc.getAPIMMTOM();
                fc.shutdown();
                //*******************************************
                AutoIngestor autoIngestor = new AutoIngestor(APIA, APIM);

                new MassIngest(autoIngestor, f, dictFile, format, Integer
                        .parseInt(args[7]));
View Full Code Here

    }

    public void init(String host, String port, String username, String password, String batch, String batches, String threads, String outputFileLocation, String context) throws Exception {

        String baseURL =  "http://" + host + ":" + port + "/" + context;
        FedoraClient fedoraClient = new FedoraClient(baseURL, username, password);
        apim = fedoraClient.getAPIMMTOM();
        fedoraClient.shutdown();

        try {
            batchSize = Integer.valueOf(batch);
        } catch (NumberFormatException nfe) {
            System.err.println("Batch Size value could not be " +
View Full Code Here

                                          isLiteral,
                                          datatype));
    }

    private TripleIterator queryRI(String query) throws Exception {
        FedoraClient client = getFedoraClient();
        InputStream results =
                client.get(RISEARCH_QUERY + URLEncoder.encode(query, "UTF-8"),
                           true);
        return new RIOTripleIterator(results,
                                     new NTriplesParser(),
                                     "info/fedora",
                                     exec);
View Full Code Here

        // Use the FedoraClient utility to get SOAP stubs.
        // These SOAP stubs enable the client to connect to a Fedora repository
        // via the API-A and API-M web service interfaces.

        String baseURL = protocol + "://" + host + ":" + port + "/" + context;
        FedoraClient fc = new FedoraClient(baseURL, user, pass);
        APIA=fc.getAPIA();
        APIM=fc.getAPIM();
    }
View Full Code Here

                // ******************************************
                // NEW: use new client utility class
                String baseURL =
                        protocol + "://" + hostName + ":" + portNum + "/"
                        + context;
                FedoraClient fc = new FedoraClient(baseURL, username, password);
                FedoraAPIMMTOM sourceRepoAPIM = fc.getAPIMMTOM();
                fc.shutdown();
                //*******************************************
                DatastreamConduit c = new DatastreamConduit(sourceRepoAPIM);

                List<Datastream> datastreams = c.getDatastreams(pid, null, null);
                for (Datastream ds : datastreams) {
View Full Code Here

TOP

Related Classes of org.fcrepo.client.FedoraClient

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.