juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svi...@apache.org
Subject cvs commit: ws-juddi/samples/discard_authToken DiscardAuthTokenSample.java
Date Wed, 24 Mar 2004 02:04:46 GMT
sviens      2004/03/23 18:04:46

  Modified:    samples/discard_authToken DiscardAuthTokenSample.java
  Log:
  discard_authToken sample tested and updated.
  
  Revision  Changes    Path
  1.5       +64 -1     ws-juddi/samples/discard_authToken/DiscardAuthTokenSample.java
  
  Index: DiscardAuthTokenSample.java
  ===================================================================
  RCS file: /home/cvs/ws-juddi/samples/discard_authToken/DiscardAuthTokenSample.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DiscardAuthTokenSample.java	16 Mar 2004 14:26:18 -0000	1.4
  +++ DiscardAuthTokenSample.java	24 Mar 2004 02:04:46 -0000	1.5
  @@ -14,6 +14,15 @@
    * limitations under the License.
    */
   
  +import java.util.Properties;
  +import java.util.Vector;
  +
  +import org.apache.juddi.datatype.request.AuthInfo;
  +import org.apache.juddi.datatype.response.AuthToken;
  +import org.apache.juddi.datatype.response.DispositionReport;
  +import org.apache.juddi.datatype.response.ErrInfo;
  +import org.apache.juddi.datatype.response.Result;
  +import org.apache.juddi.error.RegistryException;
   import org.apache.juddi.proxy.RegistryProxy;
   import org.apache.juddi.registry.IRegistry;
   
  @@ -24,10 +33,64 @@
   {
     public static void main(String[] args)
     {
  -    IRegistry registry = new RegistryProxy();
  +    // Option #1 (grabs properties from juddi.properties)
  +    //IRegistry registry = new RegistryProxy();
  +    
  +    // Option #2
  +    Properties props = new Properties();
  +    props.setProperty(RegistryProxy.ADMIN_ENDPOINT_PROPERTY_NAME,"http://localhost:8080/juddi/admin");
  +    props.setProperty(RegistryProxy.INQUIRY_ENDPOINT_PROPERTY_NAME,"http://localhost:8080/juddi/inquiry");
  +    props.setProperty(RegistryProxy.PUBLISH_ENDPOINT_PROPERTY_NAME,"http://localhost:8080/juddi/publish");
  +    props.setProperty(RegistryProxy.SECURITY_PROVIDER_PROPERTY_NAME,"com.sun.net.ssl.internal.ssl.Provider");
  +    props.setProperty(RegistryProxy.PROTOCOL_HANDLER_PROPERTY_NAME,"com.sun.net.ssl.internal.www.protocol");
   
  +    IRegistry registry = new RegistryProxy(props);
  +
  +    String userID = "sviens";
  +    String password = "password";
   
       try
       {
  +      System.out.println("discard_authToken Sample");
  +      System.out.println("------------------------");
  +      System.out.println("userID: "+userID);
  +      System.out.println("password: "+password);
  +      System.out.println("");
  +
  +      AuthToken authToken = registry.getAuthToken(userID,password);
  +      AuthInfo authInfo = authToken.getAuthInfo();
  +      System.out.println("AuthToken: "+authInfo.getValue());
  + 
  +      DispositionReport dispReport = null;
  +      Vector resultVector = null;
  +
  +      dispReport = registry.discardAuthToken(authInfo);
  +      resultVector = dispReport.getResultVector();
  +      if (resultVector != null)
  +      {
  +        Result result = (Result)resultVector.elementAt(0);
  +        ErrInfo errInfo = result.getErrInfo();
  +        int errNo = result.getErrno();
  +        System.out.println("Discard Once    Error Number: "+errNo);
  +      }
  +
  +      try
  +      {
  +        registry.discardAuthToken(authInfo);
  +      }
  +      catch(RegistryException regex)
  +      {
  +        dispReport = regex.getDispositionReport();
  +        resultVector = dispReport.getResultVector();
  +        if (resultVector != null)
  +        {
  +          Result result = (Result)resultVector.elementAt(0);
  +          ErrInfo errInfo = result.getErrInfo();
  +          int errNo = result.getErrno();
  +          System.out.println("Discard Twice   Error Number: "+errNo);
  +        }
  +      }
  +
  +      System.out.println("\ndone.");
       }
       catch(Exception ex)
       {
  
  
  

Mime
View raw message