1 /* 2 * PublishTest1.java 3 * 4 * Created on April 8, 2002, 10:45 AM 5 * 6 * $Header: /cvsroot/ebxmlrr/jaxr/test/com/sun/xml/registry/ebxml/PublishTest1.java,v 1.8 2002/12/16 20:30:18 farrukh_najmi Exp $ 7 * 8 */ 9 10 package com.sun.xml.registry.ebxml; 11 12 import javax.xml.registry.*; 13 import javax.xml.registry.infomodel.*; 14 15 import java.util.*; 16 17 import org.apache.commons.logging.Log; 18 19 import javax.security.auth.*; 20 import javax.security.auth.login.*; 21 import com.sun.security.auth.module.*; 22 import com.sun.security.auth.callback.*; 23 24 /*** 25 * 26 * @author <a href="mailto:Farrukh.Najmi@Sun.COM">Farrukh S. Najmi</a> 27 * 28 */ 29 public class PublishTest1 extends JAXRTest { 30 31 /*** Creates new PublishTest1 */ 32 public PublishTest1() throws JAXRException { 33 super(null); 34 35 //Put following queries in a new QueryTest1 36 //BulkResponse br = bqm.findAssociations((Collection)null, "urn:uuid:dafa4da3-1d92-4757-8fd8-ff2b8ce7a1bf", null, null); 37 38 Log log = ((RegistryServiceImpl)service).getConnection().getConnectionFactory().getLog(); 39 log.trace("Running PublishTes1..."); 40 41 PostalAddress addr = lcm.createPostalAddress( 42 "10", 43 "Street 1", 44 "Islamabad", 45 "Punjab", 46 "Pakistan", 47 "0123456", 48 "Historical" 49 ); 50 51 ArrayList addresses = new ArrayList(); 52 addresses.add(addr); 53 54 ArrayList phones = new ArrayList(); 55 TelephoneNumber ph1 = lcm.createTelephoneNumber(); 56 ph1.setCountryCode("1"); 57 ph1.setAreaCode("781"); 58 ph1.setNumber("442-0703"); 59 ph1.setType("Home"); 60 phones.add(ph1); 61 TelephoneNumber ph2 = lcm.createTelephoneNumber(); 62 ph2.setCountryCode("1"); 63 ph2.setAreaCode("781"); 64 ph2.setNumber("442-0704"); 65 ph2.setType("Fax"); 66 phones.add(ph2); 67 68 User user = lcm.createUser(); 69 user.setPostalAddresses(addresses); 70 user.setTelephoneNumbers(phones); 71 72 EmailAddress email = lcm.createEmailAddress("farrukh.najmi@sun.com"); 73 ArrayList emails = new ArrayList(); 74 emails.add(email); 75 user.setEmailAddresses(emails); 76 77 PersonName farrukh = lcm.createPersonName("Farrukh", "Salahudin", "Najmi"); 78 user.setPersonName(farrukh); 79 Organization org = lcm.createOrganization("Sun Microsystems Inc."); 80 org.setPrimaryContact(user); 81 org.setDescription(lcm.createInternationalString("Maker of fine Java")); 82 83 org.setPostalAddress(addr); 84 org.setTelephoneNumbers(phones); 85 86 Slot slot1 = lcm.createSlot("NASDAQ Symbol", "SUNW", null); 87 org.addSlot(slot1); 88 89 Slot slot2 = lcm.createSlot("Scott McNealys home phone number", "415-123-4567", null); 90 org.addSlot(slot2); 91 92 //ArrayList namePatterns = new ArrayList(); 93 //namePatterns.add("ntis-gov:naics"); 94 //ClassificationScheme naicsScheme = bqm.findClassificationSchemeByName((Collection)null, "ntis-gov:naics"); 95 96 //NAICS "Software Publishers" Concept 97 Concept softwarePublishersConcept = bqm.findConceptByPath("/urn:uuid:2ac531c8-39ce-4441-aaa0-d0e5fab84f88/51/511/5111/51113" ); 98 if (softwarePublishersConcept != null) { 99 Classification cl1 = lcm.createClassification(softwarePublishersConcept); 100 org.addClassification(cl1); 101 } 102 103 //NAICS "Computer and Electronic Product Manufacturing" Concept 104 Concept compMfgConcept = bqm.findConceptByPath("/urn:uuid:2ac531c8-39ce-4441-aaa0-d0e5fab84f88/31-33/334/3341" ); 105 if (compMfgConcept != null) { 106 Classification cl2 = lcm.createClassification(compMfgConcept); 107 org.addClassification(cl2); 108 } 109 110 //ISO3166 "US" Concept 111 Concept usConcept = bqm.findConceptByPath("/urn:uuid:fa278afc-d0fc-4c4a-abf0-9f27292ca387/%/US" ); 112 if (usConcept != null) { 113 Classification cl3 = lcm.createClassification(usConcept); 114 org.addClassification(cl3); 115 } 116 117 ArrayList namePatterns = new ArrayList(); 118 namePatterns.clear(); 119 namePatterns.add("NYSE Ticker"); 120 ClassificationScheme nyseScheme = bqm.findClassificationSchemeByName((Collection)null, "NYSE Ticker"); 121 if (nyseScheme != null) { 122 ExternalIdentifier extId1 = lcm.createExternalIdentifier(nyseScheme, "Sun Microsystems", "SUNW"); 123 org.addExternalIdentifier(extId1); 124 } 125 126 Service service = lcm.createService("J2EE Licensee Certification Service"); 127 org.addService(service); 128 ExternalLink link1 = lcm.createExternalLink("http://java.sun.com", "Sun Java Web Site"); 129 service.addExternalLink(link1); 130 131 ServiceBinding serviceBinding = lcm.createServiceBinding(); 132 service.addServiceBinding(serviceBinding); 133 134 RegistryPackage pkg1 = lcm.createRegistryPackage("PublishTest1 Package 1"); 135 pkg1.addRegistryObject(org); 136 137 ArrayList objs = new ArrayList(); 138 objs.add(org); 139 objs.add(service); 140 //objs.add(serviceBinding); 141 objs.add(user); 142 objs.add(pkg1); 143 144 BulkResponse resp = lcm.saveObjects(objs); 145 } 146 147 148 149 /*** 150 * @param args the command line arguments 151 */ 152 public static void main(String args[]) { 153 try { 154 PublishTest1 test = new PublishTest1(); 155 } 156 catch (JAXRException e) { 157 e.printStackTrace(); 158 System.exit(-1); 159 } 160 } 161 162 }

This page was automatically generated by Maven