diff --git a/docs/_docs/code-snippets/java/pom.xml b/docs/_docs/code-snippets/java/pom.xml
index 66b95b0878140..77a2e41d3c062 100644
--- a/docs/_docs/code-snippets/java/pom.xml
+++ b/docs/_docs/code-snippets/java/pom.xml
@@ -57,11 +57,6 @@
ignite-spring${ignite.version}
-
- ${project.groupId}
- ignite-urideploy
- ${ignite.version}
- ${project.groupId}ignite-zookeeper
diff --git a/modules/bom/pom.xml b/modules/bom/pom.xml
index 25f8124d03fc0..08b2ad73a9235 100644
--- a/modules/bom/pom.xml
+++ b/modules/bom/pom.xml
@@ -146,11 +146,6 @@
ignite-tools${revision}
-
- ${project.groupId}
- ignite-urideploy
- ${revision}
- ${project.groupId}ignite-yardstick
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index bbb9d38537073..ed01c9662bd4b 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -29,7 +29,6 @@
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.CheckpointWriteOrder;
import org.apache.ignite.configuration.DataStorageConfiguration;
-import org.apache.ignite.configuration.DeploymentMode;
import org.apache.ignite.configuration.DiskPageCompression;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.cache.query.index.sorted.inline.InlineRecommender;
@@ -369,17 +368,6 @@ public final class IgniteSystemProperties extends IgniteCommonsSystemProperties
"overrides the settings set via IgniteConfiguration", type = String.class)
public static final String IGNITE_LOCAL_HOST = "IGNITE_LOCAL_HOST";
- /**
- * System property to override deployment mode configuration parameter.
- * Valid values for property are: PRIVATE, ISOLATED, SHARED or CONTINUOUS.
- *
- * @see org.apache.ignite.configuration.DeploymentMode
- * @see org.apache.ignite.configuration.IgniteConfiguration#getDeploymentMode()
- */
- @SystemProperty(value = "Sets deployment mode configuration parameter. Valid " +
- "values for property are: PRIVATE, ISOLATED, SHARED or CONTINUOUS", type = DeploymentMode.class)
- public static final String IGNITE_DEP_MODE_OVERRIDE = "IGNITE_DEPLOYMENT_MODE_OVERRIDE";
-
/**
* Property controlling size of buffer holding completed transaction versions. Such buffer
* is used to detect duplicate transaction and has a default value of {@code 102400}. In
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index 7f4529a6a1951..b77187f2d7611 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -62,7 +62,6 @@
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.ConnectorConfiguration;
import org.apache.ignite.configuration.DataStorageConfiguration;
-import org.apache.ignite.configuration.DeploymentMode;
import org.apache.ignite.configuration.ExecutorConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
@@ -128,7 +127,6 @@
import static org.apache.ignite.IgniteState.STOPPED_ON_SEGMENTATION;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_CACHE_CLIENT;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_CONFIG_URL;
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_DEP_MODE_OVERRIDE;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_LOCAL_HOST;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_NO_SHUTDOWN_HOOK;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_OVERRIDE_CONSISTENT_ID;
@@ -1879,29 +1877,6 @@ private IgniteConfiguration initializeConfiguration(IgniteConfiguration cfg)
myCfg.setClientMode(threadClient);
}
- // Check for deployment mode override.
- String depModeName = IgniteSystemProperties.getString(IGNITE_DEP_MODE_OVERRIDE);
-
- if (!F.isEmpty(depModeName)) {
- if (!F.isEmpty(myCfg.getCacheConfiguration())) {
- U.quietAndInfo(log, "Skipping deployment mode override for caches (custom closure " +
- "execution may not work for console Visor)");
- }
- else {
- try {
- DeploymentMode depMode = DeploymentMode.valueOf(depModeName);
-
- if (myCfg.getDeploymentMode() != depMode)
- myCfg.setDeploymentMode(depMode);
- }
- catch (IllegalArgumentException e) {
- throw new IgniteCheckedException("Failed to override deployment mode using system property " +
- "(are there any misspellings?)" +
- "[name=" + IGNITE_DEP_MODE_OVERRIDE + ", value=" + depModeName + ']', e);
- }
- }
- }
-
if (myCfg.getUserAttributes() == null)
myCfg.setUserAttributes(Collections.emptyMap());
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
index a89a8dfb11f88..c6907fa33f89e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManagerAttributesSelfTest.java
@@ -19,7 +19,6 @@
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.configuration.DeploymentMode;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.marshaller.Marshallers;
@@ -30,8 +29,6 @@
import static org.apache.ignite.IgniteSystemProperties.IGNITE_BINARY_MARSHALLER_USE_STRING_SERIALIZATION_VER_2;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_OPTIMIZED_MARSHALLER_USE_DEFAULT_SUID;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_SECURITY_COMPATIBILITY_MODE;
-import static org.apache.ignite.configuration.DeploymentMode.CONTINUOUS;
-import static org.apache.ignite.configuration.DeploymentMode.SHARED;
/**
* Tests for node attributes consistency checks.
@@ -40,9 +37,6 @@ public class GridDiscoveryManagerAttributesSelfTest extends GridCommonAbstractTe
/** */
private static final String PREFER_IPV4 = "java.net.preferIPv4Stack";
- /** */
- private static DeploymentMode mode;
-
/** */
private static boolean p2pEnabled;
@@ -54,7 +48,6 @@ public class GridDiscoveryManagerAttributesSelfTest extends GridCommonAbstractTe
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setIncludeProperties(PREFER_IPV4);
- cfg.setDeploymentMode(mode);
cfg.setPeerClassLoadingEnabled(p2pEnabled);
if (secEnabled)
@@ -65,8 +58,6 @@ public class GridDiscoveryManagerAttributesSelfTest extends GridCommonAbstractTe
/** {@inheritDoc} */
@Override protected void beforeTest() throws Exception {
- mode = SHARED;
-
p2pEnabled = false;
}
@@ -315,28 +306,6 @@ private void doTestCompatibilityEnabled(String prop, Object first, Object second
}
}
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testDifferentDeploymentModes() throws Exception {
- IgniteEx g = startGrid(0);
-
- checkIsClientFlag(g);
-
- mode = CONTINUOUS;
-
- try {
- startClientGrid(1);
-
- fail();
- }
- catch (IgniteCheckedException e) {
- if (!e.getCause().getMessage().startsWith("Remote node has deployment mode different from"))
- throw e;
- }
- }
-
/**
* @throws Exception If failed.
*/
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
index 4e6964e48933c..190d5ea04fa4a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConfigurationConsistencySelfTest.java
@@ -35,7 +35,6 @@
import org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicyFactory;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.DeploymentMode;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
import org.apache.ignite.internal.util.typedef.C1;
@@ -56,8 +55,6 @@
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_ASYNC;
import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
import static org.apache.ignite.configuration.CacheConfiguration.DFLT_CACHE_MODE;
-import static org.apache.ignite.configuration.DeploymentMode.CONTINUOUS;
-import static org.apache.ignite.configuration.DeploymentMode.SHARED;
/**
*
@@ -73,9 +70,6 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
/** */
private CacheMode cacheMode = REPLICATED;
- /** */
- private DeploymentMode depMode = SHARED;
-
/** */
private C1 initCache;
@@ -105,8 +99,6 @@ public class GridCacheConfigurationConsistencySelfTest extends GridCommonAbstrac
cfg.setGridLogger(strLog);
}
- cfg.setDeploymentMode(depMode);
-
if (cacheEnabled) {
CacheConfiguration cacheCfg = defaultCacheConfiguration();
@@ -185,7 +177,6 @@ public void testNullCacheMode() throws Exception {
cacheEnabled = true;
cacheName = "myCache";
cacheMode = null;
- depMode = SHARED;
assert startGrid(1).cache("myCache").getConfiguration(CacheConfiguration.class).getCacheMode() == DFLT_CACHE_MODE;
}
@@ -197,7 +188,6 @@ public void testNullCacheMode() throws Exception {
public void testWithCacheAndWithoutCache() throws Exception {
// 1st grid without cache.
cacheEnabled = false;
- depMode = SHARED;
startGrid(2);
@@ -205,7 +195,6 @@ public void testWithCacheAndWithoutCache() throws Exception {
cacheEnabled = true;
cacheName = "myCache";
cacheMode = REPLICATED;
- depMode = SHARED;
startGrid(1);
}
@@ -219,7 +208,6 @@ public void testSameCacheDifferentModes() throws Exception {
cacheEnabled = true;
cacheName = "myCache";
cacheMode = REPLICATED;
- depMode = SHARED;
startGrid(1);
@@ -227,7 +215,6 @@ public void testSameCacheDifferentModes() throws Exception {
cacheEnabled = true;
cacheName = "myCache";
cacheMode = PARTITIONED;
- depMode = SHARED;
try {
startGrid(2);
@@ -248,7 +235,6 @@ public void testDifferentCacheDifferentModes() throws Exception {
cacheEnabled = true;
cacheName = "replicated";
cacheMode = REPLICATED;
- depMode = SHARED;
startGrid(2);
@@ -256,7 +242,6 @@ public void testDifferentCacheDifferentModes() throws Exception {
cacheEnabled = true;
cacheName = "partitioned";
cacheMode = PARTITIONED;
- depMode = SHARED;
startGrid(3);
@@ -264,37 +249,10 @@ public void testDifferentCacheDifferentModes() throws Exception {
cacheEnabled = true;
cacheName = "partitioned";
cacheMode = null;
- depMode = SHARED;
startGrid(4);
}
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testDifferentDeploymentModes() throws Exception {
- // 1st grid with SHARED mode.
- cacheEnabled = true;
- cacheName = "partitioned";
- cacheMode = PARTITIONED;
- depMode = SHARED;
-
- startGrid(1);
-
- // 2nd grid with CONTINUOUS mode.
- cacheEnabled = true;
- cacheName = "partitioned";
- cacheMode = PARTITIONED;
- depMode = CONTINUOUS;
-
- GridTestUtils.assertThrows(log, new Callable
-
- ${project.groupId}
- ignite-urideploy
- test
-
-
${project.groupId}ignite-log4j2
diff --git a/modules/spring/src/test/java/org/apache/ignite/p2p/GridP2PUserVersionChangeSelfTest.java b/modules/spring/src/test/java/org/apache/ignite/p2p/GridP2PUserVersionChangeSelfTest.java
deleted file mode 100644
index 2b09ee17e4288..0000000000000
--- a/modules/spring/src/test/java/org/apache/ignite/p2p/GridP2PUserVersionChangeSelfTest.java
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.p2p;
-
-import java.net.URL;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.concurrent.CountDownLatch;
-import javax.cache.Cache;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.cache.CacheMode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.DeploymentMode;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.events.DeploymentEvent;
-import org.apache.ignite.events.Event;
-import org.apache.ignite.events.EventType;
-import org.apache.ignite.internal.util.typedef.PAX;
-import org.apache.ignite.lang.IgnitePredicate;
-import org.apache.ignite.testframework.GridTestExternalClassLoader;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.config.GridTestProperties;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
-import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
-import static org.apache.ignite.events.EventType.EVT_TASK_UNDEPLOYED;
-
-/**
- * The test does the following:
- *
- * 1. The test should execute a task in SHARED_DEPLOY mode, restart a node with new version and make sure that a
- * new class loader is created on remote node.
- * 2. The test should execute a task in SHARED_DEPLOY mode, restart a node with same version and make sure
- * that the same class loader is created on remote node.
- * 3. The test should execute a task in SHARED_UNDEPLOY mode, restart a node with same version and
- * make sure that a new class loader is created on remote node.
- */
-@SuppressWarnings({"ProhibitedExceptionDeclared", "unchecked"})
-public class GridP2PUserVersionChangeSelfTest extends GridCommonAbstractTest {
- /** Current deployment mode. */
- private DeploymentMode depMode;
-
- /** Test task class name. */
- private static final String TEST_TASK_NAME = "org.apache.ignite.tests.p2p.P2PTestTaskExternalPath1";
-
- /** Test resource class name. */
- private static final String TEST_RCRS_NAME = "org.apache.ignite.tests.p2p.TestUserResource";
-
- /** */
- public GridP2PUserVersionChangeSelfTest() {
- super(/*start grid*/false);
- }
-
- /** {@inheritDoc} */
- @Override protected long getTestTimeout() {
- return 30 * 1000;
- }
-
- /**
- * @return Timeout for condition waits.
- */
- private long getConditionTimeout() {
- return getTestTimeout() > 10000 ? getTestTimeout() - 10000 : getTestTimeout();
- }
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
-
- cfg.setDeploymentMode(depMode);
- cfg.setNetworkTimeout(10000);
-
- if (igniteInstanceName.contains("testCacheRedeployVersionChangeContinuousMode")) {
- CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
-
- cacheCfg.setCacheMode(CacheMode.REPLICATED);
-
- cfg.setCacheConfiguration(cacheCfg);
- }
- else
- cfg.setCacheConfiguration();
-
- cfg.setIncludeEventTypes(EventType.EVTS_ALL);
-
- return cfg;
- }
-
- /**
- * @throws Exception If test failed.
- */
- @Test
- public void testRedeployVersionChangeContinuousMode() throws Exception {
- depMode = DeploymentMode.CONTINUOUS;
-
- checkRedeployVersionChange();
- }
-
- /**
- * @throws Exception If test failed.
- */
- @Test
- public void testRedeployVersionChangeSharedMode() throws Exception {
- depMode = DeploymentMode.SHARED;
-
- checkRedeployVersionChange();
- }
-
- /**
- * @throws Exception If failed.
- */
- private void checkRedeployVersionChange() throws Exception {
- try {
- Ignite ignite1 = startGrid(1);
- Ignite ignite2 = startGrid(2);
-
- GridTestExternalClassLoader ldr = new GridTestExternalClassLoader(
- new URL[] { new URL(GridTestProperties.getProperty("p2p.uri.cls")) },
- Collections.singletonMap("META-INF/ignite.xml", makeUserVersion("1").getBytes()));
-
- Class task1 = ldr.loadClass(TEST_TASK_NAME);
-
- final CountDownLatch undeployed = new CountDownLatch(1);
-
- ignite2.events().localListen(new IgnitePredicate() {
- @Override public boolean apply(Event evt) {
- if (evt.type() == EVT_TASK_UNDEPLOYED &&
- ((DeploymentEvent)evt).alias().equals(TEST_TASK_NAME))
- undeployed.countDown();
-
- return true;
- }
- }, EVT_TASK_UNDEPLOYED);
-
- Integer res1 = (Integer)ignite1.compute().execute(task1, ignite2.cluster().localNode().id());
-
- stopGrid(1);
-
- ldr.setResourceMap(Collections.singletonMap("META-INF/ignite.xml", makeUserVersion("2").getBytes()));
-
- ignite1 = startGrid(1);
-
- Integer res2 = (Integer)ignite1.compute().execute(task1, ignite2.cluster().localNode().id());
-
- assert !res1.equals(res2);
-
- // Allow P2P timeout to expire.
- assert undeployed.await(30000, MILLISECONDS);
- }
- finally {
- stopGrid(1);
- stopGrid(2);
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testRedeployOnNodeRestartContinuousMode() throws Exception {
- depMode = DeploymentMode.CONTINUOUS;
-
- try {
- Ignite ignite1 = startGrid(1);
- Ignite ignite2 = startGrid(2);
-
- GridTestExternalClassLoader ldr = new GridTestExternalClassLoader(
- new URL[] { new URL(GridTestProperties.getProperty("p2p.uri.cls")) });
-
- Class task1 = ldr.loadClass(TEST_TASK_NAME);
-
- final CountDownLatch undeployed = new CountDownLatch(1);
-
- ignite2.events().localListen(new IgnitePredicate() {
- @Override public boolean apply(Event evt) {
- if (evt.type() == EVT_TASK_UNDEPLOYED &&
- ((DeploymentEvent)evt).alias().equals(TEST_TASK_NAME))
- undeployed.countDown();
-
- return true;
- }
- }, EVT_TASK_UNDEPLOYED);
-
- Integer res1 = (Integer)ignite1.compute().execute(task1, ignite2.cluster().localNode().id());
-
- stopGrid(1);
-
- ignite1 = startGrid(1);
-
- Integer res2 = (Integer)ignite1.compute().execute(task1, ignite2.cluster().localNode().id());
-
- assert !undeployed.await(3000, MILLISECONDS);
-
- assert res1.equals(res2);
- }
- finally {
- stopGrid(1);
- stopGrid(2);
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- @Test
- public void testRedeployOnNodeRestartSharedMode() throws Exception {
- depMode = DeploymentMode.SHARED;
-
- try {
- Ignite ignite1 = startGrid(1);
- Ignite ignite2 = startGrid(2);
-
- GridTestExternalClassLoader ldr = new GridTestExternalClassLoader(
- new URL[] { new URL(GridTestProperties.getProperty("p2p.uri.cls")) });
-
- Class task1 = ldr.loadClass(TEST_TASK_NAME);
-
- final CountDownLatch undeployed = new CountDownLatch(1);
-
- ignite2.events().localListen(new IgnitePredicate() {
- @Override public boolean apply(Event evt) {
- if (evt.type() == EVT_TASK_UNDEPLOYED &&
- ((DeploymentEvent)evt).alias().equals(TEST_TASK_NAME))
- undeployed.countDown();
-
- return true;
- }
- }, EVT_TASK_UNDEPLOYED);
-
- final CountDownLatch discoLatch = new CountDownLatch(1);
-
- ignite2.events().localListen(new IgnitePredicate() {
- @Override public boolean apply(Event evt) {
- if (evt.type() == EVT_NODE_LEFT || evt.type() == EVT_NODE_FAILED)
- discoLatch.countDown();
-
- return true;
- }
- }, EVT_NODE_LEFT, EVT_NODE_FAILED);
-
- Integer res1 = (Integer)ignite1.compute().execute(task1, ignite2.cluster().localNode().id());
-
- stopGrid(1);
-
- assert discoLatch.await(1000, MILLISECONDS);
-
- assert undeployed.await(1000, MILLISECONDS);
-
- ignite1 = startGrid(1);
-
- Integer res2 = (Integer)ignite1.compute().execute(task1, ignite2.cluster().localNode().id());
-
- assert !res1.equals(res2);
- }
- finally {
- stopGrid(1);
- stopGrid(2);
- }
- }
-
- /**
- * @throws Exception If failed.
- */
- @Ignore("https://issues.apache.org/jira/browse/IGNITE-604")
- @Test
- public void testCacheRedeployVersionChangeContinuousMode() throws Exception {
- depMode = DeploymentMode.CONTINUOUS;
-
- try {
- Ignite ignite1 = startGrid("testCacheRedeployVersionChangeContinuousMode1");
- Ignite ignite2 = startGrid("testCacheRedeployVersionChangeContinuousMode2");
-
- GridTestExternalClassLoader ldr = new GridTestExternalClassLoader(
- new URL[] { new URL(GridTestProperties.getProperty("p2p.uri.cls")) },
- Collections.singletonMap("META-INF/ignite.xml", makeUserVersion("1").getBytes()));
-
- Class rcrsCls = ldr.loadClass(TEST_RCRS_NAME);
-
- IgniteCache cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
-
- assertNotNull(cache1);
-
- cache1.put(1L, rcrsCls.newInstance());
-
- final IgniteCache cache2 = ignite2.cache(DEFAULT_CACHE_NAME);
-
- assertNotNull(cache2);
-
- // The entry should propagate to grid2, because the
- // cache is REPLICATED. This happens asynchronously, we
- // need to use condition wait.
- assert GridTestUtils.waitForCondition(new PAX() {
- @Override public boolean applyx() {
- return cache2.get(1L) != null;
- }
- }, getConditionTimeout());
-
- stopGrid("testCacheRedeployVersionChangeContinuousMode1");
-
- // Increase the user version of the test class.
- ldr.setResourceMap(Collections.singletonMap("META-INF/ignite.xml", makeUserVersion("2").getBytes()));
-
- ignite1 = startGrid("testCacheRedeployVersionChangeContinuousMode1");
-
- cache1 = ignite1.cache(DEFAULT_CACHE_NAME);
-
- assertNotNull(cache1);
-
- // Put an entry with a new user version.
- cache1.put(2L, rcrsCls.newInstance());
-
- // At this point, old version of test resource should be undeployed
- // and removed from cache asynchronously.
- assert GridTestUtils.waitForCondition(new PAX() {
- @Override public boolean applyx() {
- return cache2.get(1L) == null;
- }
- }, getConditionTimeout()) : "2nd condition failed [entries1=" + toSet(cache1.iterator()) +
- ", entries2=" + toSet(cache2.iterator()) + ']';
- }
- finally {
- stopAllGrids();
- }
- }
-
- /**
- *
- */
- private Set> toSet(Iterator> iter) {
- Set> set = new HashSet<>();
-
- while (iter.hasNext())
- set.add(iter.next());
-
- return set;
- }
-
- /**
- * Creates content of META-INF/ignite.xml for specified user version.
- *
- * @param userVer Version to create.
- * @return content of META-INF/ignite.xml.
- */
- private String makeUserVersion(String userVer) {
- return " " +
- " " +
- " " +
- "";
- }
-}
diff --git a/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java b/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
index c012cc43542ea..050cdde2d5bc9 100644
--- a/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
+++ b/modules/spring/src/test/java/org/apache/ignite/testsuites/IgniteSpringTestSuite.java
@@ -35,7 +35,6 @@
import org.apache.ignite.internal.metric.RegexpMetricFilterTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheDhtMultiBackupTest;
import org.apache.ignite.internal.processors.resource.GridTransformSpringInjectionSelfTest;
-import org.apache.ignite.p2p.GridP2PUserVersionChangeSelfTest;
import org.apache.ignite.spring.IgniteExcludeInConfigurationTest;
import org.apache.ignite.spring.IgniteStartFromStreamConfigurationTest;
import org.apache.ignite.spring.injection.GridServiceInjectionSpringResourceTest;
@@ -59,7 +58,6 @@
IgniteExcludeInConfigurationTest.class,
// Tests moved to this suite since they require Spring functionality.
- GridP2PUserVersionChangeSelfTest.class,
IgniteDynamicCacheConfigTest.class,
diff --git a/modules/urideploy/README.txt b/modules/urideploy/README.txt
deleted file mode 100644
index dc3defdf7fbdc..0000000000000
--- a/modules/urideploy/README.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-Apache Ignite URI Deploy Module
--------------------------------
-
-Apache Ignite URI Deploy module provides capabilities to deploy tasks from different sources like
-File System, HTTP, or even Email.
-
-To enable URI Deploy module when starting a standalone node, move 'optional/ignite-urideploy' folder to
-'libs' folder before running 'ignite.{sh|bat}' script. The content of the module folder will
-be added to classpath in this case.
-
-Importing URI Deploy Module In Maven Project
---------------------------------------------
-
-If you are using Maven to manage dependencies of your project, you can add URI Deploy module
-dependency like this (replace '${ignite.version}' with actual Ignite version you are
-interested in):
-
-
- ...
-
- ...
-
- org.apache.ignite
- ignite-urideploy
- ${ignite.version}
-
- ...
-
- ...
-
diff --git a/modules/urideploy/licenses/apache-2.0.txt b/modules/urideploy/licenses/apache-2.0.txt
deleted file mode 100644
index d645695673349..0000000000000
--- a/modules/urideploy/licenses/apache-2.0.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/modules/urideploy/pom.xml b/modules/urideploy/pom.xml
deleted file mode 100644
index 8927c9d5b4b1a..0000000000000
--- a/modules/urideploy/pom.xml
+++ /dev/null
@@ -1,164 +0,0 @@
-
-
-
-
-
-
- 4.0.0
-
-
- org.apache.ignite
- ignite-parent-internal
- ${revision}
- ../../parent-internal/pom.xml
-
-
- ignite-urideploy
-
- http://ignite.apache.org
-
-
-
- ${project.groupId}
- ignite-core
-
-
-
- org.springframework
- spring-aop
- ${spring.version}
-
-
-
- org.springframework
- spring-beans
- ${spring.version}
-
-
-
- org.springframework
- spring-context
- ${spring.version}
-
-
-
- org.springframework
- spring-core
- ${spring.version}
-
-
-
- org.springframework
- spring-expression
- ${spring.version}
-
-
-
- org.springframework
- spring-tx
- ${spring.version}
-
-
-
- com.github.jtidy
- jtidy
- ${jtidy.version}
-
-
-
- commons-codec
- commons-codec
- ${commons.codec.version}
-
-
-
- org.apache.tomcat
- tomcat-servlet-api
- ${tomcat.version}
- test
-
-
-
- ${project.groupId}
- ignite-core
- test-jar
- test
-
-
-
- ${project.groupId}
- ignite-tools
- test
-
-
-
- org.eclipse.jetty
- jetty-io
- ${jetty.version}
- test
-
-
-
- org.eclipse.jetty
- jetty-http
- ${jetty.version}
- test
-
-
-
- org.eclipse.jetty
- jetty-server
- ${jetty.version}
- test
-
-
-
- org.eclipse.jetty
- jetty-util
- ${jetty.version}
- test
-
-
-
- com.google.guava
- guava
- test
-
-
-
- org.apache.logging.log4j
- log4j-core
- test
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-deploy-plugin
- 2.8.2
-
- false
-
-
-
-
-
diff --git a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoader.java b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoader.java
deleted file mode 100644
index 075f1d64dec10..0000000000000
--- a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoader.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spi.deployment.uri;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Arrays;
-import org.apache.ignite.internal.util.typedef.internal.S;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Loads classes and resources from "unpacked" deployment archives.
- *
- * Class loader scans package directory first and then if
- * class/resource was not found scans all JAR files.
- */
-class GridUriDeploymentClassLoader extends URLClassLoader {
- /**
- * Creates new instance of class loader.
- *
- * @param urls The URLs from which to load classes and resources.
- * @param parent The parent class loader for delegation.
- */
- GridUriDeploymentClassLoader(URL[] urls, ClassLoader parent) {
- super(urls, parent);
- }
-
- /** {@inheritDoc} */
- @Override protected synchronized Class> loadClass(String name, boolean resolve) throws ClassNotFoundException {
- // First, check if the class has already been loaded.
- Class cls = findLoadedClass(name);
-
- if (cls == null) {
- try {
- try {
- // Search classes in a deployment unit.
- // NOTE: findClass(String) is not overridden since it is always called after
- // findLoadedClass(String) in exclusive synchronization block.
- cls = findClass(name);
- }
- catch (ClassNotFoundException ignored) {
- // If still not found, then invoke parent class loader in order
- // to find the class.
- cls = super.loadClass(name, resolve);
- }
- }
- catch (ClassNotFoundException e) {
- throw e;
- }
- // Catch Throwable to secure against any errors resulted from
- // corrupted class definitions or other user errors.
- catch (Exception e) {
- throw new ClassNotFoundException("Failed to load class due to unexpected error: " + name, e);
- }
- }
-
- return cls;
- }
-
- /**
- * Load class from a deployment unit.
- *
- * @param name Class name.
- * @return Loaded class.
- * @throws ClassNotFoundException If no class found.
- */
- public synchronized Class> loadClassIsolated(String name) throws ClassNotFoundException {
- // First, check if the class has already been loaded.
- Class> cls = findLoadedClass(name);
-
- if (cls == null) {
- try {
- // Search classes in deployment unit.
- // NOTE: findClass(String) is not overridden since it is always called after
- // findLoadedClass(String) in exclusive synchronization block.
- cls = findClass(name);
- }
- catch (ClassNotFoundException e) {
- throw e;
- }
- // Catch Throwable to secure against any errors resulted from
- // corrupted class definitions or other user errors.
- catch (Exception e) {
- throw new ClassNotFoundException("Failed to load class due to unexpected error: " + name, e);
- }
- }
-
- return cls;
- }
-
- /**
- * Load class from GAR file.
- *
- * @param name Class name.
- * @return Loaded class.
- * @throws ClassNotFoundException If no class found.
- * @deprecated Use {@link GridUriDeploymentClassLoader#loadClassIsolated(String)} instead.
- */
- @Deprecated
- public synchronized Class> loadClassGarOnly(String name) throws ClassNotFoundException {
- return loadClassIsolated(name);
- }
-
- /** {@inheritDoc} */
- @Override public URL getResource(String name) {
- URL url = findResource(name);
-
- if (url == null)
- url = ClassLoader.getSystemResource(name);
-
- if (url == null)
- url = super.getResource(name);
-
- return url;
- }
-
- /** {@inheritDoc} */
- @Override public InputStream getResourceAsStream(String name) {
- // Find resource in a deployment unit first.
- InputStream in = getResourceAsStreamIsolated(name);
-
- // Find resource in parent class loader.
- if (in == null)
- in = ClassLoader.getSystemResourceAsStream(name);
-
- if (in == null)
- in = super.getResourceAsStream(name);
-
- return in;
- }
-
- /**
- * Returns an input stream for reading the specified resource from a deployment unit only.
- *
- * @param name Resource name.
- * @return An input stream for reading the resource, or {@code null}
- * if the resource could not be found.
- */
- @Nullable public InputStream getResourceAsStreamIsolated(String name) {
- URL url = findResource(name);
-
- try {
- return url != null ? url.openStream() : null;
- }
- catch (IOException ignored) {
- return null;
- }
- }
-
- /**
- * Returns an input stream for reading the specified resource from GAR file only.
- *
- * @param name Resource name.
- * @return An input stream for reading the resource, or {@code null}
- * if the resource could not be found.
- *
- * @deprecated Use {@link GridUriDeploymentClassLoader#getResourceAsStreamIsolated(String)} instead.
- */
- @Deprecated
- @Nullable public InputStream getResourceAsStreamGarOnly(String name) {
- return getResourceAsStreamIsolated(name);
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(GridUriDeploymentClassLoader.class, this, "urls", Arrays.toString(getURLs()));
- }
-}
diff --git a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoaderFactory.java b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoaderFactory.java
deleted file mode 100644
index 2cb21441c1ce2..0000000000000
--- a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoaderFactory.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spi.deployment.uri;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.spi.IgniteSpiException;
-
-/**
- * Factory class to create class loader that loads classes and resources from
- * the deployment archive or "unpacked" deployment archive (package directory).
- *
- * Class loader scans deployment archive or directory first and than if
- * class/resource was not found scans all JAR files.
- * It is assumed that all libraries are in the {@link #DFLT_LIBS_DIR_PATH}
- * directory.
- */
-class GridUriDeploymentClassLoaderFactory {
- /** Libraries directory default value (value is {@code lib}). */
- public static final String DFLT_LIBS_DIR_PATH = "lib";
-
- /**
- * @param parent Parent class loader.
- * @param file Deployment archive or directory with an unpacked deployment archive.
- * @param log Logger.
- * @return Class Loader.
- * @throws org.apache.ignite.spi.IgniteSpiException In case of any error.
- */
- public static ClassLoader create(ClassLoader parent, File file, IgniteLogger log) throws IgniteSpiException {
- assert parent != null;
- assert file != null;
- assert log != null;
-
- assert file.isDirectory();
-
- List urls = new ArrayList<>();
-
- try {
- String url = file.toURI().toURL().toString();
-
- URL mainUrl = url.length() > 0 && url.charAt(url.length() - 1) == '/' ?
- file.toURI().toURL() : new URL(url + '/');
-
- urls.add(mainUrl);
-
- File libDir = new File(file, DFLT_LIBS_DIR_PATH);
-
- if (libDir.exists()) {
- File[] files = libDir.listFiles(new FilenameFilter() {
- @Override public boolean accept(File dir, String name) {
- return name.endsWith(".jar");
- }
- });
-
- if (files.length > 0) {
- for (File jarFile : files) {
- urls.add(jarFile.toURI().toURL());
- }
- }
- }
-
- return new GridUriDeploymentClassLoader(urls.toArray(new URL[urls.size()]), parent);
- }
- catch (MalformedURLException e) {
- throw new IgniteSpiException("Failed to create class loader for a package: " + file, e);
- }
- }
-
- /**
- * Ensure singleton.
- */
- private GridUriDeploymentClassLoaderFactory() {
- // No-op.
- }
-}
diff --git a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentDiscovery.java b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentDiscovery.java
deleted file mode 100644
index d47ec68563883..0000000000000
--- a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentDiscovery.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spi.deployment.uri;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import org.apache.ignite.compute.ComputeTask;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.spi.IgniteSpiException;
-
-/**
- * Helper that loads classes either from directory or from JAR file.
- *
- * If loading from directory is used, helper scans given directory
- * and all subdirectories recursively and loads all files
- * with ".class" extension by given class loader. If class could not
- * be loaded it will be ignored.
- *
- * If JAR file loading is used helper scans JAR file and tries to
- * load all {@link JarEntry} assuming it's a file name.
- * If at least one of them could not be loaded helper fails.
- */
-final class GridUriDeploymentDiscovery {
- /**
- * Enforces singleton.
- */
- private GridUriDeploymentDiscovery() {
- // No-op.
- }
-
- /**
- * Load classes from given file. File could be either directory or JAR file.
- *
- * @param clsLdr Class loader to load files.
- * @param file Either directory or JAR file which contains classes or
- * references to them.
- * @return Set of found and loaded classes or empty set if file does not
- * exist.
- * @throws org.apache.ignite.spi.IgniteSpiException Thrown if given JAR file references to none
- * existed class or IOException occurred during processing.
- */
- static Set>> getClasses(ClassLoader clsLdr, File file)
- throws IgniteSpiException {
- Set>> rsrcs = new HashSet<>();
-
- if (!file.exists())
- return rsrcs;
-
- GridUriDeploymentFileResourceLoader fileRsrcLdr = new GridUriDeploymentFileResourceLoader(clsLdr, file);
-
- if (file.isDirectory())
- findResourcesInDirectory(fileRsrcLdr, file, rsrcs);
- else {
- try {
- for (JarEntry entry : U.asIterable(new JarFile(file.getAbsolutePath()).entries())) {
- Class extends ComputeTask, ?>> rsrc = fileRsrcLdr.createResource(entry.getName(), false);
-
- if (rsrc != null)
- rsrcs.add(rsrc);
- }
- }
- catch (IOException e) {
- throw new IgniteSpiException("Failed to discover classes in file: " + file.getAbsolutePath(), e);
- }
- }
-
- return rsrcs;
- }
-
- /**
- * Recursively scans given directory and load all found files by loader.
- *
- * @param clsLdr Loader that could load class from given file.
- * @param dir Directory which should be scanned.
- * @param rsrcs Set which will be filled in.
- */
- private static void findResourcesInDirectory(GridUriDeploymentFileResourceLoader clsLdr, File dir,
- Set>> rsrcs) {
- assert dir.isDirectory();
-
- for (File file : dir.listFiles()) {
- if (file.isDirectory()) {
- // Recurse down into directories.
- findResourcesInDirectory(clsLdr, file, rsrcs);
- }
- else {
- Class extends ComputeTask, ?>> rsrc = null;
-
- try {
- rsrc = clsLdr.createResource(file.getAbsolutePath(), true);
- }
- catch (IgniteSpiException e) {
- // Must never happen because we use 'ignoreUnknownRsrc=true'.
- assert false;
- }
-
- if (rsrc != null)
- rsrcs.add(rsrc);
- }
- }
- }
-}
diff --git a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessor.java b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessor.java
deleted file mode 100644
index a564503e62309..0000000000000
--- a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessor.java
+++ /dev/null
@@ -1,458 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spi.deployment.uri;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Modifier;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.apache.commons.codec.binary.Hex;
-import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.ignite.IgniteException;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.compute.ComputeTask;
-import org.apache.ignite.internal.util.IgniteUtils;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.spi.IgniteSpiException;
-import org.jetbrains.annotations.Nullable;
-
-import static org.apache.ignite.spi.deployment.uri.UriDeploymentSpi.XML_DESCRIPTOR_PATH;
-
-/**
- * Utility class.
- *
- * Provides useful and common functions for URI deployment.
- */
-final class GridUriDeploymentFileProcessor {
- /**
- * Enforces singleton.
- */
- private GridUriDeploymentFileProcessor() {
- // No-op.
- }
-
- /**
- * Method processes given package and extracts all tasks from it which are
- * either mentioned in a task descriptor or implement interface {@link org.apache.ignite.compute.ComputeTask}
- * if there is no descriptor in file.
- *
- * @param file Package file with tasks.
- * @param uri URI of the package.
- * @param deployDir deployment directory with downloaded files.
- * @param log Logger.
- * @throws org.apache.ignite.spi.IgniteSpiException Thrown if file could not be read.
- * @return List of tasks from given file.
- */
- @Nullable static GridUriDeploymentFileProcessorResult processFile(File file, String uri, File deployDir,
- IgniteLogger log) throws IgniteSpiException {
- File pkg = file;
-
- if (!checkIntegrity(file, log)) {
- U.error(log, "Failed to load tasks from a package (invalid file signature) [uri=" +
- U.hidePassword(uri) + ']');
-
- return null;
- }
-
- if (!file.isDirectory()) {
- pkg = new File(deployDir, "dirzip_" + file.getName());
-
- pkg.mkdirs();
-
- try {
- U.unzip(file, pkg, log);
- }
- catch (IOException e) {
- throw new IgniteSpiException("IO error when unzipping a package: "
- + file.getAbsolutePath(), e);
- }
- }
-
- GridUriDeploymentFileProcessorResult res = null;
-
- if (pkg.isDirectory()) {
- try {
- File xml = new File(pkg, XML_DESCRIPTOR_PATH);
-
- if (!xml.exists() || xml.isDirectory()) {
- U.warn(log,
- "Processing deployment without descriptor file (it will cause full classpath scan) [path="
- + XML_DESCRIPTOR_PATH + ", package=" + pkg.getAbsolutePath() + ']');
-
- res = processNoDescriptorFile(pkg, uri, log);
- }
- else {
- InputStream in = null;
-
- try {
- in = new BufferedInputStream(new FileInputStream(xml));
-
- // Parse XML task definitions and add them to cache.
- GridUriDeploymentSpringDocument doc = GridUriDeploymentSpringParser.parseTasksDocument(in, log);
-
- assert doc != null;
-
- res = processWithDescriptorFile(doc, pkg, uri, log);
- }
- finally {
- U.close(in, log);
- }
- }
- }
- catch (IOException e) {
- throw new IgniteSpiException("IO error when parsing a package: "
- + pkg.getAbsolutePath(), e);
- }
- }
-
- if (res != null)
- res.setMd5(md5(pkg, log));
-
- return res;
- }
-
- /**
- * Calculates md5 checksum for the given file o directory.
- * For directories tries to walk all nested files accumulating the result.
- *
- * @param file file to calculate sum or root directory for accumulating calculation.
- * @param log logger to log all failures.
- * @return string representation of the calculated checksum or {@code null} if calculation failed.
- */
- @Nullable public static String md5(@Nullable File file, @Nullable IgniteLogger log) {
- if (file != null)
- return file.isFile() ? fileMd5(file, log) : directoryMd5(file, log);
-
- return null;
- }
-
- /**
- * Calculates md5 checksum for the given file
- *
- * @param file file to calculate md5.
- * @param log logger to log all failures.
- * @return string representation of the calculated checksum or {@code null} if calculation failed.
- */
- @Nullable public static String fileMd5(@Nullable File file, @Nullable IgniteLogger log) {
- String md5 = null;
-
- if (file != null) {
- if (!file.isFile()) {
- U.warn(log, "Failed to find file for md5 calculation: " + file);
-
- return null;
- }
-
- InputStream in = null;
-
- try {
- in = new BufferedInputStream(new FileInputStream(file));
-
- md5 = DigestUtils.md5Hex(in);
- }
- catch (IOException e) {
- U.warn(log, "Failed to open input stream for md5 calculation: " + e.getMessage());
- }
- finally {
- U.closeQuiet(in);
- }
- }
-
- return md5;
- }
-
- /**
- * For directories tries to walk all nested files accumulating them into single md5 checksum.
- *
- * @param dir directory to calculate md5.
- * @param log logger to log all failures.
- * @return string representation of the calculated checksum or {@code null} if calculation failed.
- */
- @Nullable public static String directoryMd5(@Nullable File dir, @Nullable IgniteLogger log) {
- if (dir != null) {
- if (!dir.isDirectory()) {
- U.warn(log, "Failed to find directory for md5 calculation: " + dir);
-
- return null;
- }
-
- try {
- MessageDigest digest = MessageDigest.getInstance("MD5");
-
- return addDirectoryDigest(dir, digest, log) ? Hex.encodeHexString(digest.digest()) : null;
- }
- catch (NoSuchAlgorithmException e) {
- throw new IgniteException("MD5 digest algorithm not found.", e);
- }
- }
-
- return null;
- }
-
- /**
- * Repulsively adds all files in the given directory to the given Digest object.
- *
- * @param file directory to start calculation from.
- * @param digest digest object where all available files should be applied.
- * @param log logger to report errors.
- * @return {@code true} if digest was added successfully, {@code false} otherwise.
- */
- private static boolean addDirectoryDigest(File file, MessageDigest digest, @Nullable IgniteLogger log) {
- assert file.isDirectory();
-
- File[] files = file.listFiles();
-
- if (files == null)
- return true;
-
- Arrays.sort(files);
-
- for (File visited : files) {
- if (visited.isFile()) {
- if (!addFileDigest(visited, digest, log))
- return false;
- }
- else if (visited.isDirectory()) {
- if (!addDirectoryDigest(visited, digest, log))
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * Adds given file to the given Digest object.
- *
- * @param file file for digest calculations.
- * @param digest digest object to add file.
- * @param log logger to report errors.
- * @return {@code true} if digest was added successfully, {@code false} otherwise.
- */
- private static boolean addFileDigest(File file, MessageDigest digest, @Nullable IgniteLogger log) {
- if (!file.isFile()) {
- U.error(log, "Failed to add file to directory digest (will not check MD5 hash): " + file);
-
- return false;
- }
-
- InputStream in = null;
-
- try {
- in = new BufferedInputStream(new FileInputStream(file));
-
- byte[] buf = new byte[1024];
-
- int read = in.read(buf, 0, 1024);
-
- while (read > -1) {
- digest.update(buf, 0, read);
-
- read = in.read(buf, 0, 1024);
- }
- }
- catch (IOException e) {
- U.error(log, "Failed to add file to directory digest (will not check MD5 hash): " + file, e);
-
- return false;
- }
- finally {
- U.closeQuiet(in);
- }
-
- return true;
- }
-
- /**
- * Cleanup class loaders resource.
- *
- * @param clsLdr Released class loader.
- * @param log Logger.
- */
- static void cleanupUnit(ClassLoader clsLdr, IgniteLogger log) {
- assert clsLdr != null;
- assert log != null;
- assert clsLdr instanceof URLClassLoader;
-
- URLClassLoader clsLdr0 = (URLClassLoader)clsLdr;
-
- U.close(clsLdr0, log);
-
- try {
- URL url = IgniteUtils.classLoaderUrls(clsLdr)[0];
-
- File dir = new File(url.toURI());
-
- U.delete(dir);
-
- if (dir.getName().startsWith("dirzip_")) {
- File jarFile = new File(dir.getParentFile(), dir.getName().substring(7));
-
- U.delete(jarFile);
- }
- }
- catch (Exception e) {
- U.error(log, "Failed to cleanup unit [clsLdr=" + clsLdr + ']', e);
- }
- }
-
- /**
- * Processes given package and returns back all tasks which are in its descriptor.
- *
- * @param doc Package descriptor.
- * @param file Package file.
- * @param uri URI of the package file.
- * @param log Logger.
- * @throws org.apache.ignite.spi.IgniteSpiException Thrown if it's impossible to open file.
- * @return List of tasks from descriptor.
- */
- private static GridUriDeploymentFileProcessorResult processWithDescriptorFile(GridUriDeploymentSpringDocument doc,
- File file, String uri, IgniteLogger log) throws IgniteSpiException {
- ClassLoader clsLdr = GridUriDeploymentClassLoaderFactory.create(U.gridClassLoader(), file, log);
-
- List>> tasks = doc.getTasks(clsLdr);
-
- List>> validTasks = null;
-
- if (!F.isEmpty(tasks)) {
- validTasks = new ArrayList<>();
-
- for (Class extends ComputeTask, ?>> task : tasks) {
- if (!isAllowedTaskClass(task)) {
- U.warn(log, "Failed to load task. Task should be public none-abstract class " +
- "(might be inner static one) that implements ComputeTask interface [taskCls=" + task + ']');
- }
- else {
- if (log.isDebugEnabled())
- log.debug("Found grid deployment task: " + task.getName());
-
- validTasks.add(task);
- }
- }
- }
-
- GridUriDeploymentFileProcessorResult res = new GridUriDeploymentFileProcessorResult();
-
- res.setFile(file);
- res.setClassLoader(clsLdr);
-
- if (!F.isEmpty(validTasks))
- res.setTaskClasses(validTasks);
- else if (log.isDebugEnabled())
- log.debug("No tasks loaded from file [file=" + file.getAbsolutePath() +
- ", uri=" + U.hidePassword(uri) + ']');
-
- return res;
- }
-
- /**
- * Processes packages which have no descriptor. It scans every class and
- * checks if it is a valid task or not. All valid tasks are returned back.
- *
- * @param file Package file or directory.
- * @param uri URI of the package file.
- * @param log Logger.
- * @throws org.apache.ignite.spi.IgniteSpiException Thrown if file reading error happened.
- * @return List of tasks from given file.
- */
- private static GridUriDeploymentFileProcessorResult processNoDescriptorFile(File file, String uri, IgniteLogger log)
- throws IgniteSpiException {
- ClassLoader clsLdr = GridUriDeploymentClassLoaderFactory.create(U.gridClassLoader(), file, log);
-
- Set>> clss = GridUriDeploymentDiscovery.getClasses(clsLdr, file);
-
- GridUriDeploymentFileProcessorResult res = new GridUriDeploymentFileProcessorResult();
-
- res.setFile(file);
- res.setClassLoader(clsLdr);
-
- if (clss != null) {
- List>> validTasks =
- new ArrayList<>(clss.size());
-
- for (Class extends ComputeTask, ?>> cls : clss) {
- if (isAllowedTaskClass(cls)) {
- if (log.isDebugEnabled())
- log.debug("Found grid deployment task: " + cls.getName());
-
- validTasks.add(cls);
- }
- }
-
- if (!validTasks.isEmpty())
- res.setTaskClasses(validTasks);
- else if (log.isDebugEnabled())
- log.debug("No tasks loaded from file [file=" + file.getAbsolutePath() +
- ", uri=" + U.hidePassword(uri) + ']');
- }
-
- return res;
- }
-
- /**
- * Check that class may be instantiated as {@link org.apache.ignite.compute.ComputeTask} and used
- * in deployment.
- *
- * Loaded task class must implement interface {@link org.apache.ignite.compute.ComputeTask}.
- * Only non-abstract, non-interfaces and public classes allowed.
- * Inner static classes also allowed for loading.
- *
- * @param cls Class to check
- * @return {@code true} if class allowed for deployment.
- */
- private static boolean isAllowedTaskClass(Class> cls) {
- if (!ComputeTask.class.isAssignableFrom(cls))
- return false;
-
- int modifiers = cls.getModifiers();
-
- return !Modifier.isAbstract(modifiers) && !Modifier.isInterface(modifiers) &&
- (!cls.isMemberClass() || Modifier.isStatic(modifiers)) && Modifier.isPublic(modifiers);
- }
-
- /**
- * Make integrity check for a package.
- * Method returns {@code false} if the package has incorrect signature.
- *
- * @param file package which should be verified.
- * @param log Logger.
- * @return {@code true} if given file is a directory of verification
- * completed successfully otherwise returns {@code false}.
- */
- private static boolean checkIntegrity(File file, IgniteLogger log) {
- try {
- return file.isDirectory() || GridUriDeploymentJarVerifier.verify(file.getAbsolutePath(), false, log);
- }
- catch (IOException e) {
- U.error(log, "Error while making integrity file check.", e);
- }
-
- return false;
- }
-}
diff --git a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessorResult.java b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessorResult.java
deleted file mode 100644
index 65ba349802205..0000000000000
--- a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessorResult.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spi.deployment.uri;
-
-import java.io.File;
-import java.util.List;
-import org.apache.ignite.compute.ComputeTask;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- * Deployment file processing result.
- */
-class GridUriDeploymentFileProcessorResult {
- /** Class loader. */
- private ClassLoader clsLdr;
-
- /** Task class. */
- private List>> taskClss;
-
- /** Deploument unit file. */
- private File file;
-
- /** Hash of deployment unit. */
- private String md5;
-
- /**
- * Getter for property 'clsLdr'.
- *
- * @return Value for property 'clsLdr'.
- */
- public ClassLoader getClassLoader() {
- return clsLdr;
- }
-
- /**
- * Setter for property 'clsLdr'.
- *
- * @param clsLdr Value to set for property 'clsLdr'.
- */
- public void setClassLoader(ClassLoader clsLdr) {
- this.clsLdr = clsLdr;
- }
-
- /**
- * Getter for property 'taskClss'.
- *
- * @return Value for property 'taskClss'.
- */
- public List>> getTaskClasses() {
- return taskClss;
- }
-
- /**
- * Setter for property 'taskClss'.
- *
- * @param taskClss Value to set for property 'taskClss'.
- */
- public void setTaskClasses(List>> taskClss) {
- this.taskClss = taskClss;
- }
-
- /**
- * Gets package file.
- *
- * @return Package file.
- */
- public File getFile() {
- return file;
- }
-
- /**
- * Sets package file.
- *
- * @param file Package file.
- */
- public void setFile(File file) {
- this.file = file;
- }
-
- /**
- * @return md5 hash of this deployment result.
- */
- public String getMd5() {
- return md5;
- }
-
- /**
- * @param md5 md5 hash of this deployment result.
- */
- public void setMd5(String md5) {
- this.md5 = md5;
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(GridUriDeploymentFileProcessorResult.class, this);
- }
-}
diff --git a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileResourceLoader.java b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileResourceLoader.java
deleted file mode 100644
index 72ad91f1b757c..0000000000000
--- a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileResourceLoader.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spi.deployment.uri;
-
-import java.io.File;
-import org.apache.ignite.compute.ComputeTask;
-import org.apache.ignite.spi.IgniteSpiException;
-
-/**
- * Class loader helper that could load class from the file using certain
- * class loader.
- */
-class GridUriDeploymentFileResourceLoader {
- /** Class loader class should be loaded by. */
- private final ClassLoader clsLdr;
-
- /** Initial directory. */
- private final File scanPathDir;
-
- /**
- * Creates new instance of loader helper.
- *
- * @param clsLdr Class loader class should be loaded by.
- * @param scanPathDir Initial directory.
- */
- GridUriDeploymentFileResourceLoader(ClassLoader clsLdr, File scanPathDir) {
- this.clsLdr = clsLdr;
- this.scanPathDir = scanPathDir;
- }
-
- /**
- * Creates new class from file with given file name.
- *
- * @param fileName Name of the class to be loaded. It might be either
- * fully-qualified or just a class name.
- * @param ignoreUnknownRsrc Whether unresolved classes should be
- * ignored or not.
- * @return Loaded class.
- * @throws org.apache.ignite.spi.IgniteSpiException If class could not be loaded and
- * {@code ignoreUnknownRsrc} parameter is {@code true}.
- */
- @SuppressWarnings("unchecked")
- Class extends ComputeTask, ?>> createResource(String fileName, boolean ignoreUnknownRsrc) throws IgniteSpiException {
- if (scanPathDir.isDirectory())
- fileName = fileName.substring(scanPathDir.getAbsolutePath().length() + 1);
-
- if (fileName.endsWith(".class")) {
- String str = fileName;
-
- // Replace separators.
- str = str.replaceAll("\\/|\\\\", ".");
-
- // Strip off '.class' extension.
- str = str.substring(0, str.indexOf(".class"));
-
- try {
- return (Class extends ComputeTask, ?>>)clsLdr.loadClass(str);
- }
- catch (ClassNotFoundException e) {
- if (ignoreUnknownRsrc) {
- // No-op.
- }
- else
- throw new IgniteSpiException("Failed to load class: " + str, e);
- }
- }
-
- // Not a class resource.
- return null;
- }
-}
diff --git a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentJarVerifier.java b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentJarVerifier.java
deleted file mode 100644
index 2006f38e2a1ea..0000000000000
--- a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentJarVerifier.java
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.spi.deployment.uri;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.CodeSigner;
-import java.security.PublicKey;
-import java.security.cert.Certificate;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.jar.Attributes;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.JarInputStream;
-import java.util.jar.Manifest;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.internal.util.typedef.internal.U;
-
-/**
- * Helper class that verifies either JAR file or JAR file input stream
- * if it is consistent or not. Consistency means that file was not changed
- * since build and all files mentioned in manifest are signed.
- */
-final class GridUriDeploymentJarVerifier {
- /**
- * Enforces singleton.
- */
- private GridUriDeploymentJarVerifier() {
- // No-op.
- }
-
- /** Default buffer size = 4K. */
- private static final int BUF_SIZE = 4096;
-
- /**
- * Verify JAR-file that it was not changed since creation.
- * If parameter {@code allSigned} equals {@code true} and file is not
- * listed in manifest than method return {@code false}. If file listed
- * in manifest but doesn't exist in JAR-file than method return
- * {@code false}.
- *
- * @param jarName JAR file name.
- * @param allSigned If {@code true} then all files must be signed.
- * @param log Logger.
- * @return {@code true} if JAR file was not changed.
- * @throws IOException Thrown if JAR file or its entries could not be read.
- */
- static boolean verify(String jarName, boolean allSigned, IgniteLogger log) throws IOException {
- assert jarName != null;
-
- return verify0(jarName, null, allSigned, log);
- }
-
- /**
- * Verify JAR-file that all files declared in manifest are signed.
- * If manifest is {@code null} than method returns {@code true} if
- * public key is {@code null}.
- * If parameter {@code allSigned} equals {@code true} and file not
- * listed in manifest than method return {@code false}. If file
- * listed in manifest but doesn't exist in JAR-file than method
- * return {@code false}.
- *
- * @param jarName JAR file name.
- * @param pubKey Public key.
- * @param allSigned If {@code true} then all files must be signed.
- * @param log Logger.
- * @return {@code true} if JAR file is signed with given public key.
- * @throws IOException Thrown if JAR file or its entries could not be read.
- */
- static boolean verify(String jarName, PublicKey pubKey, boolean allSigned, IgniteLogger log)
- throws IOException {
- assert jarName != null;
- assert pubKey != null;
-
- return verify0(jarName, pubKey, allSigned, log);
- }
-
- /**
- * Tests whether given JAR file input stream was not changed since creation.
- *
- * @param in JAR file input stream.
- * @param allSigned Hint which means that all files of all entries must be
- * signed.
- * @param log Logger.
- * @return {@code true} if JAR file input stream was not changed.
- * @throws IOException Thrown if JAR file stream or its entries could not
- * be read.
- */
- static boolean verify(InputStream in, boolean allSigned, IgniteLogger log) throws IOException {
- assert in != null;
-
- return verify0(in, null, allSigned, log);
- }
-
- /**
- * Tests whether given JAR file input stream is signed with public key.
- * If manifest is {@code null} than method returns {@code true} if
- * public key is {@code null}.
- * If parameter {@code allSigned} equals {@code true} and file not
- * listed in manifest than method return {@code false}. If file
- * listed in manifest but doesn't exist in JAR-file than method
- * return {@code false}.
- *
- * @param in JAR file input stream.
- * @param pubKey Public key to be tested with.
- * @param allSigned Hint which means that all files in entry must be signed.
- * @param log Logger.
- * @return {@code true} if JAR file is signed with given public key.
- * @throws IOException Thrown if JAR file or its entries could not be read.
- */
- static boolean verify(InputStream in, PublicKey pubKey, boolean allSigned, IgniteLogger log)
- throws IOException {
- assert in != null;
- assert pubKey != null;
-
- return verify0(in, pubKey, allSigned, log);
- }
-
- /**
- * Tests whether all files in given JAR file input stream are signed
- * with public key. If manifest is {@code null} than method returns
- * {@code true} if public key is null.
- *
- * @param in JAR file input stream.
- * @param pubKey Public key to be tested with.
- * @param allSigned Hint which means that all files in entry must be signed.
- * @param log Logger.
- * @return {@code true} if JAR file is signed with given public key.
- * @throws IOException Thrown if JAR file or its entries could not be read.
- */
- private static boolean verify0(InputStream in, PublicKey pubKey, boolean allSigned, IgniteLogger log)
- throws IOException {
- assert in != null;
-
- JarInputStream jin = null;
-
- try {
- jin = new JarInputStream(in, true);
-
- Manifest manifest = jin.getManifest();
-
- // Manifest must be included into a signed package.
- if (manifest == null)
- return pubKey == null;
-
- Set manifestFiles = getSignedFiles(manifest);
-
- JarEntry jarEntry;
-
- while ((jarEntry = jin.getNextJarEntry()) != null) {
- if (jarEntry.isDirectory())
- continue;
-
- // Verify by reading the file if altered.
- // Will return quietly if no problem.
- verifyDigestsImplicitly(jin);
-
- if (!verifyEntry(jarEntry, manifest, pubKey, allSigned, true))
- return false;
-
- manifestFiles.remove(jarEntry.getName());
- }
-
- return manifestFiles.size() <= 0;
- }
- catch (SecurityException e) {
- if (log.isDebugEnabled())
- log.debug("Got security error (ignoring): " + e.getMessage());
- }
- finally {
- U.close(jin, log);
- }
-
- return false;
- }
-
- /**
- * Tests whether all files in given JAR file are signed
- * with public key. If manifest is {@code null} than method returns
- * {@code true} if public key is null.
- *
- * DO NOT REFACTOR THIS METHOD. THERE IS A SUN DEFECT ABOUT PROCESSING JAR AS
- * FILE AND AS STREAM. THE PROCESSING IS DIFFERENT.
- *
- * @param jarName JAR file name.
- * @param pubKey Public key to be tested with.
- * @param allSigned Hint which means that all files in entry must be signed.
- * @param log Logger.
- * @return {@code true} if JAR file is signed with given public key.
- * @throws IOException Thrown if JAR file or its entries could not be read.
- */
- private static boolean verify0(String jarName, PublicKey pubKey, boolean allSigned, IgniteLogger log)
- throws IOException {
- JarFile jarFile = null;
-
- try {
- jarFile = new JarFile(jarName, true);
-
- Manifest manifest = jarFile.getManifest();
-
- // Manifest must be included into a signed package.
- if (manifest == null)
- return pubKey == null;
-
- Set manifestFiles = getSignedFiles(manifest);
-
- Enumeration entries = jarFile.entries();
-
- while (entries.hasMoreElements()) {
- JarEntry jarEntry = entries.nextElement();
-
- if (jarEntry.isDirectory())
- continue;
-
- // Verify by reading the file if altered.
- // Will return quietly if no problem.
- verifyDigestsImplicitly(jarFile.getInputStream(jarEntry));
-
- if (!verifyEntry(jarEntry, manifest, pubKey, allSigned, false))
- return false;
-
- manifestFiles.remove(jarEntry.getName());
- }
-
- return manifestFiles.size() <= 0;
- }
- catch (SecurityException e) {
- if (log.isDebugEnabled())
- log.debug("Got security error (ignoring): " + e.getMessage());
- }
- finally {
- U.close(jarFile, log);
- }
-
- return false;
- }
-
- /**
- * Tests whether given JAR entry from manifest contains at least one
- * certificate with given public key.
- *
- * Files which starts with "META-INF/" are always verified successfully.
- *
- * @param jarEntry Tested JAR entry.
- * @param manifest Manifest this entry belongs to.
- * @param pubKey Public key we are testing. If it is {@code null} returns
- * {@code true}.
- * @param allSigned Hint which means that all files in entry must be signed.
- * @param makeCerts If {@code true} JAR entry certificates are scanned.
- * Otherwise all JAR entry signers certificates are scanned.
- * @return {@code true} if JAR entry is verified {@code false} otherwise.
- */
- private static boolean verifyEntry(JarEntry jarEntry, Manifest manifest, PublicKey pubKey, boolean allSigned,
- boolean makeCerts) {
- assert jarEntry != null;
- assert manifest != null;
-
- boolean inManifest = false;
-
- String entryName = jarEntry.getName();
-
- // Check that entry name contains in manifest file.
- if (manifest.getAttributes(entryName) != null || manifest.getAttributes("./" + entryName) != null ||
- manifest.getAttributes('/' + entryName) != null)
- inManifest = true;
-
- // Don't ignore files not listed in manifest and META-INF directory.
- if (allSigned && !inManifest && !entryName.toUpperCase().startsWith("META-INF/"))
- return false;
-
- // Looking at entries in manifest file.
- if (inManifest) {
- Certificate[] certs = !makeCerts ? jarEntry.getCertificates() : getCertificates(jarEntry);
-
- boolean isSigned = certs != null && certs.length > 0;
-
- if (!isSigned || pubKey != null && !findKeyInCertificates(pubKey, certs))
- return false;
- }
-
- return true;
- }
-
- /**
- * This checks that everything is valid and unchanged from the digest
- * listed in the manifest next to the name.
- *
- * @param in JAR file or JAR entry input stream.
- * @throws IOException Thrown if read fails.
- */
- private static void verifyDigestsImplicitly(InputStream in) throws IOException {
- byte[] buf = new byte[BUF_SIZE];
-
- while (in.read(buf, 0, buf.length) != -1) {
- // Just read the entry. Will throw a SecurityException if signature
- // or digest check fails. Since we instantiated JarFile with parameter
- // true, that tells it to verify that the files match the digests
- // and haven't been changed.
- }
- }
-
- /**
- * Tests whether given certificate contains public key or not.
- *
- * @param key Public key which we are looking for.
- * @param certs Certificate which should be tested.
- * @return {@code true} if certificate contains given key and
- * {@code false} if not.
- */
- private static boolean findKeyInCertificates(PublicKey key, Certificate[] certs) {
- if (key == null || certs == null)
- return false;
-
- for (Certificate cert : certs) {
- if (cert.getPublicKey().equals(key))
- return true;
- }
-
- return false;
- }
-
- /**
- * Gets all signed files from the manifest.
- *
- * It scans all manifest entries and their attributes. If there is an attribute
- * name which ends with "-DIGEST" we are assuming that manifest entry name is a
- * signed file name.
- *
- * @param manifest JAR file manifest.
- * @return Either empty set if none found or set of signed file names.
- */
- private static Set getSignedFiles(Manifest manifest) {
- Set fileNames = new HashSet<>();
-
- Map entries = manifest.getEntries();
-
- if (entries != null && entries.size() > 0) {
- for (Map.Entry entry : entries.entrySet()) {
- Attributes attrs = entry.getValue();
-
- for (Map.Entry