archiva-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eshan Sudharaka <esudhar...@gmail.com>
Subject Re: SourceAritfacts class
Date Mon, 14 Jun 2010 16:55:08 GMT
yes. i got your point. previously i was confusing how to return that
ArtifactMetaData list since we have a Artifact list .
now i added a method which is returning ArtifactMetadata list for a
particular artifact.

so the caller first need to get the Artifact list and then pass those
artifacts one by one to get the Artifactmetadata.

http://jira.codehaus.org/secure/ManageAttachments.jspa?id=75406

thanks.

On Mon, Jun 14, 2010 at 6:21 PM, Deng Ching <oching@apache.org> wrote:

> We're using ArtifactMetadata to abstract what type of artifact it is
> (whether it is a maven artifact or simply a file in the repository)..
>  Also,
> if you'll returning a list of Artifact objects from the SourceArtifact
> class then from those Artifact objects, you'll be querying for the artifact
> metadata again in the repository merge, won't it be redundant since in the
> first place you already have ArtifactMetadata objects in the SourceArtifact
> class but you returned a list of Artifact objects instead?
>
> Thanks,
> Deng
>
> On Sun, Jun 13, 2010 at 12:21 PM, Eshan Sudharaka <esudharaka@gmail.com
> >wrote:
>
> > as i understood the purpose of the SourceArtifacts class is the return a
> > list of available artifacts to the caller. Once the caller receives the
> list
> > i guess it is his responsibility to get the ArtifactMetaData using
> >
> >      **  metadataRepository.getArtifacts( repoId, namespace, projectId,
> > projectVersion );
> >
> >
> >
> >
> >
> >
> > On Fri, Jun 11, 2010 at 9:28 PM, Eshan Sudharaka <esudharaka@gmail.com
> >wrote:
> >
> >> i have a problem regarding
> >>   Collection<ArtifactMetadata> getArtifacts( String repoId, String
> >> namespace, String projectId,  String projectVersion );
> >>  method.
> >>
> >> here parameters are unique to a particular artifact. so what are  the
> >> things  that  returning list  contains ?
> >>
> >> as i understood class ArtifactMetadata contains the details for a
> >> particular artifact. So i am wondering how this method returns a list
> for
> >> the parameters of a particular artifact ..
> >>
> >>
> >> also the purpose of sourceArtifact class is to retrieve the list of
> >> Artifacts in the target repo. i guess once we have Artifacts details
> >> (gruopId, artifact id , version) we can check that artifact is available
> or
> >> not using available archiva methods.(as deng menstioned for that task we
> >> need only artifacts coordinates) So i am still confusing why we need a
> list
> >> of  ArtifactMetadata instead of a list of Artifacts.
> >>
> >> may be inorder to update archiva meta data model this  ArtifactMetadata
> >> list will be usefull.
> >>
> >>
> >> On Fri, Jun 11, 2010 at 8:33 PM, Eshan Sudharaka <esudharaka@gmail.com
> >wrote:
> >>
> >>> package org.apache.archiva.stagerepository.merge.repodetails;
> >>>
> >>> /*
> >>>  * 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 org.apache.archiva.metadata.repository.DefaultMetadataResolver;
> >>> import org.apache.archiva.metadata.repository.MetadataRepository;
> >>> import org.apache.archiva.metadata.repository.MetadataResolver;
> >>> import org.apache.archiva.web.xmlrpc.api.beans.Artifact;
> >>> import java.util.List;
> >>> import java.util.Collection;
> >>> import java.util.ArrayList;
> >>> import java.util.Iterator;
> >>> import org.slf4j.Logger;
> >>> import org.slf4j.LoggerFactory;
> >>>
> >>> /**
> >>>  * @plexus.component
> >>> role="org.apache.archiva.repodetails.SourceAritfacts"
> >>>  */
> >>>
> >>> public class SourceAritfacts
> >>> {
> >>>
> >>>     /**
> >>>      * @plexus.requirement
> >>>      */
> >>>     private MetadataResolver metadataResolver;
> >>>
> >>>     private ArrayList<String> rootNameSpacesList;
> >>>
> >>>     private ArrayList<String> gruopIdList;
> >>>
> >>>     private ArrayList<String> artifactsList;
> >>>
> >>>     private ArrayList<String> artifactsVersionsList;
> >>>
> >>>     private List<Artifact>  artifactsListWithDetails;
> >>>
> >>>     private String repoId;
> >>>
> >>>     private static final Logger log = LoggerFactory.getLogger(
> >>> SourceAritfacts.class );
> >>>
> >>>     public List<Artifact> getSourceArtifactList(String repoId)
> >>>     {
> >>>         this.repoId = repoId;
> >>>         artifactsListWithDetails = new ArrayList<Artifact>();
> >>>         process();
> >>>         return artifactsListWithDetails;
> >>>     }
> >>>
> >>>
> >>>     private void process()
> >>>     {
> >>>         //this will get the root name spaces eg : org, com
> >>>         rootNameSpacesList = ( ArrayList<String> )
> >>> metadataResolver.getRootNamespaces( repoId );
> >>>         gruopIdList = new ArrayList<String>() ;
> >>>         artifactsList = new ArrayList<String>() ;
> >>>
> >>>         //following iterates through the  root name spaces list and get
> >>> the gruo id of relavet root name spaces.
> >>>         for( String namespace : rootNameSpacesList )
> >>>         {
> >>>             //this will get the gruop id list of relavant name space .
> eg
> >>> : org > archiva(gruop id)
> >>>             gruopIdList =
> >>> (ArrayList<String>)metadataResolver.getNamespaces( repoId , namespace
> );
> >>>
> >>>             // following will iterates through the particular gruop id
> 's
> >>>             for (String gruopId : gruopIdList )
> >>>             {
> >>>                 // parse the parameters "repoId" and "namespace + gruop
> >>> id "to  artifacts list. eg : params = ("internal" , "org.archiva")
> >>>                 artifactsList =
> >>> (ArrayList<String>)metadataResolver.getNamespaces( repoId,namespace
+
> "." +
> >>> gruopId );
> >>>
> >>>                 for (String artifact : artifactsList)
> >>>                 {
> >>>                     //iterates through the artifacts and get the
> >>> available versions of a particular artifact
> >>>                     artifactsVersionsList = ( ArrayList <String>
> >>> )metadataResolver.getProjectVersions( repoId , namespace + "." +
> gruopId ,
> >>> artifact );
> >>>                     Artifact artifactWithDetails = new Artifact();
> >>>
> >>>                     for (String version : artifactsVersionsList)
> >>>                     {
> >>>                         //assign gathered attributes Artifact object
> and
> >>> add it in to the list
> >>>                         artifactWithDetails.setVersion(version);
> >>>                         artifactWithDetails.setArtifactId(artifact);
> >>>                         artifactWithDetails.setGroupId(gruopId);
> >>>                         artifactWithDetails.setRepositoryId(repoId);
> >>>
> >>> artifactsListWithDetails.add(artifactWithDetails);
> >>>
> >>>                     }
> >>>                 }
> >>>             }
> >>>         }
> >>>
> >>>
> >>>     }
> >>> }
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> P.A.Eshan Sudharaka
> >>> Dept of Computer Science and Engineering
> >>> University of Moratuwa
> >>> Sri Lanka
> >>>
> >>
> >>
> >>
> >> --
> >> P.A.Eshan Sudharaka
> >> Dept of Computer Science and Engineering
> >> University of Moratuwa
> >> Sri Lanka
> >>
> >
> >
> >
> > --
> > P.A.Eshan Sudharaka
> > Dept of Computer Science and Engineering
> > University of Moratuwa
> > Sri Lanka
> >
>



-- 
P.A.Eshan Sudharaka
Dept of Computer Science and Engineering
University of Moratuwa
Sri Lanka

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message