public static org.uddi.api_v3.TModel MapTModel(org.uddi.api_v2.TModel be) { if (be == null) { return null; } TModel item = new org.uddi.api_v3.TModel(); item.setTModelKey(be.getTModelKey()); item.setName(new Name(be.getName().getValue(), be.getName().getLang())); item.setCategoryBag(MapCategoryBag(be.getCategoryBag())); item.setIdentifierBag(MapIdentBag(be.getIdentifierBag())); item.getDescription().addAll(MapDescription(be.getDescription())); OverviewDoc MapOverviewDoc = MapOverviewDoc(be.getOverviewDoc()); if (MapOverviewDoc != null) { item.getOverviewDoc().add(MapOverviewDoc); } return item; }
public static org.uddi.api_v2.TModel MapTModel(org.uddi.api_v3.TModel be) { if (be == null) { return null; } TModel item = new org.uddi.api_v2.TModel(); item.setTModelKey(be.getTModelKey()); item.setName(new Name(be.getName().getValue(), be.getName().getLang())); item.setCategoryBag(MapCategoryBag(be.getCategoryBag())); item.getDescription().addAll(MapDescription(be.getDescription())); item.setIdentifierBag(MapIdentBag(be.getIdentifierBag())); item.setOverviewDoc(MapOverviewDoc(be.getOverviewDoc())); return item; }
void validateNotSigned(org.uddi.api_v3.TModel item) throws ValueNotAllowedException { if (item == null) { return; } if (item.getTModelKey() == null && !item.getSignature().isEmpty()) { throw new ValueNotAllowedException(new ErrorMessage("errors.entity.SignedButNoKey", "tModelKey")); } }
@Override public void validateValuesTModel(List<TModel> items) throws DispositionReportFaultMessage { if (items == null) { return; } for (int i = 0; i < items.size(); i++) { if (items.get(i).getCategoryBag() != null) { validatedValuesKeyRef(items.get(i).getCategoryBag().getKeyedReference(), "tModel(" + i + ").categoryBag."); validatedValuesKeyRefGrp(items.get(i).getCategoryBag().getKeyedReferenceGroup(), "tModel(" + i + ").categoryBag."); } if (items.get(i).getIdentifierBag() != null) { validatedValuesKeyRef(items.get(i).getIdentifierBag().getKeyedReference(), "tModel(" + i + ").identifierBag."); } } }
TModel tModel = new TModel(); tModel.setTModelKey(keyDomainURI + serviceName.getLocalPart() + "Process"); tModel.setName(name); OverviewDoc overviewDoc = new OverviewDoc(); overviewDoc.setOverviewURL(overviewURL); tModel.getOverviewDoc().add(overviewDoc); tModel.setCategoryBag(categoryBag);
public static void mapTModel(org.apache.juddi.model.Tmodel modelTModel, org.uddi.api_v3.TModel apiTModel) throws DispositionReportFaultMessage { apiTModel.setTModelKey(modelTModel.getEntityKey()); org.uddi.api_v3.Name apiName = new org.uddi.api_v3.Name(); apiName.setValue(modelTModel.getName()); apiName.setLang(modelTModel.getLangCode()); apiTModel.setName(apiName); apiTModel.setDeleted(modelTModel.getDeleted()); mapTModelDescriptions(modelTModel.getTmodelDescrs(), apiTModel.getDescription()); mapTModelIdentifiers(modelTModel.getTmodelIdentifiers(), apiTModel.getIdentifierBag(), apiTModel); apiTModel.setCategoryBag(mapCategoryBag(modelTModel.getCategoryBag(), apiTModel.getCategoryBag())); mapOverviewDocs(modelTModel.getOverviewDocs(), null, apiTModel); mapSignature(modelTModel.getSignatures(), apiTModel.getSignature()); }
/** * * @param apiTModel * @param modelTModel * @throws DispositionReportFaultMessage */ public static void mapTModel(org.uddi.api_v3.TModel apiTModel, org.apache.juddi.model.Tmodel modelTModel) throws DispositionReportFaultMessage { modelTModel.setEntityKey(apiTModel.getTModelKey()); modelTModel.setName(apiTModel.getName().getValue()); modelTModel.setLangCode(apiTModel.getName().getLang()); modelTModel.setDeleted(apiTModel.isDeleted()); mapTModelDescriptions(apiTModel.getDescription(), modelTModel.getTmodelDescrs(), modelTModel); mapTModelIdentifiers(apiTModel.getIdentifierBag(), modelTModel.getTmodelIdentifiers(), modelTModel); if (apiTModel.getCategoryBag() != null) { modelTModel.setCategoryBag(new org.apache.juddi.model.TmodelCategoryBag(modelTModel)); mapCategoryBag(apiTModel.getCategoryBag(), modelTModel.getCategoryBag()); } mapTModelOverviewDocs(apiTModel.getOverviewDoc(), modelTModel.getOverviewDocs(), modelTModel); mapTmodelSignatures(apiTModel.getSignature(), modelTModel); }
TModel tm = new TModel(); tm.setName(new Name()); tm.getName().setValue(DescriptiveName); tm.getName().setLang(DescriptiveNameLanguage); tm.setCategoryBag(new CategoryBag()); KeyedReference kr = new KeyedReference(); kr.setTModelKey(UDDIConstants.KEY_GENERATOR_TMODEL); kr.setKeyName(UDDIConstants.KEY_GENERATOR); kr.setKeyValue(UDDIConstants.KEY_GENERATOR_VALUE); tm.getCategoryBag().getKeyedReference().add(kr); OverviewDoc overviewDoc = new OverviewDoc(); OverviewURL overviewUrl = new OverviewURL(); overviewUrl.setValue("http://uddi.org/pubs/uddi_v3.htm#keyGen"); overviewDoc.setOverviewURL(overviewUrl); tm.getOverviewDoc().add(overviewDoc); tm.setTModelKey(partitionName.toLowerCase()); return tm;
public TModel saveTModel(String authInfo, TModel tmIn, boolean force) { boolean exists = false; GetTModelDetail gt1 = new GetTModelDetail(); gt1.getTModelKey().add(tmIn.getTModelKey()); try { TModelDetail td1 = inquiry.getTModelDetail(gt1); if (td1 != null && !td1.getTModel().isEmpty()) { if (!td1.getTModel().get(0).isDeleted()) { exists = true; } else { logger.info("The tModel with key " + tmIn.getTModelKey() + " exists already, but is flagged as deleted. Overwritting"); keyscreated.add(tmIn.getTModelKey()); gt.getTModelKey().add(tmIn.getTModelKey()); TModelDetail td = inquiry.getTModelDetail(gt); List<org.uddi.api_v3.TModel> tmOutList = td.getTModel(); org.uddi.api_v3.TModel tmOut = tmOutList.get(0); assertEquals(tmIn.getTModelKey().toLowerCase(), tmOut.getTModelKey()); assertEquals(tmIn.getName().getLang(), tmOut.getName().getLang()); assertEquals(tmIn.getName().getValue(), tmOut.getName().getValue()); TckValidator.checkDescriptions(tmIn.getDescription(), tmOut.getDescription()); TckValidator.checkCategories(tmIn.getCategoryBag(), tmOut.getCategoryBag()); for (OverviewDoc overviewDoc : tmIn.getOverviewDoc()) { TckValidator.checkOverviewDocs(overviewDoc, tmOut.getOverviewDoc()); logger.info("The TModel " + tmIn.getTModelKey() + " saved"); logger.info("The TModel " + tmIn.getTModelKey() + " exists already, skipping");
tModelInstanceInfo.getDescription().add(desc); TModel tModel = new TModel(); Name environmentName = new Name(); environmentName.setValue(environment); tModel.setName(environmentName); endpointUrl.setValue(endpoint); overviewDoc.setOverviewURL(endpointUrl); tModel.getOverviewDoc().add(overviewDoc); tModelInstanceInfo.setTModelKey(tModelDetail.getTModel().iterator().next().getTModelKey()); tModelInstanceDetails.getTModelInstanceInfo().add(tModelInstanceInfo);
return null; if (ref == null || ref.getTModelKey()==null) { return null; log.debug("looking for key=" + key + " from tModel " + ref.getTModelKey()); List<String> ret = new ArrayList<String>(); if (ref.getCategoryBag() != null) { for (int i = 0; i < ref.getCategoryBag().getKeyedReference().size(); i++) { if (ref.getCategoryBag().getKeyedReference().get(i).getTModelKey().equalsIgnoreCase(key)) { log.debug("found reference for key=" + key + " from tModel " + ref.getTModelKey() + " validation endpoint " + ref.getCategoryBag().getKeyedReference().get(i).getKeyValue()); ret.add(ref.getCategoryBag().getKeyedReference().get(i).getKeyValue()); for (int i = 0; i < ref.getCategoryBag().getKeyedReferenceGroup().size(); i++) { for (int k = 0; k < ref.getCategoryBag().getKeyedReferenceGroup().get(i).getKeyedReference().size(); k++) { if (ref.getCategoryBag().getKeyedReferenceGroup().get(i).getKeyedReference().get(k).getTModelKey().equalsIgnoreCase(key)) { log.debug("found reference for key=" + key + " from tModel " + ref.getTModelKey() + " validation endpoint " + ref.getCategoryBag().getKeyedReferenceGroup().get(i).getKeyedReference().get(k).getKeyValue()); ret.add(ref.getCategoryBag().getKeyedReferenceGroup().get(i).getKeyedReference().get(k).getKeyValue()); if (ref.getIdentifierBag() != null) { for (int i = 0; i < ref.getIdentifierBag().getKeyedReference().size(); i++) { if (ref.getIdentifierBag().getKeyedReference().get(i).getTModelKey().equalsIgnoreCase(key)) { log.debug("found reference for key=" + key + " from tModel " + ref.getTModelKey() + " validation endpoint " + ref.getIdentifierBag().getKeyedReference().get(i).getKeyValue()); ret.add(ref.getIdentifierBag().getKeyedReference().get(i).getKeyValue());
t = new TModel(); t.setTModelKey(PublicationConstants.tmodelKeyGen); n = new Name(); n.setLang(PublicationConstants.lang); n.setValue(PublicationConstants.tmodelKeyGenText); t.setName(n); d = new Description(); d.setLang(PublicationConstants.lang); d.setValue(PublicationConstants.tmodelKeyGenText); t.getDescription().add(d); c = new CategoryBag(); c.getKeyedReference().add((keygen)); t.setCategoryBag(c); request.getTModel().add(t); try { t = new TModel(); t.setTModelKey(PublicationConstants.tmodelSLAViolations5min); n = new Name(); n.setLang(PublicationConstants.lang); n.setValue(PublicationConstants.tmodelSLAViolationsDescription5min); t.setName(n); d = new Description(); d.setLang(PublicationConstants.lang); d.setValue(PublicationConstants.tmodelSLAViolationsText); t.getDescription().add(d); c = new CategoryBag(); c.getKeyedReference().add((shared)); t.setCategoryBag(c);
private static void installTModels(EntityManager em, List<org.uddi.api_v3.TModel> apiTModelList, UddiEntityPublisher publisher, String nodeId) throws DispositionReportFaultMessage { if (apiTModelList != null) { for (org.uddi.api_v3.TModel apiTModel : apiTModelList) { String tModelKey = apiTModel.getTModelKey(); if (tModelKey.toUpperCase().endsWith(KeyGenerator.KEYGENERATOR_SUFFIX.toUpperCase())) { installPublisherKeyGen(em, apiTModel, publisher, nodeId); } else { org.apache.juddi.model.Tmodel modelTModel = new org.apache.juddi.model.Tmodel(); apiTModel.setTModelKey(apiTModel.getTModelKey().toLowerCase()); MappingApiToModel.mapTModel(apiTModel, modelTModel); modelTModel.setAuthorizedName(publisher.getAuthorizedName()); Date now = new Date(); modelTModel.setCreated(now); modelTModel.setModified(now); modelTModel.setModifiedIncludingChildren(now); modelTModel.setNodeId(nodeId); em.persist(modelTModel); SaveTModel stm = new SaveTModel(); stm.getTModel().add(apiTModel); ReplicationNotifier.enqueue(UDDIPublicationImpl.getChangeRecord(modelTModel, apiTModel, nodeId)); } } } }
public static Concept getConcept(TModel tmodel, LifeCycleManager lifeCycleManager) throws JAXRException { Concept concept = new ConceptImpl(lifeCycleManager); concept.setKey(lifeCycleManager.createKey(tmodel.getTModelKey())); concept.setName(lifeCycleManager.createInternationalString(getLocale(tmodel.getName().getLang()), tmodel.getName().getValue())); Description desc = getDescription(tmodel); if (desc != null) { concept.setDescription(lifeCycleManager.createInternationalString(getLocale(desc.getLang()), desc.getValue())); } concept.addExternalIdentifiers(getExternalIdentifiers(tmodel.getIdentifierBag(), lifeCycleManager)); concept.addClassifications(getClassifications(tmodel.getCategoryBag(), lifeCycleManager)); return concept; }
public Set<TModel> createWADLTModels(String wadlURL, Application app) throws Exception { Set<TModel> tModels = new HashSet<TModel>(); TModel binding = new TModel(); binding.setTModelKey(keyDomainURI + "binding"); sName.setValue(keyDomainURI + " Binding tModel"); binding.setName(sName); tModels.add(binding); binding = new TModel(); binding.setTModelKey(keyDomainURI + "rest"); sName.setValue(keyDomainURI + " Rest tModel"); binding.setName(sName); tModels.add(binding);
private boolean ContainsKey(List<TModel> items, String keyValue) { for (int i = 0; i < items.size(); i++) { if (items.get(i).getTModelKey().equalsIgnoreCase(keyValue)) { return true; } } return false; }
public void findTModel(String findQualifier) { try { FindTModel body = (FindTModel)EntityCreator.buildFromDoc(FIND_TMODEL_XML, "org.uddi.api_v3"); if (findQualifier!=null) body.getFindQualifiers().getFindQualifier().add(findQualifier); TModelList result = inquiry.findTModel(body); if (result == null) Assert.fail("Null result from find tModel operation"); TModelInfos tInfos = result.getTModelInfos(); if (tInfos == null) Assert.fail("No result from find tModel operation"); 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."); } } }
/** * Create an instance of {@link TModel } * */ public TModel createTModel() { return new TModel(); }
public static void validateUDDIv3KeyGeneratorTModel(org.uddi.api_v3.TModel tModel) throws DispositionReportFaultMessage { if (tModel == null) throw new ValueNotAllowedException(new ErrorMessage("errors.tmodel.NullInput")); validateUDDIv3KeyGeneratorKey(tModel.getTModelKey()); // A key generator key should have exactly one category and it's key value should be 'keyGenerator' org.uddi.api_v3.CategoryBag categories = tModel.getCategoryBag(); if (categories != null) { List<org.uddi.api_v3.KeyedReference> elems = categories.getKeyedReference(); if (elems != null && elems.size() == 1) { org.uddi.api_v3.KeyedReference elem = elems.get(0); if (elem != null) { if (elem instanceof org.uddi.api_v3.KeyedReference) { String keyedValue = elem.getKeyValue(); if (keyedValue != null) { if (keyedValue.equalsIgnoreCase(KeyGenerator.KEYGENERATOR_SUFFIX)) return; } } } } } throw new ValueNotAllowedException(new ErrorMessage("errors.tmodel.keygenerator.BadCategory")); }
public static void mapOverviewDocs(List<org.apache.juddi.model.OverviewDoc> modelOverviewDocs, org.uddi.api_v3.InstanceDetails apiInstanceDetails, org.uddi.api_v3.TModel apiTModel) { for (OverviewDoc modelOverviewDoc : modelOverviewDocs) { org.uddi.api_v3.OverviewDoc apiOverviewDoc = new org.uddi.api_v3.OverviewDoc(); //Descriptions List<org.apache.juddi.model.OverviewDocDescr> overviewDocDescrList = modelOverviewDoc.getOverviewDocDescrs(); for (org.apache.juddi.model.OverviewDocDescr overviewDocDescr : overviewDocDescrList) { org.uddi.api_v3.Description apiDesc = new org.uddi.api_v3.Description(); apiDesc.setLang(overviewDocDescr.getLangCode()); apiDesc.setValue(overviewDocDescr.getDescr()); apiOverviewDoc.getDescription().add(apiDesc); } //OverviewURL org.uddi.api_v3.OverviewURL apiOverviewURL = new org.uddi.api_v3.OverviewURL(); apiOverviewURL.setUseType(modelOverviewDoc.getOverviewUrlUseType()); apiOverviewURL.setValue(modelOverviewDoc.getOverviewUrl()); apiOverviewDoc.setOverviewURL(apiOverviewURL); //Set the entity on the apiOverviewDoc if (apiInstanceDetails != null) { apiInstanceDetails.getOverviewDoc().add(apiOverviewDoc); } else { apiTModel.getOverviewDoc().add(apiOverviewDoc); } } }