felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1452200 - in /felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo: BundleInfo.java BundleInfoProvider.java BundleInfoType.java
Date Mon, 04 Mar 2013 07:21:44 GMT
Author: fmeschbe
Date: Mon Mar  4 07:21:43 2013
New Revision: 1452200

URL: http://svn.apache.org/r1452200
Log:
Reformat (replace tabs by space)

Modified:
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfo.java
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoProvider.java
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoType.java

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfo.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfo.java?rev=1452200&r1=1452199&r2=1452200&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfo.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfo.java
Mon Mar  4 07:21:43 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.felix.webconsole.bundleinfo;
 
+
 /**
  * This entity defines additional bundle information entry, that is provided by
  * the {@link BundleInfoProvider}. Each information entry is featured by name,
@@ -23,7 +24,7 @@ package org.apache.felix.webconsole.bund
  * 
  * @author Valentin Valchev
  */
-public class BundleInfo 
+public class BundleInfo
 {
 
     private final String name;
@@ -31,6 +32,7 @@ public class BundleInfo 
     private final Object value;
     private final BundleInfoType type;
 
+
     /**
      * Creates a new bundle information entry.
      * 
@@ -43,56 +45,59 @@ public class BundleInfo 
      * @param description
      *            additional, user-friendly description for that value.
      */
-    public BundleInfo(String name, Object value, BundleInfoType type,
-	    String description) 
+    public BundleInfo( String name, Object value, BundleInfoType type, String description
)
     {
-	this.name = name;
-	this.value = value;
-	this.type = type;
-	this.description = description;
-	type.validate(value);
+        this.name = name;
+        this.value = value;
+        this.type = type;
+        this.description = description;
+        type.validate( value );
     }
 
+
     /**
      * Gets the name of the information entry. The name should be localized
      * according the requested locale.
      * 
      * @return the name of that information key.
      */
-    public String getName() 
+    public String getName()
     {
-	return name;
+        return name;
     }
 
+
     /**
      * Gets user-friendly description of the key pair. The description should be
      * localized according the requested locale.
      * 
      * @return the description for that information key.
      */
-    public String getDescription() 
+    public String getDescription()
     {
-	return description;
+        return description;
     }
 
+
     /**
      * Gets the information value.
      * 
      * @return the value.
      */
-    public Object getValue() 
+    public Object getValue()
     {
-	return value;
+        return value;
     }
 
+
     /**
      * Gets the type of the information value.
      * 
      * @return the information type.
      */
-    public BundleInfoType getType() 
+    public BundleInfoType getType()
     {
-	return type;
+        return type;
     }
 
 }

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoProvider.java?rev=1452200&r1=1452199&r2=1452200&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoProvider.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoProvider.java
Mon Mar  4 07:21:43 2013
@@ -16,10 +16,12 @@
  */
 package org.apache.felix.webconsole.bundleinfo;
 
+
 import java.util.Locale;
 
 import org.osgi.framework.Bundle;
 
+
 /**
  * The bundle info provider allows the user to supply additional information
  * that will be used by the Web Console bundle plugin.
@@ -35,7 +37,7 @@ import org.osgi.framework.Bundle;
  * 
  * @author Valentin Valchev
  */
-public interface BundleInfoProvider 
+public interface BundleInfoProvider
 {
 
     /**
@@ -44,6 +46,7 @@ public interface BundleInfoProvider 
      */
     public static final BundleInfo[] NO_INFO = new BundleInfo[0];
 
+
     /**
      * Gets the name of the bundle info provider as localized string.
      * 
@@ -51,7 +54,8 @@ public interface BundleInfoProvider 
      *            the locale in which the name should be returned
      * @return the name of the bundle info provider.
      */
-    String getName(Locale locale);
+    String getName( Locale locale );
+
 
     /**
      * Gets the associated bundle information with the specified bundle (by it's
@@ -65,6 +69,5 @@ public interface BundleInfoProvider 
      *            the locale in which the key-value pair should be returned.
      * @return array of available {@link BundleInfo} or empty array if none.
      */
-    BundleInfo[] getBundleInfo(Bundle bundle, String webConsoleRoot,
-	    Locale locale);
+    BundleInfo[] getBundleInfo( Bundle bundle, String webConsoleRoot, Locale locale );
 }

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoType.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoType.java?rev=1452200&r1=1452199&r2=1452200&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoType.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoType.java
Mon Mar  4 07:21:43 2013
@@ -16,14 +16,16 @@
  */
 package org.apache.felix.webconsole.bundleinfo;
 
