geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r542973 - in /geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library: Library.groovy codestation/ codestation/LibraryImpl.groovy codestation/LibraryRepositoryImpl.groovy svn/LibraryImpl.groovy
Date Wed, 30 May 2007 23:42:22 GMT
Author: jdillon
Date: Wed May 30 16:42:21 2007
New Revision: 542973

URL: http://svn.apache.org/viewvc?view=rev&rev=542973
Log:
Add library impl backed up by anthill's codestation repo

Added:
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/codestation/
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/codestation/LibraryImpl.groovy
  (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/codestation/LibraryRepositoryImpl.groovy
  (with props)
Modified:
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/Library.groovy
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/svn/LibraryImpl.groovy

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/Library.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/Library.groovy?view=diff&rev=542973&r1=542972&r2=542973
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/Library.groovy
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/Library.groovy
Wed May 30 16:42:21 2007
@@ -165,8 +165,6 @@
     
     abstract void checkout()
     
-    abstract void commit(String message)
-    
     abstract boolean isLatest()
     
     abstract void update()

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/codestation/LibraryImpl.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/codestation/LibraryImpl.groovy?view=auto&rev=542973
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/codestation/LibraryImpl.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/codestation/LibraryImpl.groovy
Wed May 30 16:42:21 2007
@@ -0,0 +1,144 @@
+/*
+ * 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.
+ */
+
+//
+// $Id$
+//
+
+package gbuild.system.library.codestation
+
+import gbuild.system.library.Library
+
+import org.apache.commons.lang.time.StopWatch
+
+/**
+ * Abstraction of a library backed by AntHill's Codestation.
+ */
+class LibraryImpl extends Library
+{
+    String projectName
+    String workflowName
+    String setName
+    String stamp
+    
+    def LibraryImpl(String projectName, String workflowName, String setName, String stamp,
File baseDir) {
+        super(baseDir)
+        
+        this.projectName = projectName
+        this.workflowName = workflowName
+        this.setName = setName
+        this.stamp = stamp
+    }
+    
+    protected Library createCloneForDir(File targetDir) {
+        assert targetDir
+        
+        return new LibraryImpl(projectName, workflowName, setName, stamp, targetDir)
+    }
+    
+    void checkout() {
+        log.info "Checking out library from: $sourceURL"
+        
+        assert !exists()
+        baseDir.parentFile.mkdirs()
+        
+        // The client works on a workingDir, and then relative target directories, so to
avoid
+        // needing to configure both, set the parent as the workingDir, and then use the
child's
+        // name for the relative bits below
+        client.workingDir = baseDir.parentFile.canonicalPath
+        
+        def doc = lookupProject(client)
+        def profileId = client.extractProfileId(doc)
+        log.debug("Profile ID: ${profileId}")
+        
+        def _buildLifeId = client.extractBuildlifeId(doc)
+        log.debug("BuildLife ID: ${_buildLifeId}")
+        
+        //
+        // FIXME: This is bound to cause OOME for large artifact sets
+        //
+        
+        def files = client.retrieveArtifacts(projectName, profileId, null, _buildLifeId,
setName, baseDir.name)
+        
+        log.info("Resolved ${files.size()} file(s)")
+        
+        if (log.debugEnabled) {
+            int i=0
+            files.each {
+                log.debug("[${i++}] $it")
+            }
+        }
+    }
+    
+    boolean isLatest() {
+        log.info "Checking for changes in: $baseDir"
+        
+        assert exists()
+        
+        //
+        // TODO
+        //
+    }
+    
+    void update() {
+        //
+        // TODO
+        //
+    }
+    
+    /**
+     * Create a Codestation client.
+     */
+    private CodestationClient createClient() {
+        CodestationClient client = new CodestationClient(serverUrl, !checkCertificate)
+        client.debug = debug
+        
+        if (username) {
+            client.username = username
+        }
+        if (password) {
+            client.password = password
+        }
+        
+        return client
+    }
+    
+    /**
+     * Fetches the project document based on either stamp or buildlife id.
+     */
+    private def lookupProject(client) {
+        assert client
+        
+        // Complain of both stamp and buildLifeId are set
+        if (stamp && buildLifeId) {
+            fail("Only one of 'stamp' or 'buildLifeId' is permitted")
+        }
+        
+        if (stamp) {
+            return client.projectLookup(projectName, workflowName, stamp)
+        }
+        else if (buildLifeId) {
+            return client.projectLookup(projectName, workflowName, buildLifeId)
+        }
+        else {
+            fail("Missing either 'stamp' or 'buildLifeId' parameters")
+        }
+    }
+}
+

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/codestation/LibraryImpl.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/codestation/LibraryImpl.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/codestation/LibraryImpl.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/codestation/LibraryRepositoryImpl.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/codestation/LibraryRepositoryImpl.groovy?view=auto&rev=542973
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/codestation/LibraryRepositoryImpl.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/codestation/LibraryRepositoryImpl.groovy
Wed May 30 16:42:21 2007
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+//
+// $Id$
+//
+
+package gbuild.system.library.codestation
+
+import gbuild.system.library.Library
+import gbuild.system.library.LibraryRepository
+
+/**
+ * Support for libraries backed by AntHill's Codestataion.
+ */
+class LibraryRepositoryImpl extends LibraryRepository
+{
+    URL baseURL
+    
+    def LibraryRepositoryImpl(baseURL) {
+        assert baseURL
+        
+        this.baseURL = new URL("$baseURL")
+    }
+    
+    Library createLibrary(File baseDir, String name, String version) {
+        assert baseDir
+        assert name
+        assert version
+        
+        def t = name.tokenize('/')
+        assert t.size() == 3
+        
+        def projectName = t[0]
+        def workflowName = t[1]
+        def setName = t[2]
+        
+        def targetDir = new File("$baseDir/$name/$version")
+        
+        return new LibraryImpl(projectName, workflowName, setName, version, targetDir)
+    }
+}
+

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/codestation/LibraryRepositoryImpl.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/codestation/LibraryRepositoryImpl.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/codestation/LibraryRepositoryImpl.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/svn/LibraryImpl.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/svn/LibraryImpl.groovy?view=diff&rev=542973&r1=542972&r2=542973
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/svn/LibraryImpl.groovy
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/system/library/svn/LibraryImpl.groovy
Wed May 30 16:42:21 2007
@@ -149,23 +149,6 @@
     }
     
     /**
-     * Commit changes to the library.
-     */
-    void commit(String message) {
-        if (true) {
-            throw new Exception("This won't work anymore... pending massive update to change
how this works")
-        }
-        
-        assert message
-        
-        log.info "Commiting changes; message: $message"
-        
-        assert exists()
-        
-        svn('commit', [ '--message', message, baseDir ])
-    }
-    
-    /**
      * Check if the library is the latest revision
      */
     boolean isLatest() {



Mime
View raw message