You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by ng...@apache.org on 2011/01/16 11:04:18 UTC
svn commit: r1059526 -
/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/
Author: ngn
Date: Sun Jan 16 10:04:17 2011
New Revision: 1059526
URL: http://svn.apache.org/viewvc?rev=1059526&view=rev
Log:
Adding Javadoc
Adding missing license headers
Modified:
mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/DefaultXMPPServerConnector.java
mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/DefaultXMPPServerConnectorRegistry.java
mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/XMPPServerConnector.java
mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/XMPPServerConnectorRegistry.java
mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/XmppEndpointResolver.java
Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/DefaultXMPPServerConnector.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/DefaultXMPPServerConnector.java?rev=1059526&r1=1059525&r2=1059526&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/DefaultXMPPServerConnector.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/DefaultXMPPServerConnector.java Sun Jan 16 10:04:17 2011
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
package org.apache.vysper.xmpp.server.s2s;
import java.nio.channels.UnresolvedAddressException;
import java.util.Arrays;
@@ -41,6 +60,11 @@ import org.apache.vysper.xmpp.stanza.Sta
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Default implementation of {@link XMPPServerConnector}
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ */
public class DefaultXMPPServerConnector implements XmppPingListener, XMPPServerConnector {
private static final Logger LOG = LoggerFactory.getLogger(DefaultXMPPServerConnector.class);
@@ -71,6 +95,9 @@ public class DefaultXMPPServerConnector
this.dialbackSessionStateHolder = dialbackSessionStateHolder;
}
+ /**
+ * Connect and authenticate the XMPP server connector
+ */
public synchronized void start() throws RemoteServerNotFoundException, RemoteServerTimeoutException {
LOG.info("Starting XMPP server connector to {}", otherServer);
@@ -146,14 +173,17 @@ public class DefaultXMPPServerConnector
pingTimer.schedule(new PingTask(), pingPeriod, pingPeriod);
}
}
-
- /* (non-Javadoc)
- * @see org.apache.vysper.xmpp.server.s2s.XMPPServerConnector#write(org.apache.vysper.xmpp.stanza.Stanza)
+
+ /**
+ * {@inheritDoc}
*/
public void write(Stanza stanza) {
sessionContext.write(stanza);
}
+ /**
+ * {@inheritDoc}
+ */
public void close() {
closed = true;
if(!closed) {
@@ -166,15 +196,25 @@ public class DefaultXMPPServerConnector
}
}
+ /**
+ * {@inheritDoc}
+ */
public void pong() {
// do nothing, all happy
}
+ /**
+ * {@inheritDoc}
+ */
public void timeout() {
LOG.debug("XMPP server connector to {} timed out, closing", otherServer);
close();
}
+ /**
+ * Is this XMPP server connector closed?
+ * @return true if the connector is closed
+ */
public boolean isClosed() {
return closed;
}
@@ -194,6 +234,9 @@ public class DefaultXMPPServerConnector
this.authenticatedLatch = authenticatedLatch;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void exceptionCaught(IoSession session, Throwable cause) throws Exception {
LOG.warn("Exception thrown by XMPP server connector to " + otherServer + ", probably a bug in Vysper", cause);
@@ -208,6 +251,9 @@ public class DefaultXMPPServerConnector
return null;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void messageReceived(IoSession session, Object message) throws Exception {
if(message == SslFilter.SESSION_SECURED) {
@@ -276,6 +322,9 @@ public class DefaultXMPPServerConnector
}
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void sessionClosed(IoSession session) throws Exception {
// Socket was closed, make sure we close the connector
@@ -283,6 +332,9 @@ public class DefaultXMPPServerConnector
close();
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public void sessionOpened(IoSession session) throws Exception {
sessionContext = new MinaBackedSessionContext(serverRuntimeContext, sessionStateHolder, session);
Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/DefaultXMPPServerConnectorRegistry.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/DefaultXMPPServerConnectorRegistry.java?rev=1059526&r1=1059525&r2=1059526&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/DefaultXMPPServerConnectorRegistry.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/DefaultXMPPServerConnectorRegistry.java Sun Jan 16 10:04:17 2011
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
package org.apache.vysper.xmpp.server.s2s;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -10,6 +29,11 @@ import org.apache.vysper.xmpp.protocol.S
import org.apache.vysper.xmpp.server.ServerRuntimeContext;
import org.apache.vysper.xmpp.server.SessionContext;
+/**
+ * Default implementation of {@link XMPPServerConnectorRegistry}
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ */
public class DefaultXMPPServerConnectorRegistry implements XMPPServerConnectorRegistry {
private ServerRuntimeContext serverRuntimeContext;
@@ -22,7 +46,7 @@ public class DefaultXMPPServerConnectorR
/* (non-Javadoc)
* @see org.apache.vysper.xmpp.server.s2s.XMPPServerConnectorRegistry#getConnector(org.apache.vysper.xmpp.addressing.Entity)
*/
- @SpecCompliant(spec = "draft-ietf-xmpp-3920bis-22", section = "10.4", status = SpecCompliant.ComplianceStatus.IN_PROGRESS, coverage = SpecCompliant.ComplianceCoverage.COMPLETE)
+ @SpecCompliant(spec = "draft-ietf-xmpp-3920bis-22", section = "10.4", status = SpecCompliant.ComplianceStatus.FINISHED, coverage = SpecCompliant.ComplianceCoverage.COMPLETE)
public synchronized XMPPServerConnector connect(Entity server) throws RemoteServerNotFoundException, RemoteServerTimeoutException {
DefaultXMPPServerConnector connector = connectors.get(server);
@@ -41,6 +65,7 @@ public class DefaultXMPPServerConnectorR
return connector;
}
+ @SpecCompliant(spec = "draft-ietf-xmpp-3920bis-22", section = "10.4", status = SpecCompliant.ComplianceStatus.FINISHED, coverage = SpecCompliant.ComplianceCoverage.COMPLETE)
public synchronized XMPPServerConnector connectForDialback(Entity server, SessionContext orginalSessionContext, SessionStateHolder originalSessionStateHolder) throws RemoteServerNotFoundException, RemoteServerTimeoutException {
DefaultXMPPServerConnector connector = new DefaultXMPPServerConnector(server, serverRuntimeContext, orginalSessionContext, originalSessionStateHolder);
connector.start();
Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/XMPPServerConnector.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/XMPPServerConnector.java?rev=1059526&r1=1059525&r2=1059526&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/XMPPServerConnector.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/XMPPServerConnector.java Sun Jan 16 10:04:17 2011
@@ -1,10 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
package org.apache.vysper.xmpp.server.s2s;
import org.apache.vysper.xmpp.stanza.Stanza;
import org.apache.vysper.xmpp.writer.StanzaWriter;
+/**
+ * Connector for outgoing connections to other XMPP servers.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ */
public interface XMPPServerConnector extends StanzaWriter {
+ /**
+ * Write a {@link Stanza} to another XMPP server
+ * @param stanza The {@link Stanza} to write
+ */
void write(Stanza stanza);
}
\ No newline at end of file
Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/XMPPServerConnectorRegistry.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/XMPPServerConnectorRegistry.java?rev=1059526&r1=1059525&r2=1059526&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/XMPPServerConnectorRegistry.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/XMPPServerConnectorRegistry.java Sun Jan 16 10:04:17 2011
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
package org.apache.vysper.xmpp.server.s2s;
import org.apache.vysper.xmpp.addressing.Entity;
@@ -6,11 +25,36 @@ import org.apache.vysper.xmpp.delivery.f
import org.apache.vysper.xmpp.protocol.SessionStateHolder;
import org.apache.vysper.xmpp.server.SessionContext;
+/**
+ * Registry for {@link XMPPServerConnector} for external XMPP servers.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ */
public interface XMPPServerConnectorRegistry {
+ /**
+ * Connects or reuses an existing connection to an external XMPP server.
+ *
+ * @param server The domain name of the external XMPP server
+ * @return An {@link XMPPServerConnector} for writing stanzas for the external server
+ * @throws RemoteServerNotFoundException
+ * @throws RemoteServerTimeoutException
+ */
XMPPServerConnector connect(Entity server) throws RemoteServerNotFoundException,
RemoteServerTimeoutException;
+ /**
+ * Connects to an external XMPP server for server dialback processing.
+ *
+ * @param server The domain name of the external XMPP server
+ * @param sessionContext The {@link SessionContext} for the original connection that is being
+ * authenticated using server dialback
+ * @param sessionStateHolder The {@link SessionStateHolder} for the original connection that is being
+ * authenticated using server dialback
+ * @return An {@link XMPPServerConnector} for server dialback
+ * @throws RemoteServerNotFoundException
+ * @throws RemoteServerTimeoutException
+ */
XMPPServerConnector connectForDialback(Entity server, SessionContext sessionContext, SessionStateHolder sessionStateHolder) throws RemoteServerNotFoundException,
RemoteServerTimeoutException;
Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/XmppEndpointResolver.java
URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/XmppEndpointResolver.java?rev=1059526&r1=1059525&r2=1059526&view=diff
==============================================================================
--- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/XmppEndpointResolver.java (original)
+++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/s2s/XmppEndpointResolver.java Sun Jan 16 10:04:17 2011
@@ -1,3 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
package org.apache.vysper.xmpp.server.s2s;
import java.net.InetSocketAddress;
import java.util.ArrayList;