Modified: tomee/tomee/trunk/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/installer/InstallerServlet.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/installer/InstallerServlet.java?rev=1597579&r1=1597578&r2=1597579&view=diff ============================================================================== --- tomee/tomee/trunk/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/installer/InstallerServlet.java (original) +++ tomee/tomee/trunk/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/installer/InstallerServlet.java Mon May 26 13:26:21 2014 @@ -32,16 +32,16 @@ import java.util.Map; public class InstallerServlet extends HttpServlet { - private String escape(String str) { + private String escape(final String str) { if (str == null) { return ""; } return str.replaceAll("\"", "\\\\\"").replaceAll("\\\\", "\\\\\\\\"); } - private String getJsonList(List<Map<String, String>> list) { + private String getJsonList(final List<Map<String, String>> list) { final StringBuffer sb = new StringBuffer(); - for (Map<String, String> entry : list) { + for (final Map<String, String> entry : list) { sb.append(String.format("{\"key\": \"%s\", \"value\": \"%s\"},", entry.get("key"), escape(entry.get("value")) )); @@ -53,7 +53,7 @@ public class InstallerServlet extends Ht } @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { final ServletContext ctx = req.getServletContext(); final String rootPath = ctx.getRealPath("/"); final Runner installer = new Runner(new Installer(new Paths(new File(rootPath)))); @@ -62,7 +62,7 @@ public class InstallerServlet extends Ht } @Override - protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { final ServletContext ctx = req.getServletContext(); final String rootPath = ctx.getRealPath("/"); final Runner installer = new Runner(new Installer(new Paths(new File(rootPath))));
Modified: tomee/tomee/trunk/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/installer/Runner.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/installer/Runner.java?rev=1597579&r1=1597578&r2=1597579&view=diff ============================================================================== --- tomee/tomee/trunk/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/installer/Runner.java (original) +++ tomee/tomee/trunk/tomee/tomee-webapp/src/main/java/org/apache/tomee/webapp/installer/Runner.java Mon May 26 13:26:21 2014 @@ -39,32 +39,32 @@ public class Runner { private static List<Map<String, String>> installerResults = null; private static org.apache.tomee.installer.Status installerStatus = null; - public Runner(InstallerInterface installer) { + public Runner(final InstallerInterface installer) { this.installer = installer; } - public void setCatalinaHome(String catalinaHome) { + public void setCatalinaHome(final String catalinaHome) { this.catalinaHome = catalinaHome; } - public void setCatalinaBaseDir(String catalinaBase) { + public void setCatalinaBaseDir(final String catalinaBase) { this.catalinaBase = catalinaBase; } - public void setServerXmlFile(String serverXmlFile) { + public void setServerXmlFile(final String serverXmlFile) { this.serverXmlFile = serverXmlFile; } - private void setAlerts(String key, List<String> messages) { + private void setAlerts(final String key, final List<String> messages) { if (messages == null) { return; } - for (String message : messages) { + for (final String message : messages) { installerResults.add(Common.build(key, message)); } } - public synchronized List<Map<String, String>> execute(boolean install) { + public synchronized List<Map<String, String>> execute(final boolean install) { if (org.apache.tomee.installer.Status.INSTALLED.equals(installerStatus) || org.apache.tomee.installer.Status.REBOOT_REQUIRED.equals(installerStatus)) { return installerResults; @@ -117,20 +117,20 @@ public class Runner { final ClassLoader myLoader = this.getClass().getClassLoader(); Class.forName("org.apache.openejb.OpenEJB", true, myLoader); wereTheOpenEJBClassesInstalled = true; - } catch (Exception e) { + } catch (final Exception e) { // noop } try { Class.forName("javax.ejb.EJBHome", true, this.getClass().getClassLoader()); wereTheEjbClassesInstalled = true; - } catch (Exception e) { + } catch (final Exception e) { // noop } try { final Class openejb = Class.forName("org.apache.openejb.OpenEJB", true, this.getClass().getClassLoader()); final Method isInitialized = openejb.getDeclaredMethod("isInitialized"); wasOpenEJBStarted = (Boolean) isInitialized.invoke(openejb); - } catch (Exception e) { + } catch (final Exception e) { // noop } try { @@ -142,7 +142,7 @@ public class Runner { if (obj.getClass().getName().equals("org.apache.openejb.core.ivm.naming.IvmContext")) { canILookupAnything = true; } - } catch (Exception e) { + } catch (final Exception e) { // noop } installerResults.add(Common.build("wereTheOpenEJBClassesInstalled", String.valueOf(wereTheOpenEJBClassesInstalled))); Modified: tomee/tomee/trunk/tomee/tomee-webapp/src/test/java/org/apache/tomee/webapp/installer/test/RunnerTest.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webapp/src/test/java/org/apache/tomee/webapp/installer/test/RunnerTest.java?rev=1597579&r1=1597578&r2=1597579&view=diff ============================================================================== --- tomee/tomee/trunk/tomee/tomee-webapp/src/test/java/org/apache/tomee/webapp/installer/test/RunnerTest.java (original) +++ tomee/tomee/trunk/tomee/tomee-webapp/src/test/java/org/apache/tomee/webapp/installer/test/RunnerTest.java Mon May 26 13:26:21 2014 @@ -30,8 +30,8 @@ import java.util.Map; public class RunnerTest { - private Object getValue(String key, List<Map<String, String>> runnerResults) { - for (Map<String, String> result : runnerResults) { + private Object getValue(final String key, final List<Map<String, String>> runnerResults) { + for (final Map<String, String> result : runnerResults) { if (key.equals(result.get("key"))) { return result.get("value"); } @@ -42,13 +42,13 @@ public class RunnerTest { @Test public void testInstaller() { { - PathsInterface paths = EasyMock.createNiceMock(PathsInterface.class); + final PathsInterface paths = EasyMock.createNiceMock(PathsInterface.class); paths.reset(); EasyMock.expectLastCall(); paths.verify(); EasyMock.expectLastCall().andReturn(Boolean.TRUE).anyTimes(); - InstallerInterface installer = EasyMock.createNiceMock(InstallerInterface.class); + final InstallerInterface installer = EasyMock.createNiceMock(InstallerInterface.class); installer.getPaths(); EasyMock.expectLastCall().andReturn(paths).anyTimes(); installer.reset(); @@ -63,7 +63,7 @@ public class RunnerTest { EasyMock.expectLastCall().andReturn(new Alerts()).anyTimes(); - Runner runner = new Runner(installer); + final Runner runner = new Runner(installer); EasyMock.replay(paths, installer); Assert.assertEquals("NONE", getValue("status", runner.execute(false))); Assert.assertEquals("NONE", getValue("status", runner.execute(false))); @@ -73,8 +73,8 @@ public class RunnerTest { EasyMock.verify(paths, installer); } { - InstallerInterface installer = EasyMock.createStrictMock(InstallerInterface.class); - Runner runner = new Runner(installer); + final InstallerInterface installer = EasyMock.createStrictMock(InstallerInterface.class); + final Runner runner = new Runner(installer); EasyMock.replay(installer); Assert.assertEquals("REBOOT_REQUIRED", getValue("status", runner.execute(false))); Assert.assertEquals("REBOOT_REQUIRED", getValue("status", runner.execute(true))); Modified: tomee/tomee/trunk/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomcatWsRegistry.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomcatWsRegistry.java?rev=1597579&r1=1597578&r2=1597579&view=diff ============================================================================== --- tomee/tomee/trunk/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomcatWsRegistry.java (original) +++ tomee/tomee/trunk/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomcatWsRegistry.java Mon May 26 13:26:21 2014 @@ -68,8 +68,8 @@ public class TomcatWsRegistry implements private List<Connector> connectors; public TomcatWsRegistry() { - StandardServer standardServer = TomcatHelper.getServer(); - for (Service service : standardServer.findServices()) { + final StandardServer standardServer = TomcatHelper.getServer(); + for (final Service service : standardServer.findServices()) { if (service.getContainer() instanceof Engine) { connectors = Arrays.asList(service.findConnectors()); engine = (Engine) service.getContainer(); @@ -78,7 +78,7 @@ public class TomcatWsRegistry implements } } - private static String forceSlash(String property) { + private static String forceSlash(final String property) { if (property == null) { return "/"; } @@ -90,14 +90,14 @@ public class TomcatWsRegistry implements @Override - public List<String> setWsContainer(HttpListener httpListener, - ClassLoader classLoader, - String contextRoot, String virtualHost, ServletInfo servletInfo, - String realmName, String transportGuarantee, String authMethod) throws Exception { + public List<String> setWsContainer(final HttpListener httpListener, + final ClassLoader classLoader, + String contextRoot, String virtualHost, final ServletInfo servletInfo, + final String realmName, final String transportGuarantee, final String authMethod) throws Exception { if (virtualHost == null) virtualHost = engine.getDefaultHost(); - Container host = engine.findChild(virtualHost); + final Container host = engine.findChild(virtualHost); if (host == null) { throw new IllegalArgumentException("Invalid virtual host '" + virtualHost + "'. Do you have a matchiing Host entry in the server.xml?"); } @@ -106,12 +106,12 @@ public class TomcatWsRegistry implements contextRoot = "/" + contextRoot; } - Context context = (Context) host.findChild(contextRoot); + final Context context = (Context) host.findChild(contextRoot); if (context == null) { throw new IllegalArgumentException("Could not find web application context " + contextRoot + " in host " + host.getName()); } - Wrapper wrapper = (Wrapper) context.findChild(servletInfo.servletName); + final Wrapper wrapper = (Wrapper) context.findChild(servletInfo.servletName); if (wrapper == null) { throw new IllegalArgumentException("Could not find servlet " + servletInfo.servletName + " in web application context " + context.getName()); } @@ -127,10 +127,10 @@ public class TomcatWsRegistry implements setWsContainer(context, wrapper, httpListener); // add service locations - List<String> addresses = new ArrayList<String>(); - for (Connector connector : connectors) { - for (String mapping : wrapper.findMappings()) { - URI address = new URI(connector.getScheme(), null, host.getName(), connector.getPort(), "/" + contextRoot + mapping, null, null); + final List<String> addresses = new ArrayList<String>(); + for (final Connector connector : connectors) { + for (final String mapping : wrapper.findMappings()) { + final URI address = new URI(connector.getScheme(), null, host.getName(), connector.getPort(), "/" + contextRoot + mapping, null, null); addresses.add(address.toString()); } } @@ -139,26 +139,26 @@ public class TomcatWsRegistry implements @Override - public void clearWsContainer(String contextRoot, String virtualHost, ServletInfo servletInfo) { + public void clearWsContainer(final String contextRoot, String virtualHost, final ServletInfo servletInfo) { if (virtualHost == null) virtualHost = engine.getDefaultHost(); - Container host = engine.findChild(virtualHost); + final Container host = engine.findChild(virtualHost); if (host == null) { throw new IllegalArgumentException("Invalid virtual host '" + virtualHost + "'. Do you have a matchiing Host entry in the server.xml?"); } - Context context = (Context) host.findChild("/" + contextRoot); + final Context context = (Context) host.findChild("/" + contextRoot); if (context == null) { throw new IllegalArgumentException("Could not find web application context " + contextRoot + " in host " + host.getName()); } - Wrapper wrapper = (Wrapper) context.findChild(servletInfo.servletName); + final Wrapper wrapper = (Wrapper) context.findChild(servletInfo.servletName); if (wrapper == null) { throw new IllegalArgumentException("Could not find servlet " + servletInfo.servletName + " in web application context " + context.getName()); } // clear the webservice ref in the servlet context - String webServicecontainerId = wrapper.findInitParameter(WsServlet.WEBSERVICE_CONTAINER); + final String webServicecontainerId = wrapper.findInitParameter(WsServlet.WEBSERVICE_CONTAINER); if (webServicecontainerId != null) { context.getServletContext().removeAttribute(webServicecontainerId); wrapper.removeInitParameter(WsServlet.WEBSERVICE_CONTAINER); @@ -169,10 +169,10 @@ public class TomcatWsRegistry implements // String webContext, String path, HttpListener httpListener, String virtualHost, String realmName, String transportGuarantee, String authMethod, ClassLoader classLoader @Override - public List<String> addWsContainer(HttpListener httpListener, - ClassLoader classLoader, - String context, String virtualHost, String path, - String realmName, String transportGuarantee, String authMethod) throws Exception { + public List<String> addWsContainer(final HttpListener httpListener, + final ClassLoader classLoader, + final String context, String virtualHost, String path, + final String realmName, final String transportGuarantee, final String authMethod) throws Exception { if (path == null) throw new NullPointerException("contextRoot is null"); if (httpListener == null) throw new NullPointerException("httpListener is null"); @@ -181,12 +181,12 @@ public class TomcatWsRegistry implements // find the existing host (we do not auto-create hosts) if (virtualHost == null) virtualHost = engine.getDefaultHost(); - Container host = engine.findChild(virtualHost); + final Container host = engine.findChild(virtualHost); if (host == null) { throw new IllegalArgumentException("Invalid virtual host '" + virtualHost + "'. Do you have a matchiing Host entry in the server.xml?"); } - List<String> addresses = new ArrayList<String>(); + final List<String> addresses = new ArrayList<String>(); // build contexts // - old way (/*) @@ -222,7 +222,7 @@ public class TomcatWsRegistry implements return addresses; } - private void deployInFakeWebapp(String path, ClassLoader classLoader, String authMethod, String transportGuarantee, String realmName, Container host, HttpListener httpListener, List<String> addresses, String name) { + private void deployInFakeWebapp(final String path, final ClassLoader classLoader, final String authMethod, final String transportGuarantee, final String realmName, final Container host, final HttpListener httpListener, final List<String> addresses, final String name) { Container context = host.findChild(name); if (context == null) { context = createNewContext(classLoader, authMethod, transportGuarantee, realmName, name); @@ -243,7 +243,7 @@ public class TomcatWsRegistry implements addServlet(host, (Context) context, mapping, httpListener, path, addresses, true); } - private static Context createNewContext(ClassLoader classLoader, String authMethod, String transportGuarantee, String realmName, String name) { + private static Context createNewContext(final ClassLoader classLoader, String authMethod, String transportGuarantee, final String realmName, final String name) { String path = name; if (path == null) { path = "/"; @@ -272,7 +272,7 @@ public class TomcatWsRegistry implements } else if ("BASIC".equals(authMethod) || "DIGEST".equals(authMethod) || "CLIENT-CERT".equals(authMethod)) { //Setup a login configuration - LoginConfig loginConfig = new LoginConfig(); + final LoginConfig loginConfig = new LoginConfig(); loginConfig.setAuthMethod(authMethod); loginConfig.setRealmName(realmName); context.setLoginConfig(loginConfig); @@ -316,9 +316,9 @@ public class TomcatWsRegistry implements return context; } - private void addServlet(Container host, Context context, String mapping, HttpListener httpListener, String path, List<String> addresses, boolean fakeDeployment) { + private void addServlet(final Container host, final Context context, final String mapping, final HttpListener httpListener, final String path, final List<String> addresses, final boolean fakeDeployment) { // build the servlet - Wrapper wrapper = context.createWrapper(); + final Wrapper wrapper = context.createWrapper(); wrapper.setName("webservice" + path.substring(1)); wrapper.setServletClass(WsServlet.class.getName()); @@ -326,7 +326,7 @@ public class TomcatWsRegistry implements context.addChild(wrapper); context.addServletMapping(mapping, wrapper.getName()); - String webServicecontainerID = wrapper.getName() + WsServlet.WEBSERVICE_CONTAINER + httpListener.hashCode(); + final String webServicecontainerID = wrapper.getName() + WsServlet.WEBSERVICE_CONTAINER + httpListener.hashCode(); wrapper.addInitParameter(WsServlet.WEBSERVICE_CONTAINER, webServicecontainerID); setWsContainer(context, wrapper, httpListener); @@ -354,9 +354,9 @@ public class TomcatWsRegistry implements } try { - URI address = new URI(connector.getScheme(), null, host.getName(), connector.getPort(), fullContextpath.toString(), null, null); + final URI address = new URI(connector.getScheme(), null, host.getName(), connector.getPort(), fullContextpath.toString(), null, null); addresses.add(address.toString()); - } catch (URISyntaxException ignored) { + } catch (final URISyntaxException ignored) { // no-op } } @@ -386,19 +386,19 @@ public class TomcatWsRegistry implements try { context.stop(); context.destroy(); - } catch (Exception e) { + } catch (final Exception e) { throw new TomEERuntimeException(e); } - Host host = (Host) context.getParent(); + final Host host = (Host) context.getParent(); host.removeChild(context); } // else let tomcat manages its context } - private void setWsContainer(Context context, Wrapper wrapper, HttpListener wsContainer) { + private void setWsContainer(final Context context, final Wrapper wrapper, final HttpListener wsContainer) { // Make up an ID for the WebServiceContainer // put a reference the ID in the init-params // put the WebServiceContainer in the webapp context keyed by its ID - String webServicecontainerID = wrapper.getName() + WsServlet.WEBSERVICE_CONTAINER + wsContainer.hashCode(); + final String webServicecontainerID = wrapper.getName() + WsServlet.WEBSERVICE_CONTAINER + wsContainer.hashCode(); context.getServletContext().setAttribute(webServicecontainerID, wsContainer); wrapper.addInitParameter(WsServlet.WEBSERVICE_CONTAINER, webServicecontainerID); } Modified: tomee/tomee/trunk/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomeeJaxWsService.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomeeJaxWsService.java?rev=1597579&r1=1597578&r2=1597579&view=diff ============================================================================== --- tomee/tomee/trunk/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomeeJaxWsService.java (original) +++ tomee/tomee/trunk/tomee/tomee-webservices/src/main/java/org/apache/tomee/webservices/TomeeJaxWsService.java Mon May 26 13:26:21 2014 @@ -30,7 +30,7 @@ import org.apache.tomee.catalina.event.A public class TomeeJaxWsService implements Service { @Override - public void init(Properties props) throws Exception { + public void init(final Properties props) throws Exception { // Install the Tomcat webservice registry final SystemInstance system = SystemInstance.get(); @@ -49,7 +49,7 @@ public class TomeeJaxWsService implement // required for Pojo Web Services because when Assembler creates the application // the CoreContainerSystem does not contain the WebContext // see also the start method getContainerSystem().addWebDeployment(webContext); - WsService component = SystemInstance.get().getComponent(WsService.class); + final WsService component = SystemInstance.get().getComponent(WsService.class); if (component == null) return; component.afterApplicationCreated(event.getApp(), event.getWeb()); }
