You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-dev@ws.apache.org by sc...@apache.org on 2005/05/24 20:20:36 UTC

svn commit: r178227 - in /incubator/apollo/trunk/src: java/org/apache/ws/addressing/XmlBeansEndpointReference.java templates/Home.vm

Author: scamp
Date: Tue May 24 11:20:35 2005
New Revision: 178227

URL: http://svn.apache.org/viewcvs?rev=178227&view=rev
Log: (empty)

Modified:
    incubator/apollo/trunk/src/java/org/apache/ws/addressing/XmlBeansEndpointReference.java
    incubator/apollo/trunk/src/templates/Home.vm

Modified: incubator/apollo/trunk/src/java/org/apache/ws/addressing/XmlBeansEndpointReference.java
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/java/org/apache/ws/addressing/XmlBeansEndpointReference.java?rev=178227&r1=178226&r2=178227&view=diff
==============================================================================
--- incubator/apollo/trunk/src/java/org/apache/ws/addressing/XmlBeansEndpointReference.java (original)
+++ incubator/apollo/trunk/src/java/org/apache/ws/addressing/XmlBeansEndpointReference.java Tue May 24 11:20:35 2005
@@ -75,15 +75,16 @@
    public XmlBeansEndpointReference( org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType epr )
    {
       m_xmlObjectEPR       = epr;
+
       if(epr.getAddress()!=null)
           m_address            = epr.getAddress(  ).getStringValue(  );
-      if(epr.getPortType()!=null)
+      if(epr.isSetPortType())
           m_portTypeQName      = epr.getPortType(  ).getQNameValue(  );
-      if(epr.getServiceName()!=null)
+      if(epr.isSetServiceName() && epr.getServiceName(  ).isSetPortName())
           m_servicePortName    = epr.getServiceName(  ).getPortName(  );
-      if(epr.getServiceName()!=null)
+      if(epr.isSetServiceName())
           m_serviceQName       = epr.getServiceName(  ).getQNameValue(  );
-      if(epr.getReferenceProperties()!=null)
+      if(epr.isSetReferenceProperties())
           m_referenceProps = XmlBeanUtils.getChildElements(epr.getReferenceProperties());
    }
 
@@ -97,15 +98,15 @@
       m_xmlObjectEPR       = epr;
       if(epr.getAddress()!=null)
           m_address            = epr.getAddress(  ).getStringValue(  );
-      if(epr.getPortType()!=null)
+      if(epr.isSetPortType())
           m_portTypeQName      = epr.getPortType(  ).getQNameValue(  );
-      if(epr.getServiceName()!=null)
+      if(epr.isSetServiceName() && epr.getServiceName(  ).isSetPortName())
           m_servicePortName    = epr.getServiceName(  ).getPortName(  );
-      if(epr.getServiceName()!=null)
+      if(epr.isSetServiceName() )
           m_serviceQName       = epr.getServiceName(  ).getQNameValue(  );
-      if(epr.getReferenceProperties()!=null)
+      if(epr.isSetReferenceProperties())
           m_referenceProps = XmlBeanUtils.getChildElements(epr.getReferenceProperties());
-      if(epr.getReferenceParameters() != null)
+      if(epr.isSetReferenceParameters())
           m_referenceParameters = XmlBeanUtils.getChildElements(epr.getReferenceParameters());
    }
    /**

Modified: incubator/apollo/trunk/src/templates/Home.vm
URL: http://svn.apache.org/viewcvs/incubator/apollo/trunk/src/templates/Home.vm?rev=178227&r1=178226&r2=178227&view=diff
==============================================================================
--- incubator/apollo/trunk/src/templates/Home.vm (original)
+++ incubator/apollo/trunk/src/templates/Home.vm Tue May 24 11:20:35 2005
@@ -5,6 +5,7 @@
 #set( $endpointServiceName = $generated.ServiceQName)
 #set( $portName = $generated.PortName)
 #set( $portTypeName = $generated.PortTypeQName)
+#set( $resourcekey = $generated.Resourcekey)
 
 package $package;
 
@@ -72,17 +73,32 @@
         Resource resource = null;
         try
         {
-            resource = find( key );
+            resource = find( key ); //attempt to find from the underlying cache
         }
         catch ( ResourceException re )
         {
-            //TODO add any checking for key validity
+            //TODO add any checking for key validity if you plan to create instances here
             
             /**
-             * You can build an EndpointReference for a Resource you create by uncommenting the following code.
+             * Commented below is an example of creating a resource instance, adding its epr and adding to the cache.             
              * Note: You can set the EndpointReference on your Resource using the setter (not in Resource interface)
              */
-            //EndpointReference epr = getEndpointReference(resourceContext.getBaseURL(  ) + "/" + getServiceName().getLocalPart() , key, SPEC_NAMESPACE_SET.getAddressingNamespace());
+
+	    /*
+            try
+	    {
+	        ${capitalServiceName}Resource myresource = (${capitalServiceName}Resource)createInstance(key); //this will create the resource IF it is has default constructor
+		//the next line will create an EPR
+		EndpointReference epr = getEndpointReference(resourceContext.getBaseURL(  ) + "/" + getServiceName().getLocalPart() , key, SPEC_NAMESPACE_SET.getAddressingNamespace());
+		myresource.setEndpointReference(epr); //make sure to set the EPR on your new instance                   		
+		add(key, myresource); //make sure to add your instance to the underlying cache to be found in future requests using find(..)
+	    }
+	    catch (Exception e)
+	    {
+		throw new ResourceException(e);
+	    }                
+	    */
+            
         }
         return resource;
     }



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