You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by ni...@apache.org on 2007/10/18 20:39:49 UTC

svn commit: r586063 [1/3] - in /mina/sandbox/niklas/mina-sm: ./ src/main/java/org/apache/mina/sm/ src/main/java/org/apache/mina/sm/annotation/ src/main/java/org/apache/mina/sm/context/ src/main/java/org/apache/mina/sm/event/ src/main/java/org/apache/mi...

Author: niklas
Date: Thu Oct 18 11:39:46 2007
New Revision: 586063

URL: http://svn.apache.org/viewvc?rev=586063&view=rev
Log:
* Changed the header in all source files to the header used in MINA trunk.
* Changed to the proper @author tag in all source files.
* Fixed sources to follow the coding conventions used in trunk.
* Removed some unused constructors from the exception classes.
* Changed the visibility of Break*Exception classes to package private.

Removed:
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/finite/
Modified:
    mina/sandbox/niklas/mina-sm/pom.xml
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndCallException.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndContinueException.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndGotoException.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndReturnException.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/NoSuchStateException.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/State.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateControl.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachine.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachineCreationException.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachineFactory.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachineProxyFactory.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/annotation/Handler.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/annotation/Handlers.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/annotation/State.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/context/AbstractStateContext.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/context/AbstractStateContextLookup.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/context/DefaultStateContext.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/context/DefaultStateContextFactory.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/context/SingletonStateContextLookup.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/context/StateContext.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/context/StateContextFactory.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/context/StateContextLookup.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/event/DefaultEventFactory.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/event/Event.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/event/EventArgumentsInterceptor.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/event/EventFactory.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/event/UnhandledEventException.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/mina/Events.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/mina/MinaStateContextLookup.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/transition/AbstractTransition.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/transition/AmbiguousMethodException.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/transition/MethodInvocationException.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/transition/MethodTransition.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/transition/NoSuchMethodException.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/transition/NoopTransition.java
    mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/transition/Transition.java
    mina/sandbox/niklas/mina-sm/src/test/java/org/apache/mina/sm/StateMachineFactoryTest.java
    mina/sandbox/niklas/mina-sm/src/test/java/org/apache/mina/sm/StateMachineProxyFactoryTest.java
    mina/sandbox/niklas/mina-sm/src/test/java/org/apache/mina/sm/StateMachineTest.java
    mina/sandbox/niklas/mina-sm/src/test/java/org/apache/mina/sm/StateTest.java
    mina/sandbox/niklas/mina-sm/src/test/java/org/apache/mina/sm/context/AbstractStateContextLookupTest.java
    mina/sandbox/niklas/mina-sm/src/test/java/org/apache/mina/sm/transition/MethodTransitionTest.java

Modified: mina/sandbox/niklas/mina-sm/pom.xml
URL: http://svn.apache.org/viewvc/mina/sandbox/niklas/mina-sm/pom.xml?rev=586063&r1=586062&r2=586063&view=diff
==============================================================================
--- mina/sandbox/niklas/mina-sm/pom.xml (original)
+++ mina/sandbox/niklas/mina-sm/pom.xml Thu Oct 18 11:39:46 2007
@@ -5,7 +5,7 @@
   <parent>
     <groupId>org.apache.mina</groupId>
     <artifactId>build</artifactId>
-    <version>1.0.0</version>
+    <version>1.1.0</version>
   </parent>
   <artifactId>mina-sm</artifactId>
   <name>Apache MINA State Machine Module</name>
@@ -19,7 +19,7 @@
     <dependency>
       <groupId>org.apache.mina</groupId>
       <artifactId>mina-core</artifactId>
-      <version>1.0.0</version>
+      <version>1.1.0</version>
     </dependency>
 
     <dependency>

