ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1372650 - in /ant/ivy/ivyde/trunk: doc/ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/ org....
Date Mon, 13 Aug 2012 22:09:49 GMT
Author: hibou
Date: Mon Aug 13 22:09:48 2012
New Revision: 1372650

URL: http://svn.apache.org/viewvc?rev=1372650&view=rev
Log:
Add support for the OSGi access rules

Added:
    ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/
    ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/ivy-1.0.xml   (with props)
    ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/jars/
    ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/jars/osgimodule-1.0.jar   (with props)
    ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/sources/
    ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/sources/osgimodule-1.0.jar   (with
props)
    ant/ivy/ivyde/trunk/test/osgi/   (with props)
    ant/ivy/ivyde/trunk/test/osgi/.classpath   (with props)
    ant/ivy/ivyde/trunk/test/osgi/.project   (with props)
    ant/ivy/ivyde/trunk/test/osgi/ivy.xml   (with props)
    ant/ivy/ivyde/trunk/test/osgi/ivysettings.xml   (with props)
    ant/ivy/ivyde/trunk/test/osgi/src/
    ant/ivy/ivyde/trunk/test/osgi/src/Test.java   (with props)
Modified:
    ant/ivy/ivyde/trunk/doc/release-notes.html
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ClasspathSetup.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerMapper.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/ClasspathSetupEditor.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java

Modified: ant/ivy/ivyde/trunk/doc/release-notes.html
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/doc/release-notes.html?rev=1372650&r1=1372649&r2=1372650&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/doc/release-notes.html (original)
+++ ant/ivy/ivyde/trunk/doc/release-notes.html Mon Aug 13 22:09:48 2012
@@ -134,6 +134,7 @@ List of changes since <a href="/ivy/ivyd
     <li>NEW: Support Workspace/Filesystem/Variables for "Ivy File" setting (IVYDE-304)</li>
     <li>NEW: Retrieve list does not resolve workspace projects (IVYDE-308) (thanks
to Peter Oxenham)</li>
     <li>NEW: Allow to set the Ivy user directory globally or project by project (IVYDE-311)</li>
+    <li>NEW: Add support for the OSGi access rules</li>
 </ul>
     <!-- samples
 <ul>

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java?rev=1372650&r1=1372649&r2=1372650&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
Mon Aug 13 22:09:48 2012
@@ -97,6 +97,8 @@ public class IvyPlugin extends AbstractU
 
     private IvyMarkerManager ivyMarkerManager;
 
+    private boolean osgiAvailable;
+
     /**
      * The constructor.
      */
