Project

General

Profile

« Previous | Next » 

Revision 2683

Added by sgarg over 18 years ago

Added support in the metacat client for the new function added to MetaCatServlet

View differences:

src/edu/ucsb/nceas/metacat/client/MetacatClient.java
102 102
        }
103 103
        return response;
104 104
    }
105
    
106
    /**
107
     *  Method used to log in to a metacat server. Implementations will need
108
     *  to cache a cookie value to make the session persistent.  Each time a
109
     *  call is made to one of the other methods (e.g., read), the cookie will
110
     *  need to be passed back to the metacat server along with the request.
111
     *
112
     *  @param username   the username of the user, like an LDAP DN
113
     *  @param password   the password for that user for authentication
114
     *  @return the response string from metacat in XML format
115
     *  @throws MetacatAuthException when the username/password could
116
     *                    not be authenticated
117
     */
118
    public String getloggedinuserinfo() throws MetacatInaccessibleException
119
    {
120
        Properties prop = new Properties();
121
        prop.put("action", "getloggedinuserinfo");
122
        prop.put("qformat", "xml");
105 123

  
124
        String response = null;
125
        try {
126
            response = sendDataForString(prop, null, null, 0);
127
        } catch (Exception e) {
128
            throw new MetacatInaccessibleException(e.getMessage());
129
        }
130

  
131
        return response;
132
    }
133

  
106 134
    /**
107 135
     *  Method used to log out a metacat server. The Metacat server will end
108 136
     *  the session when this call is invoked.
src/edu/ucsb/nceas/metacat/client/Metacat.java
248 248
     * @param String the sessionId from a previously established session
249 249
     */
250 250
    public void setSessionId(String sessionId);
251
    
251

  
252 252
    /**
253
     * Get the logged in user for this session.
254
     *
255
     * @returns the response received from the server for action=getloggeduserinfo 
256
     */
257
    public String getloggedinuserinfo() throws MetacatInaccessibleException;
258

  
259
    /**
253 260
     * The method will return the lasted revision in metacat server 
254 261
     * for a given document id. If some error happent, this method will throw
255 262
     * a exception.   

Also available in: Unified diff