Permalink
Browse files

MYFACES-3644 remove unused classes, variables, generics

rest comes after the release


git-svn-id: https://svn.apache.org/repos/asf/myfaces/core/trunk@1410652 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 990c7f7 commit 2ff5c842fdd14d1877243f8029f05e65e52ba7fc @struberg struberg committed Nov 17, 2012
@@ -26,7 +26,7 @@
/**
*
*/
-class CounterKeyFactory extends KeyFactory<Integer, String>
+class CounterKeyFactory extends KeyFactory<Integer>
{
/**
@@ -22,13 +22,11 @@
/**
*
- * @author lu4242
*/
-class CounterSessionViewStorageFactory extends SessionViewStorageFactory
- <KeyFactory<Integer, String>, Integer, String>
+class CounterSessionViewStorageFactory extends SessionViewStorageFactory<KeyFactory<Integer>, Integer>
{
- public CounterSessionViewStorageFactory(KeyFactory<Integer, String> keyFactory)
+ public CounterSessionViewStorageFactory(KeyFactory<Integer> keyFactory)
{
super(keyFactory);
}
@@ -23,31 +23,22 @@
/**
*
*/
-abstract class KeyFactory<K, V>
+abstract class KeyFactory<K>
{
/**
* Generates a unique key per session
- *
- * @param facesContext
- * @return
*/
public abstract K generateKey(FacesContext facesContext);
/**
* Encode a Key into a value that will be used as view state session token
- *
- * @param key
- * @return
*/
- public abstract V encode(K key);
+ public abstract String encode(K key);
/**
* Decode a view state session token into a key
- *
- * @param value
- * @return
*/
- public abstract K decode(V value);
+ public abstract K decode(String value);
}
@@ -30,7 +30,7 @@
/**
*
*/
-class RandomKeyFactory extends KeyFactory<byte[], String>
+class RandomKeyFactory extends KeyFactory<byte[]>
{
private final Random random;
private final int length;
@@ -48,7 +48,7 @@ public Integer generateCounterKey(FacesContext facesContext)
{
ExternalContext externalContext = facesContext.getExternalContext();
Object sessionObj = externalContext.getSession(true);
- Integer sequence = null;
+ Integer sequence;
synchronized (sessionObj) // are handled at the same time for the session
{
Map<String, Object> map = externalContext.getSessionMap();
@@ -102,8 +102,6 @@ public String encode(byte[] key)
{
// Cannot decode, ignore silently, later it will be handled as
// ViewExpiredException
- // Cannot decode, ignore silently, later it will be handled as
- // ViewExpiredException
}
return null;
}
@@ -22,13 +22,11 @@
/**
*
- * @author lu4242
*/
-class RandomSessionViewStorageFactory extends SessionViewStorageFactory
- <KeyFactory<byte[], String>, byte[], String>
+class RandomSessionViewStorageFactory extends SessionViewStorageFactory<KeyFactory<byte[]>, byte[]>
{
- public RandomSessionViewStorageFactory(KeyFactory<byte[], String> keyFactory)
+ public RandomSessionViewStorageFactory(KeyFactory<byte[]> keyFactory)
{
super(keyFactory);
}
@@ -1,78 +0,0 @@
-/*
- * 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.myfaces.application.viewstate;
-
-import java.io.Serializable;
-
-/**
- * Implementation of SerializedViewKey, where the viewId and the sequenceId can be
- * anything.
- */
-class ReferenceSerializedViewKey<I, K> extends SerializedViewKey implements Serializable
-{
- private static final long serialVersionUID = -1170697124386063642L;
- final I _viewId;
- final K _sequenceId;
-
- public ReferenceSerializedViewKey()
- {
- _sequenceId = null;
- _viewId = null;
- }
-
- public ReferenceSerializedViewKey(I viewId, K sequence)
- {
- _sequenceId = sequence;
- _viewId = viewId;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == null)
- {
- return false;
- }
- if (getClass() != obj.getClass())
- {
- return false;
- }
- final ReferenceSerializedViewKey<I, K> other = (ReferenceSerializedViewKey<I, K>) obj;
- if (this._viewId != other._viewId && (this._viewId == null || !this._viewId.equals(other._viewId)))
- {
- return false;
- }
- if (this._sequenceId != other._sequenceId && (this._sequenceId == null ||
- !this._sequenceId.equals(other._sequenceId)))
- {
- return false;
- }
- return true;
- }
-
- @Override
- public int hashCode()
- {
- int hash = 7;
- hash = 83 * hash + (this._viewId != null ? this._viewId.hashCode() : 0);
- hash = 83 * hash + (this._sequenceId != null ? this._sequenceId.hashCode() : 0);
- return hash;
- }
-
-}
@@ -31,7 +31,7 @@
* counter ensures uniqueness, and the random number prevents guess the next
* session token.
*/
-class SecureRandomKeyFactory extends KeyFactory<byte[], String>
+class SecureRandomKeyFactory extends KeyFactory<byte[]>
{
private final SessionIdGenerator sessionIdGenerator;
private final int length;
@@ -71,7 +71,7 @@ public Integer generateCounterKey(FacesContext facesContext)
{
ExternalContext externalContext = facesContext.getExternalContext();
Object sessionObj = externalContext.getSession(true);
- Integer sequence = null;
+ Integer sequence;
synchronized (sessionObj) // are handled at the same time for the session
{
Map<String, Object> map = externalContext.getSessionMap();
@@ -124,8 +124,6 @@ public String encode(byte[] key)
{
// Cannot decode, ignore silently, later it will be handled as
// ViewExpiredException
- // Cannot decode, ignore silently, later it will be handled as
- // ViewExpiredException
}
return null;
}
@@ -258,7 +258,7 @@ protected Object getServerStateId(FacesContext facesContext, Object state)
{
if (state != null)
{
- return getKeyFactory(facesContext).decode(state);
+ return getKeyFactory(facesContext).decode((String) state);
}
return null;
}
@@ -406,13 +406,9 @@ protected Object serializeView(FacesContext context, Object serializedView)
os.write(UNCOMPRESSED_FLAG);
}
- //Object[] stateArray = (Object[]) serializedView;
-
ObjectOutputStream out = new ObjectOutputStream(os);
out.writeObject(serializedView);
- //out.writeObject(stateArray[0]);
- //out.writeObject(stateArray[1]);
out.close();
baos.close();
@@ -30,15 +30,12 @@
* NOTE: Class taken from tomcat 7 org.apache.catalina.util.SessionIdGenerator
* and used here as an alternative for server side state token encryption.
*
- * @author Leonardo Uribe
*/
class SessionIdGenerator
{
private static Logger log = Logger.getLogger(SessionIdGenerator.class.getName());
- //private static StringManager sm =
- // StringManager.getManager("org.apache.catalina.util");
-
+
/**
* Queue of random number generator objects to be used when creating session
* identifiers. If the queue is empty when a random number generator is
@@ -24,25 +24,23 @@
*
* @param <T>
* @param <K>
- * @param <V>
*/
-abstract class SessionViewStorageFactory<T extends KeyFactory<K, V>, K, V>
+abstract class SessionViewStorageFactory<T extends KeyFactory<K>, K>
{
- private KeyFactory<K, V> keyFactory;
+ private KeyFactory<K> keyFactory;
- public SessionViewStorageFactory(KeyFactory<K, V> keyFactory)
+ public SessionViewStorageFactory(KeyFactory<K> keyFactory)
{
this.keyFactory = keyFactory;
}
- public KeyFactory<K, V> getKeyFactory()
+ public KeyFactory<K> getKeyFactory()
{
return keyFactory;
}
public abstract SerializedViewCollection createSerializedViewCollection(FacesContext context);
- public abstract SerializedViewKey createSerializedViewKey(
- FacesContext facesContext, String viewId, K key);
+ public abstract SerializedViewKey createSerializedViewKey(FacesContext facesContext, String viewId, K key);
}
@@ -46,10 +46,8 @@
*/
public class HtmlResponseStateManager extends MyfacesResponseStateManager
{
- //private static final Log log = LogFactory.getLog(HtmlResponseStateManager.class);
private static final Logger log = Logger.getLogger(HtmlResponseStateManager.class.getName());
- //private static final int TREE_PARAM = 2;
private static final int STATE_PARAM = 0;
private static final int VIEWID_PARAM = 1;
@@ -97,7 +95,6 @@ public void writeState(FacesContext facesContext, Object state) throws IOExcepti
if (isHandlingStateCachingMechanics(facesContext))
{
- //token = getStateCache(facesContext).saveSerializedView(facesContext, state);
savedStateObject = getStateCache(facesContext).encodeSerializedState(facesContext, state);
}
else

0 comments on commit 2ff5c84

Please sign in to comment.