+
 import java.net.URL;
 
+
 /**
  * This pre-java 5 enum defines all valid bundle information value types.
  * 
  * @author Valentin Valchev
  */
-public final class BundleInfoType 
+public final class BundleInfoType
 {
 
     /**
@@ -36,29 +38,31 @@ public final class BundleInfoType 
      * for security reasons, the protocol cannot be <code>file</code> for
      * external links.
      */
-    public static final BundleInfoType LINK = new BundleInfoType("link"); //$NON-NLS-1$
+    public static final BundleInfoType LINK = new BundleInfoType( "link" ); //$NON-NLS-1$
     /**
      * This information type, specifies that the value of the information is URL
      * object, that points to a resource. In that case the UI could consider
      * that as a <em>download</em> link.
      */
-    public static final BundleInfoType RESOURCE = new BundleInfoType("resource"); //$NON-NLS-1$
+    public static final BundleInfoType RESOURCE = new BundleInfoType( "resource" ); //$NON-NLS-1$
     /**
      * That information type is for normal information keys, that provide a
      * normal (not link) value as information. The type of the value is
      * <code>Object</code> and UI will visualize it by using it's
      * {@link Object#toString()} method.
      */
-    public static final BundleInfoType VALUE = new BundleInfoType("value"); //$NON-NLS-1$
+    public static final BundleInfoType VALUE = new BundleInfoType( "value" ); //$NON-NLS-1$
 
     private final String name;
 
-    private BundleInfoType(String name)
+
+    private BundleInfoType( String name )
     {
-	/* prevent instantiation */
-	this.name = name;
+        /* prevent instantiation */
+        this.name = name;
     }
 
+
     /**
      * Returns the name of the type.
      * 
@@ -66,9 +70,10 @@ public final class BundleInfoType 
      */
     public final String getName()
     {
-	return name;
+        return name;
     }
 
+
     /**
      * That method is used to validate if the object is correct for the
      * specified type.
@@ -76,33 +81,32 @@ public final class BundleInfoType 
      * @param value
      *            the value that will be validated.
      */
-    public final void validate(final Object value)
+    public final void validate( final Object value )
     {
-	if (this == LINK)
-	{
-	    if (!(value instanceof String))
-		throw new IllegalArgumentException("Not a String");
-	    final String val = (String) value;
-	    final int idx = val.indexOf("://"); //$NON-NLS-1$
-	    // check local
-	    if (idx == -1)
-	    {
-		if (!val.startsWith("/")) //$NON-NLS-1$
-		    throw new IllegalArgumentException("Invalid local link");
-	    }
-	    else
-	    {
-		// check external link
-		if (val.substring(0, idx).equalsIgnoreCase("file")) //$NON-NLS-1$
-		    throw new IllegalArgumentException(
-			    "External link cannot use file protocol");
-	    }
-	}
-	else if (this == RESOURCE) 
-	{
-	    if (!(value instanceof URL))
-		throw new IllegalArgumentException("Invalid URL");
-	}
+        if ( this == LINK )
+        {
+            if ( !( value instanceof String ) )
+                throw new IllegalArgumentException( "Not a String" );
+            final String val = ( String ) value;
+            final int idx = val.indexOf( "://" ); //$NON-NLS-1$
+            // check local
+            if ( idx == -1 )
+            {
+                if ( !val.startsWith( "/" ) ) //$NON-NLS-1$
+                    throw new IllegalArgumentException( "Invalid local link" );
+            }
+            else
+            {
+                // check external link
+                if ( val.substring( 0, idx ).equalsIgnoreCase( "file" ) ) //$NON-NLS-1$
+                    throw new IllegalArgumentException( "External link cannot use file protocol"
);
+            }
+        }
+        else if ( this == RESOURCE )
+        {
+            if ( !( value instanceof URL ) )
+                throw new IllegalArgumentException( "Invalid URL" );
+        }
     }
 
 }



Mime
View raw message