All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java.fedora.server.test.TestClientAPIA Maven / Gradle / Ivy

Go to download

The Fedora Client is a Java Library that allows API access to a Fedora Repository. The client is typically one part of a full Fedora installation.

The newest version!
/*
 * -----------------------------------------------------------------------------
 *
 * 

License and Copyright: The contents of this file are subject to the * Apache License, Version 2.0 (the "License"); you may not use * this file except in compliance with the License. You may obtain a copy of * the License at * http://www.fedora-commons.org/licenses.

* *

Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for * the specific language governing rights and limitations under the License.

* *

The entire file consists of original code.

*

Copyright © 2008 Fedora Commons, Inc.
*

Copyright © 2002-2007 The Rector and Visitors of the University of * Virginia and Cornell University
* All rights reserved.

* * ----------------------------------------------------------------------------- */ package fedora.server.test; import java.util.Date; import java.io.ByteArrayInputStream; import java.io.BufferedReader; import java.io.InputStreamReader; //import java.io.IOException; import javax.xml.namespace.QName; import org.apache.axis.client.Service; import org.apache.axis.client.Call; /** * *

Title: TestClientAPIA.java

*

Description: Provides a client for testing the Fedora Access SOAP * service.

* * @author [email protected] * @version $Id: TestClientAPIA.java 3966 2005-04-21 13:33:01Z rlw $ */ public class TestClientAPIA { /** *

Tests the Fedora Access SOAP service by making calls to each of * the supported services.

* * @param args An array of command line arguments. */ public static void main(String[] args) { String PID = "uva-lib:1225"; String qName1 = "http://www.fedora.info/definitions/1/0/api/"; String endpoint = "http://localhost:8080/fedora/services/access"; Date asOfDate = null; try { Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress( new java.net.URL(endpoint) ); /* // Test GetbehaviorDefinitions call.setOperationName(new javax.xml.namespace.QName(qName1, "GetBehaviorDefinitions") ); String[] bDefs = (String[])call.invoke(new Object[] { PID }); System.out.println("\n*****GETBEHAVIORDEFINITIONS RESULTS*****"); for (int i=0; i 0) { System.out.write(c); } */ // Test GetDissemination PID = "1007.lib.dl.test/text_ead/viu00003"; String bDefPID = "web_ead"; String method = "get_admin"; call.setOperationName(new javax.xml.namespace.QName(qName1, "GetDissemination") ); fedora.server.types.gen.MIMETypedStream dissemination = (fedora.server.types.gen.MIMETypedStream) call.invoke( new Object[] { PID, bDefPID, method, asOfDate} ); if (dissemination != null) { String mime = dissemination.getMIMEType(); System.out.println("\n\n****DISSEMINATION RESULTS*****\n"+ "Dissemination MIME: "+mime); BufferedReader br = new BufferedReader( new InputStreamReader( new ByteArrayInputStream(dissemination.getStream()))); String line = null; while ((line=br.readLine()) != null ) { System.out.println(line); } } //Test View Objecct call.setOperationName(new javax.xml.namespace.QName(qName1, "GetObjectMethods") ); fedora.server.types.gen.ObjectMethodsDef[] objectView = null; QName qn = new QName("http://www.fedora.info/definitions/1/0/types/", "ObjectMethodsDef"); call.registerTypeMapping(fedora.server.types.gen.ObjectMethodsDef.class, qn, new org.apache.axis.encoding.ser.BeanSerializerFactory( fedora.server.types.gen.ObjectMethodsDef.class, qn), new org.apache.axis.encoding.ser.BeanDeserializerFactory( fedora.server.types.gen.ObjectMethodsDef.class, qn)); objectView = (fedora.server.types.gen.ObjectMethodsDef[]) call.invoke( new Object[] { PID, asOfDate} ); for (int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy