本文整理汇总了Java中org.jivesoftware.util.Log.error方法的典型用法代码示例。如果您正苦于以下问题:Java Log.error方法的具体用法?Java Log.error怎么用?Java Log.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.util.Log
的用法示例。
在下文中一共展示了Log.error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setMap
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
public void setMap(Map map) {
Element element = DocumentHelper.createElement(namespace);
final Iterator i = element.elementIterator();
while (i.hasNext()) {
element.remove((Element)i.next());
}
final Iterator iter = map.keySet().iterator();
while (iter.hasNext()) {
String key = (String)iter.next();
String value = (String)map.get(key);
Element elem = DocumentHelper.createElement("entry");
elem.addElement(key).setText(value);
element.add(elem);
}
try {
workgroupSettings.add(workgroup.getJID().toBareJID(), element);
}
catch (Exception ex) {
Log.error(ex.getMessage(), ex);
}
}
示例2: negotiateTLS
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
/**
* Tries to secure the connection using TLS. If the connection is secured then reset
* the parser to use the new secured reader. But if the connection failed to be secured
* then send a <failure> stanza and close the connection.
*
* @return true if the connection was secured.
*/
private boolean negotiateTLS() {
if (connection.getTlsPolicy() == Connection.TLSPolicy.disabled) {
// Set the not_authorized error
StreamError error = new StreamError(StreamError.Condition.not_authorized);
// Deliver stanza
connection.deliverRawText(error.toXML());
// Close the underlying connection
connection.close();
// Log a warning so that admins can track this case from the server side
Log.warn("TLS requested by initiator when TLS was never offered by server. " +
"Closing connection : " + connection);
return false;
}
// Client requested to secure the connection using TLS. Negotiate TLS.
try {
connection.startTLS(false, null);
}
catch (Exception e) {
Log.error("Error while negotiating TLS", e);
connection.deliverRawText("<failure xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\">");
connection.close();
return false;
}
return true;
}
示例3: getSession
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
Session getSession() {
if (sessionType == SessionType.client) {
return XMPPServer.getInstance().getRoutingTable().getClientRoute(address);
}
else if (sessionType == SessionType.component) {
return SessionManager.getInstance().getComponentSession(address.getDomain());
}
else if (sessionType == SessionType.connectionManager) {
return SessionManager.getInstance().getConnectionMultiplexerSession(address);
}
else if (sessionType == SessionType.outgoingServer) {
return SessionManager.getInstance().getOutgoingServerSession(address.getDomain());
}
else if (sessionType == SessionType.incomingServer) {
return SessionManager.getInstance().getIncomingServerSession(streamID);
}
Log.error("Found unknown session type: " + sessionType);
return null;
}
示例4: ProcessPacketTask
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
protected ProcessPacketTask(RemoteSession remoteSession, JID address, Packet packet) {
if (remoteSession instanceof RemoteClientSession) {
this.sessionType = SessionType.client;
}
else if (remoteSession instanceof RemoteOutgoingServerSession) {
this.sessionType = SessionType.outgoingServer;
}
else if (remoteSession instanceof RemoteComponentSession) {
this.sessionType = SessionType.component;
}
else if (remoteSession instanceof RemoteConnectionMultiplexerSession) {
this.sessionType = SessionType.connectionManager;
}
else {
Log.error("Invalid RemoteSession was used for task: " + remoteSession);
}
this.address = address;
this.packet = packet;
}
示例5: onEndPage
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
@Override
public void onEndPage(PdfWriter writer, Document document) {
PdfContentByte cb = writer.getDirectContent();
try {
cb.setColorStroke(new Color(156,156,156));
cb.setLineWidth(2);
cb.moveTo(document.leftMargin(), document.bottomMargin() + 32);
cb.lineTo(document.getPageSize().width() - document.rightMargin(), document.bottomMargin() + 32);
cb.stroke();
Image gif = Image.getInstance("http://" + request.getServerName() +
":" + request.getServerPort() + "/plugins/"+MonitoringConstants.NAME+"/images/pdf_generatedbyof.gif");
cb.addImage(gif, 221, 0, 0, 28, (int)document.leftMargin(), (int)document.bottomMargin());
} catch (Exception e) {
Log.error("error drawing PDF footer: " + e.getMessage());
}
cb.saveState();
}
示例6: getSession
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
Session getSession() {
if (sessionType == SessionType.client) {
return XMPPServer.getInstance().getRoutingTable().getClientRoute(address);
}
else if (sessionType == SessionType.component) {
return SessionManager.getInstance().getComponentSession(address.getDomain());
}
else if (sessionType == SessionType.connectionManager) {
return SessionManager.getInstance().getConnectionMultiplexerSession(address);
}
else if (sessionType == SessionType.outgoingServer) {
final DomainPair pair = new DomainPair(packet.getFrom().getDomain(), address.getDomain());
return SessionManager.getInstance().getOutgoingServerSession(pair);
}
else if (sessionType == SessionType.incomingServer) {
return SessionManager.getInstance().getIncomingServerSession(streamID);
}
Log.error("Found unknown session type: " + sessionType);
return null;
}
示例7: isChainTrusted
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
private boolean isChainTrusted(X509Certificate[] chain) {
boolean trusted = false;
try {
// Start with the root and see if it is in the Keystore.
// The root is at the end of the chain.
for (int i = chain.length - 1; i >= 0; i--) {
if (trustStore.getCertificateAlias(chain[i]) != null) {
trusted = true;
break;
}
}
}
catch (Exception e) {
Log.error(e);
trusted = false;
}
return trusted;
}
示例8: get
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
/**
* Returns the data stored under a key corresponding to the name and namespace
* of the given element. The Element must be in the form:<p>
*
* <code><name xmlns='namespace'/></code><p>
*
* If no data is currently stored under the given key, an empty element will be
* returned.
*
* @param data an XML document who's element name and namespace is used to
* match previously stored private data.
* @param workgroupName the name of the workgroup who's data is to be stored.
* @return the data stored under the given key or the data element.
*/
public Element get(String workgroupName, Element data) {
data.clearContent();
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(LOAD_SETTINGS);
pstmt.setString(1, workgroupName);
pstmt.setString(2, data.getNamespaceURI());
rs = pstmt.executeQuery();
if (rs.next()) {
Document document = DocumentHelper.parseText(rs.getString(1).trim());
data = document.getRootElement();
}
}
catch (Exception e) {
Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
}
finally {
DbConnectionManager.closeConnection(rs, pstmt, con);
}
return data;
}
示例9: initializePlugin
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
public void initializePlugin(PluginManager manager, File pluginDirectory) {
Log.info("ServerInfo - Starting plugin.");
Log.debug("ServerInfo - Starting plugin.");
pluginManager = manager;
sessionManager = SessionManager.getInstance();
String serverInfoPort = JiveGlobals.getProperty(SERVERINFOPORT, "4455");
userManager = UserManager.getInstance();
// Register as a component.
componentManager = ComponentManagerFactory.getComponentManager();
try {
componentManager.addComponent(serviceName, this);
}
catch (Exception e) {
Log.error(e.getMessage(), e);
}
PropertyEventDispatcher.addListener(this);
Log.info("ServerInfo - Starting bind on port " + serverInfoPort + ".");
Log.debug("ServerInfo - Starting bind on port " + serverInfoPort + ".");
ofd_srv.startServer();
}
示例10: deleteOldHistoryEntries
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
public void deleteOldHistoryEntries()
{
Connection con = null;
PreparedStatement pstmt = null;
if (historyDays > 0)
{
final Date deleteBefore;
deleteBefore = new Date(System.currentTimeMillis() - historyDays * 24L * 60L * 60L * 1000L);
try
{
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(DELETE_OLD_USER_STATUS_HISTORY);
pstmt.setString(1, StringUtils.dateToMillis(deleteBefore));
pstmt.executeUpdate();
}
catch (SQLException e)
{
Log.error("Unable to delete old user status history", e);
}
finally
{
DbConnectionManager.closeConnection(pstmt, con);
}
}
}
示例11: countConversationsBefore
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
private int countConversationsBefore(Date startDate, Date endDate, String ownerJid, String withJid, Long before, String whereClause) {
StringBuilder querySB;
querySB = new StringBuilder(COUNT_CONVERSATIONS);
querySB.append(" WHERE ");
if (whereClause != null && whereClause.length() != 0) {
querySB.append(whereClause);
querySB.append(" AND ");
}
querySB.append(CONVERSATION_ID).append(" < ?");
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
int parameterIndex;
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(querySB.toString());
parameterIndex = bindConversationParameters(startDate, endDate, ownerJid, withJid, pstmt);
pstmt.setLong(parameterIndex, before);
rs = pstmt.executeQuery();
if (rs.next()) {
return rs.getInt(1);
} else {
return 0;
}
} catch (SQLException sqle) {
Log.error("Error counting conversations", sqle);
return 0;
} finally {
DbConnectionManager.closeConnection(rs, pstmt, con);
}
}
示例12: closeFolder
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
private static void closeFolder(Folder folder, MessageCountAdapter messageListener) {
if (folder != null) {
if (messageListener != null) {
folder.removeMessageCountListener(messageListener);
}
try {
folder.close(false);
}
catch (MessagingException e) {
Log.error("Error closing folder", e);
}
}
}
示例13: countMessagesBefore
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
private Integer countMessagesBefore(Date startDate, Date endDate,
String ownerJid, String withJid, Long before, String whereClause) {
StringBuilder querySB;
querySB = new StringBuilder(COUNT_MESSAGES);
querySB.append(" AND ");
if (whereClause != null && whereClause.length() != 0) {
querySB.append(whereClause);
querySB.append(" AND ");
}
querySB.append(MESSAGE_ID).append(" < ?");
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
int parameterIndex;
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(querySB.toString());
parameterIndex = bindMessageParameters(startDate, endDate, ownerJid, withJid, pstmt);
pstmt.setLong(parameterIndex, before);
rs = pstmt.executeQuery();
if (rs.next()) {
return rs.getInt(1);
} else {
return 0;
}
} catch (SQLException sqle) {
Log.error("Error counting conversations", sqle);
return 0;
} finally {
DbConnectionManager.closeConnection(rs, pstmt, con);
}
}
示例14: getAcceptedIssuers
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
public X509Certificate[] getAcceptedIssuers() {
if (JiveGlobals.getBooleanProperty("xmpp.server.certificate.accept-selfsigned", false)) {
// Answer an empty list since we accept any issuer
return new X509Certificate[0];
}
else {
X509Certificate[] X509Certs = null;
try {
// See how many certificates are in the keystore.
int numberOfEntry = trustStore.size();
// If there are any certificates in the keystore.
if (numberOfEntry > 0) {
// Create an array of X509Certificates
X509Certs = new X509Certificate[numberOfEntry];
// Get all of the certificate alias out of the keystore.
Enumeration aliases = trustStore.aliases();
// Retrieve all of the certificates out of the keystore
// via the alias name.
int i = 0;
while (aliases.hasMoreElements()) {
X509Certs[i] =
(X509Certificate) trustStore.
getCertificate((String) aliases.nextElement());
i++;
}
}
}
catch (Exception e) {
Log.error(e);
X509Certs = null;
}
return X509Certs;
}
}
示例15: openFolder
import org.jivesoftware.util.Log; //导入方法依赖的package包/类
private static Folder openFolder(String host, Integer port, Boolean isSSLEnabled, String user, String password,
String folder) {
if (host == null || port == null || isSSLEnabled == null || user == null || password == null || folder == null) {
return null;
}
try {
Properties props = System.getProperties();
props.setProperty("mail.imap.host", host);
props.setProperty("mail.imap.port", String.valueOf(port));
props.setProperty("mail.imap.connectiontimeout", String.valueOf(10 * 1000));
// Allow messages with a mix of valid and invalid recipients to still be sent.
props.setProperty("mail.debug", JiveGlobals.getProperty("plugin.email.listener.debug", "false"));
// Methology from an article on www.javaworld.com (Java Tip 115)
// We will attempt to failback to an insecure connection
// if the secure one cannot be made
if (isSSLEnabled) {
// Register with security provider.
Security.setProperty("ssl.SocketFactory.provider", SSL_FACTORY);
//props.setProperty("mail.imap.starttls.enable", "true");
props.setProperty("mail.imap.socketFactory.class", SSL_FACTORY);
props.setProperty("mail.imap.socketFactory.fallback", "true");
}
// Get a Session object
Session session = Session.getInstance(props, null);
// Get a Store object
Store store = session.getStore(isSSLEnabled ? "imaps" : "imap");
// Connect
store.connect(host, user, password);
// Open a Folder
Folder newFolder = store.getFolder(folder);
if (newFolder == null || !newFolder.exists()) {
Log.error("Invalid email folder: " + folder);
return null;
}
newFolder.open(Folder.READ_WRITE);
return newFolder;
}
catch (Exception e) {
Log.error("Error while initializing email listener", e);
}
return null;
}