You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2011/10/09 19:42:05 UTC
svn commit: r1180665 - in /webservices/commons/trunk/modules/axiom/modules:
axiom-api/src/main/java/org/apache/axiom/locator/
axiom-api/src/main/java/org/apache/axiom/locator/loader/
axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/ axiom-d...
Author: veithen
Date: Sun Oct 9 17:42:04 2011
New Revision: 1180665
URL: http://svn.apache.org/viewvc?rev=1180665&view=rev
Log:
Use an additional level of indirection when loading the OMMetaFactory of an Axiom implementation. That is useful for non standard Axiom implementations that need to perform their own discovery/lookup.
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/locator/loader/
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/locator/loader/OMMetaFactoryLoader.java (with props)
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactoryLoader.java (with props)
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactoryLoader.java (with props)
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/locator/ImplementationFactory.java
webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/resources/META-INF/axiom.xml
webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/resources/META-INF/axiom.xml
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/locator/ImplementationFactory.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/locator/ImplementationFactory.java?rev=1180665&r1=1180664&r2=1180665&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/locator/ImplementationFactory.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/locator/ImplementationFactory.java Sun Oct 9 17:42:04 2011
@@ -27,6 +27,7 @@ import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import org.apache.axiom.locator.loader.OMMetaFactoryLoader;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMMetaFactory;
import org.apache.commons.logging.Log;
@@ -48,12 +49,12 @@ final class ImplementationFactory {
private ImplementationFactory() {}
static Implementation createDefaultImplementation(Loader loader, String className) {
- OMMetaFactory metaFactory = load(loader, className);
+ OMMetaFactory metaFactory = (OMMetaFactory)load(loader, className);
return metaFactory == null ? null : new Implementation(null, metaFactory,
new Feature[] { new Feature(OMAbstractFactory.FEATURE_DEFAULT, Integer.MAX_VALUE) });
}
- static OMMetaFactory load(Loader loader, String className) {
+ private static Object load(Loader loader, String className) {
Class clazz;
try {
clazz = loader.load(className);
@@ -62,7 +63,7 @@ final class ImplementationFactory {
return null;
}
try {
- return (OMMetaFactory)clazz.newInstance();
+ return clazz.newInstance();
} catch (Exception ex) {
log.error("The class " + className + " could not be instantiated", ex);
return null;
@@ -115,12 +116,12 @@ final class ImplementationFactory {
log.error("Encountered " + QNAME_IMPLEMENTATION + " element without name attribute");
return null;
}
- String className = implementation.getAttributeNS(null, "metaFactory");
- if (className.length() == 0) {
- log.error("Encountered " + QNAME_IMPLEMENTATION + " element without metaFactory attribute");
+ String loaderClassName = implementation.getAttributeNS(null, "loader");
+ if (loaderClassName.length() == 0) {
+ log.error("Encountered " + QNAME_IMPLEMENTATION + " element without loader attribute");
return null;
}
- OMMetaFactory metaFactory = load(loader, className);
+ OMMetaFactory metaFactory = ((OMMetaFactoryLoader)load(loader, loaderClassName)).load(null);
if (metaFactory == null) {
return null;
}
Added: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/locator/loader/OMMetaFactoryLoader.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/locator/loader/OMMetaFactoryLoader.java?rev=1180665&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/locator/loader/OMMetaFactoryLoader.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/locator/loader/OMMetaFactoryLoader.java Sun Oct 9 17:42:04 2011
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axiom.locator.loader;
+
+import java.util.Map;
+
+import org.apache.axiom.om.OMMetaFactory;
+
+/**
+ * Loads the {@link OMMetaFactory} for a given Axiom implementation. An Axiom implementation must
+ * provide an implementation of this interface. That implementation class is specified in the
+ * <tt>META-INF/axiom.xml</tt> of the Axiom implementation.
+ */
+public interface OMMetaFactoryLoader {
+ /**
+ * Get the {@link OMMetaFactory} instance for the Axiom implementation. Note that the
+ * implementation is not required to return the same instance on every invocation. It is the
+ * responsibility of the Axiom API to cache the instance if necessary.
+ *
+ * @param properties
+ * reserved for future use
+ * @return the {@link OMMetaFactory} instance; must not be <code>null</code>
+ */
+ OMMetaFactory load(Map properties);
+}
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/locator/loader/OMMetaFactoryLoader.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactoryLoader.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactoryLoader.java?rev=1180665&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactoryLoader.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactoryLoader.java Sun Oct 9 17:42:04 2011
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axiom.om.impl.dom.factory;
+
+import java.util.Map;
+
+import org.apache.axiom.locator.loader.OMMetaFactoryLoader;
+import org.apache.axiom.om.OMMetaFactory;
+
+public class OMDOMMetaFactoryLoader implements OMMetaFactoryLoader {
+ public OMMetaFactory load(Map properties) {
+ return new OMDOMMetaFactory();
+ }
+}
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMMetaFactoryLoader.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/resources/META-INF/axiom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/resources/META-INF/axiom.xml?rev=1180665&r1=1180664&r2=1180665&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/resources/META-INF/axiom.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/resources/META-INF/axiom.xml Sun Oct 9 17:42:04 2011
@@ -18,7 +18,7 @@
~ under the License.
-->
<implementations xmlns="http://ws.apache.org/axiom/">
- <implementation name="doom" metaFactory="org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactory">
+ <implementation name="doom" loader="org.apache.axiom.om.impl.dom.factory.OMDOMMetaFactoryLoader">
<feature name="dom" priority="100"/>
</implementation>
</implementations>
\ No newline at end of file
Added: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactoryLoader.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactoryLoader.java?rev=1180665&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactoryLoader.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactoryLoader.java Sun Oct 9 17:42:04 2011
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axiom.om.impl.llom.factory;
+
+import java.util.Map;
+
+import org.apache.axiom.locator.loader.OMMetaFactoryLoader;
+import org.apache.axiom.om.OMMetaFactory;
+
+public class OMLinkedListMetaFactoryLoader implements OMMetaFactoryLoader {
+ public OMMetaFactory load(Map properties) {
+ return new OMLinkedListMetaFactory();
+ }
+}
Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/factory/OMLinkedListMetaFactoryLoader.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/resources/META-INF/axiom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/resources/META-INF/axiom.xml?rev=1180665&r1=1180664&r2=1180665&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/resources/META-INF/axiom.xml (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/resources/META-INF/axiom.xml Sun Oct 9 17:42:04 2011
@@ -18,7 +18,7 @@
~ under the License.
-->
<implementations xmlns="http://ws.apache.org/axiom/">
- <implementation name="llom" metaFactory="org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactory">
+ <implementation name="llom" loader="org.apache.axiom.om.impl.llom.factory.OMLinkedListMetaFactoryLoader">
<feature name="default" priority="100"/>
</implementation>
</implementations>
\ No newline at end of file