Source Code Cross Referenced for ResetCacaoParams.java in  » Portal » Open-Portal » com » sun » portal » fabric » config » 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.fabric.config 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright 2004 Sun Microsystems, Inc. All
003:         * rights reserved. Use of this product is subject
004:         * to license terms. Federal Acquisitions:
005:         * Commercial Software -- Government Users
006:         * Subject to Standard License Terms and
007:         * Conditions.
008:         *
009:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
010:         * are trademarks or registered trademarks of Sun Microsystems,
011:         * Inc. in the United States and other countries.
012:         */package com.sun.portal.fabric.config;
013:
014:        import java.util.logging.Level;
015:        import java.util.logging.Logger;
016:
017:        import com.sun.portal.fabric.tasks.ConfigurationException;
018:        import com.sun.portal.log.common.PortalLogManager;
019:        import com.sun.portal.log.common.PortalLogger;
020:        import com.sun.portal.fabric.util.ExecuteUtil;
021:        import com.sun.portal.util.Platform;
022:
023:        /* This class has code to reset cacao java-flags parameter.
024:         Cacao flags are reset only if unconfigure all option is selected in
025:         input xml file. */
026:        public class ResetCacaoParams {
027:
028:            private static final String FS = Platform.fs;
029:            private static String logConfigFileOption = "com.sun.portal.log.config.file";
030:            private static String ubtVMOption = " -Djava.awt.headless=true ";
031:            private static String logProperties = "PSAdminLogConfig.properties";
032:            private ExecuteUtil execUtil = null;
033:            private String cacaoAdmCmd = null;
034:            private static final String CACAO_ADMIN = "cacaoadm";
035:            private static final String JAVA_FLAGS = "java-flags";
036:            public static final String STATUS = "status";
037:            public static final String CACAO_UPTIME = "ptime";
038:            private static final String GET_PARAM = "get-param";
039:            private static final String SET_PARAM = "set-param";
040:            private static final String START = "start";
041:            private static final String STOP = "stop";
042:            private static Logger logger = null;
043:
044:            public ResetCacaoParams() {
045:                //Initialise Portal Log Manager
046:                new PortalLogManager().init("debug.com.sun.portal.fabric");
047:                logger = PortalLogger.getLogger(ResetCacaoParams.class);
048:            }
049:
050:            public static void main(String[] args) {
051:
052:                // Initialize error code to success
053:                int exitCode = 1;
054:
055:                if (args == null || args.length < 1) {
056:                    System.err
057:                            .println("ResetCacaoParams Failed : Missing arguments. Please provide cacao install location.");
058:                    // Exit current VM with error
059:                    System.exit(exitCode);
060:                }
061:
062:                ResetCacaoParams resetCacao = new ResetCacaoParams();
063:                System.err.println("Resetting Cacao java-flags... ");
064:                resetCacao.cacaoAdmCmd = args[0] + FS + "bin" + FS
065:                        + CACAO_ADMIN;
066:                resetCacao.execUtil = new ExecuteUtil();
067:                resetCacao.resetCacaoJavaFlags();
068:                System.err.println("Done ");
069:            }
070:
071:            /** This method checks the value of cacao java-flags param and
072:             *   clears the java flags which are portal specific.
073:             */
074:            public void resetCacaoJavaFlags() {
075:                try {
076:                    String javaFlags = execCacaoCommand(GET_PARAM, JAVA_FLAGS,
077:                            true);
078:                    String logFileStr = " -D" + logConfigFileOption + "="
079:                            + "/etc/opt/SUNWportal" + FS + logProperties;
080:                    javaFlags = javaFlags.replaceFirst(logFileStr, "");
081:
082:                    javaFlags = javaFlags.replaceFirst(ubtVMOption.trim(), "");
083:
084:                    String status = execCacaoCommand(STATUS, null, true);
085:                    if (status.indexOf(CACAO_UPTIME) > 0) {
086:                        execCacaoCommand(STOP, null, false);
087:                    }
088:                    execCacaoCommand(SET_PARAM, javaFlags, false);
089:                    status = execCacaoCommand(STATUS, null, true);
090:                    if (status.indexOf(CACAO_UPTIME) == -1) {
091:                        execCacaoCommand(START, null, false);
092:                    }
093:                } catch (Exception e) {
094:                    logger.log(Level.SEVERE, "PSFB_CSPFT0204", e);
095:                }
096:            }
097:
098:            /** This method executes cacaoadm commands by calling ExecuteUtil methods.
099:             */
100:            public String execCacaoCommand(final String sCommandName,
101:                    final String sParam, final boolean bOutput) {
102:
103:                String[] args = (sParam != null) ? new String[] { sCommandName,
104:                        sParam } : new String[] { sCommandName };
105:                execUtil.storeOutput(bOutput);
106:                execUtil.exec(cacaoAdmCmd, args);
107:                return (bOutput ? execUtil.getOutput() : null);
108:            }
109:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.