Reformat (replace tabs by space)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1452200 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfo.java b/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfo.java
index e7f320e..d629be4 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfo.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfo.java
@@ -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 @@
*
* @author Valentin Valchev
*/
-public class BundleInfo
+public class BundleInfo
{
private final String name;
@@ -31,6 +32,7 @@
private final Object value;
private final BundleInfoType type;
+
/**
* Creates a new bundle information entry.
*
@@ -43,56 +45,59 @@
* @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;
}
}
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoProvider.java b/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoProvider.java
index 6a1f75a..a8b123b 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoProvider.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoProvider.java
@@ -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 @@
*
* @author Valentin Valchev
*/
-public interface BundleInfoProvider
+public interface BundleInfoProvider
{
/**
@@ -44,6 +46,7 @@
*/
public static final BundleInfo[] NO_INFO = new BundleInfo[0];
+
/**
* Gets the name of the bundle info provider as localized string.
*
@@ -51,7 +54,8 @@
* 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 @@
* 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 );
}
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoType.java b/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoType.java
index bab6afa..3aec8c5 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoType.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/bundleinfo/BundleInfoType.java
@@ -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 @@
* 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 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 @@
* @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" );
+ }
}
}