Author: chris.laprun(a)jboss.com
Date: 2009-11-22 17:46:54 -0500 (Sun, 22 Nov 2009)
New Revision: 749
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/ProducerConfigurationService.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/AbstractProducerConfigurationService.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/xml/FileSystemXMLProducerConfigurationService.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/xml/SimpleXMLProducerConfigurationService.java
Log:
- Remove loadConfigurationFrom(InputStream) method from ProducerConfigurationService as it
was dictating an implementation.
- Re-worked *XMLProducerConfigurationService to work with changes in interface.
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/ProducerConfigurationService.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/ProducerConfigurationService.java 2009-11-20
23:21:26 UTC (rev 748)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/ProducerConfigurationService.java 2009-11-22
22:46:54 UTC (rev 749)
@@ -23,8 +23,6 @@
package org.gatein.wsrp.producer.config;
-import java.io.InputStream;
-
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision: 8784 $
@@ -49,12 +47,4 @@
* @since 2.6.3
*/
void saveConfiguration() throws Exception;
-
- /**
- * Loads a producer configuration from the given InputStream.
- *
- * @param inputStream the InputStream to load the configuration from
- * @throws Exception
- */
- void loadConfigurationFrom(InputStream inputStream) throws Exception;
}
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/AbstractProducerConfigurationService.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/AbstractProducerConfigurationService.java 2009-11-20
23:21:26 UTC (rev 748)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/AbstractProducerConfigurationService.java 2009-11-22
22:46:54 UTC (rev 749)
@@ -23,7 +23,6 @@
package org.gatein.wsrp.producer.config.impl;
-import org.gatein.common.util.ParameterValidation;
import org.gatein.registration.RegistrationPolicyChangeListener;
import org.gatein.registration.RegistrationPropertyChangeListener;
import org.gatein.wsrp.producer.config.ProducerConfiguration;
@@ -31,7 +30,6 @@
import org.gatein.wsrp.producer.config.ProducerConfigurationService;
import org.gatein.wsrp.producer.config.ProducerRegistrationRequirements;
-import java.io.InputStream;
import java.util.List;
import java.util.Set;
@@ -48,10 +46,8 @@
return configuration;
}
- public void loadConfigurationFrom(InputStream inputStream) throws Exception
+ public void loadConfiguration() throws Exception
{
- ParameterValidation.throwIllegalArgExceptionIfNull(inputStream,
"InputStream");
-
// save listeners if we already have a configuration
List<ProducerConfigurationChangeListener> listeners = null;
Set<RegistrationPolicyChangeListener> policyListeners = null;
@@ -69,7 +65,7 @@
}
// reload
- configuration = parseConfigurationFrom(inputStream);
+ reloadConfiguration();
// restore listeners
if (listeners != null)
@@ -98,7 +94,4 @@
}
}
}
-
- protected abstract ProducerConfiguration parseConfigurationFrom(InputStream
inputStream) throws Exception;
-
}
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/xml/FileSystemXMLProducerConfigurationService.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/xml/FileSystemXMLProducerConfigurationService.java 2009-11-20
23:21:26 UTC (rev 748)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/xml/FileSystemXMLProducerConfigurationService.java 2009-11-22
22:46:54 UTC (rev 749)
@@ -133,9 +133,9 @@
private void loadConfigurationAt(URL configURL) throws Exception
{
log.debug("About to parse producer configuration " + configURL);
- InputStream inputStream = configURL.openStream();
+ inputStream = configURL.openStream();
- loadConfigurationFrom(inputStream);
+ super.loadConfiguration();
}
private URL getConfigLocationURL() throws Exception
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/xml/SimpleXMLProducerConfigurationService.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/xml/SimpleXMLProducerConfigurationService.java 2009-11-20
23:21:26 UTC (rev 748)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/config/impl/xml/SimpleXMLProducerConfigurationService.java 2009-11-22
22:46:54 UTC (rev 749)
@@ -41,18 +41,22 @@
*/
public class SimpleXMLProducerConfigurationService extends
AbstractProducerConfigurationService
{
+ protected InputStream inputStream;
- @Override
- protected ProducerConfiguration parseConfigurationFrom(InputStream inputStream) throws
Exception
+ public SimpleXMLProducerConfigurationService()
{
- Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
- ObjectModelFactory factory = new ProducerConfigurationFactory();
- return (ProducerConfiguration)unmarshaller.unmarshal(inputStream, factory, null);
}
+ public SimpleXMLProducerConfigurationService(InputStream inputStream)
+ {
+ this.inputStream = inputStream;
+ }
+
public void reloadConfiguration() throws Exception
{
- throw new UnsupportedOperationException("reloadConfiguration is not
supported!");
+ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller();
+ ObjectModelFactory factory = new ProducerConfigurationFactory();
+ configuration = (ProducerConfiguration)unmarshaller.unmarshal(inputStream, factory,
null);
}
public void saveConfiguration() throws Exception
Show replies by date