Modified: ace/trunk/org.apache.ace.client.repository/test/org/apache/ace/client/repository/impl/ModelTest.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository/test/org/apache/ace/client/repository/impl/ModelTest.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.client.repository/test/org/apache/ace/client/repository/impl/ModelTest.java (original) +++ ace/trunk/org.apache.ace.client.repository/test/org/apache/ace/client/repository/impl/ModelTest.java Fri Jan 29 08:59:31 2016 @@ -161,9 +161,9 @@ public class ModelTest { } try { - Map<String, String> attr = new HashMap<String, String>(); + Map<String, String> attr = new HashMap<>(); attr.put(BundleHelper.KEY_NAME, "mynewartifact"); - Map<String, String> tags = new HashMap<String, String>(); + Map<String, String> tags = new HashMap<>(); m_artifactRepository.create(attr, tags); assert false : "Creating a artifact without specifying all mandatory atttributes should be illegal."; } @@ -248,18 +248,18 @@ public class ModelTest { assert g2distributions.size() == 0 : "Feature two should not have any associations to distributions; we found " + g2distributions.size() + "."; assert g3distributions.size() == 0 : "Feature three should not have any associations to distributions; we found " + g3distributions.size() + "."; - List<FeatureObject> b1expectedFeatures = new ArrayList<FeatureObject>(); + List<FeatureObject> b1expectedFeatures = new ArrayList<>(); b1expectedFeatures.add(g2); b1expectedFeatures.add(g3); - List<FeatureObject> b2expectedFeatures = new ArrayList<FeatureObject>(); + List<FeatureObject> b2expectedFeatures = new ArrayList<>(); b2expectedFeatures.add(g1); b2expectedFeatures.add(g3); - List<ArtifactObject> g1expectedArtifacts = new ArrayList<ArtifactObject>(); + List<ArtifactObject> g1expectedArtifacts = new ArrayList<>(); g1expectedArtifacts.add(b2); - List<ArtifactObject> g2expectedArtifacts = new ArrayList<ArtifactObject>(); + List<ArtifactObject> g2expectedArtifacts = new ArrayList<>(); g2expectedArtifacts.add(b1); - List<ArtifactObject> g3expectedArtifacts = new ArrayList<ArtifactObject>(); + List<ArtifactObject> g3expectedArtifacts = new ArrayList<>(); g3expectedArtifacts.add(b1); g3expectedArtifacts.add(b2); @@ -296,12 +296,12 @@ public class ModelTest { FeatureObject f2 = createBasicFeatureObject("f2"); FeatureObject f3 = createBasicFeatureObject("f3"); - Map<String, String> props = new HashMap<String, String>(); + Map<String, String> props = new HashMap<>(); props.put(Association.LEFT_ENDPOINT, "(" + BundleHelper.KEY_SYMBOLICNAME + "=a1)"); props.put(Association.LEFT_CARDINALITY, "1"); props.put(Association.RIGHT_ENDPOINT, "(" + FeatureObject.KEY_NAME + "=f*)"); props.put(Association.RIGHT_CARDINALITY, "2"); - Map<String, String> tags = new HashMap<String, String>(); + Map<String, String> tags = new HashMap<>(); try { m_artifact2FeatureRepository.create(props, tags); @@ -331,10 +331,10 @@ public class ModelTest { FeatureObject g2 = createBasicFeatureObject("g2"); FeatureObject g3 = createBasicFeatureObject("g3"); - List<ArtifactObject> artifacts = new ArrayList<ArtifactObject>(); + List<ArtifactObject> artifacts = new ArrayList<>(); artifacts.add(b1); artifacts.add(b2); - List<FeatureObject> features = new ArrayList<FeatureObject>(); + List<FeatureObject> features = new ArrayList<>(); features.add(g1); features.add(g3); @@ -467,13 +467,13 @@ public class ModelTest { */ @Test(groups = { TestUtils.UNIT }) public void testEquals() { - List<ArtifactObject> artifacts = new ArrayList<ArtifactObject>(); + List<ArtifactObject> artifacts = new ArrayList<>(); artifacts.add(createBasicArtifactObject("artifact1")); artifacts.add(createBasicArtifactObject("artifact2")); artifacts.get(1).addTag("thetag", "thevalue"); artifacts.add(createBasicArtifactObject("artifact3")); - List<ArtifactObject> backupArtifacts = new ArrayList<ArtifactObject>(); + List<ArtifactObject> backupArtifacts = new ArrayList<>(); backupArtifacts.addAll(artifacts); for (ArtifactObject b : backupArtifacts) { @@ -578,10 +578,10 @@ public class ModelTest { public void testModelFiltering() throws InvalidSyntaxException { initializeRepositoryAdmin(); // Create an empty artifact repository. - Map<String, String> attributes = new HashMap<String, String>(); + Map<String, String> attributes = new HashMap<>(); attributes.put("myattribute", "theattribute"); attributes.put("name", "attname"); - Map<String, String> tags = new HashMap<String, String>(); + Map<String, String> tags = new HashMap<>(); assert m_featureRepository != null : "Something has gone wrong injecting the feature repository."; FeatureObject g1 = m_featureRepository.create(attributes, tags); @@ -739,14 +739,14 @@ public class ModelTest { } private ArtifactObject createBasicArtifactObject(String symbolicName, String version, String size) { - Map<String, String> attr = new HashMap<String, String>(); + Map<String, String> attr = new HashMap<>(); attr.put(BundleHelper.KEY_SYMBOLICNAME, symbolicName); attr.put(ArtifactObject.KEY_MIMETYPE, BundleHelper.MIMETYPE); attr.put(ArtifactObject.KEY_URL, "http://" + symbolicName + "-v" + ((version == null) ? "null" : version)); if (size != null) { attr.put(ArtifactObject.KEY_SIZE, size); // bytes } - Map<String, String> tags = new HashMap<String, String>(); + Map<String, String> tags = new HashMap<>(); if (version != null) { attr.put(BundleHelper.KEY_VERSION, version); } @@ -754,12 +754,12 @@ public class ModelTest { } private DeploymentVersionObject createBasicDeploymentVersionObject(String targetID, String version, String[] artifacts) { - Map<String, String> attr = new HashMap<String, String>(); + Map<String, String> attr = new HashMap<>(); attr.put(DeploymentVersionObject.KEY_TARGETID, targetID); attr.put(DeploymentVersionObject.KEY_VERSION, version); - Map<String, String> tags = new HashMap<String, String>(); + Map<String, String> tags = new HashMap<>(); - List<DeploymentArtifactImpl> deploymentArtifacts = new ArrayList<DeploymentArtifactImpl>(); + List<DeploymentArtifactImpl> deploymentArtifacts = new ArrayList<>(); for (String s : artifacts) { deploymentArtifacts.add(new DeploymentArtifactImpl(s, -1L)); } @@ -767,25 +767,25 @@ public class ModelTest { } private DistributionObject createBasicDistributionObject(String name) { - Map<String, String> attr = new HashMap<String, String>(); + Map<String, String> attr = new HashMap<>(); attr.put(DistributionObject.KEY_NAME, name); - Map<String, String> tags = new HashMap<String, String>(); + Map<String, String> tags = new HashMap<>(); return m_distributionRepository.create(attr, tags); } private FeatureObject createBasicFeatureObject(String name) { - Map<String, String> attr = new HashMap<String, String>(); + Map<String, String> attr = new HashMap<>(); attr.put(FeatureObject.KEY_NAME, name); - Map<String, String> tags = new HashMap<String, String>(); + Map<String, String> tags = new HashMap<>(); return m_featureRepository.create(attr, tags); } private TargetObject createBasicTargetObject(String id) { - Map<String, String> attr = new HashMap<String, String>(); + Map<String, String> attr = new HashMap<>(); attr.put(TargetObject.KEY_ID, id); - Map<String, String> tags = new HashMap<String, String>(); + Map<String, String> tags = new HashMap<>(); return m_targetRepository.create(attr, tags); } @@ -828,7 +828,7 @@ public class ModelTest { m_repositoryAdmin = new RepositoryAdminImpl("testSessionID", repoConfig); - Map<Class<? extends ObjectRepository>, ObjectRepositoryImpl> repos = new HashMap<Class<? extends ObjectRepository>, ObjectRepositoryImpl>(); + Map<Class<? extends ObjectRepository>, ObjectRepositoryImpl> repos = new HashMap<>(); repos.put(ArtifactRepository.class, m_artifactRepository); repos.put(Artifact2FeatureAssociationRepository.class, m_artifact2FeatureRepository); repos.put(FeatureRepository.class, m_featureRepository);
Modified: ace/trunk/org.apache.ace.client.repository/test/org/apache/ace/client/repository/impl/RepositoryObjectImplTest.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository/test/org/apache/ace/client/repository/impl/RepositoryObjectImplTest.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.client.repository/test/org/apache/ace/client/repository/impl/RepositoryObjectImplTest.java (original) +++ ace/trunk/org.apache.ace.client.repository/test/org/apache/ace/client/repository/impl/RepositoryObjectImplTest.java Fri Jan 29 08:59:31 2016 @@ -85,7 +85,7 @@ public class RepositoryObjectImplTest { } private void assertKeysContain(Enumeration<String> enumerator, String... expectedKeys) { - List<String> expected = new ArrayList<String>(Arrays.asList(expectedKeys)); + List<String> expected = new ArrayList<>(Arrays.asList(expectedKeys)); while (enumerator.hasMoreElements()) { String key = enumerator.nextElement(); @@ -96,7 +96,7 @@ public class RepositoryObjectImplTest { } private Map<String, String> createMap(String... entries) { - Map<String, String> result = new HashMap<String, String>(); + Map<String, String> result = new HashMap<>(); for (int i = 0; i < entries.length; i += 2) { result.put(entries[i], entries[i + 1]); } Modified: ace/trunk/org.apache.ace.client.workspace/src/org/apache/ace/client/workspace/impl/DPHelper.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.workspace/src/org/apache/ace/client/workspace/impl/DPHelper.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.client.workspace/src/org/apache/ace/client/workspace/impl/DPHelper.java (original) +++ ace/trunk/org.apache.ace.client.workspace/src/org/apache/ace/client/workspace/impl/DPHelper.java Fri Jan 29 08:59:31 2016 @@ -92,8 +92,8 @@ class DPHelper { } protected void importDeploymentPackage(JarInputStream is, boolean autoCommit) throws Exception { - Map<ArtifactObject, FeatureObject> a2fMap = new HashMap<ArtifactObject, FeatureObject>(); - Map<FeatureObject, DistributionObject> f2dMap = new HashMap<FeatureObject, DistributionObject>(); + Map<ArtifactObject, FeatureObject> a2fMap = new HashMap<>(); + Map<FeatureObject, DistributionObject> f2dMap = new HashMap<>(); // Upload all (new) artifact... JarEntry jarEntry; Modified: ace/trunk/org.apache.ace.client.workspace/src/org/apache/ace/client/workspace/impl/WorkspaceImpl.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.workspace/src/org/apache/ace/client/workspace/impl/WorkspaceImpl.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.client.workspace/src/org/apache/ace/client/workspace/impl/WorkspaceImpl.java (original) +++ ace/trunk/org.apache.ace.client.workspace/src/org/apache/ace/client/workspace/impl/WorkspaceImpl.java Fri Jan 29 08:59:31 2016 @@ -378,7 +378,7 @@ public class WorkspaceImpl implements Wo } private Map<String, String> getAttributes(RepositoryObject object) { - Map<String, String> result = new HashMap<String, String>(); + Map<String, String> result = new HashMap<>(); for (Enumeration<String> keys = object.getAttributeKeys(); keys.hasMoreElements();) { String key = keys.nextElement(); result.put(key, object.getAttribute(key)); @@ -390,8 +390,8 @@ public class WorkspaceImpl implements Wo @SuppressWarnings("unchecked") public Association<? extends RepositoryObject, ? extends RepositoryObject> createAssocation(String entityType, String leftEntityId, String rightEntityId, String leftCardinality, String rightCardinality) { - Map<String, String> attrs = new HashMap<String, String>(); - Map<String, String> tags = new HashMap<String, String>(); + Map<String, String> attrs = new HashMap<>(); + Map<String, String> tags = new HashMap<>(); attrs.put(Association.LEFT_ENDPOINT, leftEntityId); attrs.put(Association.LEFT_CARDINALITY, interpretCardinality(leftCardinality)); attrs.put(Association.RIGHT_ENDPOINT, rightEntityId); @@ -496,7 +496,7 @@ public class WorkspaceImpl implements Wo public List<ArtifactObject> lrp(String filter) throws Exception { Filter f = m_context.createFilter(filter); List<ArtifactObject> rps = m_artifactRepository.getResourceProcessors(); - List<ArtifactObject> res = new LinkedList<ArtifactObject>(); + List<ArtifactObject> res = new LinkedList<>(); for (ArtifactObject rp : rps) { if (f.matchCase(rp.getDictionary())) { res.add(rp); @@ -531,7 +531,7 @@ public class WorkspaceImpl implements Wo @Override public ArtifactObject ca(String name, String url, String bsn, String version) { - Map<String, String> attrs = new HashMap<String, String>(); + Map<String, String> attrs = new HashMap<>(); attrs.put(ArtifactObject.KEY_ARTIFACT_NAME, name); attrs.put(ArtifactObject.KEY_URL, url); attrs.put(ArtifactObject.KEY_MIMETYPE, BundleHelper.MIMETYPE); @@ -609,7 +609,7 @@ public class WorkspaceImpl implements Wo @Override public FeatureObject cf(String name) { - Map<String, String> attrs = new HashMap<String, String>(); + Map<String, String> attrs = new HashMap<>(); attrs.put(FeatureObject.KEY_NAME, name); return cf(attrs); } @@ -686,7 +686,7 @@ public class WorkspaceImpl implements Wo @Override public DistributionObject cd(String name) { - Map<String, String> attrs = new HashMap<String, String>(); + Map<String, String> attrs = new HashMap<>(); attrs.put(DistributionObject.KEY_NAME, name); return cd(attrs); } @@ -763,7 +763,7 @@ public class WorkspaceImpl implements Wo @Override public StatefulTargetObject ct(String name) { - Map<String, String> attrs = new HashMap<String, String>(); + Map<String, String> attrs = new HashMap<>(); attrs.put(StatefulTargetObject.KEY_ID, name); return ct(attrs); } Modified: ace/trunk/org.apache.ace.client.workspace/src/org/apache/ace/client/workspace/impl/WorkspaceManagerImpl.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.workspace/src/org/apache/ace/client/workspace/impl/WorkspaceManagerImpl.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.client.workspace/src/org/apache/ace/client/workspace/impl/WorkspaceManagerImpl.java (original) +++ ace/trunk/org.apache.ace.client.workspace/src/org/apache/ace/client/workspace/impl/WorkspaceManagerImpl.java Fri Jan 29 08:59:31 2016 @@ -73,8 +73,8 @@ public class WorkspaceManagerImpl implem private String m_serverUser; public WorkspaceManagerImpl() { - m_workspaces = new HashMap<String, Workspace>(); - m_workspaceComponents = new HashMap<String, Component>(); + m_workspaces = new HashMap<>(); + m_workspaceComponents = new HashMap<>(); } public void init(Component component) { Modified: ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/Configurator.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/Configurator.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/Configurator.java (original) +++ ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/Configurator.java Fri Jan 29 08:59:31 2016 @@ -25,11 +25,9 @@ import java.io.IOException; import java.io.InputStream; import java.util.Collections; import java.util.Dictionary; -import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; @@ -70,8 +68,8 @@ public class Configurator implements Run private final File m_configDir; private final long m_pollInterval; - private final Map<String, Long> m_checksums = new HashMap<String, Long>(); - private final Map<String, Map<String, Long>> m_foundFactories = new HashMap<String, Map<String, Long>>(); + private final Map<String, Long> m_checksums = new HashMap<>(); + private final Map<String, Map<String, Long>> m_foundFactories = new HashMap<>(); private final boolean m_reconfig; private Thread m_configThread; @@ -142,7 +140,7 @@ public class Configurator implements Run * the size of the new configuration has changed. */ private void doConfigs() { - Set<String> pids = new HashSet<String>(m_checksums.keySet()); + Set<String> pids = new HashSet<>(m_checksums.keySet()); File[] files = m_configDir.listFiles(FILENAME_FILTER); for (int i = 0; (files != null) && (i < files.length); i++) { @@ -162,8 +160,7 @@ public class Configurator implements Run pids.remove(pid); } } - for (Iterator e = pids.iterator(); e.hasNext();) { - String pid = (String) e.next(); + for (String pid : pids) { deleteConfig(pid, null); m_checksums.remove(pid); } @@ -174,7 +171,7 @@ public class Configurator implements Run m_foundFactories.put(factoryPid, new HashMap<String, Long>()); } Map<String, Long> instances = m_foundFactories.get(factoryPid); - Set<String> instancesPids = new HashSet<String>(instances.keySet()); + Set<String> instancesPids = new HashSet<>(instances.keySet()); for (int j = 0; j < newInstances.length; j++) { File instanceConfigFile = newInstances[j]; @@ -189,8 +186,7 @@ public class Configurator implements Run instancesPids.remove(instancePid); } - for (Iterator e = instancesPids.iterator(); e.hasNext();) { - String instancePid = (String) e.next(); + for (String instancePid : instancesPids) { deleteConfig(instancePid, factoryPid); instances.remove(instancePid); } @@ -303,9 +299,9 @@ public class Configurator implements Run * @return Same set of properties with all variables substituted. */ private Properties substVars(Properties properties) { - for (Enumeration propertyKeys = properties.propertyNames(); propertyKeys.hasMoreElements();) { - String name = (String) propertyKeys.nextElement(); - String value = properties.getProperty(name); + for (Map.Entry<Object, Object> entry : properties.entrySet()) { + String name = (String) entry.getKey(); + String value = (String) entry.getValue(); properties.setProperty(name, substVars(value, name, null, properties)); } return properties; @@ -336,7 +332,7 @@ public class Configurator implements Run // If there is currently no cycle map, then create // one for detecting cycles for this invocation. if (cycleMap == null) { - cycleMap = new HashMap<String, String>(); + cycleMap = new HashMap<>(); } // Put the current key in the cycle map. Modified: ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/useradmin/task/UpdateUserAdminTask.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/useradmin/task/UpdateUserAdminTask.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/useradmin/task/UpdateUserAdminTask.java (original) +++ ace/trunk/org.apache.ace.configurator/src/org/apache/ace/configurator/useradmin/task/UpdateUserAdminTask.java Fri Jan 29 08:59:31 2016 @@ -138,7 +138,7 @@ public class UpdateUserAdminTask impleme run(); } - public void updated(Dictionary dict) throws ConfigurationException { + public void updated(Dictionary<String, ?> dict) throws ConfigurationException { if (dict != null) { String customer = (String) dict.get(KEY_REPOSITORY_CUSTOMER); if (customer == null) { Modified: ace/trunk/org.apache.ace.configurator/test/org/apache/ace/configurator/ConfiguratorTest.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.configurator/test/org/apache/ace/configurator/ConfiguratorTest.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.configurator/test/org/apache/ace/configurator/ConfiguratorTest.java (original) +++ ace/trunk/org.apache.ace.configurator/test/org/apache/ace/configurator/ConfiguratorTest.java Fri Jan 29 08:59:31 2016 @@ -56,7 +56,7 @@ public class ConfiguratorTest { Properties initialConfiguration = createProperties(); saveConfiguration(pid, initialConfiguration); - Dictionary configuration = getAndWaitForConfigurationUpdate(pid); + Dictionary<String, ?> configuration = getAndWaitForConfigurationUpdate(pid); assertNotNull(configuration, "No configuration received from configurator"); assertEquals(createProperties(), configuration, "Configuration content is unexpected"); } @@ -69,7 +69,7 @@ public class ConfiguratorTest { Properties props = createProperties(); saveConfiguration(pid, "testFactory", props); - Dictionary configuration = getAndWaitForConfigurationUpdate(factoryPID); + Dictionary<String, ?> configuration = getAndWaitForConfigurationUpdate(factoryPID); assertNotNull(configuration, "No configuration received from configurator"); assertEquals(configuration.remove("factory.instance.pid"), "testFactory_test-add", "Incorrect factory instance pid was added to the configuration"); assertEquals(createProperties(), configuration, "Configuration content is unexpected"); @@ -83,7 +83,7 @@ public class ConfiguratorTest { Properties initialConfiguration = createProperties(); saveConfiguration(pid, initialConfiguration); - Dictionary configuration = getAndWaitForConfigurationUpdate(pid); + Dictionary<String, ?> configuration = getAndWaitForConfigurationUpdate(pid); assertNotNull(configuration, "No configuration received from configurator"); assertEquals(initialConfiguration, configuration); @@ -106,7 +106,7 @@ public class ConfiguratorTest { initialConfigurationValues.putAll(configurationValues); saveConfiguration(pid, configurationValues); - Dictionary configuration = getAndWaitForConfigurationUpdate(pid); + Dictionary<String, ?> configuration = getAndWaitForConfigurationUpdate(pid); assertNotNull(configuration, "No configuration received from configurator"); assertEquals(configurationValues, configuration); @@ -128,7 +128,7 @@ public class ConfiguratorTest { Properties configurationValues = createProperties(); saveConfiguration(pid, configurationValues); - Dictionary configuration = getAndWaitForConfigurationUpdate(pid); + Dictionary<String, ?> configuration = getAndWaitForConfigurationUpdate(pid); assertNotNull(configuration, "No configuration received from configurator"); assertEquals(configurationValues, configuration); @@ -157,7 +157,7 @@ public class ConfiguratorTest { initial.put("key3", "${qux} ${quu.${bar}} ${baz.${bar}}"); saveConfiguration(pid, initial); - Dictionary config = getAndWaitForConfigurationUpdate(pid); + Dictionary<String, ?> config = getAndWaitForConfigurationUpdate(pid); assertNotNull(config, "No configuration received from configurator"); assertEquals(config.get("key1"), "leading text middle word trailing", "Substitution failed!"); assertEquals(config.get("key2"), "%d{ISO8601} | %-5.5p | %C | %X{bundle.name} | %m%n", "Substitution failed!"); @@ -172,7 +172,7 @@ public class ConfiguratorTest { initialConfiguration.put("subst", "${contextProp}"); saveConfiguration(pid, initialConfiguration); - Dictionary configuration = getAndWaitForConfigurationUpdate(pid); + Dictionary<String, ?> configuration = getAndWaitForConfigurationUpdate(pid); assertNotNull(configuration, "No configuration received from configurator"); assertEquals(configuration.get("subst"), "contextVal", "Substitution failed"); } @@ -185,7 +185,7 @@ public class ConfiguratorTest { Properties initialConfiguration = createProperties(); saveConfiguration(pid, initialConfiguration); - Dictionary configuration = getAndWaitForConfigurationUpdate(pid); + Dictionary<String, ?> configuration = getAndWaitForConfigurationUpdate(pid); assertNotNull(configuration, "No configuration received from configurator"); assertEquals(createProperties(), configuration); @@ -276,7 +276,7 @@ public class ConfiguratorTest { * Get the configuration and if it not available yet wait for it. If there is still no configuration after the wait * time, null is returned. */ - private Dictionary getAndWaitForConfigurationUpdate(String pid) throws Exception { + private Dictionary<String, ?> getAndWaitForConfigurationUpdate(String pid) throws Exception { assertTrue(m_updateLatch.await(2, TimeUnit.SECONDS)); return m_configAdmin.getConfiguration(pid).getProperties(); Modified: ace/trunk/org.apache.ace.configurator/test/org/apache/ace/configurator/MockConfigAdmin.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.configurator/test/org/apache/ace/configurator/MockConfigAdmin.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.configurator/test/org/apache/ace/configurator/MockConfigAdmin.java (original) +++ ace/trunk/org.apache.ace.configurator/test/org/apache/ace/configurator/MockConfigAdmin.java Fri Jan 29 08:59:31 2016 @@ -31,7 +31,7 @@ public abstract class MockConfigAdmin im private final Map<String, Configuration> m_configs; public MockConfigAdmin() { - m_configs = new HashMap<String, Configuration>(); + m_configs = new HashMap<>(); } public Configuration createFactoryConfiguration(String factoryPID) throws IOException { Modified: ace/trunk/org.apache.ace.connectionfactory/src/org/apache/ace/connectionfactory/impl/ConnectionFactoryImpl.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.connectionfactory/src/org/apache/ace/connectionfactory/impl/ConnectionFactoryImpl.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.connectionfactory/src/org/apache/ace/connectionfactory/impl/ConnectionFactoryImpl.java (original) +++ ace/trunk/org.apache.ace.connectionfactory/src/org/apache/ace/connectionfactory/impl/ConnectionFactoryImpl.java Fri Jan 29 08:59:31 2016 @@ -55,7 +55,7 @@ public class ConnectionFactoryImpl imple * Creates a new {@link ConnectionFactoryImpl}. */ public ConnectionFactoryImpl() { - m_credentialMapping = new HashMap<String, UrlCredentials>(); + m_credentialMapping = new HashMap<>(); } /** @@ -117,7 +117,7 @@ public class ConnectionFactoryImpl imple /** * {@inheritDoc} */ - public void updated(String pid, Dictionary properties) throws ConfigurationException { + public void updated(String pid, Dictionary<String, ?> properties) throws ConfigurationException { UrlCredentials creds; synchronized (m_credentialMapping) { creds = m_credentialMapping.get(pid); @@ -138,14 +138,15 @@ public class ConnectionFactoryImpl imple /** * Returns the credentials to access the given URL. * - * @param url the URL to find the credentials for, cannot be <code>null</code>. - * @return a {@link UrlCredentials} instance for the given URL, or <code>null</code> - * if none were found, or if none were necessary. + * @param url + * the URL to find the credentials for, cannot be <code>null</code>. + * @return a {@link UrlCredentials} instance for the given URL, or <code>null</code> if none were found, or if none + * were necessary. */ final UrlCredentials getCredentials(URL url) { Collection<UrlCredentials> creds; synchronized (m_credentialMapping) { - creds = new ArrayList<UrlCredentials>(m_credentialMapping.values()); + creds = new ArrayList<>(m_credentialMapping.values()); } for (UrlCredentials c : creds) { @@ -160,8 +161,10 @@ public class ConnectionFactoryImpl imple /** * Returns the authorization header for HTTP Basic Authentication. * - * @param values the credential values to supply, cannot be <code>null</code> and should be an array of two elements. - * @return a string that denotes the basic authentication header ("Basic " + encoded credentials), never <code>null</code>. + * @param values + * the credential values to supply, cannot be <code>null</code> and should be an array of two elements. + * @return a string that denotes the basic authentication header ("Basic " + encoded credentials), never + * <code>null</code>. */ final String getBasicAuthCredentials(Object[] values) { if ((values == null) || values.length < 2) { @@ -189,8 +192,10 @@ public class ConnectionFactoryImpl imple /** * Applies basic authentication to the given connection, if it is a {@link HttpURLConnection}. * - * @param conn the connection to apply basic authentication to; - * @param values the credentials to apply. + * @param conn + * the connection to apply basic authentication to; + * @param values + * the credentials to apply. */ private void applyBasicAuthentication(URLConnection conn, Object[] values) { if (conn instanceof HttpURLConnection) { @@ -201,8 +206,10 @@ public class ConnectionFactoryImpl imple /** * Applies the use of client certificates to the given connection, if it a {@link HttpsURLConnection}. * - * @param conn the connection to apply client certs to; - * @param values the credentials to apply. + * @param conn + * the connection to apply client certs to; + * @param values + * the credentials to apply. */ private void applyClientCertificate(URLConnection conn, Object[] values) { if (conn instanceof HttpsURLConnection) { @@ -213,9 +220,12 @@ public class ConnectionFactoryImpl imple /** * Supplies the actual credentials to the given {@link URLConnection}. * - * @param conn the connection to supply the credentials to, cannot be <code>null</code>; - * @param urlCreds the URL credentials to supply, cannot be <code>null</code>. - * @throws IOException in case of I/O problems. + * @param conn + * the connection to supply the credentials to, cannot be <code>null</code>; + * @param urlCreds + * the URL credentials to supply, cannot be <code>null</code>. + * @throws IOException + * in case of I/O problems. */ private void supplyCredentials(URLConnection conn, UrlCredentials urlCreds) throws IOException { final AuthType type = urlCreds.getType(); Modified: ace/trunk/org.apache.ace.connectionfactory/src/org/apache/ace/connectionfactory/impl/UrlCredentialsFactory.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.connectionfactory/src/org/apache/ace/connectionfactory/impl/UrlCredentialsFactory.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.connectionfactory/src/org/apache/ace/connectionfactory/impl/UrlCredentialsFactory.java (original) +++ ace/trunk/org.apache.ace.connectionfactory/src/org/apache/ace/connectionfactory/impl/UrlCredentialsFactory.java Fri Jan 29 08:59:31 2016 @@ -92,7 +92,7 @@ final class UrlCredentialsFactory { * @param props the properties to take the access credentials from. * @throws MissingValueException in case the given properties is missing values. */ - public static UrlCredentials getCredentials(Dictionary props) throws MissingValueException { + public static UrlCredentials getCredentials(Dictionary<String, ?> props) throws MissingValueException { return getCredentials(props, ""); } @@ -101,7 +101,7 @@ final class UrlCredentialsFactory { * @param prefix the prefix to use to lookup the correct values in the given dictionary. * @throws MissingValueException in case the given properties is missing values. */ - public static UrlCredentials getCredentials(Dictionary props, String prefix) throws MissingValueException { + public static UrlCredentials getCredentials(Dictionary<String, ?> props, String prefix) throws MissingValueException { if (props == null) { throw new IllegalArgumentException("Properties cannot be null!"); } @@ -195,7 +195,7 @@ final class UrlCredentialsFactory { return new UrlCredentials(type, baseURL, creds); } - private static String getStringProperty(Dictionary dict, String key) { + private static String getStringProperty(Dictionary<String, ?> dict, String key) { Object value = dict.get(key); if (value instanceof String) { return (String) value; @@ -205,7 +205,7 @@ final class UrlCredentialsFactory { return null; } - private static String getStringProperty(Dictionary dict, String key, String defaultValue) { + private static String getStringProperty(Dictionary<String, ?> dict, String key, String defaultValue) { String value = getStringProperty(dict, key); return (value == null) ? defaultValue : value; } Modified: ace/trunk/org.apache.ace.connectionfactory/test/org/apache/ace/connectionfactory/impl/ConnectionFactoryImplTest.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.connectionfactory/test/org/apache/ace/connectionfactory/impl/ConnectionFactoryImplTest.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.connectionfactory/test/org/apache/ace/connectionfactory/impl/ConnectionFactoryImplTest.java (original) +++ ace/trunk/org.apache.ace.connectionfactory/test/org/apache/ace/connectionfactory/impl/ConnectionFactoryImplTest.java Fri Jan 29 08:59:31 2016 @@ -24,7 +24,8 @@ import static org.apache.ace.test.utils. import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; -import java.util.Properties; +import java.util.Dictionary; +import java.util.Hashtable; import org.apache.ace.test.constants.TestConstants; import org.testng.annotations.Test; @@ -77,7 +78,7 @@ public class ConnectionFactoryImplTest { public void testDeleted() throws Exception { ConnectionFactoryImpl connFactory = new ConnectionFactoryImpl(); - Properties props = createBasicAuthConfig(TEST_URL.toExternalForm()); + Dictionary<String, ?> props = createBasicAuthConfig(TEST_URL.toExternalForm()); connFactory.updated("pid1", props); @@ -97,7 +98,7 @@ public class ConnectionFactoryImplTest { public void testGetBasicAuthCredentialsOk() throws Exception { ConnectionFactoryImpl connFactory = new ConnectionFactoryImpl(); - Properties props = createBasicAuthConfig(TEST_URL.toExternalForm()); + Dictionary<String, ?> props = createBasicAuthConfig(TEST_URL.toExternalForm()); connFactory.updated("pid1", props); @@ -120,7 +121,7 @@ public class ConnectionFactoryImplTest { UrlCredentials credentials = connFactory.getCredentials(TEST_URL); assert credentials == null : "Expected no credentials to be found!"; - Properties props = createBasicAuthConfig(TEST_URL.toExternalForm()); + Dictionary<String, ?> props = createBasicAuthConfig(TEST_URL.toExternalForm()); connFactory.updated("pid1", props); @@ -135,7 +136,7 @@ public class ConnectionFactoryImplTest { public void testUpdatedUpdatesCredentialsOk() throws Exception { ConnectionFactoryImpl connFactory = new ConnectionFactoryImpl(); - Properties props = createBasicAuthConfig(TEST_URL.toExternalForm()); + Dictionary<String, Object> props = createBasicAuthConfig(TEST_URL.toExternalForm()); connFactory.updated("pid1", props); @@ -159,8 +160,8 @@ public class ConnectionFactoryImplTest { /** * @return a dictionary containing a configuration for basic authentication, never <code>null</code>. */ - private Properties createBasicAuthConfig(String url) { - Properties props = new Properties(); + private Dictionary<String, Object> createBasicAuthConfig(String url) { + Dictionary<String, Object> props = new Hashtable<>(); props.put(UrlCredentialsFactory.KEY_AUTH_BASE_URL, url); props.put(UrlCredentialsFactory.KEY_AUTH_TYPE, "basic"); props.put(UrlCredentialsFactory.KEY_AUTH_USER_NAME, "foo"); Modified: ace/trunk/org.apache.ace.connectionfactory/test/org/apache/ace/connectionfactory/impl/UrlCredentialsFactoryTest.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.connectionfactory/test/org/apache/ace/connectionfactory/impl/UrlCredentialsFactoryTest.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.connectionfactory/test/org/apache/ace/connectionfactory/impl/UrlCredentialsFactoryTest.java (original) +++ ace/trunk/org.apache.ace.connectionfactory/test/org/apache/ace/connectionfactory/impl/UrlCredentialsFactoryTest.java Fri Jan 29 08:59:31 2016 @@ -21,7 +21,8 @@ package org.apache.ace.connectionfactory import static org.apache.ace.test.utils.TestUtils.UNIT; -import java.util.Properties; +import java.util.Dictionary; +import java.util.Hashtable; import org.apache.ace.connectionfactory.impl.UrlCredentialsFactory.MissingValueException; import org.testng.annotations.Test; @@ -38,7 +39,8 @@ public class UrlCredentialsFactoryTest { */ @Test(groups = { UNIT }, expectedExceptions = MissingValueException.class) public void testGetCredentialsWithDictionaryBasicTypeMissingPasswordFail() { - Properties props = new Properties(); + Dictionary<String, Object> props = new Hashtable<>(); + props.put(UrlCredentialsFactory.KEY_AUTH_BASE_URL, AUTH_BASE_URL); props.put(UrlCredentialsFactory.KEY_AUTH_TYPE, "basic"); props.put(UrlCredentialsFactory.KEY_AUTH_USER_NAME, "bar"); @@ -51,7 +53,8 @@ public class UrlCredentialsFactoryTest { */ @Test(groups = { UNIT }, expectedExceptions = MissingValueException.class) public void testGetCredentialsWithDictionaryClientCertTypeMissingKeystorePasswordFail() { - Properties props = new Properties(); + Dictionary<String, Object> props = new Hashtable<>(); + props.put(UrlCredentialsFactory.KEY_AUTH_BASE_URL, AUTH_BASE_URL); props.put(UrlCredentialsFactory.KEY_AUTH_TYPE, "client_cert"); props.put(UrlCredentialsFactory.KEY_AUTH_TRUSTSTORE_FILE, "bar"); @@ -66,7 +69,8 @@ public class UrlCredentialsFactoryTest { */ @Test(groups = { UNIT }, expectedExceptions = MissingValueException.class) public void testGetCredentialsWithDictionaryClientCertTypeMissingKeystoreFileFail() { - Properties props = new Properties(); + Dictionary<String, Object> props = new Hashtable<>(); + props.put(UrlCredentialsFactory.KEY_AUTH_BASE_URL, AUTH_BASE_URL); props.put(UrlCredentialsFactory.KEY_AUTH_TYPE, "client_cert"); props.put(UrlCredentialsFactory.KEY_AUTH_TRUSTSTORE_FILE, "bar"); @@ -81,7 +85,8 @@ public class UrlCredentialsFactoryTest { */ @Test(groups = { UNIT }) public void testGetCredentialsWithDictionaryClientCertTypeOk() { - Properties props = new Properties(); + Dictionary<String, Object> props = new Hashtable<>(); + props.put(UrlCredentialsFactory.KEY_AUTH_BASE_URL, AUTH_BASE_URL); props.put(UrlCredentialsFactory.KEY_AUTH_TYPE, "client_cert"); props.put(UrlCredentialsFactory.KEY_AUTH_TRUSTSTORE_FILE, "foo"); @@ -102,7 +107,8 @@ public class UrlCredentialsFactoryTest { */ @Test(groups = { UNIT }, expectedExceptions = MissingValueException.class) public void testGetCredentialsWithDictionaryClientCertTypeMissingTruststorePasswordFail() { - Properties props = new Properties(); + Dictionary<String, Object> props = new Hashtable<>(); + props.put(UrlCredentialsFactory.KEY_AUTH_BASE_URL, AUTH_BASE_URL); props.put(UrlCredentialsFactory.KEY_AUTH_TYPE, "client_cert"); props.put(UrlCredentialsFactory.KEY_AUTH_KEYSTORE_FILE, "bar"); @@ -117,7 +123,8 @@ public class UrlCredentialsFactoryTest { */ @Test(groups = { UNIT }, expectedExceptions = MissingValueException.class) public void testGetCredentialsWithDictionaryClientCertTypeMissingTruststoreFileFail() { - Properties props = new Properties(); + Dictionary<String, Object> props = new Hashtable<>(); + props.put(UrlCredentialsFactory.KEY_AUTH_BASE_URL, AUTH_BASE_URL); props.put(UrlCredentialsFactory.KEY_AUTH_TYPE, "client_cert"); props.put(UrlCredentialsFactory.KEY_AUTH_KEYSTORE_FILE, "bar"); @@ -132,7 +139,8 @@ public class UrlCredentialsFactoryTest { */ @Test(groups = { UNIT }, expectedExceptions = MissingValueException.class) public void testGetCredentialsWithDictionaryBasicTypeMissingUserNameFail() { - Properties props = new Properties(); + Dictionary<String, Object> props = new Hashtable<>(); + props.put(UrlCredentialsFactory.KEY_AUTH_BASE_URL, AUTH_BASE_URL); props.put(UrlCredentialsFactory.KEY_AUTH_TYPE, "basic"); props.put(UrlCredentialsFactory.KEY_AUTH_USER_PASSWORD, "bar"); @@ -145,7 +153,8 @@ public class UrlCredentialsFactoryTest { */ @Test(groups = { UNIT }) public void testGetCredentialsWithDictionaryBasicTypeOk() { - Properties props = new Properties(); + Dictionary<String, Object> props = new Hashtable<>(); + props.put(UrlCredentialsFactory.KEY_AUTH_BASE_URL, AUTH_BASE_URL); props.put(UrlCredentialsFactory.KEY_AUTH_TYPE, "basic"); props.put(UrlCredentialsFactory.KEY_AUTH_USER_NAME, "foo"); @@ -159,7 +168,8 @@ public class UrlCredentialsFactoryTest { */ @Test(groups = { UNIT }, expectedExceptions = IllegalArgumentException.class) public void testGetCredentialsWithDictionaryInvalidAuthTypeFail() { - Properties props = new Properties(); + Dictionary<String, Object> props = new Hashtable<>(); + props.put(UrlCredentialsFactory.KEY_AUTH_BASE_URL, AUTH_BASE_URL); props.put(UrlCredentialsFactory.KEY_AUTH_TYPE, "nonsense"); @@ -171,7 +181,8 @@ public class UrlCredentialsFactoryTest { */ @Test(groups = { UNIT }, expectedExceptions = MissingValueException.class) public void testGetCredentialsWithDictionaryMissingBaseUrlFail() { - Properties props = new Properties(); + Dictionary<String, Object> props = new Hashtable<>(); + props.put(UrlCredentialsFactory.KEY_AUTH_TYPE, "none"); UrlCredentialsFactory.getCredentials(props); @@ -190,7 +201,7 @@ public class UrlCredentialsFactoryTest { */ @Test(groups = { UNIT }, expectedExceptions = IllegalArgumentException.class) public void testGetCredentialsWithNullPrefixFail() { - UrlCredentialsFactory.getCredentials(new Properties(), null); + UrlCredentialsFactory.getCredentials(new Hashtable<String, Object>(), null); } /** @@ -198,7 +209,8 @@ public class UrlCredentialsFactoryTest { */ @Test(groups = { UNIT }) public void testGetCredentialsWithValidDictionaryOk() { - Properties props = new Properties(); + Dictionary<String, Object> props = new Hashtable<>(); + props.put(UrlCredentialsFactory.KEY_AUTH_BASE_URL, AUTH_BASE_URL); props.put(UrlCredentialsFactory.KEY_AUTH_TYPE, "none"); Modified: ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/DeploymentIntegrationTest.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/DeploymentIntegrationTest.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/DeploymentIntegrationTest.java (original) +++ ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/DeploymentIntegrationTest.java Fri Jan 29 08:59:31 2016 @@ -142,18 +142,18 @@ public class DeploymentIntegrationTest e public static final String STOP_UNAFFECTED_BUNDLES = "org.apache.felix.deploymentadmin.stopUnaffectedBundles"; private final Semaphore m_semaphore = new Semaphore(0); - private final ConcurrentMap<Integer, CopyOnWriteArrayList<Bundle>> m_events = new ConcurrentHashMap<Integer, CopyOnWriteArrayList<Bundle>>(); + private final ConcurrentMap<Integer, CopyOnWriteArrayList<Bundle>> m_events = new ConcurrentHashMap<>(); private volatile ConfigurationAdmin m_config; private volatile DeploymentAdmin m_deployment; private volatile File m_tempDir; - private volatile ServiceRegistration m_deploymentAdminProxyReg; + private volatile ServiceRegistration<DeploymentAdmin> m_deploymentAdminProxyReg; @Override public void bundleChanged(BundleEvent event) { System.out.println("Bundle Event: " + event); Integer eventType = Integer.valueOf(event.getType()); - CopyOnWriteArrayList<Bundle> bundles = new CopyOnWriteArrayList<Bundle>(); + CopyOnWriteArrayList<Bundle> bundles = new CopyOnWriteArrayList<>(); CopyOnWriteArrayList<Bundle> oldBundles = m_events.putIfAbsent(eventType, bundles); if (oldBundles != null) { bundles = oldBundles; @@ -339,7 +339,7 @@ public class DeploymentIntegrationTest e props.put(EventConstants.EVENT_FILTER, "(successful=true)"); m_bundleContext.addBundleListener(this); - ServiceRegistration reg = m_bundleContext.registerService(EventHandler.class.getName(), this, props); + ServiceRegistration<EventHandler> reg = m_bundleContext.registerService(EventHandler.class, this, props); try { configureTarget(); @@ -390,7 +390,7 @@ public class DeploymentIntegrationTest e private void registerDeploymentAdminProxy(DeploymentAdmin proxy) { Dictionary<String, Object> props = new Hashtable<>(); props.put(org.osgi.framework.Constants.SERVICE_RANKING, 1); - m_deploymentAdminProxyReg = m_bundleContext.registerService(DeploymentAdmin.class.getName(), proxy, props); + m_deploymentAdminProxyReg = m_bundleContext.registerService(DeploymentAdmin.class, proxy, props); } private void unconfigureServer() throws IOException { Modified: ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/provider/filebased/FileBasedProvider.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/provider/filebased/FileBasedProvider.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/provider/filebased/FileBasedProvider.java (original) +++ ace/trunk/org.apache.ace.deployment.itest/src/org/apache/ace/it/deployment/provider/filebased/FileBasedProvider.java Fri Jan 29 08:59:31 2016 @@ -189,7 +189,7 @@ public class FileBasedProvider implement if (m_maximumNumberOfUsers != 0 && m_maximumNumberOfUsers < concurrentUsers) { throw new OverloadedException("Too many users, maximum allowed = " + m_maximumNumberOfUsers + ", current = " + concurrentUsers, (concurrentUsers - m_maximumNumberOfUsers) * BACKOFF_TIME_PER_USER); } - List<Version> versionList = new ArrayList<Version>(); + List<Version> versionList = new ArrayList<>(); File targetDirectory = new File(m_baseDirectory.getAbsolutePath(), targetId); if (targetDirectory.isDirectory()) { getVersions(targetId, versionList, targetDirectory); @@ -201,7 +201,7 @@ public class FileBasedProvider implement // now sort the list of versions and convert all values to strings. Collections.sort(versionList); - List<String> stringVersionList = new ArrayList<String>(); + List<String> stringVersionList = new ArrayList<>(); Iterator<Version> it = versionList.iterator(); while (it.hasNext()) { String version = (it.next()).toString(); @@ -227,7 +227,7 @@ public class FileBasedProvider implement else { versionDirectory = findMatchingVersionDirectory(m_defaultDirectory, version); } - List<ArtifactData> bundleData = new ArrayList<ArtifactData>(); + List<ArtifactData> bundleData = new ArrayList<>(); JarInputStream jarInputStream = null; Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/BaseRepositoryHandler.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/BaseRepositoryHandler.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/BaseRepositoryHandler.java (original) +++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/BaseRepositoryHandler.java Fri Jan 29 08:59:31 2016 @@ -250,7 +250,7 @@ class BaseRepositoryHandler extends Defa private XmlDeploymentArtifact(URL url, long size) { m_url = url; m_size = size; - m_directives = new HashMap<String, String>(); + m_directives = new HashMap<>(); } public long getSize() { Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/DeploymentArtifactCollector.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/DeploymentArtifactCollector.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/DeploymentArtifactCollector.java (original) +++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/DeploymentArtifactCollector.java Fri Jan 29 08:59:31 2016 @@ -41,9 +41,9 @@ public class DeploymentArtifactCollector public DeploymentArtifactCollector(String targetID, String... versions) { super(targetID); - m_artifacts = new HashMap<Version, List<XmlDeploymentArtifact>>(); + m_artifacts = new HashMap<>(); - m_expectedVersions = new ArrayList<Version>(versions.length); + m_expectedVersions = new ArrayList<>(versions.length); for (int i = 0; i < versions.length; i++) { Version v = parseVersion(versions[i]); if (Version.emptyVersion.equals(v)) { @@ -79,7 +79,7 @@ public class DeploymentArtifactCollector if (m_expectedVersions.contains(version)) { List<XmlDeploymentArtifact> artifacts = m_artifacts.get(version); if (artifacts == null) { - artifacts = new ArrayList<XmlDeploymentArtifact>(); + artifacts = new ArrayList<>(); m_artifacts.put(version, artifacts); } } Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/DeploymentPackageVersionCollector.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/DeploymentPackageVersionCollector.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/DeploymentPackageVersionCollector.java (original) +++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/DeploymentPackageVersionCollector.java Fri Jan 29 08:59:31 2016 @@ -36,7 +36,7 @@ public class DeploymentPackageVersionCol public DeploymentPackageVersionCollector(String targetID) { super(targetID); - m_versions = new ArrayList<Version>(); + m_versions = new ArrayList<>(); } /** Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java (original) +++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProvider.java Fri Jan 29 08:59:31 2016 @@ -128,7 +128,7 @@ public class RepositoryBasedProvider imp public RepositoryBasedProvider() { m_saxParserFactory = SAXParserFactory.newInstance(); - m_cachedVersionLists = new LRUMap<String, List<String>>(); + m_cachedVersionLists = new LRUMap<>(); } public List<ArtifactData> getBundleData(String targetId, String version) throws OverloadedException, IllegalArgumentException, IOException { @@ -229,7 +229,7 @@ public class RepositoryBasedProvider imp m_cachedVersionLists.clear(); } - List<String> stringVersionList = new ArrayList<String>(); + List<String> stringVersionList = new ArrayList<>(); InputStream input = null; try { @@ -291,7 +291,7 @@ public class RepositoryBasedProvider imp * @return A list of ArtifactData object representing this version. */ private List<ArtifactData> getAllArtifactData(List<XmlDeploymentArtifact> deploymentArtifacts) throws IllegalArgumentException { - List<ArtifactData> result = new ArrayList<ArtifactData>(); + List<ArtifactData> result = new ArrayList<>(); // get the bundledata for each URL for (XmlDeploymentArtifact pair : deploymentArtifacts) { Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/service/impl/Activator.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/service/impl/Activator.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/service/impl/Activator.java (original) +++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/service/impl/Activator.java Fri Jan 29 08:59:31 2016 @@ -49,7 +49,7 @@ public class Activator extends Dependenc private static final String MA_NAME = "ma"; private static final String DEFAULT_MA_NAME = null; - private final Map<String, Component> m_instances = new ConcurrentHashMap<String, Component>(); + private final Map<String, Component> m_instances = new ConcurrentHashMap<>(); private volatile DependencyManager m_manager; @@ -125,7 +125,7 @@ public class Activator extends Dependenc * @return a {@link Component} instance for the {@link DeploymentService}, never <code>null</code>. */ private Component createService(String ma) { - Dictionary<String, Object> deploymentProperties = new Hashtable<String, Object>(); + Dictionary<String, Object> deploymentProperties = new Hashtable<>(); String identificationFilter = "(" + Constants.OBJECTCLASS + "=" + Identification.class.getName() + ")"; String discoveryFilter = "(" + Constants.OBJECTCLASS + "=" + Discovery.class.getName() + ")"; Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/service/impl/DeploymentServiceImpl.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/service/impl/DeploymentServiceImpl.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/service/impl/DeploymentServiceImpl.java (original) +++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/service/impl/DeploymentServiceImpl.java Fri Jan 29 08:59:31 2016 @@ -66,7 +66,7 @@ public class DeploymentServiceImpl imple */ public Version getHighestLocalVersion() { Object[] installedPackages = m_deployer.list(); - List<Version> versions = new ArrayList<Version>(); + List<Version> versions = new ArrayList<>(); for (int i = 0; i < installedPackages.length; i++) { if (m_deployer.getName(installedPackages[i]).equals(m_identification.getID())) { versions.add(m_deployer.getVersion(installedPackages[i])); @@ -162,7 +162,7 @@ public class DeploymentServiceImpl imple * @return */ private Event createEvent(String version, URL dataURL) { - Dictionary<String, Object> properties = new Hashtable<String, Object>(); + Dictionary<String, Object> properties = new Hashtable<>(); properties.put("deploymentpackage.url", dataURL.toString()); properties.put("deploymentpackage.version", version); Event event = new Event(TOPIC_DEPLOYMENTPACKAGE_INSTALL, properties); @@ -215,7 +215,7 @@ public class DeploymentServiceImpl imple } final File[] files = file.listFiles(); - SortedSet<Version> versions = new TreeSet<Version>(); + SortedSet<Version> versions = new TreeSet<>(); for (File f : files) { try { Version version = Version.parseVersion(f.getName()); @@ -238,7 +238,7 @@ public class DeploymentServiceImpl imple BufferedReader bufReader = null; try { bufReader = new BufferedReader(new InputStreamReader(getContents(url))); - SortedSet<Version> versions = new TreeSet<Version>(); + SortedSet<Version> versions = new TreeSet<>(); String versionString; while ((versionString = bufReader.readLine()) != null) { Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java (original) +++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java Fri Jan 29 08:59:31 2016 @@ -296,7 +296,7 @@ public class AgentDeploymentServlet exte private List<Version> getVersionsFromOBR(URL obrBaseUrl, String agentID) throws XPathExpressionException, IOException { InputStream input = null; NodeList resources = getOBRNodeList(input); - List<Version> obrList = new ArrayList<Version>(); + List<Version> obrList = new ArrayList<>(); for (int nResource = 0; nResource < resources.getLength(); nResource++) { Node resource = resources.item(nResource); NamedNodeMap attr = resource.getAttributes(); Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java (original) +++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/DeploymentServlet.java Fri Jan 29 08:59:31 2016 @@ -68,7 +68,7 @@ public class DeploymentServlet extends H public static final String DP_MIMETYPE = "application/vnd.osgi.dp"; public static final String TEXT_MIMETYPE = "text/plain"; - private final ConcurrentMap<String, DeploymentProcessor> m_processors = new ConcurrentHashMap<String, DeploymentProcessor>(); + private final ConcurrentMap<String, DeploymentProcessor> m_processors = new ConcurrentHashMap<>(); // injected by Dependency Manager private volatile DependencyManager m_dm; Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/streamgenerator/impl/StreamGeneratorImpl.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/streamgenerator/impl/StreamGeneratorImpl.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/streamgenerator/impl/StreamGeneratorImpl.java (original) +++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/streamgenerator/impl/StreamGeneratorImpl.java Fri Jan 29 08:59:31 2016 @@ -106,7 +106,7 @@ public class StreamGeneratorImpl impleme m_readBuffer = new byte[bufferSize]; } - private static final ThreadLocal<SoftReference<DeploymentPackageStream>> m_cache = new ThreadLocal<SoftReference<DeploymentPackageStream>>(); + private static final ThreadLocal<SoftReference<DeploymentPackageStream>> m_cache = new ThreadLocal<>(); static DeploymentPackageStream createStreamForThread(ConnectionFactory connectionFactory, Manifest man, Iterator<ArtifactData> iter, boolean fixpack) throws IOException { SoftReference<DeploymentPackageStream> ref = m_cache.get(); @@ -117,7 +117,7 @@ public class StreamGeneratorImpl impleme if (dps == null) { dps = new DeploymentPackageStream(connectionFactory); - m_cache.set(new SoftReference<DeploymentPackageStream>(dps)); + m_cache.set(new SoftReference<>(dps)); } if (dps.isInUse()) { Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/task/Activator.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/task/Activator.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/task/Activator.java (original) +++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/task/Activator.java Fri Jan 29 08:59:31 2016 @@ -45,7 +45,7 @@ public class Activator extends Dependenc private static final String MA_NAME = "ma"; private static final String DEFAULT_INTERVAL = "5000"; - private final Map<String, List<Component>> m_instances = new HashMap<String, List<Component>>(); + private final Map<String, List<Component>> m_instances = new HashMap<>(); private volatile DependencyManager m_manager; @@ -126,9 +126,9 @@ public class Activator extends Dependenc * @return an array with {@link Component} instances for the different tasks, never <code>null</code>. */ private List<Component> createServices(String ma) { - Dictionary<String, Object> updateProperties = new Hashtable<String, Object>(); - Dictionary<String, Object> checkProperties = new Hashtable<String, Object>(); - Dictionary<String, Object> deploymentProperties = new Hashtable<String, Object>(); + Dictionary<String, Object> updateProperties = new Hashtable<>(); + Dictionary<String, Object> checkProperties = new Hashtable<>(); + Dictionary<String, Object> deploymentProperties = new Hashtable<>(); String updateSchedulerName = DeploymentUpdateTask.class.getName(); String updateDescription = "Task that synchronizes the artifacts (bundles, resources) installed on this target with the server."; @@ -155,7 +155,7 @@ public class Activator extends Dependenc deploymentProperties.put(MA_NAME, ma); } - List<Component> result = new ArrayList<Component>(); + List<Component> result = new ArrayList<>(); updateProperties.put(SchedulerConstants.SCHEDULER_NAME_KEY, updateSchedulerName); updateProperties.put(SchedulerConstants.SCHEDULER_DESCRIPTION_KEY, updateDescription); Modified: ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/util/test/TestProvider.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/util/test/TestProvider.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/util/test/TestProvider.java (original) +++ ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/util/test/TestProvider.java Fri Jan 29 08:59:31 2016 @@ -34,8 +34,8 @@ public class TestProvider implements Dep private List<String> m_versions; public TestProvider() throws Exception { - m_collection = new ArrayList<ArtifactData>(); - m_versions = new ArrayList<String>(); + m_collection = new ArrayList<>(); + m_versions = new ArrayList<>(); } public void addData(String fileName, String symbolicName, URL url, String version) { Modified: ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/provider/repositorybased/CacheTest.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/provider/repositorybased/CacheTest.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/provider/repositorybased/CacheTest.java (original) +++ ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/provider/repositorybased/CacheTest.java Fri Jan 29 08:59:31 2016 @@ -26,7 +26,7 @@ import org.testng.annotations.Test; public class CacheTest { @Test(groups = { UNIT }) public void testFillCacheToLimitAndCheckIfEverythingFits() { - LRUMap<String, String> map = new LRUMap<String, String>(); + LRUMap<String, String> map = new LRUMap<>(); for (int i = 0; i < 1024; i++) { String key = "" + i; map.put(key, key); @@ -39,7 +39,7 @@ public class CacheTest { @Test(groups = { UNIT }) public void testOverflowCacheAndValidateOldestElementDisappears() { - LRUMap<String, String> map = new LRUMap<String, String>(); + LRUMap<String, String> map = new LRUMap<>(); // add one too many for (int i = 0; i < 1025; i++) { String key = "" + i; Modified: ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProviderTest.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProviderTest.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProviderTest.java (original) +++ ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/provider/repositorybased/RepositoryBasedProviderTest.java Fri Jan 29 08:59:31 2016 @@ -179,13 +179,13 @@ public class RepositoryBasedProviderTest BUNDLE3_2 = generateBundle(FileUtils.createTempFile(m_tempDirectory), null, "Bundle3", "3.0.0", null); BUNDLE4_2 = generateBundle(FileUtils.createTempFile(m_tempDirectory), null, "Bundle4", "5.0.0", null); - Map<String, String> attr = new HashMap<String, String>(); + Map<String, String> attr = new HashMap<>(); attr.put(DIRECTIVE_ISCUSTOMIZER, "true"); RESOURCEPROCESSOR1 = generateBundle(FileUtils.createTempFile(m_tempDirectory), attr, "Autoconf", "1.0.0", null); - attr = new HashMap<String, String>(); + attr = new HashMap<>(); attr.put(DIRECTIVE_KEY_PROCESSORID, "my.processor.pid"); ARTIFACT1 = new ArtifactDataImpl(FileUtils.createTempFile(m_tempDirectory).toURI().toURL(), attr, false); - attr = new HashMap<String, String>(); + attr = new HashMap<>(); attr.put(DIRECTIVE_KEY_PROCESSORID, "my.processor.pid"); attr.put(DIRECTIVE_KEY_RESOURCE_ID, "Artifact2"); ARTIFACT2 = new ArtifactDataImpl(FileUtils.createTempFile(m_tempDirectory).toURI().toURL(), attr, false); Modified: ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/servlet/DeploymentServletTest.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/servlet/DeploymentServletTest.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/servlet/DeploymentServletTest.java (original) +++ ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/servlet/DeploymentServletTest.java Fri Jan 29 08:59:31 2016 @@ -349,7 +349,7 @@ public class DeploymentServletTest { @BeforeMethod(alwaysRun = true) protected void setUp() throws Exception { - final Map<String, List<String>> providerVersions = new HashMap<String, List<String>>(); + final Map<String, List<String>> providerVersions = new HashMap<>(); providerVersions.put("existing", Arrays.asList("2.0.0")); final ArtifactData artifactData = createMock(ArtifactData.class); @@ -501,7 +501,7 @@ public class DeploymentServletTest { m_generatorToVersion = null; m_responseStatus = HttpServletResponse.SC_OK; - m_responseHeaders = new HashMap<String, String>(); + m_responseHeaders = new HashMap<>(); m_requestRangeHeader = null; m_responseOutputStream = new ByteArrayOutputStream(); } Modified: ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/streamgenerator/impl/StreamTest.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/streamgenerator/impl/StreamTest.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/streamgenerator/impl/StreamTest.java (original) +++ ace/trunk/org.apache.ace.deployment/test/org/apache/ace/deployment/streamgenerator/impl/StreamTest.java Fri Jan 29 08:59:31 2016 @@ -228,7 +228,7 @@ public class StreamTest { assert att.getValue("DeploymentPackage-SymbolicName").equals("test"); assert att.getValue("DeploymentPackage-Version").equals("1.0.0"); assert (fixPackage && att.getValue("DeploymentPackage-FixPack").equals("[0.0.0,1.0.0)")) || (att.getValue("DeploymentPackage-FixPack") == null); - HashSet<String> names = new HashSet<String>(); + HashSet<String> names = new HashSet<>(); JarEntry e = jis.getNextJarEntry(); while (e != null) { String name = e.getName(); Modified: ace/trunk/org.apache.ace.discovery/src/org/apache/ace/discovery/property/Activator.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.discovery/src/org/apache/ace/discovery/property/Activator.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.discovery/src/org/apache/ace/discovery/property/Activator.java (original) +++ ace/trunk/org.apache.ace.discovery/src/org/apache/ace/discovery/property/Activator.java Fri Jan 29 08:59:31 2016 @@ -39,11 +39,11 @@ import org.osgi.service.log.LogService; public class Activator extends DependencyActivatorBase implements ManagedServiceFactory { private static final String MA_NAME = "ma"; - private final Map<String, Component> m_instances = new HashMap<String, Component>(); + private final Map<String, Component> m_instances = new HashMap<>(); private DependencyManager m_manager; public void init(BundleContext context, DependencyManager manager) throws Exception { - Dictionary<Object, Object> properties = new Hashtable<Object, Object>(); + Dictionary<Object, Object> properties = new Hashtable<>(); properties.put(Constants.SERVICE_PID, DiscoveryConstants.DISCOVERY_PID); manager.add(createComponent() @@ -71,7 +71,7 @@ public class Activator extends Dependenc return "Discovery Service Factory"; } - public void updated(String pid, Dictionary dict) throws ConfigurationException { + public void updated(String pid, Dictionary<String, ?> dict) throws ConfigurationException { String ma = (String) dict.get(MA_NAME); String id = (String) dict.get(DiscoveryConstants.DISCOVERY_URL_KEY); Modified: ace/trunk/org.apache.ace.discovery/src/org/apache/ace/discovery/property/PropertyBasedDiscovery.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.discovery/src/org/apache/ace/discovery/property/PropertyBasedDiscovery.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.discovery/src/org/apache/ace/discovery/property/PropertyBasedDiscovery.java (original) +++ ace/trunk/org.apache.ace.discovery/src/org/apache/ace/discovery/property/PropertyBasedDiscovery.java Fri Jan 29 08:59:31 2016 @@ -29,11 +29,10 @@ import org.osgi.service.cm.ManagedServic import org.osgi.service.log.LogService; /** - * Simple implementation of the <code>Discovery</code> interface. It 'discovers' - * the Provisioning Server by implementing the <code>ManagedService</code> and having the - * location configured by <code>ConfigurationAdmin</code>. If no configuration or a <code>null</code> - * configuration has been supplied by <code>ConfigurationAdmin</code> the location stored - * in <code>TargetConstants.DISCOVERY_DEFAULT_URL</code> will be used. + * Simple implementation of the <code>Discovery</code> interface. It 'discovers' the Provisioning Server by implementing + * the <code>ManagedService</code> and having the location configured by <code>ConfigurationAdmin</code>. If no + * configuration or a <code>null</code> configuration has been supplied by <code>ConfigurationAdmin</code> the location + * stored in <code>TargetConstants.DISCOVERY_DEFAULT_URL</code> will be used. */ public class PropertyBasedDiscovery implements Discovery, ManagedService { private final Object LOCK = new Object(); @@ -42,7 +41,7 @@ public class PropertyBasedDiscovery impl public PropertyBasedDiscovery() { } - + public PropertyBasedDiscovery(String url) { try { setURL(url); @@ -51,27 +50,26 @@ public class PropertyBasedDiscovery impl throw new IllegalArgumentException("Cannot create instance, invalid URL argument", e); } } - + public URL getURL() { synchronized (LOCK) { return m_serverURL; } } - + public void setURL(String id) throws MalformedURLException { setURL(new URL(id)); } - + public void setURL(URL id) { synchronized (LOCK) { m_serverURL = id; } } - - public synchronized void updated(Dictionary dictionary) throws ConfigurationException { + public synchronized void updated(Dictionary<String, ?> dictionary) throws ConfigurationException { try { - if(dictionary != null) { + if (dictionary != null) { setURL(new URL((String) dictionary.get(DiscoveryConstants.DISCOVERY_URL_KEY))); } } @@ -83,4 +81,4 @@ public class PropertyBasedDiscovery impl public synchronized URL discover() { return getURL(); } -} \ No newline at end of file +} Modified: ace/trunk/org.apache.ace.discovery/test/org/apache/ace/discovery/property/PropertyBasedDiscoveryTest.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.discovery/test/org/apache/ace/discovery/property/PropertyBasedDiscoveryTest.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.discovery/test/org/apache/ace/discovery/property/PropertyBasedDiscoveryTest.java (original) +++ ace/trunk/org.apache.ace.discovery/test/org/apache/ace/discovery/property/PropertyBasedDiscoveryTest.java Fri Jan 29 08:59:31 2016 @@ -39,7 +39,7 @@ public class PropertyBasedDiscoveryTest @Test(groups = { UNIT }) public void discoverWithPropertyUpdate() throws ConfigurationException, URISyntaxException { PropertyBasedDiscovery discovery = new PropertyBasedDiscovery(); - Dictionary<String, Object> dict = new Hashtable<String, Object>(); + Dictionary<String, Object> dict = new Hashtable<>(); dict.put(DiscoveryConstants.DISCOVERY_URL_KEY, "file://local"); discovery.updated(dict); URL url = discovery.discover(); Modified: ace/trunk/org.apache.ace.discovery/test/org/apache/ace/discovery/property/SimpleDiscoveryTest.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.discovery/test/org/apache/ace/discovery/property/SimpleDiscoveryTest.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.discovery/test/org/apache/ace/discovery/property/SimpleDiscoveryTest.java (original) +++ ace/trunk/org.apache.ace.discovery/test/org/apache/ace/discovery/property/SimpleDiscoveryTest.java Fri Jan 29 08:59:31 2016 @@ -49,7 +49,7 @@ public class SimpleDiscoveryTest { */ @Test(groups = { UNIT }) public void simpleDiscoveryValidConfiguration() throws ConfigurationException { - Dictionary<String, String> properties = new Hashtable<String, String>(); + Dictionary<String, String> properties = new Hashtable<>(); properties.put(SERVERURL_KEY, VALID_URL); m_discovery.updated(properties); URL url = m_discovery.discover(); @@ -62,7 +62,7 @@ public class SimpleDiscoveryTest { */ @Test(groups = {UNIT}, expectedExceptions = ConfigurationException.class) public void simpleDiscoveryInvalidConfiguration() throws ConfigurationException { - Dictionary<String, String> properties = new Hashtable<String, String>(); + Dictionary<String, String> properties = new Hashtable<>(); properties.put(SERVERURL_KEY, INVALID_URL); m_discovery.updated(properties); } @@ -74,7 +74,7 @@ public class SimpleDiscoveryTest { @Test(groups = {UNIT}) public void simpleDiscoveryEmptyConfiguration() throws ConfigurationException { // set valid config - Dictionary<String, String> properties = new Hashtable<String, String>(); + Dictionary<String, String> properties = new Hashtable<>(); properties.put(SERVERURL_KEY, VALID_URL); m_discovery.updated(properties); // set empty config Modified: ace/trunk/org.apache.ace.feedback.common/src/org/apache/ace/feedback/Event.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.feedback.common/src/org/apache/ace/feedback/Event.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.feedback.common/src/org/apache/ace/feedback/Event.java (original) +++ ace/trunk/org.apache.ace.feedback.common/src/org/apache/ace/feedback/Event.java Fri Jan 29 08:59:31 2016 @@ -30,7 +30,7 @@ import org.apache.ace.feedback.util.Code /** * Event from specific target (in a specific store). */ -public class Event implements Comparable { +public class Event implements Comparable<Object> { private final String m_targetID; private final long m_storeID; private final long m_id; @@ -57,7 +57,7 @@ public class Event implements Comparable m_id = id; m_time = time; m_type = type; - m_properties = new HashMap<String, String>(); + m_properties = new HashMap<>(); Enumeration<String> keys = dictionary.keys(); while (keys.hasMoreElements()) { @@ -82,7 +82,7 @@ public class Event implements Comparable m_id = Long.parseLong(st.nextToken()); m_time = Long.parseLong(st.nextToken()); m_type = Integer.parseInt(st.nextToken()); - m_properties = new HashMap<String, String>(); + m_properties = new HashMap<>(); while (st.hasMoreTokens()) { m_properties.put(st.nextToken(), Codec.decode(st.nextToken())); } Modified: ace/trunk/org.apache.ace.feedback.common/test/org/apache/ace/feedback/EventTest.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.feedback.common/test/org/apache/ace/feedback/EventTest.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.feedback.common/test/org/apache/ace/feedback/EventTest.java (original) +++ ace/trunk/org.apache.ace.feedback.common/test/org/apache/ace/feedback/EventTest.java Fri Jan 29 08:59:31 2016 @@ -107,7 +107,7 @@ public class EventTest { } private Dictionary<String, String> createDict(String... entries) { - Dictionary<String, String> result = new Hashtable<String, String>(); + Dictionary<String, String> result = new Hashtable<>(); for (int i = 0; i < entries.length; i += 2) { result.put(entries[i], entries[i + 1]); } @@ -115,7 +115,7 @@ public class EventTest { } private Map<String, String> createMap(String... entries) { - Map<String, String> result = new HashMap<String, String>(); + Map<String, String> result = new HashMap<>(); for (int i = 0; i < entries.length; i += 2) { result.put(entries[i], entries[i + 1]); } Modified: ace/trunk/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/ScriptServlet.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/ScriptServlet.java?rev=1727499&r1=1727498&r2=1727499&view=diff ============================================================================== --- ace/trunk/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/ScriptServlet.java (original) +++ ace/trunk/org.apache.ace.gogo.servlet/src/org/apache/ace/gogo/servlet/ScriptServlet.java Fri Jan 29 08:59:31 2016 @@ -72,7 +72,7 @@ public class ScriptServlet extends HttpS protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String script = getAsString(req.getInputStream()); req.getInputStream(); - Dictionary<String, String> scriptDefinition = new Hashtable<String, String>(); + Dictionary<String, String> scriptDefinition = new Hashtable<>(); scriptDefinition.put(SCRIPT_KEY, script); respondToScriptRequest(resp, scriptDefinition); } @@ -131,7 +131,7 @@ public class ScriptServlet extends HttpS } private Dictionary<String, String> toDictionary(Map<String, ?> map) { - Dictionary<String, String> result = new Hashtable<String, String>(); + Dictionary<String, String> result = new Hashtable<>(); for (Map.Entry<String, ?> entry : map.entrySet()) { result.put(entry.getKey(), toString(entry.getValue())); }
