From a0e7a295ce97642db81d979eb464175f406ac77d Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Fri, 4 Dec 2009 22:18:35 +0000 Subject: [PATCH] Moving out optional components to appropriate sandbox artifacts git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1125 7e9141cc-0065-0410-87d8-b60c137991c4 --- jetty-deploy/pom.xml | 6 -- .../webapp/deploy/DeployAuditLogBinding.java | 39 -------- .../webapp/deploy/WebappVerifierBinding.java | 95 ------------------- 3 files changed, 140 deletions(-) delete mode 100644 jetty-deploy/src/main/java/org/eclipse/jetty/webapp/deploy/DeployAuditLogBinding.java delete mode 100644 jetty-deploy/src/main/java/org/eclipse/jetty/webapp/deploy/WebappVerifierBinding.java diff --git a/jetty-deploy/pom.xml b/jetty-deploy/pom.xml index f0f9b096d5f..b4107660872 100644 --- a/jetty-deploy/pom.xml +++ b/jetty-deploy/pom.xml @@ -61,12 +61,6 @@ jetty-xml ${project.version} - - org.eclipse.jetty - jetty-webapp-verifier - ${project.version} - true - junit junit diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/webapp/deploy/DeployAuditLogBinding.java b/jetty-deploy/src/main/java/org/eclipse/jetty/webapp/deploy/DeployAuditLogBinding.java deleted file mode 100644 index d2c1988a391..00000000000 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/webapp/deploy/DeployAuditLogBinding.java +++ /dev/null @@ -1,39 +0,0 @@ -// ======================================================================== -// Copyright (c) Webtide LLC -// ------------------------------------------------------------------------ -// 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.apache.org/licenses/LICENSE-2.0.txt -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -package org.eclipse.jetty.webapp.deploy; - -import java.util.logging.Logger; - -import org.eclipse.jetty.deploy.App; -import org.eclipse.jetty.deploy.AppLifeCycle; -import org.eclipse.jetty.deploy.DeploymentManager; -import org.eclipse.jetty.deploy.graph.Node; - -public class DeployAuditLogBinding implements AppLifeCycle.Binding -{ - private Logger logger = Logger.getLogger("audit.deploy"); - - public String[] getBindingTargets() - { - return new String[] - { "*" }; - } - - public void processBinding(Node node, App app, DeploymentManager deploymentManager) throws Exception - { - logger.info("Reached LifeCycle " + node.getName() + " on app " + app.getOriginId()); - } -} diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/webapp/deploy/WebappVerifierBinding.java b/jetty-deploy/src/main/java/org/eclipse/jetty/webapp/deploy/WebappVerifierBinding.java deleted file mode 100644 index 9ce1f532bf5..00000000000 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/webapp/deploy/WebappVerifierBinding.java +++ /dev/null @@ -1,95 +0,0 @@ -// ======================================================================== -// Copyright (c) Webtide LLC -// ------------------------------------------------------------------------ -// 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.apache.org/licenses/LICENSE-2.0.txt -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -package org.eclipse.jetty.webapp.deploy; - -import java.io.File; -import java.net.URI; -import java.util.Collection; - -import org.eclipse.jetty.deploy.App; -import org.eclipse.jetty.deploy.AppLifeCycle; -import org.eclipse.jetty.deploy.DeploymentManager; -import org.eclipse.jetty.deploy.graph.Node; -import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.webapp.verifier.RuleSet; -import org.eclipse.jetty.webapp.verifier.Severity; -import org.eclipse.jetty.webapp.verifier.Violation; -import org.eclipse.jetty.webapp.verifier.WebappVerifier; - -/** - * Deploy Binding for the Webapp Verifier. - * - * Will verify the webapp being deployed, to ensure that it satisfies the ruleset configured. - */ -public class WebappVerifierBinding implements AppLifeCycle.Binding -{ - private String rulesetPath; - - public String getRulesetPath() - { - return rulesetPath; - } - - public void setRulesetPath(String rulesetPath) - { - this.rulesetPath = rulesetPath; - } - - public String[] getBindingTargets() - { - return new String[] - { "pre-deploying" }; - } - - public void processBinding(Node node, App app, DeploymentManager deploymentManager) throws Exception - { - File rulesetFile = new File(this.rulesetPath); - - RuleSet ruleset = RuleSet.load(rulesetFile); - - URI warURI = app.getArchivePath().toURI(); - - WebappVerifier verifier = ruleset.createWebappVerifier(warURI); - - verifier.visitAll(); - - Collection violations = verifier.getViolations(); - if (violations.size() <= 0) - { - // Nothing to report. - Log.info("Webapp Verifier - All Rules Passed - No Violations"); - return; - } - - boolean haltWebapp = false; - Log.info("Webapp Verifier Found " + violations.size() + " violations."); - - for (Violation violation : violations) - { - if (violation.getSeverity() == Severity.ERROR) - { - haltWebapp = true; - } - - Log.info(violation.toString()); - } - - if (haltWebapp) - { - throw new IllegalStateException("Webapp Failed Webapp Verification"); - } - } -}