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


001:        package com.sun.portal.proxylet.client.common;
002:
003:        import com.sun.portal.proxylet.client.common.ui.ProxyletUI;
004:        import com.sun.portal.proxylet.client.common.browser.BrowserHelper;
005:
006:        import java.io.*;
007:
008:        /**
009:         * Created by IntelliJ IDEA.
010:         * User: Administrator
011:         * Date: Feb 17, 2005
012:         * Time: 11:06:46 AM
013:         * To change this template use File | Settings | File Templates.
014:         */
015:        public class regxwrapper {
016:            private long connectionType;
017:            private String autoConfigURL;
018:            private String proxyserver;
019:            private String proxybypass;
020:            private String tempdirectory;
021:            public static boolean dllloaded = false;
022:            boolean binit = false;
023:            private static final regxwrapper _theInstance = new regxwrapper();
024:
025:            static {
026:                try {
027:                    System.loadLibrary("regxwrapper");
028:                    dllloaded = true;
029:                } catch (Throwable e) {
030:                    dllloaded = false;
031:                }
032:            }
033:
034:            private regxwrapper() {
035:            }
036:
037:            void init() throws Exception {
038:                try {
039:                    if (tempdirectory != null) {
040:                        if (new File(tempdirectory).isDirectory())
041:                            return;
042:                    }
043:                    tempdirectory = Param.getTempDirectory();
044:                    if (!dllloaded) {
045:                        Log.debug("Loading library explicitly");
046:                        loadExplicitly();
047:                    }
048:                } catch (IOException e) {
049:                    System.out.println("Unable to create temp file");
050:                    ProxyletUI.setText(Param.getString("perr.8",
051:                            "ERR: Unable to write to disk"));
052:                    throw e;
053:                }
054:
055:            }
056:
057:            public synchronized static regxwrapper getInstance() {
058:                if (_theInstance.binit == false) {
059:                    try {
060:                        _theInstance.init();
061:                    } catch (Exception e) {
062:                        // Unable to create temp directory
063:                        String location = null;
064:                        location = BrowserHelper
065:                                .getNewfileLocation(ProxyletUI.frame);
066:                        _theInstance.setTempDir(location);
067:                    }
068:                    _theInstance.binit = true;
069:
070:                }
071:                return _theInstance;
072:            }
073:
074:            public void loadExplicitly() throws Exception {
075:                //install  dll
076:                String location = extractResource("regxwrapper.dll");
077:                try {
078:                    System.load(location);
079:                    dllloaded = true;
080:                } catch (Exception e) {
081:                    dllloaded = false;
082:                    throw e;
083:                }
084:            }
085:
086:            public void setConnectionType(long l) {
087:                System.out.println("connection type " + l);
088:                connectionType = l;
089:
090:            }
091:
092:            public void setAutoConfigURL(String s) {
093:                System.out.println("autoconfigurl  " + s);
094:                autoConfigURL = s;
095:            }
096:
097:            public void setProxyServer(String s) {
098:                System.out.println("proxyserver  " + s);
099:                proxyserver = s;
100:            }
101:
102:            public void setProxybypass(String s) {
103:                System.out.println("proxybypass  " + s);
104:                proxybypass = s;
105:            }
106:
107:            public void setTempDir(String l) {
108:                tempdirectory = l;
109:            }
110:
111:            public long getConnectionType() {
112:                return connectionType;
113:            }
114:
115:            public String getAutoConfigURL() {
116:                return autoConfigURL;
117:            }
118:
119:            public String getProxyServer() {
120:                return proxyserver;
121:            }
122:
123:            public String getProxybypass() {
124:                return proxybypass;
125:            }
126:
127:            public native boolean Unregister(String path);
128:
129:            public native boolean Register(String path);
130:
131:            public native boolean InitInstance();
132:
133:            public native boolean UninitInstance();
134:
135:            public native boolean ReadSettings();
136:
137:            public native boolean restoreSettings(String autoConfigURL,
138:                    long ConnectionType);
139:
140:            public native boolean updateSettings(String autoConfigURL);
141:
142:            public String extractResource(String resourceName) throws Exception {
143:                ClassLoader c1 = regxwrapper.class.getClassLoader();
144:                InputStream is = c1.getResourceAsStream(resourceName);
145:                File rFile = null;
146:
147:                if (is != null) {
148:                    //generate a temporary name for the resource and write to temp file
149:                    BufferedInputStream istream = new BufferedInputStream(is);
150:                    rFile = new File(tempdirectory + resourceName);
151:                    if (rFile.exists()) {
152:                        rFile.delete();
153:                        rFile.createNewFile();
154:                    }
155:
156:                    System.out.println("Extracting resource " + resourceName
157:                            + " to directory " + tempdirectory);
158:                    rFile.deleteOnExit();
159:                    BufferedOutputStream ostream = new BufferedOutputStream(
160:                            new FileOutputStream(rFile));
161:                    int bsize = 2048;
162:                    int n = 0;
163:                    byte[] buffer = new byte[bsize];
164:                    while ((n = istream.read(buffer, 0, bsize)) != -1) {
165:                        ostream.write(buffer, 0, n);
166:                    }
167:                    istream.close();
168:                    ostream.close();
169:
170:                }
171:
172:                return rFile.getAbsolutePath();
173:            }
174:
175:            public static void main(String[] args) throws Exception {
176:                regxwrapper r = new regxwrapper();
177:                r.InitInstance();
178:                r.Register("c:\\temp\\RegX.dll");
179:                r.ReadSettings();
180:                System.out.println("Connection Type =" + r.getConnectionType());
181:                System.out.println("Autoconfig URL =" + r.getAutoConfigURL());
182:                System.out.println("Proxy Server = " + r.getProxyServer());
183:                System.out.println("Proxy bypass =" + r.getProxybypass());
184:                r.restoreSettings("http://localhost:1234", 3);
185:                r.Unregister("c:\\temp\\RegX.dll");
186:
187:            }
188:
189:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.