ajack 2004/02/01 10:44:44
Modified: python/gump/model workspace.py rawmodel.py loader.py
python/gump/document resolver.py forrest.py
python/gump/net mailer.py
python/gump/test/resources/full1 profile.xml
Added: python/gump/model server.py
python/gump/storage logic.py
python/gump/test/resources/full1 server1.xml
Removed: python/gump logic.py
Log:
Added server objects.
Need to work with these, to add logs and such, to get the owner full credit/return
on investment.
Still need to work these into linking, and 'result.xml' downloading.
Revision Changes Path
1.24 +43 -4 jakarta-gump/python/gump/model/workspace.py
Index: workspace.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/model/workspace.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- workspace.py 29 Jan 2004 03:49:58 -0000 1.23
+++ workspace.py 1 Feb 2004 18:44:44 -0000 1.24
@@ -71,6 +71,7 @@
from gump.model.state import *
from gump.model.repository import Repository
+from gump.model.server import Server
from gump.model.module import Module, createUnnamedModule
from gump.model.project import Project, ProjectSummary
from gump.model.profile import Profile
@@ -105,6 +106,7 @@
self.modules={}
self.projects={}
self.profiles={}
+ self.servers={}
#
PropertyContainer.importProperties(self,self.xml)
@@ -150,6 +152,21 @@
return self.sortedRepositories
+ # Server Interface
+
+ def hasServer(self,rname):
+ return self.servers.has_key(rname)
+
+ def getServer(self,rname):
+ return self.servers[rname]
+
+ def getServers(self):
+ return self.servers.values()
+
+ def getSortedServers(self):
+ return self.sortedServers
+
+
# Profile Interface
def hasProfile(self,mname):
@@ -194,7 +211,9 @@
def getSortedProjects(self):
return self.sortedProjects
- def complete(self, xmlprofiles, xmlrepositories, xmlmodules, xmlprojects):
+ def complete(self, xmlprofiles, xmlrepositories, \
+ xmlmodules, xmlprojects, \
+ xmlservers):
if self.isComplete(): return
#
@@ -289,6 +308,19 @@
self.repositories[repoName] = repository
#
+ # Import all servers
+ #
+ for xmlserver in xmlservers.values():
+ server=Server(xmlserver,self)
+ serverName=server.getName()
+ if serverName in self.servers:
+ # Duplicate, uh oh...
+ self.addError("Duplicate server name [" + serverName + "]")
+ else:
+ server.complete(self)
+ self.servers[serverName] = server
+
+ #
# Import all modules
#
for xmlmodule in xmlmodules.values():
@@ -322,6 +354,12 @@
for repository in self.getRepositories():
repository.check(self)
+ #
+ # Check servers.
+ #
+ for server in self.getServers():
+ server.check(self)
+
# Complete the projects
haveUnnamedModule=0
for project in self.getProjects():
@@ -354,6 +392,7 @@
self.sortedProjects=createOrderedList(self.getProjects())
self.sortedRepositories=createOrderedList(self.getRepositories())
self.sortedProfiles=createOrderedList(self.getProfiles())
+ self.sortedServer=createOrderedList(self.getServers())
# Copy over any XML errors/warnings
transferAnnotations(self.xml, self)
1.12 +15 -3 jakarta-gump/python/gump/model/rawmodel.py
Index: rawmodel.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/model/rawmodel.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- rawmodel.py 28 Jan 2004 00:13:39 -0000 1.11
+++ rawmodel.py 1 Feb 2004 18:44:44 -0000 1.12
@@ -116,6 +116,7 @@
self.project=Multiple(XMLProject)
self.module=Multiple(XMLModule)
self.repository=Multiple(XMLRepository)
+ self.server=Multiple(XMLServer)
self.profile=Multiple(XMLProfile)
self.version=Single(GumpXMLModelObject)
@@ -127,6 +128,7 @@
self.project=Multiple(XMLProject)
self.module=Multiple(XMLModule)
self.repository=Multiple(XMLRepository)
+ self.server=Multiple(XMLServer)
# represents a <module/> element
class XMLModule(Named):
@@ -141,6 +143,15 @@
self.nag=Multiple(XMLNag)
self.project=Multiple(XMLProject)
+# represents a <server/> element
+class XMLServer(Named):
+ list={}
+ def init(self):
+ self.attribution=Single(GumpXMLModelObject)
+ self.title=Single(GumpXMLModelObject)
+ self.url=Single(GumpXMLModelObject)
+ self.site=Single(GumpXMLModelObject)
+
# represents a <repository/> element
class XMLRepository(Named):
list={}
@@ -160,6 +171,7 @@
self.password=Single(GumpXMLModelObject)
self.hostname=Single(GumpXMLModelObject)
self.path=Single(GumpXMLModelObject)
+
# represents a <project/> element
class XMLProject(Named):
1.5 +6 -2 jakarta-gump/python/gump/model/loader.py
Index: loader.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/model/loader.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- loader.py 9 Jan 2004 19:57:18 -0000 1.4
+++ loader.py 1 Feb 2004 18:44:44 -0000 1.5
@@ -64,7 +64,8 @@
import os, os.path
from gump import log
-from gump.model.rawmodel import
XMLWorkspace,XMLProfile,XMLModule,XMLProject,XMLRepository
+from gump.model.rawmodel import XMLWorkspace,XMLProfile, \
+ XMLModule,XMLProject,XMLRepository, XMLServer
from gump.model.workspace import Workspace
from gump.model.module import Module
from gump.utils.xmlutils import SAXDispatcher
@@ -94,6 +95,7 @@
XMLRepository.map={}
XMLModule.map={}
XMLProject.map={}
+ XMLServer.map={}
log.debug("Launch SAX Dispatcher onto : " + file);
@@ -115,7 +117,8 @@
# Cook the raw model...
#
workspace.complete(XMLProfile.map,XMLRepository.map, \
- XMLModule.map,XMLProject.map)
+ XMLModule.map,XMLProject.map, \
+ XMLServer.map)
#
# Clear out the maps [so don't continue to use them]
@@ -124,6 +127,7 @@
XMLProject.map={}
XMLProfile.map={}
XMLRepository.map={}
+ XMLServer.map={}
return workspace
1.1 jakarta-gump/python/gump/model/server.py
Index: server.py
===================================================================
#!/usr/bin/env python
# $Header: /home/cvs/jakarta-gump/python/gump/model/repository.py,v 1.8 2004/01/20
21:55:23 ajack Exp $
# $Revision: 1.8 $
# $Date: 2004/01/20 21:55:23 $
#
# ====================================================================
#
# The Apache Software License, Version 1.1
#
# Copyright (c) 2003 The Apache Software Foundation. All rights
# reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. The end-user documentation included with the redistribution, if
# any, must include the following acknowlegement:
# "This product includes software developed by the
# Apache Software Foundation (http://www.apache.org/)."
# Alternately, this acknowlegement may appear in the software itself,
# if and wherever such third-party acknowlegements normally appear.
#
# 4. The names "The Jakarta Project", "Alexandria", and "Apache Software
# Foundation" must not be used to endorse or promote products derived
# from this software without prior written permission. For written
# permission, please contact [EMAIL PROTECTED]
#
# 5. Products derived from this software may not be called "Apache"
# nor may "Apache" appear in their names without prior written
# permission of the Apache Group.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# ====================================================================
#
# This software consists of voluntary contributions made by many
# individuals on behalf of the Apache Software Foundation. For more
# information on the Apache Software Foundation, please see
# <http://www.apache.org/>.
"""
This module contains information on
"""
from gump.model.state import *
from gump.model.stats import *
from gump.model.object import NamedModelObject
from gump.utils import getIndent
class Server(NamedModelObject, Statable):
"""A named server"""
def __init__(self,xml,workspace):
NamedModelObject.__init__(self,xml.getName(),xml,workspace)
def complete(self,workspace):
pass
def check(self,workspace):
pass
def hasType(self):
if self.type: return 1
return 0
def getType(self):
return self.type
def dump(self, indent=0, output=sys.stdout):
output.write(getIndent(indent)+'Server : ' + self.name + '\n')
NamedModelObject.dump(self,indent+1,output)
1.12 +8 -3 jakarta-gump/python/gump/document/resolver.py
Index: resolver.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/document/resolver.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- resolver.py 21 Jan 2004 21:26:02 -0000 1.11
+++ resolver.py 1 Feb 2004 18:44:44 -0000 1.12
@@ -77,6 +77,7 @@
from gump.output.statsdb import StatisticsGuru
from gump.output.xref import XRefGuru
from gump.model.repository import Repository
+from gump.model.server import Server
from gump.model.workspace import Workspace
from gump.model.module import Module
from gump.model.project import Project
@@ -141,6 +142,8 @@
path=Path()
elif isinstance(object, Repository):
path=Path(['gump_repo'])
+ elif isinstance(object, Server):
+ path=Path(['gump_srv'])
elif isinstance(object, StatisticsGuru):
path=Path(['gump_stats'])
elif isinstance(object, XRefGuru):
@@ -232,6 +235,7 @@
or isinstance(object,XRefGuru) :
document="index"+extn
elif isinstance(object, Project) \
+ or isinstance(object, Server) \
or isinstance(object, Repository) \
or isinstance(object, WorkItem):
document=gumpSafeName(object.getName()) + extn
@@ -248,6 +252,7 @@
def getIndexForObject(object):
if isinstance(object, Workspace) or \
+ isinstance(object, Server) or \
isinstance(object, Repository) or \
isinstance(object, StatisticsGuru) or \
isinstance(object, XRefGuru) or \
1.62 +71 -4 jakarta-gump/python/gump/document/forrest.py
Index: forrest.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/document/forrest.py,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- forrest.py 30 Jan 2004 17:22:58 -0000 1.61
+++ forrest.py 1 Feb 2004 18:44:44 -0000 1.62
@@ -238,7 +238,8 @@
# Pretty sorting...
sortedModuleList=createOrderedList(gumpSet.getModules())
sortedProjectList=createOrderedList(gumpSet.getSequence())
- sortedRepositoryList=createOrderedList(gumpSet.getRepositories())
+ sortedRepositoryList=createOrderedList(gumpSet.getRepositories())
+ sortedServerList=createOrderedList(workspace.getServers())
#
# ----------------------------------------------------------------------
@@ -377,6 +378,31 @@
#
# ----------------------------------------------------------------------
#
+ # Servers.xml
+ #
+ document=XDocDocument( 'All Servers', \
+ self.resolver.getFile(workspace,'servers'))
+
+ serversSection=document.createSection('All Servers')
+ serversTable=serversSection.createTable(['Name'])
+
+ scount=0
+ for server in sortedServerList:
+
+ scount+=1
+
+ serverRow=serversTable.createRow()
+ serverRow.createComment(server.getName())
+
+ self.insertLink( server, workspace, serverRow.createData())
+
+ if not scount: serversTable.createLine('None')
+
+ document.serialize()
+
+ #
+ # ----------------------------------------------------------------------
+ #
# buildLog.xml -- Projects in build order
#
document=XDocDocument('Project Build Log', \
@@ -648,6 +674,12 @@
self.documentRepository(repo,workspace,gumpSet)
#
+ # Document repositories
+ #
+ for server in workspace.getServers():
+ self.documentServer(server,workspace,gumpSet)
+
+ #
# Document modules
#
for module in workspace.getModules():
@@ -733,6 +765,41 @@
self.documentXML(document,repo)
self.documentWorkList(document,repo,'Repository-level Work')
+
+ document.serialize()
+
+ def documentServer(self,server,workspace,gumpSet):
+
+ document=XDocDocument( 'Server : ' + server.getName(), \
+ self.resolver.getFile(server))
+
+ # Provide a description/link back to the server site.
+# descriptionSection=document.createSection('Description')
+# description=''
+# if server.hasDescription():
+# description=escape(server.getDescription())
+# if not description.strip().endswith('.'):
+# description+='. '
+# if not description:
+# description='No description provided.'
+# if server.hasURL():
+# description+=' For more information, see: ' +
self.getFork(server.getURL())
+# else:
+# description+=' (No server URL provided).'
+#
+# descriptionSection.createParagraph().createRaw(description)
+
+ self.documentAnnotations(document,server)
+
+ detailSection=document.createSection('Server Details')
+ detailList=detailSection.createList()
+
+ if server.hasTitle():
+ detailList.createEntry('Title: ', server.getTitle())
+
+ self.documentXML(document,server)
+
+ self.documentWorkList(document,server,'Server-level Work')
document.serialize()
1.4 +5 -5 jakarta-gump/python/gump/net/mailer.py
Index: mailer.py
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/net/mailer.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- mailer.py 28 Jan 2004 22:54:50 -0000 1.3
+++ mailer.py 1 Feb 2004 18:44:44 -0000 1.4
@@ -134,7 +134,7 @@
# Attach to the SMTP server to send....
#
server = smtplib.SMTP(server,port)
- server.set_debuglevel(1)
+ # server.set_debuglevel(1)
server.sendmail(sane_fromaddr, sane_toaddrs, data)
server.quit()
@@ -144,7 +144,7 @@
log.error("From :" + str(fromaddr))
log.error("To :" + str(toaddrs))
log.error("------------------------------------------------------")
- log.error(data)
+ log.error(data, exc_info=1)
def sanitizeAddress(addr):
parts=addr.split('<')
1.1 jakarta-gump/python/gump/storage/logic.py
Index: logic.py
===================================================================
#!/usr/bin/env python
# $Header: /home/cvspublic/jakarta-gump/python/gump/conf.py,v 1.7 2003/05/10
18:20:36 nicolaken Exp $
# $Revision: 1.7 $
# $Date: 2003/05/10 18:20:36 $
#
# ====================================================================
#
# The Apache Software License, Version 1.1
#
# Copyright (c) 2003 The Apache Software Foundation. All rights
# reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. The end-user documentation included with the redistribution, if
# any, must include the following acknowlegement:
# "This product includes software developed by the
# Apache Software Foundation (http://www.apache.org/)."
# Alternately, this acknowlegement may appear in the software itself,
# if and wherever such third-party acknowlegements normally appear.
#
# 4. The names "The Jakarta Project", "Alexandria", and "Apache Software
# Foundation" must not be used to endorse or promote products derived
# from this software without prior written permission. For written
# permission, please contact [EMAIL PROTECTED]
#
# 5. Products derived from this software may not be called "Apache"
# nor may "Apache" appear in their names without prior written
# permission of the Apache Group.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# ====================================================================
#
# This software consists of voluntary contributions made by many
# individuals on behalf of the Apache Software Foundation. For more
# information on the Apache Software Foundation, please see
# <http://www.apache.org/>.
"""
This is the logic gump applies to the model in order to perform tasks.
"""
import os.path
import os
import sys
import logging
import types
from string import split
from fnmatch import fnmatch
from gump import log, load
from gump.launcher import Cmd, Parameters
from gump.conf import dir, default, handleArgv
from gump.model import Workspace, Module, Project
from gump.context import *
from gump.tools import listDirectoryAsWork
###############################################################################
# Initialize
###############################################################################
###############################################################################
# Classes
###############################################################################
###############################################################################
# Functions
###############################################################################
# NOTE: THIS FILE IS NEXT TO OBSOLETE, ONCE WE MOVE OUT STUFF
# static void main()
if __name__=='__main__':
# init logging
logging.basicConfig()
#set verbosity to show all messages of severity >= default.logLevel
log.setLevel(default.logLevel)
args = handleArgv(sys.argv)
ws=args[0]
ps=args[1]
context=GumpContext()
# get parsed workspace definition
workspace=load(ws, context)
#projects=getPackagedProjects(context)
#print "Packaged Projects : " + str(len(projects))
#for p in projects: print "Packaged Project " + str(p.name)
printSeparator()
print "Project Expression : " + ps
projects=getProjectsForProjectExpression(ps)
#print "Resolved Projects : " + str(len(projects))
#for p in projects: print "Project " + str(p.name)
#modules=getModulesForProjectExpression(ps)
#print "Resolved Modules : " + str(len(modules))
#for m in modules: print "Module " + str(m.name) + " : " + str(m.cvs.repository)
#projects=getBuildSequenceForProjects(getProjectsForProjectExpression(ps))
#print "Resolved Project Tree : " + str(len(projects))
#for p in projects: print "Project " + str(p.name)
#modules=getModulesForProjectList(projects)
#print "Resolved Module Tree : " + str(len(modules))
#for m in modules: print "Module " + str(m.name) + " : " + str(m.cvs.repository)
printSeparator()
# preprocessContext(workspace, context)
# from gump.document import documentText
# documentText(workspace, context, ps)
for project in projects:
(cp,bcp)=getClasspathLists(project,workspace,context,1)
print "Project : " + project.name
for p in cp:
if isinstance(p,AnnotatedPath):
pp='Unnamed'
ppp='Unnamed'
if p.context: pp=p.context.name
if p.pcontext: ppp=p.pcontext.name
print " - " + str(p) + " : " + pp + " : " + ppp + " : " + str(p.note)
else:
print " + " + str(p)
for p in bcp:
if isinstance(p,AnnotatedPath):
pp='Unnamed'
ppp='Unnamed'
if p.context: pp=p.context.name
if p.pcontext: ppp=p.pcontext.name
print " - " + str(p) + " : " + pp + " : " + ppp + " : " + str(p.note)
+ " --- BOOT"
else:
print " + " + str(p) + " --- BOOT"
cmd=getBuildCommand(workspace,Module.list[project.module],project,context)
if cmd:
cmd.dump()
1.6 +2 -0 jakarta-gump/python/gump/test/resources/full1/profile.xml
Index: profile.xml
===================================================================
RCS file: /home/cvs/jakarta-gump/python/gump/test/resources/full1/profile.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- profile.xml 19 Jan 2004 23:26:08 -0000 1.5
+++ profile.xml 1 Feb 2004 18:44:44 -0000 1.6
@@ -16,6 +16,8 @@
<module href="svn_module1.xml"/>
<module href="maven1.xml"/>
+ <server href="server1.xml"/>
+
<!-- Repository definitions -->
<repository href="repository1.xml"/>
1.1 jakarta-gump/python/gump/test/resources/full1/server1.xml
Index: server1.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<repository name="server1" type="python">
<title>Server 1</title>
<url>http://gump.apache.org</url>
</repository>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]