You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(233) |
Sep
(199) |
Oct
(206) |
Nov
(185) |
Dec
(270) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(232) |
Feb
(426) |
Mar
(623) |
Apr
(592) |
May
(506) |
Jun
(389) |
Jul
(160) |
Aug
(3) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(5) |
2007 |
Jan
(1) |
Feb
(1) |
Mar
(2) |
Apr
(2) |
May
(4) |
Jun
(2) |
Jul
|
Aug
(3) |
Sep
(5) |
Oct
(9) |
Nov
(6) |
Dec
(6) |
2008 |
Jan
(3) |
Feb
|
Mar
(1) |
Apr
(3) |
May
(3) |
Jun
(5) |
Jul
(10) |
Aug
(2) |
Sep
(12) |
Oct
(10) |
Nov
(54) |
Dec
(49) |
2009 |
Jan
(19) |
Feb
(13) |
Mar
(20) |
Apr
(24) |
May
(44) |
Jun
(29) |
Jul
(32) |
Aug
(10) |
Sep
(7) |
Oct
(10) |
Nov
(4) |
Dec
(17) |
2010 |
Jan
(14) |
Feb
(5) |
Mar
(23) |
Apr
(50) |
May
(31) |
Jun
(9) |
Jul
(5) |
Aug
(4) |
Sep
(7) |
Oct
(5) |
Nov
(2) |
Dec
(3) |
2011 |
Jan
(12) |
Feb
(5) |
Mar
(5) |
Apr
(3) |
May
(4) |
Jun
(3) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2012 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(4) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2015 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jbo...@li...> - 2006-01-06 18:21:11
|
Author: wrzep Date: 2006-01-06 13:21:03 -0500 (Fri, 06 Jan 2006) New Revision: 2007 Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Column.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java Log: improved project specyfic page http://jira.jboss.com/jira/browse/JBLAB-415 Pawel Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Column.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Column.java 2006-01-06 07:25:19 UTC (rev 2006) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Column.java 2006-01-06 18:21:03 UTC (rev 2007) @@ -61,8 +61,12 @@ * @param projectId id of the project to fill value for */ public void fillProjectContext(DelegateContext projectContext, String projectId) { + DelegateContext entryContext = projectContext.next("entry"); + Long value = plugin.getValue(projectId); entryContext.put("value", Long.toString(value)); + + entryContext.put("name", getName()); } } Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java 2006-01-06 07:25:19 UTC (rev 2006) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java 2006-01-06 18:21:03 UTC (rev 2007) @@ -157,7 +157,7 @@ DelegateContext columnContext = new DelegateContext(); columnContext.put("name", column.getName()); - context.append("collumn", columnContext); + context.append("column", columnContext); } } |
From: <jbo...@li...> - 2006-01-06 07:25:45
|
Author: mic...@jb... Date: 2006-01-06 02:25:19 -0500 (Fri, 06 Jan 2006) New Revision: 2006 Added: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/AttachmentPersistTest.java trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/RulePersistenceTest.java trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/RuleSetPersistenceTest.java Removed: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/AttachmentFile.hbm.xml trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/AttachmentPersistTest.java trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RulePersistenceTest.java trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RuleSetPersistenceTest.java Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/MetaData.java trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleDef.java trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetAttachment.java trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetDef.java trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetVersionInfo.java trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/db/RepositoryImpl.java trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleDef.hbm.xml trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetAttachment.hbm.xml trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetDef.hbm.xml trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetVersionInfo.hbm.xml trunk/labs/jbossrules/drools-repository/src/test/resources/hibernate.cfg.xml Log: pre weekend commit Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/MetaData.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/MetaData.java 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/MetaData.java 2006-01-06 07:25:19 UTC (rev 2006) @@ -4,9 +4,12 @@ import java.util.Date; /** + * MetaData for rule assets. + * * This is based on the <a href="http://dublincore.org/documents/dces/"> Dublin * Core</a> specification. Not * all of these fields will be used by everyone. They should only be used for classification. + * An alternative approach is to use the free form "tagging" of Rule assets. */ public class MetaData implements @@ -130,7 +133,12 @@ this.title = title; } - public MetaData copy(){ + /** + * This is used for versioning. + * MetaData itself is not versioned, but copies of it are taken when + * other assets are versioned. + */ + MetaData copy(){ MetaData copy = new MetaData(); copy.contributor = this.contributor; copy.coverage = this.coverage; Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleDef.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleDef.java 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleDef.java 2006-01-06 07:25:19 UTC (rev 2006) @@ -7,6 +7,9 @@ public class RuleDef extends Persistent { + + private static final long serialVersionUID = -677781085801764266L; + private String name; private long versionNumber; private String content; @@ -19,21 +22,10 @@ private String documentation; private Date effectiveDate; private Date expiryDate; - private boolean deleted; - public boolean isDeleted(){ - return deleted; - } - - public void setDeleted(boolean deleted){ - this.deleted = deleted; - } - - - /** * Use tagging to aid with searching and sorting of large numbers of rules. * Tags should not effect the versioning of the rules. @@ -58,16 +50,10 @@ this.name = name; this.content = content; this.versionNumber = 1; - this.head = true; this.tags = new HashSet(); } - /** - * This little cheat tells the repo that this - * rule is at the head of versions. - */ - private boolean head; + - public String getContent(){ return content; } @@ -100,12 +86,7 @@ public void setCheckedOutBy(String checkOutBy){ this.checkedOutBy = checkOutBy; } - public boolean isHead(){ - return head; - } - public void setHead(boolean isHead){ - this.head = isHead; - } + public String getVersionComment(){ return versionComment; } @@ -115,7 +96,7 @@ public long getVersionNumber(){ return this.versionNumber; } - private void setVersionNumber(long versionNumber){ + void setVersionNumber(long versionNumber){ this.versionNumber = versionNumber; } public String getDocumentation(){ @@ -150,7 +131,9 @@ return this; } - /** return a list of tags as Strings */ + /** return a list of tags as Strings. Tags are stored as Tag objects, + * but are essentially strings. + */ public String[] listTags() { String[] tagList = new String[tags.size()]; @@ -163,14 +146,24 @@ return tagList; } - public RuleDef createNewVersion() { -// if (this.checkedOut) { -// throw new RuleRepositoryLockException("Rule is checked out by " + this.checkedOutBy); -// } + /** + * Copy the tags. It is allowable to reuse the same Tag identities. + */ + private Set copyTags() { + Set newTags = new HashSet(); + for ( Iterator iter = this.tags.iterator(); iter.hasNext(); ) { + Tag tag = (Tag) iter.next(); + newTags.add(tag); + } + return newTags; + } + + /** + * This is used for versioning. + */ + RuleDef copy() { RuleDef newVersion = new RuleDef(); newVersion.content = this.content; - this.head = false; - newVersion.head = true; newVersion.documentation = documentation; newVersion.effectiveDate = this.effectiveDate; newVersion.expiryDate = this.expiryDate; @@ -179,39 +172,8 @@ } newVersion.name = this.name; newVersion.status = ""; - newVersion.tags = this.copyTags(); - newVersion.versionNumber = this.versionNumber + 1; + newVersion.tags = this.copyTags(); return newVersion; } - - - - private Set copyTags() { - Set newTags = new HashSet(); - for ( Iterator iter = this.tags.iterator(); iter.hasNext(); ) { - Tag tag = (Tag) iter.next(); - newTags.add(tag); - } - return newTags; - } - - - -// public boolean equals(Object arg){ -// if (arg.getClass() != this.getClass()) return false; -// RuleDef other = (RuleDef) arg; -// return (other.versionNumber == this.versionNumber -// && other.name.equals(this.name)); -// } -// -// -// -// public int hashCode(){ -// int result = this.name.hashCode(); -// return new Long(versionNumber).hashCode() + 27 * result; -// } - - - } Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetAttachment.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetAttachment.java 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetAttachment.java 2006-01-06 07:25:19 UTC (rev 2006) @@ -1,35 +1,47 @@ package org.drools.repository; -import java.util.HashSet; -import java.util.Set; /** - * A RuleSetAttachment contains a ruleset that is stored in a non-normalised format. + * A RuleSetAttachment may contain a ruleset that is stored in a non-normalised format. * An attachment may be a spreadsheet for instance. Or it may be a HTML document and a properties file. - * An "attachment" will contain one or more AttachmentFiles, which actually wraps the content. + * It can even be a plain old DRL file. * - * These are versioned along with the ruleset (with optional per save versioning). + * Attachments can also be miscellanious files, such as test scripts or documentation. The deployer will + * use the typeOfAttachment property to work out what to do with it. * + * These are versioned along with the ruleset (with per save versioning as well). + * * @author <a href="mailto:mic...@gm..."> Michael Neale</a> * */ public class RuleSetAttachment extends Persistent { + + private static final long serialVersionUID = 7474038734785975202L; + + + private byte[] content; + private String originalFileName; + private String typeOfAttachment; - private Set attachments = new HashSet(); + private String name; private long versionNumber = 1; public RuleSetAttachment(String typeOfAttachment, - String name){ + String name, + byte[] content, + String originalFileName ) { super(); this.typeOfAttachment = typeOfAttachment; this.name = name; + this.content = content; + this.originalFileName = originalFileName; } - public RuleSetAttachment() { + RuleSetAttachment() { } public String getName(){ @@ -42,22 +54,6 @@ } - public Set getAttachments(){ - return attachments; - } - - - private void setAttachments(Set attachments){ - this.attachments = attachments; - } - - - public RuleSetAttachment addFile(AttachmentFile file) { - this.attachments.add(file); - return this; - } - - public String getTypeOfAttachment(){ return typeOfAttachment; } @@ -69,9 +65,25 @@ return versionNumber; } - public void setVersionNumber(long versionNumber){ + void setVersionNumber(long versionNumber){ this.versionNumber = versionNumber; } + + public byte[] getContent(){ + return content; + } + + public void setContent(byte[] content){ + this.content = content; + } + + public String getOriginalFileName(){ + return originalFileName; + } + + public void setOriginalFileName(String originalFileName){ + this.originalFileName = originalFileName; + } Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetDef.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetDef.java 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetDef.java 2006-01-06 07:25:19 UTC (rev 2006) @@ -1,6 +1,9 @@ package org.drools.repository; +import java.util.ArrayList; import java.util.HashSet; +import java.util.Iterator; +import java.util.List; import java.util.Set; /** @@ -8,11 +11,9 @@ * The workingVersionNumber drives what version of rules will be included in this ruleset. * Changing this number will mean that different versions of ruledefs are loaded etc. * - * * @author <a href="mailto:mic...@gm..."> Michael Neale</a> - * */ -public class RuleSetDef extends Persistent { +public class RuleSetDef extends Persistent implements Comparable { private static final long serialVersionUID = 608068118653708104L; private String name; @@ -21,13 +22,14 @@ private Set tags; private long workingVersionNumber; private Set versionHistory; - private RuleSetAttachment attachment; + private Set attachments; public RuleSetDef(String name, MetaData meta) { this.name = name; this.metaData = meta; this.tags = new HashSet(); this.rules = new HashSet(); + this.attachments = new HashSet(); this.workingVersionNumber = 1; } @@ -38,16 +40,7 @@ RuleSetDef() { } - public RuleSetAttachment getAttachment(){ - return attachment; - } - - public void setAttachment(RuleSetAttachment attachment){ - this.attachment = attachment; - } - - public Set getVersionHistory(){ return versionHistory; } @@ -57,23 +50,49 @@ this.versionHistory = versionHistory; } + /** + * This adds a rule to the ruleset. + * + * If the rule already has an Id, and it is a different version number, then + * it will be copied for this ruleset. + * If it has the same version number, then it will be shared. + */ public RuleSetDef addRule(RuleDef rule) { - this.rules.add(rule); + if (rule.getId() == null) { + rule.setVersionNumber(this.workingVersionNumber); + this.rules.add(rule); + } else if (rule.getVersionNumber() == this.workingVersionNumber) { + this.rules.add(rule); + } else { + RuleDef copy = rule.copy(); + copy.setVersionNumber(this.workingVersionNumber); + this.rules.add(copy); + } return this; } + public RuleSetDef addAttachment(RuleSetAttachment attachmentFile) { + attachmentFile.setVersionNumber(this.workingVersionNumber); + this.attachments.add(attachmentFile); + return this; + } + public MetaData getMetaData(){ return metaData; } public void setMetaData(MetaData metaData){ this.metaData = metaData; } + + + /** The list of rules that are currently loaded for this ruleset */ public Set getRules(){ return rules; } private void setRules(Set rules){ this.rules = rules; } + public String getName(){ return name; } @@ -102,14 +121,84 @@ this.workingVersionNumber = workingVersionNumber; } - /** This method increments the version of the ruleset, creating a brand new version. + /** + * This method increments the working version of the ruleset, creating a brand new version. * This records the event in the version history. - * All rules and ruleset-attachments that are connected to this version of the ruleset are + * + * Typically you would call this method when you want to make a stable version of a rule set (lock in all + * the related assets) and then move on to an "editing" version. You can always switch back to a previous version + * of a rulebase. + * + * All rules and ruleset-attachments etc that are + * connected to this version of the ruleset are cloned with the new workingVersionNumber. + * + * This means that the previous state of the RuleSet is kept in tact (for instance, as a release of rules). + * Rules can then be edited, removed and so on without effecting any previous versions of rules and the ruleset. + * + * Previous rules can be retrieved by changing the value of workingVersionNumber. + * + * Note that further to this, rules themselves will be versioned on save (think of that versioning as + * "minor" versions, and this sort of ruleset versions as major versions). + * + * Ideally once a new version is created, the RuleSet should be stored and then loaded fresh, + * which will hide the non working versions of the rules. + * */ public void createNewVersion(String comment, String newStatus) { + this.workingVersionNumber++; + RuleSetVersionInfo newVersion = new RuleSetVersionInfo(); + newVersion.setStatus(newStatus); + newVersion.setVersionNumber(this.workingVersionNumber); + this.versionHistory.add(newVersion); + //as the Ids are null, copied objects + //will get a new identity, and have the new workingVersionNumber + + //now have to create new rules and add to the collection + createNewRuleVersions( comment ); + +// //create new attachment +// for ( Iterator iter = this.attachments.iterator(); iter.hasNext(); ) { +// RuleSetAttachment att = (RuleSetAttachment) iter.next(); +// //TODO: need too finish this. +// att.copy(); +// +// } + + //create new functions, app data and imports etc. + System.out.println("DON'T FORGET FUNCTIONS ETC !!"); + } + + private void createNewRuleVersions(String comment){ + for ( Iterator iter = this.rules.iterator(); iter.hasNext(); ) { + RuleDef old = (RuleDef) iter.next(); + RuleDef clone = (RuleDef) old.copy(); + clone.setVersionComment(comment); + clone.setVersionNumber(this.workingVersionNumber); + this.rules.add(clone); + } + } + public String toString() { + return "{ name=" + this.name + " , workingVersionNumber=" + this.workingVersionNumber + " }"; + } + + /** The name provides the natural ordering */ + public int compareTo(Object arg){ + if (arg instanceof RuleSetDef) { + return ((RuleSetDef) arg).name.compareTo(this.name); + } + return 0; + } + + public Set getAttachments(){ + return attachments; + } + + private void setAttachments(Set attachments){ + this.attachments = attachments; + } } Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetVersionInfo.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetVersionInfo.java 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetVersionInfo.java 2006-01-06 07:25:19 UTC (rev 2006) @@ -13,9 +13,11 @@ * @author <a href="mailto:mic...@gm..."> Michael Neale</a> * */ -public class RuleSetVersionInfo extends Persistent { +public class RuleSetVersionInfo extends Persistent implements Comparable { - private String createdByUser; + + private static final long serialVersionUID = 53728327711138178L; + private Date createdOn = new Date(); private long versionNumber; private String versionComment; @@ -29,23 +31,15 @@ this.status = status; } - public RuleSetVersionInfo(String createdByUser, - long versionNumber, + public RuleSetVersionInfo(long versionNumber, String versionComment){ super(); - this.createdByUser = createdByUser; this.versionNumber = versionNumber; this.versionComment = versionComment; } RuleSetVersionInfo() {} - public String getCreatedByUser(){ - return createdByUser; - } - public void setCreatedByUser(String createdByUser){ - this.createdByUser = createdByUser; - } public Date getCreatedOn(){ return createdOn; } @@ -64,6 +58,21 @@ public void setVersionNumber(long versionNumber){ this.versionNumber = versionNumber; } + + /** The version number provides the natural ordering */ + public int compareTo(Object arg){ + if (arg instanceof RuleSetVersionInfo) { + RuleSetVersionInfo info = (RuleSetVersionInfo) arg; + if (info.versionNumber == this.versionNumber ) { + return 0; + } else if (info.versionNumber < this.versionNumber) { + return -1; + } else { + return 1; + } + } + return 0; + } Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/db/RepositoryImpl.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/db/RepositoryImpl.java 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/db/RepositoryImpl.java 2006-01-06 07:25:19 UTC (rev 2006) @@ -27,17 +27,6 @@ //DODGY METHODS START - public List listAllRules(boolean head) { - Session session = getSession(); - session.beginTransaction(); - List results = session - .createQuery("from RuleDef where head = :head") - .setBoolean("head", head).setMaxResults(1000) - .list(); - session.getTransaction().commit(); - return results; - } - public RuleDef loadRule(String ruleName, long versionNumber) { Session session = getSession(); session.beginTransaction(); Deleted: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/AttachmentFile.hbm.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/AttachmentFile.hbm.xml 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/AttachmentFile.hbm.xml 2006-01-06 07:25:19 UTC (rev 2006) @@ -1,39 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE hibernate-mapping PUBLIC - "-//Hibernate/Hibernate Mapping DTD 3.0//EN" - "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> - - -<hibernate-mapping> - - <class name="org.drools.repository.AttachmentFile" table="FILE_ATTACHMENTS"> - <id name="id" column="ATTACHMENT_ID"> - <generator class="native"/> - </id> - - <property name="content"/> - <property name="contentType" /> - <property name="originalFileName" /> -<!-- - <component name="metaData"> - <property name="title" /> - <property name="creator" /> - <property name="subject" /> - <property name="description" /> - <property name="publisher" /> - <property name="contributor" /> - <property name="dateCreated" /> - <property name="format" /> - <property name="source" /> - <property name="language" /> - <property name="relation" /> - <property name="coverage" /> - <property name="rights" /> - </component> - --> - - - - </class> - -</hibernate-mapping> \ No newline at end of file Modified: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleDef.hbm.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleDef.hbm.xml 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleDef.hbm.xml 2006-01-06 07:25:19 UTC (rev 2006) @@ -21,8 +21,7 @@ <property name="documentation" /> <property name="effectiveDate" /> <property name="expiryDate" /> - <property name="head" /> - <property name="deleted" /> + <!-- want nothing to be lazy, no runtime proxies??? --> <!-- tags to aid with searching and management of rules --> Modified: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetAttachment.hbm.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetAttachment.hbm.xml 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetAttachment.hbm.xml 2006-01-06 07:25:19 UTC (rev 2006) @@ -13,11 +13,8 @@ <property name="name" /> <property name="typeOfAttachment" /> - - <set name="attachments" table="RULESET_ATTACHMENT_FILES" lazy="false" cascade="all"> - <key column="RULESET_ATTACHMENT_ID"/> - <one-to-many class="org.drools.repository.AttachmentFile"/> - </set> + <property name="content" /> + <property name="originalFileName" /> </class> Modified: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetDef.hbm.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetDef.hbm.xml 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetDef.hbm.xml 2006-01-06 07:25:19 UTC (rev 2006) @@ -50,13 +50,12 @@ <one-to-many class="org.drools.repository.RuleSetVersionInfo"/> </set> - <!-- we need only one ruleset attachment object. The files are attached to it as a - collection --> - <many-to-one name="attachment" column="RULESET_ATTACHMENT_ID" - class="org.drools.repository.RuleSetAttachment" - lazy="false" - cascade="all" - unique="true"/> + <set name="attachments" lazy="false" cascade="all"> + <key column="RULESET_ID"/> + <one-to-many class="org.drools.repository.RuleSetAttachment"/> + </set> + + </class> Modified: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetVersionInfo.hbm.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetVersionInfo.hbm.xml 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetVersionInfo.hbm.xml 2006-01-06 07:25:19 UTC (rev 2006) @@ -15,7 +15,6 @@ <property name="versionNumber"/> <property name="versionComment"/> <property name="createdOn"/> - <property name="createdByUser"/> <property name="status" /> </class> Added: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/AttachmentPersistTest.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/AttachmentPersistTest.java 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/AttachmentPersistTest.java 2006-01-06 07:25:19 UTC (rev 2006) @@ -0,0 +1,16 @@ +package org.drools.repository; + +import org.drools.repository.db.PersistentCase; +import org.drools.repository.db.RepositoryImpl; + +public class AttachmentPersistTest extends PersistentCase { + + public void testLoadSave() { + RuleSetAttachment at = new RuleSetAttachment("test","test", "test".getBytes(), "blah.xml" ); + RepositoryImpl repo = getRepo(); + repo.save(at); + RuleSetAttachment at2 = repo.loadAttachment("test"); + assertEquals("test", at2.getTypeOfAttachment()); + } + +} Property changes on: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/AttachmentPersistTest.java ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/RulePersistenceTest.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/RulePersistenceTest.java 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/RulePersistenceTest.java 2006-01-06 07:25:19 UTC (rev 2006) @@ -0,0 +1,69 @@ +package org.drools.repository; + +import java.util.List; +import java.util.Set; + +import org.drools.repository.MetaData; +import org.drools.repository.RuleDef; +import org.drools.repository.db.PersistentCase; +import org.drools.repository.db.RepositoryImpl; + +public class RulePersistenceTest extends PersistentCase { + + public void testStoreNewRuleDef() throws Exception { + RepositoryImpl repo = getRepo(); + RuleDef def = repo.save(new RuleDef("myRule", "A rule")); + assertNotNull(def.getId()); + def = repo.save(new RuleDef("myRule2", "A rule2")); + def = new RuleDef("myRule3", "A rule3"); + def.addTag("tag1").addTag("tag2").addTag("HR"); + def = repo.save(def); + assertNotNull(def.getId()); + } + + + + public void testRetreieveRuleWithTags() { + RepositoryImpl repo = getRepo(); + RuleDef newRule = new RuleDef("my rule", "content"); + newRule.addTag("HR").addTag("SALARY"); + repo.save(newRule); + + RuleDef rule = repo.loadRule("my rule", 1); + assertNotNull(rule); + assertEquals("my rule", rule.getName()); + + Set tags = rule.getTags(); + assertEquals(2, tags.size()); + String[] tagList = rule.listTags(); + assertTrue(tagList[0].equals("HR") || tagList[0].equals("SALARY")); + + List rules = repo.findRulesByTag("HR"); + assertTrue(rules.size() > 0); + + } + + public void testRuleCopy() { + RepositoryImpl repo = getRepo(); + + RuleDef rule1 = new RuleDef("newVersionTest", "XXX"); + rule1.addTag("HR").addTag("BOO"); + + MetaData meta = new MetaData(); + meta.setCreator("Peter Jackson"); + rule1.setMetaData(meta); + + repo.save(rule1); + RuleDef ruleCopy = rule1.copy(); + assertEquals(null, ruleCopy.getId()); + assertEquals(2, ruleCopy.getTags().size()); + assertEquals("Peter Jackson", ruleCopy.getMetaData().getCreator()); + + } + + + + + + +} Property changes on: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/RulePersistenceTest.java ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/RuleSetPersistenceTest.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/RuleSetPersistenceTest.java 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/RuleSetPersistenceTest.java 2006-01-06 07:25:19 UTC (rev 2006) @@ -0,0 +1,89 @@ +package org.drools.repository; + +import java.util.HashSet; +import java.util.Set; + +import org.drools.repository.AttachmentFile; +import org.drools.repository.MetaData; +import org.drools.repository.RuleDef; +import org.drools.repository.RuleSetAttachment; +import org.drools.repository.RuleSetDef; +import org.drools.repository.RuleSetVersionInfo; +import org.drools.repository.db.PersistentCase; +import org.drools.repository.db.RepositoryImpl; + +public class RuleSetPersistenceTest extends PersistentCase { + + public void testLoadSaveRuleSet() { + MetaData meta = new MetaData(); + meta.setCreator("Michael Neale"); + meta.setRights("Unlimited"); + + RuleSetDef def = new RuleSetDef("my ruleset", meta); + def.addTag("ME"); + RepositoryImpl repo = getRepo(); + repo.save(def); + + RuleSetDef def2 = repo.loadRuleSet("my ruleset"); + assertEquals("my ruleset", def2.getName()); + assertEquals("Michael Neale", def2.getMetaData().getCreator()); + assertEquals(1, def2.getTags().size()); + + } + + public void testRuleSetWithRules() { + MetaData meta = new MetaData(); + meta.setCreator("Michael Neale"); + RuleSetDef ruleSet = new RuleSetDef("Uber 1", meta); + ruleSet.addRule(new RuleDef("UBER1Rule", "This is a rule")); + RuleDef def = new RuleDef("UBER2Rule", "this is also a rule"); + def.addTag("HR").addTag("BUS"); + ruleSet.addRule(def); + ruleSet.addTag("HR"); + + RepositoryImpl repo = getRepo(); + repo.save(ruleSet); + + RuleSetDef loaded = repo.loadRuleSet("Uber 1"); + assertEquals(2, loaded.getRules().size()); + + } + + public void testRuleSetWithAttachment() { + MetaData meta = new MetaData(); + meta.setCreator("Michael Neale - Uber pimp"); + RuleSetDef ruleSet = new RuleSetDef("Attachmate", meta); + + RuleSetAttachment attachment = new RuleSetAttachment("decision-table", + "my text file", + "content".getBytes(), + "file.txt"); + ruleSet.addAttachment(attachment); + + RepositoryImpl repo = getRepo(); + repo.save(ruleSet); + + RuleSetDef result = repo.loadRuleSet("Attachmate"); + assertEquals(1, result.getAttachments().size()); + RuleSetAttachment at2 = (RuleSetAttachment) result.getAttachments().iterator().next(); + assertEquals("file.txt", at2.getOriginalFileName()); + } + + public void testRuleSetWithVersionHistory() { + RuleSetDef def = new RuleSetDef("WithHistory", null); + Set history = new HashSet(); + RuleSetVersionInfo info = new RuleSetVersionInfo(1, "blah"); + + history.add(info); + RuleSetVersionInfo info2 = new RuleSetVersionInfo(2, "woo"); + history.add(info2); + + def.setVersionHistory(history); + RepositoryImpl repo = getRepo(); + repo.save(def); + + RuleSetDef def2 = repo.loadRuleSet("WithHistory"); + assertEquals(2, def2.getVersionHistory().size()); + } + +} Property changes on: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/RuleSetPersistenceTest.java ___________________________________________________________________ Name: svn:eol-style + native Deleted: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/AttachmentPersistTest.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/AttachmentPersistTest.java 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/AttachmentPersistTest.java 2006-01-06 07:25:19 UTC (rev 2006) @@ -1,25 +0,0 @@ -package org.drools.repository.db; - -import org.drools.repository.AttachmentFile; -import org.drools.repository.RuleSetAttachment; - -public class AttachmentPersistTest extends PersistentCase { - - public void testLoadSave() { - RuleSetAttachment at = new RuleSetAttachment(); - at.setName("RS1"); - at.setTypeOfAttachment("DRL"); - - AttachmentFile file = new AttachmentFile("blah".getBytes(), "text", "blah.drl"); - at.addFile(file); - - RepositoryImpl repo = getRepo(); - repo.save(at); - - RuleSetAttachment at2 = repo.loadAttachment("RS1"); - assertEquals("DRL", at2.getTypeOfAttachment()); - - assertEquals(1, at2.getAttachments().size()); - } - -} Deleted: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RulePersistenceTest.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RulePersistenceTest.java 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RulePersistenceTest.java 2006-01-06 07:25:19 UTC (rev 2006) @@ -1,79 +0,0 @@ -package org.drools.repository.db; - -import java.util.List; -import java.util.Set; - -import org.drools.repository.MetaData; -import org.drools.repository.RuleDef; - -public class RulePersistenceTest extends PersistentCase { - - public void testStoreNewRuleDef() throws Exception { - RepositoryImpl repo = getRepo(); - RuleDef def = repo.save(new RuleDef("myRule", "A rule")); - assertNotNull(def.getId()); - def = repo.save(new RuleDef("myRule2", "A rule2")); - def = new RuleDef("myRule3", "A rule3"); - def.addTag("tag1").addTag("tag2").addTag("HR"); - def = repo.save(def); - assertNotNull(def.getId()); - } - - public void testListRules() { - RepositoryImpl repo = getRepo(); - repo.save(new RuleDef("blah", "blah")); - List list = repo.listAllRules(true); - assertTrue(list.size() > 0); - } - - public void testRetreieveRuleWithTags() { - RepositoryImpl repo = getRepo(); - RuleDef newRule = new RuleDef("my rule", "content"); - newRule.addTag("HR").addTag("SALARY"); - repo.save(newRule); - - RuleDef rule = repo.loadRule("my rule", 1); - assertNotNull(rule); - assertEquals("my rule", rule.getName()); - - Set tags = rule.getTags(); - assertEquals(2, tags.size()); - String[] tagList = rule.listTags(); - assertTrue(tagList[0].equals("HR") || tagList[0].equals("SALARY")); - - List rules = repo.findRulesByTag("HR"); - assertTrue(rules.size() > 0); - - } - - public void testNewVersionOfRule() { - RepositoryImpl repo = getRepo(); - - RuleDef rule1 = new RuleDef("newVersionTest", "XXX"); - MetaData meta = new MetaData(); - meta.setCreator("Peter Jackson"); - rule1.setMetaData(meta); - - repo.save(rule1); - - RuleDef rule2 = rule1.createNewVersion(); - rule2.addTag("PJ"); - - repo.save(rule2); - repo.save(rule1); - - RuleDef latest = repo.loadRule("newVersionTest", 2); - assertEquals("Peter Jackson", latest.getMetaData().getCreator()); - - List ruleHistory = repo.listRuleHistory("newVersionTest"); - assertEquals(2, ruleHistory.size()); - assertEquals(1, ((RuleDef) ruleHistory.get(0)).getVersionNumber()); - assertEquals(2, ((RuleDef) ruleHistory.get(1)).getVersionNumber()); - } - - - - - - -} Deleted: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RuleSetPersistenceTest.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RuleSetPersistenceTest.java 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RuleSetPersistenceTest.java 2006-01-06 07:25:19 UTC (rev 2006) @@ -1,86 +0,0 @@ -package org.drools.repository.db; - -import java.util.HashSet; -import java.util.Set; - -import org.drools.repository.AttachmentFile; -import org.drools.repository.MetaData; -import org.drools.repository.RuleDef; -import org.drools.repository.RuleSetAttachment; -import org.drools.repository.RuleSetDef; -import org.drools.repository.RuleSetVersionInfo; - -public class RuleSetPersistenceTest extends PersistentCase { - - public void testLoadSaveRuleSet() { - MetaData meta = new MetaData(); - meta.setCreator("Michael Neale"); - meta.setRights("Unlimited"); - - RuleSetDef def = new RuleSetDef("my ruleset", meta); - def.addTag("ME"); - RepositoryImpl repo = getRepo(); - repo.save(def); - - RuleSetDef def2 = repo.loadRuleSet("my ruleset"); - assertEquals("my ruleset", def2.getName()); - assertEquals("Michael Neale", def2.getMetaData().getCreator()); - assertEquals(1, def2.getTags().size()); - - } - - public void testRuleSetWithRules() { - MetaData meta = new MetaData(); - meta.setCreator("Michael Neale"); - RuleSetDef ruleSet = new RuleSetDef("Uber 1", meta); - ruleSet.addRule(new RuleDef("UBER1Rule", "This is a rule")); - RuleDef def = new RuleDef("UBER2Rule", "this is also a rule"); - def.addTag("HR").addTag("BUS"); - ruleSet.addRule(def); - ruleSet.addTag("HR"); - - RepositoryImpl repo = getRepo(); - repo.save(ruleSet); - - RuleSetDef loaded = repo.loadRuleSet("Uber 1"); - assertEquals(2, loaded.getRules().size()); - - } - - public void testRuleSetWithAttachment() { - MetaData meta = new MetaData(); - meta.setCreator("Michael Neale - Uber pimp"); - RuleSetDef ruleSet = new RuleSetDef("Attachmate", meta); - - RuleSetAttachment attachment = new RuleSetAttachment("decision-table", "my text file"); - attachment.addFile(new AttachmentFile("blah,blah".getBytes(), "text", "nothing.csv")); - attachment.addFile(new AttachmentFile("boo,boo".getBytes(), "binary", "smeg.xls")); - ruleSet.setAttachment(attachment); - - RepositoryImpl repo = getRepo(); - repo.save(ruleSet); - - RuleSetDef result = repo.loadRuleSet("Attachmate"); - assertNotNull(result); - assertEquals("decision-table", result.getAttachment().getTypeOfAttachment()); - assertEquals(2, result.getAttachment().getAttachments().size()); - } - - public void testRuleSetWithVersionHistory() { - RuleSetDef def = new RuleSetDef("WithHistory", null); - Set history = new HashSet(); - RuleSetVersionInfo info = new RuleSetVersionInfo("Michael", 1, "blah"); - - history.add(info); - RuleSetVersionInfo info2 = new RuleSetVersionInfo("Michael", 2, "woo"); - history.add(info2); - - def.setVersionHistory(history); - RepositoryImpl repo = getRepo(); - repo.save(def); - - RuleSetDef def2 = repo.loadRuleSet("WithHistory"); - assertEquals(2, def2.getVersionHistory().size()); - } - -} Modified: trunk/labs/jbossrules/drools-repository/src/test/resources/hibernate.cfg.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/resources/hibernate.cfg.xml 2006-01-06 07:19:01 UTC (rev 2005) +++ trunk/labs/jbossrules/drools-repository/src/test/resources/hibernate.cfg.xml 2006-01-06 07:25:19 UTC (rev 2006) @@ -37,7 +37,6 @@ <mapping resource="org/drools/repository/Tag.hbm.xml"/> <mapping resource="org/drools/repository/RuleSetDef.hbm.xml"/> <mapping resource="org/drools/repository/RuleSetAttachment.hbm.xml"/> - <mapping resource="org/drools/repository/AttachmentFile.hbm.xml"/> <mapping resource="org/drools/repository/RuleSetVersionInfo.hbm.xml"/> |
From: <jbo...@li...> - 2006-01-06 07:19:08
|
Author: aron.gombas Date: 2006-01-06 02:19:01 -0500 (Fri, 06 Jan 2006) New Revision: 2005 Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ScrapingUtils.java Log: Minor cosmetic change Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ScrapingUtils.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ScrapingUtils.java 2006-01-06 02:52:16 UTC (rev 2004) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/util/ScrapingUtils.java 2006-01-06 07:19:01 UTC (rev 2005) @@ -50,7 +50,7 @@ /** Downloads an XML document from the given URL and returns it as DOM. */ public static Document downloadXmlDom(URL url) throws Exception { - log.debug(String.format("Downloading DOM from %s...", url.toString())); + log.debug(String.format("Downloading DOM from \"%s\"...", url.toString())); Document dom = DocumentBuilderFactoryImpl.class.newInstance().newDocumentBuilder().parse(url.openStream()); log.debug(String.format("DOM top-level children: %d", dom.getChildNodes().getLength())); @@ -60,7 +60,7 @@ /** Downloads and tidies up an HTML document from the given URL and returns it as DOM. */ public static Document downloadHtmlDom(URL url) throws Exception { - log.debug(String.format("Downloading HTML DOM from %s...", url.toString())); + log.debug(String.format("Downloading HTML DOM from \"%s\"...", url.toString())); Tidy tidy = new Tidy(); tidy.setQuiet(true); |
Author: mic...@jb... Date: 2006-01-05 21:52:16 -0500 (Thu, 05 Jan 2006) New Revision: 2004 Added: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/AttachmentFile.java trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetAttachment.java trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetVersionInfo.java trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/AttachmentFile.hbm.xml trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetAttachment.hbm.xml trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetVersionInfo.hbm.xml trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/AttachmentPersistTest.java Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetDef.java trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/db/RepositoryImpl.java trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleDef.hbm.xml trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetDef.hbm.xml trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/Tag.hbm.xml trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RulePersistenceTest.java trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RuleSetPersistenceTest.java trunk/labs/jbossrules/drools-repository/src/test/resources/hibernate.cfg.xml Log: more working Added: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/AttachmentFile.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/AttachmentFile.java 2006-01-05 23:44:03 UTC (rev 2003) +++ trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/AttachmentFile.java 2006-01-06 02:52:16 UTC (rev 2004) @@ -0,0 +1,47 @@ +package org.drools.repository; + +/** + * Simply hold an individual attachment. Attachments stored using this are truly opaque. + * If they are DRL files, then they may be able to be stored and searched as text, + * but this is database specific (DRL files should be stored normalised via importing). + * @author <a href="mailto:mic...@gm..."> Michael Neale</a> + */ +public class AttachmentFile extends Persistent { + + private byte[] content; + private String contentType; + private String originalFileName; + + AttachmentFile() {} + + + public AttachmentFile(byte[] content, + String contentType, + String originalFileName){ + super(); + this.content = content; + this.contentType = contentType; + this.originalFileName = originalFileName; + } + + + public byte[] getContent(){ + return content; + } + public void setContent(byte[] content){ + this.content = content; + } + public String getContentType(){ + return contentType; + } + public void setContentType(String contentType){ + this.contentType = contentType; + } + public String getOriginalFileName(){ + return originalFileName; + } + public void setOriginalFileName(String originalFileName){ + this.originalFileName = originalFileName; + } + +} Property changes on: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/AttachmentFile.java ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetAttachment.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetAttachment.java 2006-01-05 23:44:03 UTC (rev 2003) +++ trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetAttachment.java 2006-01-06 02:52:16 UTC (rev 2004) @@ -0,0 +1,78 @@ +package org.drools.repository; + +import java.util.HashSet; +import java.util.Set; + +/** + * A RuleSetAttachment contains a ruleset that is stored in a non-normalised format. + * An attachment may be a spreadsheet for instance. Or it may be a HTML document and a properties file. + * An "attachment" will contain one or more AttachmentFiles, which actually wraps the content. + * + * These are versioned along with the ruleset (with optional per save versioning). + * + * @author <a href="mailto:mic...@gm..."> Michael Neale</a> + * + */ +public class RuleSetAttachment extends Persistent { + + private String typeOfAttachment; + private Set attachments = new HashSet(); + private String name; + private long versionNumber = 1; + + + public RuleSetAttachment(String typeOfAttachment, + String name){ + super(); + this.typeOfAttachment = typeOfAttachment; + this.name = name; + + } + + public RuleSetAttachment() { + } + + public String getName(){ + return name; + } + + + public void setName(String name){ + this.name = name; + } + + + public Set getAttachments(){ + return attachments; + } + + + private void setAttachments(Set attachments){ + this.attachments = attachments; + } + + + public RuleSetAttachment addFile(AttachmentFile file) { + this.attachments.add(file); + return this; + } + + + public String getTypeOfAttachment(){ + return typeOfAttachment; + } + public void setTypeOfAttachment(String typeOfAttachment){ + this.typeOfAttachment = typeOfAttachment; + } + + public long getVersionNumber(){ + return versionNumber; + } + + public void setVersionNumber(long versionNumber){ + this.versionNumber = versionNumber; + } + + + +} Property changes on: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetAttachment.java ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetDef.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetDef.java 2006-01-05 23:44:03 UTC (rev 2003) +++ trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetDef.java 2006-01-06 02:52:16 UTC (rev 2004) @@ -1,38 +1,67 @@ package org.drools.repository; -import java.util.ArrayList; import java.util.HashSet; -import java.util.List; import java.util.Set; +/** + * The ruleset definition contains a grouping of rules for editing/release. + * The workingVersionNumber drives what version of rules will be included in this ruleset. + * Changing this number will mean that different versions of ruledefs are loaded etc. + * + * + * @author <a href="mailto:mic...@gm..."> Michael Neale</a> + * + */ public class RuleSetDef extends Persistent { + private static final long serialVersionUID = 608068118653708104L; private String name; private MetaData metaData; private Set rules; - private Set tags; - + private Set tags; + private long workingVersionNumber; + private Set versionHistory; + private RuleSetAttachment attachment; + public RuleSetDef(String name, MetaData meta) { this.name = name; this.metaData = meta; this.tags = new HashSet(); this.rules = new HashSet(); - } + this.workingVersionNumber = 1; + } /** * This is not for public consumption. Use the * proper constructor instead. */ RuleSetDef() { + } + + public RuleSetAttachment getAttachment(){ + return attachment; } - + + + public void setAttachment(RuleSetAttachment attachment){ + this.attachment = attachment; + } + + + public Set getVersionHistory(){ + return versionHistory; + } + + + public void setVersionHistory(Set versionHistory){ + this.versionHistory = versionHistory; + } + public RuleSetDef addRule(RuleDef rule) { this.rules.add(rule); return this; } - - public MetaData getMetaData(){ return metaData; } @@ -64,6 +93,22 @@ this.tags.add(new Tag(tag)); return this; } + + public long getWorkingVersionNumber(){ + return workingVersionNumber; + } + + public void setWorkingVersionNumber(long workingVersionNumber){ + this.workingVersionNumber = workingVersionNumber; + } + + /** This method increments the version of the ruleset, creating a brand new version. + * This records the event in the version history. + * All rules and ruleset-attachments that are connected to this version of the ruleset are + */ + public void createNewVersion(String comment, String newStatus) { + + } Added: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetVersionInfo.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetVersionInfo.java 2006-01-05 23:44:03 UTC (rev 2003) +++ trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetVersionInfo.java 2006-01-06 02:52:16 UTC (rev 2004) @@ -0,0 +1,71 @@ +package org.drools.repository; + +import java.util.Date; + +/** + * This records information about a particular version of a ruleset. + * Rulesets themselves are just a collection of rules. + * Rules themselves are versioned, and rulesets pull together particular a common set of rule versions. + * + * Typically this co-incides with a release of a ruleset. + * Once a new version is created, all the rules are cloned, and the new version number applied. + * + * @author <a href="mailto:mic...@gm..."> Michael Neale</a> + * + */ +public class RuleSetVersionInfo extends Persistent { + + private String createdByUser; + private Date createdOn = new Date(); + private long versionNumber; + private String versionComment; + private String status; + + public String getStatus(){ + return status; + } + + public void setStatus(String status){ + this.status = status; + } + + public RuleSetVersionInfo(String createdByUser, + long versionNumber, + String versionComment){ + super(); + this.createdByUser = createdByUser; + this.versionNumber = versionNumber; + this.versionComment = versionComment; + } + + RuleSetVersionInfo() {} + + public String getCreatedByUser(){ + return createdByUser; + } + public void setCreatedByUser(String createdByUser){ + this.createdByUser = createdByUser; + } + public Date getCreatedOn(){ + return createdOn; + } + public void setCreatedOn(Date createdOn){ + this.createdOn = createdOn; + } + public String getVersionComment(){ + return versionComment; + } + public void setVersionComment(String versionComment){ + this.versionComment = versionComment; + } + public long getVersionNumber(){ + return versionNumber; + } + public void setVersionNumber(long versionNumber){ + this.versionNumber = versionNumber; + } + + + + +} Property changes on: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetVersionInfo.java ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/db/RepositoryImpl.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/db/RepositoryImpl.java 2006-01-05 23:44:03 UTC (rev 2003) +++ trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/db/RepositoryImpl.java 2006-01-06 02:52:16 UTC (rev 2004) @@ -1,14 +1,11 @@ package org.drools.repository.db; -import java.util.Iterator; import java.util.List; -import java.util.Set; import org.drools.repository.Repository; import org.drools.repository.RuleDef; +import org.drools.repository.RuleSetAttachment; import org.drools.repository.RuleSetDef; -import org.drools.repository.Tag; -import org.hibernate.Query; import org.hibernate.Session; @@ -16,28 +13,20 @@ public class RepositoryImpl implements Repository { /** This will simply save the current version of the rule */ - public RuleDef saveOrUpdateRule(RuleDef newRule) { + public RuleDef save(RuleDef newRule) { Session session = getSession(); session.beginTransaction(); session.saveOrUpdate(newRule); session.getTransaction().commit(); - //session.close(); + return newRule; } - /** This will simply save the current version of the rule */ - public RuleDef merge(RuleDef newRule) { - Session session = getSession(); - session.beginTransaction(); - session.merge(newRule); - - session.getTransaction().commit(); - return newRule; - } + //DODGY METHODS START public List listAllRules(boolean head) { Session session = getSession(); session.beginTransaction(); @@ -71,6 +60,7 @@ session.getTransaction().commit(); return result; } + //DODGY METHODS END public List findRulesByTag(String tag) { Session session = getSession(); @@ -84,7 +74,7 @@ - public RuleSetDef saveOrUpdateRuleSet(RuleSetDef ruleSet) { + public RuleSetDef save(RuleSetDef ruleSet) { Session session = getSession(); session.beginTransaction(); session.saveOrUpdate(ruleSet); @@ -102,6 +92,26 @@ return def; } + public void save(RuleSetAttachment attachment) { + Session session = getSession(); + session.beginTransaction(); + session.saveOrUpdate(attachment); + session.getTransaction().commit(); + } + + public RuleSetAttachment loadAttachment(String name) { + Session session = getSession(); + session.beginTransaction(); + RuleSetAttachment at = (RuleSetAttachment) + session.createQuery("from RuleSetAttachment where name = :name") + .setString("name", name) + .uniqueResult(); + session.getTransaction().commit(); + return at; + } + + + private Session getSession(){ Session session = HibernateUtil.getSessionFactory().getCurrentSession(); return session; Added: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/AttachmentFile.hbm.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/AttachmentFile.hbm.xml 2006-01-05 23:44:03 UTC (rev 2003) +++ trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/AttachmentFile.hbm.xml 2006-01-06 02:52:16 UTC (rev 2004) @@ -0,0 +1,39 @@ +<?xml version="1.0"?> +<!DOCTYPE hibernate-mapping PUBLIC + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> + + +<hibernate-mapping> + + <class name="org.drools.repository.AttachmentFile" table="FILE_ATTACHMENTS"> + <id name="id" column="ATTACHMENT_ID"> + <generator class="native"/> + </id> + + <property name="content"/> + <property name="contentType" /> + <property name="originalFileName" /> +<!-- + <component name="metaData"> + <property name="title" /> + <property name="creator" /> + <property name="subject" /> + <property name="description" /> + <property name="publisher" /> + <property name="contributor" /> + <property name="dateCreated" /> + <property name="format" /> + <property name="source" /> + <property name="language" /> + <property name="relation" /> + <property name="coverage" /> + <property name="rights" /> + </component> + --> + + + + </class> + +</hibernate-mapping> \ No newline at end of file Property changes on: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/AttachmentFile.hbm.xml ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleDef.hbm.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleDef.hbm.xml 2006-01-05 23:44:03 UTC (rev 2003) +++ trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleDef.hbm.xml 2006-01-06 02:52:16 UTC (rev 2004) @@ -10,11 +10,9 @@ <id name="id" column="RULE_ID"> <generator class="native"/> </id> - <natural-id> - <property name="name"/> - <property name="versionNumber" /> - </natural-id> + <property name="name"/> + <property name="versionNumber" /> <property name="content" /> <property name="status" /> <property name="checkedOut" /> @@ -25,7 +23,8 @@ <property name="expiryDate" /> <property name="head" /> <property name="deleted" /> - + + <!-- want nothing to be lazy, no runtime proxies??? --> <!-- tags to aid with searching and management of rules --> <set name="tags" table="RULE_TAGS" lazy="false" cascade="all"> <key column="RULE_ID"/> Added: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetAttachment.hbm.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetAttachment.hbm.xml 2006-01-05 23:44:03 UTC (rev 2003) +++ trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetAttachment.hbm.xml 2006-01-06 02:52:16 UTC (rev 2004) @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<!DOCTYPE hibernate-mapping PUBLIC + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> + + +<hibernate-mapping> + + <class name="org.drools.repository.RuleSetAttachment" table="RULESET_ATTACHMENTS"> + <id name="id" column="RULESET_ATTACHMENT_ID"> + <generator class="native"/> + </id> + + <property name="name" /> + <property name="typeOfAttachment" /> + + <set name="attachments" table="RULESET_ATTACHMENT_FILES" lazy="false" cascade="all"> + <key column="RULESET_ATTACHMENT_ID"/> + <one-to-many class="org.drools.repository.AttachmentFile"/> + </set> + + + </class> + +</hibernate-mapping> \ No newline at end of file Property changes on: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetAttachment.hbm.xml ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetDef.hbm.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetDef.hbm.xml 2006-01-05 23:44:03 UTC (rev 2003) +++ trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetDef.hbm.xml 2006-01-06 02:52:16 UTC (rev 2004) @@ -11,10 +11,11 @@ <generator class="native"/> </id> - <natural-id> - <property name="name" /> - </natural-id> + + <property name="name" /> + <property name="workingVersionNumber" /> + <component name="metaData"> <property name="title" /> <property name="creator" /> @@ -38,11 +39,25 @@ <one-to-many class="org.drools.repository.Tag"/> </set> + <set name="rules" table="RULESET_RULES" lazy="false" cascade="all"> <key column="RULESET_ID"/> <one-to-many class="org.drools.repository.RuleDef"/> </set> + <set name="versionHistory" table="RULESET_VERSION_HISTORY" lazy="false" cascade="all"> + <key column="RULESET_ID" /> + <one-to-many class="org.drools.repository.RuleSetVersionInfo"/> + </set> + + <!-- we need only one ruleset attachment object. The files are attached to it as a + collection --> + <many-to-one name="attachment" column="RULESET_ATTACHMENT_ID" + class="org.drools.repository.RuleSetAttachment" + lazy="false" + cascade="all" + unique="true"/> + </class> </hibernate-mapping> \ No newline at end of file Added: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetVersionInfo.hbm.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetVersionInfo.hbm.xml 2006-01-05 23:44:03 UTC (rev 2003) +++ trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetVersionInfo.hbm.xml 2006-01-06 02:52:16 UTC (rev 2004) @@ -0,0 +1,23 @@ +<?xml version="1.0"?> +<!DOCTYPE hibernate-mapping PUBLIC + "-//Hibernate/Hibernate Mapping DTD 3.0//EN" + "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> + + +<hibernate-mapping> + + <class name="org.drools.repository.RuleSetVersionInfo" table="RULESET_VERSION_INFO"> + + <id name="id" column="RULESET_VERSION_ID"> + <generator class="native" /> + </id> + + <property name="versionNumber"/> + <property name="versionComment"/> + <property name="createdOn"/> + <property name="createdByUser"/> + <property name="status" /> + + </class> + +</hibernate-mapping> \ No newline at end of file Property changes on: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetVersionInfo.hbm.xml ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/Tag.hbm.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/Tag.hbm.xml 2006-01-05 23:44:03 UTC (rev 2003) +++ trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/Tag.hbm.xml 2006-01-06 02:52:16 UTC (rev 2004) @@ -6,6 +6,9 @@ <hibernate-mapping> + <!-- NOTE I really want to make tag strings normalised + Need to add in logic for finding existing tags of same value + Or else use string as ID (not the best idea).--> <class name="org.drools.repository.Tag" table="DROOLS_TAGS"> <id name="id" column="TAG_ID"> <generator class="native" /> Added: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/AttachmentPersistTest.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/AttachmentPersistTest.java 2006-01-05 23:44:03 UTC (rev 2003) +++ trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/AttachmentPersistTest.java 2006-01-06 02:52:16 UTC (rev 2004) @@ -0,0 +1,25 @@ +package org.drools.repository.db; + +import org.drools.repository.AttachmentFile; +import org.drools.repository.RuleSetAttachment; + +public class AttachmentPersistTest extends PersistentCase { + + public void testLoadSave() { + RuleSetAttachment at = new RuleSetAttachment(); + at.setName("RS1"); + at.setTypeOfAttachment("DRL"); + + AttachmentFile file = new AttachmentFile("blah".getBytes(), "text", "blah.drl"); + at.addFile(file); + + RepositoryImpl repo = getRepo(); + repo.save(at); + + RuleSetAttachment at2 = repo.loadAttachment("RS1"); + assertEquals("DRL", at2.getTypeOfAttachment()); + + assertEquals(1, at2.getAttachments().size()); + } + +} Property changes on: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/AttachmentPersistTest.java ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RulePersistenceTest.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RulePersistenceTest.java 2006-01-05 23:44:03 UTC (rev 2003) +++ trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RulePersistenceTest.java 2006-01-06 02:52:16 UTC (rev 2004) @@ -10,18 +10,18 @@ public void testStoreNewRuleDef() throws Exception { RepositoryImpl repo = getRepo(); - RuleDef def = repo.saveOrUpdateRule(new RuleDef("myRule", "A rule")); + RuleDef def = repo.save(new RuleDef("myRule", "A rule")); assertNotNull(def.getId()); - def = repo.saveOrUpdateRule(new RuleDef("myRule2", "A rule2")); + def = repo.save(new RuleDef("myRule2", "A rule2")); def = new RuleDef("myRule3", "A rule3"); def.addTag("tag1").addTag("tag2").addTag("HR"); - def = repo.saveOrUpdateRule(def); + def = repo.save(def); assertNotNull(def.getId()); } public void testListRules() { RepositoryImpl repo = getRepo(); - repo.saveOrUpdateRule(new RuleDef("blah", "blah")); + repo.save(new RuleDef("blah", "blah")); List list = repo.listAllRules(true); assertTrue(list.size() > 0); } @@ -30,7 +30,7 @@ RepositoryImpl repo = getRepo(); RuleDef newRule = new RuleDef("my rule", "content"); newRule.addTag("HR").addTag("SALARY"); - repo.saveOrUpdateRule(newRule); + repo.save(newRule); RuleDef rule = repo.loadRule("my rule", 1); assertNotNull(rule); @@ -54,17 +54,14 @@ meta.setCreator("Peter Jackson"); rule1.setMetaData(meta); - repo.saveOrUpdateRule(rule1); + repo.save(rule1); - //?????repo.saveOrUpdateRule(rule1); - //repo.merge(rule1); - RuleDef rule2 = rule1.createNewVersion(); rule2.addTag("PJ"); - repo.saveOrUpdateRule(rule2); + repo.save(rule2); + repo.save(rule1); - RuleDef latest = repo.loadRule("newVersionTest", 2); assertEquals("Peter Jackson", latest.getMetaData().getCreator()); Modified: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RuleSetPersistenceTest.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RuleSetPersistenceTest.java 2006-01-05 23:44:03 UTC (rev 2003) +++ trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RuleSetPersistenceTest.java 2006-01-06 02:52:16 UTC (rev 2004) @@ -1,8 +1,14 @@ package org.drools.repository.db; +import java.util.HashSet; +import java.util.Set; + +import org.drools.repository.AttachmentFile; import org.drools.repository.MetaData; import org.drools.repository.RuleDef; +import org.drools.repository.RuleSetAttachment; import org.drools.repository.RuleSetDef; +import org.drools.repository.RuleSetVersionInfo; public class RuleSetPersistenceTest extends PersistentCase { @@ -14,7 +20,7 @@ RuleSetDef def = new RuleSetDef("my ruleset", meta); def.addTag("ME"); RepositoryImpl repo = getRepo(); - repo.saveOrUpdateRuleSet(def); + repo.save(def); RuleSetDef def2 = repo.loadRuleSet("my ruleset"); assertEquals("my ruleset", def2.getName()); @@ -34,11 +40,47 @@ ruleSet.addTag("HR"); RepositoryImpl repo = getRepo(); - repo.saveOrUpdateRuleSet(ruleSet); + repo.save(ruleSet); RuleSetDef loaded = repo.loadRuleSet("Uber 1"); assertEquals(2, loaded.getRules().size()); } + public void testRuleSetWithAttachment() { + MetaData meta = new MetaData(); + meta.setCreator("Michael Neale - Uber pimp"); + RuleSetDef ruleSet = new RuleSetDef("Attachmate", meta); + + RuleSetAttachment attachment = new RuleSetAttachment("decision-table", "my text file"); + attachment.addFile(new AttachmentFile("blah,blah".getBytes(), "text", "nothing.csv")); + attachment.addFile(new AttachmentFile("boo,boo".getBytes(), "binary", "smeg.xls")); + ruleSet.setAttachment(attachment); + + RepositoryImpl repo = getRepo(); + repo.save(ruleSet); + + RuleSetDef result = repo.loadRuleSet("Attachmate"); + assertNotNull(result); + assertEquals("decision-table", result.getAttachment().getTypeOfAttachment()); + assertEquals(2, result.getAttachment().getAttachments().size()); + } + + public void testRuleSetWithVersionHistory() { + RuleSetDef def = new RuleSetDef("WithHistory", null); + Set history = new HashSet(); + RuleSetVersionInfo info = new RuleSetVersionInfo("Michael", 1, "blah"); + + history.add(info); + RuleSetVersionInfo info2 = new RuleSetVersionInfo("Michael", 2, "woo"); + history.add(info2); + + def.setVersionHistory(history); + RepositoryImpl repo = getRepo(); + repo.save(def); + + RuleSetDef def2 = repo.loadRuleSet("WithHistory"); + assertEquals(2, def2.getVersionHistory().size()); + } + } Modified: trunk/labs/jbossrules/drools-repository/src/test/resources/hibernate.cfg.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/resources/hibernate.cfg.xml 2006-01-05 23:44:03 UTC (rev 2003) +++ trunk/labs/jbossrules/drools-repository/src/test/resources/hibernate.cfg.xml 2006-01-06 02:52:16 UTC (rev 2004) @@ -36,7 +36,9 @@ <mapping resource="org/drools/repository/RuleDef.hbm.xml"/> <mapping resource="org/drools/repository/Tag.hbm.xml"/> <mapping resource="org/drools/repository/RuleSetDef.hbm.xml"/> - + <mapping resource="org/drools/repository/RuleSetAttachment.hbm.xml"/> + <mapping resource="org/drools/repository/AttachmentFile.hbm.xml"/> + <mapping resource="org/drools/repository/RuleSetVersionInfo.hbm.xml"/> </session-factory> |
From: <jbo...@li...> - 2006-01-05 23:44:22
|
Author: wrzep Date: 2006-01-05 18:44:03 -0500 (Thu, 05 Jan 2006) New Revision: 2003 Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusDescriptor.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPortlet.java Log: displaying project specyfic page http://jira.jboss.com/jira/browse/JBLAB-415 Pawel Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java 2006-01-05 21:23:44 UTC (rev 2002) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java 2006-01-05 23:44:03 UTC (rev 2003) @@ -70,8 +70,11 @@ columns = new ArrayList<Column>(); Node columnsRoot = XmlTools.getFirstNodeWithName(pageRoot, StatusTags.COLUMNS_ELEMENT); - addColumns(columnsRoot, plugins); + if (columnsRoot != null) { + addColumns(columnsRoot, plugins); + } + // Get the plugin determining projects order orderPlugin = getOrderPlugin(pageRoot, plugins); } @@ -85,7 +88,9 @@ private void addColumns(Node columnsRoot, Plugins plugins) { NodeList columnsList = columnsRoot.getChildNodes(); + for (int i = 0; i < columnsList.getLength(); i++) { + Node columnNode = columnsList.item(i); if (columnNode.getNodeType() == Node.ELEMENT_NODE) { @@ -96,7 +101,7 @@ if (plugin != null) { Column column = new Column(name,plugin); - columns.add(column); + columns.add(column); } } @@ -134,6 +139,11 @@ fillValues(context); } + public void fillContext(DelegateContext context, String projectId) { + fillColumnsNames(context); + fillProjectContext(context, projectId); + } + /** * Fills the given context with column names * @@ -165,9 +175,9 @@ String projectId = projectIds[i]; DelegateContext projectContext = context.next("project"); + projectContext.put("position", i + 1); - fillProjectContext(projectContext, projectId, i + 1); - fillEntries(projectContext, projectId); + fillProjectContext(projectContext, projectId); } } @@ -201,17 +211,15 @@ * * @param projectContext DelegateContext to fill * @param projectId project id - * @param position Project posistion in the Status Matrix */ - private void fillProjectContext(DelegateContext projectContext, - String projectId, int position) { + private void fillProjectContext(DelegateContext projectContext, String projectId) { - projectContext.put("position", position); - projectContext.put("id", projectId); projectContext.put("name", projects.getProjectName(projectId)); projectContext.put("link", projects.getProjectLink(projectId)); -} + + fillEntries(projectContext, projectId); + } /** * Fills the given context with the cells information in the project row @@ -222,8 +230,8 @@ private void fillEntries(DelegateContext projectContext, String projectId) { for (Iterator iter = columns.iterator(); iter.hasNext();) { + Column column = (Column) iter.next(); - column.fillProjectContext(projectContext, projectId); } } Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2006-01-05 21:23:44 UTC (rev 2002) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Status.java 2006-01-05 23:44:03 UTC (rev 2003) @@ -22,12 +22,17 @@ package org.jboss.forge.status; +import java.util.Map; +import java.util.Set; + import org.jboss.forge.common.projects.Projects; import org.jboss.forge.common.projects.ProjectsHelper; import org.jboss.forge.common.XmlTools; import org.jboss.forge.common.projects.AbstractDescriptor; +import org.jboss.forge.common.projects.permissions.NullPermissionsChecker; +import org.jboss.forge.common.projects.permissions.PermissionsChecker; import org.jboss.portal.common.context.DelegateContext; import org.w3c.dom.Node; @@ -40,30 +45,35 @@ public class Status extends AbstractDescriptor { private static final String MAIN_PAGE_COLLUMNS_TAG = "main-page"; - //private static final String PROJECT_PAGE_COLLUMNS_TAG = "project-page"; - //TODO displaying project-specyfic pages + private static final String PROJECT_PAGE_COLLUMNS_TAG = "project-page"; /** Columns to display on the main page */ private Columns mainPageColumns; /* Columns to display on the project specyfic page */ - //private Columns projectPageColumns; + private Columns projectPageColumns; /** Plugins used in the Status Matrix */ private Plugins plugins; + private Projects projects; + Status(String portalName, Node statusRoot, Node statusPluginsRoot, Node scorePluginsRoot) { // Get the projects - Projects projects = ProjectsHelper.getProjects(portalName); + projects = ProjectsHelper.getProjects(portalName); // Get the status and score plugins plugins = new Plugins(statusPluginsRoot, portalName, projects, false); plugins.addAll(scorePluginsRoot, portalName, true); - // Get columns to display - Node pageRoot = XmlTools.getFirstNodeWithName(statusRoot, MAIN_PAGE_COLLUMNS_TAG); - mainPageColumns = new Columns(pageRoot, plugins, projects); + // Get columns to display on the main page + Node mainPageRoot = XmlTools.getFirstNodeWithName(statusRoot, MAIN_PAGE_COLLUMNS_TAG); + mainPageColumns = new Columns(mainPageRoot, plugins, projects); + + // Get columns to display on the project page + Node projectPageRoot = XmlTools.getFirstNodeWithName(statusRoot, PROJECT_PAGE_COLLUMNS_TAG); + projectPageColumns = new Columns(projectPageRoot, plugins, projects); } /** @@ -74,4 +84,18 @@ public void fillContext(DelegateContext context) { mainPageColumns.fillContext(context); } + + public void fillProjectContexts(Map<String,DelegateContext> contextsMap) { + + Set<String> projectIdsSet = projects.getProjectIds( + (PermissionsChecker) new NullPermissionsChecker(), null); + + for (String projectId : projectIdsSet) { + + DelegateContext context = new DelegateContext(); + projectPageColumns.fillContext(context, projectId); + + contextsMap.put(projectId, context); + } + } } \ No newline at end of file Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusDescriptor.java 2006-01-05 21:23:44 UTC (rev 2002) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusDescriptor.java 2006-01-05 23:44:03 UTC (rev 2003) @@ -23,6 +23,9 @@ package org.jboss.forge.status; import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + import org.apache.xerces.parsers.DOMParser; import org.jboss.portal.common.context.DelegateContext; import org.jboss.portlet.JBossRenderRequest; @@ -41,6 +44,8 @@ public class StatusDescriptor { private DelegateContext context; + private Map<String,DelegateContext> projectContexts; + private Status status; public StatusDescriptor(String portalName, ContentManager cm) { @@ -65,13 +70,21 @@ } private void fillContext() { + context = new DelegateContext(); status.fillContext(context); + + projectContexts = new HashMap<String,DelegateContext>(); + status.fillProjectContexts(projectContexts); } - public DelegateContext getContext(JBossRenderRequest request) { + public DelegateContext getContext() { return context; } + + public DelegateContext getProjectContext(String id) { + return projectContexts.get(id); + } private Node getRoot(ContentManager cm, String path) throws IOException, SAXException, ResourceDoesNotExist { DOMParser parser = new DOMParser(); @@ -80,4 +93,5 @@ Node root = parser.getDocument().getDocumentElement(); return root; } + } Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPortlet.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPortlet.java 2006-01-05 21:23:44 UTC (rev 2002) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPortlet.java 2006-01-05 23:44:03 UTC (rev 2003) @@ -47,20 +47,23 @@ throws IOException, PortletException { response.setContentType("text/html"); + // Get the request parameters String portalName = ForgeHelper.getPortalName(request); String action = request.getParameter("action"); String id = request.getParameter("id"); - // Getting the podcast context - DelegateContext context = StatusTools.getDesc(portalName).getContext(request); + StatusDescriptor desc = StatusTools.getDesc(portalName); + + // Set the JSP to show and get the appropriate context + String jspPath = null; + DelegateContext context = null; - - String jspPath = null; - if ((id != null) && (action.equals(PROJECT_DETAILS_ACTION))) { jspPath = StatusTools.getDetailsJspCmPath(); + context = desc.getProjectContext(id); } else { jspPath = StatusTools.getJspCmPath(); + context = desc.getContext(); } // Displaying the JSP |
From: <jbo...@li...> - 2006-01-05 21:23:49
|
Author: wrzep Date: 2006-01-05 16:23:44 -0500 (Thu, 05 Jan 2006) New Revision: 2002 Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusDescriptor.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPortlet.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusTools.java Log: jsp selection - displaying project specyfic page http://jira.jboss.com/jira/browse/JBLAB-415 Pawel Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java 2006-01-05 20:54:01 UTC (rev 2001) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java 2006-01-05 21:23:44 UTC (rev 2002) @@ -208,6 +208,7 @@ projectContext.put("position", position); + projectContext.put("id", projectId); projectContext.put("name", projects.getProjectName(projectId)); projectContext.put("link", projects.getProjectLink(projectId)); } Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusDescriptor.java 2006-01-05 20:54:01 UTC (rev 2001) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusDescriptor.java 2006-01-05 21:23:44 UTC (rev 2002) @@ -44,6 +44,7 @@ private Status status; public StatusDescriptor(String portalName, ContentManager cm) { + try { String statusPath = StatusTools.getXmlCmPath(portalName); Node statusRoot = getRoot(cm , statusPath); Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPortlet.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPortlet.java 2006-01-05 20:54:01 UTC (rev 2001) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusPortlet.java 2006-01-05 21:23:44 UTC (rev 2002) @@ -41,21 +41,33 @@ */ public class StatusPortlet extends JBossPortlet { + private static final String PROJECT_DETAILS_ACTION = "viewProjectDetails"; + public void doView(JBossRenderRequest request, JBossRenderResponse response) throws IOException, PortletException { response.setContentType("text/html"); String portalName = ForgeHelper.getPortalName(request); + String action = request.getParameter("action"); + String id = request.getParameter("id"); // Getting the podcast context DelegateContext context = StatusTools.getDesc(portalName).getContext(request); + + String jspPath = null; + + if ((id != null) && (action.equals(PROJECT_DETAILS_ACTION))) { + jspPath = StatusTools.getDetailsJspCmPath(); + } else { + jspPath = StatusTools.getJspCmPath(); + } + // Displaying the JSP request.setAttribute(PortalJsp.CTX_REQUEST, context); - + PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher( - ForgeHelper.createRepoAccessPath(portalName, StatusTools - .getJspCmPath())); + ForgeHelper.createRepoAccessPath(portalName, jspPath)); rd.include(request, response); } Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusTools.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusTools.java 2006-01-05 20:54:01 UTC (rev 2001) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusTools.java 2006-01-05 21:23:44 UTC (rev 2002) @@ -28,10 +28,11 @@ /** * <code>STATUS_DIR</code> - directory in which file <code>PODCAST_XML<code> is stored. */ - private final static String STATUS_DIR = "status"; + private final static String STATUS_DIR = "status"; - private final static String STATUS_JSP = "status.jsp"; - private final static String STATUS_JSP_DIR = "status"; + private final static String STATUS_JSP = "status.jsp"; + private final static String STATUS_JSP_DIR = "status"; + private final static String PROJECT_DETAILS_JSP = "project_details.jsp"; @Inject private static ContentManager cm; @@ -70,12 +71,16 @@ } /** - * Path to the file displaying the podcast feeds. + * Path to the file displaying the Status Matrix */ public static String getJspCmPath() { return STATUS_JSP_DIR + "/" + STATUS_JSP; } + public static String getDetailsJspCmPath() { + return STATUS_JSP_DIR + "/" + PROJECT_DETAILS_JSP; + } + public static synchronized StatusDescriptor getDesc(final String portalName) { String cacheKey = StatusDescriptor.class.getName(); |
From: <jbo...@li...> - 2006-01-05 20:54:08
|
Author: unibrew Date: 2006-01-05 15:54:01 -0500 (Thu, 05 Jan 2006) New Revision: 2001 Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/WeightedScorePlugin.java Log: [JBLAB-580] Small change in weighted status plugin. Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/WeightedScorePlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/WeightedScorePlugin.java 2006-01-05 19:06:48 UTC (rev 2000) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/WeightedScorePlugin.java 2006-01-05 20:54:01 UTC (rev 2001) @@ -23,7 +23,6 @@ package org.jboss.forge.status.plugins; import java.util.Hashtable; -import java.util.Iterator; import java.util.Map; import org.jboss.forge.common.XmlTools; @@ -35,12 +34,15 @@ /** -* @author Pawel Wrzeszcz -*/ - + * This plugin gets weights from xml configuration file + * and sumarizes all the stats multiplying them firstly by those weights. + * + * @author Ryszard Kozmik + * + */ public class WeightedScorePlugin extends ScorePlugin { - private Map<String,Integer> properties; + private Map<String,Float> properties; public WeightedScorePlugin() { super(); @@ -52,10 +54,10 @@ public void init(String id, Node propertiesNode) throws InvalidPluginPropertiesException { super.init(id, propertiesNode); Map<String,String> props = XmlTools.getMapFromNodeElements(propertiesNode); - properties = new Hashtable<String,Integer>(props.size()); + properties = new Hashtable<String,Float>(props.size()); for (String key : props.keySet()) { try { - Integer value = Integer.parseInt(props.get(key)); + Float value = Float.parseFloat(props.get(key)); properties.put(key,value); } catch (NumberFormatException e) { Logger log = Logger.getLogger(this.getClass()); |
From: <jbo...@li...> - 2006-01-05 19:07:04
|
Author: wrzep Date: 2006-01-05 14:06:48 -0500 (Thu, 05 Jan 2006) New Revision: 2000 Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusNodeWatcher.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusTools.java Log: shaped up project.xml watching http://jira.jboss.com/jira/browse/JBLAB-415 Pawel Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusNodeWatcher.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusNodeWatcher.java 2006-01-05 18:44:34 UTC (rev 1999) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusNodeWatcher.java 2006-01-05 19:06:48 UTC (rev 2000) @@ -54,7 +54,7 @@ Set<String> projectXmlPathsSet = StatusTools.getProjectXmlPathsSet(portalName); for (String projectXmlPath : projectXmlPathsSet) { - rw.watchResource(projectXmlPath); + rw.watchResource(projectXmlPath);; } return desc; @@ -65,6 +65,7 @@ } public Object nodeUpdate(String portalName, Object currentValue) { + if ((currentValue == null) || (rw.checkResources())) return getDesc(portalName); else Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusTools.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusTools.java 2006-01-05 18:44:34 UTC (rev 1999) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusTools.java 2006-01-05 19:06:48 UTC (rev 2000) @@ -62,9 +62,8 @@ for (String projectId : projectIdsSet) { - String projectXmlPath = portalName + "/" + - ProjectsHelper.MEMBERS_DIR + "/" + projectId + - ProjectsHelper.PROJECT_DESC; + String projectXmlPath = portalName + "/" + ProjectsHelper.MEMBERS_DIR + + "/" + projectId + "/" + ProjectsHelper.PROJECT_DESC; pathsSet.add(projectXmlPath); } return pathsSet; |
Author: wrzep Date: 2006-01-05 13:44:34 -0500 (Thu, 05 Jan 2006) New Revision: 1999 Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusNodeWatcher.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusTools.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java Log: watching projects.xml file and project.xml file for each project http://jira.jboss.com/jira/browse/JBLAB-415 Pawel Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java 2006-01-05 16:35:07 UTC (rev 1998) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsHelper.java 2006-01-05 18:44:34 UTC (rev 1999) @@ -76,13 +76,14 @@ */ private static Map<String, Projects> projectsObjects; + public final static String PROJECT_DESC = "project.xml"; + public final static String PROJECTS_DESC = "projects.xml"; + protected final static String LEVELS_DESC = "levels.xml"; protected final static String PAGES_DESC = "pages.xml"; protected final static String JEMS_DESC = "jems.xml"; protected final static String CATEGORIES_DESC = "categories.xml"; protected final static String SERVICES_DESC = "services.xml"; - protected final static String PROJECT_DESC = "project.xml"; - protected final static String PROJECTS_DESC = "projects.xml"; protected final static String DOWNLOADS_DESC = "downloads.xml"; protected final static String DOWNLOADCOUNTER_DESC = "counter.xml"; protected final static String DOWNLOADCOUNTERMAIN_DESC = "counters.xml"; Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusNodeWatcher.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusNodeWatcher.java 2006-01-05 16:35:07 UTC (rev 1998) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusNodeWatcher.java 2006-01-05 18:44:34 UTC (rev 1999) @@ -21,6 +21,8 @@ */ package org.jboss.forge.status; +import java.util.Set; + import org.jboss.forge.common.service.NodeWatcher; import org.jboss.forge.common.service.ResourceWatcher; import org.jboss.shotoku.ContentManager; @@ -35,13 +37,26 @@ } private StatusDescriptor getDesc(String portalName) { + StatusDescriptor desc = new StatusDescriptor(portalName, cm); rw = new ResourceWatcher(cm); + + /* Watch plugins confuguration files */ rw.watchResource(StatusTools.getXmlCmPath(portalName)); rw.watchResource(StatusTools.getXmlStatusPluginsCmPath(portalName)); rw.watchResource(StatusTools.getXmlScorePluginsCmPath(portalName)); + /* Watch projects.xml file*/ + rw.watchResource(StatusTools.getProjectsXmlPath(portalName)); + + /* Watch all project.xml files */ + Set<String> projectXmlPathsSet = StatusTools.getProjectXmlPathsSet(portalName); + + for (String projectXmlPath : projectXmlPathsSet) { + rw.watchResource(projectXmlPath); + } + return desc; } Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusTools.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusTools.java 2006-01-05 16:35:07 UTC (rev 1998) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/StatusTools.java 2006-01-05 18:44:34 UTC (rev 1999) @@ -1,6 +1,13 @@ package org.jboss.forge.status; +import java.util.HashSet; +import java.util.Set; + import org.jboss.forge.common.ForgeHelper; +import org.jboss.forge.common.projects.Projects; +import org.jboss.forge.common.projects.ProjectsHelper; +import org.jboss.forge.common.projects.permissions.NullPermissionsChecker; +import org.jboss.forge.common.projects.permissions.PermissionsChecker; import org.jboss.shotoku.ContentManager; import org.jboss.shotoku.aop.Inject; @@ -41,6 +48,28 @@ return portalName + "/" + STATUS_DIR + "/" + SCORE_PLUGINS_XML; } + public static String getProjectsXmlPath(String portalName) { + return portalName + "/" + ProjectsHelper.PROJECTS_DESC; + } + + public static Set<String> getProjectXmlPathsSet(String portalName) { + + Set<String> pathsSet = new HashSet<String>(); + + Projects projects = ProjectsHelper.getProjects(portalName); + Set<String> projectIdsSet = projects.getProjectIds( + (PermissionsChecker) new NullPermissionsChecker(), null); + + for (String projectId : projectIdsSet) { + + String projectXmlPath = portalName + "/" + + ProjectsHelper.MEMBERS_DIR + "/" + projectId + + ProjectsHelper.PROJECT_DESC; + pathsSet.add(projectXmlPath); + } + return pathsSet; + } + /** * Path to the file displaying the podcast feeds. */ Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2006-01-05 16:35:07 UTC (rev 1998) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2006-01-05 18:44:34 UTC (rev 1999) @@ -71,7 +71,6 @@ service = (SvnService) factory.create(SvnService.class, serviceURL); } catch (MalformedURLException e) { log.error("Can not connect to the kosmos svn service: " + serviceURL); - e.printStackTrace(); return null; } @@ -81,6 +80,7 @@ repositories = service.getRepositories(repoURL); } catch (Exception e) { log.error("Can not analyze repo: " + repoURL); + e.printStackTrace(); return null; } |
From: <jbo...@li...> - 2006-01-05 16:35:24
|
Author: wrzep Date: 2006-01-05 11:35:07 -0500 (Thu, 05 Jan 2006) New Revision: 1998 Modified: trunk/forge/portal-extensions/binaries/maven-repo-addons/informa/jars/informa.jar Log: eventually... get rid of the annoying FeedParser message http://jira.jboss.com/jira/browse/JBLAB-540 Pawel Modified: trunk/forge/portal-extensions/binaries/maven-repo-addons/informa/jars/informa.jar =================================================================== (Binary files differ) |
From: <jbo...@li...> - 2006-01-05 15:46:47
|
Author: wrzep Date: 2006-01-05 10:46:37 -0500 (Thu, 05 Jan 2006) New Revision: 1997 Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Column.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java Log: debug code to find out why svn plugin does not work properly http://jira.jboss.com/jira/browse/JBLAB-415 Pawel Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Column.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Column.java 2006-01-05 14:39:21 UTC (rev 1996) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Column.java 2006-01-05 15:46:37 UTC (rev 1997) @@ -62,6 +62,7 @@ */ public void fillProjectContext(DelegateContext projectContext, String projectId) { DelegateContext entryContext = projectContext.next("entry"); - entryContext.put("value", Long.toString(plugin.getValue(projectId))); + Long value = plugin.getValue(projectId); + entryContext.put("value", Long.toString(value)); } } Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java 2006-01-05 14:39:21 UTC (rev 1996) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/Columns.java 2006-01-05 15:46:37 UTC (rev 1997) @@ -169,7 +169,6 @@ fillProjectContext(projectContext, projectId, i + 1); fillEntries(projectContext, projectId); } - //TODO sorting } /** Modified: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2006-01-05 14:39:21 UTC (rev 1996) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/plugins/svn/SvnStatusPlugin.java 2006-01-05 15:46:37 UTC (rev 1997) @@ -71,6 +71,7 @@ service = (SvnService) factory.create(SvnService.class, serviceURL); } catch (MalformedURLException e) { log.error("Can not connect to the kosmos svn service: " + serviceURL); + e.printStackTrace(); return null; } |
From: <jbo...@li...> - 2006-01-05 14:39:28
|
Author: rem...@jb... Date: 2006-01-05 09:39:21 -0500 (Thu, 05 Jan 2006) New Revision: 1996 Removed: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/Group.java trunk/labs/jbossweb/src/share/classes/org/apache/catalina/Role.java trunk/labs/jbossweb/src/share/classes/org/apache/catalina/User.java trunk/labs/jbossweb/src/share/classes/org/apache/catalina/UserDatabase.java trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/DefaultContextMBean.java trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/GroupMBean.java trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/RoleMBean.java trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/UserMBean.java Modified: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/MBeanUtils.java Log: - Remove remaining realm references. Deleted: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/Group.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/catalina/Group.java 2006-01-05 13:52:16 UTC (rev 1995) +++ trunk/labs/jbossweb/src/share/classes/org/apache/catalina/Group.java 2006-01-05 14:39:21 UTC (rev 1996) @@ -1,122 +0,0 @@ -/* - * Copyright 2002,2004 The Apache Software Foundation. - * - * Licensed 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. - */ - - -package org.apache.catalina; - - -import java.security.Principal; -import java.util.Iterator; - - -/** - * <p>Abstract representation of a group of {@link User}s in a - * {@link UserDatabase}. Each user that is a member of this group - * inherits the {@link Role}s assigned to the group.</p> - * - * @author Craig R. McClanahan - * @version $Revision: 302726 $ $Date: 2004-02-27 15:59:07 +0100 (ven., 27 févr. 2004) $ - * @since 4.1 - */ - -public interface Group extends Principal { - - - // ------------------------------------------------------------- Properties - - - /** - * Return the description of this group. - */ - public String getDescription(); - - - /** - * Set the description of this group. - * - * @param description The new description - */ - public void setDescription(String description); - - - /** - * Return the group name of this group, which must be unique - * within the scope of a {@link UserDatabase}. - */ - public String getGroupname(); - - - /** - * Set the group name of this group, which must be unique - * within the scope of a {@link UserDatabase}. - * - * @param groupname The new group name - */ - public void setGroupname(String groupname); - - - /** - * Return the set of {@link Role}s assigned specifically to this group. - */ - public Iterator getRoles(); - - - /** - * Return the {@link UserDatabase} within which this Group is defined. - */ - public UserDatabase getUserDatabase(); - - - /** - * Return the set of {@link User}s that are members of this group. - */ - public Iterator getUsers(); - - - // --------------------------------------------------------- Public Methods - - - /** - * Add a new {@link Role} to those assigned specifically to this group. - * - * @param role The new role - */ - public void addRole(Role role); - - - /** - * Is this group specifically assigned the specified {@link Role}? - * - * @param role The role to check - */ - public boolean isInRole(Role role); - - - /** - * Remove a {@link Role} from those assigned to this group. - * - * @param role The old role - */ - public void removeRole(Role role); - - - /** - * Remove all {@link Role}s from those assigned to this group. - */ - public void removeRoles(); - - -} Deleted: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/Role.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/catalina/Role.java 2006-01-05 13:52:16 UTC (rev 1995) +++ trunk/labs/jbossweb/src/share/classes/org/apache/catalina/Role.java 2006-01-05 14:39:21 UTC (rev 1996) @@ -1,75 +0,0 @@ -/* - * Copyright 2002,2004 The Apache Software Foundation. - * - * Licensed 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. - */ - - -package org.apache.catalina; - - -import java.security.Principal; - - -/** - * <p>Abstract representation of a security role, suitable for use in - * environments like JAAS that want to deal with <code>Principals</code>.</p> - * - * @author Craig R. McClanahan - * @version $Revision: 302726 $ $Date: 2004-02-27 15:59:07 +0100 (ven., 27 févr. 2004) $ - * @since 4.1 - */ - -public interface Role extends Principal { - - - // ------------------------------------------------------------- Properties - - - /** - * Return the description of this role. - */ - public String getDescription(); - - - /** - * Set the description of this role. - * - * @param description The new description - */ - public void setDescription(String description); - - - /** - * Return the role name of this role, which must be unique - * within the scope of a {@link UserDatabase}. - */ - public String getRolename(); - - - /** - * Set the role name of this role, which must be unique - * within the scope of a {@link UserDatabase}. - * - * @param rolename The new role name - */ - public void setRolename(String rolename); - - - /** - * Return the {@link UserDatabase} within which this Role is defined. - */ - public UserDatabase getUserDatabase(); - - -} Deleted: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/User.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/catalina/User.java 2006-01-05 13:52:16 UTC (rev 1995) +++ trunk/labs/jbossweb/src/share/classes/org/apache/catalina/User.java 2006-01-05 14:39:21 UTC (rev 1996) @@ -1,173 +0,0 @@ -/* - * Copyright 2002,2004 The Apache Software Foundation. - * - * Licensed 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. - */ - - -package org.apache.catalina; - - -import java.security.Principal; -import java.util.Iterator; - - -/** - * <p>Abstract representation of a user in a {@link UserDatabase}. Each user - * is optionally associated with a set of {@link Group}s through which he or - * she inherits additional security roles, and is optionally assigned a set - * of specific {@link Role}s.</p> - * - * @author Craig R. McClanahan - * @version $Revision: 302726 $ $Date: 2004-02-27 15:59:07 +0100 (ven., 27 févr. 2004) $ - * @since 4.1 - */ - -public interface User extends Principal { - - - // ------------------------------------------------------------- Properties - - - /** - * Return the full name of this user. - */ - public String getFullName(); - - - /** - * Set the full name of this user. - * - * @param fullName The new full name - */ - public void setFullName(String fullName); - - - /** - * Return the set of {@link Group}s to which this user belongs. - */ - public Iterator getGroups(); - - - /** - * Return the logon password of this user, optionally prefixed with the - * identifier of an encoding scheme surrounded by curly braces, such as - * <code>{md5}xxxxx</code>. - */ - public String getPassword(); - - - /** - * Set the logon password of this user, optionally prefixed with the - * identifier of an encoding scheme surrounded by curly braces, such as - * <code>{md5}xxxxx</code>. - * - * @param password The new logon password - */ - public void setPassword(String password); - - - /** - * Return the set of {@link Role}s assigned specifically to this user. - */ - public Iterator getRoles(); - - - /** - * Return the {@link UserDatabase} within which this User is defined. - */ - public UserDatabase getUserDatabase(); - - - /** - * Return the logon username of this user, which must be unique - * within the scope of a {@link UserDatabase}. - */ - public String getUsername(); - - - /** - * Set the logon username of this user, which must be unique within - * the scope of a {@link UserDatabase}. - * - * @param username The new logon username - */ - public void setUsername(String username); - - - // --------------------------------------------------------- Public Methods - - - /** - * Add a new {@link Group} to those this user belongs to. - * - * @param group The new group - */ - public void addGroup(Group group); - - - /** - * Add a {@link Role} to those assigned specifically to this user. - * - * @param role The new role - */ - public void addRole(Role role); - - - /** - * Is this user in the specified {@link Group}? - * - * @param group The group to check - */ - public boolean isInGroup(Group group); - - - /** - * Is this user specifically assigned the specified {@link Role}? This - * method does <strong>NOT</strong> check for roles inherited based on - * {@link Group} membership. - * - * @param role The role to check - */ - public boolean isInRole(Role role); - - - /** - * Remove a {@link Group} from those this user belongs to. - * - * @param group The old group - */ - public void removeGroup(Group group); - - - /** - * Remove all {@link Group}s from those this user belongs to. - */ - public void removeGroups(); - - - /** - * Remove a {@link Role} from those assigned to this user. - * - * @param role The old role - */ - public void removeRole(Role role); - - - /** - * Remove all {@link Role}s from those assigned to this user. - */ - public void removeRoles(); - - -} Deleted: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/UserDatabase.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/catalina/UserDatabase.java 2006-01-05 13:52:16 UTC (rev 1995) +++ trunk/labs/jbossweb/src/share/classes/org/apache/catalina/UserDatabase.java 2006-01-05 14:39:21 UTC (rev 1996) @@ -1,173 +0,0 @@ -/* - * Copyright 2002,2004 The Apache Software Foundation. - * - * Licensed 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. - */ - - -package org.apache.catalina; - - -import java.util.Iterator; - - -/** - * <p>Abstract representation of a database of {@link User}s and - * {@link Group}s that can be maintained by an application, - * along with definitions of corresponding {@link Role}s, and - * referenced by a {@link Realm} for authentication and access control.</p> - * - * @author Craig R. McClanahan - * @version $Revision: 302726 $ $Date: 2004-02-27 15:59:07 +0100 (ven., 27 févr. 2004) $ - * @since 4.1 - */ - -public interface UserDatabase { - - - // ------------------------------------------------------------- Properties - - - /** - * Return the set of {@link Group}s defined in this user database. - */ - public Iterator getGroups(); - - - /** - * Return the unique global identifier of this user database. - */ - public String getId(); - - - /** - * Return the set of {@link Role}s defined in this user database. - */ - public Iterator getRoles(); - - - /** - * Return the set of {@link User}s defined in this user database. - */ - public Iterator getUsers(); - - - // --------------------------------------------------------- Public Methods - - - /** - * Finalize access to this user database. - * - * @exception Exception if any exception is thrown during closing - */ - public void close() throws Exception; - - - /** - * Create and return a new {@link Group} defined in this user database. - * - * @param groupname The group name of the new group (must be unique) - * @param description The description of this group - */ - public Group createGroup(String groupname, String description); - - - /** - * Create and return a new {@link Role} defined in this user database. - * - * @param rolename The role name of the new role (must be unique) - * @param description The description of this role - */ - public Role createRole(String rolename, String description); - - - /** - * Create and return a new {@link User} defined in this user database. - * - * @param username The logon username of the new user (must be unique) - * @param password The logon password of the new user - * @param fullName The full name of the new user - */ - public User createUser(String username, String password, - String fullName); - - - /** - * Return the {@link Group} with the specified group name, if any; - * otherwise return <code>null</code>. - * - * @param groupname Name of the group to return - */ - public Group findGroup(String groupname); - - - /** - * Return the {@link Role} with the specified role name, if any; - * otherwise return <code>null</code>. - * - * @param rolename Name of the role to return - */ - public Role findRole(String rolename); - - - /** - * Return the {@link User} with the specified user name, if any; - * otherwise return <code>null</code>. - * - * @param username Name of the user to return - */ - public User findUser(String username); - - - /** - * Initialize access to this user database. - * - * @exception Exception if any exception is thrown during opening - */ - public void open() throws Exception; - - - /** - * Remove the specified {@link Group} from this user database. - * - * @param group The group to be removed - */ - public void removeGroup(Group group); - - - /** - * Remove the specified {@link Role} from this user database. - * - * @param role The role to be removed - */ - public void removeRole(Role role); - - - /** - * Remove the specified {@link User} from this user database. - * - * @param user The user to be removed - */ - public void removeUser(User user); - - - /** - * Save any updated information to the persistent storage location for - * this user database. - * - * @exception Exception if any exception is thrown during saving - */ - public void save() throws Exception; - - -} Deleted: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/DefaultContextMBean.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/DefaultContextMBean.java 2006-01-05 13:52:16 UTC (rev 1995) +++ trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/DefaultContextMBean.java 2006-01-05 14:39:21 UTC (rev 1996) @@ -1,338 +0,0 @@ -/* - * Copyright 1999,2004 The Apache Software Foundation. - * - * Licensed 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. - */ - -package org.apache.catalina.mbeans; - -import java.util.ArrayList; - -import javax.management.MBeanException; -import javax.management.MalformedObjectNameException; -import javax.management.ObjectName; -import javax.management.RuntimeOperationsException; - -import org.apache.catalina.Context; -import org.apache.catalina.deploy.ContextEnvironment; -import org.apache.catalina.deploy.ContextResource; -import org.apache.catalina.deploy.ContextResourceLink; -import org.apache.catalina.deploy.NamingResources; -import org.apache.commons.modeler.BaseModelMBean; -import org.apache.commons.modeler.ManagedBean; -import org.apache.commons.modeler.Registry; -import org.apache.tomcat.util.compat.JdkCompat; - -/** - * <p>A <strong>ModelMBean</strong> implementation for the - * <code>org.apache.catalina.core.StandardDefaultContext</code> component.</p> - * - * @author Amy Roh - * @version $Revision: 303133 $ $Date: 2004-08-29 18:46:15 +0200 (dim., 29 août 2004) $ - */ - -public class DefaultContextMBean extends BaseModelMBean { - - - // ----------------------------------------------------------- Constructors - - - /** - * Construct a <code>ModelMBean</code> with default - * <code>ModelMBeanInfo</code> information. - * - * @exception MBeanException if the initializer of an object - * throws an exception - * @exception RuntimeOperationsException if an IllegalArgumentException - * occurs - */ - public DefaultContextMBean() - throws MBeanException, RuntimeOperationsException { - - super(); - - } - - - // ----------------------------------------------------- Class Variables - - - /** - * JDK compatibility support - */ - private static final JdkCompat jdkCompat = JdkCompat.getJdkCompat(); - - - // ----------------------------------------------------- Instance Variables - - - /** - * The configuration information registry for our managed beans. - */ - protected Registry registry = MBeanUtils.createRegistry(); - - /** - * The <code>ManagedBean</code> information describing this MBean. - */ - protected ManagedBean managed = - registry.findManagedBean("DefaultContext"); - - - // ------------------------------------------------------------- Attributes - - - /** - * Return the naming resources associated with this web application. - */ - private NamingResources getNamingResources() { - - return ((Context)this.resource).getNamingResources(); - - } - - - /** - * Return the MBean Names of the set of defined environment entries for - * this web application - */ - public String[] getEnvironments() { - ContextEnvironment[] envs = getNamingResources().findEnvironments(); - ArrayList results = new ArrayList(); - for (int i = 0; i < envs.length; i++) { - try { - ObjectName oname = - MBeanUtils.createObjectName(managed.getDomain(), envs[i]); - results.add(oname.toString()); - } catch (MalformedObjectNameException e) { - IllegalArgumentException iae = new IllegalArgumentException - ("Cannot create object name for environment " + envs[i]); - jdkCompat.chainException(iae, e); - throw iae; - } - } - return ((String[]) results.toArray(new String[results.size()])); - - } - - - /** - * Return the MBean Names of all the defined resource references for this - * application. - */ - public String[] getResources() { - - ContextResource[] resources = getNamingResources().findResources(); - ArrayList results = new ArrayList(); - for (int i = 0; i < resources.length; i++) { - try { - ObjectName oname = - MBeanUtils.createObjectName(managed.getDomain(), resources[i]); - results.add(oname.toString()); - } catch (MalformedObjectNameException e) { - IllegalArgumentException iae = new IllegalArgumentException - ("Cannot create object name for resource " + resources[i]); - jdkCompat.chainException(iae, e); - throw iae; - } - } - return ((String[]) results.toArray(new String[results.size()])); - - } - - - /** - * Return the MBean Names of all the defined resource links for this - * application - */ - public String[] getResourceLinks() { - - ContextResourceLink[] links = getNamingResources().findResourceLinks(); - ArrayList results = new ArrayList(); - for (int i = 0; i < links.length; i++) { - try { - ObjectName oname = - MBeanUtils.createObjectName(managed.getDomain(), links[i]); - results.add(oname.toString()); - } catch (MalformedObjectNameException e) { - IllegalArgumentException iae = new IllegalArgumentException - ("Cannot create object name for resource " + links[i]); - jdkCompat.chainException(iae, e); - throw iae; - } - } - return ((String[]) results.toArray(new String[results.size()])); - - } - - // ------------------------------------------------------------- Operations - - - /** - * Add an environment entry for this web application. - * - * @param envName New environment entry name - */ - public String addEnvironment(String envName, String type) - throws MalformedObjectNameException { - - NamingResources nresources = getNamingResources(); - if (nresources == null) { - return null; - } - ContextEnvironment env = nresources.findEnvironment(envName); - if (env != null) { - throw new IllegalArgumentException - ("Invalid environment name - already exists '" + envName + "'"); - } - env = new ContextEnvironment(); - env.setName(envName); - env.setType(type); - nresources.addEnvironment(env); - - // Return the corresponding MBean name - ManagedBean managed = registry.findManagedBean("ContextEnvironment"); - ObjectName oname = - MBeanUtils.createObjectName(managed.getDomain(), env); - return (oname.toString()); - - } - - - /** - * Add a resource reference for this web application. - * - * @param resourceName New resource reference name - */ - public String addResource(String resourceName, String type) - throws MalformedObjectNameException { - - NamingResources nresources = getNamingResources(); - if (nresources == null) { - return null; - } - ContextResource resource = nresources.findResource(resourceName); - if (resource != null) { - throw new IllegalArgumentException - ("Invalid resource name - already exists'" + resourceName + "'"); - } - resource = new ContextResource(); - resource.setName(resourceName); - resource.setType(type); - nresources.addResource(resource); - - // Return the corresponding MBean name - ManagedBean managed = registry.findManagedBean("ContextResource"); - ObjectName oname = - MBeanUtils.createObjectName(managed.getDomain(), resource); - - return (oname.toString()); - } - - - /** - * Add a resource link for this web application. - * - * @param resourceLinkName New resource link name - */ - public String addResourceLink(String resourceLinkName, String global, - String name, String type) throws MalformedObjectNameException { - - NamingResources nresources = getNamingResources(); - if (nresources == null) { - return null; - } - ContextResourceLink resourceLink = - nresources.findResourceLink(resourceLinkName); - if (resourceLink != null) { - throw new IllegalArgumentException - ("Invalid resource link name - already exists'" + - resourceLinkName + "'"); - } - resourceLink = new ContextResourceLink(); - resourceLink.setGlobal(global); - resourceLink.setName(resourceLinkName); - resourceLink.setType(type); - nresources.addResourceLink(resourceLink); - - // Return the corresponding MBean name - ManagedBean managed = registry.findManagedBean("ContextResourceLink"); - ObjectName oname = - MBeanUtils.createObjectName(managed.getDomain(), resourceLink); - return (oname.toString()); - } - - - /** - * Remove any environment entry with the specified name. - * - * @param envName Name of the environment entry to remove - */ - public void removeEnvironment(String envName) { - - NamingResources nresources = getNamingResources(); - if (nresources == null) { - return; - } - ContextEnvironment env = nresources.findEnvironment(envName); - if (env == null) { - throw new IllegalArgumentException - ("Invalid environment name '" + envName + "'"); - } - nresources.removeEnvironment(envName); - - } - - - /** - * Remove any resource reference with the specified name. - * - * @param resourceName Name of the resource reference to remove - */ - public void removeResource(String resourceName) { - - resourceName = ObjectName.unquote(resourceName); - NamingResources nresources = getNamingResources(); - if (nresources == null) { - return; - } - ContextResource resource = nresources.findResource(resourceName); - if (resource == null) { - throw new IllegalArgumentException - ("Invalid resource name '" + resourceName + "'"); - } - nresources.removeResource(resourceName); - } - - - /** - * Remove any resource link with the specified name. - * - * @param resourceLinkName Name of the resource reference to remove - */ - public void removeResourceLink(String resourceLinkName) { - - resourceLinkName = ObjectName.unquote(resourceLinkName); - NamingResources nresources = getNamingResources(); - if (nresources == null) { - return; - } - ContextResourceLink resource = nresources.findResourceLink(resourceLinkName); - if (resource == null) { - throw new IllegalArgumentException - ("Invalid resource name '" + resourceLinkName + "'"); - } - nresources.removeResourceLink(resourceLinkName); - } - - -} Deleted: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java 2006-01-05 13:52:16 UTC (rev 1995) +++ trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java 2006-01-05 14:39:21 UTC (rev 1996) @@ -1,236 +0,0 @@ -/* - * Copyright 2002,2004 The Apache Software Foundation. - * - * Licensed 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. - */ - -package org.apache.catalina.mbeans; - - -import java.util.Iterator; -import javax.naming.Binding; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingEnumeration; -import javax.naming.NamingException; -import javax.naming.OperationNotSupportedException; -import org.apache.catalina.Group; -import org.apache.catalina.Lifecycle; -import org.apache.catalina.LifecycleEvent; -import org.apache.catalina.LifecycleListener; -import org.apache.catalina.Role; -import org.apache.catalina.User; -import org.apache.catalina.UserDatabase; -import org.apache.commons.modeler.Registry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - - -/** - * Implementation of <code>LifecycleListener</code> that instantiates the - * set of MBeans associated with global JNDI resources that are subject to - * management. - * - * @author Craig R. McClanahan - * @version $Revision: 302983 $ $Date: 2004-06-26 01:56:25 +0200 (sam., 26 juin 2004) $ - * @since 4.1 - */ - -public class GlobalResourcesLifecycleListener - implements LifecycleListener { - private static Log log = LogFactory.getLog(GlobalResourcesLifecycleListener.class); - - // ----------------------------------------------------- Instance Variables - - - /** - * The owning Catalina component that we are attached to. - */ - protected Lifecycle component = null; - - - /** - * The configuration information registry for our managed beans. - */ - protected static Registry registry = MBeanUtils.createRegistry(); - - - // ---------------------------------------------- LifecycleListener Methods - - - /** - * Primary entry point for startup and shutdown events. - * - * @param event The event that has occurred - */ - public void lifecycleEvent(LifecycleEvent event) { - - if (Lifecycle.START_EVENT.equals(event.getType())) { - component = event.getLifecycle(); - createMBeans(); - } else if (Lifecycle.STOP_EVENT.equals(event.getType())) { - destroyMBeans(); - component = null; - } - - } - - - // ------------------------------------------------------ Protected Methods - - - /** - * Create the MBeans for the interesting global JNDI resources. - */ - protected void createMBeans() { - - // Look up our global naming context - Context context = null; - try { - context = (Context) (new InitialContext()).lookup("java:/"); - } catch (NamingException e) { - log.error("No global naming context defined for server"); - return; - } - - // Recurse through the defined global JNDI resources context - try { - createMBeans("", context); - } catch (NamingException e) { - log.error("Exception processing Global JNDI Resources", e); - } - - } - - - /** - * Create the MBeans for the interesting global JNDI resources in - * the specified naming context. - * - * @param prefix Prefix for complete object name paths - * @param context Context to be scanned - * - * @exception NamingException if a JNDI exception occurs - */ - protected void createMBeans(String prefix, Context context) - throws NamingException { - - if (log.isDebugEnabled()) { - log.debug("Creating MBeans for Global JNDI Resources in Context '" + - prefix + "'"); - } - - try { - NamingEnumeration bindings = context.listBindings(""); - while (bindings.hasMore()) { - Binding binding = (Binding) bindings.next(); - String name = prefix + binding.getName(); - Object value = context.lookup(binding.getName()); - if (log.isDebugEnabled()) { - log.debug("Checking resource " + name); - } - if (value instanceof Context) { - createMBeans(name + "/", (Context) value); - } else if (value instanceof UserDatabase) { - try { - createMBeans(name, (UserDatabase) value); - } catch (Exception e) { - log.error("Exception creating UserDatabase MBeans for " + name, - e); - } - } - } - } catch( RuntimeException ex) { - log.error("RuntimeException " + ex); - } catch( OperationNotSupportedException ex) { - log.error("Operation not supported " + ex); - } - - } - - - /** - * Create the MBeans for the specified UserDatabase and its contents. - * - * @param name Complete resource name of this UserDatabase - * @param database The UserDatabase to be processed - * - * @exception Exception if an exception occurs while creating MBeans - */ - protected void createMBeans(String name, UserDatabase database) - throws Exception { - - // Create the MBean for the UserDatabase itself - if (log.isDebugEnabled()) { - log.debug("Creating UserDatabase MBeans for resource " + name); - log.debug("Database=" + database); - } - if (MBeanUtils.createMBean(database) == null) { - throw new IllegalArgumentException - ("Cannot create UserDatabase MBean for resource " + name); - } - - // Create the MBeans for each defined Role - Iterator roles = database.getRoles(); - while (roles.hasNext()) { - Role role = (Role) roles.next(); - if (log.isDebugEnabled()) { - log.debug(" Creating Role MBean for role " + role); - } - if (MBeanUtils.createMBean(role) == null) { - throw new IllegalArgumentException - ("Cannot create Role MBean for role " + role); - } - } - - // Create the MBeans for each defined Group - Iterator groups = database.getGroups(); - while (groups.hasNext()) { - Group group = (Group) groups.next(); - if (log.isDebugEnabled()) { - log.debug(" Creating Group MBean for group " + group); - } - if (MBeanUtils.createMBean(group) == null) { - throw new IllegalArgumentException - ("Cannot create Group MBean for group " + group); - } - } - - // Create the MBeans for each defined User - Iterator users = database.getUsers(); - while (users.hasNext()) { - User user = (User) users.next(); - if (log.isDebugEnabled()) { - log.debug(" Creating User MBean for user " + user); - } - if (MBeanUtils.createMBean(user) == null) { - throw new IllegalArgumentException - ("Cannot create User MBean for user " + user); - } - } - - } - - - /** - * Destroy the MBeans for the interesting global JNDI resources. - */ - protected void destroyMBeans() { - - if (log.isDebugEnabled()) { - log.debug("Destroying MBeans for Global JNDI Resources"); - } - - } - -} Deleted: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/GroupMBean.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/GroupMBean.java 2006-01-05 13:52:16 UTC (rev 1995) +++ trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/GroupMBean.java 2006-01-05 14:39:21 UTC (rev 1996) @@ -1,201 +0,0 @@ -/* - * Copyright 2002,2004 The Apache Software Foundation. - * - * Licensed 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. - */ - -package org.apache.catalina.mbeans; - - -import java.util.ArrayList; -import java.util.Iterator; - -import javax.management.MBeanException; -import javax.management.MBeanServer; -import javax.management.MalformedObjectNameException; -import javax.management.ObjectName; -import javax.management.RuntimeOperationsException; - -import org.apache.catalina.Group; -import org.apache.catalina.Role; -import org.apache.catalina.User; -import org.apache.commons.modeler.BaseModelMBean; -import org.apache.commons.modeler.ManagedBean; -import org.apache.commons.modeler.Registry; -import org.apache.tomcat.util.compat.JdkCompat; - -/** - * <p>A <strong>ModelMBean</strong> implementation for the - * <code>org.apache.catalina.Group</code> component.</p> - * - * @author Craig R. McClanahan - * @version $Revision: 302833 $ $Date: 2004-04-15 03:44:09 +0200 (jeu., 15 avr. 2004) $ - */ - -public class GroupMBean extends BaseModelMBean { - - - // ----------------------------------------------------------- Constructors - - - /** - * Construct a <code>ModelMBean</code> with default - * <code>ModelMBeanInfo</code> information. - * - * @exception MBeanException if the initializer of an object - * throws an exception - * @exception RuntimeOperationsException if an IllegalArgumentException - * occurs - */ - public GroupMBean() - throws MBeanException, RuntimeOperationsException { - - super(); - - } - - - // ----------------------------------------------------- Class Variables - - - /** - * JDK compatibility support - */ - private static final JdkCompat jdkCompat = JdkCompat.getJdkCompat(); - - - // ----------------------------------------------------- Instance Variables - - - /** - * The configuration information registry for our managed beans. - */ - protected Registry registry = MBeanUtils.createRegistry(); - - - /** - * The <code>MBeanServer</code> in which we are registered. - */ - protected MBeanServer mserver = MBeanUtils.createServer(); - - - /** - * The <code>ManagedBean</code> information describing this MBean. - */ - protected ManagedBean managed = - registry.findManagedBean("Group"); - - - // ------------------------------------------------------------- Attributes - - - /** - * Return the MBean Names of all authorized roles for this group. - */ - public String[] getRoles() { - - Group group = (Group) this.resource; - ArrayList results = new ArrayList(); - Iterator roles = group.getRoles(); - while (roles.hasNext()) { - Role role = null; - try { - role = (Role) roles.next(); - ObjectName oname = - MBeanUtils.createObjectName(managed.getDomain(), role); - results.add(oname.toString()); - } catch (MalformedObjectNameException e) { - IllegalArgumentException iae = new IllegalArgumentException - ("Cannot create object name for role " + role); - jdkCompat.chainException(iae, e); - throw iae; - } - } - return ((String[]) results.toArray(new String[results.size()])); - - } - - - /** - * Return the MBean Names of all users that are members of this group. - */ - public String[] getUsers() { - - Group group = (Group) this.resource; - ArrayList results = new ArrayList(); - Iterator users = group.getUsers(); - while (users.hasNext()) { - User user = null; - try { - user = (User) users.next(); - ObjectName oname = - MBeanUtils.createObjectName(managed.getDomain(), user); - results.add(oname.toString()); - } catch (MalformedObjectNameException e) { - IllegalArgumentException iae = new IllegalArgumentException - ("Cannot create object name for user " + user); - jdkCompat.chainException(iae, e); - throw iae; - } - } - return ((String[]) results.toArray(new String[results.size()])); - - } - - - // ------------------------------------------------------------- Operations - - - /** - * Add a new {@link Role} to those this group belongs to. - * - * @param rolename Role name of the new role - */ - public void addRole(String rolename) { - - Group group = (Group) this.resource; - if (group == null) { - return; - } - Role role = group.getUserDatabase().findRole(rolename); - if (role == null) { - throw new IllegalArgumentException - ("Invalid role name '" + rolename + "'"); - } - group.addRole(role); - - } - - - /** - * Remove a {@link Role} from those this group belongs to. - * - * @param rolename Role name of the old role - */ - public void removeRole(String rolename) { - - Group group = (Group) this.resource; - if (group == null) { - return; - } - Role role = group.getUserDatabase().findRole(rolename); - if (role == null) { - throw new IllegalArgumentException - ("Invalid role name '" + rolename + "'"); - } - group.removeRole(role); - - } - - -} Modified: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/MBeanUtils.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/MBeanUtils.java 2006-01-05 13:52:16 UTC (rev 1995) +++ trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/MBeanUtils.java 2006-01-05 14:39:21 UTC (rev 1996) @@ -29,16 +29,12 @@ import org.apache.catalina.Container; import org.apache.catalina.Context; import org.apache.catalina.Engine; -import org.apache.catalina.Group; import org.apache.catalina.Host; import org.apache.catalina.Loader; import org.apache.catalina.Manager; import org.apache.catalina.Realm; -import org.apache.catalina.Role; import org.apache.catalina.Server; import org.apache.catalina.Service; -import org.apache.catalina.User; -import org.apache.catalina.UserDatabase; import org.apache.catalina.Valve; import org.apache.catalina.connector.Connector; import org.apache.catalina.deploy.ContextEnvironment; @@ -319,37 +315,6 @@ /** * Create, register, and return an MBean for this - * <code>Group</code> object. - * - * @param group The Group to be managed - * - * @exception Exception if an MBean cannot be created or registered - */ - static ModelMBean createMBean(Group group) - throws Exception { - - String mname = createManagedName(group); - ManagedBean managed = registry.findManagedBean(mname); - if (managed == null) { - Exception e = new Exception("ManagedBean is not found with "+mname); - throw new MBeanException(e); - } - String domain = managed.getDomain(); - if (domain == null) - domain = mserver.getDefaultDomain(); - ModelMBean mbean = managed.createMBean(group); - ObjectName oname = createObjectName(domain, group); - if( mserver.isRegistered( oname )) { - mserver.unregisterMBean(oname); - } - mserver.registerMBean(mbean, oname); - return (mbean); - - } - - - /** - * Create, register, and return an MBean for this * <code>Host</code> object. * * @param host The Host to be managed @@ -536,37 +501,6 @@ /** * Create, register, and return an MBean for this - * <code>Role</code> object. - * - * @param role The Role to be managed - * - * @exception Exception if an MBean cannot be created or registered - */ - static ModelMBean createMBean(Role role) - throws Exception { - - String mname = createManagedName(role); - ManagedBean managed = registry.findManagedBean(mname); - if (managed == null) { - Exception e = new Exception("ManagedBean is not found with "+mname); - throw new MBeanException(e); - } - String domain = managed.getDomain(); - if (domain == null) - domain = mserver.getDefaultDomain(); - ModelMBean mbean = managed.createMBean(role); - ObjectName oname = createObjectName(domain, role); - if( mserver.isRegistered( oname )) { - mserver.unregisterMBean(oname); - } - mserver.registerMBean(mbean, oname); - return (mbean); - - } - - - /** - * Create, register, and return an MBean for this * <code>Server</code> object. * * @param server The Server to be managed @@ -629,68 +563,6 @@ /** * Create, register, and return an MBean for this - * <code>User</code> object. - * - * @param user The User to be managed - * - * @exception Exception if an MBean cannot be created or registered - */ - static ModelMBean createMBean(User user) - throws Exception { - - String mname = createManagedName(user); - ManagedBean managed = registry.findManagedBean(mname); - if (managed == null) { - Exception e = new Exception("ManagedBean is not found with "+mname); - throw new MBeanException(e); - } - String domain = managed.getDomain(); - if (domain == null) - domain = mserver.getDefaultDomain(); - ModelMBean mbean = managed.createMBean(user); - ObjectName oname = createObjectName(domain, user); - if( mserver.isRegistered( oname )) { - mserver.unregisterMBean(oname); - } - mserver.registerMBean(mbean, oname); - return (mbean); - - } - - - /** - * Create, register, and return an MBean for this - * <code>UserDatabase</code> object. - * - * @param userDatabase The UserDatabase to be managed - * - * @exception Exception if an MBean cannot be created or registered - */ - static ModelMBean createMBean(UserDatabase userDatabase) - throws Exception { - - String mname = createManagedName(userDatabase); - ManagedBean managed = registry.findManagedBean(mname); - if (managed == null) { - Exception e = new Exception("ManagedBean is not found with "+mname); - throw new MBeanException(e); - } - String domain = managed.getDomain(); - if (domain == null) - domain = mserver.getDefaultDomain(); - ModelMBean mbean = managed.createMBean(userDatabase); - ObjectName oname = createObjectName(domain, userDatabase); - if( mserver.isRegistered( oname )) { - mserver.unregisterMBean(oname); - } - mserver.registerMBean(mbean, oname); - return (mbean); - - } - - - /** - * Create, register, and return an MBean for this * <code>Valve</code> object. * * @param valve The Valve to be managed @@ -931,28 +803,6 @@ /** * Create an <code>ObjectName</code> for this - * <code>Group</code> object. - * - * @param domain Domain in which this name is to be created - * @param group The Group to be named - * - * @exception MalformedObjectNameException if a name cannot be created - */ - static ObjectName createObjectName(String domain, - Group group) - throws MalformedObjectNameException { - - ObjectName name = null; - name = new ObjectName(domain + ":type=Group,groupname=" + - ObjectName.quote(group.getGroupname()) + - ",database=" + group.getUserDatabase().getId()); - return (name); - - } - - - /** - * Create an <code>ObjectName</code> for this * <code>Host</code> object. * * @param domain Domain in which this name is to be created @@ -1154,28 +1004,6 @@ /** * Create an <code>ObjectName</code> for this - * <code>Role</code> object. - * - * @param domain Domain in which this name is to be created - * @param role The Role to be named - * - * @exception MalformedObjectNameException if a name cannot be created - */ - static ObjectName createObjectName(String domain, - Role role) - throws MalformedObjectNameException { - - ObjectName name = null; - name = new ObjectName(domain + ":type=Role,rolename=" + - role.getRolename() + ",database=" + - role.getUserDatabase().getId()); - return (name); - - } - - - /** - * Create an <code>ObjectName</code> for this * <code>Server</code> object. * * @param domain Domain in which this name is to be created @@ -1217,49 +1045,6 @@ /** * Create an <code>ObjectName</code> for this - * <code>User</code> object. - * - * @param domain Domain in which this name is to be created - * @param user The User to be named - * - * @exception MalformedObjectNameException if a name cannot be created - */ - static ObjectName createObjectName(String domain, - User user) - throws MalformedObjectNameException { - - ObjectName name = null; - name = new ObjectName(domain + ":type=User,username=" + - ObjectName.quote(user.getUsername()) - + ",database=" + user.getUserDatabase().getId()); - return (name); - - } - - - /** - * Create an <code>ObjectName</code> for this - * <code>UserDatabase</code> object. - * - * @param domain Domain in which this name is to be created - * @param userDatabase The UserDatabase to be named - * - * @exception MalformedObjectNameException if a name cannot be created - */ - static ObjectName createObjectName(String domain, - UserDatabase userDatabase) - throws MalformedObjectNameException { - - ObjectName name = null; - name = new ObjectName(domain + ":type=UserDatabase,database=" + - userDatabase.getId()); - return (name); - - } - - - /** - * Create an <code>ObjectName</code> for this * <code>Valve</code> object. * * @param domain Domain in which this name is to be created @@ -1553,32 +1338,6 @@ /** * Deregister the MBean for this - * <code>Group</code> object. - * - * @param group The Group to be managed - * - * @exception Exception if an MBean cannot be deregistered - */ - static void destroyMBean(Group group) - throws Exception { - - String mname = createManagedName(group); - ManagedBean managed = registry.findManagedBean(mname); - if (managed == null) { - return; - } - String domain = managed.getDomain(); - if (domain == null) - domain = mserver.getDefaultDomain(); - ObjectName oname = createObjectName(domain, group); - if( mserver.isRegistered(oname) ) - mserver.unregisterMBean(oname); - - } - - - /** - * Deregister the MBean for this * <code>Host</code> object. * * @param host The Host to be managed @@ -1709,32 +1468,6 @@ /** * Deregister the MBean for this - * <code>Role</code> object. - * - * @param role The Role to be managed - * - * @exception Exception if an MBean cannot be deregistered - */ - static void destroyMBean(Role role) - throws Exception { - - String mname = createManagedName(role); - ManagedBean managed = registry.findManagedBean(mname); - if (managed == null) { - return; - } - String domain = managed.getDomain(); - if (domain == null) - domain = mserver.getDefaultDomain(); - ObjectName oname = createObjectName(domain, role); - if( mserver.isRegistered(oname) ) - mserver.unregisterMBean(oname); - - } - - - /** - * Deregister the MBean for this * <code>Server</code> object. * * @param server The Server to be managed @@ -1787,58 +1520,6 @@ /** * Deregister the MBean for this - * <code>User</code> object. - * - * @param user The User to be managed - * - * @exception Exception if an MBean cannot be deregistered - */ - static void destroyMBean(User user) - throws Exception { - - String mname = createManagedName(user); - ManagedBean managed = registry.findManagedBean(mname); - if (managed == null) { - return; - } - String domain = managed.getDomain(); - if (domain == null) - domain = mserver.getDefaultDomain(); - ObjectName oname = createObjectName(domain, user); - if( mserver.isRegistered(oname) ) - mserver.unregisterMBean(oname); - - } - - - /** - * Deregister the MBean for this - * <code>UserDatabase</code> object. - * - * @param userDatabase The UserDatabase to be managed - * - * @exception Exception if an MBean cannot be deregistered - */ - static void destroyMBean(UserDatabase userDatabase) - throws Exception { - - String mname = createManagedName(userDatabase); - ManagedBean managed = registry.findManagedBean(mname); - if (managed == null) { - return; - } - String domain = managed.getDomain(); - if (domain == null) - domain = mserver.getDefaultDomain(); - ObjectName oname = createObjectName(domain, userDatabase); - if( mserver.isRegistered(oname) ) - mserver.unregisterMBean(oname); - - } - - - /** - * Deregister the MBean for this * <code>Valve</code> object. * * @param valve The Valve to be managed Deleted: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java 2006-01-05 13:52:16 UTC (rev 1995) +++ trunk/labs/jbossweb/src/share/classes/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java 2006-01-05 14:39:21 UTC (rev 1996) @@ -1,403 +0,0 @@ -/* - * Copyright 2002,2004 The Apache Software Foundation. - * - * Licensed 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. - */ - -package org.apache.catalina.mbeans; - - -import java.util.ArrayList; -import java.util.Iterator; -import javax.management.MalformedObjectNameException; -import javax.management.MBeanException; -import javax.management.MBeanServer; -import javax.management.ObjectName; -import javax.management.RuntimeOperationsException; -import org.apache.catalina.Group; -import org.apache.catalina.Role; -import org.apache.catalina.User; -import org.apache.catalina.UserDatabase; -import org.apache.commons.modeler.BaseModelMBean; -import org.apache.commons.modeler.ManagedBean; -import org.apache.commons.modeler.Registry; -import org.apache.tomcat.util.compat.JdkCompat; - -/** - * <p>A <strong>ModelMBean</strong> implementation for the - * <code>org.apache.catalina.users.MemoryUserDatabase</code> component.</p> - * - * @author Craig R. McClanahan - * @version $Revision: 302833 $ $Date: 2004-04-15 03:44:09 +0200 (jeu., 15 avr. 2004) $ - */ - -public class MemoryUserDatabaseMBean extends BaseModelMBean { - - - // ----------------------------------------------------------- Constructors - - - /** - * Construct a <code>ModelMBean</code> with default - * <code>ModelMBeanInfo</code> information. - * - * @exception MBeanException if the initializer of an object - * throws an exception - * @exception RuntimeOperationsException if an IllegalArgumentException - * occurs - */ - public MemoryUserDatabaseMBean() - throws MBeanException, RuntimeOperationsException { - - super(); - - } - - - // ----------------------------------------------------- Class Variables - - - /** - * JDK compatibility support - */ - private static final JdkCompat jdkCompat = JdkCompat.getJdkCompat(); - - - // ----------------------------------------------------- Instance Variables - - - /** - * The configuration information registry for our managed beans. - */ - protected Registry registry = MBeanUtils.createRegistry(); - - - /** - * The <code>MBeanServer</code> in which we are registered. - */ - protected MBeanServer mserver = MBeanUtils.createServer(); - - - /** - * The <code>ManagedBean</code> information describing this MBean. - */ - protected ManagedBean managed = - registry.findManagedBean("MemoryUserDatabase"); - - - /** - * The <code>ManagedBean</code> information describing Group MBeans. - */ - protected ManagedBean managedGroup = - registry.findManagedBean("Group"); - - - /** - * The <code>ManagedBean</code> information describing Group MBeans. - */ - protected ManagedBean managedRole = - registry.findManagedBean("Role"); - - - /** - * The <code>ManagedBean</code> information describing User MBeans. - */ - protected ManagedBean managedUser = - registry.findManagedBean("User"); - - - // ------------------------------------------------------------- Attributes - - - /** - * Return the MBean Names of all groups defined in this database. - */ - public String[] getGroups() { - - ... [truncated message content] |
From: <jbo...@li...> - 2006-01-05 06:39:34
|
Author: mic...@jb... Date: 2006-01-05 01:39:28 -0500 (Thu, 05 Jan 2006) New Revision: 1994 Added: trunk/labs/jbossrules/drools-natural-dsl/doc/ruleset.txt Log: Added: trunk/labs/jbossrules/drools-natural-dsl/doc/ruleset.txt =================================================================== --- trunk/labs/jbossrules/drools-natural-dsl/doc/ruleset.txt 2006-01-05 06:38:36 UTC (rev 1993) +++ trunk/labs/jbossrules/drools-natural-dsl/doc/ruleset.txt 2006-01-05 06:39:28 UTC (rev 1994) @@ -0,0 +1,11 @@ +Start-rule +Name: Raincoat +Input: Weather weather +IF + weather is rainy and going outside + do not have raincoat +THEN + purchase raincost + modify clothing + +End-rule \ No newline at end of file Property changes on: trunk/labs/jbossrules/drools-natural-dsl/doc/ruleset.txt ___________________________________________________________________ Name: svn:eol-style + native |
From: <jbo...@li...> - 2006-01-05 06:38:42
|
Author: mic...@jb... Date: 2006-01-05 01:38:36 -0500 (Thu, 05 Jan 2006) New Revision: 1993 Removed: trunk/labs/jbossrules/drools-natural-language/ Log: |
Author: mic...@jb... Date: 2006-01-04 19:32:02 -0500 (Wed, 04 Jan 2006) New Revision: 1992 Modified: trunk/labs/jbossrules/drools-natural-dsl/src/main/java/org/drools/natural/lexer/SimpleSnippetLexer.java trunk/labs/jbossrules/drools-natural-dsl/src/test/java/org/drools/natural/lexer/SimpleSnippetLexerTest.java trunk/labs/jbossrules/drools-natural-dsl/src/test/java/org/drools/natural/ruledoc/RuleFragmentTest.java Log: normalised whitespace in tokens Modified: trunk/labs/jbossrules/drools-natural-dsl/src/main/java/org/drools/natural/lexer/SimpleSnippetLexer.java =================================================================== --- trunk/labs/jbossrules/drools-natural-dsl/src/main/java/org/drools/natural/lexer/SimpleSnippetLexer.java 2006-01-04 20:29:03 UTC (rev 1991) +++ trunk/labs/jbossrules/drools-natural-dsl/src/main/java/org/drools/natural/lexer/SimpleSnippetLexer.java 2006-01-05 00:32:02 UTC (rev 1992) @@ -142,9 +142,13 @@ private void breakBySpace(int pos) { - if ( bracketStack.size( ) > 0 || inDoubleQuotes ) + if (inDoubleQuotes) { + appendCurrentChar( pos ); + } else if ( bracketStack.size( ) > 0) { - appendCurrentChar( pos ); + if (previousIsNotSpace(pos)) { + appendCurrentChar( pos ); + } } else { @@ -153,6 +157,16 @@ } + private boolean previousIsNotSpace(int pos){ + + if (pos == 0) return true; + if (snippet[pos - 1] == ' ') { + return false; + } else { + return true; + } + } + private void newToken() { String token = currentToken.toString( ).trim( ); Modified: trunk/labs/jbossrules/drools-natural-dsl/src/test/java/org/drools/natural/lexer/SimpleSnippetLexerTest.java =================================================================== --- trunk/labs/jbossrules/drools-natural-dsl/src/test/java/org/drools/natural/lexer/SimpleSnippetLexerTest.java 2006-01-04 20:29:03 UTC (rev 1991) +++ trunk/labs/jbossrules/drools-natural-dsl/src/test/java/org/drools/natural/lexer/SimpleSnippetLexerTest.java 2006-01-05 00:32:02 UTC (rev 1992) @@ -124,7 +124,20 @@ assertEquals(expected, rawTokens); } + + public void testNormaliseWhitespaceInTokens() { + String sample ="[Age of][Age\n of]"; + NaturalSnippetLexer lex = new SimpleSnippetLexer(sample); + List rawTokens = lex.getRawTokens().getTokens(); + List expected = new ArrayList(); + expected.add("Age of"); + expected.add("Age of"); + + assertEquals(expected, rawTokens); + + } + } Modified: trunk/labs/jbossrules/drools-natural-dsl/src/test/java/org/drools/natural/ruledoc/RuleFragmentTest.java =================================================================== --- trunk/labs/jbossrules/drools-natural-dsl/src/test/java/org/drools/natural/ruledoc/RuleFragmentTest.java 2006-01-04 20:29:03 UTC (rev 1991) +++ trunk/labs/jbossrules/drools-natural-dsl/src/test/java/org/drools/natural/ruledoc/RuleFragmentTest.java 2006-01-05 00:32:02 UTC (rev 1992) @@ -59,7 +59,7 @@ RuleFragment helper = new RuleFragment(fragment, grammar); List cons = helper.getConsequences(); assertEquals(1, cons.size()); - assertEquals("cons 1", cons.get(0)); + assertEquals("cons 1", cons.get(0)); } |
From: <jbo...@li...> - 2006-01-04 20:29:15
|
Author: wrzep Date: 2006-01-04 15:29:03 -0500 (Wed, 04 Jan 2006) New Revision: 1991 Modified: trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java Log: podcast link fix http://jira.jboss.com/jira/browse/JBLAB-540 Pawel Modified: trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java =================================================================== --- trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java 2006-01-04 19:25:56 UTC (rev 1990) +++ trunk/forge/portal-extensions/forge-podcast/src/java/org/jboss/forge/podcast/Podcast.java 2006-01-04 20:29:03 UTC (rev 1991) @@ -191,11 +191,19 @@ private void fillChannelInfo(DelegateContext nodeContext, ChannelIF channel) { nodeContext.put("channel-title", channel.getTitle()); + URL channelLocation = channel.getLocation(); + String channelStringLink = null; if (channelLocation != null) { - nodeContext.put("channel-link", channelLocation.toString()); + channelStringLink = channelLocation.toString(); + } else { + channelStringLink = channel.getElementValue("link"); } + + if (channelStringLink != null) { + nodeContext.put("channel-link", channelStringLink); + } ImageIF channelImage = channel.getImage(); |
From: <jbo...@li...> - 2006-01-04 19:26:17
|
Author: rem...@jb... Date: 2006-01-04 14:25:56 -0500 (Wed, 04 Jan 2006) New Revision: 1990 Modified: trunk/labs/jbossweb/src/share/classes/org/apache/tomcat/util/net/AprEndpoint.java Log: - Oops. Sync on the right object. Modified: trunk/labs/jbossweb/src/share/classes/org/apache/tomcat/util/net/AprEndpoint.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/tomcat/util/net/AprEndpoint.java 2006-01-04 19:21:14 UTC (rev 1989) +++ trunk/labs/jbossweb/src/share/classes/org/apache/tomcat/util/net/AprEndpoint.java 2006-01-04 19:25:56 UTC (rev 1990) @@ -1212,7 +1212,7 @@ } // Tell threadStop() we have shut ourselves down successfully - synchronized (this) { + synchronized (threadSync) { threadSync.notifyAll(); } |
Author: rl...@jb... Date: 2006-01-04 14:21:14 -0500 (Wed, 04 Jan 2006) New Revision: 1989 Added: trunk/labs/jbossbuild/projects/jboss/hibernate-int/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/.classpath trunk/labs/jbossbuild/projects/jboss/hibernate-int/.cvsignore trunk/labs/jbossbuild/projects/jboss/hibernate-int/.project trunk/labs/jbossbuild/projects/jboss/hibernate-int/build.bat trunk/labs/jbossbuild/projects/jboss/hibernate-int/build.sh trunk/labs/jbossbuild/projects/jboss/hibernate-int/build.xml trunk/labs/jbossbuild/projects/jboss/hibernate-int/component-info.xml trunk/labs/jbossbuild/projects/jboss/hibernate-int/file1.txt trunk/labs/jbossbuild/projects/jboss/hibernate-int/jbossbuild.xml trunk/labs/jbossbuild/projects/jboss/hibernate-int/lib/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/pom.xml trunk/labs/jbossbuild/projects/jboss/hibernate-int/resources/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/resources/har/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/resources/har/org/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/resources/har/org/hibernate/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/resources/har/org/hibernate/admin/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/resources/har/org/hibernate/admin/model/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/resources/hbdeployer/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/resources/hbdeployer/META-INF/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/etc/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/etc/sample-configs/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/etc/sample-configs/har/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/etc/sample-configs/jmx/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/ListenerInjector.java trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/cache/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/cache/DeployedTreeCacheProvider.java trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/har/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/jmx/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/jmx/Hibernate.java trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMBean.java trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/session/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/session/HibernateContext.java trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/session/locator/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/session/store/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/net/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/net/sf/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/net/sf/hibernate/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/net/sf/hibernate/jboss/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/org/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/org/hibernate/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/org/hibernate/admin/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/org/hibernate/admin/model/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/org/jboss/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/org/jboss/hibernate/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/org/jboss/hibernate/har/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/org/jboss/hibernate/jmx/ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/resources/ Log: JBBUILD-233 deploy maven2 build to hibernate module Added: trunk/labs/jbossbuild/projects/jboss/hibernate-int/.classpath =================================================================== --- trunk/labs/jbossbuild/projects/jboss/hibernate-int/.classpath 2006-01-04 18:52:11 UTC (rev 1988) +++ trunk/labs/jbossbuild/projects/jboss/hibernate-int/.classpath 2006-01-04 19:21:14 UTC (rev 1989) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src/main"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="src" path="/common"/> + <classpathentry kind="src" path="/j2ee"/> + <classpathentry kind="src" path="/system"/> + <classpathentry kind="src" path="/server"/> + <classpathentry kind="src" path="/transaction"/> + <classpathentry kind="lib" path="/thirdparty/dom4j/lib/dom4j.jar"/> + <classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/> + <classpathentry kind="lib" path="/thirdparty/jgroups/lib/jgroups.jar"/> + <classpathentry kind="src" path="/j2se"/> + <classpathentry kind="lib" path="/thirdparty/hibernate/lib/hibernate3.jar"/> + <classpathentry kind="lib" path="/thirdparty/jboss/cache/lib/jboss-cache.jar"/> + <classpathentry kind="output" path="output/eclipse-classes"/> +</classpath> Added: trunk/labs/jbossbuild/projects/jboss/hibernate-int/.cvsignore =================================================================== --- trunk/labs/jbossbuild/projects/jboss/hibernate-int/.cvsignore 2006-01-04 18:52:11 UTC (rev 1988) +++ trunk/labs/jbossbuild/projects/jboss/hibernate-int/.cvsignore 2006-01-04 19:21:14 UTC (rev 1989) @@ -0,0 +1,2 @@ +output +build.log Added: trunk/labs/jbossbuild/projects/jboss/hibernate-int/.project =================================================================== --- trunk/labs/jbossbuild/projects/jboss/hibernate-int/.project 2006-01-04 18:52:11 UTC (rev 1988) +++ trunk/labs/jbossbuild/projects/jboss/hibernate-int/.project 2006-01-04 19:21:14 UTC (rev 1989) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>hibernate-int</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> + </natures> +</projectDescription> Added: trunk/labs/jbossbuild/projects/jboss/hibernate-int/build.bat =================================================================== --- trunk/labs/jbossbuild/projects/jboss/hibernate-int/build.bat 2006-01-04 18:52:11 UTC (rev 1988) +++ trunk/labs/jbossbuild/projects/jboss/hibernate-int/build.bat 2006-01-04 19:21:14 UTC (rev 1989) @@ -0,0 +1,98 @@ +@echo off + +REM ====================================================================== +REM +REM This is the main entry point for the build system. +REM +REM ====================================================================== +REM +REM $Id: build.bat,v 1.3 2004/10/28 13:35:15 steveebersole Exp $ +REM +REM Authors: +REM Jason Dillon <ja...@pl...> +REM Sacha Labourey <sac...@co...> +REM + +REM ****************************************************** +REM Ignore the ANT_HOME variable: we want to use *our* +REM ANT version and associated JARs. +REM ****************************************************** +REM Ignore the users classpath, cause it might mess +REM things up +REM ****************************************************** + +SETLOCAL + +set CLASSPATH= +set ANT_HOME= +set ANT_OPTS= + +REM ****************************************************** +REM - "for" loops have been unrolled for compatibility +REM with some WIN32 systems. +REM ****************************************************** + +set NAMES=tools; +set SUBFOLDERS=..;..\..;..\..\..;..\..\..\.. + +REM ****************************************************** +REM ****************************************************** + +SET EXECUTED=FALSE +for %%i in (%NAMES%) do call :subLoop %%i %* + +goto :EOF + + +REM ****************************************************** +REM ********* Search for names in the subfolders ********* +REM ****************************************************** + +:subLoop +SET SUBDIR=%1 +SHIFT + +set OTHER_ARGS= +:setupArgs +if %1a==a goto doneSetupArgs +set OTHER_ARGS=%OTHER_ARGS% %1 +shift +goto setupArgs +:doneSetupArgs + +for %%j in (%SUBFOLDERS%) do call :testIfExists %%j\%SUBDIR%\bin\ant.bat -logger org.apache.tools.ant.NoBannerLogger %OTHER_ARGS% + +goto :EOF + + +REM ****************************************************** +REM ************ Test if ANT Batch file exists *********** +REM ****************************************************** + +:testIfExists +if exist %1 call :BatchFound %* + +goto :EOF + + +REM ****************************************************** +REM ************** Batch file has been found ************* +REM ****************************************************** + +:BatchFound +if (%EXECUTED%)==(FALSE) call :ExecuteBatch %* +set EXECUTED=TRUE + +goto :EOF + +REM ****************************************************** +REM ************* Execute Batch file only once *********** +REM ****************************************************** + +:ExecuteBatch +echo Calling %* +call %* + +:end + +pause Added: trunk/labs/jbossbuild/projects/jboss/hibernate-int/build.sh =================================================================== --- trunk/labs/jbossbuild/projects/jboss/hibernate-int/build.sh 2006-01-04 18:52:11 UTC (rev 1988) +++ trunk/labs/jbossbuild/projects/jboss/hibernate-int/build.sh 2006-01-04 19:21:14 UTC (rev 1989) @@ -0,0 +1,172 @@ +#!/bin/sh +### ====================================================================== ### +## ## +## This is the main entry point for the build system. ## +## ## +## Users should be sure to execute this file rather than 'ant' to ensure ## +## the correct version is being used with the correct configuration. ## +## ## +### ====================================================================== ### + +# $Id: build.sh,v 1.2 2004/10/28 13:35:15 steveebersole Exp $ + +PROGNAME=`basename $0` +DIRNAME=`dirname $0` +GREP="grep" +ROOT="/" + +# Ignore user's ANT_HOME if it is set +ANT_HOME="" + +# the default search path for ant +ANT_SEARCH_PATH="\ + tools + tools/ant \ + tools/apache/ant \ + ant" + +# the default build file name +ANT_BUILD_FILE="build.xml" + +# the default arguments +ANT_OPTIONS="-find $ANT_BUILD_FILE" + +# Use the maximum available, or set MAX_FD != -1 to use that +MAX_FD="maximum" + +# OS specific support (must be 'true' or 'false'). +cygwin=false; +darwin=false; +case "`uname`" in + CYGWIN*) + cygwin=true + ;; + + Darwin*) + darwin=true + ;; +esac + +# +# Helper to complain. +# +die() { + echo "${PROGNAME}: $*" + exit 1 +} + +# +# Helper to complain. +# +warn() { + echo "${PROGNAME}: $*" +} + +# +# Helper to source a file if it exists. +# +maybe_source() { + for file in $*; do + if [ -f "$file" ]; then + . $file + fi + done +} + +search() { + search="$*" + for d in $search; do + ANT_HOME="`pwd`/$d" + ANT="$ANT_HOME/bin/ant" + if [ -x "$ANT" ]; then + # found one + echo $ANT_HOME + break + fi + done +} + +# +# Main function. +# +main() { + # if there is a build config file. then source it + maybe_source "$DIRNAME/build.conf" "$HOME/.build.conf" + + # Increase the maximum file descriptors if we can + if [ $cygwin = "false" ]; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ]; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then + # use the system max + MAX_FD="$MAX_FD_LIMIT" + fi + + ulimit -n $MAX_FD + if [ $? -ne 0 ]; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT" + fi + fi + + # try the search path + ANT_HOME=`search $ANT_SEARCH_PATH` + + # try looking up to root + if [ "x$ANT_HOME" = "x" ]; then + target="build" + _cwd=`pwd` + + while [ "x$ANT_HOME" = "x" ] && [ "$cwd" != "$ROOT" ]; do + cd .. + cwd=`pwd` + ANT_HOME=`search $ANT_SEARCH_PATH` + done + + # make sure we get back + cd $_cwd + + if [ "$cwd" != "$ROOT" ]; then + found="true" + fi + + # complain if we did not find anything + if [ "$found" != "true" ]; then + die "Could not locate Ant; check \$ANT or \$ANT_HOME." + fi + fi + + # make sure we have one + ANT=$ANT_HOME/bin/ant + if [ ! -x "$ANT" ]; then + die "Ant file is not executable: $ANT" + fi + + # need to specify planet57/buildmagic protocol handler package + ANT_OPTS="-Djava.protocol.handler.pkgs=org.jboss.net.protocol" + + # setup some build properties + ANT_OPTS="$ANT_OPTS -Dbuild.script=$0" + + # change to the directory where the script lives so users are not forced + # to be in the same directory as build.xml + cd $DIRNAME + + # export some stuff for ant + export ANT ANT_HOME ANT_OPTS + + # execute in debug mode, or simply execute + if [ "x$ANT_DEBUG" != "x" ]; then + /bin/sh -x $ANT $ANT_OPTIONS "$@" + else + exec $ANT $ANT_OPTIONS "$@" + fi +} + +## +## Bootstrap +## + +main "$@" Added: trunk/labs/jbossbuild/projects/jboss/hibernate-int/build.xml =================================================================== --- trunk/labs/jbossbuild/projects/jboss/hibernate-int/build.xml 2006-01-04 18:52:11 UTC (rev 1988) +++ trunk/labs/jbossbuild/projects/jboss/hibernate-int/build.xml 2006-01-04 19:21:14 UTC (rev 1989) @@ -0,0 +1,286 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE project [ + <!ENTITY buildmagic SYSTEM "../tools/etc/buildmagic/buildmagic.ent"> + <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent"> + <!ENTITY modules SYSTEM "../tools/etc/buildmagic/modules.ent"> +]> + +<!-- ====================================================================== --> +<!-- --> +<!-- JBoss, the OpenSource J2EE webOS --> +<!-- --> +<!-- Distributable under LGPL license. --> +<!-- See terms of license at http://www.gnu.org. --> +<!-- --> +<!-- ====================================================================== --> + +<!-- $Id: build.xml,v 1.14 2005/08/29 15:53:15 rloehr Exp $ --> + +<project name="JBoss/Hibernate" default="main" basedir="."> + + <!-- ================================================================== --> + <!-- Setup --> + <!-- ================================================================== --> + + <!-- + | Include the common Buildmagic elements. + | + | This defines several different targets, properties and paths. + | It also sets up the basic extention tasks amoung other things. + --> + &buildmagic; + + + <!-- ================================================================== --> + <!-- Initialization --> + <!-- ================================================================== --> + + <!-- + | Initialize the build system. Must depend on '_buildmagic:init'. + | Other targets should depend on 'init' or things will mysteriously fail. + --> + <target name="init" unless="init.disable" depends="_buildmagic:init"/> + + + <!-- ================================================================== --> + <!-- Configuration --> + <!-- ================================================================== --> + + <!-- + | Configure the build system. + | + | This target is invoked by the Buildmagic initialization logic and + | should contain module specific configuration elements. + --> + <target name="configure" unless="configure.disable"> + + <!-- =================== --> + <!-- Basic Configuration --> + <!-- =================== --> + + <!-- Module name(s) & version --> + <property name="module.name" value="jboss-hibernate"/> + <property name="module.Name" value="JBoss Hibernate"/> + <property name="module.version" value="DEV"/> + + <!-- ========= --> + <!-- Libraries --> + <!-- ========= --> + &libraries; + + <!-- The combined library classpath --> + <path id="library.classpath"> + <path refid="apache.commons.classpath"/> + <path refid="apache.xalan.classpath"/> + <path refid="dom4j.dom4j.classpath"/> + <path refid="sun.servlet.classpath"/> + <path refid="hibernate3.classpath"/> + <path refid="odmg.classpath"/> + <path refid="cglib.classpath"/> + </path> + + <!-- ======= --> + <!-- Modules --> + <!-- ======= --> + &modules; + + <!-- Specify modules upon which this build depends --> + <path id="dependentmodule.classpath"> + <path refid="jboss.cache.classpath"/> + <path refid="jboss.common.classpath"/> + <path refid="jboss.j2se.classpath"/> + <path refid="jboss.j2ee.classpath"/> + <path refid="jboss.server.classpath"/> + <path refid="jboss.system.classpath"/> + <path refid="jboss.transaction.classpath"/> + </path> + + <!-- Where source files live --> + <property name="source.java" value="${module.source}/main"/> + <property name="source.bin" value="${module.source}/bin"/> + <property name="source.resources" value="${module.source}/resources"/> + <property name="source.etc" value="${module.source}/etc"/> + + <!-- Where build generated files will go --> + <property name="build.reports" value="${module.output}/reports"/> + <property name="build.classes" value="${module.output}/classes"/> + <property name="build.lib" value="${module.output}/lib"/> + <property name="build.api" value="${module.output}/api"/> + <property name="build.etc" value="${module.output}/etc"/> + <property name="build.bin" value="${module.output}/bin"/> + <property name="build.resources" value="${module.output}/resources"/> + <property name="build.etc" value="${module.output}/etc"/> + <property name="build.gen-src" value="${module.output}/gen-src"/> + <property name="build.todo" value="${module.output}/todo"/> + + <!-- Install/Release structure --> + <property name="install.id" value="${module.name}-${module.version}"/> + <property name="release.id" value="${install.id}"/> + <property name="install.root" value="${module.output}/${install.id}"/> + + <!-- The combined thirdparty classpath --> + <path id="thirdparty.classpath"> + <path refid="library.classpath"/> + <path refid="dependentmodule.classpath"/> + </path> + + <!-- classpath and local.classpath must have a value using with a path --> + <property name="classpath" value=""/> + <property name="local.classpath" value=""/> + + <!-- The classpath required to build classes. --> + <path id="javac.classpath"> + <pathelement path="${classpath}"/> + <pathelement path="${local.classpath}"/> + <path refid="thirdparty.classpath"/> + </path> + + <!-- The classpath required to build javadocs. --> + <path id="javadoc.classpath"> + <path refid="javac.classpath"/> + </path> + + <!-- Packages to include when generating api documentation --> + <property name="javadoc.packages" value="org.jboss.*"/> + + </target> + + <!-- ================================================================== --> + <!-- Convenience targets --> + <!-- ================================================================== --> + <target name="build-hibernate-jars" depends="init, compile"> + <mkdir dir="${build.lib}"/> + + <!-- Generate a jar containing all the compiled sources --> + <jar destfile="${build.lib}/${module.name}.jar"> + <fileset dir="${build.classes}"/> + </jar> + + </target> + + <target name="rebuild-hibernate-jars" depends="init, clean-hibernate-jars, compile, build-hibernate-jars"/> + + <target name="clean-hibernate-jars" depends="init"> + <delete file="${build.lib}/${module.name}.jar"/> + </target> + + + <!-- ================================================================== --> + <!-- Compile --> + <!-- ================================================================== --> + + <!-- + | Compile everything. + | + | This target should depend on other compile-* targets for each + | different type of compile that needs to be performed, short of + | documentation compiles. + --> + <target name="compile" + description="Compile all source files." + depends="compile-classes"/> + + <!-- Compile all class files --> + <target name="compile-classes" depends="init"> + <mkdir dir="${build.classes}"/> + <javac destdir="${build.classes}" + optimize="${javac.optimize}" + target="${javac.target}" + source="${javac.source}" + debug="${javac.debug}" + depend="${javac.depend}" + verbose="${javac.verbose}" + deprecation="${javac.deprecation}" + includeAntRuntime="${javac.include.ant.runtime}" + includeJavaRuntime="${javac.include.java.runtime}" + includes="${javac.includes}" + excludes="${javac.excludes}" + failonerror="${javac.fail.onerror}"> + <src path="${source.java}"/> + <classpath refid="javac.classpath"/> + </javac> + </target> + + + <!-- ================================================================== --> + <!-- Archives --> + <!-- ================================================================== --> + + <!-- + | Build all jar files. + --> + <target name="jars" + description="Builds all jar files." + depends="_buildmagic:build-bypass-check" + unless="build-bypass.on"> + + <antcall target="build-hibernate-jars"/> + + <!-- Update the build marker to allow bypassing --> + <touch file="${build-bypass.marker}"/> + </target> + + + <!-- ================================================================== --> + <!-- Install & Release --> + <!-- ================================================================== --> + + <target name="install" + description="Install the structure for a release." + depends="all, _buildmagic:install:default"/> + + <target name="release" depends="install"/> + + <target name="release-zip" + description="Builds a ZIP distribution." + depends="release, _buildmagic:release:zip"/> + + <target name="release-tar" + description="Builds a TAR distribution." + depends="release, _buildmagic:release:tar"/> + + <target name="release-tgz" + description="Builds a TAR-GZ distribution." + depends="release, _buildmagic:release:tgz"/> + + <target name="release-all" + description="Builds a distribution for each archive type." + depends="release-zip, release-tgz"/> + + + <!-- ================================================================== --> + <!-- Cleaning --> + <!-- ================================================================== --> + + <!-- Clean up all build output --> + <target name="clean" + description="Cleans up most generated files." + depends="_buildmagic:clean"/> + + <!-- Clean up all generated files --> + <target name="clobber" + description="Cleans up all generated files." + depends="_buildmagic:clobber, clean"/> + + + <!-- ================================================================== --> + <!-- Misc. --> + <!-- ================================================================== --> + + <target name="main" + description="Executes the default target (most)." + depends="most"/> + + <target name="all" + description="Builds everything." + depends="jars, docs"/> + + <target name="most" + description="Builds almost everything." + depends="jars"/> + + <target name="help" + description="Show this help message." + depends="_buildmagic:help:standard"/> + +</project> Added: trunk/labs/jbossbuild/projects/jboss/hibernate-int/component-info.xml =================================================================== --- trunk/labs/jbossbuild/projects/jboss/hibernate-int/component-info.xml 2006-01-04 18:52:11 UTC (rev 1988) +++ trunk/labs/jbossbuild/projects/jboss/hibernate-int/component-info.xml 2006-01-04 19:21:14 UTC (rev 1989) @@ -0,0 +1,11 @@ +<project name="hibernate-int-component-info"> + <component id="hibernate-int" + module="hibernate" + version="5.0-SNAPSHOT" + > + <artifact id="jboss-hibernate.jar"/> + <export> + <include input="jboss-hibernate.jar"/> + </export> + </component> +</project> \ No newline at end of file Added: trunk/labs/jbossbuild/projects/jboss/hibernate-int/file1.txt =================================================================== --- trunk/labs/jbossbuild/projects/jboss/hibernate-int/file1.txt 2006-01-04 18:52:11 UTC (rev 1988) +++ trunk/labs/jbossbuild/projects/jboss/hibernate-int/file1.txt 2006-01-04 19:21:14 UTC (rev 1989) @@ -0,0 +1,30 @@ +[INFO] Scanning for projects... +[INFO] ---------------------------------------------------------------------------- +[INFO] Building JBoss Hibernate Integration Project +[INFO] task-segment: [compile] +[INFO] ---------------------------------------------------------------------------- +[INFO] [resources:resources] +[INFO] Using default encoding to copy filtered resources. +Downloading: http://repository.jboss.com/maven2/hibernate/hibernate3/3.1rc2jboss/hibernate3-3.1rc2jboss.pom +[WARNING] Unable to get resource from repository central (http://repository.jboss.com/maven2) +Downloading: http://repository.jboss.com/maven2/jboss/jboss-cache/1.2.4/jboss-cache-1.2.4.pom +[WARNING] Unable to get resource from repository central (http://repository.jboss.com/maven2) +Downloading: http://repository.jboss.com/maven2/jaxen/jaxen/1.1-beta-4/jaxen-1.1-beta-4.pom +[WARNING] Unable to get resource from repository central (http://repository.jboss.com/maven2) +Downloading: http://repository.jboss.com/maven2/gnu-getopt/getopt/1.0.10/getopt-1.0.10.pom +[WARNING] Unable to get resource from repository central (http://repository.jboss.com/maven2) +Downloading: http://repository.jboss.com/maven2/jpl-util/jpl-util/1.0/jpl-util-1.0.pom +[WARNING] Unable to get resource from repository central (http://repository.jboss.com/maven2) +Downloading: http://repository.jboss.com/maven2/jpl-pattern/jpl-pattern/1.0/jpl-pattern-1.0.pom +[WARNING] Unable to get resource from repository central (http://repository.jboss.com/maven2) +Downloading: http://repository.jboss.com/maven2/jboss/jboss-remoting/5.0-SNAPSHOT/jboss-remoting-5.0-SNAPSHOT.pom +[WARNING] Unable to get resource from repository central (http://repository.jboss.com/maven2) +[INFO] [compiler:compile] +Compiling 5 source files to c:\projects\subtry3\jbossbuild\projects\jboss\hibernate-int\output\classes +[INFO] ---------------------------------------------------------------------------- +[INFO] BUILD SUCCESSFUL +[INFO] ---------------------------------------------------------------------------- +[INFO] Total time: 33 seconds +[INFO] Finished at: Wed Jan 04 13:06:43 CST 2006 +[INFO] Final Memory: 4M/12M +[INFO] ---------------------------------------------------------------------------- Added: trunk/labs/jbossbuild/projects/jboss/hibernate-int/jbossbuild.xml =================================================================== --- trunk/labs/jbossbuild/projects/jboss/hibernate-int/jbossbuild.xml 2006-01-04 18:52:11 UTC (rev 1988) +++ trunk/labs/jbossbuild/projects/jboss/hibernate-int/jbossbuild.xml 2006-01-04 19:21:14 UTC (rev 1989) @@ -0,0 +1,68 @@ +<?xml version="1.0"?> + +<!-- + JBoss, the OpenSource J2EE webOS + + Distributable under LGPL license. + See terms of license at gnu.org. +--> + +<!-- ================================================================== --> +<!-- Hibernate-int component definition --> +<!-- ================================================================== --> + +<project name="project" + default="build" + basedir="." +> + <!-- The main build --> + <import file="../tools/etc/jbossbuild/tasks.xml"/> + <import file="component-info.xml"/> + + <!-- =============================================================== --> + <!-- The component definition --> + <!-- =============================================================== --> + + <componentdef component="hibernate-int" + description="Hibernate Integration Module"> + + <!-- ============================================================ --> + <!-- The main source --> + <!-- ============================================================ --> + + <source id="main"> + <include component="apache-xalan"/> + <include component="dom4j"/> + <include component="sun-servlet"/> + <include component="hibernate"/> + <include component="odmg"/> + <include component="cglib"/> + <include component="jboss/cache"/> + <include component="common"/> + <include component="j2se"/> + <include component="server"/> + <include component="system"/> + <include component="transaction"/> + <include component="j2ee"/> + <include component="apache-log4j"/> + </source> + + <!-- ============================================================ --> + <!-- hibernate.jar --> + <!-- ============================================================ --> + + <artifactdef artifact="jboss-hibernate.jar"> + <include input="main"> + </include> + </artifactdef> + + + + + + </componentdef> + + <!-- Generate the targets --> + <generate generate="hibernate-int"/> + +</project> Added: trunk/labs/jbossbuild/projects/jboss/hibernate-int/pom.xml =================================================================== --- trunk/labs/jbossbuild/projects/jboss/hibernate-int/pom.xml 2006-01-04 18:52:11 UTC (rev 1988) +++ trunk/labs/jbossbuild/projects/jboss/hibernate-int/pom.xml 2006-01-04 19:21:14 UTC (rev 1989) @@ -0,0 +1,66 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>org.jboss.server.hibernate-int</groupId> + <version>5.0-SNAPSHOT</version> + <artifactId>jboss-hibernate</artifactId> + <packaging>jar</packaging> + <name>JBoss Hibernate Integration Project</name> + <description>JBoss Hibernate Integration Project</description> + <parent> + <artifactId>app</artifactId> + <groupId>org.jboss.server</groupId> + <version>5.0-SNAPSHOT</version> + </parent> + <build> + <sourceDirectory>src/main</sourceDirectory> + <outputDirectory>output/classes</outputDirectory> + <plugins> + + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + + <!-- use ant to mirror buildmagic output --> + <execution> + <id>packaging</id> + <phase>package</phase> + <configuration> + <tasks> + + <mkdir dir="${basedir}/output/lib"/> + + <!-- Generate a jar containing all the compiled sources --> + <jar destfile="${basedir}/output/lib/jboss-hibernate.jar"> + <fileset dir="${basedir}/output/classes"/> + </jar> + + + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>org.jboss.server.server</groupId> + <artifactId>jboss-server</artifactId> + <version>5.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>hibernate</groupId> + <artifactId>hibernate3</artifactId> + <version>3.1rc2jboss</version> + </dependency> + <dependency> + <groupId>jboss</groupId> + <artifactId>jboss-cache</artifactId> + <version>1.2.4</version> + </dependency> + </dependencies> + +</project> Added: trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/ListenerInjector.java =================================================================== --- trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/ListenerInjector.java 2006-01-04 18:52:11 UTC (rev 1988) +++ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/ListenerInjector.java 2006-01-04 19:21:14 UTC (rev 1989) @@ -0,0 +1,46 @@ +/* + * JBoss, Home of Professional Open Source + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package org.jboss.hibernate; + +import org.hibernate.cfg.Configuration; +import org.jboss.deployment.DeploymentException; + +import javax.management.ObjectName; + +/** + * Implementors are responsible for injecting any custom Hibernate3 event listeners into the {@link + * org.hibernate.cfg.Configuration} which will then later be used to build the {@link org.hibernate.SessionFactory}. + * <p/> + * Implementors should have a no-arg constructor. + * + * @author <a href="mailto:st...@hi...">Steve Ebersole</a> + * @version <tt>$Revision: 1.2 $</tt> + */ +public interface ListenerInjector +{ + /** + * Called by the {@link org.jboss.hibernate.jmx.Hibernate} MBean when it is time to generate any custom listeners. + * <p/> + * Implementors should use the {@link Configuration#setListener(String, Object)} method to inject the appropriate + * listener instance(s). + * <p/> + * Note that the {@link org.hibernate.SessionFactory} is not yet available; it has not even beeen built at this time. + * <p/> + * Note that it is possible to actually set some properties on the incoming configuration instance. It is not + * advisable to do this with any Hibernate-specific settings as the MBean will have final say after execution of this + * method regarding any settings it manages (potentially over-writing a setting done during this execution). Maybe + * useful for the listeners, themselves, being able to read custom settings later from the {@link + * org.hibernate.SessionFactory}. + * + * @param configuration The configuration into which the customer listeners should be injected. + * @param objectName The MBean object name. + * + * @throws DeploymentException If any problems occur which should lead to a deployment failure (i.e. do not build the + * {@link org.hibernate.SessionFactory}). + */ + public void injectListeners(ObjectName objectName, Configuration configuration) throws DeploymentException; +} Added: trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/cache/DeployedTreeCacheProvider.java =================================================================== --- trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/cache/DeployedTreeCacheProvider.java 2006-01-04 18:52:11 UTC (rev 1988) +++ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/cache/DeployedTreeCacheProvider.java 2006-01-04 19:21:14 UTC (rev 1989) @@ -0,0 +1,91 @@ +/* + * JBoss, Home of Professional Open Source + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package org.jboss.hibernate.cache; + +import java.util.Properties; +import javax.management.MBeanServer; +import javax.management.ObjectName; + +import org.hibernate.cache.Cache; +import org.hibernate.cache.CacheException; +import org.hibernate.cache.CacheProvider; +import org.jboss.cache.TreeCache; +import org.jboss.cache.TreeCacheMBean; +import org.jboss.mx.util.MBeanProxy; +import org.jboss.mx.util.MBeanServerLocator; +import org.jboss.tm.TxManager; + +/** + * A Hibernate CacheProvider implementation which knows how to + * obtain a deployed JBossCache via its JMX ObjectName. + * + * @version <tt>$Revision: 1.6 $</tt> + * @author <a href="mailto:st...@hi...">Steve Ebersole</a> + */ +public class DeployedTreeCacheProvider implements CacheProvider +{ + public static final String OBJECT_NAME_PROP = "hibernate.treecache.objectName"; + public static final String DEFAULT_OBJECT_NAME = "jboss.cache:service=HibernateTreeCache"; + + private TreeCache deployedTreeCache; + + public void start(Properties properties) throws CacheException + { + // Determine the TreeCache MBean ObjectName. + String configObjectName = properties.getProperty( OBJECT_NAME_PROP, DEFAULT_OBJECT_NAME ); + ObjectName objectName; + try + { + objectName = new ObjectName( configObjectName ); + } + catch( Throwable t ) + { + throw new CacheException( "Malformed TreeCache ObjectName"); + } + + TreeCacheMBean mbean; + try + { + MBeanServer server = MBeanServerLocator.locateJBoss(); + mbean = (TreeCacheMBean) MBeanProxy.get(TreeCacheMBean.class, objectName, server); + } + catch( Throwable t ) + { + throw new CacheException( "Unable to locate TreeCache MBean under object name [" + configObjectName + "]" ); + } + + deployedTreeCache = mbean.getInstance(); + } + + public void stop() + { + deployedTreeCache = null; + } + + public boolean isMinimalPutsEnabledByDefault() + { + return true; + } + + /** + * Called by Hibernate in order to build the given named cache "region". + * + * @param name The cache "region" name. + * @param properties The configuration properties. + * @return The constructed Cache wrapper around the jndi-deployed TreeCache. + * @throws CacheException Generally indicates a problem locating the TreeCache. + */ + public Cache buildCache(String name, Properties properties) throws CacheException + { + return new org.hibernate.cache.TreeCache( deployedTreeCache, name, TxManager.getInstance() ); + } + + public long nextTimestamp() + { + return System.currentTimeMillis() / 100; + } +} Added: trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/jmx/Hibernate.java =================================================================== --- trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/jmx/Hibernate.java 2006-01-04 18:52:11 UTC (rev 1988) +++ trunk/labs/jbossbuild/projects/jboss/hibernate-int/src/main/org/jboss/hibernate/jmx/Hibernate.java 2006-01-04 19:21:14 UTC (rev 1989) @@ -0,0 +1,983 @@ +/* + * JBoss, Home of Professional Open Source + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package org.jboss.hibernate.jmx; + +import java.io.File; +import java.net.URL; +import java.net.URLClassLoader; +import java.util.Properties; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Date; +import java.util.jar.JarFile; +import javax.management.Notification; +import javax.management.ObjectName; +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import org.hibernate.HibernateException; +import org.hibernate.Interceptor; +import org.hibernate.SessionFactory; +import org.hibernate.jmx.StatisticsService; +import org.hibernate.cfg.Configuration; +import org.hibernate.cfg.Environment; +import org.hibernate.transaction.JBossTransactionManagerLookup; +import org.hibernate.transaction.JTATransactionFactory; + +import org.jboss.hibernate.cache.DeployedTreeCacheProvider; +import org.jboss.hibernate.ListenerInjector; +import org.jboss.logging.Logger; +import org.jboss.naming.Util; +import org.jboss.system.ServiceMBeanSupport; +import org.jboss.deployment.DeploymentException; +import org.jboss.deployment.DeploymentInfo; +import org.jboss.mx.loading.RepositoryClassLoader; + +/** + * The {@link HibernateMBean} implementation. + * + * @author <a href="mailto:al...@jb...">Alexey Loubyansky</a> + * @author <a href="mailto:ga...@hi...">Gavin King</a> + * @author <a href="mailto:st...@hi...">Steve Ebersole</a> + * @author <a href="mailto:dim...@jb...">Dimitris Andreadis</a> + * @version <tt>$Revision: 1.18 $</tt> + */ +public class Hibernate extends ServiceMBeanSupport implements HibernateMBean +{ + + private static final Logger log = Logger.getLogger( Hibernate.class ); + + public static final String SESSION_FACTORY_CREATE = "hibernate.sessionfactory.create"; + public static final String SESSION_FACTORY_DESTROY = "hibernate.sessionfactory.destroy"; + + // Configuration attributes "passed through" to Hibernate + private String datasourceName; + private String dialect; + private String defaultSchema; + private String defaultCatalog; + private Boolean sqlCommentsEnabled; + private Integer maxFetchDepth; + private Integer jdbcFetchSize; + private Integer jdbcBatchSize; + private Boolean batchVersionedDataEnabled; + private Boolean jdbcScrollableResultSetEnabled; + private Boolean getGeneratedKeysEnabled; + private Boolean streamsForBinaryEnabled; + private String hbm2ddlAuto; + private String querySubstitutions; + private Boolean showSqlEnabled; + private String username; + private String password; + private Boolean secondLevelCacheEnabled = Boolean.TRUE; + private Boolean queryCacheEnabled; + private String cacheProviderClass; + private ObjectName deployedTreeCacheObjectName; + private Boolean minimalPutsEnabled; + private String cacheRegionPrefix; + private Boolean structuredCacheEntriesEnabled; + private Boolean statGenerationEnabled; + private Boolean reflectionOptimizationEnabled; + + // Configuration attributes used by the MBean + private String sessionFactoryName; + private String sessionFactoryInterceptor; + private String listenerInjector; + private URL harUrl; + private boolean scanForMappingsEnabled = false; + private HashSet archiveClasspathUrls = new HashSet(); + private HashSet directoryClasspathUrls = new HashSet(); + + // Internal state + private boolean dirty = false; + private Date runningSince; + private SessionFactory sessionFactory; + private ObjectName hibernateStatisticsServiceName; + + /** + * Configure Hibernate and bind the <tt>SessionFactory</tt> to JNDI. + */ + public void startService() throws Exception + { + log.debug( "Hibernate MBean starting; " + this ); + + // be defensive... + if ( sessionFactory != null ) + { + destroySessionFactory(); + } + + harUrl = determineHarUrl(); + + if ( harUrl != null ) + { + log.trace( "starting in har deployment mode" ); + // we are part of a har deployment... + if ( scanForMappingsEnabled ) + { + log.trace( "scan for mappings was enabled" ); + scanForMappings(); + } + } + else + { + // we are not contained within a har deployment... + log.trace( "starting in non-har deployment mode" ); + scanForMappings(); + } + + buildSessionFactory(); + } + + /** + * Close the <tt>SessionFactory</tt>. + */ + public void stopService() throws Exception + { + destroySessionFactory(); + archiveClasspathUrls.clear(); + directoryClasspathUrls.clear(); + } + + private URL determineHarUrl() throws Exception + { + log.trace( "Attempting to determine HarUrl..." ); + DeploymentInfo deploymentInfo = getDeploymentInfo(); + if ( deploymentInfo == null ) + { + log.warn( "Unable to locate deployment info [" + getServiceName() + "]" ); + return null; + } + + String urlStr = deploymentInfo.url.getFile(); + log.trace( "checking our deployment unit [" + urlStr + "]" ); + if ( urlStr.endsWith( ".har" ) || urlStr.endsWith( ".har/" ) ) + { + return deploymentInfo.url; + } + else + { + return null; + } + } + + /** + * Centralize the logic needed for starting/binding the SessionFactory. + * + * @throws Exception + */ + private void buildSessionFactory() throws Exception + { + log.debug( "Building SessionFactory; " + this ); + + Configuration cfg = new Configuration(); + cfg.getProperties().clear(); // avoid reading hibernate.properties and Sys-props + + // Handle custom listeners.... + ListenerInjector listenerInjector = generateListenerInjectorInstance(); + if ( listenerInjector != null ) + { + listenerInjector.injectListeners( getServiceName(), cfg ); + } + + // Handle config settings.... + transferSettings( cfg.getProperties() ); + + // Handle mappings.... + handleMappings( cfg ); + + // Handle interceptor.... + Interceptor interceptorInstance = generateInterceptorInstance(); + if ( interceptorInstance != null ) + { + cfg.setInterceptor( interceptorInstance ); + } + + // Generate sf.... + sessionFactory = cfg.buildSessionFactory(); + + try + { + // Handle stat-mbean creation/registration.... + if ( sessionFactory.getStatistics() != null && sessionFactory.getStatistics().isStatisticsEnabled() ) + { + hibernateStatisticsServiceName = new ObjectName( getServiceName().toString() + "/Stats" ); + StatisticsService hibernateStatisticsService = new StatisticsService(); + hibernateStatisticsService.setSessionFactory( sessionFactory ); + getServer().registerMBean( hibernateStatisticsService, hibernateStatisticsServiceName ); + } + + // Handle JNDI binding.... + bind(); + } + catch ( Exception e ) + { + forceCleanup(); + throw e; + } + + dirty = false; + + sendNotification( + new Notification( SESSION_FACTORY_CREATE, getServiceName(), getNextNotificationSequenceNumber() ) + ); + + runningSince = new Date(); + + log.info( "SessionFactory successfully built and bound into JNDI [" + sessionFactoryName + "]" ); + } + + /** + * Centralize the logic needed to unbind/close a SessionFactory. + * + * @throws Exception + */ + private void destroySessionFactory() throws Exception + { + if ( sessionFactory != null ) + { + // TODO : exact situations where we need to clear the 2nd-lvl cache? + // (to allow clean release of the classloaders) + // Most likely, if custom classes are directly cached (UserTypes); anything else? + unbind(); + sessionFactory.close(); + sessionFactory = null; + runningSince = null; + + if ( hibernateStatisticsServiceName != null ) + { + try + { + getServer().unregisterMBean( hibernateStatisticsServiceName ); + } + catch ( Throwable t ) + { + // just log it + log.warn( "unable to cleanup statistics mbean", t ); + } + } + + sendNotification( + new Notification( SESSION_FACTORY_DESTROY, getServiceName(), getNextNotificationSequenceNumber() ) + ); + } + } + + private void handleMappings(Configuration cfg) + { + if ( harUrl != null ) + { + final File file = new File( harUrl.getFile() ); + if ( file.isDirectory() ) + { + cfg.addDirectory( file ); + } + else + { + cfg.addJar( file ); + } + } + + Iterator itr = archiveClasspathUrls.iterator(); + while ( itr.hasNext() ) + { + final File archive = ( File ) itr.next(); + log.debug( "Passing archive [" + archive + "] to Hibernate Configration" ); + cfg.addJar( archive ); + } + + itr = directoryClasspathUrls.iterator(); + while ( itr.hasNext() ) + { + final File directory = ( File ) itr.next(); + log.debug( "Passing directory [" + directory + "] to Hibernate Configration" ); + cfg.addDirectory( directory ); + } + } + + /** + * Scan the current context's classloader to locate any potential sources of Hibernate mapping files. + * + * @throws DeploymentException + */ + private void scanForMappings() throws DeploymentException + { + // Won't this cause problems if start() is called from say the console? + // a way around is to locate our DeploymentInfo and grab its ucl attribute + // for use here. + URL[] urls = null; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + if ( cl instanceof RepositoryClassLoader ) + { + urls = ( ( RepositoryClassLoader ) cl ).getClasspath(); + } + else if ( cl instanceof URLClassLoader ) + { + urls = ( ( URLClassLoader ) cl ).getURLs(); + } + else + { + throw new DeploymentException( "Unable to determine urls from classloader [" + cl + "]" ); + } + + // Search the urls for each of the classpath entries for any containing + // hibernate mapping files or archives + for ( int i = 0; i < urls.length; i++ ) + { + final File entry = new File( urls[i].getFile() ); + log.trace( "checking classpath entry [" + entry + "]" ); + if ( !entry.exists() ) + { + continue; + } + + if ( !entry.isDirectory() ) + { + // This entry is not a directory, meaning it is a file of + // some sort. If it is an archive, we are interested in it... + if ( isArchive( entry ) ) + { + log.trace( "classpath entry was an archive file..." ); + archiveClasspathUrls.add( entry ); + } + else + { + log.trace( "classpath entry was a non-archive file..." ); + } + } + else + { + log.trace( "classpath entry was a directory..." ); + + // we have a directory, add it to the list of directory classpath urls + directoryClasspathUrls.add( entry ); + } + } + } + + /** + * Simple helper method to determine whether a given File instance represents an archive which complies with the JAR + * specification. + * + * @param file The file to test. + * @return True if the incoming file for certain represents an archive; false otherwise. + */ + private boolean isArchive(File file) + { + try + { + new JarFile( file ); + return true; + } + catch ( Throwable t ) + { + return false; + } + } + + /** + * Transfer the state represented by our current attribute values into the given Properties instance, translating our + * attributes into the appropriate Hibernate settings. + * + * @param settings The Properties instance to which to add our state. + */ + private void transferSettings(Properties settings) + { + if ( cacheProviderClass == null ) + { + cacheProviderClass = "org.hibernate.cache.HashtableCacheProvider"; + } + + log.debug( "Using JDBC batch size : " + jdbcBatchSize ); + + setUnlessNull( settings, Environment.DATASOURCE, datasourceName ); + setUnlessNull( settings, Environment.DIALECT, dialect ); + setUnlessNull( settings, Environment.CACHE_PROVIDER, cacheProviderClass ); + setUnlessNull( settings, Environment.CACHE_REGION_PREFIX, cacheRegionPrefix ); + setUnlessNull( settings, Environment.USE_MINIMAL_PUTS, minimalPutsEnabled ); + setUnlessNull( settings, Environment.HBM2DDL_AUTO, hbm2ddlAuto ); + setUnlessNull( settings, Environment.DEFAULT_SCHEMA, defaultSchema ); + setUnlessNull( settings, Environment.STATEMENT_BATCH_SIZE, jdbcBatchSize ); + setUnlessNull( settings, Environment.USE_SQL_COMMENTS, sqlCommentsEnabled ); + + setUnlessNull( settings, Environment.STATEMENT_FETCH_SIZE, jdbcFetchSize ); + setUnlessNull( settings, Environment.USE_SCROLLABLE_RESULTSET, jdbcScrollableResultSetEnabled ); + setUnlessNull( settings, Environment.USE_QUERY_CACHE, queryCacheEnabled ); + setUnlessNull( settings, Environment.USE_STRUCTURED_CACHE, structuredCacheEntriesEnabled ); + setUnlessNull( settings, Environment.QUERY_SUBSTITUTIONS, querySubstitutions ); + setUnlessNull( settings, Environment.MAX_FETCH_DEPTH, maxFetchDepth ); + setUnlessNull( settings, Environment.SHOW_SQL, showSqlEnabled ); + setUnlessNull( settings, Environment.USE_GET_GENERATED_KEYS, getGeneratedKeysEnabled ); + setUnlessNull( settings, Environment.USER, username ); + setUnlessNull( settings, Environment.PASS, password ); + setUnlessNull( settings, Environment.BATCH_VERSIONED_DATA, batchVersionedDataEnabled ); + setUnlessNull( settings, Environment.USE_STREAMS_FOR_BINARY, streamsForBinaryEnabled ); + setUnlessNull( settings, Environment.USE_REFLECTION_OPTIMIZER, reflectionOptimizationEnabled ); + setUnlessNull( settings, Environment.GENERATE_STATISTICS, statGenerationEnabled ); + + setUnlessNull( + settings, Environment.TRANSACTION_MANAGER_STRATEGY, JBossTransactionManagerLookup.class.getName() + ); + setUnlessNull( settings, Environment.TRANSACTION_STRATEGY, JTATransactionFactory.class.getName() ); + + if ( deployedTreeCacheObjectName != null ) + { + String objNameString = deployedTreeCacheObjectName.toString(); + if ( objNameString != null && !"".equals( objNameString ) ) + { + settings.setProperty( DeployedTreeCacheProvider.OBJECT_NAME_PROP, objNameString ); + } + } + + settings.setProperty( Environment.FLUSH_BEFORE_COMPLETION, "true" ); + settings.setProperty( Environment.AUTO_CLOSE_SESSION, "true" ); + + // This is really H3-version-specific: + // in 3.0.3 and later, this should be the ConnectionReleaseMode enum; + // in 3.0.2, this is a true/false setting; + // in 3.0 -> 3.0.1, there is no such setting + // + // so we just set them both :) + settings.setProperty( "hibernate.connection.agressive_release", "true" ); + settings.setProperty( "hibernate.connection.release_mode", "after_statement" ); + } + + /** + * Simple helper method for transferring individual settings to a properties + * instance only if the setting's value is not null. + * + * @param props The properties instance into which to transfer the setting + * @param key The key under which to transfer the setting + * @param value The value of the setting. + */ + private void setUnlessNull(Properties props, String key, Object value) + { + if ( value != null ) + { + props.setProperty( key, value.toString() ); + } + } + + private ListenerInjector generateListenerInjectorInstance() + { + if ( listenerInjector == null ) + { + return null; + } + + log.info( "attempting to use listener injector [" + listenerInjector + "]" ); + try + { + return ( ListenerInjector ) Thread.currentThread() + .getContextClassLoader() + .loadClass( listenerInjector ) + .newInstance(); + } + catch ( Throwable t ) + { + log.warn( "Unable to generate specified listener injector", t ); + } + + return null; + } + + private Interceptor generateInterceptorInstance() + { + if ( sessionFactoryInterceptor == null ) + { + return null; + } + + log.info( "Generating session factory interceptor instance [" + sessionFactoryInterceptor + "]" ); + try + { + return ( Interceptor ) Thread.currentThread() + .getContextClassLoader() + .loadClass( sessionFactoryInterceptor ) + .newInstance(); + } + catch ( Throwable t ) + { + log.warn( "Unable to generate session factory interceptor instance", t ); + } + + return null; + } + + /** + * Perform the steps necessary to bind the managed SessionFactory into JNDI. + * + * @throws HibernateException + */ + private void bind() throws HibernateException + { + InitialContext ctx = null; + try + { + ctx = new InitialContext(); + Util.bind( ctx, sessionFactoryName, sessionFactory ); + } + catch ( NamingException e ) + { + throw new HibernateException( "Unable to bind SessionFactory into JNDI", e ); + } + finally + { + if ( ctx != null ) + { + try + { + ctx.close(); + } + catch ( Throwable ignore ) + { + // ignore + } + } + } + } + + /** + * Perform the steps necessary to unbind the managed SessionFactory from JNDI. + * + * @throws HibernateException + */ + private void unbind() throws HibernateException + { + InitialContext ctx = null; + try + { + ctx = new InitialContext(); + Util.unbind( ctx, sessionFactoryName ); + } + catch ( NamingException e ) + { + throw new HibernateException( "Unable to unbind SessionFactory from JNDI", e ); + } + finally + { + if ( ctx != null ) + { + try + { + ctx.close(); + } + catch ( Throwable ignore ) + { + // ignore + } + } + } + } + + private void forceCleanup() + { + try + { + sessionFactory.close(); + sessionFactory = null; + } + catch ( Throwable ignore ) + { + // ignore + } + } + + public String toString() + { + return super.toString() + " [ServiceName=" + serviceName + ", JNDI=" + sessionFactoryName + "]"; + } + + + // Managed operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + public void rebuildSessionFactory() throws Exception + { + destroySessionFactory(); + buildSessionFactory(); + } + + + // RO managed attributes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + public boolean isDirty() + { + return dirty; + } + + public boolean isSessionFactoryRunning() + { + return sessionFactory != null; + } + + public String getVersion() + { + return Environment.VERSION; + } + + public SessionFactory getInstance() + { + return sessionFactory; + } + + public ObjectName getStatisticsServiceName() + { + return hibernateStatisticsServiceName; + } + + public Date getRunningSince() + { + return runningSince; + } + + // R/W managed attributes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + public String getSessionFactoryName() + { + return sessionFactoryName; + } + + public void setSessionFactoryName(String sessionFactoryName) + { + this.sessionFactoryName = sessionFactoryName; + dirty = true; + } + + public String getDatasourceName() + { + return datasourceName; + } + + public void setDatasourceName(String datasourceName) + { + this.datasourceName = datasourceName; + dirty = true; + } + + public String getUsername() + ... [truncated message content] |
From: <jbo...@li...> - 2006-01-04 18:52:16
|
Author: tom...@jb... Date: 2006-01-04 13:52:11 -0500 (Wed, 04 Jan 2006) New Revision: 1988 Modified: / Log: grant fisheye access Property changes on: ___________________________________________________________________ Name: fisheye.access + allow |
From: <jbo...@li...> - 2006-01-03 16:40:32
|
Author: dam...@jb... Date: 2006-01-03 11:40:27 -0500 (Tue, 03 Jan 2006) New Revision: 1980 Added: trunk/labs/jbosswebnp/ Log: Added jbosswebnp |
From: <jbo...@li...> - 2006-01-03 14:39:07
|
Author: rem...@jb... Date: 2006-01-03 09:38:58 -0500 (Tue, 03 Jan 2006) New Revision: 1978 Modified: trunk/labs/jbossweb/src/share/classes/org/apache/coyote/ajp/AjpAprProcessor.java Log: - Fix dependency on wrong package. Modified: trunk/labs/jbossweb/src/share/classes/org/apache/coyote/ajp/AjpAprProcessor.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/coyote/ajp/AjpAprProcessor.java 2006-01-03 13:54:31 UTC (rev 1977) +++ trunk/labs/jbossweb/src/share/classes/org/apache/coyote/ajp/AjpAprProcessor.java 2006-01-03 14:38:58 UTC (rev 1978) @@ -32,7 +32,6 @@ import org.apache.coyote.Request; import org.apache.coyote.RequestInfo; import org.apache.coyote.Response; -import org.apache.jk.common.AjpConstants; import org.apache.tomcat.jni.Socket; import org.apache.tomcat.jni.Status; import org.apache.tomcat.util.buf.ByteChunk; @@ -773,7 +772,7 @@ requestHeaderMessage.getBytes(request.method()); break; - case AjpConstants.SC_A_SECRET: + case Constants.SC_A_SECRET: requestHeaderMessage.getBytes(tmpMB); if (requiredSecret != null) { secret = true; |
From: <jbo...@li...> - 2006-01-03 13:54:35
|
Author: rem...@jb... Date: 2006-01-03 08:54:31 -0500 (Tue, 03 Jan 2006) New Revision: 1977 Modified: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/connector/Request.java Log: - Small tweak: also use enableLookups for local DNS. Modified: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/connector/Request.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/catalina/connector/Request.java 2006-01-03 13:13:53 UTC (rev 1976) +++ trunk/labs/jbossweb/src/share/classes/org/apache/catalina/connector/Request.java 2006-01-03 13:54:31 UTC (rev 1977) @@ -1167,9 +1167,13 @@ */ public String getLocalName(){ if (localName == null) { - coyoteRequest.action - (ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE, coyoteRequest); - localName = coyoteRequest.localName().toString(); + if (!connector.getEnableLookups()) { + localName = getLocalAddr(); + } else { + coyoteRequest.action + (ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE, coyoteRequest); + localName = coyoteRequest.localName().toString(); + } } return localName; } |
Author: noe...@jb... Date: 2006-01-03 08:13:53 -0500 (Tue, 03 Jan 2006) New Revision: 1976 Added: trunk/labs/reportingservices/reporting-services/bin/ trunk/labs/reportingservices/reporting-services/doc/logo.png trunk/labs/reportingservices/reporting-services/doc/report-services.xcf trunk/labs/reportingservices/reporting-services/doc/reporting-services.xcf trunk/labs/reportingservices/reporting-services/lib/apache-myfaces/myfaces-extensions.jar trunk/labs/reportingservices/reporting-services/lib/jboss-serialization/ trunk/labs/reportingservices/reporting-services/lib/jboss-serialization/jboss-serialization.jar trunk/labs/reportingservices/reporting-services/lib/junit/ trunk/labs/reportingservices/reporting-services/lib/junit/README.txt trunk/labs/reportingservices/reporting-services/lib/junit/junit.jar trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/distribute/DistributeByFileCopy.java trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/metadata/ trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/metadata/DistributeMetaData.java trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/metadata/OutputFormatMetaData.java trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/metadata/ReportMetaData.java trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/metadata/ScheduleMetaData.java trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/distribute/DistributeByFileCopy.java trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/metadata/ReportsMetaData.java trunk/labs/reportingservices/reporting-services/src/main/report.xsd trunk/labs/reportingservices/reporting-services/src/tests/org/jboss/test/reporting/metadata/ trunk/labs/reportingservices/reporting-services/src/tests/org/jboss/test/reporting/metadata/TestMarshallSchemaless.java trunk/labs/reportingservices/reporting-services/src/tests/org/jboss/test/reporting/simple/SimpleClientTest.java trunk/labs/reportingservices/reporting-services/src/webapp/WEB-INF/lib/myfaces-examples.jar trunk/labs/reportingservices/reporting-services/src/webapp/WEB-INF/lib/portlet-api-1.0.jar trunk/labs/reportingservices/reporting-services/src/webapp/WEB-INF/lib/struts.jar Removed: trunk/labs/reportingservices/reporting-services/build.bat trunk/labs/reportingservices/reporting-services/build.sh trunk/labs/reportingservices/reporting-services/lib/jfreereport/gnujaxp.jar trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/metadata/ReportMetaData.java Modified: trunk/labs/reportingservices/reporting-services/.classpath trunk/labs/reportingservices/reporting-services/build.xml trunk/labs/reportingservices/reporting-services/lib/jboss-remoting/jboss-remoting.jar trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/ReportTaskFactory.java trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/ReportTaskImpl.java trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/distribute/Distribute.java trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/output/OutputFormat.java trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/schedule/Schedule.java trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/schedule/SchedulePeriodic.java trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/engine/ReportEngine.java trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/repository/RepositoryEntry.java trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/request/ReportRequestProcessor.java trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/scheduler/SchedulerService.java trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/scheduler/SchedulerSessionBean.java trunk/labs/reportingservices/reporting-services/src/resources/META-INF/jboss-service.xml trunk/labs/reportingservices/reporting-services/src/tests/org/jboss/test/reporting/simple/SimpleClient.java Log: fixed scheduling / started metadata Modified: trunk/labs/reportingservices/reporting-services/.classpath =================================================================== --- trunk/labs/reportingservices/reporting-services/.classpath 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/.classpath 2006-01-03 13:13:53 UTC (rev 1976) @@ -3,7 +3,6 @@ <classpathentry kind="src" path="src/main"/> <classpathentry kind="src" path="src/tests"/> <classpathentry kind="src" path="output/gen-src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="src" path="/jmx"/> <classpathentry kind="src" path="/common"/> <classpathentry kind="src" path="/j2ee"/> @@ -25,11 +24,17 @@ <classpathentry kind="lib" path="lib/apache-commons/lib/commons-vfs.jar"/> <classpathentry kind="lib" path="lib/apache-myfaces/jstl.jar"/> <classpathentry kind="lib" path="lib/apache-myfaces/myfaces.jar"/> + <classpathentry kind="lib" path="lib/apache-myfaces/myfaces-extensions.jar"/> <classpathentry kind="lib" path="lib/apache-myfaces/myfaces-impl.jar"/> <classpathentry kind="lib" path="lib/apache-myfaces/myfaces-jsf-api.jar"/> - <classpathentry kind="lib" path="lib/jasperreports/itext-1.01.jar"/> <classpathentry kind="lib" path="lib/jasperreports/jasperreports-0.6.8.jar"/> <classpathentry kind="lib" path="lib/jboss/javax.servlet.jar"/> + <classpathentry kind="lib" path="lib/jboss-remoting/jboss-remoting.jar"/> + <classpathentry kind="lib" path="lib/jboss-serialization/jboss-serialization.jar"/> + <classpathentry kind="lib" path="lib/junit/junit.jar"/> + <classpathentry kind="lib" path="lib/sun-jaf/activation.jar"/> + <classpathentry kind="lib" path="lib/sun-mail/mail.jar"/> + <classpathentry kind="lib" path="lib/xdoclet/commons-logging.jar"/> <classpathentry kind="lib" path="lib/jboss/jboss.jar"/> <classpathentry kind="lib" path="lib/jboss/jboss-common.jar"/> <classpathentry kind="lib" path="lib/jboss/jboss-j2ee.jar"/> @@ -38,10 +43,6 @@ <classpathentry kind="lib" path="lib/jboss/jboss-system.jar"/> <classpathentry kind="lib" path="lib/jboss/jmx-adaptor-plugin.jar"/> <classpathentry kind="lib" path="lib/jboss/jnpserver.jar"/> - <classpathentry kind="lib" path="lib/jboss-remoting/jboss-remoting.jar"/> - <classpathentry kind="lib" path="lib/oswego-concurrent/lib/concurrent.jar"/> - <classpathentry kind="lib" path="lib/sun-jaf/activation.jar"/> - <classpathentry kind="lib" path="lib/sun-mail/mail.jar"/> <classpathentry kind="lib" path="lib/xdoclet/xdoclet-bea-module-jb4.jar"/> <classpathentry kind="lib" path="lib/xdoclet/xdoclet-ejb-module-jb4.jar"/> <classpathentry kind="lib" path="lib/xdoclet/xdoclet-java-module-jb4.jar"/> @@ -52,7 +53,8 @@ <classpathentry kind="lib" path="lib/xdoclet/xdoclet-web-module-jb4.jar"/> <classpathentry kind="lib" path="lib/xdoclet/xdoclet-xdoclet-module-jb4.jar"/> <classpathentry kind="lib" path="lib/xdoclet/xdoclet-xjavadoc-jb4.jar"/> - <classpathentry kind="lib" path="lib/jfreereport/gnujaxp.jar"/> + <classpathentry kind="lib" path="lib/oswego-concurrent/lib/concurrent.jar"/> + <classpathentry kind="lib" path="lib/oswego-concurrent/lib/concurrent-src.zip"/> <classpathentry kind="lib" path="lib/jfreereport/itext-1.2.3.jar"/> <classpathentry kind="lib" path="lib/jfreereport/jcommon-1.0.0-rc1.jar"/> <classpathentry kind="lib" path="lib/jfreereport/jcommon-xml-1.0.0-rc1.jar"/> @@ -60,6 +62,6 @@ <classpathentry kind="lib" path="lib/jfreereport/jlfgr-1_0.jar"/> <classpathentry kind="lib" path="lib/jfreereport/pixie-0.8.4.jar"/> <classpathentry kind="lib" path="lib/jfreereport/poi-2.5.1-final-20040804.jar"/> - <classpathentry sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.source_3.1.0/src/org.junit_3.8.1/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="bin"/> </classpath> Deleted: trunk/labs/reportingservices/reporting-services/build.bat =================================================================== --- trunk/labs/reportingservices/reporting-services/build.bat 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/build.bat 2006-01-03 13:13:53 UTC (rev 1976) @@ -1,94 +0,0 @@ -@echo off -REM ====================================================================== -REM -REM This is the main entry point for the build system. -REM -REM Users should be sure to execute this file rather than 'ant' to ensure -REM the correct version is being used with the correct configuration. -REM -REM ====================================================================== -REM -REM $Id: build.bat,v 1.1.1.1 2004/04/22 17:21:12 tdiesler Exp $ -REM -REM Authors: -REM Jason Dillon <ja...@pl...> -REM Sacha Labourey <sac...@co...> -REM - -REM ****************************************************** -REM Ignore the ANT_HOME variable: we want to use *our* -REM ANT version and associated JARs. -REM ****************************************************** -REM Ignore the users classpath, cause it might mess -REM things up -REM ****************************************************** - -SETLOCAL - -set CLASSPATH= -set ANT_HOME= -set JAXP_DOM_FACTORY=org.apache.crimson.jaxp.DocumentBuilderFactoryImpl -set JAXP_SAX_FACTORY=org.apache.crimson.jaxp.SAXParserFactoryImpl -REM set JAXP_DOM_FACTORY=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl -REM set JAXP_SAX_FACTORY=org.apache.xerces.jaxp.SAXParserFactoryImpl - -set ANT_OPTS=-Djava.protocol.handler.pkgs=org.jboss.net.protocol -Djavax.xml.parsers.DocumentBuilderFactory=%JAXP_DOM_FACTORY% -Djavax.xml.parsers.SAXParserFactory=%JAXP_SAX_FACTORY% -Dbuild.script=build.bat - -REM ****************************************************** -REM - "for" loops have been unrolled for compatibility -REM with some WIN32 systems. -REM ****************************************************** - -set NAMES=tools;tools\ant;tools\apache\ant -set SUBFOLDERS=..;..\..;..\..\..;..\..\..\.. - -REM ****************************************************** -REM ****************************************************** - -SET EXECUTED=FALSE -for %%i in (%NAMES%) do call :subLoop %%i %1 %2 %3 %4 %5 %6 - -goto :EOF - - -REM ****************************************************** -REM ********* Search for names in the subfolders ********* -REM ****************************************************** - -:subLoop -for %%j in (%SUBFOLDERS%) do call :testIfExists %%j\%1\bin\ant.bat %2 %3 %4 %5 %6 %7 - -goto :EOF - - -REM ****************************************************** -REM ************ Test if ANT Batch file exists *********** -REM ****************************************************** - -:testIfExists -if exist %1 call :BatchFound %1 %2 %3 %4 %5 %6 %7 %8 - -goto :EOF - - -REM ****************************************************** -REM ************** Batch file has been found ************* -REM ****************************************************** - -:BatchFound -if (%EXECUTED%)==(FALSE) call :ExecuteBatch %1 %2 %3 %4 %5 %6 %7 %8 -set EXECUTED=TRUE - -goto :EOF - -REM ****************************************************** -REM ************* Execute Batch file only once *********** -REM ****************************************************** - -:ExecuteBatch -echo Calling %1 %2 %3 %4 %5 %6 %7 %8 -call %1 %2 %3 %4 %5 %6 %7 %8 - -:end - -if "%NOPAUSE%" == "" pause Deleted: trunk/labs/reportingservices/reporting-services/build.sh =================================================================== --- trunk/labs/reportingservices/reporting-services/build.sh 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/build.sh 2006-01-03 13:13:53 UTC (rev 1976) @@ -1,198 +0,0 @@ -#!/bin/sh -### ====================================================================== ### -## ## -## This is the main entry point for the build system. ## -## ## -## Users should be sure to execute this file rather than 'ant' to ensure ## -## the correct version is being used with the correct configuration. ## -## ## -### ====================================================================== ### - -# $Id: build.sh,v 1.1.1.1 2004/04/22 17:21:12 tdiesler Exp $ - -PROGNAME=`basename $0` -DIRNAME=`dirname $0` -GREP="grep" -ROOT="/" - -# Ignore user's ANT_HOME if it is set -ANT_HOME="" - -# the default search path for ant -ANT_SEARCH_PATH="\ - tools - tools/ant \ - tools/apache/ant \ - ant" - -# the default build file name -ANT_BUILD_FILE="build.xml" - -# the default arguments -ANT_OPTIONS="-find $ANT_BUILD_FILE" - -# Use the maximum available, or set MAX_FD != -1 to use that -MAX_FD="maximum" - -# OS specific support (must be 'true' or 'false'). -cygwin=false; -darwin=false; -case "`uname`" in - CYGWIN*) - cygwin=true - ;; - - Darwin*) - darwin=true - ;; -esac - -# the jaxp parser to use -if [ "x$JAXP" = "x" ]; then - # Default to crimson - JAXP="crimson" -fi - -# -# Helper to complain. -# -die() { - echo "${PROGNAME}: $*" - exit 1 -} - -# -# Helper to complain. -# -warn() { - echo "${PROGNAME}: $*" -} - -# -# Helper to source a file if it exists. -# -maybe_source() { - for file in $*; do - if [ -f "$file" ]; then - . $file - fi - done -} - -search() { - search="$*" - for d in $search; do - ANT_HOME="`pwd`/$d" - ANT="$ANT_HOME/bin/ant" - if [ -x "$ANT" ]; then - # found one - echo $ANT_HOME - break - fi - done -} - -# -# Main function. -# -main() { - # if there is a build config file. then source it - maybe_source "$DIRNAME/build.conf" "$HOME/.build.conf" - - # Increase the maximum file descriptors if we can - if [ $cygwin = "false" ]; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ]; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then - # use the system max - MAX_FD="$MAX_FD_LIMIT" - fi - - ulimit -n $MAX_FD - if [ $? -ne 0 ]; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT" - fi - fi - - # try the search path - ANT_HOME=`search $ANT_SEARCH_PATH` - - # try looking up to root - if [ "x$ANT_HOME" = "x" ]; then - target="build" - _cwd=`pwd` - - while [ "x$ANT_HOME" = "x" ] && [ "$cwd" != "$ROOT" ]; do - cd .. - cwd=`pwd` - ANT_HOME=`search $ANT_SEARCH_PATH` - done - - # make sure we get back - cd $_cwd - - if [ "$cwd" != "$ROOT" ]; then - found="true" - fi - - # complain if we did not find anything - if [ "$found" != "true" ]; then - die "Could not locate Ant; check \$ANT or \$ANT_HOME." - fi - fi - - # make sure we have one - ANT=$ANT_HOME/bin/ant - if [ ! -x "$ANT" ]; then - die "Ant file is not executable: $ANT" - fi - - # specify the jaxp parser impls to use - case "$JAXP" in - crimson) - JAXP_DOM_FACTORY="org.apache.crimson.jaxp.DocumentBuilderFactoryImpl" - JAXP_SAX_FACTORY="org.apache.crimson.jaxp.SAXParserFactoryImpl" - ;; - - xerces) - JAXP_DOM_FACTORY="org.apache.xerces.jaxp.DocumentBuilderFactoryImpl" - JAXP_SAX_FACTORY="org.apache.xerces.jaxp.SAXParserFactoryImpl" - ;; - esac - - if [ "x$JAXP_DOM_FACTORY" != "x" ]; then - ANT_OPTS="$ANT_OPTS -Djavax.xml.parsers.DocumentBuilderFactory=$JAXP_DOM_FACTORY" - fi - if [ "x$JAXP_SAX_FACTORY" != "x" ]; then - ANT_OPTS="$ANT_OPTS -Djavax.xml.parsers.SAXParserFactory=$JAXP_SAX_FACTORY" - fi - - # need to specify planet57/buildmagic protocol handler package - ANT_OPTS="$ANT_OPTS -Djava.protocol.handler.pkgs=org.jboss.net.protocol" - - # setup some build properties - ANT_OPTS="$ANT_OPTS -Dbuild.script=$0" - - # change to the directory where the script lives so users are not forced - # to be in the same directory as build.xml - cd $DIRNAME - - # export some stuff for ant - export ANT ANT_HOME ANT_OPTS - - # execute in debug mode, or simply execute - if [ "x$ANT_DEBUG" != "x" ]; then - /bin/sh -x $ANT $ANT_OPTIONS "$@" - else - exec $ANT $ANT_OPTIONS "$@" - fi -} - -## -## Bootstrap -## - -main "$@" Modified: trunk/labs/reportingservices/reporting-services/build.xml =================================================================== --- trunk/labs/reportingservices/reporting-services/build.xml 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/build.xml 2006-01-03 13:13:53 UTC (rev 1976) @@ -47,19 +47,32 @@ <property name="tests.src.dir" value="${tests.dir}"/> <property name="tests.compile.dir" value="${output.dir}/tests/classes"/> - <!-- The combined library classpath --> + <!-- deploy dir from JBoss AS install --> + <property name="jboss.dir" value="../jboss" /> + <property name="jboss.conf.dir" value="${jboss.dir}/server/default" /> + <property name="jboss.deploy.dir" value="${jboss.conf.dir}/deploy" /> + + <!-- The combined library classpath --> <path id="library.classpath"> <pathelement location="${compile.dir}"/> <pathelement location="${etc.dir}"/> + <fileset dir="${jboss.dir}/lib"> + <include name="**/*.jar"/> + </fileset> + <fileset dir="${jboss.conf.dir}/lib"> + <include name="**/*.jar"/> + </fileset> <fileset dir="${lib.dir}"> <include name="**/*.jar"/> + <exclude name="**/jboss/**/*.jar"/> </fileset> </path> - <path id="tests.classpath"> - <path refid="library.classpath"/> - <pathelement path="${output.lib.dir}/xmas-reporting.jar"/> - </path> + <path id="tests.classpath"> + <path refid="library.classpath"/> + <pathelement path="${output.lib.dir}/reporting-services.jar"/> + <pathelement path="${output.lib.dir}/reporting-services-tests.jar"/> + </path> </target> @@ -206,6 +219,9 @@ <fileset dir="${lib.dir}/jboss-remoting"> <include name="*.jar"/> </fileset> + <fileset dir="${lib.dir}/jboss-serialization"> + <include name="*.jar"/> + </fileset> <fileset dir="${lib.dir}/jasperreports"> <include name="*.jar"/> <exclude name="itext*.jar"/> @@ -256,7 +272,8 @@ debug="on" deprecation="on" optimize="off" - includes="**/*.java" + includes="**/*.java" + excludes="**/metadata/*.java" failonerror="true"> <src path="${tests.src.dir}"/> <classpath refid="library.classpath"/> @@ -271,6 +288,7 @@ manifest="${manifest.file}"> <fileset dir="${tests.compile.dir}"> <include name="org/jboss/test/reporting/**"/> + <exclude name="org/jboss/test/reporting/metadata/**"/> </fileset> </jar> </target> @@ -278,32 +296,40 @@ <target name="tests" description="Runs reporting functional tests." depends="jars, tests.jars"> <java classname="org.jboss.test.reporting.simple.SimpleClient" > - <arg value="${output.dir}/tests"/> - <classpath> - <fileset dir="${output.lib.dir}"> - <include name="reporting-services-client.jar"/> - <include name="reporting-services-tests.jar"/> - </fileset> - <fileset dir="${lib.dir}/jboss-remoting"> - <include name="*.jar"/> - </fileset> - <fileset dir="${lib.dir}/jboss"> - <include name="jboss-common.jar"/> - <include name="jboss-j2se.jar"/> - <include name="javax.servlet.jar"/> - </fileset> - <fileset dir="${lib.dir}/apache-commons/lib"> - <include name="commons-httpclient.jar"/> - </fileset> - <fileset dir="${lib.dir}/oswego-concurrent/lib"> - <include name="*.jar"/> - </fileset> - </classpath> + <arg value="${output.dir}/tests"/> + <classpath refid="tests.classpath"/> </java> - </target> + <!--target name="testsMetadata" depends="configure"> + <mkdir dir="${tests.compile.dir}"/> + <path id="testsmetadata.classpath"> + <path refid="library.classpath"/> + <pathelement path="${output.lib.dir}/reporting-services.jar"/> + <pathelement path="${output.lib.dir}/reporting-services-tests.jar"/> + <fileset dir="${lib.dir}"> + <include name="**/jboss/**/*.jar"/> + </fileset> + <pathelement location="${tests.compile.dir}"/> + </path> + + + <javac destdir="${tests.compile.dir}" + debug="on" + deprecation="on" + optimize="off" + includes="**/*.java" + failonerror="true"> + <src path="${tests.src.dir}"/> + <classpath refid="testsmetadata.classpath"/> + </javac> + <java classname="org.jboss.test.reporting.metadata.TestMarshallSchemaless" > + <arg value="${output.dir}/tests"/> + <classpath refid="testsmetadata.classpath"/> + </java> + </target--> + <!-- ================================================================== --> <!-- General --> <!-- ================================================================== --> @@ -331,17 +357,14 @@ <!-- Misc. --> <!-- ================================================================== --> - <target name="z_deploy-env"> - <property name="deploy.dir" value="C:/_app/JAVA/JBOSS/reporting-services/jboss4/server/default/deploy" /> - </target> - <target name="z_deploy" depends="z_deploy-env, most"> + <target name="z_deploy" depends="configure, most"> <delete> - <fileset dir="${deploy.dir}"> + <fileset dir="${jboss.deploy.dir}"> <include name="reporting-services.sar/**/*"/> </fileset> </delete> - <copy todir="${deploy.dir}"> + <copy todir="${jboss.deploy.dir}"> <fileset dir="${output.lib.dir}"> <include name="reporting-services.sar/**/*"/> </fileset> @@ -351,15 +374,15 @@ </target> - <target name="z_deploy-reports" depends="configure, z_deploy-env"> + <target name="z_deploy-reports" depends="configure"> <delete> - <fileset dir="${deploy.dir}"> + <fileset dir="${jboss.deploy.dir}"> <include name="*.era"/> <include name="*.jrxml"/> <include name="*.jfxml"/> </fileset> </delete> - <copy todir="${deploy.dir}"> + <copy todir="${jboss.deploy.dir}"> <fileset dir="${root.dir}/sample/era"> <include name="*.era"/> </fileset> Added: trunk/labs/reportingservices/reporting-services/doc/logo.png =================================================================== (Binary files differ) Property changes on: trunk/labs/reportingservices/reporting-services/doc/logo.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/reportingservices/reporting-services/doc/report-services.xcf =================================================================== (Binary files differ) Property changes on: trunk/labs/reportingservices/reporting-services/doc/report-services.xcf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/reportingservices/reporting-services/doc/reporting-services.xcf =================================================================== (Binary files differ) Property changes on: trunk/labs/reportingservices/reporting-services/doc/reporting-services.xcf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/reportingservices/reporting-services/lib/apache-myfaces/myfaces-extensions.jar =================================================================== (Binary files differ) Property changes on: trunk/labs/reportingservices/reporting-services/lib/apache-myfaces/myfaces-extensions.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/labs/reportingservices/reporting-services/lib/jboss-remoting/jboss-remoting.jar =================================================================== (Binary files differ) Added: trunk/labs/reportingservices/reporting-services/lib/jboss-serialization/jboss-serialization.jar =================================================================== (Binary files differ) Property changes on: trunk/labs/reportingservices/reporting-services/lib/jboss-serialization/jboss-serialization.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Deleted: trunk/labs/reportingservices/reporting-services/lib/jfreereport/gnujaxp.jar =================================================================== (Binary files differ) Added: trunk/labs/reportingservices/reporting-services/lib/junit/README.txt =================================================================== --- trunk/labs/reportingservices/reporting-services/lib/junit/README.txt 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/lib/junit/README.txt 2006-01-03 13:13:53 UTC (rev 1976) @@ -0,0 +1 @@ +Version 3.8.1 of JUnit from http://www.junit.org/index.htm Added: trunk/labs/reportingservices/reporting-services/lib/junit/junit.jar =================================================================== (Binary files differ) Property changes on: trunk/labs/reportingservices/reporting-services/lib/junit/junit.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/ReportTaskFactory.java =================================================================== --- trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/ReportTaskFactory.java 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/ReportTaskFactory.java 2006-01-03 13:13:53 UTC (rev 1976) @@ -92,10 +92,18 @@ public static ReportTask getInstance() { ReportTaskImpl result=null; - result = new ReportTaskImpl(new GUID().toString()); + result = new ReportTaskImpl(newReportTaskID()); return result; } + /** + * Return a ReportTask ID + */ + public static String newReportTaskID() + { + return new GUID().toString(); + } + } Modified: trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/ReportTaskImpl.java =================================================================== --- trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/ReportTaskImpl.java 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/ReportTaskImpl.java 2006-01-03 13:13:53 UTC (rev 1976) @@ -21,11 +21,6 @@ */ public class ReportTaskImpl implements ReportTask, Serializable { - - - /** - * - */ private static final long serialVersionUID = -3943314104014993256L; @@ -34,6 +29,7 @@ private int outputFormat = 0; private Schedule schedule = null; private String ID = ""; + private boolean requiresNewID=false; // keep this for later // private SecurityThing securityInfo=null; @@ -55,16 +51,33 @@ /** trigger the execution of the report */ public void submit() throws Exception { + String previousID=this.ID; + boolean error=false; try { + // when submitted, the RT ID is used as the timer ID + // if the RT is used several times, its ID will change + if (this.requiresNewID == true) + { + this.ID = ReportTaskFactory.newReportTaskID(); + } ReportTaskFactory.reportClient.invoke(this); + this.requiresNewID = true; } catch (Throwable e) { + error=true; Exception ee=new Exception("Invocation error."); ee.initCause(e); throw ee; } + finally + { + if (error) + { + this.ID=previousID; + } + } } /** @@ -150,10 +163,11 @@ { String result= "\n\n******************** ReportTask ***********************\n" + - "** report \t= " + this.report + "\n" + + "** ID \t= " + this.ID + "\n" + + "** report \t= " + this.report.toString() + "\n" + "** output \t= " + OutputFormat.toString(this.outputFormat) + "\n" + - "** schedule \t= " + this.schedule + "\n" + - "** distribute \t= " + this.distribute + "\n"; + "** schedule \t= " + this.schedule.toString() + "\n" + + "** distribute \t= " + this.distribute.toString() + "\n"; if (report.getData() != null) result = result + "** data columns = " + report.getData().toString() + "\n"; @@ -199,12 +213,12 @@ public Schedule getSchedule() { - return schedule; + return this.schedule; } public void setSchedule(Schedule in_value) { - schedule = in_value; + this.schedule = in_value; } Modified: trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/distribute/Distribute.java =================================================================== --- trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/distribute/Distribute.java 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/distribute/Distribute.java 2006-01-03 13:13:53 UTC (rev 1976) @@ -6,8 +6,12 @@ */ package org.jboss.reporting.api.distribute; -public class Distribute +import java.io.Serializable; + +public class Distribute implements Serializable { + + private static final long serialVersionUID = 181723683354366173L; public final static int TYPE_NONE=0; public final static int TYPE_BY_METHOD_RETURN=100; public final static int TYPE_BY_MAIL=200; Added: trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/distribute/DistributeByFileCopy.java =================================================================== --- trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/distribute/DistributeByFileCopy.java 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/distribute/DistributeByFileCopy.java 2006-01-03 13:13:53 UTC (rev 1976) @@ -0,0 +1,71 @@ +/* + * JBoss, Home of Professional Open Source + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package org.jboss.reporting.api.distribute; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @author noel + * + */ +public class DistributeByFileCopy extends Distribute implements Serializable +{ + + /** + * + */ + private static final long serialVersionUID = 1996230093509472886L; + + private String pathName=""; + private String fileName=""; + + + static + { + TYPE=TYPE_BY_FILE_COPY; + } + + + public DistributeByFileCopy() + { + } + + public DistributeByFileCopy(String in_pathName, String in_fileName) + { + this.pathName = in_pathName; + this.fileName = in_fileName; + } + + public String toString() + { + return "DistributeByFileCopy: \n" + + "\tpathName = " + this.pathName + "\n" + + "\tfileName = " + this.fileName + "\n"; + } + + public String getFileName() + { + return fileName; + } + + public void setFileName(String fileName) + { + this.fileName = fileName; + } + + public String getPathName() + { + return pathName; + } + + public void setPathName(String pathName) + { + this.pathName = pathName; + } +} Added: trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/metadata/DistributeMetaData.java =================================================================== --- trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/metadata/DistributeMetaData.java 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/metadata/DistributeMetaData.java 2006-01-03 13:13:53 UTC (rev 1976) @@ -0,0 +1,56 @@ +/* + * JBoss, Home of Professional Open Source + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package org.jboss.reporting.api.metadata; + +import java.io.Serializable; +import org.jboss.logging.Logger; +import org.jboss.reporting.api.distribute.*; + +/** + * A representation of the <distribute> element in + * jboss-report.xml deployment descriptors . + * + * @author <a href="mailto:noe...@jb...">Noel Rocher</a> + * @version $Revision: 1.0 $ + */ +public class DistributeMetaData implements Serializable +{ + +private static final long serialVersionUID = 1L; + +private static Logger log = Logger.getLogger(DistributeMetaData.class); + + private DistributeByFileCopy byFileCopy = null; + private DistributeByMail byMail = null; + private DistributeByMethodReturn byMethodReturn = null; + + public DistributeByFileCopy getByFileCopy() + { + return byFileCopy; + } + public void setByFileCopy(DistributeByFileCopy byFileCopy) + { + this.byFileCopy = byFileCopy; + } + public DistributeByMail getByMail() + { + return byMail; + } + public void setByMail(DistributeByMail byMail) + { + this.byMail = byMail; + } + public DistributeByMethodReturn getByMethodReturn() + { + return byMethodReturn; + } + public void setByMethodReturn(DistributeByMethodReturn byMethodReturn) + { + this.byMethodReturn = byMethodReturn; + } + +} Added: trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/metadata/OutputFormatMetaData.java =================================================================== --- trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/metadata/OutputFormatMetaData.java 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/metadata/OutputFormatMetaData.java 2006-01-03 13:13:53 UTC (rev 1976) @@ -0,0 +1,41 @@ +/* + * JBoss, Home of Professional Open Source + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package org.jboss.reporting.api.metadata; + +import java.util.Map; + +import org.jboss.logging.Logger; +import org.jboss.reporting.api.schedule.Schedule; + +/** + * A representation of the <outputFormat> element in + * jboss-report.xml deployment descriptors . + * + * @author <a href="mailto:noe...@jb...">Noel Rocher</a> + * @version $Revision: 1.0 $ + */ +public class OutputFormatMetaData +{ + private static Logger log = Logger.getLogger(OutputFormatMetaData.class); + + private String value=""; + + public OutputFormatMetaData(){} + public OutputFormatMetaData(String in_value){this.value = in_value;} + + + public String getValue() + { + return value; + } + + public void setValue(String value) + { + this.value = value; + } + +} Added: trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/metadata/ReportMetaData.java =================================================================== --- trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/metadata/ReportMetaData.java 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/metadata/ReportMetaData.java 2006-01-03 13:13:53 UTC (rev 1976) @@ -0,0 +1,86 @@ +/* + * JBoss, Home of Professional Open Source + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package org.jboss.reporting.api +.metadata; + +import java.io.Serializable; +import java.util.Map; + +import org.jboss.logging.Logger; +import org.jboss.reporting.api.schedule.Schedule; + +/** + * A representation of the <report> element in + * jboss-report.xml deployment descriptors . + * + * @author <a href="mailto:noe...@jb...">Noel Rocher</a> + * @version $Revision: 1.0 $ + */ +public class ReportMetaData implements Serializable +{ + +private static final long serialVersionUID = 1L; + +private static Logger log = Logger.getLogger(ReportMetaData.class); + + private String name = ""; + private String datasource = ""; + private Map parameters = null; + private ScheduleMetaData schedule = null; + private OutputFormatMetaData outputFormat = null; + private DistributeMetaData distribute = null; + + public String getDatasource() + { + return datasource; + } + public void setDatasource(String datasource) + { + this.datasource = datasource; + } + public DistributeMetaData getDistribute() + { + return distribute; + } + public void setDistribute(DistributeMetaData distribute) + { + this.distribute = distribute; + } + public String getName() + { + return name; + } + public void setName(String name) + { + this.name = name; + } + public OutputFormatMetaData getOutputFormat() + { + return outputFormat; + } + public void setOutputFormat(OutputFormatMetaData outputFormat) + { + this.outputFormat = outputFormat; + } + public Map getParameters() + { + return parameters; + } + public void setParameters(Map parameters) + { + this.parameters = parameters; + } + public ScheduleMetaData getSchedule() + { + return schedule; + } + public void setSchedule(ScheduleMetaData schedule) + { + this.schedule = schedule; + } + +} \ No newline at end of file Added: trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/metadata/ScheduleMetaData.java =================================================================== --- trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/metadata/ScheduleMetaData.java 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/metadata/ScheduleMetaData.java 2006-01-03 13:13:53 UTC (rev 1976) @@ -0,0 +1,54 @@ +/* + * JBoss, Home of Professional Open Source + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package org.jboss.reporting.api.metadata; + +import java.io.Serializable; + +import org.jboss.logging.Logger; +import org.jboss.reporting.api.schedule.*; + +/** + * A representation of the <report> element in + * jboss-report.xml deployment descriptors . + * + * @author <a href="mailto:noe...@jb...">Noel Rocher</a> + * @version $Revision: 1.0 $ + */ +public class ScheduleMetaData implements Serializable +{ + private static final long serialVersionUID = 1L; + private static Logger log = Logger.getLogger(ScheduleMetaData.class); + + private ScheduleOnce scheduleOnce=null; + private ScheduleNow scheduleNow=null; + private SchedulePeriodic schedulePeriodic=null; + public ScheduleNow getScheduleNow() + { + return scheduleNow; + } + public void setScheduleNow(ScheduleNow scheduleNow) + { + this.scheduleNow = scheduleNow; + } + public ScheduleOnce getScheduleOnce() + { + return scheduleOnce; + } + public void setScheduleOnce(ScheduleOnce scheduleOnce) + { + this.scheduleOnce = scheduleOnce; + } + public SchedulePeriodic getSchedulePeriodic() + { + return schedulePeriodic; + } + public void setSchedulePeriodic(SchedulePeriodic schedulePeriodic) + { + this.schedulePeriodic = schedulePeriodic; + } + +} Modified: trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/output/OutputFormat.java =================================================================== --- trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/output/OutputFormat.java 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/output/OutputFormat.java 2006-01-03 13:13:53 UTC (rev 1976) @@ -81,4 +81,35 @@ return result; } + + + public final static int toInt(String in_value) + { + int result=0; + String trim_value = in_value.trim().toUpperCase(); + if ("PDF".equals(trim_value) ) + { + result = OutputFormat.PDF; + } + else if ("HTML".equals(trim_value) ) + { + result = OutputFormat.HTML; + } + else if ("XML".equals(trim_value) ) + { + result = OutputFormat.PDF; + } + else if ("XLS".equals(trim_value) ) + { + result = OutputFormat.XLS; + } + else if ("CSV".equals(trim_value) ) + { + result = OutputFormat.CSV; + } + + return result; + } + + } Modified: trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/schedule/Schedule.java =================================================================== --- trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/schedule/Schedule.java 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/schedule/Schedule.java 2006-01-03 13:13:53 UTC (rev 1976) @@ -6,21 +6,26 @@ */ package org.jboss.reporting.api.schedule; +import java.io.Serializable; import java.util.Calendar; /** * @author noel * */ -public class Schedule +public class Schedule implements Serializable { + + private static final long serialVersionUID = 181723683354366172L; + + public final static int TYPE_NONE=0; public final static int TYPE_ONCE=100; public final static int TYPE_NOW=200; public final static int TYPE_PERIODIC=300; public static int TYPE=TYPE_NONE; - private Calendar startDate=null; + protected Calendar startDate=null; public int getType() { @@ -29,7 +34,7 @@ public Calendar getStartDate() { - return startDate; + return this.startDate; } public void setStartDate(Calendar in_startDate) Modified: trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/schedule/SchedulePeriodic.java =================================================================== --- trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/schedule/SchedulePeriodic.java 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/api/schedule/SchedulePeriodic.java 2006-01-03 13:13:53 UTC (rev 1976) @@ -36,7 +36,7 @@ /** day of week exceptions - * when <b>execute</b> or <b>schedule next</b>, we should verify + * when <b>execute</b>, we should verify * we are not in this list. * Contains Calendar.SATURDAY and Calendar.SUNDAY by default. */ Added: trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/distribute/DistributeByFileCopy.java =================================================================== --- trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/distribute/DistributeByFileCopy.java 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/distribute/DistributeByFileCopy.java 2006-01-03 13:13:53 UTC (rev 1976) @@ -0,0 +1,149 @@ +/* + * JBoss, Home of Professional Open Source + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ + +package org.jboss.reporting.server.distribute; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Calendar; +import java.util.Iterator; + +import javax.activation.DataHandler; +import javax.activation.FileDataSource; +import javax.mail.Message; +import javax.mail.Multipart; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeMultipart; +import javax.management.ObjectName; +import javax.naming.InitialContext; + +import org.jboss.logging.Logger; +import org.jboss.mx.util.MBeanProxyExt; +import org.jboss.mx.util.ObjectNameFactory; +import org.jboss.reporting.api.ReportTask; +import org.jboss.reporting.api.output.OutputFormat; +import org.jboss.system.ServiceMBeanSupport; +import org.jboss.system.server.ServerConfig; + +/** + * + * @author noe...@jb... + * @version $Revision: 1.0 $ + * + * + * @jmx:mbean + * description="Distribute a report by copy into a dir" + * name="reporting:service=Distribute,type=ByFileCopy" + * extends="org.jboss.system.ServiceMBean" + * + */ +public class DistributeByFileCopy extends ServiceMBeanSupport +implements DistributeByFileCopyMBean, DistributeModule +{ + // provide logging + private final Logger log = Logger.getLogger(DistributeByFileCopy.class); + // MBean name + public static final ObjectName OBJECT_NAME = ObjectNameFactory.create("reporting:service=Distribute,type=ByFileCopy"); + + // tmp dir name to work + private final String TEMP_DIR_NAME = "distribute-byMail"; + + // server config MBean + ServerConfig serverConfig = null; + + // base directory + private String baseDirectoryName; + private File baseDirectory; + + + + /** @jmx:managed-attribute */ + public String getBaseDirectoryName() + { + return baseDirectoryName; + } + /** @jmx:managed-attribute */ + public void setBaseDirectoryName(String baseDirectoryName) + { + this.baseDirectoryName = baseDirectoryName; + } + + + /** @jmx:managed-operation */ + public void distribute(ReportTask in_reportTask, Object in_result) throws Exception + { + log.info("Recieved reportTask" +in_reportTask); + String distributePathName=""; + File distributePath; + String fileSeparator = System.getProperty("file.separator"); + String fileName=""; + + org.jboss.reporting.api.distribute.DistributeByFileCopy distribute = (org.jboss.reporting.api.distribute.DistributeByFileCopy)in_reportTask.getDistribute(); + + distributePathName = distribute.getPathName(); +// distributePathName = distribute.getPathName().replaceAll("\\", fileSeparator).replaceAll("/", fileSeparator); +// distributePathName = distribute.getPathName().replaceAll("//", "/").replaceAll("\\", "\\").replaceAll("\\", fileSeparator).replaceAll("/", fileSeparator); + distributePath = new File(baseDirectory, distributePathName); + if (distributePath.exists() == false) distributePath.mkdir(); + + fileName = distribute.getFileName(); + if (fileName == null || fileName.length() == 0) + { + fileName = in_reportTask.getReport().getJndi_name() + "_" + System.currentTimeMillis() + OutputFormat.getFileExtension(in_reportTask.getOutputFormat()); + } + else + { + fileName = fileName + "_" + System.currentTimeMillis() + OutputFormat.getFileExtension(in_reportTask.getOutputFormat()); + } + + + try + { + // write result into a file + File file = new File(distributePath,fileName); + BufferedInputStream in = new BufferedInputStream((InputStream)in_result); + OutputStream out = new BufferedOutputStream( new FileOutputStream(file)); + int b=0; + while ( (b=in.read()) >= 0) out.write( b ); + in.close(); + out.close(); + + log.debug("File " + file.getAbsolutePath() + " created. ReportTask ID = " + in_reportTask.getID()); + } + catch (Exception e) + { + log.error(e); + throw e; + } + } + + + + + + /** + * Configure required properties from server config info + */ + public void startService() throws Exception + { + serverConfig = (ServerConfig) + MBeanProxyExt.create(ServerConfig.class, + "jboss.system:type=ServerConfig", server); + baseDirectory = new File(serverConfig.getServerHomeDir(),baseDirectoryName); + if (baseDirectory.exists() == false) baseDirectory.mkdir(); + } + + +} \ No newline at end of file Modified: trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/engine/ReportEngine.java =================================================================== --- trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/engine/ReportEngine.java 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/engine/ReportEngine.java 2006-01-03 13:13:53 UTC (rev 1976) @@ -23,7 +23,7 @@ import org.jboss.system.ServiceMBeanSupport; import org.jboss.reporting.api.Report; import org.jboss.reporting.api.ReportTask; -import org.jboss.reporting.server.metadata.ReportMetaData; +import org.jboss.reporting.api.metadata.ReportMetaData; import org.jboss.reporting.server.repository.RepositoryEntry; import org.jboss.reporting.server.repository.RepositoryServiceMBean; Deleted: trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/metadata/ReportMetaData.java =================================================================== --- trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/metadata/ReportMetaData.java 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/metadata/ReportMetaData.java 2006-01-03 13:13:53 UTC (rev 1976) @@ -1,269 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * - * Distributable under LGPL license. - * See terms of license at gnu.org. - */ -package org.jboss.reporting.server.metadata; - -import java.net.URLClassLoader; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import javax.management.MalformedObjectNameException; - -import org.jboss.deployment.DeploymentException; -import org.jboss.logging.Logger; -import org.jboss.metadata.MetaData; -import org.jboss.metadata.SecurityRoleMetaData; -import org.jboss.mx.loading.LoaderRepositoryFactory; -import org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfig; -import org.jboss.mx.util.ObjectNameFactory; -import org.w3c.dom.Element; - -/** A representation of the jboss-report.xml deployment - * descriptors. - * - * @see XmlLoadable - * - * @author <a href="mailto:noe...@jb...">Noel Rocher</a> - * @version $Revision: 1.0 $ - */ -public class ReportMetaData extends MetaData -{ - private static Logger log = Logger.getLogger(ReportMetaData.class); - - /** The JNDI name of the security domain implementation */ - private String securityDomain; - /** security-constraint */ - private ArrayList securityContraints = new ArrayList(); - /** The security-roles */ - private HashMap securityRoles = new HashMap(); - /** security-role-refs */ - private ArrayList securityRoleReferences = new ArrayList(); - - - /** The web context class loader used to create the java:comp context */ - private ClassLoader encLoader; - /** The web context class loader, used to create the ws4ee service endpoint */ - private ClassLoader cxtLoader; - - /** The ClassLoader to load additional resources */ - private URLClassLoader resourceCl; - - /** Set the ClassLoader to load additional resources */ - public void setResourceClassLoader(URLClassLoader resourceCl) - { - this.resourceCl = resourceCl; - } - - - /** Return the optional security-domain element. - @return The jndiName of the security manager implementation that is - responsible for security of the reports. May be null if - there was no security-domain specified in the jboss-report.xml - descriptor. - */ - public String getSecurityDomain() - { - return securityDomain; - } - - /** Set the security domain for this web application - */ - public void setSecurityDomain(String securityDomain) - { - this.securityDomain = securityDomain; - } - - /** Get the security-constraint settings - */ - public Iterator getSecurityContraints() - { - return securityContraints.iterator(); - } - - /** Get the optional map of security role/user mapping. - */ - public Map getSecurityRoles() - { - return new HashMap(securityRoles); - } - - - /** - * Merge the security role/principal mapping defined in jboss-web.xml - * with the one defined at jboss-app.xml. - */ - public void mergeSecurityRoles(Map applRoles) - { - Iterator it = applRoles.entrySet().iterator(); - while (it.hasNext()) - { - Map.Entry entry = (Map.Entry) it.next(); - String roleName = (String)entry.getKey(); - SecurityRoleMetaData appRole = (SecurityRoleMetaData)entry.getValue(); - SecurityRoleMetaData srMetaData = (SecurityRoleMetaData)securityRoles.get(roleName); - if (srMetaData != null) - { - Set principalNames = appRole.getPrincipals(); - srMetaData.addPrincipalNames(principalNames); - } - else - { - securityRoles.put(roleName, entry.getValue()); - } - } - } - - - public ClassLoader getENCLoader() - { - return encLoader; - } - public void setENCLoader(ClassLoader encLoader) - { - this.encLoader = encLoader; - } - - public ClassLoader getContextLoader() - { - return cxtLoader; - } - - /** Make sure this is called during performDeploy */ - public void setContextLoader(ClassLoader cxtLoader) - { - this.cxtLoader = cxtLoader; - } - - - public void importXml(Element element) throws DeploymentException - { - String rootTag = element.getOwnerDocument().getDocumentElement().getTagName(); - if( rootTag.equals("jboss-report") ) - { - importReportXml(element); - } - } - - /** Parse the elements of the web-app element used by the integration layer. - */ - protected void importReportXml(Element webApp) throws DeploymentException - { - - // Get the security-constraints - Iterator iterator = getChildrenByTagName(webApp, "security-constraint"); - while (iterator.hasNext()) - { - Element contraints = (Element) iterator.next(); - ReportSecurityMetaData rsmd = new ReportSecurityMetaData(); - securityContraints.add(rsmd); - // Process the report-resource-collections - Iterator iter2 = getChildrenByTagName(contraints, "report-resource-collection"); - while( iter2.hasNext() ) - { - Element wrcElement = (Element) iter2.next(); - Element wrName = getUniqueChild(wrcElement, "report-resource-name"); - String name = getElementContent(wrName); - ReportSecurityMetaData.ReportResourceCollection rrc = rsmd.addReportResource(name); - Iterator iter21 = getChildrenByTagName(wrcElement, "url-pattern"); - while( iter21.hasNext() ) - { - Element urlPattern = (Element) iter21.next(); - String pattern = getElementContent(urlPattern); - rrc.addPattern(pattern); - } - - Iterator iter22 = getChildrenByTagName(wrcElement, "http-method"); - while( iter22.hasNext() ) - { - Element httpMethod = (Element) iter22.next(); - String method = getElementContent(httpMethod); - rrc.addHttpMethod(method); - } - } - - // Process the auth-constraints - Element authContraint = getOptionalChild(contraints, "auth-constraint"); - if( authContraint != null ) - { - Iterator iter3 = getChildrenByTagName(authContraint, "role-name"); - while( iter3.hasNext() ) - { - Element roleName = (Element) iter3.next(); - String name = getElementContent(roleName); - rsmd.addRole(name); - } - if( rsmd.getRoles().size() == 0 ) - rsmd.setExcluded(true); - } - else - { - rsmd.setUnchecked(true); - } - - // Process the user-data-constraint - Element userData = getOptionalChild(contraints, "user-data-constraint"); - if( userData != null ) - { - Element transport = getUniqueChild(userData, "transport-guarantee"); - String type = getElementContent(transport); - rsmd.setTransportGuarantee(type); - } - } - - // set the security roles (optional) - iterator = getChildrenByTagName(webApp, "security-role"); - while (iterator.hasNext()) - { - Element securityRole = (Element) iterator.next(); - String roleName = getElementContent(getUniqueChild(securityRole, "role-name")); - securityRoles.put(roleName, new SecurityRoleMetaData(roleName)); - } - - - } - - /** Parse the elements of the jboss-web element used by the integration layer. - */ - protected void importJBossWebXml(Element jbossWeb) throws DeploymentException - { - - // Parse the jboss-web/security-domain element - Element securityDomainElement = getOptionalChild(jbossWeb, "security-domain"); - if( securityDomainElement != null ) - { - securityDomain = getElementContent(securityDomainElement); - } - - - - // set the security roles (optional) - Iterator iterator = getChildrenByTagName(jbossWeb, "security-role"); - while (iterator.hasNext()) - { - Element securityRole = (Element) iterator.next(); - String roleName = getElementContent(getUniqueChild(securityRole, "role-name")); - SecurityRoleMetaData securityRoleMetaData = (SecurityRoleMetaData)securityRoles.get(roleName); - if (securityRoleMetaData == null) - throw new DeploymentException("Security role '" + roleName + "' defined in jboss-web.xml" + - "is not defined in web.xml"); - - Iterator itPrincipalNames = getChildrenByTagName(securityRole, "principal-name"); - while (itPrincipalNames.hasNext()) - { - String principalName = getElementContent((Element) itPrincipalNames.next()); - securityRoleMetaData.addPrincipalName(principalName); - } - } - - - - - - } -} Added: trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/metadata/ReportsMetaData.java =================================================================== --- trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/metadata/ReportsMetaData.java 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/metadata/ReportsMetaData.java 2006-01-03 13:13:53 UTC (rev 1976) @@ -0,0 +1,40 @@ +/* + * JBoss, Home of Professional Open Source + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package org.jboss.reporting.server.metadata; + +import java.io.Serializable; +import java.util.Map; +import org.jboss.reporting.api.metadata.ReportMetaData; + +/** + * @author <a href="mailto:noe...@jb...">Noel Rocher</a> + * + */ +public class ReportsMetaData implements Serializable +{ + + private static final long serialVersionUID = 1L; + private ReportMetaData defaultMetaData=null; + private Map reports=null; + public ReportMetaData getDefaultMetaData() + { + return defaultMetaData; + } + public void setDefaultMetaData(ReportMetaData defaultMetaData) + { + this.defaultMetaData = defaultMetaData; + } + public Map getReports() + { + return reports; + } + public void setReports(Map reports) + { + this.reports = reports; + } + +} Modified: trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/repository/RepositoryEntry.java =================================================================== --- trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/repository/RepositoryEntry.java 2006-01-03 12:46:31 UTC (rev 1975) +++ trunk/labs/reportingservices/reporting-services/src/main/org/jboss/reporting/server/repository/Rep... [truncated message content] |
From: <jbo...@li...> - 2006-01-03 12:46:38
|
Author: rem...@jb... Date: 2006-01-03 07:46:31 -0500 (Tue, 03 Jan 2006) New Revision: 1975 Modified: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/realm/RealmBase.java Log: - Another change for * ... Modified: trunk/labs/jbossweb/src/share/classes/org/apache/catalina/realm/RealmBase.java =================================================================== --- trunk/labs/jbossweb/src/share/classes/org/apache/catalina/realm/RealmBase.java 2006-01-03 10:57:42 UTC (rev 1974) +++ trunk/labs/jbossweb/src/share/classes/org/apache/catalina/realm/RealmBase.java 2006-01-03 12:46:31 UTC (rev 1975) @@ -60,7 +60,7 @@ * location) are identical to those currently supported by Tomcat 3.X. * * @author Craig R. McClanahan - * @version $Revision: 355701 $ $Date: 2005-12-10 03:53:21 +0100 (sam., 10 déc. 2005) $ + * @version $Revision: 365363 $ $Date: 2006-01-02 16:46:04 +0100 (lun., 02 janv. 2006) $ */ public abstract class RealmBase @@ -728,13 +728,18 @@ boolean denyfromall = false; for(int i=0; i < constraints.length; i++) { SecurityConstraint constraint = constraints[i]; - String roles[] = constraint.findAuthRoles(); + + String roles[]; + if (constraint.getAllRoles()) { + // * means all roles defined in web.xml + roles = request.getContext().findSecurityRoles(); + } else { + roles = constraint.findAuthRoles(); + } + if (roles == null) roles = new String[0]; - if (constraint.getAllRoles() && !denyfromall) - status = true; - if (log.isDebugEnabled()) log.debug(" Checking roles " + principal); |
Author: mic...@jb... Date: 2006-01-03 05:57:42 -0500 (Tue, 03 Jan 2006) New Revision: 1974 Added: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/PersistentCase.java trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RulePersistenceTest.java Removed: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/PersistCase.java trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RepositoryImplTest.java Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/MetaData.java trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleDef.java trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetDef.java trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/Tag.java trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/db/RepositoryImpl.java trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleDef.hbm.xml trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetDef.hbm.xml trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/Tag.hbm.xml trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RuleSetPersistenceTest.java Log: Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/MetaData.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/MetaData.java 2006-01-03 10:33:04 UTC (rev 1973) +++ trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/MetaData.java 2006-01-03 10:57:42 UTC (rev 1974) @@ -130,4 +130,22 @@ this.title = title; } + public MetaData copy(){ + MetaData copy = new MetaData(); + copy.contributor = this.contributor; + copy.coverage = this.coverage; + copy.creator = this.creator; + copy.dateCreated = this.dateCreated; + copy.description = this.description; + copy.format = this.format; + copy.language = this.language; + copy.publisher = this.publisher; + copy.relation = this.relation; + copy.rights = this.rights; + copy.source = this.source; + copy.subject = this.subject; + copy.title = this.title; + return copy; + } + } Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleDef.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleDef.java 2006-01-03 10:33:04 UTC (rev 1973) +++ trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleDef.java 2006-01-03 10:57:42 UTC (rev 1974) @@ -150,7 +150,7 @@ return this; } - /** return a list of tags */ + /** return a list of tags as Strings */ public String[] listTags() { String[] tagList = new String[tags.size()]; @@ -163,5 +163,55 @@ return tagList; } + public RuleDef createNewVersion() { +// if (this.checkedOut) { +// throw new RuleRepositoryLockException("Rule is checked out by " + this.checkedOutBy); +// } + RuleDef newVersion = new RuleDef(); + newVersion.content = this.content; + this.head = false; + newVersion.head = true; + newVersion.documentation = documentation; + newVersion.effectiveDate = this.effectiveDate; + newVersion.expiryDate = this.expiryDate; + if (this.metaData != null) { + newVersion.metaData = this.metaData.copy(); + } + newVersion.name = this.name; + newVersion.status = ""; + newVersion.tags = this.copyTags(); + newVersion.versionNumber = this.versionNumber + 1; + return newVersion; + } + + + + private Set copyTags() { + Set newTags = new HashSet(); + for ( Iterator iter = this.tags.iterator(); iter.hasNext(); ) { + Tag tag = (Tag) iter.next(); + newTags.add(tag); + } + return newTags; + } + + + +// public boolean equals(Object arg){ +// if (arg.getClass() != this.getClass()) return false; +// RuleDef other = (RuleDef) arg; +// return (other.versionNumber == this.versionNumber +// && other.name.equals(this.name)); +// } +// +// +// +// public int hashCode(){ +// int result = this.name.hashCode(); +// return new Long(versionNumber).hashCode() + 27 * result; +// } + + + } Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetDef.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetDef.java 2006-01-03 10:33:04 UTC (rev 1973) +++ trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/RuleSetDef.java 2006-01-03 10:57:42 UTC (rev 1974) @@ -1,5 +1,6 @@ package org.drools.repository; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -8,41 +9,40 @@ private String name; private MetaData metaData; - private List rules; - private long versionNumber; - private Set tags; + private Set rules; + private Set tags; public RuleSetDef(String name, MetaData meta) { this.name = name; this.metaData = meta; - this.versionNumber = 1; this.tags = new HashSet(); + this.rules = new HashSet(); } /** * This is not for public consumption. Use the * proper constructor instead. */ - public RuleSetDef() { + RuleSetDef() { } + public RuleSetDef addRule(RuleDef rule) { + this.rules.add(rule); + return this; + } - public long getVersionNumber(){ - return versionNumber; - } - private void setVersionNumber(long versionNumber){ - this.versionNumber = versionNumber; - } + + public MetaData getMetaData(){ return metaData; } public void setMetaData(MetaData metaData){ this.metaData = metaData; } - public List getRules(){ + public Set getRules(){ return rules; } - public void setRules(List rules){ + private void setRules(Set rules){ this.rules = rules; } public String getName(){ Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/Tag.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/Tag.java 2006-01-03 10:33:04 UTC (rev 1973) +++ trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/Tag.java 2006-01-03 10:57:42 UTC (rev 1974) @@ -14,7 +14,16 @@ public class Tag implements Serializable { private String tag; + private Long id; + public Long getId(){ + return id; + } + + public void setId(Long id){ + this.id = id; + } + public Tag(String tag) { this.tag = tag; } Modified: trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/db/RepositoryImpl.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/db/RepositoryImpl.java 2006-01-03 10:33:04 UTC (rev 1973) +++ trunk/labs/jbossrules/drools-repository/src/main/java/org/drools/repository/db/RepositoryImpl.java 2006-01-03 10:57:42 UTC (rev 1974) @@ -15,29 +15,28 @@ public class RepositoryImpl implements Repository { - public RuleDef addNewRule(RuleDef newRule) { + /** This will simply save the current version of the rule */ + public RuleDef saveOrUpdateRule(RuleDef newRule) { Session session = getSession(); session.beginTransaction(); - Set tags = newRule.getTags(); - saveTags( session, - tags ); - - session.save(newRule); + session.saveOrUpdate(newRule); session.getTransaction().commit(); + //session.close(); return newRule; } + + /** This will simply save the current version of the rule */ + public RuleDef merge(RuleDef newRule) { + Session session = getSession(); + session.beginTransaction(); + session.merge(newRule); - private void saveTags(Session session, - Set tags){ - for ( Iterator iter = tags.iterator(); iter.hasNext(); ) { - Tag tag = (Tag) iter.next(); - session.saveOrUpdate(tag); - } - } - + session.getTransaction().commit(); + return newRule; + } public List listAllRules(boolean head) { Session session = getSession(); @@ -50,7 +49,7 @@ return results; } - public RuleDef retrieveRule(String ruleName, long versionNumber) { + public RuleDef loadRule(String ruleName, long versionNumber) { Session session = getSession(); session.beginTransaction(); @@ -62,6 +61,17 @@ return result; } + public List listRuleHistory(String ruleName) { + Session session = getSession(); + session.beginTransaction(); + + List result = (List) session.createQuery("from RuleDef where name = :name order by versionNumber") + .setString("name", ruleName).list(); + + session.getTransaction().commit(); + return result; + } + public List findRulesByTag(String tag) { Session session = getSession(); session.beginTransaction(); @@ -74,22 +84,20 @@ - public RuleSetDef saveRuleSet(RuleSetDef ruleSet) { + public RuleSetDef saveOrUpdateRuleSet(RuleSetDef ruleSet) { Session session = getSession(); session.beginTransaction(); - saveTags(session, ruleSet.getTags()); session.saveOrUpdate(ruleSet); session.getTransaction().commit(); return ruleSet; } - public RuleSetDef retrieveRuleSet(String ruleSetName, long versionNumber) { + public RuleSetDef loadRuleSet(String ruleSetName) { Session session = getSession(); session.beginTransaction(); RuleSetDef def = (RuleSetDef) - session.createQuery("from RuleSetDef where name = :name and versionNumber = :versionNumber") - .setString("name", ruleSetName ) - .setLong("versionNumber", versionNumber).uniqueResult(); + session.createQuery("from RuleSetDef where name = :name") + .setString("name", ruleSetName ).uniqueResult(); session.getTransaction().commit(); return def; } Modified: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleDef.hbm.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleDef.hbm.xml 2006-01-03 10:33:04 UTC (rev 1973) +++ trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleDef.hbm.xml 2006-01-03 10:57:42 UTC (rev 1974) @@ -10,10 +10,10 @@ <id name="id" column="RULE_ID"> <generator class="native"/> </id> -<!-- <natural-id> --> + <natural-id> <property name="name"/> <property name="versionNumber" /> -<!-- </natural-id> --> + </natural-id> <property name="content" /> <property name="status" /> @@ -27,10 +27,26 @@ <property name="deleted" /> <!-- tags to aid with searching and management of rules --> - <set name="tags" table="RULE_TAGS" lazy="false"> + <set name="tags" table="RULE_TAGS" lazy="false" cascade="all"> <key column="RULE_ID"/> - <many-to-many column="TAG_ID" class="org.drools.repository.Tag"/> - </set> + <one-to-many class="org.drools.repository.Tag" /> + </set> + + <component name="metaData"> + <property name="title" /> + <property name="creator" /> + <property name="subject" /> + <property name="description" /> + <property name="publisher" /> + <property name="contributor" /> + <property name="dateCreated" /> + <property name="format" /> + <property name="source" /> + <property name="language" /> + <property name="relation" /> + <property name="coverage" /> + <property name="rights" /> + </component> </class> Modified: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetDef.hbm.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetDef.hbm.xml 2006-01-03 10:33:04 UTC (rev 1973) +++ trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/RuleSetDef.hbm.xml 2006-01-03 10:57:42 UTC (rev 1974) @@ -12,8 +12,7 @@ </id> <natural-id> - <property name="name" /> - <property name="versionNumber" /> + <property name="name" /> </natural-id> <component name="metaData"> @@ -34,11 +33,16 @@ <!-- tags to aid with searching and management of rules --> - <set name="tags" table="RULESET_TAGS" lazy="false"> + <set name="tags" table="RULESET_TAGS" lazy="false" cascade="all"> <key column="RULESET_ID"/> - <many-to-many column="TAG_ID" class="org.drools.repository.Tag"/> - </set> - + <one-to-many class="org.drools.repository.Tag"/> + </set> + + <set name="rules" table="RULESET_RULES" lazy="false" cascade="all"> + <key column="RULESET_ID"/> + <one-to-many class="org.drools.repository.RuleDef"/> + </set> + </class> </hibernate-mapping> \ No newline at end of file Modified: trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/Tag.hbm.xml =================================================================== --- trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/Tag.hbm.xml 2006-01-03 10:33:04 UTC (rev 1973) +++ trunk/labs/jbossrules/drools-repository/src/main/resources/org/drools/repository/Tag.hbm.xml 2006-01-03 10:57:42 UTC (rev 1974) @@ -7,7 +7,10 @@ <hibernate-mapping> <class name="org.drools.repository.Tag" table="DROOLS_TAGS"> - <id name="tag" column="TAG_VALUE"/> + <id name="id" column="TAG_ID"> + <generator class="native" /> + </id> + <property name="tag" column="TAG_VALUE"/> </class> </hibernate-mapping> \ No newline at end of file Deleted: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/PersistCase.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/PersistCase.java 2006-01-03 10:33:04 UTC (rev 1973) +++ trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/PersistCase.java 2006-01-03 10:57:42 UTC (rev 1974) @@ -1,14 +0,0 @@ -package org.drools.repository.db; - -import junit.framework.TestCase; - -public class PersistCase extends TestCase { - - - public RepositoryImpl getRepo() { - RepositoryImpl repo = new RepositoryImpl(); - return repo; - } - - -} Added: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/PersistentCase.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/PersistentCase.java 2006-01-03 10:33:04 UTC (rev 1973) +++ trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/PersistentCase.java 2006-01-03 10:57:42 UTC (rev 1974) @@ -0,0 +1,19 @@ +package org.drools.repository.db; + +import junit.framework.TestCase; + +public class PersistentCase extends TestCase { + + public void testDummy() { + //I need this as I often run all tests from within eclipse + getRepo(); + } + + + public RepositoryImpl getRepo() { + RepositoryImpl repo = new RepositoryImpl(); + return repo; + } + + +} Property changes on: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/PersistentCase.java ___________________________________________________________________ Name: svn:eol-style + native Deleted: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RepositoryImplTest.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RepositoryImplTest.java 2006-01-03 10:33:04 UTC (rev 1973) +++ trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RepositoryImplTest.java 2006-01-03 10:57:42 UTC (rev 1974) @@ -1,53 +0,0 @@ -package org.drools.repository.db; - -import java.util.List; -import java.util.Set; - -import junit.framework.TestCase; - -import org.drools.repository.RuleDef; - -public class RepositoryImplTest extends PersistCase { - - public void testStoreNewRuleDef() throws Exception { - RepositoryImpl repo = getRepo(); - RuleDef def = repo.addNewRule(new RuleDef("myRule", "A rule")); - assertNotNull(def.getId()); - def = repo.addNewRule(new RuleDef("myRule2", "A rule2")); - def = new RuleDef("myRule3", "A rule3"); - def.addTag("tag1").addTag("tag2").addTag("HR"); - def = repo.addNewRule(def); - assertNotNull(def.getId()); - } - - public void testListRules() { - RepositoryImpl repo = getRepo(); - repo.addNewRule(new RuleDef("blah", "blah")); - List list = repo.listAllRules(true); - assertTrue(list.size() > 0); - } - - public void testRetreieveRuleWithTags() { - RepositoryImpl repo = getRepo(); - RuleDef newRule = new RuleDef("my rule", "content"); - newRule.addTag("HR").addTag("SALARY"); - repo.addNewRule(newRule); - - RuleDef rule = repo.retrieveRule("my rule", 1); - assertNotNull(rule); - assertEquals("my rule", rule.getName()); - - Set tags = rule.getTags(); - assertEquals(2, tags.size()); - String[] tagList = rule.listTags(); - assertTrue(tagList[0].equals("HR") || tagList[0].equals("SALARY")); - - List rules = repo.findRulesByTag("HR"); - assertTrue(rules.size() > 0); - - } - - - - -} Added: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RulePersistenceTest.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RulePersistenceTest.java 2006-01-03 10:33:04 UTC (rev 1973) +++ trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RulePersistenceTest.java 2006-01-03 10:57:42 UTC (rev 1974) @@ -0,0 +1,82 @@ +package org.drools.repository.db; + +import java.util.List; +import java.util.Set; + +import org.drools.repository.MetaData; +import org.drools.repository.RuleDef; + +public class RulePersistenceTest extends PersistentCase { + + public void testStoreNewRuleDef() throws Exception { + RepositoryImpl repo = getRepo(); + RuleDef def = repo.saveOrUpdateRule(new RuleDef("myRule", "A rule")); + assertNotNull(def.getId()); + def = repo.saveOrUpdateRule(new RuleDef("myRule2", "A rule2")); + def = new RuleDef("myRule3", "A rule3"); + def.addTag("tag1").addTag("tag2").addTag("HR"); + def = repo.saveOrUpdateRule(def); + assertNotNull(def.getId()); + } + + public void testListRules() { + RepositoryImpl repo = getRepo(); + repo.saveOrUpdateRule(new RuleDef("blah", "blah")); + List list = repo.listAllRules(true); + assertTrue(list.size() > 0); + } + + public void testRetreieveRuleWithTags() { + RepositoryImpl repo = getRepo(); + RuleDef newRule = new RuleDef("my rule", "content"); + newRule.addTag("HR").addTag("SALARY"); + repo.saveOrUpdateRule(newRule); + + RuleDef rule = repo.loadRule("my rule", 1); + assertNotNull(rule); + assertEquals("my rule", rule.getName()); + + Set tags = rule.getTags(); + assertEquals(2, tags.size()); + String[] tagList = rule.listTags(); + assertTrue(tagList[0].equals("HR") || tagList[0].equals("SALARY")); + + List rules = repo.findRulesByTag("HR"); + assertTrue(rules.size() > 0); + + } + + public void testNewVersionOfRule() { + RepositoryImpl repo = getRepo(); + + RuleDef rule1 = new RuleDef("newVersionTest", "XXX"); + MetaData meta = new MetaData(); + meta.setCreator("Peter Jackson"); + rule1.setMetaData(meta); + + repo.saveOrUpdateRule(rule1); + + //?????repo.saveOrUpdateRule(rule1); + //repo.merge(rule1); + + RuleDef rule2 = rule1.createNewVersion(); + rule2.addTag("PJ"); + + repo.saveOrUpdateRule(rule2); + + + RuleDef latest = repo.loadRule("newVersionTest", 2); + assertEquals("Peter Jackson", latest.getMetaData().getCreator()); + + List ruleHistory = repo.listRuleHistory("newVersionTest"); + assertEquals(2, ruleHistory.size()); + assertEquals(1, ((RuleDef) ruleHistory.get(0)).getVersionNumber()); + assertEquals(2, ((RuleDef) ruleHistory.get(1)).getVersionNumber()); + } + + + + + + +} Property changes on: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RulePersistenceTest.java ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RuleSetPersistenceTest.java =================================================================== --- trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RuleSetPersistenceTest.java 2006-01-03 10:33:04 UTC (rev 1973) +++ trunk/labs/jbossrules/drools-repository/src/test/java/org/drools/repository/db/RuleSetPersistenceTest.java 2006-01-03 10:57:42 UTC (rev 1974) @@ -1,14 +1,11 @@ package org.drools.repository.db; import org.drools.repository.MetaData; +import org.drools.repository.RuleDef; import org.drools.repository.RuleSetDef; +public class RuleSetPersistenceTest extends PersistentCase { - -import junit.framework.TestCase; - -public class RuleSetPersistenceTest extends PersistCase { - public void testLoadSaveRuleSet() { MetaData meta = new MetaData(); meta.setCreator("Michael Neale"); @@ -17,13 +14,31 @@ RuleSetDef def = new RuleSetDef("my ruleset", meta); def.addTag("ME"); RepositoryImpl repo = getRepo(); - repo.saveRuleSet(def); + repo.saveOrUpdateRuleSet(def); - RuleSetDef def2 = repo.retrieveRuleSet("my ruleset", 1); + RuleSetDef def2 = repo.loadRuleSet("my ruleset"); assertEquals("my ruleset", def2.getName()); assertEquals("Michael Neale", def2.getMetaData().getCreator()); assertEquals(1, def2.getTags().size()); } + public void testRuleSetWithRules() { + MetaData meta = new MetaData(); + meta.setCreator("Michael Neale"); + RuleSetDef ruleSet = new RuleSetDef("Uber 1", meta); + ruleSet.addRule(new RuleDef("UBER1Rule", "This is a rule")); + RuleDef def = new RuleDef("UBER2Rule", "this is also a rule"); + def.addTag("HR").addTag("BUS"); + ruleSet.addRule(def); + ruleSet.addTag("HR"); + + RepositoryImpl repo = getRepo(); + repo.saveOrUpdateRuleSet(ruleSet); + + RuleSetDef loaded = repo.loadRuleSet("Uber 1"); + assertEquals(2, loaded.getRules().size()); + + } + } |