Source Code Cross Referenced for SipManager.java in  » Net » openfire » org » jivesoftware » openfire » sip » 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 » Net » openfire » org.jivesoftware.openfire.sip 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * $RCSfile$
003:         * $Revision: $
004:         * $Date: $
005:         *
006:         * Copyright (C) 2007 Jive Software. All rights reserved.
007:         *
008:         * This software is published under the terms of the GNU Public License (GPL),
009:         * a copy of which is included in this distribution.
010:         */package org.jivesoftware.openfire.sip;
011:
012:        import org.jivesoftware.openfire.container.Plugin;
013:        import org.jivesoftware.openfire.container.PluginManager;
014:        import org.jivesoftware.openfire.sip.log.LogComponent;
015:        import org.jivesoftware.openfire.sip.log.LogListenerImpl;
016:        import org.jivesoftware.openfire.sip.sipaccount.SipComponent;
017:        import org.jivesoftware.util.JiveGlobals;
018:        import org.jivesoftware.util.PropertyEventDispatcher;
019:        import org.jivesoftware.util.PropertyEventListener;
020:        import org.xmpp.component.ComponentManager;
021:        import org.xmpp.component.ComponentManagerFactory;
022:
023:        import java.util.Map;
024:        import java.io.File;
025:
026:        /**
027:         * Remote management for users SIP account for Spark SIP Plugin
028:         *
029:         * @author Thiago Rocha Camargo
030:         */
031:        public class SipManager implements  Plugin, PropertyEventListener {
032:
033:            private String serviceName;
034:
035:            private ComponentManager componentManager;
036:
037:            private SipComponent sipComponent;
038:
039:            private LogComponent logComponent;
040:
041:            /**
042:             * Constructs a new SIP Controller plugin.
043:             */
044:            public SipManager() {
045:                serviceName = JiveGlobals.getProperty(SipComponent.PROPNAME,
046:                        SipComponent.NAME);
047:            }
048:
049:            public void initializePlugin(PluginManager manager,
050:                    File pluginDirectory) {
051:                // Register as a component.
052:                componentManager = ComponentManagerFactory
053:                        .getComponentManager();
054:
055:                sipComponent = new SipComponent();
056:                LogListenerImpl logListener = new LogListenerImpl(
057:                        componentManager);
058:                logComponent = new LogComponent(logListener);
059:
060:                // Register the logger and SIP components. Both components are cluster-safe
061:                try {
062:                    componentManager.addComponent(serviceName, sipComponent);
063:
064:                } catch (Exception e) {
065:                    componentManager.getLog().error(e);
066:                }
067:                try {
068:                    componentManager.addComponent(LogComponent.NAME,
069:                            logComponent);
070:
071:                } catch (Exception e) {
072:                    componentManager.getLog().error(e);
073:                }
074:
075:                PropertyEventDispatcher.addListener(this );
076:                componentManager.getLog().debug("SIPARK STARTED");
077:            }
078:
079:            public void destroyPlugin() {
080:                PropertyEventDispatcher.removeListener(this );
081:                // Unregister component.
082:                if (componentManager != null) {
083:                    try {
084:                        componentManager.removeComponent(serviceName);
085:                    } catch (Exception e) {
086:                        componentManager.getLog().error(e);
087:                    }
088:                    try {
089:                        componentManager.removeComponent(LogComponent.NAME);
090:                    } catch (Exception e) {
091:                        componentManager.getLog().error(e);
092:                    }
093:                }
094:                sipComponent = null;
095:                logComponent = null;
096:                componentManager = null;
097:            }
098:
099:            /**
100:             * Returns the service name of this component, which is "sipark" by default.
101:             *
102:             * @return the service name of this component.
103:             */
104:            public String getServiceName() {
105:                return serviceName;
106:            }
107:
108:            /**
109:             * Sets the service name of this component, which is "sipark" by default.
110:             *
111:             * @param serviceName the service name of this component.
112:             */
113:            public void setServiceName(String serviceName) {
114:                JiveGlobals.setProperty(SipComponent.PROPNAME, serviceName);
115:            }
116:
117:            /**
118:             * Changes the service name to a new value.
119:             *
120:             * @param serviceName the service name.
121:             */
122:            private void changeServiceName(String serviceName) {
123:                if (serviceName == null) {
124:                    throw new NullPointerException(
125:                            "Service name cannot be null");
126:                }
127:                if (this .serviceName.equals(serviceName)) {
128:                    return;
129:                }
130:
131:                // Re-register the service.
132:                try {
133:                    componentManager.removeComponent(this .serviceName);
134:                } catch (Exception e) {
135:                    componentManager.getLog().error(e);
136:                }
137:                try {
138:                    componentManager.addComponent(serviceName, sipComponent);
139:                } catch (Exception e) {
140:                    componentManager.getLog().error(e);
141:                }
142:                this .serviceName = serviceName;
143:            }
144:
145:            public void propertySet(String property, Map params) {
146:                if (property.equals(SipComponent.NAMESPACE)) {
147:                    changeServiceName((String) params.get("value"));
148:                }
149:            }
150:
151:            public void propertyDeleted(String property, Map params) {
152:                if (property.equals(serviceName)) {
153:                    changeServiceName(SipComponent.NAME);
154:                }
155:            }
156:
157:            public void xmlPropertySet(String property, Map params) {
158:                // not used
159:            }
160:
161:            public void xmlPropertyDeleted(String property, Map params) {
162:                // not used
163:            }
164:
165:            public ComponentManager getComponentManager() {
166:                return componentManager;
167:            }
168:
169:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.