本文整理汇总了Java中org.xmpp.component.ComponentException类的典型用法代码示例。如果您正苦于以下问题:Java ComponentException类的具体用法?Java ComponentException怎么用?Java ComponentException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ComponentException类属于org.xmpp.component包,在下文中一共展示了ComponentException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shutdown
import org.xmpp.component.ComponentException; //导入依赖的package包/类
/**
* Shuts down running components that were found by the service.
*/
public void shutdown() {
// Stop the component monitoring service.
if (executor != null) {
executor.shutdown();
}
// Shutdown found components.
for (String subdomain : componentDomains.values()) {
try {
manager.removeComponent(subdomain);
} catch (ComponentException e) {
manager.getLog().error("Error shutting down component", e);
}
}
components.clear();
componentDirs.clear();
classloaders.clear();
componentDomains.clear();
}
示例2: unloadComponent
import org.xmpp.component.ComponentException; //导入依赖的package包/类
/**
* Unloads a component. The {@link ComponentManager#removeComponent(String)} method will be
* called and then any resources will be released. The name should be the name of the component
* directory and not the name as given by the component meta-data. This method only removes
* the component but does not delete the component JAR file. Therefore, if the component JAR
* still exists after this method is called, the component will be started again the next
* time the component monitor process runs. This is useful for "restarting" components.<p>
*
* This method is called automatically when a component's JAR file is deleted.
*
* @param componentName the name of the component to unload.
*/
public void unloadComponent(String componentName) {
manager.getLog().debug("Unloading component " + componentName);
Component component = components.get(componentName);
if (component == null) {
return;
}
File webXML = new File(componentDirectory + File.separator + componentName +
File.separator + "web" + File.separator + "web.xml");
if (webXML.exists()) {
//AdminConsole.removeModel(componentName);
ComponentServlet.unregisterServlets(webXML);
}
ComponentClassLoader classLoader = classloaders.get(component);
try {
manager.removeComponent(componentDomains.get(component));
} catch (ComponentException e) {
manager.getLog().error("Error shutting down component", e);
}
classLoader.destroy();
components.remove(componentName);
componentDirs.remove(component);
classloaders.remove(component);
componentDomains.remove(component);
}
示例3: processPacket
import org.xmpp.component.ComponentException; //导入依赖的package包/类
public void processPacket(Packet p) {
if (!(p instanceof IQ)) {
return;
}
final IQ packet = (IQ) p;
if (packet.getType().equals(IQ.Type.error) || packet.getType().equals(IQ.Type.result)) {
return;
}
// Packet p is an IQ stanza of type GET or SET. Therefor, it _must_ be
// replied to.
final IQ replyPacket = handleIQRequest(packet);
try {
componentManager.sendPacket(this, replyPacket);
} catch (ComponentException e) {
Log.error(e.getMessage(), e);
}
}
示例4: workgroupManagerStop
import org.xmpp.component.ComponentException; //导入依赖的package包/类
private void workgroupManagerStop() {
// Unregister workgroup component
try {
ComponentManagerFactory.getComponentManager().removeComponent("workgroup");
}
catch (ComponentException e) {
Log.error("Error unregistering workgroup component", e);
}
if (workgroupManager != null) {
// Unregister the provider of workgroup names
UserNameManager.removeUserNameProvider(workgroupManager.getAddress().toString());
// Stop the Fastpath module
workgroupManager.stop();
}
// Clean up the reference to the workgroup manager as a way to say that FP is no longer running in this JVM
workgroupManager = null;
}
示例5: initialize
import org.xmpp.component.ComponentException; //导入依赖的package包/类
public void initialize(JID jid, ComponentManager componentManager) throws ComponentException {
// Set the full domain address that this component is serving
serviceAddress = jid;
agentManager = new AgentManager();
// Set a default MUC service JID. This may be required when the server does
// not support service discovery
mucServiceName = "conference." + componentManager.getServerName();
// Send a disco request to discover the MUC service address
IQ disco = new IQ(IQ.Type.get);
disco.setTo(componentManager.getServerName());
disco.setFrom(jid);
disco.setChildElement("query", "http://jabber.org/protocol/disco#items");
send(disco);
// Start the background processes
startTimer();
// Load Workgroups
loadWorkgroups();
// Set that the workgroups have been loaded
loaded = true;
}
示例6: initializePlugin
import org.xmpp.component.ComponentException; //导入依赖的package包/类
public void initializePlugin(PluginManager manager, File pluginDirectory) {
componentManager = ComponentManagerFactory.getComponentManager();
component = new RayoComponent(this);
try {
componentManager.addComponent(serviceName, component);
bridge.appStart(pluginDirectory);
checkNatives(pluginDirectory);
checkRecordingFolder(pluginDirectory);
SessionEventDispatcher.addListener(this);
} catch (ComponentException e) {
Log.error("Could NOT load " + component.getName());
}
setup();
component.doStart();
}
示例7: processPacket
import org.xmpp.component.ComponentException; //导入依赖的package包/类
public void processPacket(Packet p) {
if (!(p instanceof IQ)) {
return;
}
final IQ packet = (IQ) p;
if (packet.getType().equals(IQ.Type.error)
|| packet.getType().equals(IQ.Type.result)) {
return;
}
// Packet p is an IQ stanza of type GET or SET. Therefor, it _must_ be
// replied to.
final IQ replyPacket = handleIQRequest(packet);
try {
componentManager.sendPacket(this, replyPacket);
} catch (ComponentException e) {
Log.error(e.getMessage(), e);
}
}
示例8: processPacket
import org.xmpp.component.ComponentException; //导入依赖的package包/类
public void processPacket(Packet p) {
if (!(p instanceof IQ)) {
return;
}
final IQ packet = (IQ) p;
if (packet.getType().equals(IQ.Type.error) || packet.getType().equals(IQ.Type.result)) {
return;
}
// Packet p is an IQ stanza of type GET or SET. Therefor, it _must_ be
// replied to.
final IQ replyPacket = handleIQRequest(packet);
try {
componentManager.sendPacket(this, replyPacket);
} catch (ComponentException e) {
Log.error(e.getMessage(), e);
}
}
示例9: initializePlugin
import org.xmpp.component.ComponentException; //导入依赖的package包/类
public void initializePlugin(PluginManager manager, File pluginDirectory) {
componentManager = ComponentManagerFactory.getComponentManager();
component = new RayoComponent(this);
try {
componentManager.addComponent(serviceName, component);
bridge.appStart(pluginDirectory);
checkNatives(pluginDirectory);
checkRecordingFolder(pluginDirectory);
SessionEventDispatcher.addListener(this);
} catch (ComponentException e) {
Log.error("Could NOT load " + component.getName());
}
setup();
component.doStart();
}
示例10: startFederation
import org.xmpp.component.ComponentException; //导入依赖的package包/类
@Override
public void startFederation() {
try {
transport.run();
} catch (ComponentException e) {
LOG.warning("couldn't connect to XMPP server:", e);
}
}
示例11: run
import org.xmpp.component.ComponentException; //导入依赖的package包/类
/**
* Bind the component to the XMPP server.
*
* @throws ComponentException if the component couldn't talk to the server
*/
public void run() throws ComponentException {
componentManager = new ExternalComponentManager(serverAddress, serverPort);
componentManager.setDefaultSecretKey(serverSecret);
componentManager.setServerName(serverDomain);
// Register this component with the manager.
componentManager.addComponent(componentName, this);
}
示例12: addComponent
import org.xmpp.component.ComponentException; //导入依赖的package包/类
public void addComponent(String subdomain, Component component, Integer port) throws ComponentException {
if (componentsByDomain.containsKey(subdomain)) {
if (componentsByDomain.get(subdomain).getComponent() == component) {
// Do nothing since the component has already been registered
return;
}
else {
throw new IllegalArgumentException("Subdomain already in use by another component");
}
}
// Create a wrapping ExternalComponent on the component
ExternalComponent externalComponent = new ExternalComponent(component, this);
try {
// Register the new component
componentsByDomain.put(subdomain, externalComponent);
components.put(component, externalComponent);
// Ask the ExternalComponent to connect with the remote server
externalComponent.connect(host, port, subdomain, startEncrypted);
// Initialize the component
JID componentJID = new JID(null, externalComponent.getDomain(), null);
externalComponent.initialize(componentJID, this);
}
catch (ComponentException e) {
// Unregister the new component
componentsByDomain.remove(subdomain);
components.remove(component);
// Re-throw the exception
throw e;
}
// Ask the external component to start processing incoming packets
externalComponent.start();
}
示例13: removeComponent
import org.xmpp.component.ComponentException; //导入依赖的package包/类
public void removeComponent(String subdomain) throws ComponentException {
ExternalComponent externalComponent = componentsByDomain.remove(subdomain);
if (externalComponent != null) {
components.remove(externalComponent.getComponent());
externalComponent.shutdown();
}
}
示例14: registerMultiUserChatService
import org.xmpp.component.ComponentException; //导入依赖的package包/类
/**
* Registers a new MultiUserChatService implementation to the manager.
* This is typically used if you have a custom MUC implementation that you
* want to register with the manager. In other words, it may not be database
* stored and may follow special rules, implementating MultiUserChatService.
* It is also used internally to register services from the database. Triggers
* the service to start up.
*
* @param service The MultiUserChatService to be registered.
*/
public void registerMultiUserChatService(MultiUserChatService service) {
Log.debug("MultiUserChatManager: Registering MUC service "+service.getServiceName());
try {
ComponentManagerFactory.getComponentManager().addComponent(service.getServiceName(), service);
mucServices.put(service.getServiceName(), service);
}
catch (ComponentException e) {
Log.error("MultiUserChatManager: Unable to add "+service.getServiceName()+" as component.", e);
}
}
示例15: unregisterMultiUserChatService
import org.xmpp.component.ComponentException; //导入依赖的package包/类
/**
* Unregisters a MultiUserChatService from the manager. It can be used
* to explicitly unregister services, and is also used internally to unregister
* database stored services. Triggers the service to shut down.
*
* @param subdomain The subdomain of the service to be unregistered.
*/
public void unregisterMultiUserChatService(String subdomain) {
Log.debug("MultiUserChatManager: Unregistering MUC service "+subdomain);
MultiUserChatService service = mucServices.get(subdomain);
if (service != null) {
service.shutdown();
try {
ComponentManagerFactory.getComponentManager().removeComponent(subdomain);
}
catch (ComponentException e) {
Log.error("MultiUserChatManager: Unable to remove "+subdomain+" from component manager.", e);
}
mucServices.remove(subdomain);
}
}