You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by jf...@apache.org on 2009/03/20 19:20:14 UTC

svn commit: r756700 - in /webservices/juddi/branches/v3_trunk/juddi-core/src/main: java/org/apache/juddi/api/impl/ java/org/apache/juddi/mapping/ java/org/apache/juddi/validation/ resources/

Author: jfaath
Date: Fri Mar 20 18:20:13 2009
New Revision: 756700

URL: http://svn.apache.org/viewvc?rev=756700&view=rev
Log:
JUDDI-214: fixed

Modified:
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateUDDIApi.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java?rev=756700&r1=756699&r2=756700&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java Fri Mar 20 18:20:13 2009
@@ -482,8 +482,37 @@
 
 	public OperationalInfos getOperationalInfo(GetOperationalInfo body)
 			throws DispositionReportFaultMessage {
-		// TODO Auto-generated method stub
-		return null;
+
+		new ValidateInquiry(null).validateGetOperationalInfo(body);
+		
+		// TODO JUDDI-178: Perform necessary authentication logic
+		@SuppressWarnings("unused")
+		String authInfo = body.getAuthInfo();
+
+		EntityManager em = PersistenceManager.getEntityManager();
+		EntityTransaction tx = em.getTransaction();
+		tx.begin();
+
+		OperationalInfos result = new OperationalInfos();
+		
+		List<String> entityKeyList = body.getEntityKey();
+		for (String entityKey : entityKeyList) {
+			
+			org.apache.juddi.model.UddiEntity modelUddiEntity = em.find(org.apache.juddi.model.UddiEntity.class, entityKey);
+			if (modelUddiEntity == null)
+				throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.EntityNotFound", entityKey));
+			
+			org.uddi.api_v3.OperationalInfo apiOperationalInfo = new org.uddi.api_v3.OperationalInfo();
+			
+			MappingModelToApi.mapOperationalInfo(modelUddiEntity, apiOperationalInfo);
+			
+			result.getOperationalInfo().add(apiOperationalInfo);
+		}
+
+		tx.commit();
+		em.close();
+		
+		return result;
 	}
 
 	public ServiceDetail getServiceDetail(GetServiceDetail body)

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java?rev=756700&r1=756699&r2=756700&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java Fri Mar 20 18:20:13 2009
@@ -18,15 +18,25 @@
 package org.apache.juddi.mapping;
 
 import java.util.Collections;
+import java.util.Date;
 import java.util.List;
 
 import javax.xml.bind.JAXBElement;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
 
+import org.apache.juddi.error.ErrorMessage;
+import org.apache.juddi.error.FatalErrorException;
 import org.apache.juddi.model.OverviewDoc;
+import org.apache.juddi.model.UddiEntity;
 import org.uddi.api_v3.CompletionStatus;
 import org.uddi.api_v3.ObjectFactory;
+import org.uddi.api_v3.OperationalInfo;
 import org.uddi.v3_service.DispositionReportFaultMessage;
 
