felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsav...@apache.org
Subject svn commit: r820254 - in /felix/trunk/sigil/ivy/resolver: .classpath src/org/apache/felix/sigil/ivy/ProjectRepository.java src/org/apache/felix/sigil/ivy/SigilParser.java src/org/apache/felix/sigil/ivy/SigilResolver.java
Date Wed, 30 Sep 2009 12:30:00 GMT
Author: dsavage
Date: Wed Sep 30 12:30:00 2009
New Revision: 820254

URL: http://svn.apache.org/viewvc?rev=820254&view=rev
Log:
* Remove org.apache.felix.sigil.common.core from org.apache.felix.sigil.ivy.resolver .classpath
file
* Refactor resolver code to avoid need to import internal classes
(FELIX-1663)

Modified:
    felix/trunk/sigil/ivy/resolver/.classpath
    felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepository.java
    felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilParser.java
    felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilResolver.java

Modified: felix/trunk/sigil/ivy/resolver/.classpath
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/ivy/resolver/.classpath?rev=820254&r1=820253&r2=820254&view=diff
==============================================================================
--- felix/trunk/sigil/ivy/resolver/.classpath (original)
+++ felix/trunk/sigil/ivy/resolver/.classpath Wed Sep 30 12:30:00 2009
@@ -2,7 +2,6 @@
 <classpath>
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry combineaccessrules="false" kind="src" path="/org.apache.felix.sigil.common.core"/>
 	<classpathentry kind="con" path="org.apache.felix.sigil.classpathContainer"/>
 	<classpathentry kind="output" path="build/classes"/>
 </classpath>

Modified: felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepository.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepository.java?rev=820254&r1=820253&r2=820254&view=diff
==============================================================================
--- felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepository.java (original)
+++ felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/ProjectRepository.java Wed
Sep 30 12:30:00 2009
@@ -25,15 +25,16 @@
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.felix.sigil.common.osgi.VersionRange;
 import org.apache.felix.sigil.config.BldFactory;
 import org.apache.felix.sigil.config.IBldProject;
 import org.apache.felix.sigil.config.IBldProject.IBldBundle;
-import org.apache.felix.sigil.core.internal.model.eclipse.SigilBundle;
-import org.apache.felix.sigil.core.internal.model.osgi.BundleModelElement;
 import org.apache.felix.sigil.core.licence.ILicensePolicy;
+import org.apache.felix.sigil.model.ModelElementFactory;
 import org.apache.felix.sigil.model.eclipse.ISigilBundle;
 import org.apache.felix.sigil.model.osgi.IBundleModelElement;
 import org.apache.felix.sigil.model.osgi.IPackageExport;
@@ -41,8 +42,8 @@
 import org.apache.felix.sigil.model.osgi.IRequiredBundle;
 import org.apache.felix.sigil.repository.AbstractBundleRepository;
 import org.apache.felix.sigil.repository.IRepositoryVisitor;
+import org.apache.ivy.core.module.descriptor.Artifact;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
-import org.apache.ivy.core.module.id.ModuleRevisionId;
 
 import org.osgi.framework.Version;
 
@@ -246,7 +247,7 @@
 
         for (IBldBundle bb : project.getBundles())
         {
-            IBundleModelElement info = new BundleModelElement();
+            IBundleModelElement info = ModelElementFactory.getInstance().newModelElement(IBundleModelElement.class);
 
             for (IPackageExport pexport : bb.getExports())
             {
@@ -272,77 +273,27 @@
             Version version = new Version(bb.getVersion());
             info.setVersion(version);
 
-            ProjectBundle pb = new ProjectBundle();
+            ISigilBundle pb = ModelElementFactory.getInstance().newModelElement(ISigilBundle.class);
             pb.setBundleInfo(info);
-            pb.setId(bb.getId());
-
+            
+            Map<Object, Object> meta = new HashMap<Object, Object>();
             ModuleDescriptor md = SigilParser.instance().parseDescriptor(uri.toURL());
+            if ( !bb.getId().equals( md.getModuleRevisionId().getName() ) )
+            { // non-default artifact
+                for ( Artifact a : md.getAllArtifacts() ) {
+                    if ( a.getName().equals( bb.getId() ) ) {
+                        meta.put(Artifact.class, a);
+                        break;
+                    }
+                }
+            }
 
-            ModuleRevisionId mrid = md.getModuleRevisionId();
-            pb.setModule(mrid.getName());
-            pb.setOrg(mrid.getOrganisation());
-            // XXX: should revision be configurable?
-            pb.setRevision("latest." + md.getStatus());
-
+            meta.put(ModuleDescriptor.class, md);
+            pb.setMeta(meta);
+            
             list.add(pb);
             Log.debug("ProjectRepository: added " + pb);
             Log.debug("ProjectRepository: exports " + bb.getExports());
         }
     }
