Package org.uddi.api_v2

Examples of org.uddi.api_v2.TModel


         * @return null, or a TModel object
         * @throws ValueNotAllowedException
         * @since 3.3
         */
        private TModel verifyTModelKeyExists(String tmodelKey) throws ValueNotAllowedException, DispositionReportFaultMessage {
                TModel api = null;
                EntityManager em = PersistenceManager.getEntityManager();
                boolean found = false;
                if (em == null) {
                        log.warn(new ErrorMessage("errors.tmodel.ReferentialIntegrityNullEM"));
                } else {
                        Tmodel modelTModel = null;
                        {
                                EntityTransaction tx = em.getTransaction();
                                try {

                                        tx.begin();
                                        modelTModel = em.find(org.apache.juddi.model.Tmodel.class, tmodelKey);


                                        if (modelTModel != null) {
                                                found = true;
                                                api = new TModel();
                                                MappingModelToApi.mapTModel(modelTModel, api);
                                        }
                                        tx.commit();

                                } finally {
View Full Code Here


                return ret;
        }

        private List<String> GetBindingKeysCheckedTModelKeyedReference(Map<String, TModel> cache, KeyedReference get) {
                List<String> ret = new ArrayList<String>();
                TModel ref = null;
                if (cache.containsKey(get.getTModelKey())) {
                        ref = cache.get(get.getTModelKey());
                }
                if (ref == null) {
                        try {
View Full Code Here

      List<TModelInfo> tiList = tInfos.getTModelInfo();
      if (tiList == null || tiList.size() == 0)
        Assert.fail("No result from find tModel operation");
      TModelInfo tiOut = tiList.get(0);
     
      TModel tmIn = (TModel)EntityCreator.buildFromDoc(TckTModel.JOE_PUBLISHER_TMODEL_XML, "org.uddi.api_v3");
     
      assertEquals(tmIn.getTModelKey(), tiOut.getTModelKey());
      assertEquals(tmIn.getName().getLang(), tiOut.getName().getLang());
      assertEquals(tmIn.getName().getValue(), tiOut.getName().getValue());

      TckValidator.checkDescriptions(tmIn.getDescription(), tiOut.getDescription());
    }
    catch(Exception e) {
      logger.error(e.getMessage(), e);
      Assert.fail("No exception should be thrown.");
    }
View Full Code Here

        throw new FatalErrorException(new ErrorMessage("errors.install.AlreadyInstalled"));
     
     
      String rootPublisherStr = config.getString(Property.JUDDI_ROOT_PUBLISHER);
      String fileRootTModelKeygen = rootPublisherStr + FILE_TMODELKEYGEN;
      TModel rootTModelKeyGen = (TModel)buildInstallEntity(fileRootTModelKeygen, "org.uddi.api_v3", config);
      String fileRootBusinessEntity = rootPublisherStr + FILE_BUSINESSENTITY;
      org.uddi.api_v3.BusinessEntity rootBusinessEntity = (org.uddi.api_v3.BusinessEntity)buildInstallEntity(fileRootBusinessEntity, "org.uddi.api_v3",config);
     
      String rootPartition = getRootPartition(rootTModelKeyGen);
                        //JUDDI-645
      String nodeId = config.getString(Property.JUDDI_NODE_ID,getNodeId(rootBusinessEntity.getBusinessKey(), rootPartition) );
                                //getNodeId(rootBusinessEntity.getBusinessKey(), rootPartition);
      String rootbizkey = getNodeId(rootBusinessEntity.getBusinessKey(), rootPartition);
      String fileRootPublisher = rootPublisherStr + FILE_PUBLISHER;
      if (!alreadyInstalled) {
        log.info("Loading the root Publisher from file " + fileRootPublisher);
     
        rootPublisher = installPublisher(em, fileRootPublisher, config);
        installRootPublisherKeyGen(em, rootTModelKeyGen, rootPartition, rootPublisher, nodeId);
        rootBusinessEntity.setBusinessKey(rootbizkey);
        installBusinessEntity(true, em, rootBusinessEntity, rootPublisher, rootPartition, config,nodeId);
      } else {
        log.debug("juddi.seed.always reapplies all seed files except for the root data.");
      }
     
      List<String> juddiPublishers = getPublishers(config);
      for (String publisherStr : juddiPublishers) {
        String filePublisher = publisherStr + FILE_PUBLISHER;
        String fileTModelKeygen = publisherStr + FILE_TMODELKEYGEN;
        TModel tModelKeyGen = (TModel)buildInstallEntity(fileTModelKeygen, "org.uddi.api_v3", config);
        String fileBusinessEntity = publisherStr + FILE_BUSINESSENTITY;
        org.uddi.api_v3.BusinessEntity businessEntity = (org.uddi.api_v3.BusinessEntity)buildInstallEntity(fileBusinessEntity, "org.uddi.api_v3",config);
        UddiEntityPublisher publisher = installPublisher(em, filePublisher, config);
        if (publisher==null) {
          throw new ConfigurationException("File " + filePublisher + " not found.");
View Full Code Here

        Iterator iter = schemes.iterator();
        int currLoc = 0;
        while (iter.hasNext()) {
            try {
                TModel en =
                    ScoutJaxrUddiV3Helper.getTModelFromJAXRClassificationScheme((ClassificationScheme) iter.next());
                entityarr[currLoc] = en;
                currLoc++;
            }
            catch (ClassCastException ce) {
                throw new UnexpectedObjectException();
            }
        }
        log.debug("Method:save_classificationscheme: ENlength=" + entityarr.length);
        // Save business
        TModelDetail td = null;
        try {
            td = (TModelDetail) executeOperation(entityarr, "SAVE_TMODEL");
        }
        catch (RegistryV3Exception e) {
            exceptions.add(new SaveException(e.getLocalizedMessage()));
            bulk.setStatus(JAXRResponse.STATUS_FAILURE);
            return bulk;
        }

        List<TModel> tmodelList = td.getTModel();
        entityarr = new TModel[tmodelList.size()];
        tmodelList.toArray(entityarr);
        log.debug("After Saving TModel. Obtained vector size:" + entityarr != null ? entityarr.length : 0);
        for (int i = 0; entityarr != null && i < entityarr.length; i++) {
            TModel tm = (TModel) entityarr[i];
            coll.add(new KeyImpl(tm.getTModelKey()));
        }

        bulk.setCollection(coll);
        bulk.setExceptions(exceptions);
View Full Code Here

        Iterator iter = concepts.iterator();
        int currLoc = 0;
        while (iter.hasNext()) {
            try {
                TModel en =
                  ScoutJaxrUddiV3Helper.getTModelFromJAXRConcept((Concept) iter.next());
                entityarr[currLoc] = en;
                currLoc++;
            }
            catch (ClassCastException ce) {
                throw new UnexpectedObjectException();
            }
        }
        log.debug("Method:save_concept: ENlength=" + entityarr.length);
        // Save business
        TModelDetail td = null;
        try {
            td = (TModelDetail) executeOperation(entityarr, "SAVE_TMODEL");
        }
        catch (RegistryV3Exception e) {
            exceptions.add(new SaveException(e.getLocalizedMessage()));
            bulk.setStatus(JAXRResponse.STATUS_FAILURE);
            return bulk;
        }

        List<TModel> tmodelList = td.getTModel();
        entityarr = new TModel[tmodelList.size()];
        tmodelList.toArray(entityarr);
       
        log.debug("After Saving TModel. Obtained vector size:" + entityarr != null ? entityarr.length : 0);
        for (int i = 0; entityarr != null && i < entityarr.length; i++) {
            TModel tm = (TModel) entityarr[i];
            coll.add(new KeyImpl(tm.getTModelKey()));
        }

        bulk.setCollection(coll);
        bulk.setExceptions(exceptions);
View Full Code Here

      List<TModelInfo> tiList = tInfos.getTModelInfo();
      if (tiList == null || tiList.size() == 0)
        Assert.fail("No result from find tModel operation");
      TModelInfo tiOut = tiList.get(0);
     
      TModel tmIn = (TModel)EntityCreator.buildFromDoc(TckTModel.JOE_PUBLISHER_TMODEL_XML, "org.uddi.api_v3");
     
      assertEquals(tmIn.getTModelKey(), tiOut.getTModelKey());
      assertEquals(tmIn.getName().getLang(), tiOut.getName().getLang());
      assertEquals(tmIn.getName().getValue(), tiOut.getName().getValue());

      TckValidator.checkDescriptions(tmIn.getDescription(), tiOut.getDescription());
    }
    catch(Exception e) {
      logger.error(e.getMessage(), e);
      Assert.fail("No exception should be thrown.");
    }
View Full Code Here

    sp.getPublisher().add(p);
    sp.setAuthInfo(rootAuthToken.getAuthInfo());
    juddiApi.savePublisher(sp);
   
    //Joe should have a keyGenerator
    TModel keyGenerator = new TModel();
    keyGenerator.setTModelKey("uddi:uddi.joepublisher.com:keygenerator");
    Name name = new Name();
    name.setValue("Joe Publisher's Key Generator");
    keyGenerator.setName(name);
    Description description = new Description();
    description.setValue("This is the key generator for Joe Publisher's UDDI entities!");
    keyGenerator.getDescription().add(description);
    OverviewDoc overviewDoc = new OverviewDoc();
    OverviewURL overviewUrl = new OverviewURL();
    overviewUrl.setUseType("text");
    overviewUrl.setValue("http://uddi.org/pubs/uddi_v3.htm#keyGen");
    overviewDoc.setOverviewURL(overviewUrl);
    keyGenerator.getOverviewDoc().add(overviewDoc);
    CategoryBag categoryBag = new CategoryBag();
    KeyedReference keyedReference = new KeyedReference();
    keyedReference.setKeyName("uddi-org:types:keyGenerator");
    keyedReference.setKeyValue("keyGenerator");
    keyedReference.setTModelKey("uddi:uddi.org:categorization:types");
    categoryBag.getKeyedReference().add(keyedReference);
    keyGenerator.setCategoryBag(categoryBag);
    clerk.register(keyGenerator);
  }
View Full Code Here

      //  a tModelKey that starts with uddi:<something>:keygenerator - recommended all lower case

            String key = GetAuthKey("uddi", "uddi", AuthStyle.UDDI_AUTH);
            SaveTModel st = new SaveTModel();
            st.setAuthInfo(key);
            TModel tm = new TModel();
            tm.setName(new Name());
            tm.getName().setValue("My Company's Keymodel generator");
            tm.getName().setLang("en");
            tm.setCategoryBag(new CategoryBag());
            KeyedReference kr = new KeyedReference();
            kr.setTModelKey("uddi:uddi.org:categorization:types");
            kr.setKeyName("uddi-org:keyGenerator");
            kr.setKeyValue("keyGenerator");
            tm.getCategoryBag().getKeyedReference().add(kr);
            tm.setTModelKey("uddi:www.mycoolcompany.com:keygenerator");
            st.getTModel().add(tm);
            TModelDetail saveTModel = publish.saveTModel(st);
            System.out.println("Creation of Partition Success!");

            tm = new TModel();
            tm.setName(new Name());
            tm.getName().setValue("My Company's Department");
            tm.getName().setLang("en");
            tm.setTModelKey("uddi:www.mycoolcompany.com:department");
            st.getTModel().add(tm);
            saveTModel = publish.saveTModel(st);
            System.out.println("Creation of tModel Department Success!");
           
             tm = new TModel();
            tm.setName(new Name());
            tm.getName().setValue("My Company's Authentication Method");
            tm.getName().setLang("en");
            tm.setTModelKey("uddi:www.mycoolcompany.com:authmode");
            st.getTModel().add(tm);
            saveTModel = publish.saveTModel(st);
            System.out.println("Creation of tModel Auth Mode Success!");

View Full Code Here

        new FatalErrorException(new ErrorMessage("errors.install.AlreadyInstalled"));
     
     
      String rootPublisherStr = config.getString(Property.JUDDI_ROOT_PUBLISHER);
      String fileRootTModelKeygen = rootPublisherStr + FILE_TMODELKEYGEN;
      TModel rootTModelKeyGen = (TModel)buildInstallEntity(fileRootTModelKeygen, "org.uddi.api_v3", config);
      String fileRootBusinessEntity = rootPublisherStr + FILE_BUSINESSENTITY;
      org.uddi.api_v3.BusinessEntity rootBusinessEntity = (org.uddi.api_v3.BusinessEntity)buildInstallEntity(fileRootBusinessEntity, "org.uddi.api_v3",config);
     
      String rootPartition = getRootPartition(rootTModelKeyGen);
      String nodeId = getNodeId(rootBusinessEntity.getBusinessKey(), rootPartition);
     
      String fileRootPublisher = rootPublisherStr + FILE_PUBLISHER;
      if (!alreadyInstalled) {
        log.info("Loading the root Publisher from file " + fileRootPublisher);
     
        rootPublisher = installPublisher(em, fileRootPublisher, config);
        installRootPublisherKeyGen(em, rootTModelKeyGen, rootPartition, rootPublisher, nodeId);
        rootBusinessEntity.setBusinessKey(nodeId);
        installBusinessEntity(true, em, rootBusinessEntity, rootPublisher, rootPartition, config);
      } else {
        log.debug("juddi.seed.always reapplies all seed files except for the root data.");
      }
     
      List<String> juddiPublishers = getPublishers(config);
      for (String publisherStr : juddiPublishers) {
        String filePublisher = publisherStr + FILE_PUBLISHER;
        String fileTModelKeygen = publisherStr + FILE_TMODELKEYGEN;
        TModel tModelKeyGen = (TModel)buildInstallEntity(fileTModelKeygen, "org.uddi.api_v3", config);
        String fileBusinessEntity = publisherStr + FILE_BUSINESSENTITY;
        org.uddi.api_v3.BusinessEntity businessEntity = (org.uddi.api_v3.BusinessEntity)buildInstallEntity(fileBusinessEntity, "org.uddi.api_v3",config);
        UddiEntityPublisher publisher = installPublisher(em, filePublisher, config);
        if (publisher==null) {
          throw new ConfigurationException("File " + filePublisher + " not found.");
View Full Code Here

TOP

Related Classes of org.uddi.api_v2.TModel

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.