+import com.ibm.icu.util.Calendar;
+
 /**
  * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
  * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
@@ -704,4 +714,40 @@
 		apiRelatedBusinessInfo.getSharedRelationships().add(sharedRelationships);
 	}
 
+	public static void mapOperationalInfo(UddiEntity modelUddiEntity,
+										  OperationalInfo apiOperationalInfo)
+				   throws DispositionReportFaultMessage {
+		
+		apiOperationalInfo.setCreated(convertDateToXMLGregorianCalendar(modelUddiEntity.getCreated()));
+		apiOperationalInfo.setModified(convertDateToXMLGregorianCalendar(modelUddiEntity.getModified()));
+		apiOperationalInfo.setModifiedIncludingChildren(convertDateToXMLGregorianCalendar(modelUddiEntity.getModifiedIncludingChildren()));
+		apiOperationalInfo.setNodeID(modelUddiEntity.getNodeId());
+		apiOperationalInfo.setAuthorizedName(modelUddiEntity.getAuthorizedName());
+	}
+
+	public static XMLGregorianCalendar convertDateToXMLGregorianCalendar(Date date) throws DispositionReportFaultMessage {
+		XMLGregorianCalendar result = null;
+		try { 
+			Calendar calendar = Calendar.getInstance();
+			calendar.setTime(date);
+			
+			DatatypeFactory df = DatatypeFactory.newInstance();
+			result = df.newXMLGregorianCalendar(calendar.get(Calendar.YEAR), 
+												calendar.get(Calendar.MONTH), 
+												calendar.get(Calendar.DAY_OF_MONTH), 
+												calendar.get(Calendar.HOUR), 
+												calendar.get(Calendar.MINUTE), 
+												calendar.get(Calendar.SECOND), 
+												calendar.get(Calendar.MILLISECOND), 
+												0);
+		}
+		catch(DatatypeConfigurationException ce) { 
+			throw new FatalErrorException(new ErrorMessage("errors.Unspecified"));
+		}
+		
+		return result;
+		
+	}
+
+	
 }

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java?rev=756700&r1=756699&r2=756700&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateInquiry.java Fri Mar 20 18:20:13 2009
@@ -25,6 +25,7 @@
 
 import org.apache.juddi.api.datatype.GetPublisherDetail;
 import org.uddi.api_v3.GetBusinessDetail;
+import org.uddi.api_v3.GetOperationalInfo;
 import org.uddi.api_v3.GetServiceDetail;
 import org.uddi.api_v3.GetBindingDetail;
 import org.uddi.api_v3.GetTModelDetail;
@@ -150,6 +151,26 @@
 				throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
 		}
 	}
+
+	public void validateGetOperationalInfo(GetOperationalInfo body) throws DispositionReportFaultMessage {
+
+		// No null input
+		if (body == null)
+			throw new FatalErrorException(new ErrorMessage("errors.NullInput"));
+		
+		// No null or empty list
+		List<String> entityKeyList = body.getEntityKey();
+		if (entityKeyList == null || entityKeyList.size() == 0)
+			throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.NoKeys"));
+
+		HashSet<String> dupCheck = new HashSet<String>();
+		for (String entityKey : entityKeyList) {
+			boolean inserted = dupCheck.add(entityKey);
+			if (!inserted)
+				throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.DuplicateKey", entityKey));
+		}
+	}
+	
 	
 	public void validateFindBusiness(FindBusiness body) throws DispositionReportFaultMessage  {
 		// No null input

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateUDDIApi.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateUDDIApi.java?rev=756700&r1=756699&r2=756700&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateUDDIApi.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateUDDIApi.java Fri Mar 20 18:20:13 2009
@@ -17,6 +17,7 @@
 
 package org.apache.juddi.validation;
 
+
 import org.apache.juddi.error.ErrorMessage;
 import org.apache.juddi.error.UnsupportedException;
 import org.apache.juddi.model.UddiEntityPublisher;
@@ -44,4 +45,5 @@
 	public static void unsupportedAPICall() throws DispositionReportFaultMessage {
 		throw new UnsupportedException(new ErrorMessage("errors.Unsupported"));
 	}
+	
 }

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties?rev=756700&r1=756699&r2=756700&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties Fri Mar 20 18:20:13 2009
@@ -96,7 +96,7 @@
 errors.bindingtemplate.NullInput=The bindingTemplate structure cannot be blank
 errors.bindingtemplate.NoAccessPoint=A binding template must contain an access point
 errors.tmodel.NullInput=The tModel structure cannot be blank
-errors.tmodel.NoAccessPoint=A tModel must contain a name
+errors.tmodel.NoName=A tModel must contain a name
 errors.tmodel.keygenerator.BadCategory=A Key Generator tModel must have exactly one 'types' category whose value is 'keyGenerator'
 errors.tmodel.keygenerator.RootKeyGen=A Key Generator cannot be added for the root publisher
 errors.pubassertion.NullInput=The publisherAssertion structure cannot be blank
@@ -149,8 +149,8 @@
 
 #-- jUDDI-specific publisher messages
 errors.savepublisher.NoInput=At least one Publisher must be provided
-errors.savepublisher.AdminReqd=An account must have adminstrative privileges to save publishers
-errors.deletepublisher.AdminReqd=An account must have adminstrative privileges to delete publishers
+errors.savepublisher.AdminReqd=An account must have administrative privileges to save publishers
+errors.deletepublisher.AdminReqd=An account must have administrative privileges to delete publishers
 errors.publisher.NullInput=The Publisher structure cannot be blank
 errors.publisher.NoAuthorizedName=A valid publisher authorized name was not specified
 errors.publisher.NoPublisherName=A valid publisher name was not specified



---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org