Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Knauer2007-10-22 13:15:56 +0000
committerMarkus Knauer2007-10-22 13:15:56 +0000
commit604a37a3aa4d5523e3c0f4561740ebc5b63cc31b (patch)
tree91b62c113d23bf2d7d1fc7372192fcd36ae91945 /plugins
parent1ac42e1f54d1577ab0086acb3399aae6d67f8c77 (diff)
downloadorg.eclipse.epp.packages-604a37a3aa4d5523e3c0f4561740ebc5b63cc31b.tar.gz
org.eclipse.epp.packages-604a37a3aa4d5523e3c0f4561740ebc5b63cc31b.tar.xz
org.eclipse.epp.packages-604a37a3aa4d5523e3c0f4561740ebc5b63cc31b.zip
configuration folder for packaging configuration files moved to the main plug-in location
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.epp.packaging.core/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/Activator.java60
-rw-r--r--plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/EclipsePackagingExecutor.java6
-rw-r--r--plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/CustomTargetsWriter.java21
-rw-r--r--plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/EclipsePackager.java35
-rw-r--r--plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/PackagingPropertiesWriter.java23
-rw-r--r--plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/IModifiablePackagerConfiguration.java5
-rw-r--r--plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/PackagerConfiguration.java27
-rw-r--r--plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/xml/ConfigurationParser.java13
9 files changed, 149 insertions, 44 deletions
diff --git a/plugins/org.eclipse.epp.packaging.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.epp.packaging.core/META-INF/MANIFEST.MF
index d1f90649..84542103 100644
--- a/plugins/org.eclipse.epp.packaging.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.epp.packaging.core/META-INF/MANIFEST.MF
@@ -18,5 +18,6 @@ Export-Package: org.eclipse.epp.packaging.core,
org.eclipse.epp.packaging.core.download,
org.eclipse.epp.packaging.core.io,
org.eclipse.epp.packaging.core.logging
-Eclipse-LazyStart: false
+Eclipse-LazyStart: true
+Bundle-Activator: org.eclipse.epp.packaging.core.Activator
diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/Activator.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/Activator.java
new file mode 100644
index 00000000..a8e554fb
--- /dev/null
+++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/Activator.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Innoopract Informationssysteme GmbH
+ * 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:
+ * Innoopract - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.epp.packaging.core;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ /** The plug-in ID */
+ public static final String PLUGIN_ID = "org.eclipse.epp.packaging.core"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ // do nothing
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start( final BundleContext context ) throws Exception {
+ super.start( context );
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop( final BundleContext context ) throws Exception {
+ plugin = null;
+ super.stop( context );
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/EclipsePackagingExecutor.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/EclipsePackagingExecutor.java
index e1234541..aad9c642 100644
--- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/EclipsePackagingExecutor.java
+++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/EclipsePackagingExecutor.java
@@ -11,6 +11,7 @@
package org.eclipse.epp.packaging.core;
import java.io.IOException;
+import java.net.URISyntaxException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.epp.packaging.core.assembly.EclipsePackager;
@@ -42,8 +43,9 @@ public class EclipsePackagingExecutor {
/**
* Run the packaging process
+ * @throws URISyntaxException
*/
- public void execute() throws CoreException, IOException {
+ public void execute() throws CoreException, IOException, URISyntaxException {
MessageLogger logger = MessageLogger.getInstance();
logger.log( "Application.FeatureCount", //$NON-NLS-1$
Integer.valueOf( this.configuration.getRequiredFeatures().length ) );
@@ -65,7 +67,7 @@ public class EclipsePackagingExecutor {
}
}
- private void build() throws IOException, CoreException {
+ private void build() throws IOException, CoreException, URISyntaxException {
if( this.commands.mustDo( Task.BUILD ) ) {
MessageLogger.getInstance().logBeginProcess( "Application.Building" ); //$NON-NLS-1$
IPackager packager = new EclipsePackager( this.configuration );
diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/CustomTargetsWriter.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/CustomTargetsWriter.java
index 17fce40b..3ea9b0db 100644
--- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/CustomTargetsWriter.java
+++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/CustomTargetsWriter.java
@@ -14,10 +14,17 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
+import java.net.URISyntaxException;
+import java.net.URL;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.epp.packaging.core.Activator;
import org.eclipse.epp.packaging.core.configuration.IPackagerConfiguration;
import org.eclipse.epp.packaging.core.configuration.IPlatform;
import org.eclipse.epp.packaging.core.io.FileUtils;
+import org.osgi.framework.Bundle;
/**
* Completes the custom targets stub to form a customtargets.xml ant file.
@@ -25,6 +32,7 @@ import org.eclipse.epp.packaging.core.io.FileUtils;
*/
public class CustomTargetsWriter {
+ private static final String SKELETONS_DIRECTORY = "skeletons/"; //$NON-NLS-1$
private final PrintWriter writer;
private final IPackagerConfiguration configuration;
@@ -33,13 +41,20 @@ public class CustomTargetsWriter {
* @param configuration
* @param baseFile
* @throws IOException
+ * @throws URISyntaxException
*/
public CustomTargetsWriter( final IPackagerConfiguration configuration,
- final String baseFile ) throws IOException
+ final String baseFile )
+ throws IOException, URISyntaxException
{
this.configuration = configuration;
- File stubFile = new File( configuration.getPackagerConfigurationFolder(),
- baseFile );
+
+ IPath path = new Path( SKELETONS_DIRECTORY + baseFile );
+ Bundle bundle = Activator.getDefault().getBundle();
+ URL url = FileLocator.find( bundle, path, null );
+ URL fileURL = FileLocator.toFileURL( url );
+ File stubFile = new File( fileURL.toURI() );
+
File customTargetsFile = new File( configuration.getPackagerConfigurationFolder(),
"customTargets.xml" ); //$NON-NLS-1$
FileUtils.copy( stubFile, customTargetsFile );
diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/EclipsePackager.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/EclipsePackager.java
index d54e02b4..16042f6f 100644
--- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/EclipsePackager.java
+++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/EclipsePackager.java
@@ -12,29 +12,43 @@ package org.eclipse.epp.packaging.core.assembly;
import java.io.File;
import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.epp.packaging.core.Activator;
import org.eclipse.epp.packaging.core.configuration.IPackagerConfiguration;
import org.eclipse.epp.packaging.core.configuration.IPlatform;
import org.eclipse.epp.packaging.core.io.FileUtils;
import org.eclipse.epp.packaging.core.io.Zip;
import org.eclipse.epp.packaging.core.logging.MessageLogger;
import org.eclipse.update.core.VersionedIdentifier;
+import org.osgi.framework.Bundle;
/**
* An IPackager using the main configuration as its argument.
*/
public class EclipsePackager implements IPackager {
- private static final String CONFIGURED_FEATURES_ZIP = "ConfiguredFeatures.zip"; //$NON-NLS-1$
+ private static final String PACKAGER_SKELETON_DIR
+ = "skeletons/"; //$NON-NLS-1$
+ private static final String PACKAGER_PROPERTIES_FILE
+ = "packager.properties"; //$NON-NLS-1$
+ private static final String CONFIGURED_FEATURES_ZIP
+ = "ConfiguredFeatures.zip"; //$NON-NLS-1$
private final PackagerRunner runner;
/**
* TODO mknauer missing doc
* @param configuration
* @throws IOException
+ * @throws URISyntaxException
*/
public EclipsePackager( final IPackagerConfiguration configuration )
- throws IOException
+ throws IOException, URISyntaxException
{
this.runner = new PackagerRunner();
setFolders( configuration );
@@ -43,9 +57,13 @@ public class EclipsePackager implements IPackager {
prepareWorkingArea( configuration );
}
- /** Creates the map file in the workspace and clears the existing work area. */
+ /**
+ * Creates the map file in the workspace and clears the existing work area.
+ *
+ * @throws URISyntaxException
+ */
private void prepareWorkingArea( final IPackagerConfiguration configuration )
- throws IOException
+ throws IOException, URISyntaxException
{
FileUtils.deleteFile( new File( configuration.getTargetFolder(),
"workingPlace" ) ); //$NON-NLS-1$
@@ -70,6 +88,15 @@ public class EclipsePackager implements IPackager {
mapWriter.close();
propertiesWriter.close();
customTargetsWriter.close();
+
+ IPath path = new Path( PACKAGER_SKELETON_DIR + PACKAGER_PROPERTIES_FILE );
+ Bundle bundle = Activator.getDefault().getBundle();
+ URL url = FileLocator.find( bundle, path, null );
+ URL fileURL = FileLocator.toFileURL( url );
+ File packagerPropertiesFile = new File( fileURL.toURI() );
+ File destinationPPFile = new File( configuration.getPackagerConfigurationFolder(),
+ PACKAGER_PROPERTIES_FILE ); //$NON-NLS-1$
+ FileUtils.copy( packagerPropertiesFile, destinationPPFile );
}
private void writeDataForCustomFile( final String filename,
diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/PackagingPropertiesWriter.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/PackagingPropertiesWriter.java
index e55bf7c8..4cbb6fe2 100644
--- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/PackagingPropertiesWriter.java
+++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/assembly/PackagingPropertiesWriter.java
@@ -14,31 +14,44 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
+import java.net.URISyntaxException;
+import java.net.URL;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.epp.packaging.core.Activator;
import org.eclipse.epp.packaging.core.configuration.IPackagerConfiguration;
import org.eclipse.epp.packaging.core.io.FileUtils;
+import org.osgi.framework.Bundle;
/**
* Completes the packaging.properties file by adding the unzipOrder property.
*/
public class PackagingPropertiesWriter {
+ private static final String SKELETONS_PACKAGING_PROPERTIES = "skeletons/packagingStub.properties"; //$NON-NLS-1$
private static final String UNZIP_ORDER_PROPERTY = "unzipOrder"; //$NON-NLS-1$
private static final String PACKAGING_PROPERTIES_FILENAME = "packaging.properties"; //$NON-NLS-1$
private final PrintWriter writer;
private boolean firstName = true;
/**
- * TODO mknauer missing doc
* @param configuration
* @param baseFile
* @throws IOException
+ * @throws URISyntaxException
*/
public PackagingPropertiesWriter( final IPackagerConfiguration configuration,
- final String baseFile ) throws IOException
+ final String baseFile )
+ throws IOException, URISyntaxException
{
- File stubFile = new File( configuration.getPackagerConfigurationFolder(),
- baseFile );
+ IPath path = new Path( SKELETONS_PACKAGING_PROPERTIES );
+ Bundle bundle = Activator.getDefault().getBundle();
+ URL url = FileLocator.find( bundle, path, null );
+ URL fileURL = FileLocator.toFileURL( url );
+ File stubFile = new File( fileURL.toURI() );
+
File packagingFile = new File( configuration.getPackagerConfigurationFolder(),
PACKAGING_PROPERTIES_FILENAME );
FileUtils.copy( stubFile, packagingFile );
@@ -48,7 +61,6 @@ public class PackagingPropertiesWriter {
}
/**
- * TODO mknauer missing doc
* @param fileName
*/
public void addFileToOrder( final String fileName ) {
@@ -61,7 +73,6 @@ public class PackagingPropertiesWriter {
}
/**
- * TODO mknauer missing doc
*/
public void close() {
this.writer.close();
diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/IModifiablePackagerConfiguration.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/IModifiablePackagerConfiguration.java
index 149f644d..a158a1f8 100644
--- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/IModifiablePackagerConfiguration.java
+++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/IModifiablePackagerConfiguration.java
@@ -29,9 +29,6 @@ public interface IModifiablePackagerConfiguration
/**Adds the feature [id] with the given version to the list of required features.*/
public void addRequiredFeature( final String id, final String version );
- /**Sets the designated folder containing the PDE packager config files.*/
- public void setPackagerConfigurationFolder( final String folder );
-
/**Sets the extension site's name in the target folder.*/
public void setExtensionSiteRelative( final String relativeFolder );
@@ -50,4 +47,4 @@ public interface IModifiablePackagerConfiguration
/**Sets the product name to use for the final result.*/
public void setProductName( final String name );
-} \ No newline at end of file
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/PackagerConfiguration.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/PackagerConfiguration.java
index 13534f55..2b0f1f49 100644
--- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/PackagerConfiguration.java
+++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/PackagerConfiguration.java
@@ -22,6 +22,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.PluginVersionIdentifier;
import org.eclipse.core.runtime.Status;
+import org.eclipse.epp.packaging.core.Activator;
import org.eclipse.epp.packaging.core.logging.MessageLogger;
import org.eclipse.update.core.ISite;
import org.eclipse.update.core.ISiteFeatureReference;
@@ -34,9 +35,11 @@ import org.eclipse.update.core.VersionedIdentifier;
*/
public class PackagerConfiguration implements IModifiablePackagerConfiguration {
- private static final String PLUGIN_ID = "org.eclipse.epp.packaging.core"; //$NON-NLS-1$
+ private static final String PACKAGER_CONFIGURATION_DIRECTORY
+ = "packagerConfiguration"; //$NON-NLS-1$
- private static final String ECLIPSE_PLATTFORM = "eclipse-platform-"; //$NON-NLS-1$
+ private static final String ECLIPSE_PLATTFORM
+ = "eclipse-platform-"; //$NON-NLS-1$
private final List<URL> updateSites = new ArrayList<URL>();
private final List<Platform> targetPlatforms = new ArrayList<Platform>();
@@ -71,18 +74,18 @@ public class PackagerConfiguration implements IModifiablePackagerConfiguration {
this.requiredFeatures.add( new VersionedIdentifier( id, version ) );
}
- public File getPackagerConfigurationFolder() {
- return this.packagerConfigurationFolder;
- }
-
- public void setPackagerConfigurationFolder( final String folder ) {
- this.packagerConfigurationFolder = new File( folder );
- }
-
public File getTargetFolder() {
return this.baseFolder;
}
+ public File getPackagerConfigurationFolder() {
+ File result = new File( this.baseFolder, PACKAGER_CONFIGURATION_DIRECTORY );
+ if( ! result.isDirectory() ) {
+ result.mkdir();
+ }
+ return result;
+ }
+
public void setExtensionSiteRelative( final String relativeFolder ) {
this.extensionSite = new File( this.baseFolder, relativeFolder );
}
@@ -156,7 +159,7 @@ public class PackagerConfiguration implements IModifiablePackagerConfiguration {
public IStatus checkFeatures( final IProgressMonitor monitor )
throws CoreException
{
- MultiStatus result = new MultiStatus( PLUGIN_ID, IStatus.OK, null, null );
+ MultiStatus result = new MultiStatus( Activator.PLUGIN_ID, IStatus.OK, null, null );
FeatureVersionRepository availableFeatures = new FeatureVersionRepository();
List<VersionedIdentifier> newRequiredFeatures = new ArrayList<VersionedIdentifier>();
createFeatureRepository( monitor, availableFeatures );
@@ -172,7 +175,7 @@ public class PackagerConfiguration implements IModifiablePackagerConfiguration {
+ identifier
+ " with version " //$NON-NLS-1$
+ newVersion;
- result.add( new Status( IStatus.INFO, PLUGIN_ID, message ) );
+ result.add( new Status( IStatus.INFO, Activator.PLUGIN_ID, message ) );
VersionedIdentifier newVersionId = new VersionedIdentifier( identifier,
newVersion );
newRequiredFeatures.add( newVersionId );
diff --git a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/xml/ConfigurationParser.java b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/xml/ConfigurationParser.java
index f9963fa7..dd1edf7e 100644
--- a/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/xml/ConfigurationParser.java
+++ b/plugins/org.eclipse.epp.packaging.core/src/org/eclipse/epp/packaging/core/configuration/xml/ConfigurationParser.java
@@ -19,7 +19,6 @@ import javax.xml.parsers.ParserConfigurationException;
import org.eclipse.epp.packaging.core.configuration.IPackagerConfiguration;
import org.eclipse.epp.packaging.core.configuration.PackagerConfiguration;
import org.eclipse.epp.packaging.core.configuration.Platform;
-import org.eclipse.update.core.VersionedIdentifier;
import org.xml.sax.SAXException;
/**
@@ -47,7 +46,6 @@ public class ConfigurationParser {
private static final String TAG_ECLIPSE_INI_FILE = "eclipseIniFileContent"; //$NON-NLS-1$
private static final String TAG_EXTENSION_SITE = "extensionSite"; //$NON-NLS-1$
private static final String TAG_FEATURE = "feature"; //$NON-NLS-1$
- private static final String TAG_PACKAGER_CONFIGURATION_FOLDER = "packagerConfigurationFolder"; //$NON-NLS-1$
private static final String TAG_PLATFORM = "platform"; //$NON-NLS-1$
private static final String TAG_PRODUCT = "product"; //$NON-NLS-1$
private static final String TAG_RCP = "rcp"; //$NON-NLS-1$
@@ -105,7 +103,6 @@ public class ConfigurationParser {
parseProduct( configuration, root );
parseUpdateSites( configuration, root );
parseRequiredFeatures( configuration, root );
- parsePackagerConfigurationFolder( configuration, root );
parseRootFolder( configuration, root );
parseExtensionSite( configuration, root );
parsePlatforms( configuration, root );
@@ -121,15 +118,7 @@ public class ConfigurationParser {
configuration.setExtensionSiteRelative( element.getAttributeValue( ATTRIB_RELATIVE_FOLDER ) );
}
- /** Loads and sets the packager configuration folder to use. */
- private void parsePackagerConfigurationFolder( final PackagerConfiguration configuration,
- final IXmlElement parent )
- {
- IXmlElement element = parent.getElement( TAG_PACKAGER_CONFIGURATION_FOLDER );
- String folder = resolveRelativeFileName( getFolderName( element ) );
- configuration.setPackagerConfigurationFolder( folder );
- }
-
+
/** Loads and sets the target platforms. */
private void parsePlatforms( final PackagerConfiguration configuration,
final IXmlElement parent )

Back to the top