X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=cms%2Forg.argeo.slc.repo%2Fsrc%2Forg%2Feclipse%2Faether%2FDefaultSessionData.java;fp=cms%2Forg.argeo.slc.repo%2Fsrc%2Forg%2Feclipse%2Faether%2FDefaultSessionData.java;h=0000000000000000000000000000000000000000;hb=6fc94d69efe089414ac9e63bde3efab1cbf7b7ca;hp=738cebc027c555b65709365e943d12e38b91d4c3;hpb=b36c62642bd0db11b3133b369cc026fd4b7a1ec6;p=gpl%2Fargeo-slc.git diff --git a/cms/org.argeo.slc.repo/src/org/eclipse/aether/DefaultSessionData.java b/cms/org.argeo.slc.repo/src/org/eclipse/aether/DefaultSessionData.java deleted file mode 100644 index 738cebc02..000000000 --- a/cms/org.argeo.slc.repo/src/org/eclipse/aether/DefaultSessionData.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 Sonatype, Inc. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Sonatype, Inc. - initial API and implementation - *******************************************************************************/ -package org.eclipse.aether; - -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -/** - * A simple session data storage backed by a thread-safe map. - */ -public final class DefaultSessionData - implements SessionData -{ - - private final ConcurrentMap data; - - public DefaultSessionData() - { - data = new ConcurrentHashMap(); - } - - public void set( Object key, Object value ) - { - if ( key == null ) - { - throw new IllegalArgumentException( "key must not be null" ); - } - - if ( value != null ) - { - data.put( key, value ); - } - else - { - data.remove( key ); - } - } - - public boolean set( Object key, Object oldValue, Object newValue ) - { - if ( key == null ) - { - throw new IllegalArgumentException( "key must not be null" ); - } - - if ( newValue != null ) - { - if ( oldValue == null ) - { - return data.putIfAbsent( key, newValue ) == null; - } - return data.replace( key, oldValue, newValue ); - } - else - { - if ( oldValue == null ) - { - return !data.containsKey( key ); - } - return data.remove( key, oldValue ); - } - } - - public Object get( Object key ) - { - if ( key == null ) - { - throw new IllegalArgumentException( "key must not be null" ); - } - - return data.get( key ); - } - -}