@@ -131,26 +133,9 @@ public class IvyPlugin extends AbstractU
         propertyListener = new IPropertyChangeListener() {
             public void propertyChange(PropertyChangeEvent event) {
                 try {
-                    // CheckStyle:LineLength| OFF
-                    if (event.getProperty() == PreferenceConstants.IVYSETTINGS_PATH
-                            || event.getProperty() == PreferenceConstants.IVY_USER_DIR
-                            || event.getProperty() == PreferenceConstants.ACCEPTED_TYPES
-                            || event.getProperty() == PreferenceConstants.SOURCES_TYPES
-                            || event.getProperty() == PreferenceConstants.JAVADOC_TYPES
-                            || event.getProperty() == PreferenceConstants.SOURCES_SUFFIXES
-                            || event.getProperty() == PreferenceConstants.JAVADOC_SUFFIXES
-                            || event.getProperty() == PreferenceConstants.DO_RETRIEVE_DEPRECATED
-                            || event.getProperty() == PreferenceConstants.RETRIEVE_PATTERN_DEPRECATED
-                            || event.getProperty() == PreferenceConstants.DO_RETRIEVE
-                            || event.getProperty() == PreferenceConstants.RETRIEVE_PATTERN
-                            || event.getProperty() == PreferenceConstants.RETRIEVE_SYNC
-                            || event.getProperty() == PreferenceConstants.ALPHABETICAL_ORDER
-                            || event.getProperty() == PreferenceConstants.RESOLVE_IN_WORKSPACE
-                            || event.getProperty() == PreferenceConstants.IGNORE_BRANCH_ON_WORKSPACE_PROJECTS
-                            || event.getProperty() == PreferenceConstants.IGNORE_VERSION_ON_WORKSPACE_PROJECTS)
{
+                    if (PreferenceConstants.ALL.contains(event.getProperty())) {
                         prefStoreChanged();
                     }
-                    // CheckStyle:LineLength| ON
                 } catch (JavaModelException e) {
                     MessageDialog.openError(IvyPlugin.getDefault().getWorkbench()
                             .getActiveWorkbenchWindow().getShell(),
@@ -177,6 +162,13 @@ public class IvyPlugin extends AbstractU
         ivyMarkerManager = new IvyMarkerManager();
 
         log(IStatus.INFO, "IvyDE plugin started", null);
+
+        try {
+            Class.forName("org.apache.ivy.osgi.core.ManifestParser");
+            osgiAvailable = true;
+        } catch (Exception e) {
+            osgiAvailable = false;
+        }
     }
 
     /**
@@ -252,6 +244,10 @@ public class IvyPlugin extends AbstractU
         return plugin;
     }
 
+    public boolean isOsgiAvailable() {
+        return osgiAvailable;
+    }
+
     /**
      * Returns the active workbench shell
      * 

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ClasspathSetup.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ClasspathSetup.java?rev=1372650&r1=1372649&r2=1372650&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ClasspathSetup.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/ClasspathSetup.java
Mon Aug 13 22:09:48 2012
@@ -33,6 +33,8 @@ public class ClasspathSetup {
 
     private RetrieveSetup retrieveSetup = new RetrieveSetup();
 
+    private boolean readOSGiMetadata;
+
     /**
      * Default constructor
      */
@@ -46,6 +48,7 @@ public class ClasspathSetup {
         this.alphaOrder = setup.alphaOrder;
         this.retrievedClasspath = setup.retrievedClasspath;
         this.retrieveSetup.set(setup.retrieveSetup);
+        this.readOSGiMetadata = setup.readOSGiMetadata;
     }
 
     public boolean isResolveInWorkspace() {
@@ -88,4 +91,11 @@ public class ClasspathSetup {
         this.retrieveSetup = retrieveSetup;
     }
 
+    public boolean isReadOSGiMetadata() {
+        return readOSGiMetadata;
+    }
+
+    public void setReadOSGiMetadata(boolean readOSGiMetadata) {
+        this.readOSGiMetadata = readOSGiMetadata;
+    }
 }

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java?rev=1372650&r1=1372649&r2=1372650&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerConfAdapter.java
Mon Aug 13 22:09:48 2012
@@ -177,6 +177,9 @@ public final class IvyClasspathContainer
             } else if (parameter[0].equals("resolveInWorkspace")) {
                 classpathSetup.setResolveInWorkspace(Boolean.valueOf(value).booleanValue());
                 conf.setClassthProjectSpecific(true);
+            } else if (parameter[0].equals("readOSGiMetadata")) {
+                classpathSetup.setReadOSGiMetadata(Boolean.valueOf(value).booleanValue());
+                conf.setClassthProjectSpecific(true);
             } else if (parameter[0].equals("resolveBeforeLaunch")) {
                 advancedSetup.setResolveBeforeLaunch(Boolean.valueOf(value).booleanValue());
                 conf.setAdvancedProjectSpecific(true);
@@ -384,6 +387,7 @@ public final class IvyClasspathContainer
                 append(path, "acceptedTypes", setup.getAcceptedTypes());
                 append(path, "alphaOrder", setup.isAlphaOrder());
                 append(path, "resolveInWorkspace", setup.isResolveInWorkspace());
+                append(path, "readOSGiMetadata", setup.isReadOSGiMetadata());
                 append(path, "retrievedClasspath", setup.isRetrievedClasspath());
                 if (setup.isRetrievedClasspath()) {
                     RetrieveSetup retrieveSetup = setup.getRetrieveSetup();

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerMapper.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerMapper.java?rev=1372650&r1=1372649&r2=1372650&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerMapper.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cpcontainer/IvyClasspathContainerMapper.java
Mon Aug 13 22:09:48 2012
@@ -17,8 +17,11 @@
  */
 package org.apache.ivyde.eclipse.cpcontainer;
 
+import java.io.FileInputStream;
+import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -32,6 +35,10 @@ import org.apache.ivy.core.module.descri
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.report.ArtifactDownloadReport;
 import org.apache.ivy.core.resolve.DownloadOptions;
+import org.apache.ivy.osgi.core.BundleInfo;
+import org.apache.ivy.osgi.core.ExportPackage;
+import org.apache.ivy.osgi.core.ManifestParser;
+import org.apache.ivy.util.Message;
 import org.apache.ivyde.eclipse.IvyPlugin;
 import org.apache.ivyde.eclipse.resolve.ResolveResult;
 import org.apache.ivyde.eclipse.workspaceresolver.WorkspaceResolver;
@@ -39,6 +46,7 @@ import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IAccessRule;
 import org.eclipse.jdt.core.IClasspathAttribute;
 import org.eclipse.jdt.core.IClasspathEntry;
 import org.eclipse.jdt.core.IJavaProject;
@@ -73,6 +81,8 @@ public class IvyClasspathContainerMapper
 
     private MappingSetup mapping;
 
+    private boolean osgiAvailable;
+
     public IvyClasspathContainerMapper(IProgressMonitor monitor, Ivy ivy,
             IvyClasspathContainerConfiguration conf, ResolveResult resolveResult) {
         this.monitor = monitor;
@@ -83,6 +93,7 @@ public class IvyClasspathContainerMapper
         this.all = resolveResult.getArtifactReports();
         this.artifactsByDependency = resolveResult.getArtifactsByDependency();
         this.retrievedArtifacts = resolveResult.getRetrievedArtifacts();
+        this.osgiAvailable = IvyPlugin.getDefault().isOsgiAvailable();
     }
 
     public IClasspathEntry[] map() {
@@ -97,7 +108,9 @@ public class IvyClasspathContainerMapper
                 // but only add it if it is not a self dependency
                 if (javaProject == null
                         || !artifact.getName().equals(javaProject.getPath().toString()))
{
-                    paths.add(JavaCore.newProjectEntry(new Path(artifact.getName()), true));
+                    IAccessRule[] rules = getAccessRules(javaProject);
+                    paths.add(JavaCore.newProjectEntry(new Path(artifact.getName()), rules,
true,
+                        null, true));
                 }
             } else if (artifact.getLocalFile() != null && accept(artifact.getArtifact()))
{
                 Path classpathArtifact = getArtifactPath(artifact);
@@ -105,9 +118,10 @@ public class IvyClasspathContainerMapper
                     mapping.isMapIfOnlyOneSource());
                 Path javadocArtifact = getArtifactPath(artifact, javadocArtifactMatcher,
                     mapping.isMapIfOnlyOneJavadoc());
+                IAccessRule[] rules = getAccessRules(classpathArtifact);
                 paths.add(JavaCore.newLibraryEntry(classpathArtifact,
                     getSourceAttachment(classpathArtifact, sourcesArtifact),
-                    getSourceAttachmentRoot(classpathArtifact, sourcesArtifact), null,
+                    getSourceAttachmentRoot(classpathArtifact, sourcesArtifact), rules,
                     getExtraAttribute(classpathArtifact, javadocArtifact), false));
             }
 
@@ -117,6 +131,56 @@ public class IvyClasspathContainerMapper
         return classpathEntries;
     }
 
+    private IAccessRule[] getAccessRules(IJavaProject javaProject) {
+        if (!osgiAvailable || !classpathSetup.isReadOSGiMetadata()) {
+            return null;
+        }
+        // TODO
+        // Nicolas: AFAIU, the access rules seems to have to be set on the imported project
itself
+        // rather than filtering here, afterwards
+        return null;
+    }
+
+    private IAccessRule[] getAccessRules(Path artifact) {
+        if (!osgiAvailable || !classpathSetup.isReadOSGiMetadata()) {
+            return null;
+        }
+        BundleInfo bundleInfo;
+        FileInputStream jar = null;
+        try {
+            jar = new FileInputStream(artifact.toFile());
+            bundleInfo = ManifestParser.parseJarManifest(jar);
+        } catch (IOException e) {
+            Message.warn("OSGi metadata could not be extracted from " + artifact + ": "
+                    + e.getMessage() + " (" + e.getClass().getName() + ")");
+            return null;
+        } catch (ParseException e) {
+            Message.warn("OSGi metadata could not be extracted from " + artifact + ": "
+                    + e.getMessage() + " (" + e.getClass().getName() + ")");
+            return null;
+        } finally {
+            if (jar != null) {
+                try {
+                    jar.close();
+                } catch (IOException e) {
+                    // don't care
+                }
+            }
+        }
+        IAccessRule[] rules = new IAccessRule[bundleInfo.getExports().size() + 1];
+        int i = 0;
+        Iterator itExports = bundleInfo.getExports().iterator();
+        while (itExports.hasNext()) {
+            ExportPackage exportPackage = (ExportPackage) itExports.next();
+            rules[i++] = JavaCore.newAccessRule(
+                new Path(exportPackage.getName().replace('.', IPath.SEPARATOR) + "/*"),
+                IAccessRule.K_ACCESSIBLE);
+        }
+        rules[i++] = JavaCore.newAccessRule(new Path("**/*"), IAccessRule.K_NON_ACCESSIBLE
+                | IAccessRule.IGNORE_IF_BETTER);
+        return rules;
+    }
+
     private Path getArtifactPath(ArtifactDownloadReport artifact) {
         if (retrievedArtifacts != null) {
             Set pathSet = (Set) retrievedArtifacts.get(artifact);

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/ClasspathSetupEditor.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/ClasspathSetupEditor.java?rev=1372650&r1=1372649&r2=1372650&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/ClasspathSetupEditor.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/ClasspathSetupEditor.java
Mon Aug 13 22:09:48 2012
@@ -17,6 +17,7 @@
  */
 package org.apache.ivyde.eclipse.ui;
 
+import org.apache.ivyde.eclipse.IvyPlugin;
 import org.apache.ivyde.eclipse.cpcontainer.ClasspathSetup;
 import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
 import org.eclipse.swt.SWT;
@@ -36,7 +37,8 @@ public class ClasspathSetupEditor extend
 
     private static final int INDENT_RETRIEVE = 60;
 
-    public static final String TOOLTIP_ACCEPTED_TYPES = "Comma separated list of artifact
types to add to the classpath.\n" + "Example: jar, zip";
+    public static final String TOOLTIP_ACCEPTED_TYPES = "Comma separated list of artifact
types to add to the classpath.\n"
+            + "Example: jar, zip";
 
     private Button resolveInWorkspaceCheck;
 
@@ -54,10 +56,16 @@ public class ClasspathSetupEditor extend
 
     private Text acceptedTypesText;
 
+    private Button readOSGiMetadataCheck;
+
+    private boolean osgiAvailable;
+
     public ClasspathSetupEditor(Composite parent, int style) {
         super(parent, style);
         setLayout(new GridLayout(2, false));
 
+        osgiAvailable = IvyPlugin.getDefault().isOsgiAvailable();
+
         resolveInWorkspaceCheck = new Button(this, SWT.CHECK);
         resolveInWorkspaceCheck.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
true,
                 false, 2, 1));
@@ -65,6 +73,14 @@ public class ClasspathSetupEditor extend
         resolveInWorkspaceCheck
                 .setToolTipText("Will replace jars on the classpath with workspace projects");
 
+        readOSGiMetadataCheck = new Button(this, SWT.CHECK);
+        readOSGiMetadataCheck.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true,
false,
+                2, 1));
+        readOSGiMetadataCheck.setText("Read OSGi metadata");
+        readOSGiMetadataCheck
+                .setToolTipText("Will setup access rules regarding OSGi metadata like Export-Package");
+        readOSGiMetadataCheck.setEnabled(osgiAvailable);
+
         acceptedTypesLabel = new Label(this, SWT.NONE);
         acceptedTypesLabel.setText("Accepted types:");
 
@@ -111,6 +127,7 @@ public class ClasspathSetupEditor extend
 
     public void init(ClasspathSetup setup) {
         resolveInWorkspaceCheck.setSelection(setup.isResolveInWorkspace());
+        readOSGiMetadataCheck.setSelection(setup.isReadOSGiMetadata());
         acceptedTypesText.setText(IvyClasspathUtil.concat(setup.getAcceptedTypes()));
         alphaOrderCheck.select(setup.isAlphaOrder() ? 1 : 0);
         selectCache.setSelection(!setup.isRetrievedClasspath());
@@ -122,6 +139,7 @@ public class ClasspathSetupEditor extend
     public ClasspathSetup getClasspathSetup() {
         ClasspathSetup setup = new ClasspathSetup();
         setup.setResolveInWorkspace(resolveInWorkspaceCheck.getSelection());
+        setup.setReadOSGiMetadata(readOSGiMetadataCheck.getSelection());
         setup.setAcceptedTypes(IvyClasspathUtil.split(acceptedTypesText.getText()));
         setup.setAlphaOrder(alphaOrderCheck.getSelectionIndex() == 1);
         setup.setRetrievedClasspath(selectRetrieve.getSelection());
@@ -133,6 +151,7 @@ public class ClasspathSetupEditor extend
 
     public void setEnabled(boolean enabled) {
         resolveInWorkspaceCheck.setEnabled(enabled);
+        readOSGiMetadataCheck.setEnabled(osgiAvailable && enabled);
         acceptedTypesLabel.setEnabled(enabled);
         acceptedTypesText.setEnabled(enabled);
         alphaOrderLabel.setEnabled(enabled);

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java?rev=1372650&r1=1372649&r2=1372650&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
Mon Aug 13 22:09:48 2012
@@ -74,6 +74,7 @@ public class IvyDEPreferenceStoreHelper 
     public ClasspathSetup getClasspathSetup() {
         ClasspathSetup setup = new ClasspathSetup();
         setup.setResolveInWorkspace(prefStore.getBoolean(PreferenceConstants.RESOLVE_IN_WORKSPACE));
+        setup.setReadOSGiMetadata(prefStore.getBoolean(PreferenceConstants.READ_OSGI_METADATA));
         setup.setAcceptedTypes(IvyClasspathUtil.split(prefStore
                 .getString(PreferenceConstants.ACCEPTED_TYPES)));
         setup.setAlphaOrder(prefStore.getBoolean(PreferenceConstants.ALPHABETICAL_ORDER));
@@ -90,6 +91,7 @@ public class IvyDEPreferenceStoreHelper 
 
     public void setClasspathSetup(ClasspathSetup setup) {
         prefStore.setValue(PreferenceConstants.RESOLVE_IN_WORKSPACE, setup.isResolveInWorkspace());
+        prefStore.setValue(PreferenceConstants.READ_OSGI_METADATA, setup.isReadOSGiMetadata());
         prefStore.setValue(PreferenceConstants.ACCEPTED_TYPES,
             IvyClasspathUtil.concat(setup.getAcceptedTypes()));
         prefStore.setValue(PreferenceConstants.ALPHABETICAL_ORDER, setup.isAlphaOrder());

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java?rev=1372650&r1=1372649&r2=1372650&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
Mon Aug 13 22:09:48 2012
@@ -17,6 +17,11 @@
  */
 package org.apache.ivyde.eclipse.ui.preferences;
 
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.HashSet;
+import java.util.Set;
+
 /**
  * Constant definitions for plug-in preferences
  */
@@ -66,6 +71,8 @@ public final class PreferenceConstants {
 
     public static final String RESOLVE_IN_WORKSPACE = "resolveInWorkspace";
 
+    public static final String READ_OSGI_METADATA = "readOSGIMetadata";
+
     public static final String RESOLVE_BEFORE_LAUNCH = "resolveBeforeLaunch";
 
     public static final String USE_EXTENDED_RESOLVE_ID = "useExtendedResolveId";
@@ -118,4 +125,20 @@ public final class PreferenceConstants {
 
     public static final String ERROR_POPUP = "error.popup";
 
+    public static final Set/*<String>*/ ALL = new HashSet();
+
+    static {
+        Field[] fields = PreferenceConstants.class.getFields();
+        for (int i = 0; i < fields.length; i++) {
+            if (Modifier.isStatic(fields[i].getModifiers())) {
+                try {
+                    ALL.add(fields[i].get(null));
+                } catch (IllegalArgumentException e) {
+                    throw new RuntimeException(e);
+                } catch (IllegalAccessException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+    }
 }

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java?rev=1372650&r1=1372649&r2=1372650&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java
Mon Aug 13 22:09:48 2012
@@ -62,6 +62,8 @@ public class PreferenceInitializer exten
 
     public static final boolean DEFAULT_RESOLVE_IN_WORKSPACE = false;
 
+    private static final boolean DEFAULT_READ_OSGI_METADATA = false;
+
     public static final boolean DEFAULT_RETRIEVED_CLASSPATH = false;
 
     private static final String DEFAULT_RETRIEVED_CLASSPATH_PATTERN = "lib/[artifact]-[revision].[ext]";
@@ -84,6 +86,7 @@ public class PreferenceInitializer exten
         DEFAULT_CLASSPATH_SETUP.setAcceptedTypes(IvyClasspathUtil.split(DEFAULT_ACCEPTED_TYPES));
         DEFAULT_CLASSPATH_SETUP.setAlphaOrder(DEFAULT_ALPHABETICAL_ORDER);
         DEFAULT_CLASSPATH_SETUP.setResolveInWorkspace(DEFAULT_RESOLVE_IN_WORKSPACE);
+        DEFAULT_CLASSPATH_SETUP.setReadOSGiMetadata(DEFAULT_READ_OSGI_METADATA);
         DEFAULT_CLASSPATH_SETUP.setRetrievedClasspath(DEFAULT_RETRIEVED_CLASSPATH);
         DEFAULT_CLASSPATH_SETUP.setRetrieveSetup(DEFAULT_RETRIEVED_CLASSPATH_SETUP);
     }
@@ -161,6 +164,7 @@ public class PreferenceInitializer exten
 
         store.setDefault(PreferenceConstants.ALPHABETICAL_ORDER, DEFAULT_ALPHABETICAL_ORDER);
         store.setDefault(PreferenceConstants.RESOLVE_IN_WORKSPACE, DEFAULT_RESOLVE_IN_WORKSPACE);
+        store.setDefault(PreferenceConstants.READ_OSGI_METADATA, DEFAULT_READ_OSGI_METADATA);
         store.setDefault(PreferenceConstants.RESOLVE_BEFORE_LAUNCH, DEFAULT_RESOLVE_BEFORE_LAUNCH);
         store.setDefault(PreferenceConstants.PROPERTY_FILES, DEFAULT_PROPERTY_FILES);
         store.setDefault(PreferenceConstants.LOAD_SETTINGS_ON_DEMAND,

Added: ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/ivy-1.0.xml
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/ivy-1.0.xml?rev=1372650&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/ivy-1.0.xml (added)
+++ ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/ivy-1.0.xml Mon Aug 13 22:09:48 2012
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="1.0">
+    <info organisation="myorg" module="osgimodule" revision="1.0" />
+    <publications>
+        <artifact name="osgimodule" type="jar" ext="jar" conf="default" />
+        <artifact name="osgimodule" type="source" ext="jar" conf="default" />
+    </publications>
+    <dependencies>
+    </dependencies>
+</ivy-module>

Propchange: ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/ivy-1.0.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/ivy-1.0.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/ivy-1.0.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/jars/osgimodule-1.0.jar
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/jars/osgimodule-1.0.jar?rev=1372650&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/jars/osgimodule-1.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/zip

Added: ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/sources/osgimodule-1.0.jar
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/sources/osgimodule-1.0.jar?rev=1372650&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ant/ivy/ivyde/trunk/test/fakerepo/myorg/osgimodule/sources/osgimodule-1.0.jar
------------------------------------------------------------------------------
    svn:mime-type = application/zip

Propchange: ant/ivy/ivyde/trunk/test/osgi/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Aug 13 22:09:48 2012
@@ -0,0 +1 @@
+bin

Added: ant/ivy/ivyde/trunk/test/osgi/.classpath
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/osgi/.classpath?rev=1372650&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ant/ivy/ivyde/trunk/test/osgi/.classpath
------------------------------------------------------------------------------
    svn:mime-type = application/xml

Added: ant/ivy/ivyde/trunk/test/osgi/.project
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/osgi/.project?rev=1372650&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/osgi/.project (added)
+++ ant/ivy/ivyde/trunk/test/osgi/.project Mon Aug 13 22:09:48 2012
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>ivydetest-osgi</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.apache.ivyde.eclipse.ivynature</nature>
+	</natures>
+</projectDescription>

Propchange: ant/ivy/ivyde/trunk/test/osgi/.project
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/test/osgi/.project
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/test/osgi/.project
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ant/ivy/ivyde/trunk/test/osgi/ivy.xml
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/osgi/ivy.xml?rev=1372650&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/osgi/ivy.xml (added)
+++ ant/ivy/ivyde/trunk/test/osgi/ivy.xml Mon Aug 13 22:09:48 2012
@@ -0,0 +1,31 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivy-module version="1.0">
+    <info organisation="org.apache.ivyde" module="ivytest-osgi">
+        <description>
+            Project to test the osgi rules
+        </description>
+    </info>
+    <configurations>
+        <conf name="default" />
+    </configurations>
+    <dependencies>
+        <dependency org="myorg" name="osgimodule" rev="1.0" conf="default" />
+    </dependencies>
+</ivy-module>

Propchange: ant/ivy/ivyde/trunk/test/osgi/ivy.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/test/osgi/ivy.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/test/osgi/ivy.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ant/ivy/ivyde/trunk/test/osgi/ivysettings.xml
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/osgi/ivysettings.xml?rev=1372650&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/osgi/ivysettings.xml (added)
+++ ant/ivy/ivyde/trunk/test/osgi/ivysettings.xml Mon Aug 13 22:09:48 2012
@@ -0,0 +1,28 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivysettings>
+    <caches defaultCacheDir="${ivy.settings.dir}/../cache-fakerepo" useOrigin="false"
/>
+    <settings defaultResolver="fakerepo" checkUpToDate="false" />
+    <resolvers>
+        <filesystem name="fakerepo">
+            <ivy pattern="${ivy.settings.dir}/../fakerepo/[organisation]/[module]/ivy-[revision].xml"/>
+            <artifact pattern="${ivy.settings.dir}/../fakerepo/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
+        </filesystem>
+    </resolvers>
+</ivysettings>

Propchange: ant/ivy/ivyde/trunk/test/osgi/ivysettings.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/test/osgi/ivysettings.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/test/osgi/ivysettings.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ant/ivy/ivyde/trunk/test/osgi/src/Test.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/test/osgi/src/Test.java?rev=1372650&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/test/osgi/src/Test.java (added)
+++ ant/ivy/ivyde/trunk/test/osgi/src/Test.java Mon Aug 13 22:09:48 2012
@@ -0,0 +1,27 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+import myorg.osgimodule.api.ApiClass;
+import myorg.osgimodule.internal.InternalClass;
+
+public class Test {
+
+	public static void main(String[] args) {
+		System.out.print(new ApiClass().echo()); // this should compile
+		System.out.print(new InternalClass().echo()); // this should not compile!
+	}
+}

Propchange: ant/ivy/ivyde/trunk/test/osgi/src/Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/test/osgi/src/Test.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/test/osgi/src/Test.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message