move @Name to annotation package and change @Managed to drop PARAMETER

This commit is contained in:
Jesse McConnell 2012-07-23 09:44:41 -05:00
parent d2a0cb5c50
commit 100b5fb6cb
6 changed files with 48 additions and 20 deletions

View File

@ -34,7 +34,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.util.Name;
import org.eclipse.jetty.util.annotation.Name;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.component.AggregateLifeCycle;
@ -61,7 +61,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
this((Runtime.getRuntime().availableProcessors() + 1) / 2);
}
protected SelectorManager(@Name("selectors") int selectors)
protected SelectorManager(@Name(value="selectors") int selectors)
{
_selectors = new ManagedSelector[selectors];
setIdleCheckPeriod(1000);

View File

@ -20,7 +20,7 @@ import java.util.concurrent.Executor;
import org.eclipse.jetty.io.AsyncConnection;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.StandardByteBufferPool;
import org.eclipse.jetty.util.Name;
import org.eclipse.jetty.util.annotation.Name;
import org.eclipse.jetty.util.component.AggregateLifeCycle;
import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.util.log.Log;
@ -73,7 +73,7 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Co
/* ------------------------------------------------------------ */
/**
*/
public AbstractConnector(@Name("acceptors") int acceptors)
public AbstractConnector(@Name(value="acceptors") int acceptors)
{
if (acceptors > 2 * Runtime.getRuntime().availableProcessors())
LOG.warn("Acceptors should be <=2*availableProcessors: " + this);

View File

@ -69,6 +69,7 @@ import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.annotation.Managed;
import org.eclipse.jetty.util.annotation.Name;
import org.eclipse.jetty.util.component.AggregateLifeCycle;
import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.util.log.Log;
@ -1204,7 +1205,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
* @see javax.servlet.ServletContext#removeAttribute(java.lang.String)
*/
@Managed("Remove context attribute")
public void removeAttribute( @Managed("attribute name") String name)
public void removeAttribute( @Name(value = "name", description="attribute name") String name)
{
checkManagedAttribute(name,null);
_attributes.removeAttribute(name);
@ -1218,7 +1219,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
* @see javax.servlet.ServletContext#setAttribute(java.lang.String, java.lang.Object)
*/
@Managed("Set context attribute")
public void setAttribute(@Managed("attribute name") String name, @Managed("attribute value") Object value)
public void setAttribute(@Name(value = "name", description="attribute name") String name, @Name(value = "value", description="attribute value") Object value)
{
checkManagedAttribute(name,value);
_attributes.setAttribute(name,value);

View File

@ -1,13 +0,0 @@
package org.eclipse.jetty.util;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
public @interface Name
{
String value();
}

View File

@ -1,4 +1,16 @@
package org.eclipse.jetty.util.annotation;
//========================================================================
//Copyright 2011-2012 Mort Bay Consulting Pty. Ltd.
//------------------------------------------------------------------------
//All rights reserved. This program and the accompanying materials
//are made available under the terms of the Eclipse Public License v1.0
//and Apache License v2.0 which accompanies this distribution.
//The Eclipse Public License is available at
//http://www.eclipse.org/legal/epl-v10.html
//The Apache License v2.0 is available at
//http://www.opensource.org/licenses/apache2.0.php
//You may elect to redistribute this code under either of these licenses.
//========================================================================
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
@ -8,7 +20,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Target( { ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER } )
@Target( { ElementType.TYPE, ElementType.METHOD, ElementType.FIELD } )
public @interface Managed
{
String value() default "Not Specified";

View File

@ -0,0 +1,28 @@
package org.eclipse.jetty.util.annotation;
//========================================================================
//Copyright 2011-2012 Mort Bay Consulting Pty. Ltd.
//------------------------------------------------------------------------
//All rights reserved. This program and the accompanying materials
//are made available under the terms of the Eclipse Public License v1.0
//and Apache License v2.0 which accompanies this distribution.
//The Eclipse Public License is available at
//http://www.eclipse.org/legal/epl-v10.html
//The Apache License v2.0 is available at
//http://www.opensource.org/licenses/apache2.0.php
//You may elect to redistribute this code under either of these licenses.
//========================================================================
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Target( { ElementType.PARAMETER } )
public @interface Name
{
String value();
String description() default "not specified";
}