-
-    public static class ProjectBundle extends SigilBundle
-    {
-        private String id;
-        private String module;
-        private String org;
-        private String revision;
-
-        @Override
-        public String toString()
-        {
-            return "ProjectBundle[" + org + "@" + module + (id == null ? "" : "$" + id)
-                + "#" + revision + "]";
-        }
-
-        public String getModule()
-        {
-            return module;
-        }
-
-        public void setModule(String module)
-        {
-            this.module = module;
-        }
-
-        public String getId()
-        {
-            return id;
-        }
-
-        public void setId(String id)
-        {
-            this.id = id;
-        }
-
-        public String getRevision()
-        {
-            return revision;
-        }
-
-        public void setRevision(String rev)
-        {
-            this.revision = rev;
-        }
-
-        public String getOrg()
-        {
-            return org;
-        }
-
-        public void setOrg(String org)
-        {
-            this.org = org;
-        }
-    }
-
 }

Modified: felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilParser.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilParser.java?rev=820254&r1=820253&r2=820254&view=diff
==============================================================================
--- felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilParser.java (original)
+++ felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilParser.java Wed Sep
30 12:30:00 2009
@@ -537,23 +537,24 @@
                     continue;
                 }
 
-                if ( bundle instanceof ProjectRepository.ProjectBundle )
+                ModuleDescriptor bmd = (ModuleDescriptor) bundle.getMeta().get(ModuleDescriptor.class);
+                if ( bmd != null )
                 {
-                    ProjectRepository.ProjectBundle pb = ( ProjectRepository.ProjectBundle
) bundle;
-                    String org = pb.getOrg();
+                    ModuleRevisionId bmrid = bmd.getModuleRevisionId();
+                    String org = bmrid.getOrganisation();
                     if ( org == null )
                         org = masterMrid.getOrganisation();
-                    String id = pb.getId();
-                    String module = pb.getModule();
-                    String rev = pb.getRevision();
+                    String module = bmrid.getName();
+                    String rev = "latest." + bmd.getStatus();
 
                     mrid = ModuleRevisionId.newInstance( org, module, rev );
+                    
                     dd = new SigilDependencyDescriptor( md, mrid, force, changing, transitive
);
 
-                    if ( !id.equals( module ) )
-                    { // non-default artifact
-                        dd.addDependencyArtifact( module, new DefaultDependencyArtifactDescriptor(
dd, id, "jar",
-                            "jar", null, null ) );
+                    Artifact artifact = (Artifact) bundle.getMeta().get(Artifact.class);
+                    if ( artifact != null ) {
+                        dd.addDependencyArtifact( mrid.getName(), new DefaultDependencyArtifactDescriptor(
dd, artifact.getName(), "jar",
+                            "jar", null, null ) );                        
                     }
                 }
                 else

Modified: felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilResolver.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilResolver.java?rev=820254&r1=820253&r2=820254&view=diff
==============================================================================
--- felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilResolver.java (original)
+++ felix/trunk/sigil/ivy/resolver/src/org/apache/felix/sigil/ivy/SigilResolver.java Wed Sep
30 12:30:00 2009
@@ -39,10 +39,11 @@
 
 import org.apache.felix.sigil.common.osgi.VersionRange;
 import org.apache.felix.sigil.config.BldFactory;
-import org.apache.felix.sigil.core.internal.model.osgi.RequiredBundle;
 import org.apache.felix.sigil.model.IModelElement;
+import org.apache.felix.sigil.model.ModelElementFactory;
 import org.apache.felix.sigil.model.eclipse.ISigilBundle;
 import org.apache.felix.sigil.model.osgi.IBundleModelElement;
+import org.apache.felix.sigil.model.osgi.IRequiredBundle;
 import org.apache.felix.sigil.repository.IResolution;
 import org.apache.felix.sigil.repository.ResolutionException;
 import org.apache.ivy.core.module.descriptor.Artifact;
@@ -247,7 +248,7 @@
             range = "[" + revision + "," + revision + "]";
         }
 
-        RequiredBundle bundle = new RequiredBundle();
+        IRequiredBundle bundle = ModelElementFactory.getInstance().newModelElement(IRequiredBundle.class);
         bundle.setSymbolicName( id.getName() );
         bundle.setVersions( VersionRange.parseVersionRange( range ) );
 



Mime
View raw message