You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by tr...@apache.org on 2007/10/29 04:19:58 UTC
svn commit: r589477 - in /mina/trunk/statemachine: ./
src/main/java/org/apache/mina/statemachine/context/
src/main/java/org/apache/mina/statemachine/event/
src/main/java/org/apache/mina/statemachine/mina/
Author: trustin
Date: Sun Oct 28 20:19:58 2007
New Revision: 589477
URL: http://svn.apache.org/viewvc?rev=589477&view=rev
Log:
* Renamed statemachine.mina.MinaStateContextLookup to statemachine.context.IoSessionStateContextLookup
* Renamed statemachine.mina.Events to statemachine.event.IoSessionEvents
* Made mina-core as an optional dependency
Added:
mina/trunk/statemachine/src/main/java/org/apache/mina/statemachine/context/IoSessionStateContextLookup.java (with props)
mina/trunk/statemachine/src/main/java/org/apache/mina/statemachine/event/IoSessionEvents.java (with props)
Removed:
mina/trunk/statemachine/src/main/java/org/apache/mina/statemachine/mina/
Modified:
mina/trunk/statemachine/pom.xml
Modified: mina/trunk/statemachine/pom.xml
URL: http://svn.apache.org/viewvc/mina/trunk/statemachine/pom.xml?rev=589477&r1=589476&r2=589477&view=diff
==============================================================================
--- mina/trunk/statemachine/pom.xml (original)
+++ mina/trunk/statemachine/pom.xml Sun Oct 28 20:19:58 2007
@@ -16,6 +16,7 @@
<dependency>
<groupId>${groupId}</groupId>
<artifactId>mina-core</artifactId>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
Added: mina/trunk/statemachine/src/main/java/org/apache/mina/statemachine/context/IoSessionStateContextLookup.java
URL: http://svn.apache.org/viewvc/mina/trunk/statemachine/src/main/java/org/apache/mina/statemachine/context/IoSessionStateContextLookup.java?rev=589477&view=auto
==============================================================================
--- mina/trunk/statemachine/src/main/java/org/apache/mina/statemachine/context/IoSessionStateContextLookup.java (added)
+++ mina/trunk/statemachine/src/main/java/org/apache/mina/statemachine/context/IoSessionStateContextLookup.java Sun Oct 28 20:19:58 2007
@@ -0,0 +1,70 @@
+/*
+ * 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.mina.statemachine.context;
+
+import org.apache.mina.common.IoSession;
+
+/**
+ * MINA specific {@link StateContextLookup} which uses an {@link IoSession}
+ * attribute to store the {@link StateContextLookup}.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
+ */
+public class IoSessionStateContextLookup extends AbstractStateContextLookup {
+ /**
+ * The name of the {@link IoSession} attribute used to store the
+ * {@link StateContext} object.
+ */
+ public static final String STATE_CONTEXT =
+ IoSessionStateContextLookup.class.getName() + ".stateContext";
+
+ /**
+ * Creates a new instance using a {@link DefaultStateContextFactory} to
+ * create {@link StateContext} objects for new {@link IoSession}s.
+ */
+ public IoSessionStateContextLookup() {
+ this(new DefaultStateContextFactory());
+ }
+
+ /**
+ * Creates a new instance using the specified {@link StateContextFactory} to
+ * create {@link StateContext} objects for new {@link IoSession}s.
+ *
+ * @param contextFactory the {@link StateContextFactory}.
+ */
+ public IoSessionStateContextLookup(StateContextFactory contextFactory) {
+ super(contextFactory);
+ }
+
+ protected StateContext lookup(Object eventArg) {
+ IoSession session = (IoSession) eventArg;
+ return (StateContext) session.getAttribute(STATE_CONTEXT);
+ }
+
+ protected void store(Object eventArg, StateContext context) {
+ IoSession session = (IoSession) eventArg;
+ session.setAttribute(STATE_CONTEXT, context);
+ }
+
+ protected boolean supports(Class<?> c) {
+ return IoSession.class.isAssignableFrom(c);
+ }
+}
Propchange: mina/trunk/statemachine/src/main/java/org/apache/mina/statemachine/context/IoSessionStateContextLookup.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: mina/trunk/statemachine/src/main/java/org/apache/mina/statemachine/context/IoSessionStateContextLookup.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: mina/trunk/statemachine/src/main/java/org/apache/mina/statemachine/event/IoSessionEvents.java
URL: http://svn.apache.org/viewvc/mina/trunk/statemachine/src/main/java/org/apache/mina/statemachine/event/IoSessionEvents.java?rev=589477&view=auto
==============================================================================
--- mina/trunk/statemachine/src/main/java/org/apache/mina/statemachine/event/IoSessionEvents.java (added)
+++ mina/trunk/statemachine/src/main/java/org/apache/mina/statemachine/event/IoSessionEvents.java Sun Oct 28 20:19:58 2007
@@ -0,0 +1,49 @@
+/*
+ * 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.mina.statemachine.event;
+
+import org.apache.mina.common.IoHandler;
+import org.apache.mina.statemachine.annotation.Handler;
+
+/**
+ * Defines all possible MINA {@link IoHandler} events for use in {@link Handler}
+ * annotations.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
+ */
+public final class IoSessionEvents {
+ public static final String SESSION_CREATED = "sessionCreated";
+
+ public static final String SESSION_OPENED = "sessionOpened";
+
+ public static final String SESSION_CLOSED = "sessionClosed";
+
+ public static final String SESSION_IDLE = "sessionIdle";
+
+ public static final String MESSAGE_RECEIVED = "messageReceived";
+
+ public static final String MESSAGE_SENT = "messageSent";
+
+ public static final String EXCEPTION_CAUGHT = "exceptionCaught";
+
+ private IoSessionEvents() {
+ }
+}
Propchange: mina/trunk/statemachine/src/main/java/org/apache/mina/statemachine/event/IoSessionEvents.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: mina/trunk/statemachine/src/main/java/org/apache/mina/statemachine/event/IoSessionEvents.java
------------------------------------------------------------------------------
svn:keywords = Rev Date