Author: trustin Date: Tue Nov 30 22:51:08 2004 New Revision: 109304 URL: http://svn.apache.org/viewcvs?view=rev&rev=109304 Log: * Added service registry package interfaces (thanks to Alex) Added: incubator/directory/seda/branches/trustin/src/java/org/apache/netty/registry/Service.java incubator/directory/seda/branches/trustin/src/java/org/apache/netty/registry/ServiceRegistry.java incubator/directory/seda/branches/trustin/src/java/org/apache/netty/registry/TransportType.java (contents, props changed) Modified: incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Acceptor.java incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Connector.java incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Session.java
Added: incubator/directory/seda/branches/trustin/src/java/org/apache/netty/registry/Service.java Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/trustin/src/java/org/apache/netty/registry/Service.java?view=auto&rev=109304 ============================================================================== --- (empty file) +++ incubator/directory/seda/branches/trustin/src/java/org/apache/netty/registry/Service.java Tue Nov 30 22:51:08 2004 @@ -0,0 +1,37 @@ +/* + * Copyright 2004 The Apache Software Foundation + * + * Licensed 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. + * + */ +/* + * @(#) $Id$ + */ +package org.apache.netty.registry; + + +/** + * TODO Insert type comment. + * + * @author Trustin Lee ([EMAIL PROTECTED]) + * @version $Rev$, $Date$ + */ +public interface Service { + String getName(); + + TransportType getTransportType(); + + int getPort(); + + Object getSessionHandler(); +} Added: incubator/directory/seda/branches/trustin/src/java/org/apache/netty/registry/ServiceRegistry.java Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/trustin/src/java/org/apache/netty/registry/ServiceRegistry.java?view=auto&rev=109304 ============================================================================== --- (empty file) +++ incubator/directory/seda/branches/trustin/src/java/org/apache/netty/registry/ServiceRegistry.java Tue Nov 30 22:51:08 2004 @@ -0,0 +1,70 @@ +/* + * Copyright 2004 The Apache Software Foundation + * + * Licensed 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. + * + */ +/* + * @(#) $Id$ + */ +package org.apache.netty.registry; + +import java.io.IOException; + +import java.util.Iterator; + + +/** + * Interface for the internet service registry. The registry is used by + * Netty to associate services with ports and transport protocols. + * + * @author [EMAIL PROTECTED] + * @author [EMAIL PROTECTED] + * @version $Rev: 56478 $, $Date$ + */ +public interface ServiceRegistry { + void bind(Service service, + org.apache.netty.downstream.SessionHandler sessionHandler) + throws IOException; + + void bind(Service service, + org.apache.netty.upstream.SessionHandler sessionHandler) + throws IOException; + + void unbind(Service service); + + Iterator iterator(); + + Service getByName(String name, TransportType transportType); + + Service getByPort(int port, TransportType transportType); + + /** + * Gets an iteration over all the entries for a service by the name of the + * service. + * + * @param name the authoritative name of the service + * @return an Iterator over InetServiceEntry objects + */ + Iterator getByName(String name); + + /** + * Gets an iteration over all the entries for a service by port number. + * This method returns an Iterator over the set of InetServiceEntry objects + * since more than one transport protocol can be used on the same port. + * + * @param port the port one which the service resides + * @return an Iterator over InetServiceEntry objects + */ + Iterator getByPort(int port); +} Added: incubator/directory/seda/branches/trustin/src/java/org/apache/netty/registry/TransportType.java Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/trustin/src/java/org/apache/netty/registry/TransportType.java?view=auto&rev=109304 ============================================================================== --- (empty file) +++ incubator/directory/seda/branches/trustin/src/java/org/apache/netty/registry/TransportType.java Tue Nov 30 22:51:08 2004 @@ -0,0 +1,45 @@ +/* + * Copyright 2004 The Apache Software Foundation + * + * Licensed 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. + * + */ +/* + * @(#) $Id$ + */ +package org.apache.netty.registry; + + +/** + * TODO Insert type comment. + * + * @author Trustin Lee ([EMAIL PROTECTED]) + * @version $Rev$, $Date$ + */ +public class TransportType { + public static final TransportType TCP = new TransportType("TCP"); + public static final TransportType UDP = new TransportType("UDP"); + public static final TransportType VM = new TransportType("VM"); + private final String strVal; + + /** + * Creates a new instance. + */ + private TransportType(String strVal) { + this.strVal = strVal; + } + + public String toString() { + return strVal; + } +} Modified: incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Acceptor.java Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Acceptor.java?view=diff&rev=109304&p1=incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Acceptor.java&r1=109303&p2=incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Acceptor.java&r2=109304 ============================================================================== --- incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Acceptor.java (original) +++ incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Acceptor.java Tue Nov 30 22:51:08 2004 @@ -1,18 +1,38 @@ /* + * Copyright 2004 The Apache Software Foundation + * + * Licensed 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. + * + */ +/* * @(#) $Id$ */ package org.apache.netty.upstream; import java.io.IOException; + import java.net.SocketAddress; + /** * TODO Insert type comment. - * + * * @author Trustin Lee ([EMAIL PROTECTED]) * @version $Rev$, $Date$ */ public interface Acceptor { - void bind(SocketAddress address, SessionHandler defaultHandler) throws IOException; + void bind(SocketAddress address, SessionHandler defaultHandler) + throws IOException; + void unbind(SocketAddress address); } Modified: incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Connector.java Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Connector.java?view=diff&rev=109304&p1=incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Connector.java&r1=109303&p2=incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Connector.java&r2=109304 ============================================================================== --- incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Connector.java (original) +++ incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Connector.java Tue Nov 30 22:51:08 2004 @@ -1,13 +1,30 @@ /* + * Copyright 2004 The Apache Software Foundation + * + * Licensed 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. + * + */ +/* * @(#) $Id$ */ package org.apache.netty.upstream; import java.net.SocketAddress; + /** * TODO Insert type comment. - * + * * @author Trustin Lee ([EMAIL PROTECTED]) * @version $Rev$, $Date$ */ Modified: incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Session.java Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Session.java?view=diff&rev=109304&p1=incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Session.java&r1=109303&p2=incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Session.java&r2=109304 ============================================================================== --- incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Session.java (original) +++ incubator/directory/seda/branches/trustin/src/java/org/apache/netty/upstream/Session.java Tue Nov 30 22:51:08 2004 @@ -1,4 +1,20 @@ /* + * Copyright 2004 The Apache Software Foundation + * + * Licensed 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. + * + */ +/* * @(#) $Id$ */ package org.apache.netty.upstream; @@ -7,32 +23,39 @@ import org.apache.netty.common.SessionConfig; + /** * TODO Insert type comment. - * + * * @author Trustin Lee ([EMAIL PROTECTED]) * @version $Rev$, $Date$ */ public interface Session { void addHandler(SessionHandler handler); + void removeHandler(SessionHandler handler); - + Codec getCodec(); + void setCodec(Codec codec); void close(); - + boolean write(Object message); - + boolean isConnected(); + boolean isClosed(); - + SessionConfig getConfig(); SocketAddress getRemoteAddress(); + SocketAddress getLocalAddress(); - + long getLastIoTime(); + long getLastReadTime(); + long getLastWriteTime(); }
