Author: alexsmirnov
Date: 2010-01-25 22:26:02 -0500 (Mon, 25 Jan 2010)
New Revision: 16360
Added:
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXB.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/XmlModule.java
Modified:
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/Logger.java
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java
Log:
https://jira.jboss.org/jira/browse/RF-8288
Modified:
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/Logger.java
===================================================================
---
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/Logger.java 2010-01-26
03:16:25 UTC (rev 16359)
+++
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/Logger.java 2010-01-26
03:26:02 UTC (rev 16360)
@@ -22,7 +22,7 @@
package org.richfaces.cdk;
/**
- * That interface hides current logging system from generator classe.
+ * That interface hides current logging system from generator classes.
* Concrete tools ( Maven, Ant, JUnit ) should provide appropriate logger instance that
delegates
* messages to the current log system.
*
Added:
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXB.java
===================================================================
---
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXB.java
(rev 0)
+++
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXB.java 2010-01-26
03:26:02 UTC (rev 16360)
@@ -0,0 +1,19 @@
+package org.richfaces.cdk.xmlconfig;
+
+import org.richfaces.cdk.CdkException;
+
+import java.io.File;
+
+import javax.xml.transform.Result;
+
+public interface JAXB {
+
+ public abstract <T> T unmarshal(File file, String schemaLocation,
Class<T> bindClass) throws CdkException;
+
+ public abstract <T> T unmarshal(String url, String schemaLocation,
Class<T> bindClass) throws CdkException;
+
+ public abstract <T> void marshal(File output, String schemaLocation, T model)
throws CdkException;
+
+ public abstract <T> void marshal(Result output, String schemaLocation, T model)
throws CdkException;
+
+}
\ No newline at end of file
Property changes on:
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXB.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified:
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java
===================================================================
---
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java 2010-01-26
03:16:25 UTC (rev 16359)
+++
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/JAXBBinding.java 2010-01-26
03:26:02 UTC (rev 16360)
@@ -70,7 +70,7 @@
* @author asmirnov(a)exadel.com
*
*/
-public class JAXBBinding implements CdkWorker {
+public class JAXBBinding implements CdkWorker, JAXB {
private static final FacesConfigNamespacePreffixMapper PREFFIX_MAPPER = new
FacesConfigNamespacePreffixMapper();
private static final ImmutableSet<String> IGNORE_PROPERTIES =
ImmutableSet.of("class", "extension");
@@ -90,6 +90,9 @@
this.resolver = new CdkEntityResolver(context);
}
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.xmlconfig.JAXB#unmarshal(java.io.File, java.lang.String,
java.lang.Class)
+ */
public <T> T unmarshal(File file, String schemaLocation, Class<T>
bindClass) throws CdkException {
try {
InputSource input = new InputSource(new FileInputStream(file));
@@ -104,6 +107,9 @@
}
}
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.xmlconfig.JAXB#unmarshal(java.lang.String,
java.lang.String, java.lang.Class)
+ */
public <T> T unmarshal(String url, String schemaLocation, Class<T>
bindClass) throws CdkException {
try {
InputSource inputSource = resolver.resolveSystemId(url);
@@ -122,7 +128,7 @@
@SuppressWarnings("unchecked")
//TODO nick - schemaLocation is unused
- public <T> T unmarshal(String schemaLocation, Class<T> bindClass,
InputSource inputSource) throws CdkException {
+ <T> T unmarshal(String schemaLocation, Class<T> bindClass, InputSource
inputSource) throws CdkException {
T unmarshal = null;
try {
@@ -176,6 +182,9 @@
return unmarshal;
}
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.xmlconfig.JAXB#marshal(java.io.File, java.lang.String, T)
+ */
public <T> void marshal(File output, String schemaLocation, T model) throws
CdkException {
try {
FileOutputStream outputStream = new FileOutputStream(output);
@@ -191,6 +200,9 @@
}
}
+ /* (non-Javadoc)
+ * @see org.richfaces.cdk.xmlconfig.JAXB#marshal(javax.xml.transform.Result,
java.lang.String, T)
+ */
public <T> void marshal(Result output, String schemaLocation, T model) throws
CdkException {
try {
JAXBContext jc = JAXBContext.newInstance(model.getClass());
Added:
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/XmlModule.java
===================================================================
---
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/XmlModule.java
(rev 0)
+++
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/XmlModule.java 2010-01-26
03:26:02 UTC (rev 16360)
@@ -0,0 +1,45 @@
+/*
+ * 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.richfaces.cdk.xmlconfig;
+
+import org.xml.sax.EntityResolver;
+
+import com.google.inject.AbstractModule;
+
+/**
+ * @author asmirnov
+ * @version $Id$
+ *
+ */
+public class XmlModule extends AbstractModule {
+
+ /* (non-Javadoc)
+ * @see com.google.inject.AbstractModule#configure()
+ */
+ @Override
+ protected void configure() {
+ bind(EntityResolver.class).to(CdkEntityResolver.class);
+ bind(JAXB.class).to(JAXBBinding.class);
+ }
+
+}
Property changes on:
root/cdk/branches/guice/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/XmlModule.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native