repository restructure
git-svn-id: http://dev.eclipse.org/svnroot/technology/org.eclipse.stem/trunk/data@2194 92a21009-5b66-0410-b83a-dc787c41c6e9
diff --git a/population/org.eclipse.stem.internal.data.geography.population.human.models/.classpath b/population/org.eclipse.stem.internal.data.geography.population.human.models/.classpath
new file mode 100644
index 0000000..304e861
--- /dev/null
+++ b/population/org.eclipse.stem.internal.data.geography.population.human.models/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/population/org.eclipse.stem.internal.data.geography.population.human.models/.cvsignore b/population/org.eclipse.stem.internal.data.geography.population.human.models/.cvsignore
new file mode 100644
index 0000000..9c595a6
--- /dev/null
+++ b/population/org.eclipse.stem.internal.data.geography.population.human.models/.cvsignore
@@ -0,0 +1 @@
+temp
diff --git a/population/org.eclipse.stem.internal.data.geography.population.human.models/.project b/population/org.eclipse.stem.internal.data.geography.population.human.models/.project
new file mode 100644
index 0000000..744c012
--- /dev/null
+++ b/population/org.eclipse.stem.internal.data.geography.population.human.models/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.stem.internal.data.geography.population.human.models</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/population/org.eclipse.stem.internal.data.geography.population.human.models/.settings/org.eclipse.jdt.core.prefs b/population/org.eclipse.stem.internal.data.geography.population.human.models/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..3a812aa
--- /dev/null
+++ b/population/org.eclipse.stem.internal.data.geography.population.human.models/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,21 @@
+#Tue Sep 01 17:01:23 EDT 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.doc.comment.support=disabled
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/population/org.eclipse.stem.internal.data.geography.population.human.models/META-INF/MANIFEST.MF b/population/org.eclipse.stem.internal.data.geography.population.human.models/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..727cca1
--- /dev/null
+++ b/population/org.eclipse.stem.internal.data.geography.population.human.models/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: STEM Internal Population Models
+Bundle-SymbolicName: org.eclipse.stem.internal.data.geography.population.human.models
+Bundle-Version: 1.2.0
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.stem.core,
+ org.eclipse.stem.definitions,
+ org.eclipse.stem.data.geography,
+ org.eclipse.stem.data.geography.models,
+ org.eclipse.stem.internal.data,
+ org.eclipse.stem.internal.data.geography,
+ org.eclipse.stem.internal.data.geography.models,
+ org.eclipse.stem.data.geography.population.human,
+ org.eclipse.stem.data.geography.population.human.models
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-Vendor: Eclipse.org
diff --git a/population/org.eclipse.stem.internal.data.geography.population.human.models/build.properties b/population/org.eclipse.stem.internal.data.geography.population.human.models/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/population/org.eclipse.stem.internal.data.geography.population.human.models/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/population/org.eclipse.stem.internal.data.geography.population.human.models/src/org/eclipse/stem/internal/data/geography/population/human/models/PopulationModelGenerator.java b/population/org.eclipse.stem.internal.data.geography.population.human.models/src/org/eclipse/stem/internal/data/geography/population/human/models/PopulationModelGenerator.java
new file mode 100644
index 0000000..a1f7163
--- /dev/null
+++ b/population/org.eclipse.stem.internal.data.geography.population.human.models/src/org/eclipse/stem/internal/data/geography/population/human/models/PopulationModelGenerator.java
@@ -0,0 +1,229 @@
+// PopulationModelGenerator.java
+package org.eclipse.stem.internal.data.geography.population.human.models;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.stem.core.Constants;
+import org.eclipse.stem.data.geography.ISOKey;
+import org.eclipse.stem.internal.data.ModelGenerator;
+import org.eclipse.stem.internal.data.PluginFileGenerator;
+import org.eclipse.stem.internal.data.generatedplugin.DublinCore;
+import org.eclipse.stem.internal.data.generatedplugin.Extension;
+import org.eclipse.stem.internal.data.generatedplugin.GeneratedpluginFactory;
+import org.eclipse.stem.internal.data.generatedplugin.Plugin;
+import org.eclipse.stem.internal.data.generatedplugin.StemCategory;
+import org.eclipse.stem.internal.data.geography.models.GeographyModelGenerator;
+import org.eclipse.stem.internal.data.geography.specifications.AdminLevel;
+import org.eclipse.stem.internal.data.geography.specifications.AdminLevelSet;
+import org.eclipse.stem.internal.data.geography.specifications.CountryGraphPropertyFileSpecification;
+import org.eclipse.stem.internal.data.specifications.ModelSpecification;
+
+/**
+ * This class is responsible for generating population models.
+ */
+public class PopulationModelGenerator extends GeographyModelGenerator {
+ /**
+ * @param args
+ * the URI of the generated geography plugin.xml file
+ */
+ public static void main(final String[] args) {
+ // Is the plugin file specified?
+ if (args.length == 0) {
+ // Yes
+ System.err.println("Missing specification of the plugin file"); //$NON-NLS-1$
+ } // if
+ else {
+
+ final String GENERATED_FILES_PATH = args[0];
+ final String sourceGeographicModelProjecName = args[1];
+ final String sourcePopulationProjectName = args[2];
+
+ final String GENERATED_MODELS_PATH = GENERATED_FILES_PATH
+ + File.separator + "resources" + File.separator + "data"; //$NON-NLS-1$ //$NON-NLS-2$
+
+ final File geographicModelPluginfile = new File(
+ ".." + File.separator + sourceGeographicModelProjecName + File.separator + PluginFileGenerator.PLUGIN_XML_FILE_NAME); //$NON-NLS-1$
+ final URI geographicModelPluginFileURI = URI
+ .createFileURI(geographicModelPluginfile.getAbsolutePath());
+
+ final File populationPluginfile = new File(
+ ".." + File.separator + sourcePopulationProjectName + File.separator + PluginFileGenerator.PLUGIN_XML_FILE_NAME); //$NON-NLS-1$
+ final URI populationPluginFileURI = URI
+ .createFileURI(populationPluginfile.getAbsolutePath());
+
+ final PopulationModelGenerator pmg = new PopulationModelGenerator();
+ final Map<ISOKey, List<PopulationModelSpecification>> modelSpecifications = pmg
+ .processFiles(geographicModelPluginFileURI,
+ populationPluginFileURI);
+
+ for (final ISOKey isoKey : sortISOKeys(modelSpecifications)) {
+ // Now serialize the Identifiables
+ for (final ModelSpecification gms : modelSpecifications
+ .get(isoKey)) {
+ try {
+ gms.serialize(GENERATED_MODELS_PATH);
+ } catch (final IOException e) {
+ e.printStackTrace();
+ }
+ } // for
+ } // for isoKey
+
+ // Create the instance of plugin.xml that we'll serialize later
+ final Plugin pluginxml = GeneratedpluginFactory.eINSTANCE
+ .createPlugin();
+ final Extension extension = GeneratedpluginFactory.eINSTANCE
+ .createExtension();
+
+ // Add the "model" extension point
+ extension.setPoint(Constants.ID_MODEL_EXTENSION_POINT);
+
+ // Add the categories to the extension
+// addCatagoriesToExtension(extension);
+
+ pluginxml.getExtensionelement().add(extension);
+
+ // Now add the dublin core entries to the plugin.xml file for
+ // each of the models
+ for (final ISOKey isoKey : sortISOKeys(modelSpecifications)) {
+ final StemCategory countryCategory = GeneratedpluginFactory.eINSTANCE
+ .createStemCategory();
+ final String COUNTRY_CATAGORY_STRING = ID_MODEL_GEOGRAPHY_POLITICAL_COUNTRIES_CATEGORY
+ + "." + isoKey.toString().toLowerCase(); //$NON-NLS-1$
+ countryCategory.setId(COUNTRY_CATAGORY_STRING);
+ countryCategory.setName(isoKey.toString());
+ countryCategory
+ .setParentId(ID_MODEL_GEOGRAPHY_POLITICAL_COUNTRIES_CATEGORY);
+// extension.getCategories().add(countryCategory);
+ for (final ModelSpecification gms : modelSpecifications
+ .get(isoKey)) {
+ final DublinCore dc = GeneratedpluginFactory.eINSTANCE
+ .createDublinCore();
+ dc.setCategoryId(COUNTRY_CATAGORY_STRING);
+ extension.getDublinCores().add(
+ populateGeneratedDC(dc, gms.getDublinCore()));
+ } // for
+ } // for isoKey
+
+ final URI TEMP_PLUGINXML_URI = URI
+ .createFileURI(GENERATED_FILES_PATH + File.separator
+ + PluginFileGenerator.PLUGIN_XML_FILE_NAME);
+
+ // Serialize the plugin.xml file.
+ ModelGenerator.writePluginxml(pluginxml, TEMP_PLUGINXML_URI);
+
+ // Create the plugin.properties file
+ createPluginPropertties(GENERATED_FILES_PATH);
+
+ } // else
+ } // main
+
+ protected Map<ISOKey, List<PopulationModelSpecification>> processFiles(
+ URI geographicModelPluginFileUri, URI populationPluginFileUri) {
+ final Map<ISOKey, List<PopulationModelSpecification>> retValue = new HashMap<ISOKey, List<PopulationModelSpecification>>();
+
+ // Get the contents of the geography model plug.xml file
+ final Plugin geographyModelsPlugin = getPluginxml(geographicModelPluginFileUri);
+
+ final Plugin populationGraphsPlugin = getPluginxml(populationPluginFileUri);
+
+ final HashMap<ISOKey, Map<AdminLevelSet, DublinCore>> modelMap = new HashMap<ISOKey, Map<AdminLevelSet, DublinCore>>();
+ final Map<ISOKey, Map<AdminLevel, DublinCore>> populationMap = new HashMap<ISOKey, Map<AdminLevel, DublinCore>>();
+
+ for (Extension extension : geographyModelsPlugin.getExtensionelement()) {
+ for (DublinCore dc : extension.getDublinCores()) {
+ final Map<ISOKey, AdminLevelSet> isoKeyAdminLevelSetMap = CountryGraphPropertyFileSpecification
+ .parseDublinCoreCoverageString(dc.getCoverage());
+ final AdminLevelSet adminLevelSet = (AdminLevelSet) isoKeyAdminLevelSetMap
+ .values().toArray()[0];
+ final ISOKey isoKey = (ISOKey) isoKeyAdminLevelSetMap.keySet()
+ .toArray()[0];
+
+ Map<AdminLevelSet, DublinCore> temp = modelMap.get(isoKey);
+ if (temp == null) {
+ temp = new HashMap<AdminLevelSet, DublinCore>();
+ modelMap.put(isoKey, temp);
+ }
+ temp.put(adminLevelSet, dc);
+ } // for
+ } // for Geography Models
+
+ // for (ISOKey isoKey : sortISOKeys(modelMap)) {
+ // for (AdminLevel adminLevel : modelMap.get(isoKey).keySet() ) {
+ // System.out.println( isoKey + " " + adminLevel + " " +
+ // modelMap.get(isoKey).get(adminLevel).getIdentifier());
+ // }
+ // }
+
+ for (Extension extension : populationGraphsPlugin.getExtensionelement()) {
+ for (DublinCore dc : extension.getDublinCores()) {
+ final Map<ISOKey, AdminLevelSet> isoKeyAdminLevelSetMap = CountryGraphPropertyFileSpecification
+ .parseDublinCoreCoverageString(dc.getCoverage());
+ final AdminLevelSet adminLevelSet = (AdminLevelSet) isoKeyAdminLevelSetMap
+ .values().toArray()[0];
+ final AdminLevel maxAdminLevel = adminLevelSet
+ .getMaxAdminLevel();
+ final ISOKey isoKey = (ISOKey) isoKeyAdminLevelSetMap.keySet()
+ .toArray()[0];
+
+ Map<AdminLevel, DublinCore> temp = populationMap.get(isoKey);
+ if (temp == null) {
+ temp = new HashMap<AdminLevel, DublinCore>();
+ populationMap.put(isoKey, temp);
+ }
+ temp.put(maxAdminLevel, dc);
+ }
+ } // for Population Graphs
+
+ // for (ISOKey isoKey : sortISOKeys(populuationMap)) {
+ // for (AdminLevel adminLevel : populuationMap.get(isoKey).keySet() ) {
+ // System.out.println( isoKey + " " + adminLevel + " " +
+ // populuationMap.get(isoKey).get(adminLevel).getIdentifier());
+ // }
+ // }
+
+ for (ISOKey isoKey : sortISOKeys(modelMap)) {
+ final List<PopulationModelSpecification> gmsList = new ArrayList<PopulationModelSpecification>();
+
+ final Map<AdminLevelSet, DublinCore> adminSetDCMap = modelMap
+ .get(isoKey);
+ for (AdminLevelSet adminLevelSet : adminSetDCMap.keySet()) {
+ final AdminLevel maxAdminLevel = adminLevelSet
+ .getMaxAdminLevel();
+
+ final DublinCore countryGeographicModelDC = adminSetDCMap
+ .get(adminLevelSet);
+
+ final Map<AdminLevel, DublinCore> adminDCMap = populationMap
+ .get(isoKey);
+ DublinCore populationGraphDC = adminDCMap.get(maxAdminLevel);
+ final PopulationModelSpecification temp = new PopulationModelSpecification(
+ isoKey, adminLevelSet, countryGeographicModelDC,
+ populationGraphDC);
+
+ gmsList.add(temp);
+ } // for adminLevel
+ retValue.put(isoKey, gmsList);
+ } // for each isoKey
+
+ return retValue;
+ } // processFiles
+
+} // PopulationModelGenerator
\ No newline at end of file
diff --git a/population/org.eclipse.stem.internal.data.geography.population.human.models/src/org/eclipse/stem/internal/data/geography/population/human/models/PopulationModelSpecification.java b/population/org.eclipse.stem.internal.data.geography.population.human.models/src/org/eclipse/stem/internal/data/geography/population/human/models/PopulationModelSpecification.java
new file mode 100644
index 0000000..b09c40c
--- /dev/null
+++ b/population/org.eclipse.stem.internal.data.geography.population.human.models/src/org/eclipse/stem/internal/data/geography/population/human/models/PopulationModelSpecification.java
@@ -0,0 +1,223 @@
+// PopulationModelSpecification.java
+package org.eclipse.stem.internal.data.geography.population.human.models;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import java.io.File;
+import java.util.Map;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+import org.eclipse.stem.core.Utility;
+import org.eclipse.stem.core.graph.Graph;
+import org.eclipse.stem.core.model.Model;
+import org.eclipse.stem.core.model.ModelPackage;
+import org.eclipse.stem.data.geography.ISOKey;
+import org.eclipse.stem.definitions.labels.LabelsPackage;
+import org.eclipse.stem.internal.data.generatedplugin.DublinCore;
+import org.eclipse.stem.internal.data.geography.specifications.AdminLevelSet;
+import org.eclipse.stem.internal.data.geography.specifications.CountryGraphPropertyFileSpecification;
+import org.eclipse.stem.internal.data.specifications.GraphPropertyFileSpecification;
+import org.eclipse.stem.internal.data.specifications.ModelSpecification;
+
+/**
+ * This class represents a {@link ModelSpecification} for a Population model.
+ */
+public class PopulationModelSpecification extends ModelSpecification implements
+ Comparable<PopulationModelSpecification> {
+
+ /**
+ * This is referenced to cause the {@link ModelPackage} to register itself
+ * as a package.
+ */
+ @SuppressWarnings("unused")
+ private final ModelPackage modelPackage = ModelPackage.eINSTANCE;
+ @SuppressWarnings("unused")
+ private final LabelsPackage labelsPackage = LabelsPackage.eINSTANCE;
+
+ private final ISOKey isoKey;
+ private final AdminLevelSet adminLevelSet;
+ private final DublinCore countryGeographicModelDC;
+ private final DublinCore populationGraphDC;
+
+ static {
+ // This sets up the mapping between the "platform" URI's and the
+ // projects in the file system.
+
+ // CWD is the current working directory
+ final String CWD = System.getProperty("user.dir"); //$NON-NLS-1$
+ // WORKSPACE is the directory of the parent workspace
+ final String WORKSPACE = CWD.substring(0, CWD
+ .lastIndexOf(File.separator));
+
+ // The path to the generated geography data project
+ final String GEOGRAPHY_MODELS_PROJECT_ROOT = WORKSPACE
+ + File.separator
+ + org.eclipse.stem.data.geography.models.Activator.PLUGIN_ID
+ + File.separator;
+
+ // The path to the generated population data project
+ final String HUMAN_POPULATION_GRAPHS_PROJECT_ROOT = WORKSPACE
+ + File.separator
+ + org.eclipse.stem.data.geography.population.human.Activator.PLUGIN_ID
+ + File.separator;
+
+ final Map<String, URI> platformResourceMap = EcorePlugin
+ .getPlatformResourceMap();
+
+ // Register the mapping between the project id and the absolute path to
+ // the project in the file system. This will be found later when
+ // deserializing when the platform URI is mapped.
+ platformResourceMap.put(
+ org.eclipse.stem.data.geography.models.Activator.PLUGIN_ID,
+ URI.createFileURI(GEOGRAPHY_MODELS_PROJECT_ROOT));
+
+ platformResourceMap
+ .put(
+ org.eclipse.stem.data.geography.population.human.Activator.PLUGIN_ID,
+ URI.createFileURI(HUMAN_POPULATION_GRAPHS_PROJECT_ROOT));
+ } // static
+
+ /**
+ * @param isoKey
+ * the {@link ISOKey} of the country the population model is for.
+ * @param adminLevelSet
+ * the administration levels covered in the model
+ * @param countryGeographicModelDC
+ * @param populationGraphDC
+ */
+ public PopulationModelSpecification(ISOKey isoKey,
+ AdminLevelSet adminLevelSet, DublinCore countryGeographicModelDC,
+ DublinCore populationGraphDC) {
+ this.isoKey = isoKey;
+ this.adminLevelSet = adminLevelSet;
+ this.countryGeographicModelDC = countryGeographicModelDC;
+ this.populationGraphDC = populationGraphDC;
+ } // PopulationModelSpecification
+
+ /**
+ * @see org.eclipse.stem.internal.data.specifications.ModelSpecification#createIdentifiableInstance()
+ */
+ @Override
+ protected Model createIdentifiableInstance() {
+ final Model retValue = super.createIdentifiableInstance();
+ // The generated Graphs etc., all have dublin core that references
+ // them as plugins. This is as it should be when STEM is running,
+ // but right now we're running stand-alone and want to access the
+ // plugins as projects (they aren't plugged into our running version
+ // of Eclipse). Substitute "resource" for "plugin" in the URI's we
+ // use and all will be well.
+
+ retValue
+ .getModels()
+ .add(
+ (Model) Utility
+ .getIdentifiable(getIdentifiableProjectURI(countryGeographicModelDC)));
+
+ retValue
+ .getGraphs()
+ .add(
+ (Graph) Utility
+ .getIdentifiable(getIdentifiableProjectURI(populationGraphDC)));
+
+ return retValue;
+ } // createIdentifiableInstance
+
+ /**
+ * @see org.eclipse.stem.internal.data.specifications.IdentifiableSpecification#getRelativeSerializationPath()
+ */
+ @Override
+ protected String getRelativeSerializationPath() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append(CountryGraphPropertyFileSpecification.COUNTRY_DIR);
+ sb.append(File.separatorChar);
+ sb.append(getISOKey().toString());
+ return sb.toString();
+ }
+
+ /**
+ * @see org.eclipse.stem.internal.data.specifications.IdentifiableSpecification#getSerializationFileNameRoot()
+ */
+ @Override
+ protected String getSerializationFileNameRoot() {
+ final StringBuilder sb = new StringBuilder(getISOKey().toString());
+ sb.append("_"); //$NON-NLS-1$
+ sb.append(adminLevelSet.toString());
+ sb.append("_population"); //$NON-NLS-1$
+ return sb.toString();
+ }
+
+ /**
+ * @see org.eclipse.stem.internal.data.specifications.IdentifiableSpecification#getTargetPluginId()
+ */
+ @Override
+ protected String getTargetPluginId() {
+ return org.eclipse.stem.data.geography.population.human.models.Activator.PLUGIN_ID;
+ }
+
+ /**
+ * @see org.eclipse.stem.internal.data.specifications.IdentifiableSpecification#getTitleDescriptor()
+ */
+ @Override
+ protected String getTitleDescriptor() {
+ final StringBuilder sb = new StringBuilder(isoKey.toString());
+ sb.append(" Human Population"); //$NON-NLS-1$
+ sb
+ .append(adminLevelSet.getNumAdminLevels() > 1 ? " (Levels: " : " (Level: "); //$NON-NLS-1$ //$NON-NLS-2$
+ sb.append(adminLevelSet.toString(",")); //$NON-NLS-1$
+ sb.append(")"); //$NON-NLS-1$
+ return sb.toString();
+ } // getTitleDescriptor
+
+ /**
+ * @see org.eclipse.stem.internal.data.specifications.IdentifiableSpecification#createDubinCoreCoverage()
+ */
+ @Override
+ protected String createDubinCoreCoverage() {
+ return countryGeographicModelDC.getCoverage();
+ } // createDubinCoreCoverage
+
+ /**
+ * @see org.eclipse.stem.internal.data.specifications.IdentifiableSpecification#createDubinCoreSubject()
+ */
+ @Override
+ protected String createDubinCoreSubject() {
+ return GraphPropertyFileSpecification.createDublinCoreSubjectString(
+ ModelPackage.Literals.MODEL.getName(), "population"); //$NON-NLS-1$
+ }
+
+ /**
+ * @return the isoKey
+ */
+ public ISOKey getISOKey() {
+ return isoKey;
+ }
+
+ public int compareTo(PopulationModelSpecification pms) {
+ return adminLevelSet.getNumAdminLevels() > pms.adminLevelSet
+ .getNumAdminLevels() ? 1 : -1;
+
+ } // compareTo
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append(isoKey);
+ sb.append(":"); //$NON-NLS-1$
+ sb.append(adminLevelSet.toString());
+ return sb.toString();
+ } // toString
+
+} // PopulationModelSpecification
\ No newline at end of file
diff --git a/population/org.eclipse.stem.internal.data.geography.population.human.models/update.xml b/population/org.eclipse.stem.internal.data.geography.population.human.models/update.xml
new file mode 100644
index 0000000..c7a69bd
--- /dev/null
+++ b/population/org.eclipse.stem.internal.data.geography.population.human.models/update.xml
@@ -0,0 +1,161 @@
+<?xml version="1.0"?>
+<!-- ======================================================================
+ ANT script to build org.eclispe.ohf.stem.geography project
+ and the initial set of STEM scenarios.
+ This must be run after installing the STEM workspace and after changes
+ to code generated by EMF models.
+
+ ====================================================================== -->
+<project name="STEM Internal Human Population Models" default="update_all">
+ <description>
+ Use the properties files to populate the org.eclipse.stem.data.geography.population.human.models plugin
+ </description>
+
+ <!-- P r o j e c t S p e c i f i c a t i o n s -->
+
+ <!-- The name of the project -->
+ <property name="project.name" value="stem" />
+
+
+ <!-- Are we running headless? -->
+ <condition property="runningHeadless" >
+ <isset property="buildDirectory" />
+ </condition>
+
+ <!-- The buildDirectory property is set in a headless build -->
+ <condition property="pluginRootDirectory" value="${buildDirectory}/plugins" else="..">
+ <isset property="runningHeadless" />
+ </condition>
+
+ <!-- The baseLocation property is the location of the eclipse home installation -->
+ <!-- It is used to find eclipse plugins -->
+ <!-- It is set in a headless build, but not one started manually from Eclipse -->
+ <condition property="baseLocation" value="${eclipse.pdebuild.home}../..">
+ <not>
+ <isset property="runningHeadless" />
+ </not>
+ </condition>
+
+ <!-- This is the location of the class files of the built plug-ins -->
+ <!-- If this is a manual build started from Eclipse then the directory -->
+ <!-- is "bin", if its a headless build then the directory is "@dot" -->
+ <!-- The property baseLocation is set in a headless build -->
+ <condition property="targetBin" value="@dot" else="bin">
+ <isset property="runningHeadless" />
+ </condition>
+
+
+ <!-- The prefix for fully qualified names -->
+ <property name="ID_ROOT" value="org.eclipse.stem" />
+
+ <!-- The name of the plugin that contains the plugin.xml file to scan -->
+ <property name="scan.plugin" value="${ID_ROOT}.data.geography.models" />
+
+ <!-- The name of the plugin that contains the plugin.xml file to scan -->
+ <property name="population.plugin" value="${ID_ROOT}.data.geography.population.human" />
+
+ <!-- The name of the source plugin (i.e., the one that contains this file -->
+ <property name="source.plugin" value="${ID_ROOT}.internal.data.geography.population.human.models" />
+
+ <!-- The name of the target plugin -->
+ <property name="target.plugin" value="${ID_ROOT}.data.geography.population.human.models" />
+
+ <!-- The path to the root directory of the source plugin -->
+ <property name="path.sourceplugin" location="${pluginRootDirectory}/${source.plugin}" />
+
+ <!-- The path to the root directory of the plugin that will be augmented with generated content -->
+ <property name="path.targetplugin" location="${pluginRootDirectory}/${target.plugin}" />
+
+ <!-- The path to the root directory of the resource files -->
+ <property name="path.resource.files" value="${path.sourceplugin}/resources/data/country" />
+
+ <!-- The path to the root directory of the plugin that will be augmented with generated content-->
+ <property name="path.generated.files" value="${path.sourceplugin}/temp" />
+
+ <!-- The path to the root directory of geography source code -->
+ <property name="path.geography.src" value="${path.targetplugin}/src/org/eclipse/stem/data/geography/population/human/models" />
+
+ <!-- The name of the plugin.xml file that will be augmented with generated content-->
+ <property name="file.target.pluginxml" value="${path.targetplugin}/plugin.xml" />
+
+ <!-- The name of the plugin.properties file that will be augmented with generated content-->
+ <property name="file.target.pluginproperties" value="${path.targetplugin}/plugin.properties" />
+
+ <!-- The name of the plugin.xml file that that is the aggregation of the generated content-->
+ <property name="file.util.pluginxml" value="${path.generated.files}/plugin.xml" />
+
+ <!-- The name of the plugin.properties file that that is the aggregation of the generated content-->
+ <property name="file.util.pluginproperties" value="${path.generated.files}/plugin.properties" />
+
+ <!-- The name of the plugin.xml file that that is the aggregation of the generated content-->
+ <property name="file.target.pluginproperties" value="${path.generated.files}/plugin.properties" />
+
+ <!-- The class path to use -->
+ <path id="classpath.runtime">
+ <pathelement location="${path.sourceplugin}/${targetBin}" />
+ <pathelement location="${pluginRootDirectory}/${ID_ROOT}.core/${targetBin}" />
+ <pathelement location="${pluginRootDirectory}/${ID_ROOT}.definitions/${targetBin}" />
+ <pathelement location="${pluginRootDirectory}/${ID_ROOT}.internal.data/${targetBin}" />
+ <pathelement location="${pluginRootDirectory}/${ID_ROOT}.internal.data.geography/${targetBin}" />
+ <pathelement location="${pluginRootDirectory}/${ID_ROOT}.internal.data.geography.models/${targetBin}" />
+ <pathelement location="${pluginRootDirectory}/${ID_ROOT}.data.geography/${targetBin}" />
+ <fileset dir="${baseLocation}/plugins/">
+ <include name="*emf*.jar" />
+ </fileset>
+ <fileset dir="${pluginRootDirectory}/${ID_ROOT}.internal.data/lib/">
+ <include name="*emf*.jar" />
+ </fileset>
+ </path>
+
+ <target name="update_all" depends="update_geography" />
+
+ <!-- Update the geography plugin with the latest definitions -->
+ <target name="update_geography" depends="update_population_models, update_population_plugin_xml, update_population_plugin_properties" />
+
+ <target name="update_population_plugin_xml" depends="create_candidates">
+ <copy tofile="${file.target.pluginxml}" file="${file.util.pluginxml}" overwrite="true" />
+ </target>
+
+ <target name="update_population_plugin_properties" depends="create_candidates">
+ <copy tofile="${file.target.pluginproperties}" file="${file.util.pluginproperties}" overwrite="true" />
+ </target>
+
+ <!-- Update the graph files in the geography plugin -->
+ <target name="update_population_models" depends="create_candidates">
+ <copy todir="${path.targetplugin}/resources/data/" overwrite="true">
+ <fileset dir="${path.generated.files}/resources/data">
+ <include name="**/*.model" />
+ </fileset>
+ </copy>
+ </target>
+
+ <!-- Create the model files for countries and the plugin.xml and plugin.properties fragments -->
+ <target name="create_candidates" depends="clean">
+ <!-- There is a problem here with specifying fork="true" maxmemory="768m". It causes an IOException on some machines -->
+ <java classname="${ID_ROOT}.internal.data.geography.population.human.models.PopulationModelGenerator" fork="true" maxmemory="1024m">
+ <classpath refid="classpath.runtime" />
+ <arg value="${path.generated.files}" />
+ <arg value="${scan.plugin}" />
+ <arg value="${population.plugin}" />
+ <jvmarg value="-Xms1024m"/>
+ <jvmarg value="-Xmx1024m"/>
+ </java>
+ </target>
+
+ <!-- clean out the .../temp/data directories -->
+ <!-- clean out the target directories -->
+ <target name="clean" depends="create_generated_files_dir">
+ <delete includeEmptyDirs="true" quiet="true">
+ <fileset dir="${path.generated.files}/">
+ <include name="**/*" />
+ </fileset>
+ <fileset dir="${path.targetplugin}/resources/data/">
+ <include name="country/**/*" />
+ </fileset>
+ </delete>
+ </target>
+
+ <target name="create_generated_files_dir">
+ <mkdir dir="${path.generated.files}/resources/data"/>
+ </target>
+</project>