Source Code Cross Referenced for SRA.java in  » Portal » Open-Portal » com » sun » portal » sra » admin » mbeans » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » Open Portal » com.sun.portal.sra.admin.mbeans 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        package com.sun.portal.sra.admin.mbeans;
0002:
0003:        import java.io.File;
0004:        import java.io.IOException;
0005:        import java.io.FileInputStream;
0006:        import java.util.*;
0007:        import java.util.logging.Logger;
0008:        import java.util.logging.Level;
0009:
0010:        import com.sun.portal.log.common.PortalLogger;
0011:        import com.sun.portal.sra.admin.context.GWPropertyContext;
0012:        import com.sun.portal.sra.admin.context.NLPPropertyContext;
0013:        import com.sun.portal.sra.admin.context.RWPPropertyContext;
0014:        import com.sun.portal.admin.common.SRAAttributes;
0015:        import com.sun.portal.admin.common.context.PSConfigContext;
0016:        import com.sun.portal.admin.common.context.PortalDomainContext;
0017:        import com.sun.portal.admin.common.context.PortalDomainContextException;
0018:        import com.sun.portal.admin.common.PSMBeanException;
0019:        import com.sun.portal.admin.common.util.AdminUtil;
0020:        import com.sun.portal.admin.server.AdminServerUtil;
0021:        import com.sun.portal.admin.server.mbeans.PSResource;
0022:        import com.sun.portal.sra.admin.attribute.handlers.GatewayAttributeOperations;
0023:        import com.sun.portal.admin.common.AttrOptionConstants;
0024:        import com.sun.portal.sra.admin.context.ConfigurationFileFilter;
0025:        import com.sun.portal.sra.admin.mbeans.exceptions.NoSuchSraServerTypeException;
0026:        import com.sun.portal.fabric.util.os.OSTasksFactory;
0027:        import com.sun.portal.fabric.util.os.OSTasks;
0028:        import com.sun.portal.fabric.util.FileUtil;
0029:        import com.sun.identity.sm.ServiceConfigManager;
0030:        import com.sun.identity.sm.ServiceConfig;
0031:        import com.sun.identity.sm.SMSException;
0032:        import com.iplanet.sso.SSOException;
0033:        import com.iplanet.am.sdk.AMStoreConnection;
0034:        import com.iplanet.am.sdk.AMOrganization;
0035:
0036:        import com.sun.portal.util.Platform;
0037:
0038:        import javax.management.ObjectName;
0039:        import javax.management.MalformedObjectNameException;
0040:
0041:        /**
0042:         * Author: fa151985 Date: Feb 25, 2005 Time: 2:42:18 PM
0043:         */
0044:        public class SRA extends PSResource implements  SRAMBean {
0045:
0046:            private static final String STRING_OFF = "off";
0047:
0048:            private static final String STRING_ON = "on";
0049:
0050:            private static String SERVICE_NAME = "srapGatewayService";
0051:
0052:            private static String SUB_SCHEMA_NAME = "Gateway-Profiles";
0053:
0054:            private static String SUB_SCHEMA_ID = "One-Instance-Profile";
0055:
0056:            public static final String PROP_NETLET_PROXY_PORT = "netletproxy.port";
0057:
0058:            public static final String PROP_REWRITER_PROXY_PORT = "rewriterproxy.port";
0059:
0060:            private static Logger _logger = PortalLogger.getLogger(SRA.class);
0061:
0062:            public void init(PSConfigContext cc, PortalDomainContext pdc,
0063:                    List path) {
0064:                super .init(cc, pdc, path);
0065:            }
0066:
0067:            public Boolean CreateGWInstance(Properties GWConfigProperties)
0068:                    throws PSMBeanException {
0069:                try {
0070:                    System.setProperty("sra.log.user.password",
0071:                            GWConfigProperties
0072:                                    .getProperty("sra.log.user.password"));
0073:                    System
0074:                            .setProperty(
0075:                                    "certificate.database.password",
0076:                                    GWConfigProperties
0077:                                            .getProperty("certificate.database.password"));
0078:                    String portalhost = GWConfigProperties
0079:                            .getProperty("primary.portal.host");
0080:                    if (portalhost == null || portalhost.trim().length() == 0) {
0081:                        portalhost = GWConfigProperties
0082:                                .getProperty("portal.server.hostname");
0083:                    }
0084:                    String profile = GWConfigProperties
0085:                            .getProperty("gateway.profile.name");
0086:                    if (checkProfileExists(portalhost, profile).booleanValue()) {
0087:                        if (!isSRAOn()) {
0088:                            GWConfigProperties.setProperty(
0089:                                    GWPropertyContext.DO_START_AFTER_INSTALL,
0090:                                    "n");
0091:                            _logger.log(Level.FINEST,
0092:                                    "PSSR_CSPS_ADM_MBEANS104",
0093:                                    new String[] { "Gateway" });
0094:                        }
0095:                        if (SraServerFactory.createServerInstance(
0096:                                SraServer.INSTANCE_TYPE_GATEWAY,
0097:                                GWConfigProperties, cc) != null) {
0098:                            return Boolean.TRUE;
0099:                        }
0100:                    }
0101:                } catch (PSMBeanException e) {
0102:                    throw new PSMBeanException(e.getErrorKey(), e.getTokens());
0103:                } catch (NoSuchSraServerTypeException e) {
0104:                    e.printStackTrace();
0105:                } catch (Exception e) {
0106:                    e.printStackTrace();
0107:                }
0108:                return Boolean.FALSE;
0109:            }
0110:
0111:            private Boolean StartSRAInstance(final String sInstanceName,
0112:                    final String sSRACompDesc, final String sSRACompName,
0113:                    final int sSRACompType) throws PSMBeanException {
0114:
0115:                String instanceName = sInstanceName;
0116:                if (instanceName.trim().equals("")) {
0117:                    instanceName = "default";
0118:                }
0119:
0120:                Boolean bRetVal = Boolean.FALSE;
0121:                try {
0122:
0123:                    if (!isSRAOn()) {
0124:                        String[] token = { sSRACompDesc, instanceName };
0125:                        throw new PSMBeanException(
0126:                                "psadmin.error.sra.switched.off", token);
0127:                    } else if (!isProvisionedForPortal(instanceName)) {
0128:                        String[] token = { instanceName };
0129:                        throw new PSMBeanException(
0130:                                "psadmin.error.sra.notprovisioned", token);
0131:                    } else if (!checkInstanceExists(instanceName, sSRACompName)) {
0132:                        String[] token = { instanceName };
0133:                        throw new PSMBeanException(
0134:                                "psadmin.error.sra.create.instanceNotExists",
0135:                                token);
0136:                    } else if (!isProvisionedForPortal(instanceName)) {
0137:                        String[] token = { instanceName };
0138:                        throw new PSMBeanException(
0139:                                "psadmin.error.sra.notprovisioned", token);
0140:                    } else if (!SraServerFactory.startServerInstance(
0141:                            sSRACompType, instanceName, cc)) {
0142:                        String[] token = { instanceName, sSRACompName };
0143:                        throw new PSMBeanException(
0144:                                "psadmin.error.sra.start.instance", token);
0145:                    }
0146:
0147:                    bRetVal = Boolean.TRUE;
0148:                } catch (PSMBeanException e) {
0149:                    throw new PSMBeanException(e.getErrorKey(), e.getTokens());
0150:                } catch (NoSuchSraServerTypeException e) {
0151:                    e.printStackTrace();
0152:                } catch (Exception e) {
0153:                    e.printStackTrace();
0154:                }
0155:
0156:                return bRetVal;
0157:            }
0158:
0159:            private boolean isProvisionedForPortal(String instanceName) {
0160:                try {
0161:                    GatewayAttributeOperations operations = new GatewayAttributeOperations(
0162:                            AdminServerUtil.getSSOToken());
0163:                    Map options = new HashMap();
0164:                    options.put(AttrOptionConstants.OPT_COMPONENT, "gateway");
0165:                    options.put("gateway-profile", instanceName);
0166:                    options.put(AttrOptionConstants.OPT_ATTR_NAME,
0167:                            "sunPortalGatewayNonAuthenticatedURLPath");
0168:                    List nonauthurls = operations.getAttribute("gateway",
0169:                            "sunPortalGatewayNonAuthenticatedURLPath", options);
0170:                    Iterator iter = nonauthurls.iterator();
0171:                    while (iter.hasNext()) {
0172:                        String nonAuthenticatedURL = (String) iter.next();
0173:                        if (nonAuthenticatedURL
0174:                                .endsWith("netlet/netletjsse.jar")
0175:                                || nonAuthenticatedURL
0176:                                        .endsWith("netlet/jnlpclient.jar")) {
0177:                            return true;
0178:                        }
0179:                    }
0180:                } catch (Exception e) {
0181:                    e.printStackTrace();
0182:                }
0183:                return false;
0184:
0185:            }
0186:
0187:            public Boolean StartGateway(final String instance)
0188:                    throws PSMBeanException {
0189:
0190:                return StartSRAInstance(instance, "Gateway", "gateway",
0191:                        SraServer.INSTANCE_TYPE_GATEWAY);
0192:            }
0193:
0194:            private Boolean StopSRAInstance(final String sInstanceName,
0195:                    final String sSRACompName, final int sSRACompType)
0196:                    throws PSMBeanException {
0197:
0198:                String instanceName = sInstanceName;
0199:                if (instanceName.trim().equals("")) {
0200:                    instanceName = "default";
0201:                }
0202:
0203:                Boolean bRetVal = Boolean.FALSE;
0204:                try {
0205:
0206:                    if (!checkInstanceExists(instanceName, sSRACompName)) {
0207:                        String[] token = { instanceName };
0208:                        throw new PSMBeanException(
0209:                                "psadmin.error.sra.create.instanceNotExists",
0210:                                token);
0211:                    }
0212:
0213:                    bRetVal = new Boolean(SraServerFactory.stopServerInstance(
0214:                            sSRACompType, instanceName, cc));
0215:                } catch (PSMBeanException e) {
0216:                    throw new PSMBeanException(e.getErrorKey(), e.getTokens());
0217:                } catch (NoSuchSraServerTypeException e) {
0218:                    e.printStackTrace();
0219:                } catch (Exception e) {
0220:                    e.printStackTrace();
0221:                }
0222:
0223:                return bRetVal;
0224:            }
0225:
0226:            public Boolean StopGateway(final String instance)
0227:                    throws PSMBeanException {
0228:
0229:                return StopSRAInstance(instance, "gateway",
0230:                        SraServer.INSTANCE_TYPE_GATEWAY);
0231:            }
0232:
0233:            public String[] ListGatewayInstances() throws PSMBeanException {
0234:                // String[] instanceNames = getInstanceNames("GWConfig-",
0235:                // ".properties");
0236:                // if(instanceNames == null) {
0237:                // String[] token = {"gateway"};
0238:                // throw new PSMBeanException("psadmin.error.sra.list.noinstancesfound",
0239:                // token);
0240:                // }
0241:                // return instanceNames;
0242:                try {
0243:                    return listServerInstances(SraServer.INSTANCE_TYPE_GATEWAY);
0244:                } catch (PSMBeanException e) {
0245:                    throw new PSMBeanException(e.getErrorKey(), e.getTokens());
0246:                }
0247:            }
0248:
0249:            public Boolean RemoveGWInstance(String instance)
0250:                    throws PSMBeanException {
0251:                if (instance.trim().equals(""))
0252:                    instance = "default";
0253:                try {
0254:                    if (!checkInstanceExists(instance, "gateway")) {
0255:                        String[] token = { instance };
0256:                        throw new PSMBeanException(
0257:                                "psadmin.error.sra.create.instanceNotExists",
0258:                                token);
0259:                    }
0260:                    if (SraServerFactory.deleteServerInstance(
0261:                            SraServer.INSTANCE_TYPE_GATEWAY, instance, cc)) {
0262:                        return Boolean.TRUE;
0263:                    }
0264:                } catch (PSMBeanException e) {
0265:                    throw new PSMBeanException(e.getErrorKey(), e.getTokens());
0266:                } catch (NoSuchSraServerTypeException e) {
0267:                    e.printStackTrace();
0268:                } catch (Exception e) {
0269:                    e.printStackTrace();
0270:                }
0271:                return Boolean.FALSE;
0272:            }
0273:
0274:            public Boolean ChangeLogUserPassword(String instance,
0275:                    String password) throws PSMBeanException {
0276:                if (instance.trim().equals(""))
0277:                    instance = "default";
0278:                int type = SraServer.INSTANCE_TYPE_GATEWAY;
0279:                if (!checkInstanceExists(instance, "gateway")) {
0280:                    if (!checkInstanceExists(instance, "nlproxy")) {
0281:                        if (!checkInstanceExists(instance, "rwproxy")) {
0282:                            String[] token = { instance };
0283:                            throw new PSMBeanException(
0284:                                    "psadmin.error.sra.create.instanceNotExists",
0285:                                    token);
0286:                        } else
0287:                            type = SraServer.INSTANCE_TYPE_REWRITER_PROXY;
0288:                    } else
0289:                        type = SraServer.INSTANCE_TYPE_NETLET_PROXY;
0290:                }
0291:
0292:                System.setProperty("sra.log.user.password", password);
0293:                switch (type) {
0294:                case SraServer.INSTANCE_TYPE_GATEWAY:
0295:                    Gateway gw = new Gateway(instance, cc);
0296:                    return gw.createLoggingUserAuthenticationEntry();
0297:                case SraServer.INSTANCE_TYPE_REWRITER_PROXY:
0298:                    RewriterProxy rwp = new RewriterProxy(instance, cc);
0299:                    return rwp.createLoggingUserAuthenticationEntry();
0300:                case SraServer.INSTANCE_TYPE_NETLET_PROXY:
0301:                    NetletProxy nlp = new NetletProxy(instance, cc);
0302:                    return nlp.createLoggingUserAuthenticationEntry();
0303:                }
0304:                Gateway server = new Gateway(instance, cc);
0305:                return server.createLoggingUserAuthenticationEntry();
0306:            }
0307:
0308:            public Boolean SraWatchdog(String type, String password,
0309:                    Boolean toSet) throws PSMBeanException {
0310:                OSTasks osTasks;
0311:                OSTasksFactory osTasksFactory = OSTasksFactory.getInstance();
0312:                // osTasks = osTasksFactory.getOSTasks(cc, _logger);
0313:                osTasks = osTasksFactory.getOSTasks(cc);
0314:                osTasks.setValue(OSTasks.COMMAND, cc.getPSBaseDir()
0315:                        + File.separator + "bin" + File.separator
0316:                        + "sra-watchdog " + password + " " + type
0317:                        + " > /dev/null 2>&1");
0318:                osTasks.setValue(OSTasks.DAYOFTHEWEEK, "*");
0319:                osTasks.setValue(OSTasks.HOUR, "*");
0320:                osTasks.setValue(OSTasks.MINUTE, "0-59");
0321:
0322:                if (toSet.booleanValue()) {
0323:                    osTasks.schedule();
0324:                } else {
0325:                    osTasks.unschedule();
0326:                }
0327:                return Boolean.TRUE;
0328:            }
0329:
0330:            public Boolean createNewProfile(String oldProfileName,
0331:                    String newProfileName) throws PSMBeanException {
0332:
0333:                try {
0334:                    // ServiceConfigManager configManager = new
0335:                    // ServiceConfigManager(SERVICE_NAME,
0336:                    // AdminServerUtil.getSSOToken());
0337:                    ServiceConfigManager configManager = new ServiceConfigManager(
0338:                            AdminServerUtil.getSSOToken(), SERVICE_NAME, "1.0");
0339:                    ServiceConfig __config = configManager
0340:                            .getGlobalConfig(null);
0341:                    ServiceConfig config = __config
0342:                            .getSubConfig(SUB_SCHEMA_NAME);
0343:
0344:                    Set subConfigNames = config.getSubConfigNames();
0345:
0346:                    if (!subConfigNames.contains(oldProfileName)) {
0347:                        String token[] = { oldProfileName };
0348:                        throw new PSMBeanException(
0349:                                "psadmin.error.sra.profile.doesntExists", token);
0350:                    }
0351:
0352:                    if (subConfigNames.contains(newProfileName)) {
0353:                        String token[] = { newProfileName };
0354:                        throw new PSMBeanException(
0355:                                "psadmin.error.sra.profile.alreadyExists",
0356:                                token);
0357:                    }
0358:
0359:                    ServiceConfig oldConfig = config
0360:                            .getSubConfig(oldProfileName);
0361:                    Map attrs = oldConfig.getAttributes();
0362:
0363:                    attrs.put(Gateway.ATTRIBUTE_GATEWAY_LISTS,
0364:                            Collections.EMPTY_SET);
0365:                    attrs.put(NetletProxy.ATTRIBUTE_NLP_LISTS,
0366:                            Collections.EMPTY_SET);
0367:                    attrs.put(RewriterProxy.ATTRIBUTE_RWP_LISTS,
0368:                            Collections.EMPTY_SET);
0369:                    config
0370:                            .addSubConfig(newProfileName, SUB_SCHEMA_ID, 1,
0371:                                    attrs);
0372:
0373:                    ServiceConfig newConfig = config
0374:                            .getSubConfig(newProfileName);
0375:                    if (newConfig == null) {
0376:                        String token[] = { newProfileName };
0377:                        throw new PSMBeanException(
0378:                                "psadmin.error.sra.profile.unableToCreate",
0379:                                token);
0380:                    }
0381:                } catch (SMSException ex) {
0382:                } catch (SSOException ex) {
0383:                } catch (PSMBeanException e) {
0384:                    throw new PSMBeanException(e.getErrorKey(), e.getTokens());
0385:                } catch (Exception ex) {
0386:                    ex.printStackTrace();
0387:                }
0388:
0389:                return Boolean.TRUE;
0390:            }
0391:
0392:            public Boolean deleteProfile(String profileName)
0393:                    throws PSMBeanException {
0394:
0395:                try {
0396:                    ServiceConfigManager configManager = new ServiceConfigManager(
0397:                            SERVICE_NAME, AdminServerUtil.getSSOToken());
0398:
0399:                    ServiceConfig __config = configManager
0400:                            .getGlobalConfig(null);
0401:                    ServiceConfig config = __config
0402:                            .getSubConfig(SUB_SCHEMA_NAME);
0403:                    ServiceConfig profile = config.getSubConfig(profileName);
0404:                    if (profile == null) {
0405:                        String token[] = { profileName };
0406:                        throw new PSMBeanException(
0407:                                "psadmin.error.sra.profile.doesntExists", token);
0408:                    }
0409:                    Map attrs = profile.getAttributes();
0410:                    Set values = (Set) attrs
0411:                            .get(Gateway.ATTRIBUTE_GATEWAY_LISTS);
0412:                    String value = "";
0413:                    boolean canDelete = true;
0414:                    if (values != null && values.iterator().hasNext())
0415:                        value = (String) values.iterator().next();
0416:                    if (!value.trim().equals(""))
0417:                        canDelete = false;
0418:
0419:                    values = (Set) attrs.get(NetletProxy.ATTRIBUTE_NLP_LISTS);
0420:                    value = "";
0421:                    if (values != null && values.iterator().hasNext())
0422:                        value = (String) values.iterator().next();
0423:                    if (!value.trim().equals(""))
0424:                        canDelete = false;
0425:
0426:                    values = (Set) attrs.get(RewriterProxy.ATTRIBUTE_RWP_LISTS);
0427:                    value = "";
0428:                    if (values != null && values.iterator().hasNext())
0429:                        value = (String) values.iterator().next();
0430:                    if (!value.trim().equals(""))
0431:                        canDelete = false;
0432:
0433:                    if (canDelete)
0434:                        config.removeSubConfig(profileName);
0435:                    else {
0436:                        String token[] = { profileName };
0437:                        throw new PSMBeanException(
0438:                                "psadmin.error.sra.profile.instancesExits",
0439:                                token);
0440:                    }
0441:
0442:                } catch (SMSException ex) {
0443:                } catch (SSOException ex) {
0444:                } catch (PSMBeanException e) {
0445:                    throw new PSMBeanException(e.getErrorKey(), e.getTokens());
0446:                } catch (Exception ex) {
0447:                }
0448:
0449:                return Boolean.TRUE;
0450:            }
0451:
0452:            public Boolean CreateNLPInstance(Properties NLPConfigProperties)
0453:                    throws PSMBeanException {
0454:                try {
0455:                    System.setProperty("sra.log.user.password",
0456:                            NLPConfigProperties
0457:                                    .getProperty("sra.log.user.password"));
0458:                    System
0459:                            .setProperty(
0460:                                    "certificate.database.password",
0461:                                    NLPConfigProperties
0462:                                            .getProperty("certificate.database.password"));
0463:                    String portalhost = NLPConfigProperties
0464:                            .getProperty("primary.portal.host");
0465:                    if (portalhost == null || portalhost.trim().length() == 0) {
0466:                        portalhost = NLPConfigProperties
0467:                                .getProperty("portal.server.hostname");
0468:                    }
0469:                    String profile = NLPConfigProperties
0470:                            .getProperty("netletproxy.profile.name");
0471:                    if (checkProfileExists(portalhost, profile).booleanValue()) {
0472:                        if (!isSRAOn()) {
0473:                            NLPConfigProperties.setProperty(
0474:                                    NLPPropertyContext.DO_START_AFTER_INSTALL,
0475:                                    "n");
0476:                            _logger.log(Level.FINEST,
0477:                                    "PSSR_CSPS_ADM_MBEANS104",
0478:                                    new String[] { "Netlet proxy" });
0479:                        }
0480:                        if (SraServerFactory.createServerInstance(
0481:                                SraServer.INSTANCE_TYPE_NETLET_PROXY,
0482:                                NLPConfigProperties, cc) != null) {
0483:                            return Boolean.TRUE;
0484:                        }
0485:                    }
0486:                } catch (PSMBeanException e) {
0487:                    throw new PSMBeanException(e.getErrorKey(), e.getTokens());
0488:                } catch (NoSuchSraServerTypeException e) {
0489:                    e.printStackTrace();
0490:                } catch (Exception e) {
0491:                    e.printStackTrace();
0492:                }
0493:                return Boolean.FALSE;
0494:            }
0495:
0496:            public Boolean StartNetletd(final String instance)
0497:                    throws PSMBeanException {
0498:
0499:                return StartSRAInstance(instance, "Netlet Proxy", "nlproxy",
0500:                        SraServer.INSTANCE_TYPE_NETLET_PROXY);
0501:            }
0502:
0503:            public Boolean StopNetletd(final String instance)
0504:                    throws PSMBeanException {
0505:
0506:                return StopSRAInstance(instance, "nlproxy",
0507:                        SraServer.INSTANCE_TYPE_NETLET_PROXY);
0508:            }
0509:
0510:            public String[] ListNLPInstances() throws PSMBeanException {
0511:                // String[] instanceNames = getInstanceNames("NLPConfig-",
0512:                // ".properties");
0513:                // if(instanceNames == null) {
0514:                // String[] token = {"nlproxy"};
0515:                // throw new PSMBeanException("psadmin.error.sra.list.noinstancesfound",
0516:                // token);
0517:                // }
0518:                // return instanceNames;
0519:                try {
0520:                    return listServerInstances(SraServer.INSTANCE_TYPE_NETLET_PROXY);
0521:                } catch (PSMBeanException e) {
0522:                    throw new PSMBeanException(e.getErrorKey(), e.getTokens());
0523:                }
0524:            }
0525:
0526:            public Boolean RemoveNLPInstance(String instance)
0527:                    throws PSMBeanException {
0528:                if (instance.trim().equals(""))
0529:                    instance = "default";
0530:                try {
0531:                    if (!checkInstanceExists(instance, "nlproxy")) {
0532:                        String[] token = { instance };
0533:                        throw new PSMBeanException(
0534:                                "psadmin.error.sra.create.instanceNotExists",
0535:                                token);
0536:                    }
0537:                    if (SraServerFactory.deleteServerInstance(
0538:                            SraServer.INSTANCE_TYPE_NETLET_PROXY, instance, cc)) {
0539:                        return Boolean.TRUE;
0540:                    }
0541:                } catch (PSMBeanException e) {
0542:                    throw new PSMBeanException(e.getErrorKey(), e.getTokens());
0543:                } catch (NoSuchSraServerTypeException e) {
0544:                    e.printStackTrace();
0545:                } catch (Exception e) {
0546:                    e.printStackTrace();
0547:                }
0548:                return Boolean.FALSE;
0549:            }
0550:
0551:            public Boolean CreateRWPInstance(Properties RWPConfigProperties)
0552:                    throws PSMBeanException {
0553:                try {
0554:                    System.setProperty("sra.log.user.password",
0555:                            RWPConfigProperties
0556:                                    .getProperty("sra.log.user.password"));
0557:                    System
0558:                            .setProperty(
0559:                                    "certificate.database.password",
0560:                                    RWPConfigProperties
0561:                                            .getProperty("certificate.database.password"));
0562:                    String portalhost = RWPConfigProperties
0563:                            .getProperty("primary.portal.host");
0564:                    if (portalhost == null || portalhost.trim().length() == 0) {
0565:                        portalhost = RWPConfigProperties
0566:                                .getProperty("portal.server.hostname");
0567:                    }
0568:                    String profile = RWPConfigProperties
0569:                            .getProperty("rewriterproxy.profile.name");
0570:                    if (checkProfileExists(portalhost, profile).booleanValue()) {
0571:                        if (!isSRAOn()) {
0572:                            RWPConfigProperties.setProperty(
0573:                                    RWPPropertyContext.DO_START_AFTER_INSTALL,
0574:                                    "n");
0575:                            _logger.log(Level.FINEST,
0576:                                    "PSSR_CSPS_ADM_MBEANS104",
0577:                                    new String[] { "Rewriter Proxy" });
0578:                        }
0579:                        if (SraServerFactory.createServerInstance(
0580:                                SraServer.INSTANCE_TYPE_REWRITER_PROXY,
0581:                                RWPConfigProperties, cc) != null) {
0582:                            return Boolean.TRUE;
0583:                        }
0584:                    }
0585:                } catch (PSMBeanException e) {
0586:                    throw new PSMBeanException(e.getErrorKey(), e.getTokens());
0587:                } catch (NoSuchSraServerTypeException e) {
0588:                    e.printStackTrace();
0589:                } catch (Exception e) {
0590:                    e.printStackTrace();
0591:                }
0592:                return Boolean.FALSE;
0593:            }
0594:
0595:            public Boolean StartRWProxy(final String instance)
0596:                    throws PSMBeanException {
0597:
0598:                return StartSRAInstance(instance, "Rewriter Proxy", "rwproxy",
0599:                        SraServer.INSTANCE_TYPE_REWRITER_PROXY);
0600:            }
0601:
0602:            public Boolean StopRWProxy(final String instance)
0603:                    throws PSMBeanException {
0604:
0605:                return StopSRAInstance(instance, "rwproxy",
0606:                        SraServer.INSTANCE_TYPE_REWRITER_PROXY);
0607:            }
0608:
0609:            public String[] ListRWPInstances() throws PSMBeanException {
0610:                /*
0611:                 * String[] instanceNames = getInstanceNames("RWPConfig-",
0612:                 * ".properties"); if(instanceNames == null) { String[] token =
0613:                 * {"rwproxy"}; throw new
0614:                 * PSMBeanException("psadmin.error.sra.list.noinstancesfound", token); }
0615:                 * return instanceNames;
0616:                 */
0617:                try {
0618:                    return listServerInstances(SraServer.INSTANCE_TYPE_REWRITER_PROXY);
0619:                } catch (PSMBeanException e) {
0620:                    throw new PSMBeanException(e.getErrorKey(), e.getTokens());
0621:                }
0622:            }
0623:
0624:            public Boolean RemoveRWPInstance(String instance)
0625:                    throws PSMBeanException {
0626:                if (instance.trim().equals(""))
0627:                    instance = "default";
0628:                try {
0629:                    if (!checkInstanceExists(instance, "rwproxy")) {
0630:                        String[] token = { instance };
0631:                        throw new PSMBeanException(
0632:                                "psadmin.error.sra.create.instanceNotExists",
0633:                                token);
0634:                    }
0635:                    if (SraServerFactory.deleteServerInstance(
0636:                            SraServer.INSTANCE_TYPE_REWRITER_PROXY, instance,
0637:                            cc)) {
0638:                        return Boolean.TRUE;
0639:                    }
0640:                } catch (PSMBeanException e) {
0641:                    throw new PSMBeanException(e.getErrorKey(), e.getTokens());
0642:                } catch (NoSuchSraServerTypeException e) {
0643:                    e.printStackTrace();
0644:                } catch (Exception e) {
0645:                    e.printStackTrace();
0646:                }
0647:                return Boolean.FALSE;
0648:            }
0649:
0650:            String[] getInstanceNames(String prefix, String suffix) {
0651:                ArrayList result = new ArrayList();
0652:                File configDir = new File(cc.getPSConfigDir());
0653:                File[] configFiles = configDir
0654:                        .listFiles(new ConfigurationFileFilter(prefix, suffix));
0655:
0656:                if ((configFiles != null) && (configFiles.length != 0)) {
0657:                    for (int i = 0; i < configFiles.length; i++) {
0658:                        String name = configFiles[i].getName();
0659:                        name = name.substring(prefix.length(), name
0660:                                .lastIndexOf(suffix));
0661:                        result.add(name);
0662:                        // DebugContext.message(name);
0663:                        _logger.info("PSSR_CSPS_ADM_MBEANS019");
0664:                    }
0665:                }
0666:                return (result.size() == 0) ? null : (String[]) result
0667:                        .toArray(new String[result.size()]);
0668:            }
0669:
0670:            public List ListAllKnownProfiles() throws PSMBeanException {
0671:                List list = null;
0672:                try {
0673:                    GatewayAttributeOperations operations = new GatewayAttributeOperations(
0674:                            AdminServerUtil.getSSOToken());
0675:                    list = operations.getAllProfileNames();
0676:                } catch (SMSException ex) {
0677:                    throw new PSMBeanException(
0678:                            "psadmin.error.sra.list.amnotrunning");
0679:                } catch (SSOException ex) {
0680:                    throw new PSMBeanException(
0681:                            "psadmin.error.sra.list.amnotrunning");
0682:                } catch (Exception e) {
0683:                    throw new PSMBeanException(e.getMessage());
0684:                }
0685:
0686:                return list == null ? Collections.EMPTY_LIST : list;
0687:            }
0688:
0689:            private boolean checkInstanceExists(String instanceName,
0690:                    String instanceType) {
0691:                String instancePropertiesFile = null;
0692:                if (instanceType.equalsIgnoreCase("gateway"))
0693:                    instancePropertiesFile = cc.getPSConfigDir() + Platform.fs
0694:                            + "GWConfig-" + instanceName + ".properties";
0695:                if (instanceType.equalsIgnoreCase("nlproxy"))
0696:                    instancePropertiesFile = cc.getPSConfigDir() + Platform.fs
0697:                            + "NLPConfig-" + instanceName + ".properties";
0698:                if (instanceType.equalsIgnoreCase("rwproxy"))
0699:                    instancePropertiesFile = cc.getPSConfigDir() + Platform.fs
0700:                            + "RWPConfig-" + instanceName + ".properties";
0701:                if (instancePropertiesFile != null)
0702:                    if ((new File(instancePropertiesFile)).exists())
0703:                        return true;
0704:                return false;
0705:            }
0706:
0707:            private String[] listServerInstances(int type)
0708:                    throws PSMBeanException {
0709:                List completeInstanceList = new ArrayList();
0710:                int i = 0;
0711:                try {
0712:                    List profilesList = ListAllKnownProfiles();
0713:                    for (i = 0; i < profilesList.size(); i++) {
0714:                        String instance = (String) profilesList.get(i);
0715:                        List instanceList = SraServerFactory
0716:                                .getInstancesFromProfile(type, instance);
0717:                        for (int j = 0; j < instanceList.size(); j++) {
0718:                            completeInstanceList.add(instance + ":"
0719:                                    + ((String) instanceList.get(j)));
0720:                        }
0721:                    }
0722:                } catch (PSMBeanException e) {
0723:                    throw new PSMBeanException(e.getErrorKey(), e.getTokens());
0724:                } catch (NoSuchSraServerTypeException e) {
0725:                    e.printStackTrace();
0726:                } catch (Exception e) {
0727:                    String[] token = { "" };
0728:                    switch (type) {
0729:                    case SraServer.INSTANCE_TYPE_GATEWAY:
0730:                        token[0] = "gateway";
0731:                        break;
0732:                    case SraServer.INSTANCE_TYPE_REWRITER_PROXY:
0733:                        token[0] = "rwproxy";
0734:                        break;
0735:                    case SraServer.INSTANCE_TYPE_NETLET_PROXY:
0736:                        token[0] = "nlproxy";
0737:                        break;
0738:                    }
0739:                    throw new PSMBeanException(
0740:                            "psadmin.error.sra.list.noinstancesfound", token);
0741:                }
0742:                return (String[]) completeInstanceList.toArray(new String[0]);
0743:            }
0744:
0745:            public Boolean checkProfileExists(String host, String instanceName)
0746:                    throws PSMBeanException {
0747:                try {
0748:                    List profiles = getProfilesRemote(host);
0749:                    Iterator iter = profiles.iterator();
0750:
0751:                    while (iter.hasNext()) {
0752:                        String attrValue = (String) iter.next();
0753:                        if (attrValue.equalsIgnoreCase(instanceName)) {
0754:                            return Boolean.TRUE;
0755:                        }
0756:                    }
0757:                    String token[] = { instanceName };
0758:                    throw new PSMBeanException(
0759:                            "psadmin.error.sra.profile.doesntExists", token);
0760:                } catch (PSMBeanException e) {
0761:                    throw new PSMBeanException(e.getErrorKey(), e.getTokens());
0762:                } catch (Exception ex) {
0763:                    _logger.log(Level.SEVERE, "PSSR_CSPS_ADM_MBEANS103", ex);
0764:                }
0765:                return Boolean.TRUE;
0766:            }
0767:
0768:            public Boolean IsInstanceStarted(String instanceType,
0769:                    String profileName, String hostname, Integer portNumber)
0770:                    throws PSMBeanException {
0771:                boolean ret = false;
0772:                try {
0773:                    if (instanceType.equalsIgnoreCase("gateway"))
0774:                        ret = SraServerFactory.isServerInstanceStarted(cc,
0775:                                SraServer.INSTANCE_TYPE_GATEWAY, profileName,
0776:                                hostname, portNumber.intValue());
0777:                    else if (instanceType.equalsIgnoreCase("nlproxy"))
0778:                        ret = SraServerFactory.isServerInstanceStarted(cc,
0779:                                SraServer.INSTANCE_TYPE_NETLET_PROXY,
0780:                                profileName, hostname, portNumber.intValue());
0781:                    else if (instanceType.equalsIgnoreCase("rwproxy"))
0782:                        ret = SraServerFactory.isServerInstanceStarted(cc,
0783:                                SraServer.INSTANCE_TYPE_REWRITER_PROXY,
0784:                                profileName, hostname, portNumber.intValue());
0785:                } catch (Exception e) {
0786:                    _logger.log(Level.SEVERE, "PSSR_CSPS_ADM_MBEANS103", e);
0787:                    throw new PSMBeanException(e.getMessage());
0788:                }
0789:
0790:                return ret == true ? Boolean.TRUE : Boolean.FALSE;
0791:            }
0792:
0793:            public Boolean IsInstanceStopped(String instanceType,
0794:                    String profileName, String hostname, Integer portNumber)
0795:                    throws PSMBeanException {
0796:                boolean ret = false;
0797:
0798:                try {
0799:                    if (instanceType.equalsIgnoreCase("gateway"))
0800:                        ret = SraServerFactory.isServerInstanceStopped(cc,
0801:                                SraServer.INSTANCE_TYPE_GATEWAY, profileName,
0802:                                hostname, portNumber.intValue());
0803:                    else if (instanceType.equalsIgnoreCase("nlproxy"))
0804:                        ret = SraServerFactory.isServerInstanceStopped(cc,
0805:                                SraServer.INSTANCE_TYPE_NETLET_PROXY,
0806:                                profileName, hostname, portNumber.intValue());
0807:                    else if (instanceType.equalsIgnoreCase("rwproxy"))
0808:                        ret = SraServerFactory.isServerInstanceStopped(cc,
0809:                                SraServer.INSTANCE_TYPE_REWRITER_PROXY,
0810:                                profileName, hostname, portNumber.intValue());
0811:                } catch (Exception e) {
0812:                    _logger.log(Level.SEVERE, "PSSR_CSPS_ADM_MBEANS103", e);
0813:                    throw new PSMBeanException(e.getMessage());
0814:                }
0815:
0816:                return ret == true ? Boolean.TRUE : Boolean.FALSE;
0817:            }
0818:
0819:            public String GetNetletProxyPort(String profileName)
0820:                    throws PSMBeanException {
0821:                String ret = "10555";
0822:                try {
0823:                    SraServer server = SraServerFactory.getServerComponent(
0824:                            SraServer.INSTANCE_TYPE_NETLET_PROXY, profileName,
0825:                            cc);
0826:                    ret = server.getPlatformConfProperties().getProperty(
0827:                            PROP_NETLET_PROXY_PORT);
0828:                } catch (NoSuchSraServerTypeException e) {
0829:                    _logger.log(Level.SEVERE, "PSSR_CSPS_ADM_MBEANS103", e);
0830:                    throw new PSMBeanException(e.getMessage());
0831:                }
0832:
0833:                return ret;
0834:            }
0835:
0836:            public String GetRewriterProxyPort(String profileName)
0837:                    throws PSMBeanException {
0838:                String ret = "10443";
0839:                try {
0840:                    SraServer server = SraServerFactory.getServerComponent(
0841:                            SraServer.INSTANCE_TYPE_REWRITER_PROXY,
0842:                            profileName, cc);
0843:                    ret = server.getPlatformConfProperties().getProperty(
0844:                            PROP_REWRITER_PROXY_PORT);
0845:                } catch (NoSuchSraServerTypeException e) {
0846:                    _logger.log(Level.SEVERE, "PSSR_CSPS_ADM_MBEANS103", e);
0847:                    throw new PSMBeanException(e.getMessage());
0848:                }
0849:
0850:                return ret;
0851:            }
0852:
0853:            public String GetInstancePlatformConfProperty(String profileName,
0854:                    String propertyName) throws PSMBeanException {
0855:                String value = "";
0856:                try {
0857:                    SraServer server = SraServerFactory.getServerComponent(
0858:                            SraServer.INSTANCE_TYPE_GATEWAY, profileName, cc);
0859:                    value = server.getPlatformConfProperties().getProperty(
0860:                            propertyName);
0861:                } catch (NoSuchSraServerTypeException e) {
0862:                    _logger.log(Level.SEVERE, "PSSR_CSPS_ADM_MBEANS103", e);
0863:                    throw new PSMBeanException(e.getMessage());
0864:                }
0865:                return value;
0866:            }
0867:
0868:            public List getProfilesRemote(String host)
0869:                    throws MalformedObjectNameException, PSMBeanException {
0870:                LinkedList path = new LinkedList();
0871:                path.addFirst(getDomainID());
0872:                path.addFirst("sra");
0873:
0874:                ObjectName objName = AdminUtil.getResourceMBeanObjectName(
0875:                        AdminUtil.SRA_MBEAN_TYPE, path);
0876:
0877:                return (List) invokeRemoteOperation(host, objName,
0878:                        "ListAllKnownProfiles", null, null);
0879:            }
0880:
0881:            public Boolean changeSRAStatus(final String sSRAStatus)
0882:                    throws PSMBeanException {
0883:
0884:                Boolean bRetVal = Boolean.TRUE;
0885:                String fileName = null;
0886:                String host = null;
0887:                String configdir = cc.getPSConfigDir();
0888:                try {
0889:                    if (cc
0890:                            .getDomainDataClass()
0891:                            .equals(
0892:                                    "com.sun.portal.admin.common.context.ldap.LDAPPortalDomainContext")) {
0893:                        pdc.setAttributeValue(AdminUtil.SRA_MBEAN_TYPE, path,
0894:                                SRAAttributes.SRA_STATUS, sSRAStatus);
0895:                    } else {
0896:                        LinkedList path = new LinkedList();
0897:                        path.addFirst(getDomainID());
0898:                        path.addFirst("sra");
0899:                        Object[] params = { sSRAStatus };
0900:                        String[] signature = { "java.lang.String" };
0901:                        ObjectName objName = AdminUtil
0902:                                .getResourceMBeanObjectName(
0903:                                        AdminUtil.SRA_MBEAN_TYPE, path);
0904:                        List profiles = ListAllKnownProfiles();
0905:                        Iterator i = profiles.listIterator();
0906:                        while (i.hasNext()) {
0907:                            String profileName = i.next().toString();
0908:                            _logger.log(Level.INFO, profileName);
0909:                            if (FileUtil
0910:                                    .fileExists(configdir + File.separator
0911:                                            + "GWConfig-" + profileName
0912:                                            + ".properties")) {
0913:                                fileName = configdir + File.separator
0914:                                        + "GWConfig-" + profileName
0915:                                        + ".properties";
0916:                                break;
0917:                            } else if (FileUtil.fileExists(configdir
0918:                                    + File.separator + "NLPConfig-"
0919:                                    + profileName + ".properties")) {
0920:                                fileName = configdir + File.separator
0921:                                        + "NLPConfig-" + profileName
0922:                                        + ".properties";
0923:                                break;
0924:                            } else if (FileUtil.fileExists(configdir
0925:                                    + File.separator + "RWPConfig-"
0926:                                    + profileName + ".properties")) {
0927:                                fileName = configdir + File.separator
0928:                                        + "RWPConfig-" + profileName
0929:                                        + ".properties";
0930:                                break;
0931:                            }
0932:                        }
0933:                        if (fileName != null) {
0934:                            File file = new File(fileName);
0935:                            String str = FileUtil.findTextInFile(file,
0936:                                    "primary.portal.host");
0937:                            host = str.substring(str.indexOf("=") + 1);
0938:                        } else {
0939:                            _logger
0940:                                    .log(Level.INFO,
0941:                                            "No SRA instance found. So status will not be set");
0942:                        }
0943:                        Object RetVal = invokeRemoteOperation(host, objName,
0944:                                "changeSRAStatus", params, signature);
0945:                        bRetVal = (Boolean) bRetVal;
0946:                    }
0947:                } catch (PortalDomainContextException e) {
0948:                    _logger.log(Level.SEVERE, "PSSR_CSPS_ADM_MBEANS103"
0949:                            + e.getMessage(), e);
0950:                    bRetVal = Boolean.FALSE;
0951:                } catch (MalformedObjectNameException e) {
0952:                    _logger.log(Level.INFO, e.getMessage());
0953:                    bRetVal = Boolean.FALSE;
0954:                }
0955:
0956:                return bRetVal;
0957:            }
0958:
0959:            public String retrieveSRAStatus() throws PSMBeanException {
0960:
0961:                boolean bRetVal = true;
0962:                String sRetVal = null;
0963:                String fileName = null;
0964:                String host = null;
0965:                String configdir = cc.getPSConfigDir();
0966:                try {
0967:                    if (cc
0968:                            .getDomainDataClass()
0969:                            .equals(
0970:                                    "com.sun.portal.admin.common.context.ldap.LDAPPortalDomainContext")) {
0971:                        sRetVal = pdc.getAttributeValue(
0972:                                AdminUtil.SRA_MBEAN_TYPE, path,
0973:                                SRAAttributes.SRA_STATUS);
0974:                        _logger.log(Level.INFO, "PSSR_CSPS_ADM_MBEANS105"
0975:                                + sRetVal);
0976:                        if ((sRetVal != null)
0977:                                && !sRetVal.equalsIgnoreCase("on")) {
0978:                            bRetVal = false;
0979:                        }
0980:                    } else {
0981:                        LinkedList path = new LinkedList();
0982:                        path.addFirst(getDomainID());
0983:                        path.addFirst("sra");
0984:
0985:                        ObjectName objName = AdminUtil
0986:                                .getResourceMBeanObjectName(
0987:                                        AdminUtil.SRA_MBEAN_TYPE, path);
0988:                        List profiles = ListAllKnownProfiles();
0989:                        Iterator i = profiles.listIterator();
0990:                        while (i.hasNext()) {
0991:                            String profileName = i.next().toString();
0992:                            _logger.log(Level.INFO, profileName);
0993:                            if (FileUtil
0994:                                    .fileExists(configdir + File.separator
0995:                                            + "GWConfig-" + profileName
0996:                                            + ".properties")) {
0997:                                fileName = configdir + File.separator
0998:                                        + "GWConfig-" + profileName
0999:                                        + ".properties";
1000:                                break;
1001:                            } else if (FileUtil.fileExists(configdir
1002:                                    + File.separator + "NLPConfig-"
1003:                                    + profileName + ".properties")) {
1004:                                fileName = configdir + File.separator
1005:                                        + "NLPConfig-" + profileName
1006:                                        + ".properties";
1007:                                break;
1008:                            } else if (FileUtil.fileExists(configdir
1009:                                    + File.separator + "RWPConfig-"
1010:                                    + profileName + ".properties")) {
1011:                                fileName = configdir + File.separator
1012:                                        + "RWPConfig-" + profileName
1013:                                        + ".properties";
1014:                                break;
1015:                            }
1016:                        }
1017:                        if (fileName != null) {
1018:                            File file = new File(fileName);
1019:                            String str = FileUtil.findTextInFile(file,
1020:                                    "primary.portal.host");
1021:                            host = str.substring(str.indexOf("=") + 1);
1022:                        } else {
1023:                            return ("No SRA instances found. So status will not be returned");
1024:                        }
1025:                        Object RetVal = invokeRemoteOperation(host, objName,
1026:                                "retrieveSRAStatus", null, null);
1027:                        sRetVal = RetVal.toString();
1028:                        _logger.log(Level.INFO, "PSSR_CSPS_ADM_MBEANS105"
1029:                                + sRetVal);
1030:                        if ((sRetVal != null)
1031:                                && !sRetVal.equalsIgnoreCase("on")) {
1032:                            bRetVal = false;
1033:                        }
1034:                    }
1035:                } catch (PortalDomainContextException e) {
1036:                    _logger.log(Level.SEVERE, "PSSR_CSPS_ADM_MBEANS103"
1037:                            + e.getMessage(), e);
1038:                    bRetVal = false;
1039:                } catch (MalformedObjectNameException e) {
1040:                    _logger.log(Level.INFO, e.getMessage());
1041:                    bRetVal = false;
1042:                }
1043:
1044:                return bRetVal == true ? STRING_ON : STRING_OFF;
1045:
1046:            }
1047:
1048:            public Boolean isServiceAssignedToOrg(String serviceName, String dn)
1049:                    throws PSMBeanException {
1050:                _logger.log(Level.FINEST, "PSFB_CSPFM1058", serviceName);
1051:                try {
1052:                    AMStoreConnection amsc = new AMStoreConnection(
1053:                            AdminServerUtil.getSSOToken());
1054:                    AMOrganization org = amsc.getOrganization(dn);
1055:                    Map map = org.getAttributes();
1056:                    Set services = (Set) map.get("sunregisteredservicename");
1057:                    if (!services.contains(serviceName))
1058:                        return Boolean.FALSE;
1059:                } catch (Exception ssoe) {
1060:                    _logger.log(Level.SEVERE, "PSFB_CSPFCM0003", ssoe);
1061:                }
1062:
1063:                return Boolean.TRUE;
1064:            }
1065:
1066:            private final boolean isSRAOn() throws PSMBeanException {
1067:                String ret = retrieveSRAStatus();
1068:                if (ret.equalsIgnoreCase(STRING_ON))
1069:                    return true;
1070:                else if (ret.equalsIgnoreCase(STRING_OFF))
1071:                    return false;
1072:                else
1073:                    return false;
1074:            }
1075:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.