Seam SVN: r13324 - sandbox/encore/src/test/java/org/jboss/encore/grammar/java.
by seam-commits@lists.jboss.org
Author: lincolnthree
Date: 2010-06-30 18:07:23 -0400 (Wed, 30 Jun 2010)
New Revision: 13324
Modified:
sandbox/encore/src/test/java/org/jboss/encore/grammar/java/JavaParserTest.java
Log:
Working on tree manipulation.
Modified: sandbox/encore/src/test/java/org/jboss/encore/grammar/java/JavaParserTest.java
===================================================================
--- sandbox/encore/src/test/java/org/jboss/encore/grammar/java/JavaParserTest.java 2010-06-30 11:04:08 UTC (rev 13323)
+++ sandbox/encore/src/test/java/org/jboss/encore/grammar/java/JavaParserTest.java 2010-06-30 22:07:23 UTC (rev 13324)
@@ -1,21 +1,36 @@
package org.jboss.encore.grammar.java;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTVisitor;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.ImportDeclaration;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.junit.Before;
import org.junit.Test;
public class JavaParserTest
{
+ private InputStream stream;
+
+ @Before
+ public void reset()
+ {
+ stream = JavaParserTest.class
+ .getResourceAsStream("/org/jboss/encore/grammar/java/MockClassFile.java");
+ }
+
@Test
public void testParse() throws Exception
{
- InputStream stream = JavaParserTest.class
- .getResourceAsStream("/org/jboss/encore/grammar/java/MockClassFile.java");
CompilationUnit unit = JavaParser.parse(stream);
@SuppressWarnings("unchecked")
@@ -23,4 +38,47 @@
assertEquals("java.net.URL", imports.get(0).getName().getFullyQualifiedName());
}
+
+ @Test
+ public void testAddMethod() throws Exception
+ {
+ CompilationUnit unit = JavaParser.parse(stream);
+ MethodFinderVisitor visitor = new MethodFinderVisitor();
+ unit.accept(visitor);
+ List<MethodDeclaration> methods = visitor.getMethods();
+ TypeDeclaration parent = visitor.getParent();
+ MethodDeclaration newMethod = parent.getAST().newMethodDeclaration();
+ newMethod.setName(parent.getAST().newSimpleName("addedMethod"));
+ newMethod.setConstructor(false);
+ newMethod.setReturnType2(null);
+
+ // http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclipse.jdt.doc.isv...
+ methods = visitor.getMethods();
+
+ assertTrue(methods.contains(newMethod));
+ }
+
+ public class MethodFinderVisitor extends ASTVisitor
+ {
+ private final List<MethodDeclaration> methods = new ArrayList<MethodDeclaration>();
+ private ASTNode parent;
+
+ @Override
+ public boolean visit(final TypeDeclaration node)
+ {
+ parent = node;
+ methods.addAll(Arrays.asList(node.getMethods()));
+ return super.visit(node);
+ }
+
+ public List<MethodDeclaration> getMethods()
+ {
+ return methods;
+ }
+
+ public TypeDeclaration getParent()
+ {
+ return (TypeDeclaration) parent;
+ }
+ }
}
14 years, 4 months
Seam SVN: r13323 - branches/community/Seam_2_2/seam-gen/view/stylesheet.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-06-30 07:04:08 -0400 (Wed, 30 Jun 2010)
New Revision: 13323
Modified:
branches/community/Seam_2_2/seam-gen/view/stylesheet/theme.xcss
Log:
JBSEAM-4444 - added richfaces styles to theme.xcss
Modified: branches/community/Seam_2_2/seam-gen/view/stylesheet/theme.xcss
===================================================================
--- branches/community/Seam_2_2/seam-gen/view/stylesheet/theme.xcss 2010-06-29 19:45:10 UTC (rev 13322)
+++ branches/community/Seam_2_2/seam-gen/view/stylesheet/theme.xcss 2010-06-30 11:04:08 UTC (rev 13323)
@@ -16,7 +16,7 @@
<u:selector name="a:hover">
<u:style name="color" skin="hoverLinkColor"/>
</u:selector>
- <u:selector name="input[type=text]:not([class*=rich-combobox-button]), input[type=password], textarea, select">
+ <u:selector name="input[type=text], input[type=password], textarea, select">
<u:style name="background-color" skin="controlBackgroundColor"/>
<u:style name="color" skin="controlTextColor"/>
<u:style name="background-position" value="left top"/>
@@ -77,6 +77,34 @@
<u:selector name=".rich-table-subheadercell a:hover">
<u:style name="color" skin="calendarHolidaysTextColor"/>
</u:selector>
+ <!-- Richfaces styles -->
+ <u:selector name="input[type=text][class*=rich-combobox-button-icon]">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.images.ComboBoxArrowImage" />
+ </u:style>
+ <u:style name="background-color" value="transparent"/>
+ </u:selector>
+
+ <u:selector name="input[type=text][class~=rich-combobox-button-icon-disabled]">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.images.ComboBoxArrowImageDisable" />
+ </u:style>
+ <u:style name="background-color" value="transparent"/>
+ </u:selector>
+
+ <u:selector name="input[type=text][class*=rich-combobox-button-background]">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.images.SpinnerButtonGradient"/>
+ </u:style>
+ <u:style name="background-color" skin="tabBackgroundColor"/>
+ </u:selector>
+
+ <u:selector name="input[type=text][class~=rich-combobox-button-pressed-background]">
+ <u:style name="background-image">
+ <f:resource f:key="org.richfaces.renderkit.html.images.ComboBoxButtonPressGradient"/>
+ </u:style>
+ <u:style name="background-color" skin="tabBackgroundColor"/>
+ </u:selector>
<!-- Define static styles in the CDATA block below (you can also move this block to the top) -->
<f:verbatim><![CDATA[
]]></f:verbatim>
14 years, 4 months
Seam SVN: r13322 - in sandbox/encore/src: main/java/org/jboss/encore/mojo and 4 other directories.
by seam-commits@lists.jboss.org
Author: lincolnthree
Date: 2010-06-29 15:45:10 -0400 (Tue, 29 Jun 2010)
New Revision: 13322
Added:
sandbox/encore/src/main/java/org/jboss/encore/mojo/
sandbox/encore/src/test/resources/org/jboss/encore/
Removed:
sandbox/encore/src/main/java/org/jboss/seam/encore/mojo/
sandbox/encore/src/test/java/org/jboss/seam/encore/grammar/
sandbox/encore/src/test/resources/org/jboss/seam/
Modified:
sandbox/encore/src/main/java/org/jboss/encore/mojo/Execute.java
sandbox/encore/src/test/java/org/jboss/encore/grammar/java/JavaParserTest.java
Log:
Copied: sandbox/encore/src/main/java/org/jboss/encore/mojo (from rev 13321, sandbox/encore/src/main/java/org/jboss/seam/encore/mojo)
Modified: sandbox/encore/src/main/java/org/jboss/encore/mojo/Execute.java
===================================================================
--- sandbox/encore/src/main/java/org/jboss/seam/encore/mojo/Execute.java 2010-06-29 19:29:44 UTC (rev 13321)
+++ sandbox/encore/src/main/java/org/jboss/encore/mojo/Execute.java 2010-06-29 19:45:10 UTC (rev 13322)
@@ -1,4 +1,4 @@
-package org.jboss.seam.encore.mojo;
+package org.jboss.encore.mojo;
import java.io.File;
Modified: sandbox/encore/src/test/java/org/jboss/encore/grammar/java/JavaParserTest.java
===================================================================
--- sandbox/encore/src/test/java/org/jboss/encore/grammar/java/JavaParserTest.java 2010-06-29 19:29:44 UTC (rev 13321)
+++ sandbox/encore/src/test/java/org/jboss/encore/grammar/java/JavaParserTest.java 2010-06-29 19:45:10 UTC (rev 13322)
@@ -14,7 +14,8 @@
@Test
public void testParse() throws Exception
{
- InputStream stream = JavaParserTest.class.getResourceAsStream("/org/jboss/seam/encore/grammar/java/MockClassFile.java");
+ InputStream stream = JavaParserTest.class
+ .getResourceAsStream("/org/jboss/encore/grammar/java/MockClassFile.java");
CompilationUnit unit = JavaParser.parse(stream);
@SuppressWarnings("unchecked")
Copied: sandbox/encore/src/test/resources/org/jboss/encore (from rev 13321, sandbox/encore/src/test/resources/org/jboss/seam/encore)
14 years, 4 months
Seam SVN: r13321 - in sandbox/encore: src/main and 8 other directories.
by seam-commits@lists.jboss.org
Author: lincolnthree
Date: 2010-06-29 15:29:44 -0400 (Tue, 29 Jun 2010)
New Revision: 13321
Added:
sandbox/encore/src/main/java/org/jboss/encore/grammar/java/JavaParser.java
sandbox/encore/src/test/java/org/jboss/encore/
sandbox/encore/src/test/java/org/jboss/encore/grammar/
sandbox/encore/src/test/java/org/jboss/encore/grammar/java/
sandbox/encore/src/test/java/org/jboss/encore/grammar/java/JavaParserTest.java
sandbox/encore/src/test/resources/org/jboss/seam/encore/grammar/java/
sandbox/encore/src/test/resources/org/jboss/seam/encore/grammar/java/MockClassFile.java
Removed:
sandbox/encore/src/main/antlr3/
sandbox/encore/src/main/java/org/jboss/encore/grammar/java/Parser.java
sandbox/encore/src/test/java/org/jboss/seam/encore/grammar/xml/
sandbox/encore/src/test/resources/org/jboss/seam/encore/grammar/xml/
Modified:
sandbox/encore/pom.xml
Log:
Switched to Eclipse JDT & prototyped simple parser
Modified: sandbox/encore/pom.xml
===================================================================
--- sandbox/encore/pom.xml 2010-06-29 13:38:42 UTC (rev 13320)
+++ sandbox/encore/pom.xml 2010-06-29 19:29:44 UTC (rev 13321)
@@ -10,35 +10,24 @@
enhancement framework </description>
<dependencies>
+ <!-- Resource manipulation dependencies -->
<dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
<groupId>org.jboss.shrinkwrap</groupId>
<artifactId>shrinkwrap-api</artifactId>
<version>1.0.0-alpha-9</version>
</dependency>
-
+
+ <!-- Maven plugin dependencies -->
<dependency>
- <groupId>org.antlr</groupId>
- <artifactId>antlr</artifactId>
- <version>3.2</version>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
</dependency>
-
-
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>3.0-beta-1</version>
</dependency>
- <dependency>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-clean-plugin</artifactId>
- <version>2.1.1</version>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>junit</groupId>
@@ -82,18 +71,6 @@
<build>
<plugins>
<plugin>
- <groupId>org.antlr</groupId>
- <artifactId>antlr3-maven-plugin</artifactId>
- <version>3.2</version>
- <executions>
- <execution>
- <goals>
- <goal>antlr</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
Added: sandbox/encore/src/main/java/org/jboss/encore/grammar/java/JavaParser.java
===================================================================
--- sandbox/encore/src/main/java/org/jboss/encore/grammar/java/JavaParser.java (rev 0)
+++ sandbox/encore/src/main/java/org/jboss/encore/grammar/java/JavaParser.java 2010-06-29 19:29:44 UTC (rev 13321)
@@ -0,0 +1,44 @@
+package org.jboss.encore.grammar.java;
+
+import java.io.InputStream;
+
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.internal.compiler.util.Util;
+
+public class JavaParser
+{
+
+ /**
+ * Parses and process the java source code as a compilation unit and the
+ * result it abstract syntax tree (AST) representation and this action uses
+ * the third edition of java Language Specification, that gets the
+ * possibility to support J2SE 5 during the parsing.
+ *
+ * @param source - the java source to be parsed (i.e. the char[] contains
+ * Java source).
+ * @return CompilationUnit Abstract syntax tree representation of a java
+ * source file.
+ */
+ public static CompilationUnit parse(InputStream inputStream)
+ {
+ try
+ {
+ char[] source = Util.getInputStreamAsCharArray(inputStream, inputStream.available(), "ISO8859_1");
+
+ ASTParser parser = ASTParser.newParser(AST.JLS3);
+ parser.setSource(source);
+ parser.setKind(ASTParser.K_COMPILATION_UNIT);
+ // to get more informations from the unit.
+ parser.setResolveBindings(true);
+
+ return (CompilationUnit) parser.createAST(null);
+ }
+ catch (Exception e)
+ {
+ throw new IllegalArgumentException("InputStream must be a parsable java file: ", e);
+ }
+ }
+
+}
Deleted: sandbox/encore/src/main/java/org/jboss/encore/grammar/java/Parser.java
===================================================================
--- sandbox/encore/src/main/java/org/jboss/encore/grammar/java/Parser.java 2010-06-29 13:38:42 UTC (rev 13320)
+++ sandbox/encore/src/main/java/org/jboss/encore/grammar/java/Parser.java 2010-06-29 19:29:44 UTC (rev 13321)
@@ -1,164 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.encore.grammar.java;
-
-import java.io.File;
-
-import org.antlr.runtime.ANTLRFileStream;
-import org.antlr.runtime.CommonTokenStream;
-import org.antlr.runtime.Token;
-import org.antlr.runtime.TokenRewriteStream;
-import org.antlr.runtime.debug.BlankDebugEventListener;
-import org.antlr.runtime.tree.CommonTree;
-import org.antlr.runtime.tree.CommonTreeAdaptor;
-import org.antlr.runtime.tree.TreeAdaptor;
-import org.jboss.seam.encore.grammar.java.JavaLexer;
-import org.jboss.seam.encore.grammar.java.JavaParser;
-import org.jboss.seam.encore.grammar.java.JavaParser.compilationUnit_return;
-
-/**
- * @author <a href="mailto:lincolnbaxter@gmail.com>Lincoln Baxter, III</a>
- *
- */
-public class Parser
-{
- public static long lexerTime = 0;
- public static boolean profile = false;
-
- static JavaLexer lexer;
-
- static final TreeAdaptor adaptor = new CommonTreeAdaptor()
- {
- @Override
- public Object create(final Token payload)
- {
- return new CommonTree(payload);
- }
- };
-
- public static void main(final String[] args)
- {
- try
- {
- long start = System.currentTimeMillis();
-
- String arg = "/home/lb3/JBoss/encore/src/main/java/org/jboss/encore/grammar/java/Parser.java";
- System.out.println("Doing file: " + arg);
- File file = new File(arg);
- doFile(file); // parse it
-
- long stop = System.currentTimeMillis();
-
- System.out.println("finished parsing OK");
- if (profile)
- {
- System.out.println("num decisions " + profiler.numDecisions);
- }
- }
- catch (Exception e)
- {
- System.err.println("exception: " + e);
- e.printStackTrace(System.err); // so we can get stack trace
- }
- }
-
- // This method decides what action to take based on the type of
- // file we are looking at
- public static void doFile(final File f) throws Exception
- {
- // If this is a directory, walk each file/dir in that directory
- if (f.isDirectory())
- {
- String files[] = f.list();
- for (String file : files)
- {
- doFile(new File(f, file));
- }
- }
-
- // otherwise, if this is a java file, parse it!
- else if (((f.getName().length() > 5) && f.getName().substring(f.getName().length() - 5).equals(".java")) || f.getName().equals("input"))
- {
- System.err.println("parsing " + f.getAbsolutePath());
- parseFile(f.getAbsolutePath());
- }
- }
-
- static class CountDecisions extends BlankDebugEventListener
- {
- public int numDecisions = 0;
-
- @Override
- public void enterDecision(final int decisionNumber)
- {
- numDecisions++;
- }
- }
-
- static CountDecisions profiler = new CountDecisions();
-
- // Here's where we do the real work...
- public static void parseFile(final String f) throws Exception
- {
- try
- {
- // Create a scanner that reads from the input stream passed to us
- if (lexer == null)
- {
- lexer = new JavaLexer();
- }
- lexer.setCharStream(new ANTLRFileStream(f));
-
- CommonTokenStream tokens = new TokenRewriteStream(lexer);
- long start = System.currentTimeMillis();
- tokens.LT(1); // force load
- long stop = System.currentTimeMillis();
- lexerTime += stop - start;
-
- /*
- * long t1 = System.currentTimeMillis(); tokens.LT(1); long t2 =
- * System.currentTimeMillis();
- * System.out.println("lexing time: "+(t2-t1)+"ms");
- */
- // System.out.println(tokens);
-
- // Create a parser that reads from the scanner
- JavaParser parser = null;
- parser = new JavaParser(tokens);
-
- parser.setTreeAdaptor(adaptor);
-
- // start parsing at the compilationUnit rule
- compilationUnit_return compilationUnit = parser.compilationUnit();
-
- System.out.println("out");
- // System.err.println("finished "+f);
- }
- catch (Exception e)
- {
- System.err.println("parser exception: " + e);
- e.printStackTrace(); // so we can get stack trace
- }
- }
-
-}
Added: sandbox/encore/src/test/java/org/jboss/encore/grammar/java/JavaParserTest.java
===================================================================
--- sandbox/encore/src/test/java/org/jboss/encore/grammar/java/JavaParserTest.java (rev 0)
+++ sandbox/encore/src/test/java/org/jboss/encore/grammar/java/JavaParserTest.java 2010-06-29 19:29:44 UTC (rev 13321)
@@ -0,0 +1,25 @@
+package org.jboss.encore.grammar.java;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.InputStream;
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.ImportDeclaration;
+import org.junit.Test;
+
+public class JavaParserTest
+{
+ @Test
+ public void testParse() throws Exception
+ {
+ InputStream stream = JavaParserTest.class.getResourceAsStream("/org/jboss/seam/encore/grammar/java/MockClassFile.java");
+ CompilationUnit unit = JavaParser.parse(stream);
+
+ @SuppressWarnings("unchecked")
+ List<ImportDeclaration> imports = unit.imports();
+
+ assertEquals("java.net.URL", imports.get(0).getName().getFullyQualifiedName());
+ }
+}
Added: sandbox/encore/src/test/resources/org/jboss/seam/encore/grammar/java/MockClassFile.java
===================================================================
--- sandbox/encore/src/test/resources/org/jboss/seam/encore/grammar/java/MockClassFile.java (rev 0)
+++ sandbox/encore/src/test/resources/org/jboss/seam/encore/grammar/java/MockClassFile.java 2010-06-29 19:29:44 UTC (rev 13321)
@@ -0,0 +1,22 @@
+package org.jboss.seam.encore.grammar.java;
+
+import java.net.URL;
+
+public class MockClassFile
+{
+ private String field;
+ private URL urlField;
+
+ public MockClassFile()
+ {
+ }
+
+ public void method()
+ {
+ }
+
+ public String valueOf(URL url)
+ {
+ return url.getPath();
+ }
+}
14 years, 4 months
Seam SVN: r13320 - in modules/resteasy/trunk: api/src/main/java/org/jboss/seam/resteasy/configuration and 4 other directories.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-06-29 09:38:42 -0400 (Tue, 29 Jun 2010)
New Revision: 13320
Added:
modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/SeamResteasyBootstrap.java
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/SeamResteasyClientTest.java
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/Student.java
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/ExcludedResource.java
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/ExclusionTest.java
modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/excluded-web.xml
Modified:
modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/SeamResteasyConfiguration.java
modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/ConfigurationListener.java
modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/GenericExceptionMapper.java
modules/resteasy/trunk/pom.xml
Log:
Get configuration working again.
Modified: modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/SeamResteasyConfiguration.java
===================================================================
--- modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/SeamResteasyConfiguration.java 2010-06-29 13:07:52 UTC (rev 13319)
+++ modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/SeamResteasyConfiguration.java 2010-06-29 13:38:42 UTC (rev 13320)
@@ -10,10 +10,10 @@
/**
* Holds configuration options for seam-resteasy extension. It can be used to configure the extension via XML descriptor
* using seam-xml extension. Alternatively, you can configure the extension programatically by providing an
- * @{link @Alternative} subclass of SeamResteasyConfiguration.
+ * {@link @Alternative} subclass of SeamResteasyConfiguration.
*
* This class allows declarative exception mapping to be used. The way exceptions are treated in the application is based on
- * what @{link {@link #getExceptionMappings()} returns. Override this method or use seam-xml module to set up exception mapping
+ * what {@link #getExceptionMappings()} returns. Override this method or use seam-xml module to set up exception mapping
* declaratively.
*
* @author <a href="mailto:jharting@redhat.com">Jozef Hartinger</a>
Modified: modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/ConfigurationListener.java
===================================================================
--- modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/ConfigurationListener.java 2010-06-29 13:07:52 UTC (rev 13319)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/ConfigurationListener.java 2010-06-29 13:38:42 UTC (rev 13320)
@@ -33,7 +33,7 @@
{
if (sce.getServletContext().getAttribute(Dispatcher.class.getName()) == null)
{
- // RESTEasy has not been initialized
+ // RESTEasy has not been started yet, let's start it
bootstrapResteasy(sce.getServletContext());
}
@@ -45,16 +45,19 @@
registerProviders();
registerResources();
- unregisterResources(); // remove excluded resources
+ unregisterResources();
dispatcher.setLanguageMappings(configuration.getLanguageMappings());
registerMediaTypeMappings();
registerExceptionMappings();
}
+ /**
+ * Bootstrap RESTEasy
+ */
protected void bootstrapResteasy(ServletContext servletContext)
{
log.info("Starting RESTEasy.");
- SeamResteasyListenerBootstrap bootstrap = new SeamResteasyListenerBootstrap(servletContext);
+ SeamResteasyBootstrap bootstrap = new SeamResteasyBootstrap(servletContext);
ResteasyDeployment deployment = bootstrap.createDeployment();
deployment.start();
@@ -63,7 +66,10 @@
servletContext.setAttribute(Registry.class.getName(), deployment.getRegistry());
}
- private void registerResources()
+ /**
+ * Register resources specified in {@link SeamResteasyConfiguration}.
+ */
+ protected void registerResources()
{
for (Class<?> clazz : configuration.getResources())
{
@@ -72,7 +78,12 @@
}
}
- private void unregisterResources()
+ /**
+ * Unregister resources specified in {@link SeamResteasyConfiguration}.
+ * This method is used for explicit exclusion of resources that would be
+ * registered by auto-scanning.
+ */
+ protected void unregisterResources()
{
for (Class<?> clazz : configuration.getExcludedResources())
{
@@ -81,7 +92,10 @@
}
}
- private void registerProviders()
+ /**
+ * Register providers specified in {@link SeamResteasyConfiguration}.
+ */
+ protected void registerProviders()
{
for (Class<?> clazz : configuration.getProviders())
{
@@ -90,7 +104,10 @@
}
}
- private void registerExceptionMappings()
+ /**
+ * Register exception mappers based on {@link SeamResteasyConfiguration}.
+ */
+ protected void registerExceptionMappings()
{
for (Entry<Class<? extends Throwable>, Integer> item : configuration.getExceptionMappings().entrySet())
{
@@ -122,7 +139,10 @@
}
}
- private void registerMediaTypeMappings()
+ /**
+ * Register media mappings based on {@link SeamResteasyConfiguration}.
+ */
+ protected void registerMediaTypeMappings()
{
Map<String, MediaType> mediaTypeMappings = new HashMap<String, MediaType>();
for (Entry<String, String> entry : configuration.getMediaTypeMappings().entrySet())
Modified: modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/GenericExceptionMapper.java
===================================================================
--- modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/GenericExceptionMapper.java 2010-06-29 13:07:52 UTC (rev 13319)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/GenericExceptionMapper.java 2010-06-29 13:38:42 UTC (rev 13320)
@@ -3,6 +3,12 @@
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
+/**
+ * GenericExceptionMapper allows exceptions to be mapped to HTTP status codes declaratively (at runtime).
+ * @author Jozef Hartinger
+ *
+ * @param <T> exception
+ */
public class GenericExceptionMapper<T extends Throwable> implements ExceptionMapper<T>
{
private int status;
Added: modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/SeamResteasyBootstrap.java
===================================================================
--- modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/SeamResteasyBootstrap.java (rev 0)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/SeamResteasyBootstrap.java 2010-06-29 13:38:42 UTC (rev 13320)
@@ -0,0 +1,50 @@
+package org.jboss.seam.resteasy.configuration;
+
+import javax.servlet.FilterRegistration;
+import javax.servlet.ServletContext;
+
+import org.jboss.resteasy.plugins.server.servlet.ListenerBootstrap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author Jozef Hartinger
+ *
+ */
+public class SeamResteasyBootstrap extends ListenerBootstrap
+{
+ private FilterRegistration filter;
+ private static final Logger log = LoggerFactory.getLogger(SeamResteasyBootstrap.class);
+
+ public SeamResteasyBootstrap(ServletContext servletContext)
+ {
+ super(servletContext);
+ filter = servletContext.getFilterRegistration("Resteasy");
+ if (filter != null)
+ {
+ log.debug("Found RESTEasy filter registration.");
+ }
+ }
+
+ @Override
+ public String getInitParameter(String name)
+ {
+ return getParameter(name);
+ }
+
+ @Override
+ public String getParameter(String name)
+ {
+ String value = null;
+ if (filter != null)
+ {
+ value = filter.getInitParameter(name);
+ }
+ if (value == null)
+ {
+ value = super.getInitParameter(name);
+ }
+ return value;
+ }
+}
Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/SeamResteasyClientTest.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/SeamResteasyClientTest.java (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/SeamResteasyClientTest.java 2010-06-29 13:38:42 UTC (rev 13320)
@@ -0,0 +1,80 @@
+package org.jboss.seam.resteasy.test;
+
+import static org.testng.Assert.assertEquals;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.api.Run;
+import org.jboss.arquillian.api.RunModeType;
+import org.jboss.arquillian.testng.Arquillian;
+import org.jboss.seam.resteasy.configuration.ConfigurationListener;
+import org.jboss.seam.resteasy.configuration.GenericExceptionMapper;
+import org.jboss.seam.resteasy.configuration.SeamResteasyConfiguration;
+import org.jboss.seam.resteasy.configuration.SeamResteasyBootstrap;
+import org.jboss.seam.resteasy.test.configuration.CustomSeamResteasyConfiguration;
+import org.jboss.seam.resteasy.test.configuration.EntityNotFoundException;
+import org.jboss.seam.resteasy.test.configuration.ExcludedResource;
+import org.jboss.seam.resteasy.test.configuration.TestProvider;
+import org.jboss.seam.resteasy.test.configuration.TestResource;
+import org.jboss.seam.resteasy.validation.ValidationException;
+import org.jboss.seam.resteasy.validation.ValidationExceptionMapper;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+
+(a)Run(RunModeType.AS_CLIENT)
+public abstract class SeamResteasyClientTest extends Arquillian
+{
+ protected HttpClient client = new HttpClient();
+
+ @Deployment
+ public static WebArchive createDeployment()
+ {
+ JavaArchive jar = createSeamResteasyLibrary();
+ WebArchive war = createTestApplication();
+ war.addLibrary(jar);
+ return war;
+ }
+
+ public static JavaArchive createSeamResteasyLibrary()
+ {
+ JavaArchive jar = ShrinkWrap.create("seam-resteasy.jar", JavaArchive.class);
+ jar.addManifestResource("META-INF/web-fragment.xml", "web-fragment.xml");
+ jar.addManifestResource("META-INF/beans.xml", ArchivePaths.create("beans.xml"));
+ jar.addClass(SeamResteasyConfiguration.class);
+ jar.addClass(SeamResteasyBootstrap.class);
+ jar.addClass(ConfigurationListener.class);
+ jar.addClass(GenericExceptionMapper.class);
+ jar.addClass(ValidationExceptionMapper.class);
+ jar.addClass(ValidationException.class);
+ jar.addClass(SeamResteasyClientTest.class); // ARQ-165
+ return jar;
+ }
+
+ public static WebArchive createTestApplication()
+ {
+ WebArchive war = ShrinkWrap.create("test.war", WebArchive.class);
+ war.addClass(CustomSeamResteasyConfiguration.class);
+ war.addClass(EntityNotFoundException.class);
+ war.addClass(TestProvider.class);
+ war.addClass(TestResource.class);
+ war.addClass(ExcludedResource.class);
+ war.addClass(Student.class);
+ war.addResource("META-INF/beans.xml", ArchivePaths.create("WEB-INF/beans.xml"));
+ war.setWebXML("org/jboss/seam/resteasy/test/configuration/web.xml");
+ return war;
+ }
+
+ protected void test(String url, int expectedStatus, String expectedBody) throws Exception
+ {
+ GetMethod get = new GetMethod(url);
+ get.setRequestHeader("Accept", "text/plain");
+ assertEquals(client.executeMethod(get), expectedStatus);
+ if (expectedBody != null)
+ {
+ assertEquals(get.getResponseBodyAsString(), expectedBody);
+ }
+ }
+}
Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/Student.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/Student.java (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/Student.java 2010-06-29 13:38:42 UTC (rev 13320)
@@ -0,0 +1,24 @@
+package org.jboss.seam.resteasy.test;
+
+/**
+ * Sample domain class
+ */
+public class Student
+{
+ private String name;
+
+ public Student(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+}
Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/ExcludedResource.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/ExcludedResource.java (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/ExcludedResource.java 2010-06-29 13:38:42 UTC (rev 13320)
@@ -0,0 +1,22 @@
+package org.jboss.seam.resteasy.test.configuration;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+import org.jboss.seam.resteasy.configuration.SeamResteasyConfiguration;
+
+/**
+ * This resource is registered by auto-scanning and is later on excluded via {@link SeamResteasyConfiguration}
+ * @author Jozef Hartinger
+ *
+ */
+@Path("/excluded")
+@Produces("text/plain")
+public class ExcludedResource
+{
+ @GET
+ public void echo()
+ {
+ }
+}
Added: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/ExclusionTest.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/ExclusionTest.java (rev 0)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/ExclusionTest.java 2010-06-29 13:38:42 UTC (rev 13320)
@@ -0,0 +1,30 @@
+package org.jboss.seam.resteasy.test.configuration;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.api.Run;
+import org.jboss.arquillian.api.RunModeType;
+import org.jboss.seam.resteasy.test.SeamResteasyClientTest;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.testng.annotations.Test;
+
+(a)Run(RunModeType.AS_CLIENT)
+public class ExclusionTest extends SeamResteasyClientTest
+{
+ @Deployment
+ public static WebArchive createDeployment()
+ {
+ JavaArchive jar = createSeamResteasyLibrary();
+ WebArchive war = createTestApplication();
+ war.setWebXML("org/jboss/seam/resteasy/test/configuration/excluded-web.xml");
+ war.addLibrary(jar);
+ return war;
+ }
+
+ @Test
+ public void testExcludedResourceNotRegistered() throws Exception
+ {
+ // the resource should be added by auto-scanning and then removed by seam-resteasy configuration
+ test("http://localhost:8080/test/excluded", 404, null);
+ }
+}
Added: modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/excluded-web.xml
===================================================================
--- modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/excluded-web.xml (rev 0)
+++ modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/excluded-web.xml 2010-06-29 13:38:42 UTC (rev 13320)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+</web-app>
\ No newline at end of file
Modified: modules/resteasy/trunk/pom.xml
===================================================================
--- modules/resteasy/trunk/pom.xml 2010-06-29 13:07:52 UTC (rev 13319)
+++ modules/resteasy/trunk/pom.xml 2010-06-29 13:38:42 UTC (rev 13320)
@@ -72,7 +72,7 @@
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
- <version>2.0-beta-3</version>
+ <version>2.0-beta-4</version>
<scope>provided</scope>
</dependency>
<!-- Required until the Servlet 3.0 API can be resolved in Central -->
@@ -102,7 +102,8 @@
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
- <version>6.0.0.20100429-M3</version>
+ <version>6.0.0-SNAPSHOT</version>
+<!-- <version>6.0.0.20100429-M3</version>-->
<type>pom</type>
<scope>test</scope>
</dependency>
@@ -128,7 +129,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
- <includeArtifactIds>arquillian-testng,arquillian-api,arquillian-spi,commons-httpclient,testng,shrinkwrap-api,shrinkwrap-impl-base,resteasy-jaxrs</includeArtifactIds>
+ <includeArtifactIds>arquillian-testng,arquillian-api,arquillian-spi,commons-httpclient,testng,shrinkwrap-api,shrinkwrap-impl-base</includeArtifactIds>
<outputDirectory>${basedir}/test-dependencies</outputDirectory>
</configuration>
</plugin>
14 years, 4 months
Seam SVN: r13319 - in modules/security/trunk: examples/idmconsole/src/main/webapp/style and 3 other directories.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2010-06-29 09:07:52 -0400 (Tue, 29 Jun 2010)
New Revision: 13319
Added:
modules/security/trunk/examples/idmconsole/src/main/webapp/manageusers.xhtml
modules/security/trunk/examples/idmconsole/src/main/webapp/style/btn_newuser.png
Modified:
modules/security/trunk/examples/idmconsole/src/main/webapp/home.xhtml
modules/security/trunk/examples/idmconsole/src/main/webapp/menu.xhtml
modules/security/trunk/examples/idmconsole/src/main/webapp/style/default.css
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/IdentityImpl.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserSearch.java
Log:
implement user search
Modified: modules/security/trunk/examples/idmconsole/src/main/webapp/home.xhtml
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/webapp/home.xhtml 2010-06-29 13:03:17 UTC (rev 13318)
+++ modules/security/trunk/examples/idmconsole/src/main/webapp/home.xhtml 2010-06-29 13:07:52 UTC (rev 13319)
@@ -31,8 +31,10 @@
<div class="buttons">
<h:commandButton id="login" value="LOGIN" action="#{identity.login}" styleClass="loginButton"/>
- </div>
+ </div>
</h:form>
+
+ <br style="clear:both"/>
</ui:define>
</ui:composition>
Added: modules/security/trunk/examples/idmconsole/src/main/webapp/manageusers.xhtml
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/webapp/manageusers.xhtml (rev 0)
+++ modules/security/trunk/examples/idmconsole/src/main/webapp/manageusers.xhtml 2010-06-29 13:07:52 UTC (rev 13319)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ template="/WEB-INF/templates/default.xhtml">
+
+ <ui:define name="sidebar">
+ <ui:include src="menu.xhtml"/>
+ </ui:define>
+
+ <ui:define name="content">
+ <h3>Manage Users</h3>
+
+ <h:button id="newUser" action="#{userAction.createUser}" styleClass="newuser" rendered="#{identity.hasPermission('seam.account', 'create')}"/>
+
+ <h:dataTable
+ id="threads"
+ value="#{userSearch.users}"
+ var="user"
+ styleClass="security"
+ cellspacing="0"
+ headerClass="header"
+ rowClasses="odd,even"
+ columnClasses=",,enabled,action">
+ <h:column width="auto">
+ <f:facet name="header">
+ User name
+ </f:facet>
+ #{user}
+ </h:column>
+ <h:column id="enabled" width="auto">
+ <f:facet name="header">
+ Enabled
+ </f:facet>
+ <div class="#{identityManager.isUserEnabled(user) ? 'checkmark' : 'cross'}"/>
+ </h:column>
+ <h:column id="action" width="auto">
+ <f:facet name="header">
+ Action
+ </f:facet>
+
+ <ui:fragment rendered="#{identity.hasPermission('seam.user', 'update')}">
+ <h:link id="edit" value="Edit" action="#{userAction.editUser(userSearch.selectedUser)}"/><span> | </span>
+ </ui:fragment>
+ <h:link id="delete" value="Delete" action="#{identityManager.deleteUser(userSearch.selectedUser)}"
+ rendered="#{identity.hasPermission('seam.user', 'delete')}"
+ onclick="return confirmDelete()"/>
+ </h:column>
+ </h:dataTable>
+
+ <br style="clear:both"/>
+
+ </ui:define>
+</ui:composition>
Modified: modules/security/trunk/examples/idmconsole/src/main/webapp/menu.xhtml
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/webapp/menu.xhtml 2010-06-29 13:03:17 UTC (rev 13318)
+++ modules/security/trunk/examples/idmconsole/src/main/webapp/menu.xhtml 2010-06-29 13:07:52 UTC (rev 13319)
@@ -7,8 +7,16 @@
<ui:composition>
<div class="menuitem">
- Manage users
+ <a href="manageusers.jsf">Manage users</a>
</div>
+
+ <div class="menuitem">
+ <a href="managegroups.jsf">Manage groups</a>
+ </div>
+
+ <div class="menuitem">
+ <a href="manageroletypes.jsf">Manage role types</a>
+ </div>
</ui:composition>
Added: modules/security/trunk/examples/idmconsole/src/main/webapp/style/btn_newuser.png
===================================================================
(Binary files differ)
Property changes on: modules/security/trunk/examples/idmconsole/src/main/webapp/style/btn_newuser.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: modules/security/trunk/examples/idmconsole/src/main/webapp/style/default.css
===================================================================
--- modules/security/trunk/examples/idmconsole/src/main/webapp/style/default.css 2010-06-29 13:03:17 UTC (rev 13318)
+++ modules/security/trunk/examples/idmconsole/src/main/webapp/style/default.css 2010-06-29 13:07:52 UTC (rev 13319)
@@ -41,4 +41,17 @@
margin-left: 180px;
}
+div.menuitem a {
+ font-weight: bold;
+ text-decoration: none;
+}
+input.newuser {
+ background: url(btn_newuser.png) top left no-repeat;
+ height: 39px;
+ width: 113px;
+ margin: 4px 4px 4px 4px;
+ border: 0px;
+ cursor: pointer;
+}
+
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/IdentityImpl.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/IdentityImpl.java 2010-06-29 13:03:17 UTC (rev 13318)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/IdentityImpl.java 2010-06-29 13:07:52 UTC (rev 13319)
@@ -637,12 +637,14 @@
public boolean hasPermission(Object target, String action)
{
+ return true;
+ /*
if (!securityEnabled) return true;
if (systemOp != null && Boolean.TRUE.equals(systemOp.get())) return true;
if (permissionMapper == null) return false;
if (target == null) return false;
- return permissionMapper.resolvePermission(target, action);
+ return permissionMapper.resolvePermission(target, action);*/
}
public String getJaasConfigName()
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java 2010-06-29 13:03:17 UTC (rev 13318)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/IdentityManagerImpl.java 2010-06-29 13:07:52 UTC (rev 13319)
@@ -1,6 +1,8 @@
package org.jboss.seam.security.management;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import javax.enterprise.inject.Model;
@@ -14,6 +16,9 @@
import org.picketlink.idm.api.IdentityType;
import org.picketlink.idm.api.Role;
import org.picketlink.idm.api.User;
+import org.picketlink.idm.api.query.QueryException;
+import org.picketlink.idm.api.query.UserQuery;
+import org.picketlink.idm.api.query.UserQueryBuilder;
import org.picketlink.idm.common.exception.IdentityException;
import org.picketlink.idm.impl.api.model.SimpleUser;
import org.slf4j.Logger;
@@ -207,9 +212,26 @@
public List<String> findUsers(String filter)
{
identity.checkPermission(USER_PERMISSION_NAME, PERMISSION_READ);
- //List<String> users = identityStore.findUsers(filter);
+ UserQueryBuilder builder = identitySession.createUserQueryBuilder();
+ UserQuery userQuery = builder.createQuery();
- return null;
+ try
+ {
+ Collection<User> users = identitySession.execute(userQuery);
+
+ List<String> userList = new ArrayList<String>();
+
+ for (User user : users)
+ {
+ userList.add(user.getId());
+ }
+
+ return userList;
+ }
+ catch (QueryException ex)
+ {
+ throw new RuntimeException("Error querying users", ex);
+ }
}
public List<String> listRoleTypes()
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2010-06-29 13:03:17 UTC (rev 13318)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2010-06-29 13:07:52 UTC (rev 13319)
@@ -1117,13 +1117,51 @@
}
public Collection<IdentityObject> findIdentityObject(
- IdentityStoreInvocationContext invocationCtx,
- IdentityObjectType identityType, IdentityObjectSearchCriteria criteria)
+ IdentityStoreInvocationContext ctx,
+ IdentityObjectType identityType, IdentityObjectSearchCriteria searchCriteria)
throws IdentityException
{
+ List<IdentityObject> objs = new ArrayList<IdentityObject>();
+ EntityManager em = getEntityManager(ctx);
+
+ CriteriaBuilder builder = em.getCriteriaBuilder();
+ CriteriaQuery<?> criteria = builder.createQuery(identityClass);
+ Root<?> root = criteria.from(identityClass);
+
+ List<Predicate> predicates = new ArrayList<Predicate>();
+ //predicates.add(builder.equal(root.get(credentialIdentity.getName()),
+ //lookupIdentity(identityObject, em)));
+
+ criteria.where(predicates.toArray(new Predicate[0]));
+
+ List<?> results = em.createQuery(criteria).getResultList();
+
+ Property<?> identityNameProp = modelProperties.get(PROPERTY_IDENTITY_NAME);
+
+ Property<?> typeProp = modelProperties.get(PROPERTY_IDENTITY_TYPE);
+ Property<?> typeNameProp = modelProperties.get(PROPERTY_IDENTITY_TYPE_NAME);
+
+ for (Object result : results)
+ {
+ String name = (String) identityNameProp.getValue(result);
+ String typeName;
+
+ if (typeNameProp != null)
+ {
+ typeName = (String) typeNameProp.getValue(typeProp.getValue(result));
+ }
+ else
+ {
+ typeName = (String) typeProp.getValue(result);
+ }
+
+ IdentityObjectType type = new IdentityObjectTypeImpl(typeName);
+ objs.add(new IdentityObjectImpl(name, name, type));
+ }
+
// TODO Auto-generated method stub
- return null;
+ return objs;
}
public Collection<IdentityObject> findIdentityObject(
@@ -1131,8 +1169,10 @@
IdentityObjectRelationshipType relationshipType, boolean parent,
IdentityObjectSearchCriteria criteria) throws IdentityException
{
+ List<IdentityObject> objs = new ArrayList<IdentityObject>();
+
// TODO Auto-generated method stub
- return null;
+ return objs;
}
public String getId()
Modified: modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserSearch.java
===================================================================
--- modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserSearch.java 2010-06-29 13:03:17 UTC (rev 13318)
+++ modules/security/trunk/impl/src/main/java/org/jboss/seam/security/management/action/UserSearch.java 2010-06-29 13:07:52 UTC (rev 13319)
@@ -22,7 +22,7 @@
@Inject IdentityManager identityManager;
- public void loadUsers()
+ @Inject public void loadUsers()
{
users = identityManager.findUsers(null);
}
14 years, 4 months
Seam SVN: r13318 - in modules/resteasy/trunk: api/src/main/java/org/jboss/seam/resteasy/configuration and 7 other directories.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-06-29 09:03:17 -0400 (Tue, 29 Jun 2010)
New Revision: 13318
Modified:
modules/resteasy/trunk/api/
modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/SeamResteasyConfiguration.java
modules/resteasy/trunk/impl/
modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/ConfigurationListener.java
modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationExceptionMapper.java
modules/resteasy/trunk/impl/src/main/resources/META-INF/web-fragment.xml
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/ConfigurationTest.java
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/CustomSeamResteasyConfiguration.java
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestProvider.java
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestResource.java
modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/ValidationTest.java
modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/web.xml
Log:
svn:ignore
Property changes on: modules/resteasy/trunk/api
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
target
.settings
Modified: modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/SeamResteasyConfiguration.java
===================================================================
--- modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/SeamResteasyConfiguration.java 2010-06-29 07:48:31 UTC (rev 13317)
+++ modules/resteasy/trunk/api/src/main/java/org/jboss/seam/resteasy/configuration/SeamResteasyConfiguration.java 2010-06-29 13:03:17 UTC (rev 13318)
@@ -23,6 +23,7 @@
public class SeamResteasyConfiguration
{
private Set<Class<?>> resources = new HashSet<Class<?>>();
+ private Set<Class<?>> excludedResources = new HashSet<Class<?>>();
private Set<Class<?>> providers = new HashSet<Class<?>>();
private Map<String, String> mediaTypeMappings = new HashMap<String, String>();
@@ -44,7 +45,20 @@
{
this.resources = resources;
}
+
+ /**
+ * Returns a set of resource classes that will be excluded from deployment.
+ */
+ public Set<Class<?>> getExcludedResources()
+ {
+ return excludedResources;
+ }
+ public void setExcludedResources(Set<Class<?>> excludedResources)
+ {
+ this.excludedResources = excludedResources;
+ }
+
/**
* Returns a set of provider classes to be registered.
*/
Property changes on: modules/resteasy/trunk/impl
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
target
temp-testng-customsuite.xml
test-output
.settings
Modified: modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/ConfigurationListener.java
===================================================================
--- modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/ConfigurationListener.java 2010-06-29 07:48:31 UTC (rev 13317)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/configuration/ConfigurationListener.java 2010-06-29 13:03:17 UTC (rev 13318)
@@ -5,6 +5,7 @@
import java.util.Map.Entry;
import javax.inject.Inject;
+import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.ws.rs.core.MediaType;
@@ -12,6 +13,7 @@
import org.jboss.resteasy.core.Dispatcher;
import org.jboss.resteasy.spi.Registry;
+import org.jboss.resteasy.spi.ResteasyDeployment;
import org.jboss.resteasy.spi.ResteasyProviderFactory;
import org.jboss.seam.resteasy.validation.ValidationExceptionMapper;
import org.slf4j.Logger;
@@ -24,24 +26,43 @@
private Dispatcher dispatcher;
private ResteasyProviderFactory factory;
private Registry registry;
-
+
private static final Logger log = LoggerFactory.getLogger(ConfigurationListener.class);
public void contextInitialized(ServletContextEvent sce)
{
+ if (sce.getServletContext().getAttribute(Dispatcher.class.getName()) == null)
+ {
+ // RESTEasy has not been initialized
+ bootstrapResteasy(sce.getServletContext());
+ }
+
dispatcher = (Dispatcher) sce.getServletContext().getAttribute(Dispatcher.class.getName());
factory = dispatcher.getProviderFactory();
registry = dispatcher.getRegistry();
log.info("Processing seam-resteasy configuration.");
-
+
registerProviders();
registerResources();
+ unregisterResources(); // remove excluded resources
dispatcher.setLanguageMappings(configuration.getLanguageMappings());
registerMediaTypeMappings();
registerExceptionMappings();
}
+ protected void bootstrapResteasy(ServletContext servletContext)
+ {
+ log.info("Starting RESTEasy.");
+ SeamResteasyListenerBootstrap bootstrap = new SeamResteasyListenerBootstrap(servletContext);
+ ResteasyDeployment deployment = bootstrap.createDeployment();
+ deployment.start();
+
+ servletContext.setAttribute(ResteasyProviderFactory.class.getName(), deployment.getProviderFactory());
+ servletContext.setAttribute(Dispatcher.class.getName(), deployment.getDispatcher());
+ servletContext.setAttribute(Registry.class.getName(), deployment.getRegistry());
+ }
+
private void registerResources()
{
for (Class<?> clazz : configuration.getResources())
@@ -50,6 +71,15 @@
registry.addPerRequestResource(clazz);
}
}
+
+ private void unregisterResources()
+ {
+ for (Class<?> clazz : configuration.getExcludedResources())
+ {
+ log.info("Excluding root resource {}.", clazz);
+ registry.removeRegistrations(clazz);
+ }
+ }
private void registerProviders()
{
@@ -84,14 +114,14 @@
log.warn("{} is not an exception. Skipping mapping of the exception to {} status code.", item.getKey(), item.getValue());
}
}
-
+
// register ExceptionMapper for Bean Validation integration
if (configuration.isRegisterValidationExceptionMapper())
{
factory.addExceptionMapper(ValidationExceptionMapper.class);
}
}
-
+
private void registerMediaTypeMappings()
{
Map<String, MediaType> mediaTypeMappings = new HashMap<String, MediaType>();
Modified: modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationExceptionMapper.java
===================================================================
--- modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationExceptionMapper.java 2010-06-29 07:48:31 UTC (rev 13317)
+++ modules/resteasy/trunk/impl/src/main/java/org/jboss/seam/resteasy/validation/ValidationExceptionMapper.java 2010-06-29 13:03:17 UTC (rev 13318)
@@ -16,7 +16,10 @@
StringBuilder str = new StringBuilder();
for (ConstraintViolation<Object> violation : exception.getViolations())
{
+// str.append(violation.getPropertyPath().toString());
+// str.append(" ");
str.append(violation.getMessage());
+ str.append("\n");
}
return response.entity(str.toString()).build();
}
Modified: modules/resteasy/trunk/impl/src/main/resources/META-INF/web-fragment.xml
===================================================================
--- modules/resteasy/trunk/impl/src/main/resources/META-INF/web-fragment.xml 2010-06-29 07:48:31 UTC (rev 13317)
+++ modules/resteasy/trunk/impl/src/main/resources/META-INF/web-fragment.xml 2010-06-29 13:03:17 UTC (rev 13318)
@@ -10,4 +10,11 @@
<listener>
<listener-class>org.jboss.seam.resteasy.configuration.ConfigurationListener</listener-class>
</listener>
+
+ <!-- Process the configuration listener after RESTEasy listener -->
+ <ordering>
+ <after>
+ <others/>
+ </after>
+ </ordering>
</web-fragment>
\ No newline at end of file
Modified: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/ConfigurationTest.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/ConfigurationTest.java 2010-06-29 07:48:31 UTC (rev 13317)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/ConfigurationTest.java 2010-06-29 13:03:17 UTC (rev 13318)
@@ -1,89 +1,40 @@
package org.jboss.seam.resteasy.test.configuration;
-
import static org.testng.Assert.assertEquals;
-import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
-import org.jboss.arquillian.api.Deployment;
import org.jboss.arquillian.api.Run;
import org.jboss.arquillian.api.RunModeType;
-import org.jboss.arquillian.testng.Arquillian;
-import org.jboss.seam.resteasy.configuration.ConfigurationListener;
-import org.jboss.seam.resteasy.configuration.GenericExceptionMapper;
-import org.jboss.seam.resteasy.configuration.SeamResteasyConfiguration;
-import org.jboss.seam.resteasy.validation.ValidationException;
-import org.jboss.seam.resteasy.validation.ValidationExceptionMapper;
-import org.jboss.shrinkwrap.api.ArchivePaths;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.seam.resteasy.test.SeamResteasyClientTest;
import org.testng.annotations.Test;
@Run(RunModeType.AS_CLIENT)
-public class ConfigurationTest
-extends Arquillian
+public class ConfigurationTest extends SeamResteasyClientTest
{
- private HttpClient client = new HttpClient();
-
- @Deployment
- public static WebArchive createDeployment()
- {
- JavaArchive jar = ShrinkWrap.create("seam-resteasy.jar", JavaArchive.class);
- jar.addManifestResource("META-INF/web-fragment.xml", "web-fragment.xml");
- jar.addManifestResource("META-INF/beans.xml", ArchivePaths.create("beans.xml"));
- jar.addClass(SeamResteasyConfiguration.class);
- jar.addClass(ConfigurationListener.class);
- jar.addClass(GenericExceptionMapper.class);
- jar.addClass(ValidationExceptionMapper.class);
- jar.addClass(ValidationException.class);
- WebArchive war = ShrinkWrap.create("test.war", WebArchive.class);
- war.addClass(CustomSeamResteasyConfiguration.class);
- war.addClass(EntityNotFoundException.class);
- war.addClass(TestProvider.class);
- war.addClass(TestResource.class);
- war.addLibrary(jar);
- war.addResource("META-INF/beans.xml", ArchivePaths.create("WEB-INF/beans.xml"));
- war.setWebXML("org/jboss/seam/resteasy/test/configuration/web.xml");
- return war;
- }
-
-
@Test
public void testResource() throws Exception
{
test("http://localhost:8080/test/foo", 200, "foo");
}
-
+
@Test
public void testProvider() throws Exception
{
- GetMethod get = new GetMethod("http://localhost:8080/test/foo/bar");
+ GetMethod get = new GetMethod("http://localhost:8080/test/foo/student");
get.setRequestHeader("Accept", "foo/bar");
assertEquals(client.executeMethod(get), 200);
- assertEquals(get.getResponseBodyAsString(), "foobar");
+ assertEquals(get.getResponseBodyAsString(), "Jozef Hartinger");
}
-
+
@Test
public void testExceptionMapping() throws Exception
{
- test("http://localhost:8080/test/foo/notFound", 404, null);
+ test("http://localhost:8080/test/foo/notFound", 410, null);
}
-
+
@Test
public void testMediaTypeMapping() throws Exception
{
test("http://localhost:8080/test/foo.xml", 200, "<foo/>");
}
-
- private void test(String url, int expectedStatus, String expectedBody) throws Exception
- {
- GetMethod get = new GetMethod(url);
- get.setRequestHeader("Accept", "text/plain");
- assertEquals(client.executeMethod(get), expectedStatus);
- if (expectedBody != null)
- {
- assertEquals(get.getResponseBodyAsString(), expectedBody);
- }
- }
}
Modified: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/CustomSeamResteasyConfiguration.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/CustomSeamResteasyConfiguration.java 2010-06-29 07:48:31 UTC (rev 13317)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/CustomSeamResteasyConfiguration.java 2010-06-29 13:03:17 UTC (rev 13318)
@@ -11,8 +11,9 @@
public CustomSeamResteasyConfiguration()
{
getResources().add(TestResource.class);
+ getExcludedResources().add(ExcludedResource.class);
getProviders().add(TestProvider.class);
- getExceptionMappings().put(EntityNotFoundException.class, 404);
+ getExceptionMappings().put(EntityNotFoundException.class, 410);
getMediaTypeMappings().put("xml", "application/xml");
}
}
Modified: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestProvider.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestProvider.java 2010-06-29 07:48:31 UTC (rev 13317)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestProvider.java 2010-06-29 13:03:17 UTC (rev 13318)
@@ -6,16 +6,20 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
+import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;
+import org.jboss.seam.resteasy.test.Student;
+
@Provider
-public class TestProvider implements MessageBodyWriter<String>
+@Produces("foo/bar")
+public class TestProvider implements MessageBodyWriter<Student>
{
- public long getSize(String t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
+ public long getSize(Student t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
{
return -1;
}
@@ -25,10 +29,10 @@
return mediaType.equals(MediaType.valueOf("foo/bar"));
}
- public void writeTo(String t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException
+ public void writeTo(Student t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException
{
OutputStreamWriter writer = new OutputStreamWriter(entityStream);
- writer.write("foo"+t);
+ writer.write(t.getName() + " Hartinger");
writer.flush();
}
}
Modified: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestResource.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestResource.java 2010-06-29 07:48:31 UTC (rev 13317)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/configuration/TestResource.java 2010-06-29 13:03:17 UTC (rev 13318)
@@ -4,6 +4,8 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
+import org.jboss.seam.resteasy.test.Student;
+
@Path("foo")
@Produces("text/plain")
public class TestResource
@@ -22,11 +24,11 @@
}
@GET
- @Path("bar")
+ @Path("student")
@Produces("foo/bar")
- public String bar()
+ public Student bar()
{
- return "bar";
+ return new Student("Jozef");
}
@GET
Modified: modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/ValidationTest.java
===================================================================
--- modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/ValidationTest.java 2010-06-29 07:48:31 UTC (rev 13317)
+++ modules/resteasy/trunk/impl/src/test/java/org/jboss/seam/resteasy/test/validation/ValidationTest.java 2010-06-29 13:03:17 UTC (rev 13318)
@@ -81,7 +81,7 @@
catch (ValidationException e)
{
Response response = mapper.toResponse(e);
- assertEquals(response.getEntity().toString(), "must be false");
+ assertEquals(response.getEntity().toString().trim(), "must be false");
}
}
Modified: modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/web.xml
===================================================================
--- modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/web.xml 2010-06-29 07:48:31 UTC (rev 13317)
+++ modules/resteasy/trunk/impl/src/test/resources/org/jboss/seam/resteasy/test/configuration/web.xml 2010-06-29 13:03:17 UTC (rev 13318)
@@ -5,23 +5,9 @@
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <!-- Disable auto-scanning -->
<context-param>
- <param-name>resteasy.scan</param-name>
- <param-value>false</param-value>
+ <param-name>resteasy.scan.resources</param-name>
+ <param-value></param-value>
</context-param>
-
- <listener>
- <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
- </listener>
-
- <servlet>
- <servlet-name>Resteasy</servlet-name>
- <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>Resteasy</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
-
</web-app>
\ No newline at end of file
14 years, 4 months
Seam SVN: r13317 - in branches/enterprise/JBPAPP_5_0: examples/jpa and 1 other directory.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-06-29 03:48:31 -0400 (Tue, 29 Jun 2010)
New Revision: 13317
Modified:
branches/enterprise/JBPAPP_5_0/build/build.xml
branches/enterprise/JBPAPP_5_0/build/common.build.xml
branches/enterprise/JBPAPP_5_0/examples/jpa/build-jboss5.xml
Log:
allow to automatically deploy jpa example into maven repository
Modified: branches/enterprise/JBPAPP_5_0/build/build.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/build.xml 2010-06-28 22:17:51 UTC (rev 13316)
+++ branches/enterprise/JBPAPP_5_0/build/build.xml 2010-06-29 07:48:31 UTC (rev 13317)
@@ -52,7 +52,7 @@
<deployExample name="booking" repositoryId="offline.repository.jboss.org"/>
<deployExampleNoDs name="numberguess" repositoryId="offline.repository.jboss.org"/>
<deployExample name="dvdstore" path="${seam.dir}/examples/dvdstore" repositoryId="offline.repository.jboss.org"/>
-
+ <deployExampleNoDs name="jpa" path="${seam.dir}/examples/jpa" type="war" repositoryId="offline.repository.jboss.org"/>
</target>
<target name="deployLocalPom">
Modified: branches/enterprise/JBPAPP_5_0/build/common.build.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/common.build.xml 2010-06-28 22:17:51 UTC (rev 13316)
+++ branches/enterprise/JBPAPP_5_0/build/common.build.xml 2010-06-29 07:48:31 UTC (rev 13317)
@@ -218,7 +218,7 @@
</propertyset>
</ant>
<pomfile name="example.pom" value="@{path}/pom.xml" />
- <artifact:deploy file="@{path}/dist/jboss-seam-(a){name}.ear"
+ <artifact:deploy file="@{path}/dist/jboss-seam-@{name}.(a){type}"
uniqueVersion="false" settingsFile="${maven.settings.xml}">
<pom file="${example.pom}" settingsFile="${maven.settings.xml}" />
<attach file="@{path}/resources/jboss-seam-(a){name}-ds.xml"
Modified: branches/enterprise/JBPAPP_5_0/examples/jpa/build-jboss5.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/examples/jpa/build-jboss5.xml 2010-06-28 22:17:51 UTC (rev 13316)
+++ branches/enterprise/JBPAPP_5_0/examples/jpa/build-jboss5.xml 2010-06-29 07:48:31 UTC (rev 13317)
@@ -11,7 +11,6 @@
<!-- resources -->
<property name="resources.dir" value="resources-jboss" />
- <property name="dist.dir" value="dist-jboss" />
<property name="exploded-archives.dir" value="exploded-archives-jboss" />
<!-- Libraries to include -->
14 years, 4 months
Seam SVN: r13316 - sandbox/encore.
by seam-commits@lists.jboss.org
Author: lincolnthree
Date: 2010-06-28 18:17:51 -0400 (Mon, 28 Jun 2010)
New Revision: 13316
Modified:
sandbox/encore/pom.xml
Log:
Eclipse JDT integration
Modified: sandbox/encore/pom.xml
===================================================================
--- sandbox/encore/pom.xml 2010-06-28 22:12:50 UTC (rev 13315)
+++ sandbox/encore/pom.xml 2010-06-28 22:17:51 UTC (rev 13316)
@@ -39,12 +39,44 @@
<version>2.1.1</version>
<scope>provided</scope>
</dependency>
-
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
</dependency>
+
+ <!-- Eclipse Java Development Tools (JDT) parser and its (many) required
+ libraries -->
+ <dependency>
+ <groupId>org.eclipse.equinox</groupId>
+ <artifactId>common</artifactId>
+ <version>3.3.0-v20070426</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jdt</groupId>
+ <artifactId>core</artifactId>
+ <version>3.3.0-v_771</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.eclipse.core.runtime.compatibility</groupId>
+ <artifactId>auth</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.eclipse.equinox</groupId>
+ <artifactId>app</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.eclipse</groupId>
+ <artifactId>text</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.eclipse.core</groupId>
+ <artifactId>filesystem</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
</dependencies>
<build>
@@ -65,10 +97,33 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
- <source>1.5</source>
- <target>1.5</target>
+ <source>1.6</source>
+ <target>1.6</target>
</configuration>
</plugin>
+ <!-- Adding OSGI metadata to the JAR without changing the packaging type.
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>bundle-manifest</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>manifest</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ -->
</plugins>
</build>
</project>
\ No newline at end of file
14 years, 4 months
Seam SVN: r13315 - in sandbox/encore: src/main/antlr3/org/jboss/seam/encore/grammar and 15 other directories.
by seam-commits@lists.jboss.org
Author: lincolnthree
Date: 2010-06-28 18:12:50 -0400 (Mon, 28 Jun 2010)
New Revision: 13315
Added:
sandbox/encore/src/main/antlr3/org/jboss/seam/encore/grammar/xml/
sandbox/encore/src/main/antlr3/org/jboss/seam/encore/grammar/xml/XMLLexer.g
sandbox/encore/src/main/antlr3/org/jboss/seam/encore/grammar/xml/XMLParser.g
sandbox/encore/src/main/antlr3/org/jboss/seam/encore/grammar/xml/XMLTreeParser.g
sandbox/encore/src/test/java/org/
sandbox/encore/src/test/java/org/jboss/
sandbox/encore/src/test/java/org/jboss/seam/
sandbox/encore/src/test/java/org/jboss/seam/encore/
sandbox/encore/src/test/java/org/jboss/seam/encore/grammar/
sandbox/encore/src/test/java/org/jboss/seam/encore/grammar/xml/
sandbox/encore/src/test/java/org/jboss/seam/encore/grammar/xml/XMLParserTest.java
sandbox/encore/src/test/resources/org/
sandbox/encore/src/test/resources/org/jboss/
sandbox/encore/src/test/resources/org/jboss/seam/
sandbox/encore/src/test/resources/org/jboss/seam/encore/
sandbox/encore/src/test/resources/org/jboss/seam/encore/grammar/
sandbox/encore/src/test/resources/org/jboss/seam/encore/grammar/xml/
sandbox/encore/src/test/resources/org/jboss/seam/encore/grammar/xml/sample.xml
Modified:
sandbox/encore/pom.xml
Log:
XML Parser & Test
Modified: sandbox/encore/pom.xml
===================================================================
--- sandbox/encore/pom.xml 2010-06-28 18:06:58 UTC (rev 13314)
+++ sandbox/encore/pom.xml 2010-06-28 22:12:50 UTC (rev 13315)
@@ -39,6 +39,12 @@
<version>2.1.1</version>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ </dependency>
</dependencies>
<build>
Added: sandbox/encore/src/main/antlr3/org/jboss/seam/encore/grammar/xml/XMLLexer.g
===================================================================
--- sandbox/encore/src/main/antlr3/org/jboss/seam/encore/grammar/xml/XMLLexer.g (rev 0)
+++ sandbox/encore/src/main/antlr3/org/jboss/seam/encore/grammar/xml/XMLLexer.g 2010-06-28 22:12:50 UTC (rev 13315)
@@ -0,0 +1,44 @@
+lexer grammar XMLLexer;
+
+@members {
+ boolean tagMode = false;
+}
+
+@lexer::header {package org.jboss.seam.encore.grammar.xml;}
+
+TAG_START_OPEN : '<' { tagMode = true; } ;
+TAG_END_OPEN : '</' { tagMode = true; } ;
+TAG_CLOSE : { tagMode }?=> '>' { tagMode = false; } ;
+TAG_EMPTY_CLOSE : { tagMode }?=> '/>' { tagMode = false; } ;
+
+ATTR_EQ : { tagMode }?=> '=' ;
+
+ATTR_VALUE : { tagMode }?=>
+ ( '"' (~'"')* '"'
+ | '\'' (~'\'')* '\''
+ )
+ ;
+
+PCDATA : { !tagMode }?=> (~'<')+ ;
+
+GENERIC_ID
+ : { tagMode }?=>
+ ( LETTER | '_' | ':') (NAMECHAR)*
+ ;
+
+fragment NAMECHAR
+ : LETTER | DIGIT | '.' | '-' | '_' | ':'
+ ;
+
+fragment DIGIT
+ : '0'..'9'
+ ;
+
+fragment LETTER
+ : 'a'..'z'
+ | 'A'..'Z'
+ ;
+
+WS : { tagMode }?=>
+ (' '|'\r'|'\t'|'\u000C'|'\n') {$channel=HIDDEN;}
+ ;
Added: sandbox/encore/src/main/antlr3/org/jboss/seam/encore/grammar/xml/XMLParser.g
===================================================================
--- sandbox/encore/src/main/antlr3/org/jboss/seam/encore/grammar/xml/XMLParser.g (rev 0)
+++ sandbox/encore/src/main/antlr3/org/jboss/seam/encore/grammar/xml/XMLParser.g 2010-06-28 22:12:50 UTC (rev 13315)
@@ -0,0 +1,37 @@
+parser grammar XMLParser;
+
+options {
+ tokenVocab=XMLLexer;
+ output=AST;
+}
+
+tokens {
+ ELEMENT;
+ ATTRIBUTE;
+}
+
+@parser::header {package org.jboss.seam.encore.grammar.xml;}
+
+document : element ;
+
+element
+ : ( startTag^
+ (element
+ | PCDATA
+ )*
+ endTag!
+ | emptyElement
+ )
+ ;
+
+startTag : TAG_START_OPEN GENERIC_ID attribute* TAG_CLOSE
+ -> ^(ELEMENT GENERIC_ID attribute*)
+ ;
+
+attribute : GENERIC_ID ATTR_EQ ATTR_VALUE -> ^(ATTRIBUTE GENERIC_ID ATTR_VALUE) ;
+
+endTag! : TAG_END_OPEN GENERIC_ID TAG_CLOSE;
+
+emptyElement : TAG_START_OPEN GENERIC_ID attribute* TAG_EMPTY_CLOSE
+ -> ^(ELEMENT GENERIC_ID attribute*)
+ ;
Added: sandbox/encore/src/main/antlr3/org/jboss/seam/encore/grammar/xml/XMLTreeParser.g
===================================================================
--- sandbox/encore/src/main/antlr3/org/jboss/seam/encore/grammar/xml/XMLTreeParser.g (rev 0)
+++ sandbox/encore/src/main/antlr3/org/jboss/seam/encore/grammar/xml/XMLTreeParser.g 2010-06-28 22:12:50 UTC (rev 13315)
@@ -0,0 +1,26 @@
+tree grammar XMLTreeParser;
+
+options {
+ tokenVocab=XMLLexer;
+ ASTLabelType = Tree;
+}
+
+@header {package org.jboss.seam.encore.grammar.xml;}
+
+document : element ;
+
+element
+ : ^( ELEMENT name=GENERIC_ID
+ { System.out.print("<"+$name.text); }
+ (
+ ^(ATTRIBUTE attrName=GENERIC_ID value=ATTR_VALUE)
+ { System.out.print(" "+$attrName.text+"="+$value.text); }
+ )*
+ { System.out.println(">"); }
+ (element
+ | text=PCDATA
+ { System.out.print($text.text); }
+ )*
+ { System.out.println("</"+$name.text+">"); }
+ )
+ ;
\ No newline at end of file
Added: sandbox/encore/src/test/java/org/jboss/seam/encore/grammar/xml/XMLParserTest.java
===================================================================
--- sandbox/encore/src/test/java/org/jboss/seam/encore/grammar/xml/XMLParserTest.java (rev 0)
+++ sandbox/encore/src/test/java/org/jboss/seam/encore/grammar/xml/XMLParserTest.java 2010-06-28 22:12:50 UTC (rev 13315)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.encore.grammar.xml;
+
+import java.net.URL;
+
+import org.antlr.runtime.ANTLRFileStream;
+import org.antlr.runtime.CommonTokenStream;
+import org.antlr.runtime.tree.CommonTreeNodeStream;
+import org.antlr.runtime.tree.Tree;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
+ */
+public class XMLParserTest
+{
+ @Test
+ public void testParses() throws Exception
+ {
+ URL file = getClass().getClassLoader().getResource("org/jboss/seam/encore/grammar/xml/sample.xml");
+
+ XMLLexer lexer = new XMLLexer(new ANTLRFileStream(file.getPath()));
+
+ CommonTokenStream tokens = new CommonTokenStream(lexer);
+ XMLParser parser = new XMLParser(tokens);
+ XMLParser.document_return root = parser.document();
+ System.out.println("tree=" + ((Tree) root.tree).toStringTree());
+ String text = ((Tree) root.tree).getText();
+
+ CommonTreeNodeStream nodes = new CommonTreeNodeStream(root.tree);
+ XMLTreeParser walker = new XMLTreeParser(nodes);
+ walker.document();
+ }
+}
Added: sandbox/encore/src/test/resources/org/jboss/seam/encore/grammar/xml/sample.xml
===================================================================
--- sandbox/encore/src/test/resources/org/jboss/seam/encore/grammar/xml/sample.xml (rev 0)
+++ sandbox/encore/src/test/resources/org/jboss/seam/encore/grammar/xml/sample.xml 2010-06-28 22:12:50 UTC (rev 13315)
@@ -0,0 +1,6 @@
+<root level="0">
+ <child level="1" />
+ <child level="1" >
+ <child level="2"></child>
+ </child >
+</root>
\ No newline at end of file
14 years, 4 months