Skip to content

Commit

Permalink
Format java files in o.e.equinox.http.jetty
Browse files Browse the repository at this point in the history
This was achieved by running:
eclipse -consolelog -nosplash -application org.eclipse.jdt.core.JavaCodeFormatter \
  -config .settings/org.eclipse.jdt.core.prefs . -data `mktemp -d`

Signed-off-by: Torbjörn SVENSSON <[email protected]>
  • Loading branch information
Torbjorn-Svensson committed Oct 1, 2023
1 parent ba352ea commit 6de34c0
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@

/**
* <p>
* JettyConfigurator provides API level access for creating configured instances of a Jetty-based Http Service.
* The created instances are not persistent across re-starts of the bundle.
* JettyConfigurator provides API level access for creating configured instances
* of a Jetty-based Http Service. The created instances are not persistent
* across re-starts of the bundle.
* </p>
*
* @see org.eclipse.equinox.http.jetty.JettyConstants
Expand All @@ -31,12 +32,15 @@
*/
public class JettyConfigurator {
private static final String PID_PREFIX = "org.eclipse.equinox.http.jetty.JettyConfigurator."; //$NON-NLS-1$
private static Permission configurationPermission = new ConfigurationPermission("*", ConfigurationPermission.CONFIGURE); //$NON-NLS-1$
private static Permission configurationPermission = new ConfigurationPermission("*", //$NON-NLS-1$
ConfigurationPermission.CONFIGURE);

/**
* Creates an instance of Jetty parameterized with a dictionary of settings
* @param id The identifier for the server instance
* @param settings The dictionary of settings used to configure the server instance
*
* @param id The identifier for the server instance
* @param settings The dictionary of settings used to configure the server
* instance
* @throws Exception If the server failed to start for any reason
*/
public static void startServer(String id, Dictionary<String, ? extends Object> settings) throws Exception {
Expand All @@ -49,7 +53,9 @@ public static void startServer(String id, Dictionary<String, ? extends Object> s
}

/**
* Stops a previously started instance of Jetty. If the identified instance is not started this will call will do nothing.
* Stops a previously started instance of Jetty. If the identified instance is
* not started this will call will do nothing.
*
* @param id The identifier for the server instance
* @throws Exception If the server failed to stop for any reason.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* <p>
* Provides configuration constants for use with JettyConfigurator.
* </p>
*
* @since 1.1
* @noextend This interface is not intended to be extended by clients.
* @noimplement This interface is not intended to be implemented by clients.
Expand All @@ -40,7 +41,9 @@ public interface JettyConstants {
public static final String HTTP_HOST = "http.host"; //$NON-NLS-1$

/**
* name="http.nio" type="Boolean" (default: true, with some exceptions for JREs with known NIO problems)
* name="http.nio" type="Boolean" (default: true, with some exceptions for JREs
* with known NIO problems)
*
* @since 1.1
*/
public static final String HTTP_NIO = "http.nio"; //$NON-NLS-1$
Expand All @@ -62,12 +65,14 @@ public interface JettyConstants {

/**
* name="http.maxThreads" type="Integer" (default: 200 -- max number of threads)
*
* @since 1.2
*/
public static final String HTTP_MAXTHREADS = "http.maxThreads"; //$NON-NLS-1$

/**
* name="http.maxThreads" type="Integer" (default: 8 -- max number of threads)
*
* @since 1.2
*/
public static final String HTTP_MINTHREADS = "http.minThreads"; //$NON-NLS-1$
Expand Down Expand Up @@ -152,15 +157,18 @@ public interface JettyConstants {

/**
* name="housekeeper.interval" type="Integer"
*
* @since 1.5
*/
public static final String HOUSEKEEPER_INTERVAL = "housekeeper.interval"; //$NON-NLS-1$

/**
* name="customizer.class" type="String" <br>
* (full qualified name of the class that implements
* <code>org.eclipse.equinox.http.jetty.JettyCustomizer</code> and has a public no-arg constructor;
* the class must be supplied via a fragment to this bundle's classpath)
* <code>org.eclipse.equinox.http.jetty.JettyCustomizer</code> and has a public
* no-arg constructor; the class must be supplied via a fragment to this
* bundle's classpath)
*
* @since 1.1
*/
public static final String CUSTOMIZER_CLASS = "customizer.class"; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,68 +19,66 @@
/**
* Jetty Customizer allows one to customize Jetty contexts and connectors.
* <p>
* This abstract class must be extended by clients which wish to customize
* the created Jetty contexts or connectors further.
* This abstract class must be extended by clients which wish to customize the
* created Jetty contexts or connectors further.
* </p>
*
* @since 1.1
*/
public abstract class JettyCustomizer {

/**
* Called by the framework when the Jetty context has been created
* and initialized.
* Called by the framework when the Jetty context has been created and
* initialized.
* <p>
* Implementors may perform additional configuration of the Jetty context.
* However, they must be aware that changing certain central functionalities
* of the context such as class loading are already configured by the
* framework. Changing those may cause breakage and thus must be avoided.
* However, they must be aware that changing certain central functionalities of
* the context such as class loading are already configured by the framework.
* Changing those may cause breakage and thus must be avoided.
* </p>
* @param context
* the Jetty context; in case of Jetty 7 the context is of
* type <code>org.eclipse.jetty.servlet.ServletContextHandler</code>
* @param settings
* the settings as passed to {@link JettyConfigurator#startServer(String, Dictionary)}
* @return context
* the customized context; in case of Jetty 7 the context is of
* type <code>org.eclipse.jetty.servlet.ServletContextHandler</code>
*
* @param context the Jetty context; in case of Jetty 7 the context is of type
* <code>org.eclipse.jetty.servlet.ServletContextHandler</code>
* @param settings the settings as passed to
* {@link JettyConfigurator#startServer(String, Dictionary)}
* @return context the customized context; in case of Jetty 7 the context is of
* type <code>org.eclipse.jetty.servlet.ServletContextHandler</code>
*/
public Object customizeContext(Object context, Dictionary<String, ?> settings) {
return context;
}

/**
* Called by the framework when the Jetty Http Connector has been created
* and initialized.
* Called by the framework when the Jetty Http Connector has been created and
* initialized.
* <p>
* Implementors may perform additional configuration of the Jetty Connector.
* </p>
* @param connector
* the Jetty connector; in case of Jetty 7 the context is of
* type <code>org.eclipse.jetty.server.Connector</code>
* @param settings
* the settings as passed to {@link JettyConfigurator#startServer(String, Dictionary)}
* @return connector
* the customized connector; in case of Jetty 6 the connector is of
* type <code>org.eclipse.jetty.server.Connector</code>
*
* @param connector the Jetty connector; in case of Jetty 7 the context is of
* type <code>org.eclipse.jetty.server.Connector</code>
* @param settings the settings as passed to
* {@link JettyConfigurator#startServer(String, Dictionary)}
* @return connector the customized connector; in case of Jetty 6 the connector
* is of type <code>org.eclipse.jetty.server.Connector</code>
*/
public Object customizeHttpConnector(Object connector, Dictionary<String, ?> settings) {
return connector;
}

/**
* Called by the framework when the Jetty Https Connector has been created
* and initialized.
* Called by the framework when the Jetty Https Connector has been created and
* initialized.
* <p>
* Implementors may perform additional configuration of the Jetty Connector.
* </p>
* @param connector
* the Jetty connector; in case of Jetty 7 the connector is of
* type <code>oorg.eclipse.jetty.server.Connector</code>
* @param settings
* the settings as passed to {@link JettyConfigurator#startServer(String, Dictionary)}
* @return connector
* the customized connector; in case of Jetty 7 the connector is of
* type <code>org.eclipse.jetty.server.Connector</code>
*
* @param connector the Jetty connector; in case of Jetty 7 the connector is of
* type <code>oorg.eclipse.jetty.server.Connector</code>
* @param settings the settings as passed to
* {@link JettyConfigurator#startServer(String, Dictionary)}
* @return connector the customized connector; in case of Jetty 7 the connector
* is of type <code>org.eclipse.jetty.server.Connector</code>
*/
public Object customizeHttpsConnector(Object connector, Dictionary<String, ?> settings) {
return connector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public static boolean getBooleanProp(BundleContext dictionary, String key, boole
return getBoolean(dictionary, JettyConstants.PROPERTY_PREFIX + key, dflt);
}

public static boolean getBooleanProp(@SuppressWarnings("rawtypes") Dictionary dictionary, String key, boolean dflt) {
public static boolean getBooleanProp(@SuppressWarnings("rawtypes") Dictionary dictionary, String key,
boolean dflt) {
return getBoolean(dictionary, JettyConstants.PROPERTY_PREFIX + key, dflt);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ public org.eclipse.jetty.util.log.Logger getLogger(String name) {
return new EquinoxStdErrLog(name, realLogger.getLogger(name));
}

// debugSOO = slf4j.getMethod("debug", new Class[]{String.class,Object.class,Object.class});
// debugSOO = slf4j.getMethod("debug", new
// Class[]{String.class,Object.class,Object.class});
@Override
public void debug(String msg, Object... arg0) {
if (threshold > DEBUG)
Expand All @@ -95,7 +96,8 @@ public void debug(String msg, Object... arg0) {
realLogger.debug(msg, arg0);
}

// debugST = slf4j.getMethod("debug", new Class[]{String.class,Throwable.class});
// debugST = slf4j.getMethod("debug", new
// Class[]{String.class,Throwable.class});
@Override
public void debug(String msg, Throwable th) {
if (threshold > DEBUG)
Expand All @@ -104,7 +106,8 @@ public void debug(String msg, Throwable th) {
realLogger.debug(msg, th);
}

// infoSOO = slf4j.getMethod("info", new Class[]{String.class,Object.class,Object.class});
// infoSOO = slf4j.getMethod("info", new
// Class[]{String.class,Object.class,Object.class});
@Override
public void info(String msg, Object... arg0) {
if (threshold > INFO)
Expand All @@ -113,7 +116,8 @@ public void info(String msg, Object... arg0) {
realLogger.info(msg, arg0);
}

// warnSOO = slf4j.getMethod("warn", new Class[]{String.class,Object.class,Object.class});
// warnSOO = slf4j.getMethod("warn", new
// Class[]{String.class,Object.class,Object.class});
@Override
public void warn(String msg, Object... arg0) {
if (threshold > WARN)
Expand All @@ -135,7 +139,8 @@ else if (threshold != ERROR)
realLogger.warn(msg, th);
}

// errorST = slf4j.getMethod("error", new Class[]{String.class,Throwable.class});
// errorST = slf4j.getMethod("error", new
// Class[]{String.class,Throwable.class});
public void error(String msg, Throwable th) {
if (threshold > ERROR)
return;
Expand Down

0 comments on commit 6de34c0

Please sign in to comment.