Modified: mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndCallException.java
URL: http://svn.apache.org/viewvc/mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndCallException.java?rev=586063&r1=586062&r2=586063&view=diff
==============================================================================
--- mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndCallException.java (original)
+++ mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndCallException.java Thu Oct 18 11:39:46 2007
@@ -1,62 +1,56 @@
 /*
- *   @(#) $Id$
- *
- *   Copyright 2006 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.
+ *  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.sm;
 
 /**
  *
- * @author The Apache Directory Project (mina-dev@directory.apache.org)
+ * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
-public class BreakAndCallException extends RuntimeException
-{
+class BreakAndCallException extends RuntimeException {
     private final String stateId;
     private final String returnToStateId;
     private final boolean now;
 
-    public BreakAndCallException( String stateId, boolean now )
-    {
-        this( stateId, null, now );
+    public BreakAndCallException(String stateId, boolean now) {
+        this(stateId, null, now);
     }
-    
-    public BreakAndCallException( String stateId, String returnToStateId, boolean now )
-    {
-        if( stateId == null )
-        {
-            throw new NullPointerException( "stateId" );
+
+    public BreakAndCallException(String stateId, String returnToStateId, boolean now) {
+        if (stateId == null) {
+            throw new NullPointerException("stateId");
         }
         this.stateId = stateId;
         this.returnToStateId = returnToStateId;
         this.now = now;
     }
-    
-    public boolean isNow()
-    {
+
+    public boolean isNow() {
         return now;
     }
 
-    public String getStateId()
-    {
+    public String getStateId() {
         return stateId;
     }
 
-    public String getReturnToStateId()
-    {
+    public String getReturnToStateId() {
         return returnToStateId;
     }
 }

Modified: mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndContinueException.java
URL: http://svn.apache.org/viewvc/mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndContinueException.java?rev=586063&r1=586062&r2=586063&view=diff
==============================================================================
--- mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndContinueException.java (original)
+++ mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndContinueException.java Thu Oct 18 11:39:46 2007
@@ -1,29 +1,28 @@
 /*
- *   @(#) $Id$
- *
- *   Copyright 2006 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.
+ *  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.sm;
 
 /**
  *
- * @author The Apache Directory Project (mina-dev@directory.apache.org)
+ * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
-public class BreakAndContinueException extends RuntimeException
-{
-    
+class BreakAndContinueException extends RuntimeException {
 }

Modified: mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndGotoException.java
URL: http://svn.apache.org/viewvc/mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndGotoException.java?rev=586063&r1=586062&r2=586063&view=diff
==============================================================================
--- mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndGotoException.java (original)
+++ mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndGotoException.java Thu Oct 18 11:39:46 2007
@@ -1,52 +1,47 @@
 /*
- *   @(#) $Id$
- *
- *   Copyright 2006 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.
+ *  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.sm;
 
 /**
  *
- * @author The Apache Directory Project (mina-dev@directory.apache.org)
+ * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
-public class BreakAndGotoException extends RuntimeException
-{
+class BreakAndGotoException extends RuntimeException {
     private final String stateId;
     private final boolean now;
 
-    public BreakAndGotoException( String stateId, boolean now )
-    {
-        if( stateId == null )
-        {
-            throw new NullPointerException( "stateId" );
+    public BreakAndGotoException(String stateId, boolean now) {
+        if (stateId == null) {
+            throw new NullPointerException("stateId");
         }
         this.stateId = stateId;
         this.now = now;
     }
 
-    public boolean isNow()
-    {
+    public boolean isNow() {
         return now;
     }
 
-    public String getStateId()
-    {
+    public String getStateId() {
         return stateId;
     }
-    
-    
+
 }

Modified: mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndReturnException.java
URL: http://svn.apache.org/viewvc/mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndReturnException.java?rev=586063&r1=586062&r2=586063&view=diff
==============================================================================
--- mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndReturnException.java (original)
+++ mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/BreakAndReturnException.java Thu Oct 18 11:39:46 2007
@@ -1,39 +1,37 @@
 /*
- *   @(#) $Id$
- *
- *   Copyright 2006 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.
+ *  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.sm;
 
 /**
  *
- * @author The Apache Directory Project (mina-dev@directory.apache.org)
+ * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
-public class BreakAndReturnException extends RuntimeException
-{
+class BreakAndReturnException extends RuntimeException {
     private final boolean now;
 
-    public BreakAndReturnException( boolean now )
-    {
+    public BreakAndReturnException(boolean now) {
         this.now = now;
     }
 
-    public boolean isNow()
-    {
+    public boolean isNow() {
         return now;
     }
 }

Modified: mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/NoSuchStateException.java
URL: http://svn.apache.org/viewvc/mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/NoSuchStateException.java?rev=586063&r1=586062&r2=586063&view=diff
==============================================================================
--- mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/NoSuchStateException.java (original)
+++ mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/NoSuchStateException.java Thu Oct 18 11:39:46 2007
@@ -1,34 +1,33 @@
 /*
- *   @(#) $Id$
- *
- *   Copyright 2006 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.
+ *  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.sm;
 
 /**
  *
- * @author The Apache Directory Project (mina-dev@directory.apache.org)
+ * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
-public class NoSuchStateException extends RuntimeException
-{
+public class NoSuchStateException extends RuntimeException {
 
-    public NoSuchStateException( String stateId )
-    {
-        super( stateId );
+    public NoSuchStateException(String stateId) {
+        super(stateId);
     }
-    
+
 }

Modified: mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/State.java
URL: http://svn.apache.org/viewvc/mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/State.java?rev=586063&r1=586062&r2=586063&view=diff
==============================================================================
--- mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/State.java (original)
+++ mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/State.java Thu Oct 18 11:39:46 2007
@@ -1,19 +1,20 @@
 /*
- *   @(#) $Id$
- *
- *   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.
+ *  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.sm;
@@ -28,115 +29,92 @@
 import org.apache.mina.sm.transition.Transition;
 
 /**
- * 
  *
- * @author The Apache Directory Project (mina-dev@directory.apache.org)
+ * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
 public class State {
     private final String id;
     private final State parent;
-    private ArrayList<TransitionHolder> transitionHolders = 
-        new ArrayList<TransitionHolder>();
+    private List<TransitionHolder> transitionHolders = new ArrayList<TransitionHolder>();
     private List<Transition> transitions = Collections.emptyList();
     
-    public State( String id )
-    {
-        this( id, null );
+    public State(String id) {
+        this(id, null);
     }
 
-    public State( String id, State parent )
-    {
+    public State(String id, State parent) {
         this.id = id;
         this.parent = parent;
     }
 
-    public String getId()
-    {
+    public String getId() {
         return id;
     }
 
-    public State getParent()
-    {
+    public State getParent() {
         return parent;
     }
 
-    public List<Transition> getTransitions()
-    {
-        return Collections.unmodifiableList( transitions );
+    public List<Transition> getTransitions() {
+        return Collections.unmodifiableList(transitions);
     }
 
     private void updateTransitions() {
         transitions = new ArrayList<Transition>(transitionHolders.size());
-        for( TransitionHolder holder: transitionHolders )
-        {
-            transitions.add( holder.transition );
-        }        
+        for (TransitionHolder holder : transitionHolders) {
+            transitions.add(holder.transition);
+        }
     }
     
     public State addTransition(Transition transition) {
         return addTransition(transition, 0);
     }
-    
-    public State addTransition( Transition transition, int weight )
-    {
-        if( transition == null )
-        {
-            throw new NullPointerException( "transition" );
+
+    public State addTransition(Transition transition, int weight) {
+        if (transition == null) {
+            throw new NullPointerException("transition");
         }
-        
-        transitionHolders.add( new TransitionHolder( transition, weight ) );
-        Collections.sort( transitionHolders );
+
+        transitionHolders.add(new TransitionHolder(transition, weight));
+        Collections.sort(transitionHolders);
         updateTransitions();
         return this;
     }
     
     @Override
-    public boolean equals( Object o )
-    {
-        if( ! ( o instanceof State ) )
-        {
+    public boolean equals(Object o) {
+        if (!(o instanceof State)) {
             return false;
         }
-        if ( o == this )
-        {
+        if (o == this) {
             return true;
         }
-        State that = ( State ) o;
-        return new EqualsBuilder()
-            .append( this.id, that.id )
-            .isEquals();
+        State that = (State) o;
+        return new EqualsBuilder().append(this.id, that.id).isEquals();
     }
 
     @Override
-    public int hashCode()
-    {
-        return new HashCodeBuilder( 13, 33 )
-            .append( this.id )
-            .toHashCode();
+    public int hashCode() {
+        return new HashCodeBuilder(13, 33).append(this.id).toHashCode();
     }
 
     @Override
-    public String toString()
-    {
-        return new ToStringBuilder( this )
-            .append( "id", this.id )
-            .toString();
+    public String toString() {
+        return new ToStringBuilder(this).append("id", this.id).toString();
     }
 
-    private static class TransitionHolder implements Comparable<TransitionHolder>
-    {
+    private static class TransitionHolder implements Comparable<TransitionHolder> {
         Transition transition;
+
         int weight;
 
-        TransitionHolder( Transition transition, int weight )
-        {
+        TransitionHolder(Transition transition, int weight) {
             this.transition = transition;
             this.weight = weight;
         }
 
-        public int compareTo( TransitionHolder o )
-        {
+        public int compareTo(TransitionHolder o) {
             return (weight > o.weight) ? 1 : (weight < o.weight ? -1 : 0);
         }
     }

Modified: mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateControl.java
URL: http://svn.apache.org/viewvc/mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateControl.java?rev=586063&r1=586062&r2=586063&view=diff
==============================================================================
--- mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateControl.java (original)
+++ mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateControl.java Thu Oct 18 11:39:46 2007
@@ -1,74 +1,64 @@
 /*
- *   @(#) $Id$
- *
- *   Copyright 2006 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.
+ *  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.sm;
 
-
 /**
  *
- * @author The Apache Directory Project (mina-dev@directory.apache.org)
+ * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
-public class StateControl
-{
+public class StateControl {
 
-    public static void breakAndContinue()
-    {
+    public static void breakAndContinue() {
         throw new BreakAndContinueException();
     }
-    
-    public static void breakAndGotoNow( String state )
-    {
-        throw new BreakAndGotoException( state, true );
-    }
-    
-    public static void breakAndGotoNext( String state )
-    {
-        throw new BreakAndGotoException( state, false );
-    }
-    
-    public static void breakAndCallNow( String state )
-    {
-        throw new BreakAndCallException( state, true );
-    }
-    
-    public static void breakAndCallNext( String state )
-    {
-        throw new BreakAndCallException( state, false );
-    }
-    
-    public static void breakAndCallNow( String state, String returnTo )
-    {
-        throw new BreakAndCallException( state, returnTo, true );
-    }
-    
-    public static void breakAndCallNext( String state, String returnTo )
-    {
-        throw new BreakAndCallException( state, returnTo, false );
-    }
-    
-    public static void breakAndReturnNow()
-    {
-        throw new BreakAndReturnException( true );
-    }
-    
-    public static void breakAndReturnNext()
-    {
-        throw new BreakAndReturnException( false );
+
+    public static void breakAndGotoNow(String state) {
+        throw new BreakAndGotoException(state, true);
+    }
+
+    public static void breakAndGotoNext(String state) {
+        throw new BreakAndGotoException(state, false);
+    }
+
+    public static void breakAndCallNow(String state) {
+        throw new BreakAndCallException(state, true);
+    }
+
+    public static void breakAndCallNext(String state) {
+        throw new BreakAndCallException(state, false);
+    }
+
+    public static void breakAndCallNow(String state, String returnTo) {
+        throw new BreakAndCallException(state, returnTo, true);
+    }
+
+    public static void breakAndCallNext(String state, String returnTo) {
+        throw new BreakAndCallException(state, returnTo, false);
+    }
+
+    public static void breakAndReturnNow() {
+        throw new BreakAndReturnException(true);
+    }
+
+    public static void breakAndReturnNext() {
+        throw new BreakAndReturnException(false);
     }
 }

Modified: mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachine.java
URL: http://svn.apache.org/viewvc/mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachine.java?rev=586063&r1=586062&r2=586063&view=diff
==============================================================================
--- mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachine.java (original)
+++ mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachine.java Thu Oct 18 11:39:46 2007
@@ -1,19 +1,20 @@
 /*
- *   @(#) $Id$
- *
- *   Copyright 2006 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.
+ *  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.sm;
@@ -34,238 +35,178 @@
 
 /**
  *
- * @author The Apache Directory Project (mina-dev@directory.apache.org)
+ * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
-public class StateMachine
-{
-    private static final Logger log = LoggerFactory.getLogger( StateMachine.class );
+public class StateMachine {
+    private static final Logger log = LoggerFactory.getLogger(StateMachine.class);
     private static final String CALL_STACK = StateMachine.class.getName() + ".callStack";
-
     private final State startState;
     private final Map<String, State> states;
-    
-    private final ThreadLocal<Boolean> processingThreadLocal = new ThreadLocal<Boolean>()
-    {
-        protected Boolean initialValue()
-        {
+
+    private final ThreadLocal<Boolean> processingThreadLocal = new ThreadLocal<Boolean>() {
+        protected Boolean initialValue() {
             return Boolean.FALSE;
         }
     };
 
-    private final ThreadLocal<LinkedList<Event>> eventQueueThreadLocal = new ThreadLocal<LinkedList<Event>>()
-    {
-        protected LinkedList<Event> initialValue()
-        {
+    private final ThreadLocal<LinkedList<Event>> eventQueueThreadLocal = new ThreadLocal<LinkedList<Event>>() {
+        protected LinkedList<Event> initialValue() {
             return new LinkedList<Event>();
         }
     };
     
-    public StateMachine( State[] states, String startStateId )
-    {
+    public StateMachine(State[] states, String startStateId) {
         this.states = new HashMap<String, State>();
-        for( State s: states )
-        {
-            this.states.put( s.getId(), s );
+        for (State s : states) {
+            this.states.put(s.getId(), s);
         }
-        this.startState = getState( startStateId );
+        this.startState = getState(startStateId);
     }
-    
-    public StateMachine( Collection<State> states, String startStateId )
-    {
-        this( states.toArray( new State[0] ), startStateId );
+
+    public StateMachine(Collection<State> states, String startStateId) {
+        this(states.toArray(new State[0]), startStateId);
     }
     
-    public State getState( String id )
-    {
-        State state = states.get( id );
-        if( state == null )
-        {
-            throw new NoSuchStateException( id );
+    public State getState(String id) {
+        State state = states.get(id);
+        if (state == null) {
+            throw new NoSuchStateException(id);
         }
         return state;
     }
-    
-    public Collection<State> getStates()
-    {
-        return Collections.unmodifiableCollection( states.values() );
+
+    public Collection<State> getStates() {
+        return Collections.unmodifiableCollection(states.values());
     }
     
-    public void handle( Event event )
-    {
+    public void handle(Event event) {
         StateContext context = event.getContext();
-        
-        synchronized ( context )
-        {
+
+        synchronized (context) {
             LinkedList<Event> eventQueue = eventQueueThreadLocal.get();
-            eventQueue.addLast( event );
-            
-            if ( processingThreadLocal.get() )
-            {
+            eventQueue.addLast(event);
+
+            if (processingThreadLocal.get()) {
                 /*
                  * This thread is already processing an event. Queue this 
                  * event.
                  */
