View Javadoc
1 /*** 2 * $Revision: 1.2 $ 3 */ 4 package com.sun.xml.registry.ebxml.util; 5 6 import java.io.*; 7 import javax.xml.registry.*; 8 9 import org.oasis.ebxml.registry.bindings.query.*; 10 import org.oasis.ebxml.registry.bindings.rim.*; 11 12 /*** 13 * Helper routines. For example, methods that generate requests may be 14 * part of this class. 15 */ 16 public class BindingUtil 17 { 18 private static final BindingUtil INSTANCE = new BindingUtil(); 19 20 private BindingUtil() { 21 } 22 23 public static BindingUtil getInstance() { 24 return INSTANCE; 25 } 26 27 /* 28 * Create a GetContentRequest 29 */ 30 public String toGetContentRequest(String id) 31 throws JAXRException 32 { 33 ObjectRef objRef = new ObjectRef(); 34 objRef.setId(id); 35 36 ObjectRefListItem orli = new ObjectRefListItem(); 37 orli.setObjectRef(objRef); 38 39 ObjectRefList orl = new ObjectRefList(); 40 orl.addObjectRefListItem(orli); 41 42 GetContentRequest gcr = new GetContentRequest(); 43 gcr.setObjectRefList(orl); 44 45 StringWriter sw = new StringWriter(); 46 try { 47 gcr.marshal(sw); 48 } catch (org.exolab.castor.xml.MarshalException x) { 49 throw new JAXRException(x); 50 } catch (org.exolab.castor.xml.ValidationException x) { 51 throw new JAXRException(x); 52 } 53 54 return sw.toString(); 55 } 56 }

This page was automatically generated by Maven