01: /*
02: * RegistrySSOAdapter.java
03: *
04: * Created on August 3, 2005, 8:06 PM
05: *
06: * To change this template, choose Tools | Options and locate the template under
07: * the Source Creation and Management node. Right-click the template and choose
08: * Open. You can then make changes to the template in the Source Editor.
09: */
10: package com.sun.portal.wsrp.common.registry;
11:
12: import java.util.Properties;
13: import java.util.logging.Level;
14: import java.util.logging.Logger;
15:
16: import com.sun.portal.log.common.PortalLogger;
17: import com.sun.ssoadapter.AbstractSSOAdapter;
18: import com.iplanet.sso.SSOTokenEvent;
19:
20: public class RegistrySSOAdapter extends AbstractSSOAdapter {
21:
22: private boolean connected = false;
23: private RegistryManager regManager;
24: private static Logger logger = PortalLogger
25: .getLogger(RegistrySSOAdapter.class);
26:
27: public void ssoTokenChanged(SSOTokenEvent evt) {
28: connected = false;
29: }
30:
31: private boolean isConnected() {
32: return connected;
33: }
34:
35: public Object getConnection() {
36: if (isConnected())
37: return regManager;
38: try {
39: Properties prop = getProperties();
40: RegistryConfiguration regconf = new RegistryConfiguration(
41: prop);
42: regManager = RegistryManagerFactory.getInstance()
43: .getRegistryManager(RegistryConstants.TYPE_EBXML,
44: regconf);
45: } catch (Exception e) {
46: logger.log(Level.SEVERE, "PSWS_CSPWCR0001", e);
47: }
48: if (regManager != null) {
49: connected = true;
50: } else {
51: logger.log(Level.WARNING, "PSWS_CSPWCR0001");
52: }
53: return regManager;
54: }
55:
56: public boolean closeConnection() {
57: connected = false;
58: return true;
59: }
60:
61: }
|