-                if ( log.isDebugEnabled() )
-                {
-                    log.debug( "State machine called recursively. "
-                             + "Queuing event " + event 
-                             + " for later processing." );
+                if (log.isDebugEnabled()) {
+                    log.debug("State machine called recursively. Queuing event " + event
+                            + " for later processing.");
                 }
-            }
-            else
-            {
-                processingThreadLocal.set( true );
-                try
-                {
-                    if ( context.getCurrentState() == null )
-                    {
-                        context.setCurrentState( startState );
+            } else {
+                processingThreadLocal.set(true);
+                try {
+                    if (context.getCurrentState() == null) {
+                        context.setCurrentState(startState);
                     }
-                    processEvents( eventQueue );
-                }
-                finally
-                {
-                    processingThreadLocal.set( false );
+                    processEvents(eventQueue);
+                } finally {
+                    processingThreadLocal.set(false);
                 }
             }
         }
-        
+
     }
 
-    private void processEvents( LinkedList<Event> eventQueue )
-    {
-        while ( ! eventQueue.isEmpty() )
-        {
-            Event event = ( Event ) eventQueue.removeFirst();
+    private void processEvents(LinkedList<Event> eventQueue) {
+        while (!eventQueue.isEmpty()) {
+            Event event = (Event) eventQueue.removeFirst();
             StateContext context = event.getContext();
-            handle( context.getCurrentState(), event );
+            handle(context.getCurrentState(), event);
         }
     }
     
-    private void handle( State state, Event event )
-    {
+    private void handle(State state, Event event) {
         StateContext context = event.getContext();
 
-        for( Transition t: state.getTransitions() )
-        {
-            if( log.isDebugEnabled() )
-            {
-                log.debug( "Trying transition " + t );
-            }
-            
-            try
-            {
-                if( t.execute( event ) )
-                {
-                    if( log.isDebugEnabled() )
-                    {
-                        log.debug( "Transition " + t + " executed successfully.");
+        for (Transition t : state.getTransitions()) {
+            if (log.isDebugEnabled()) {
+                log.debug("Trying transition " + t);
+            }
+
+            try {
+                if (t.execute(event)) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("Transition " + t + " executed successfully.");
+                    }
+                    setCurrentState(context, t.getNextState());
+
+                    return;
+                }
+            } catch (BreakAndContinueException bace) {
+                if (log.isDebugEnabled()) {
+                    log.debug("BreakAndContinueException thrown in " 
+                            + "transition " + t
+                            + ". Continuing with next transition.");
+                }
+            } catch (BreakAndGotoException bage) {
+                State newState = getState(bage.getStateId());
+
+                if (bage.isNow()) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("BreakAndGotoException thrown in " 
+                                + "transition " + t + ". Moving to state "
+                                + newState.getId() + " now.");
+                    }
+                    setCurrentState(context, newState);
+                    handle(newState, event);
+                } else {
+                    if (log.isDebugEnabled()) {
+                        log.debug("BreakAndGotoException thrown in " 
+                                + "transition " + t + ". Moving to state "
+                                + newState.getId() + " next.");
                     }
-                    setCurrentState( context, t.getNextState() );
-
-                    return;                    
-                }
-            }
-            catch( BreakAndContinueException bace )
-            {
-                if( log.isDebugEnabled() )
-                {
-                    log.debug( "BreakAndContinueException thrown in "
-                            + "transition " + t 
-                            + ". Continuing with next transition." );
-                }
-            }
-            catch( BreakAndGotoException bage )
-            {
-                State newState = getState( bage.getStateId() );
-                
-                if( bage.isNow() )
-                {
-                    if( log.isDebugEnabled() )
-                    {
-                        log.debug( "BreakAndGotoException thrown in "
-                                + "transition " + t 
-                                + ". Moving to state " + newState.getId() 
-                                + " now." );
-                    }
-                    setCurrentState( context, newState );
-                    handle( newState, event );
-                }
-                else
-                {
-                    if( log.isDebugEnabled() )
-                    {
-                        log.debug( "BreakAndGotoException thrown in "
-                                + "transition " + t 
-                                + ". Moving to state " + newState.getId() 
-                                + " next." );
-                    }
-                    setCurrentState( context, newState );
+                    setCurrentState(context, newState);
                 }
                 return;
-            }
-            catch( BreakAndCallException bace )
-            {
-                State newState = getState( bace.getStateId() );
-                
-                Stack<State> callStack = getCallStack( context );
+            } catch (BreakAndCallException bace) {
+                State newState = getState(bace.getStateId());
+
+                Stack<State> callStack = getCallStack(context);
                 State returnTo = bace.getReturnToStateId() != null 
-                    ? getState( bace.getReturnToStateId() ) : context.getCurrentState();
-                callStack.push( returnTo );
-                
-                if( bace.isNow() )
-                {
-                    if( log.isDebugEnabled() )
-                    {
-                        log.debug( "BreakAndCallException thrown in "
-                                + "transition " + t 
-                                + ". Moving to state " + newState.getId() 
-                                + " now." );
-                    }
-                    setCurrentState( context, newState );
-                    handle( newState, event );
-                }
-                else
-                {
-                    if( log.isDebugEnabled() )
-                    {
-                        log.debug( "BreakAndCallException thrown in "
-                                + "transition " + t 
-                                + ". Moving to state " + newState.getId() 
-                                + " next." );
+                    ? getState(bace.getReturnToStateId()) 
+                    : context.getCurrentState();
+                callStack.push(returnTo);
+
+                if (bace.isNow()) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("BreakAndCallException thrown in " 
+                                + "transition " + t + ". Moving to state "
+                                + newState.getId() + " now.");
+                    }
+                    setCurrentState(context, newState);
+                    handle(newState, event);
+                } else {
+                    if (log.isDebugEnabled()) {
+                        log.debug("BreakAndCallException thrown in " 
+                                + "transition " + t + ". Moving to state "
+                                + newState.getId() + " next.");
                     }
-                    setCurrentState( context, newState );
+                    setCurrentState(context, newState);
                 }
                 return;
-            }            
-            catch( BreakAndReturnException bare )
-            {
-                Stack<State> callStack = getCallStack( context );
+            } catch (BreakAndReturnException bare) {
+                Stack<State> callStack = getCallStack(context);
                 State newState = callStack.pop();
-                
-                if( bare.isNow() )
-                {
-                    if( log.isDebugEnabled() )
-                    {
-                        log.debug( "BreakAndReturnException thrown in "
-                                + "transition " + t 
-                                + ". Moving to state " + newState.getId() 
-                                + " now." );
-                    }
-                    setCurrentState( context, newState );
-                    handle( newState, event );
-                }
-                else
-                {
-                    if( log.isDebugEnabled() )
-                    {
-                        log.debug( "BreakAndReturnException thrown in "
-                                + "transition " + t 
-                                + ". Moving to state " + newState.getId() 
-                                + " next." );
+
+                if (bare.isNow()) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("BreakAndReturnException thrown in " 
+                                + "transition " + t + ". Moving to state "
+                                + newState.getId() + " now.");
+                    }
+                    setCurrentState(context, newState);
+                    handle(newState, event);
+                } else {
+                    if (log.isDebugEnabled()) {
+                        log.debug("BreakAndReturnException thrown in " 
+                                + "transition " + t + ". Moving to state "
+                                + newState.getId() + " next.");
                     }
-                    setCurrentState( context, newState );
+                    setCurrentState(context, newState);
                 }
                 return;
             }
@@ -274,42 +215,34 @@
         /*
          * No transition could handle the event. Try with the parent state if
          * there is one.
-         */ 
-        
-        if( state.getParent() != null )
-        {
-            handle( state.getParent(), event );
+         */
+
+        if (state.getParent() != null) {
+            handle(state.getParent(), event);
+        } else {
+            throw new UnhandledEventException(event);
         }
-        else
-        {
-            throw new UnhandledEventException( "Unhandled event: " + event );
-        }   
     }
 
-    private Stack<State> getCallStack( StateContext context )
-    {
-        Stack<State> callStack = ( Stack<State> ) context.getAttribute( CALL_STACK );
-        if( callStack == null )
-        {
+    private Stack<State> getCallStack(StateContext context) {
+        @SuppressWarnings("unchecked")
+        Stack<State> callStack = (Stack<State>) context.getAttribute(CALL_STACK);
+        if (callStack == null) {
             callStack = new Stack<State>();
-            context.setAttribute( CALL_STACK, callStack );
+            context.setAttribute(CALL_STACK, callStack);
         }
         return callStack;
     }
 
-    private void setCurrentState( StateContext context, State newState )
-    {
-        if( newState != null )
-        {
-            if( log.isDebugEnabled() )
-            {
-                if( newState != context.getCurrentState() )
-                {
-                    log.debug( "Leaving state " + context.getCurrentState().getId() );
-                    log.debug( "Entering state " + newState.getId() );
+    private void setCurrentState(StateContext context, State newState) {
+        if (newState != null) {
+            if (log.isDebugEnabled()) {
+                if (newState != context.getCurrentState()) {
+                    log.debug("Leaving state " + context.getCurrentState().getId());
+                    log.debug("Entering state " + newState.getId());
                 }
             }
-            context.setCurrentState( newState );
+            context.setCurrentState(newState);
         }
     }
     

Modified: mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachineCreationException.java
URL: http://svn.apache.org/viewvc/mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachineCreationException.java?rev=586063&r1=586062&r2=586063&view=diff
==============================================================================
--- mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachineCreationException.java (original)
+++ mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachineCreationException.java Thu Oct 18 11:39:46 2007
@@ -1,29 +1,30 @@
 /*
- *   @(#) $Id$
- *
- *   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.
+ *  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.sm;
 
 /**
- * 
  *
- * @author The Apache Directory Project (mina-dev@directory.apache.org)
+ * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
+
 public class StateMachineCreationException extends RuntimeException {
 
     /**
@@ -31,7 +32,6 @@
      */
     public StateMachineCreationException() {
         super();
-        // TODO Auto-generated constructor stub
     }
 
     /**
@@ -39,7 +39,6 @@
      */
     public StateMachineCreationException(String message) {
         super(message);
-        // TODO Auto-generated constructor stub
     }
 
     /**
@@ -48,7 +47,6 @@
      */
     public StateMachineCreationException(String message, Throwable cause) {
         super(message, cause);
-        // TODO Auto-generated constructor stub
     }
 
     /**
@@ -56,7 +54,6 @@
      */
     public StateMachineCreationException(Throwable cause) {
         super(cause);
-        // TODO Auto-generated constructor stub
     }
 
 }

Modified: mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachineFactory.java
URL: http://svn.apache.org/viewvc/mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachineFactory.java?rev=586063&r1=586062&r2=586063&view=diff
==============================================================================
--- mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachineFactory.java (original)
+++ mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachineFactory.java Thu Oct 18 11:39:46 2007
@@ -1,19 +1,20 @@
 /*
- *   @(#) $Id$
- *
- *   Copyright 2006 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.
+ *  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.sm;
@@ -37,175 +38,146 @@
 
 
 /**
+ * 
  *
- * @author The Apache Directory Project (mina-dev@directory.apache.org)
+ * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
-public class StateMachineFactory
-{
+public class StateMachineFactory {
 
-    public static StateMachine create( Object handler )
-    {
-        return create( handler, new Object[0] );
+    public static StateMachine create(Object handler) {
+        return create(handler, new Object[0]);
     }
-    
-    public static StateMachine create( String start, Object handler )
-    {
-        return create( start, handler, new Object[0] );
+
+    public static StateMachine create(String start, Object handler) {
+        return create(start, handler, new Object[0]);
     }
-    
-    public static StateMachine create( Object handler, Object... handlers )
-    {
-        return create( "start", handler, handlers );
+
+    public static StateMachine create(Object handler, Object... handlers) {
+        return create("start", handler, handlers);
     }
     
-    public static StateMachine create( String start, Object handler, Object... handlers )
-    {
-        HashMap<String, State> states = new HashMap<String, State>();
-        ArrayList<Object> handlersList = new ArrayList<Object>(1 + handlers.length);
-        handlersList.add( handler );
-        handlersList.addAll( Arrays.asList( handlers ) );
+    public static StateMachine create(String start, Object handler, Object... handlers) {
+        Map<String, State> states = new HashMap<String, State>();
+        List<Object> handlersList = new ArrayList<Object>(1 + handlers.length);
+        handlersList.add(handler);
+        handlersList.addAll(Arrays.asList(handlers));
         
         LinkedList<Field> fields = new LinkedList<Field>();
-        for (Object h: handlersList) {
-            fields.addAll( getFields( h instanceof Class ? (Class) h : h.getClass() ) );
+        for (Object h : handlersList) {
+            fields.addAll(getFields(h instanceof Class ? (Class) h : h.getClass()));
         }
-        for( State state: createStates( fields ) )
-        {
-            states.put( state.getId(), state );
+        for (State state : createStates(fields)) {
+            states.put(state.getId(), state);
         }
-        
-        if( !states.containsKey( start ) )
-        {
-            throw new StateMachineCreationException( "Start state '" + start + "' not found." );
+
+        if (!states.containsKey(start)) {
+            throw new StateMachineCreationException("Start state '" + start + "' not found.");
         }
-        
-        setupTransitions( states, handlersList );
-        
-        return new StateMachine( states.values(), start );
+
+        setupTransitions(states, handlersList);
+
+        return new StateMachine(states.values(), start);
     }
 
-    private static void setupTransitions( Map<String, State> states, List<Object> handlers )
-    {
-        for( Object handler : handlers )
-        {
-            setupTransitions( states, handler );
+    private static void setupTransitions(Map<String, State> states, List<Object> handlers) {
+        for (Object handler : handlers) {
+            setupTransitions(states, handler);
         }
     }
 
-    private static void setupTransitions( Map<String, State> states, Object handler )
-    {
+    private static void setupTransitions(Map<String, State> states, Object handler) {
         Method[] methods = handler.getClass().getDeclaredMethods();
-        Arrays.sort( methods, new Comparator<Method>()
-        {
-            public int compare( Method m1, Method m2 )
-            {
-                return m1.toString().compareTo( m2.toString() );
+        Arrays.sort(methods, new Comparator<Method>() {
+            public int compare(Method m1, Method m2) {
+                return m1.toString().compareTo(m2.toString());
             }
-        } );
+        });
         
-        for( Method m : methods )
-        {
+        for (Method m : methods) {
             List<Handler> handlerAnnotations = new ArrayList<Handler>();
-            if( m.isAnnotationPresent( Handler.class ) )
-            {
-                handlerAnnotations.add( m.getAnnotation( Handler.class ) );
-            }
-            if( m.isAnnotationPresent( Handlers.class ) )
-            {
-                handlerAnnotations.addAll( Arrays.asList( m.getAnnotation( Handlers.class ).value() ) );
+            if (m.isAnnotationPresent(Handler.class)) {
+                handlerAnnotations.add(m.getAnnotation(Handler.class));
+            }
+            if (m.isAnnotationPresent(Handlers.class)) {
+                handlerAnnotations.addAll(Arrays.asList(m.getAnnotation(Handlers.class).value()));
             }
             
-            if( handlerAnnotations.isEmpty() )
-            {
+            if (handlerAnnotations.isEmpty()) {
                 continue;
             }
             
-            for( Handler annotation : handlerAnnotations)
-            {
+            for (Handler annotation : handlerAnnotations) {
                 String[] eventIds = annotation.on();
-                if( eventIds.length == 0 )
-                {
-                    throw new StateMachineCreationException( "Error encountered "
-                            + "when processing method " + m 
-                            + ". No event ids specified." );
-                }
-                if( annotation.in().length == 0 )
-                {
-                    throw new StateMachineCreationException( "Error encountered "
-                            + "when processing method " + m 
-                            + ". No states specified." );
+                if (eventIds.length == 0) {
+                    throw new StateMachineCreationException("Error encountered " 
+                            + "when processing method " + m
+                            + ". No event ids specified.");
+                }
+                if (annotation.in().length == 0) {
+                    throw new StateMachineCreationException("Error encountered " 
+                            + "when processing method " + m
+                            + ". No states specified.");
                 }
                 
                 State next = null;
-                if( !annotation.next().equals( Handler.SELF ) )
-                {
-                    next = states.get( annotation.next() );
-                    if( next == null )
-                    {
-                        throw new StateMachineCreationException( "Error encountered "
-                                + "when processing method " + m 
-                                + ". Unknown next state: " 
-                                + annotation.next() + "." );
+                if (!annotation.next().equals(Handler.SELF)) {
+                    next = states.get(annotation.next());
+                    if (next == null) {
+                        throw new StateMachineCreationException("Error encountered " 
+                                + "when processing method " + m
+                                + ". Unknown next state: " + annotation.next() + ".");
                     }
                 }
                 
-                for( String event : eventIds )
-                {
-                    for( String in : annotation.in() )
-                    {
-                        State state = states.get( in );
-                        if( state == null )
-                        {
-                            throw new StateMachineCreationException( "Error encountered "
-                                    + "when processing method " + m 
-                                    + ". Unknown state: " + in + "." );
+                for (String event : eventIds) {
+                    for (String in : annotation.in()) {
+                        State state = states.get(in);
+                        if (state == null) {
+                            throw new StateMachineCreationException("Error encountered " 
+                                    + "when processing method "
+                                    + m + ". Unknown state: " + in + ".");
                         }
-                        
-                        Transition t = new MethodTransition( event, next, m, handler );
-                        state.addTransition( t, annotation.weight() );
+
+                        Transition t = new MethodTransition(event, next, m, handler);
+                        state.addTransition(t, annotation.weight());
                     }
                 }
             }
         }
     }
 
-    static List<Field> getFields( Class clazz )
-    {
+    static List<Field> getFields(Class clazz) {
         LinkedList<Field> fields = new LinkedList<Field>();
-        
-        for( Field f : clazz.getDeclaredFields() )
-        {
-            if( !f.isAnnotationPresent( org.apache.mina.sm.annotation.State.class ) )
-            {
+
+        for (Field f : clazz.getDeclaredFields()) {
+            if (!f.isAnnotationPresent(org.apache.mina.sm.annotation.State.class)) {
                 continue;
             }
-            
-            if( ( f.getModifiers() & Modifier.STATIC ) == 0
-                    || ( f.getModifiers() & Modifier.FINAL ) == 0
-                    || !f.getType().equals( String.class ) )
-            {
-                throw new StateMachineCreationException( "Error encountered when "
-                        + "processing field " + f + ". Only static final "
-                        + "String fields can be used with the @State "
-                        + "annotation." );
+
+            if ((f.getModifiers() & Modifier.STATIC) == 0 
+                    || (f.getModifiers() & Modifier.FINAL) == 0
+                    || !f.getType().equals(String.class)) {
+                throw new StateMachineCreationException("Error encountered when " 
+                        + "processing field " + f
+                        + ". Only static final " 
+                        + "String fields can be used with the @State " 
+                        + "annotation.");
             }
-            
-            if( !f.isAccessible() )
-            {
-                f.setAccessible( true );
+
+            if (!f.isAccessible()) {
+                f.setAccessible(true);
             }
-            
-            fields.add( f );
+
+            fields.add(f);
         }
-        
+
         return fields;
     }
         
-    static State[] createStates( List<Field> fields )
-    {
+    static State[] createStates(List<Field> fields) {
         LinkedHashMap<String, State> states = new LinkedHashMap<String, State>();
-        
+
         while (!fields.isEmpty()) {
             int size = fields.size();
             int numStates = states.size();
@@ -216,39 +188,35 @@
                 try {
                     value = (String) f.get(null);
                 } catch (IllegalAccessException iae) {
-                    throw new StateMachineCreationException(
-                            "Error encountered when " + "processing field " + f
-                                    + ".", iae);
+                    throw new StateMachineCreationException("Error encountered when " 
+                            + "processing field " + f + ".", iae);
                 }
 
                 org.apache.mina.sm.annotation.State stateAnnotation = f
                         .getAnnotation(org.apache.mina.sm.annotation.State.class);
-                if (stateAnnotation.value().equals(
-                        org.apache.mina.sm.annotation.State.ROOT)) {
+                if (stateAnnotation.value().equals(org.apache.mina.sm.annotation.State.ROOT)) {
                     states.put(value, new State(value));
                 } else if (states.containsKey(stateAnnotation.value())) {
-                    states.put(value, new State(value, states
-                            .get(stateAnnotation.value())));
+                    states.put(value, new State(value, states.get(stateAnnotation.value())));
                 } else {
                     // Move to the back of the list of fields for later
                     // processing
                     fields.add(f);
                 }
             }
-        
+
             /*
              * If no new states were added to states during this iteration it 
              * means that all fields in fields specify non-existent parents.
              */
             if (states.size() == numStates) {
-                throw new StateMachineCreationException(
-                        "Error encountered while creating "
-                                + "FSM. The following fields specify non-existing "
-                                + "parent states: " + fields);
+                throw new StateMachineCreationException("Error encountered while creating "
+                        + "FSM. The following fields specify non-existing " 
+                        + "parent states: " + fields);
             }
         }
 
-        return states.values().toArray( new State[ 0 ] );
+        return states.values().toArray(new State[0]);
     }
     
 }

Modified: mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachineProxyFactory.java
URL: http://svn.apache.org/viewvc/mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachineProxyFactory.java?rev=586063&r1=586062&r2=586063&view=diff
==============================================================================
--- mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachineProxyFactory.java (original)
+++ mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/StateMachineProxyFactory.java Thu Oct 18 11:39:46 2007
@@ -1,19 +1,20 @@
 /*
- *   @(#) $Id$
- *
- *   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.
+ *  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.sm;
@@ -36,7 +37,7 @@
  * Used to create proxies which will forward all method calls on them to a
  * state machine.
  *
- * @author The Apache Directory Project (mina-dev@directory.apache.org)
+ * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
 public class StateMachineProxyFactory {
@@ -48,48 +49,37 @@
     }
 
     public static Object create(Class iface, StateMachine sm) {
-        return create(new Class[] {iface}, sm);
+        return create(new Class[] { iface }, sm);
     }
     
-    public static Object create(Class iface, StateMachine sm, 
-                                StateContextLookup contextLookup) {
-        return create(new Class[] {iface}, sm, contextLookup);
+    public static Object create(Class iface, StateMachine sm, StateContextLookup contextLookup) {
+        return create(new Class[] { iface }, sm, contextLookup);
     }
     
-    public static Object create(Class iface, StateMachine sm, 
-                                StateContextLookup contextLookup,
-                                EventArgumentsInterceptor interceptor) {
-        return create( new Class[] {iface}, sm, contextLookup, interceptor, 
-                       new DefaultEventFactory() );
+    public static Object create(Class iface, StateMachine sm, StateContextLookup contextLookup,
+            EventArgumentsInterceptor interceptor) {
+        return create(new Class[] { iface }, sm, contextLookup, interceptor, new DefaultEventFactory());
     }
 
-    public static Object create( Class iface, StateMachine sm, 
-                                 StateContextLookup contextLookup,
-                                 EventArgumentsInterceptor interceptor, 
-                                 EventFactory eventFactory )
-    {
-        return create( new Class[] {iface}, sm, contextLookup, interceptor, eventFactory );
-}
+    public static Object create(Class iface, StateMachine sm, StateContextLookup contextLookup,
+            EventArgumentsInterceptor interceptor, EventFactory eventFactory) {
+        return create(new Class[] { iface }, sm, contextLookup, interceptor, eventFactory);
+    }
     
     public static Object create(Class[] ifaces, StateMachine sm) {
         return create(ifaces, sm, new SingletonStateContextLookup());
     }
     
-    public static Object create(Class[] ifaces, StateMachine sm, 
-                                StateContextLookup contextLookup) {
+    public static Object create(Class[] ifaces, StateMachine sm, StateContextLookup contextLookup) {
 
-        return create( ifaces, sm, contextLookup, null, new DefaultEventFactory() );
+        return create(ifaces, sm, contextLookup, null, new DefaultEventFactory());
     }
     
-    public static Object create(Class[] ifaces, StateMachine sm, 
-                                StateContextLookup contextLookup, 
-                                EventArgumentsInterceptor interceptor,
-                                EventFactory eventFactory) {
+    public static Object create(Class[] ifaces, StateMachine sm, StateContextLookup contextLookup,
+            EventArgumentsInterceptor interceptor, EventFactory eventFactory) {
 
         ClassLoader cl = StateMachineProxyFactory.class.getClassLoader();
-        InvocationHandler handler = 
-            new MethodInvocationHandler(sm, contextLookup, interceptor, 
-                                        eventFactory);
+        InvocationHandler handler = new MethodInvocationHandler(sm, contextLookup, interceptor, eventFactory);
 
         return Proxy.newProxyInstance(cl, ifaces, handler);
     }
@@ -100,56 +90,47 @@
         private final EventArgumentsInterceptor interceptor;
         private final EventFactory eventFactory;
         
-        public MethodInvocationHandler( StateMachine sm, 
-                                       StateContextLookup contextLookup, 
-                                       EventArgumentsInterceptor interceptor,
-                                       EventFactory eventFactory )
-        {
+        public MethodInvocationHandler(StateMachine sm, StateContextLookup contextLookup,
+                EventArgumentsInterceptor interceptor, EventFactory eventFactory) {
+            
             this.contextLookup = contextLookup;
             this.sm = sm;
             this.interceptor = interceptor;
             this.eventFactory = eventFactory;
         }
         
-        public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable
-        {
-            if ( "hashCode".equals( method.getName() ) && args == null )
-            {
-                return new Integer( System.identityHashCode( proxy ) );
-            }
-            if ( "equals".equals( method.getName() ) && args.length == 1 )
-            {
-                return Boolean.valueOf( proxy == args[ 0 ] );
-            }            
-            if ( "toString".equals( method.getName() ) && args == null )
-            {
+        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+            if ("hashCode".equals(method.getName()) && args == null) {
+                return new Integer(System.identityHashCode(proxy));
+            }
+            if ("equals".equals(method.getName()) && args.length == 1) {
+                return Boolean.valueOf(proxy == args[0]);
+            }
+            if ("toString".equals(method.getName()) && args == null) {
                 return proxy.getClass().getName() + "@" 
-                    + Integer.toHexString( System.identityHashCode( proxy ) );
+                        + Integer.toHexString(System.identityHashCode(proxy));
             }
-            
-            if ( log.isDebugEnabled() )
-            {
-                log.debug( "Method invoked: " + method );
+
+            if (log.isDebugEnabled()) {
+                log.debug("Method invoked: " + method);
             }
-            
+
             args = args == null ? EMPTY_ARGUMENTS : args;
-            if ( interceptor != null )
-            {
+            if (interceptor != null) {
                 args = interceptor.modify(args);
             }
-            
-            StateContext context = contextLookup.lookup( args );
-            
-            if ( context == null )
-            {
-                throw new IllegalStateException( "Cannot determine state "
-                        + "context for method invocation: " + method );
+
+            StateContext context = contextLookup.lookup(args);
+
+            if (context == null) {
+                throw new IllegalStateException("Cannot determine state " 
+                        + "context for method invocation: " + method);
             }
-            
+
             Event event = eventFactory.create(context, method, args);
-            
-            sm.handle( event );
-            
+
+            sm.handle(event);
+
             return null;
         }
     }

Modified: mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/annotation/Handler.java
URL: http://svn.apache.org/viewvc/mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/annotation/Handler.java?rev=586063&r1=586062&r2=586063&view=diff
==============================================================================
--- mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/annotation/Handler.java (original)
+++ mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/annotation/Handler.java Thu Oct 18 11:39:46 2007
@@ -1,19 +1,20 @@
 /*
- *   @(#) $Id$
- *
- *   Copyright 2006 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.
+ *  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.sm.annotation;
@@ -27,17 +28,19 @@
 
 /**
  *
- * @author The Apache Directory Project (mina-dev@directory.apache.org)
+ * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.METHOD)
-public @interface Handler
-{
+public @interface Handler {
     public static final String SELF = "__self__";
-    
+
     String[] on() default Event.WILDCARD_EVENT_ID;
+
     String[] in();
+
     String next() default SELF;
+
     int weight() default 0;
 }

Modified: mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/annotation/Handlers.java
URL: http://svn.apache.org/viewvc/mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/annotation/Handlers.java?rev=586063&r1=586062&r2=586063&view=diff
==============================================================================
--- mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/annotation/Handlers.java (original)
+++ mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/annotation/Handlers.java Thu Oct 18 11:39:46 2007
@@ -1,19 +1,20 @@
 /*
- *   @(#) $Id$
- *
- *   Copyright 2006 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.
+ *  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.sm.annotation;
@@ -25,12 +26,11 @@
 
 /**
  *
- * @author The Apache Directory Project (mina-dev@directory.apache.org)
+ * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.METHOD)
-public @interface Handlers
-{
+public @interface Handlers {
     Handler[] value();
 }

Modified: mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/annotation/State.java
URL: http://svn.apache.org/viewvc/mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/annotation/State.java?rev=586063&r1=586062&r2=586063&view=diff
==============================================================================
--- mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/annotation/State.java (original)
+++ mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/annotation/State.java Thu Oct 18 11:39:46 2007
@@ -1,19 +1,20 @@
 /*
- *   @(#) $Id$
- *
- *   Copyright 2006 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.
+ *  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.sm.annotation;
@@ -25,14 +26,13 @@
 
 /**
  *
- * @author The Apache Directory Project (mina-dev@directory.apache.org)
+ * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.FIELD)
-public @interface State
-{
+public @interface State {
     public static final String ROOT = "__root__";
-    
+
     String value() default ROOT;
 }

Modified: mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/context/AbstractStateContext.java
URL: http://svn.apache.org/viewvc/mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/context/AbstractStateContext.java?rev=586063&r1=586062&r2=586063&view=diff
==============================================================================
--- mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/context/AbstractStateContext.java (original)
+++ mina/sandbox/niklas/mina-sm/src/main/java/org/apache/mina/sm/context/AbstractStateContext.java Thu Oct 18 11:39:46 2007
@@ -1,19 +1,20 @@
 /*
- *   @(#) $Id$
- *
- *   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.
+ *  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.sm.context;
@@ -27,46 +28,40 @@
 /**
  * 
  *
- * @author The Apache Directory Project (mina-dev@directory.apache.org)
+ * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
 public abstract class AbstractStateContext implements StateContext {
     private State currentState = null;
     private Map<Object, Object> attributes = null;
 
-    public Object getAttribute( Object key )
-    {
-        return getAttributes().get( key );
+    public Object getAttribute(Object key) {
+        return getAttributes().get(key);
     }
 
-    public State getCurrentState()
-    {
+    public State getCurrentState() {
         return currentState;
     }
 
-    public void setAttribute( Object key, Object value )
-    {
-        getAttributes().put( key, value );
+    public void setAttribute(Object key, Object value) {
+        getAttributes().put(key, value);
     }
 
-    public void setCurrentState( State state )
-    {
+    public void setCurrentState(State state) {
         currentState = state;
     }
 
-    protected Map<Object, Object> getAttributes() 
-    {
-        if ( attributes == null ) {
+    protected Map<Object, Object> getAttributes() {
+        if (attributes == null) {
             attributes = new HashMap<Object, Object>();
         }
         return attributes;
     }
-    
-    public String toString()
-    {
-        return new ToStringBuilder( this )
-            .append( "currentState", currentState )
-            .append( "attributes", attributes )
+
+    public String toString() {
+        return new ToStringBuilder(this)
+            .append("currentState", currentState)
+            .append("attributes", attributes)
             .toString();
     }    
 }