You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by da...@apache.org on 2007/03/24 14:10:49 UTC
svn commit: r522016 [2/3] - in
/webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi:
./ descriptor/ internal/ routing/ util/
Modified: webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiDeploymentDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiDeploymentDescriptor.java?view=diff&rev=522016&r1=522015&r2=522016
==============================================================================
--- webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiDeploymentDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiDeploymentDescriptor.java Sat Mar 24 06:10:47 2007
@@ -1,310 +1,313 @@
-/*=============================================================================*
- * Copyright 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-
-
-package org.apache.muse.core.platform.osgi.descriptor;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import javax.xml.namespace.QName;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import org.osgi.framework.Bundle;
-
-import org.apache.muse.core.Environment;
-import org.apache.muse.core.descriptor.DeploymentDescriptor;
-import org.apache.muse.core.descriptor.DescriptorConstants;
-import org.apache.muse.core.descriptor.PersistenceDefinition;
-import org.apache.muse.core.descriptor.ResourceDefinition;
-import org.apache.muse.core.descriptor.ResourceDescriptor;
-import org.apache.muse.core.descriptor.RouterDefinition;
-import org.apache.muse.core.descriptor.RouterDescriptor;
-import org.apache.muse.core.descriptor.SerializerDefinition;
-import org.apache.muse.core.descriptor.SerializerDescriptor;
-import org.apache.muse.core.descriptor.SimpleDeploymentDescriptor;
-import org.apache.muse.core.descriptor.SimpleSerializerDescriptor;
-import org.apache.muse.util.messages.Messages;
-import org.apache.muse.util.messages.MessagesFactory;
-import org.apache.muse.util.xml.XmlUtils;
-import org.apache.muse.ws.addressing.soap.SoapFault;
-
-
-/**
- *
- * OSGiDeploymentDescriptor is an implementation of <code>DeploymentDescriptor</code>
- * specific to the OSGi environment
- *
- * @see DeploymentDescriptor
- * @author Joel Hawkins (joelh)
- *
- */
-
-public class OSGiDeploymentDescriptor implements DeploymentDescriptor {
-
- //
- // Used to lookup all exception messages
- //
- private static Messages _MESSAGES = MessagesFactory.get(SimpleDeploymentDescriptor.class);
-
- //
- // Stores info on the concrete implementations of the resource type.
- // There will be at least one resource-instance in the factory.
- //
- private Collection _resourceDefinitions = null;
-
- //
- // The data used to instantiate the router
- //
- private static RouterDefinition _routerDefinition = null;
- private RouterDefinition _localRouterDefinition = null;
-
- private Collection _serializerDefinitions = null;
- private PersistenceDefinition _localPersistenceDefinition;
-
- /**
- * the Bundle the current deployment descriptor was loaded from
- */
- protected Bundle bundle;
-
- /**
- * setter for the decriptor Bundle
- * @param bundle
- */
- public void setBundle(Bundle bundle) {
- this.bundle = bundle;
- }
-
- /**
- * Loads the context paths from the muse.xml descriptor
- * @param xml
- * @param env
- * @return the context paths contianed by the descriptor
- * @throws SoapFault
- *
- * @see DeploymentDescriptor#loadContextPaths(Document, Environment)
- */
- public Collection loadContextPaths(Document xml, Environment env)
- throws SoapFault {
- if (xml == null)
- throw new NullPointerException(_MESSAGES.get("NullDescriptorDocument"));
-
- Element root = XmlUtils.getElement(xml, DescriptorConstants.MUSE_QNAME);
-
- Element[] resourceXML = XmlUtils.getElements(root,
- DescriptorConstants.RESOURCE_TYPE_QNAME);
-
- ArrayList contextPaths = new ArrayList(resourceXML.length);
-
- QName qname = DescriptorConstants.CONTEXT_PATH_QNAME;
- for (int n = 0; n < resourceXML.length; ++n) {
- String path = XmlUtils.getElementText(resourceXML[n], qname);
-
- if (path == null)
- continue;
-
- contextPaths.add(path);
- }
- return contextPaths;
- }
-
-
- public String getWsdlPathForContext(Document xml, String context) throws SoapFault {
- if (xml == null)
- throw new NullPointerException(_MESSAGES.get("NullDescriptorDocument"));
-
- if (context == null) return null;
-
- Element root = XmlUtils.getElement(xml, DescriptorConstants.MUSE_QNAME);
-
- Element[] resourceXML = XmlUtils.getElements(root,
- DescriptorConstants.RESOURCE_TYPE_QNAME);
- if(resourceXML == null) return null;
- QName qname = DescriptorConstants.CONTEXT_PATH_QNAME;
- for(int i=0;i<resourceXML.length;i++){
- String path = XmlUtils.getElementText(resourceXML[i], qname);
- if(context.equals(path)){
- Element wsdlElement = XmlUtils.getElement(resourceXML[i], DescriptorConstants.WSDL_QNAME);
- if(wsdlElement != null)
- return XmlUtils.getElementText(wsdlElement,DescriptorConstants.WSDL_FILE_QNAME);
- break;
- }
- }
- return null;
- }
-
- /**
- * loads the descriptor from the muse.xml document.
- * @see DeploymentDescriptor#load(Document, Environment)
- */
- public void load(Document xml, Environment environment) throws SoapFault {
- if (xml == null)
- throw new NullPointerException(_MESSAGES.get("NullDescriptorDocument"));
-
- Element root = XmlUtils.getElement(xml, DescriptorConstants.MUSE_QNAME);
-
- //
- // make sure we're starting with a valid DD (<muse/>)
- //
- // FIXME: if (root == null)
-
- //
- // any user-defined serializers must be loaded before we try to
- // load the operations/handlers
- //
- _serializerDefinitions = createSerializerDefinitions(root, environment);
-
- //
- // one router used to map all resource types...
- //
- // Ignored - OSGi Router mandated by default plugin
- RouterDefinition localRouter;
- if (_routerDefinition == null)
- _localRouterDefinition = _routerDefinition = createRouterDefinition(root, environment);
- else
- _localRouterDefinition = createRouterDefinition(root, environment);
-
- //
- // there will be one definition for each resource type
- //
- _resourceDefinitions = createResourceDefinitions(root, environment);
-
- if (_localRouterDefinition != null)
- _localRouterDefinition.setResourceDefinitions(_resourceDefinitions);
- }
-
- /**
- * creates the set of resource definitions for a deployment descriptor.
- * @param xml
- * @param env
- * @return a collection of <code>OSGiResourceDescriptor</code> objects
- * @throws SoapFault
- *
- * @see OSGiResourceDescriptor
- */
- protected Collection createResourceDefinitions(Element xml, Environment env)
- throws SoapFault {
- Element[] resourceXML = XmlUtils.getElements(xml,
- DescriptorConstants.RESOURCE_TYPE_QNAME);
-
- Collection definitions = new ArrayList(resourceXML.length);
-
- for (int n = 0; n < resourceXML.length; ++n) {
- OSGiResourceDescriptor rd = (OSGiResourceDescriptor) createResourceDescriptor();
- rd.setBundle(bundle);
- rd.load(resourceXML[n], env);
-
- ResourceDefinition definition = rd.getResourceDefinition();
- definitions.add(definition);
- }
-
- return definitions;
- }
-
- /**
- * factory method for creating ResourceDescriptors
- * @return an <code>OSGiResourceDescriptor</code> instance
- *
- * @see OSGiResourceDescriptor
- */
- protected ResourceDescriptor createResourceDescriptor() {
- return new OSGiResourceDescriptor();
- }
-
- /**
- * factory method for creating RouterDescriptors
- * @return a <code>OSGiRouterDescriptor</code> instance
- *
- * @see OSGiRouterDescriptor
- */
- protected RouterDescriptor createRouterDescriptor() {
- return new OSGiRouterDescriptor();
- }
-
- /** factory method for creating RouterDefinitions
- *
- * @param xml
- * @param env
- * @return a RouterDefinition instance
- * @throws SoapFault
- */
- protected RouterDefinition createRouterDefinition(Element xml,
- Environment env) throws SoapFault {
- Element routerXML = XmlUtils.getElement(xml,
- DescriptorConstants.ROUTER_QNAME);
-
- RouterDescriptor rd = createRouterDescriptor();
- rd.load(routerXML, env);
-
- return rd.getRouterDefinition();
- }
-
- protected SerializerDescriptor createSerializerDescriptor() {
- return new SimpleSerializerDescriptor();
- }
-
- public Collection createSerializerDefinitions(Element xml, Environment env)
- throws SoapFault {
- QName qname = DescriptorConstants.CUSTOM_SERIALIZER_QNAME;
- Element[] serializerXML = XmlUtils.getElements(xml, qname);
-
- Collection definitions = new ArrayList(serializerXML.length);
-
- for (int n = 0; n < serializerXML.length; ++n) {
- SerializerDescriptor sd = createSerializerDescriptor();
- sd.load(serializerXML[n], env);
-
- SerializerDefinition definition = sd.getSerializerDefinition();
- definitions.add(definition);
- }
-
- return definitions;
- }
-
- public Collection getSerializerDefinitions() {
- return _serializerDefinitions;
- }
-
- public Collection getResourceDefinitions() {
- return _resourceDefinitions;
- }
-
- public RouterDefinition getRouterDefinition() {
- return _localRouterDefinition;
- }
-
- public void setSerializerDefinitions(Collection definitions) {
- _serializerDefinitions = definitions;
- }
-
- public void setResourceDefinitions(Collection definitions) {
- _resourceDefinitions = definitions;
- }
-
- public void setRouterDefinition(RouterDefinition definition) {
- _localRouterDefinition = definition;
- }
-
- public Element toXML() {
- return toXML(XmlUtils.EMPTY_DOC);
- }
-
- public Element toXML(Document doc) {
- throw new UnsupportedOperationException("Use SimpleDeploymentDescriptor for descriptor serialization.");
- }
-}
+/*
+ * 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.muse.core.platform.osgi.descriptor;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.osgi.framework.Bundle;
+
+import org.apache.muse.core.Environment;
+import org.apache.muse.core.descriptor.DeploymentDescriptor;
+import org.apache.muse.core.descriptor.DescriptorConstants;
+import org.apache.muse.core.descriptor.PersistenceDefinition;
+import org.apache.muse.core.descriptor.ResourceDefinition;
+import org.apache.muse.core.descriptor.ResourceDescriptor;
+import org.apache.muse.core.descriptor.RouterDefinition;
+import org.apache.muse.core.descriptor.RouterDescriptor;
+import org.apache.muse.core.descriptor.SerializerDefinition;
+import org.apache.muse.core.descriptor.SerializerDescriptor;
+import org.apache.muse.core.descriptor.SimpleDeploymentDescriptor;
+import org.apache.muse.core.descriptor.SimpleSerializerDescriptor;
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+
+
+/**
+ *
+ * OSGiDeploymentDescriptor is an implementation of <code>DeploymentDescriptor</code>
+ * specific to the OSGi environment
+ *
+ * @see DeploymentDescriptor
+ * @author Joel Hawkins (joelh)
+ *
+ */
+
+public class OSGiDeploymentDescriptor implements DeploymentDescriptor {
+
+ //
+ // Used to lookup all exception messages
+ //
+ private static Messages _MESSAGES = MessagesFactory.get(SimpleDeploymentDescriptor.class);
+
+ //
+ // Stores info on the concrete implementations of the resource type.
+ // There will be at least one resource-instance in the factory.
+ //
+ private Collection _resourceDefinitions = null;
+
+ //
+ // The data used to instantiate the router
+ //
+ private static RouterDefinition _routerDefinition = null;
+ private RouterDefinition _localRouterDefinition = null;
+
+ private Collection _serializerDefinitions = null;
+ private PersistenceDefinition _localPersistenceDefinition;
+
+ /**
+ * the Bundle the current deployment descriptor was loaded from
+ */
+ protected Bundle bundle;
+
+ /**
+ * setter for the decriptor Bundle
+ * @param bundle
+ */
+ public void setBundle(Bundle bundle) {
+ this.bundle = bundle;
+ }
+
+ /**
+ * Loads the context paths from the muse.xml descriptor
+ * @param xml
+ * @param env
+ * @return the context paths contianed by the descriptor
+ * @throws SoapFault
+ *
+ * @see DeploymentDescriptor#loadContextPaths(Document, Environment)
+ */
+ public Collection loadContextPaths(Document xml, Environment env)
+ throws SoapFault {
+ if (xml == null)
+ throw new NullPointerException(_MESSAGES.get("NullDescriptorDocument"));
+
+ Element root = XmlUtils.getElement(xml, DescriptorConstants.MUSE_QNAME);
+
+ Element[] resourceXML = XmlUtils.getElements(root,
+ DescriptorConstants.RESOURCE_TYPE_QNAME);
+
+ ArrayList contextPaths = new ArrayList(resourceXML.length);
+
+ QName qname = DescriptorConstants.CONTEXT_PATH_QNAME;
+ for (int n = 0; n < resourceXML.length; ++n) {
+ String path = XmlUtils.getElementText(resourceXML[n], qname);
+
+ if (path == null)
+ continue;
+
+ contextPaths.add(path);
+ }
+ return contextPaths;
+ }
+
+
+ public String getWsdlPathForContext(Document xml, String context) throws SoapFault {
+ if (xml == null)
+ throw new NullPointerException(_MESSAGES.get("NullDescriptorDocument"));
+
+ if (context == null) return null;
+
+ Element root = XmlUtils.getElement(xml, DescriptorConstants.MUSE_QNAME);
+
+ Element[] resourceXML = XmlUtils.getElements(root,
+ DescriptorConstants.RESOURCE_TYPE_QNAME);
+ if(resourceXML == null) return null;
+ QName qname = DescriptorConstants.CONTEXT_PATH_QNAME;
+ for(int i=0;i<resourceXML.length;i++){
+ String path = XmlUtils.getElementText(resourceXML[i], qname);
+ if(context.equals(path)){
+ Element wsdlElement = XmlUtils.getElement(resourceXML[i], DescriptorConstants.WSDL_QNAME);
+ if(wsdlElement != null)
+ return XmlUtils.getElementText(wsdlElement,DescriptorConstants.WSDL_FILE_QNAME);
+ break;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * loads the descriptor from the muse.xml document.
+ * @see DeploymentDescriptor#load(Document, Environment)
+ */
+ public void load(Document xml, Environment environment) throws SoapFault {
+ if (xml == null)
+ throw new NullPointerException(_MESSAGES.get("NullDescriptorDocument"));
+
+ Element root = XmlUtils.getElement(xml, DescriptorConstants.MUSE_QNAME);
+
+ //
+ // make sure we're starting with a valid DD (<muse/>)
+ //
+ // FIXME: if (root == null)
+
+ //
+ // any user-defined serializers must be loaded before we try to
+ // load the operations/handlers
+ //
+ _serializerDefinitions = createSerializerDefinitions(root, environment);
+
+ //
+ // one router used to map all resource types...
+ //
+ // Ignored - OSGi Router mandated by default plugin
+ RouterDefinition localRouter;
+ if (_routerDefinition == null)
+ _localRouterDefinition = _routerDefinition = createRouterDefinition(root, environment);
+ else
+ _localRouterDefinition = createRouterDefinition(root, environment);
+
+ //
+ // there will be one definition for each resource type
+ //
+ _resourceDefinitions = createResourceDefinitions(root, environment);
+
+ if (_localRouterDefinition != null)
+ _localRouterDefinition.setResourceDefinitions(_resourceDefinitions);
+ }
+
+ /**
+ * creates the set of resource definitions for a deployment descriptor.
+ * @param xml
+ * @param env
+ * @return a collection of <code>OSGiResourceDescriptor</code> objects
+ * @throws SoapFault
+ *
+ * @see OSGiResourceDescriptor
+ */
+ protected Collection createResourceDefinitions(Element xml, Environment env)
+ throws SoapFault {
+ Element[] resourceXML = XmlUtils.getElements(xml,
+ DescriptorConstants.RESOURCE_TYPE_QNAME);
+
+ Collection definitions = new ArrayList(resourceXML.length);
+
+ for (int n = 0; n < resourceXML.length; ++n) {
+ OSGiResourceDescriptor rd = (OSGiResourceDescriptor) createResourceDescriptor();
+ rd.setBundle(bundle);
+ rd.load(resourceXML[n], env);
+
+ ResourceDefinition definition = rd.getResourceDefinition();
+ definitions.add(definition);
+ }
+
+ return definitions;
+ }
+
+ /**
+ * factory method for creating ResourceDescriptors
+ * @return an <code>OSGiResourceDescriptor</code> instance
+ *
+ * @see OSGiResourceDescriptor
+ */
+ protected ResourceDescriptor createResourceDescriptor() {
+ return new OSGiResourceDescriptor();
+ }
+
+ /**
+ * factory method for creating RouterDescriptors
+ * @return a <code>OSGiRouterDescriptor</code> instance
+ *
+ * @see OSGiRouterDescriptor
+ */
+ protected RouterDescriptor createRouterDescriptor() {
+ return new OSGiRouterDescriptor();
+ }
+
+ /** factory method for creating RouterDefinitions
+ *
+ * @param xml
+ * @param env
+ * @return a RouterDefinition instance
+ * @throws SoapFault
+ */
+ protected RouterDefinition createRouterDefinition(Element xml,
+ Environment env) throws SoapFault {
+ Element routerXML = XmlUtils.getElement(xml,
+ DescriptorConstants.ROUTER_QNAME);
+
+ RouterDescriptor rd = createRouterDescriptor();
+ rd.load(routerXML, env);
+
+ return rd.getRouterDefinition();
+ }
+
+ protected SerializerDescriptor createSerializerDescriptor() {
+ return new SimpleSerializerDescriptor();
+ }
+
+ public Collection createSerializerDefinitions(Element xml, Environment env)
+ throws SoapFault {
+ QName qname = DescriptorConstants.CUSTOM_SERIALIZER_QNAME;
+ Element[] serializerXML = XmlUtils.getElements(xml, qname);
+
+ Collection definitions = new ArrayList(serializerXML.length);
+
+ for (int n = 0; n < serializerXML.length; ++n) {
+ SerializerDescriptor sd = createSerializerDescriptor();
+ sd.load(serializerXML[n], env);
+
+ SerializerDefinition definition = sd.getSerializerDefinition();
+ definitions.add(definition);
+ }
+
+ return definitions;
+ }
+
+ public Collection getSerializerDefinitions() {
+ return _serializerDefinitions;
+ }
+
+ public Collection getResourceDefinitions() {
+ return _resourceDefinitions;
+ }
+
+ public RouterDefinition getRouterDefinition() {
+ return _localRouterDefinition;
+ }
+
+ public void setSerializerDefinitions(Collection definitions) {
+ _serializerDefinitions = definitions;
+ }
+
+ public void setResourceDefinitions(Collection definitions) {
+ _resourceDefinitions = definitions;
+ }
+
+ public void setRouterDefinition(RouterDefinition definition) {
+ _localRouterDefinition = definition;
+ }
+
+ public Element toXML() {
+ return toXML(XmlUtils.EMPTY_DOC);
+ }
+
+ public Element toXML(Document doc) {
+ throw new UnsupportedOperationException("Use SimpleDeploymentDescriptor for descriptor serialization.");
+ }
+}
Modified: webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiLoggingConfig.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiLoggingConfig.java?view=diff&rev=522016&r1=522015&r2=522016
==============================================================================
--- webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiLoggingConfig.java (original)
+++ webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiLoggingConfig.java Sat Mar 24 06:10:47 2007
@@ -1,59 +1,63 @@
-/*=============================================================================*
- * Copyright 2007 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-
-package org.apache.muse.core.platform.osgi.descriptor;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.logging.Handler;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.FileHandler;
-import java.util.logging.SimpleFormatter;
-
-import org.apache.muse.core.descriptor.LoggingConfig;
-import org.apache.muse.core.platform.osgi.OSGiLogHandler;
-
-/**
- *
- * @author Barry Atkins
- *
- */
-
-public class OSGiLoggingConfig extends LoggingConfig
-{
- protected Handler createLogHandler(File logFile)
- {
- Handler handler = null;
-
- try
- {
- handler = new OSGiLogHandler(logFile.getAbsolutePath());
- }
-
- catch (IOException error)
- {
- //
- // what can we do? redirect errors to stderr/console
- //
- error.printStackTrace();
- handler = new ConsoleHandler();
- }
-
- handler.setFormatter(new SimpleFormatter());
- return handler;
- }
-
-}
+/*
+ * 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.muse.core.platform.osgi.descriptor;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.logging.Handler;
+import java.util.logging.ConsoleHandler;
+import java.util.logging.FileHandler;
+import java.util.logging.SimpleFormatter;
+
+import org.apache.muse.core.descriptor.LoggingConfig;
+import org.apache.muse.core.platform.osgi.OSGiLogHandler;
+
+/**
+ *
+ * @author Barry Atkins
+ *
+ */
+
+public class OSGiLoggingConfig extends LoggingConfig
+{
+ protected Handler createLogHandler(File logFile)
+ {
+ Handler handler = null;
+
+ try
+ {
+ handler = new OSGiLogHandler(logFile.getAbsolutePath());
+ }
+
+ catch (IOException error)
+ {
+ //
+ // what can we do? redirect errors to stderr/console
+ //
+ error.printStackTrace();
+ handler = new ConsoleHandler();
+ }
+
+ handler.setFormatter(new SimpleFormatter());
+ return handler;
+ }
+
+}
Modified: webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiResourceDefinition.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiResourceDefinition.java?view=diff&rev=522016&r1=522015&r2=522016
==============================================================================
--- webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiResourceDefinition.java (original)
+++ webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiResourceDefinition.java Sat Mar 24 06:10:47 2007
@@ -1,53 +1,56 @@
-/*=============================================================================*
- * Copyright 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-
-
-package org.apache.muse.core.platform.osgi.descriptor;
-
-import org.apache.muse.core.descriptor.ResourceDefinition;
-import org.apache.muse.core.Resource;
-import org.osgi.framework.Bundle;
-
-/**
- *
- * OSGiResourceDefinition is an OSGi-aware extension of the
- * <code>ResourceDefinition</code> class.
- *
- * @author Joel Hawkins (joelh)
- *
- */
-
-public class OSGiResourceDefinition extends ResourceDefinition {
-
- /**
- * the Bundle that owns the resource definition
- */
- protected Bundle bundle;
-
- /**
- * Constructor
- * @param bundle
- */
- public OSGiResourceDefinition(Bundle bundle){
- this.bundle = bundle;
- }
-
- public Resource newInstance(){
- Resource instance = super.newInstance();
- return instance;
- }
-
-}
+/*
+ * 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.muse.core.platform.osgi.descriptor;
+
+import org.apache.muse.core.descriptor.ResourceDefinition;
+import org.apache.muse.core.Resource;
+import org.osgi.framework.Bundle;
+
+/**
+ *
+ * OSGiResourceDefinition is an OSGi-aware extension of the
+ * <code>ResourceDefinition</code> class.
+ *
+ * @author Joel Hawkins (joelh)
+ *
+ */
+
+public class OSGiResourceDefinition extends ResourceDefinition {
+
+ /**
+ * the Bundle that owns the resource definition
+ */
+ protected Bundle bundle;
+
+ /**
+ * Constructor
+ * @param bundle
+ */
+ public OSGiResourceDefinition(Bundle bundle){
+ this.bundle = bundle;
+ }
+
+ public Resource newInstance(){
+ Resource instance = super.newInstance();
+ return instance;
+ }
+
+}
Modified: webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiResourceDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiResourceDescriptor.java?view=diff&rev=522016&r1=522015&r2=522016
==============================================================================
--- webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiResourceDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiResourceDescriptor.java Sat Mar 24 06:10:47 2007
@@ -1,281 +1,284 @@
-/*=============================================================================*
- * Copyright 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-
-
-package org.apache.muse.core.platform.osgi.descriptor;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Operation;
-import javax.wsdl.Output;
-import javax.wsdl.Part;
-import javax.wsdl.PortType;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.wsdl.xml.WSDLLocator;
-import javax.xml.namespace.QName;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.InputSource;
-
-import org.osgi.framework.Bundle;
-
-import org.apache.muse.core.Environment;
-import org.apache.muse.core.Resource;
-import org.apache.muse.core.descriptor.CapabilityDescriptor;
-import org.apache.muse.core.descriptor.DescriptorConstants;
-import org.apache.muse.core.descriptor.ResourceDefinition;
-import org.apache.muse.core.descriptor.SimpleResourceDescriptor;
-import org.apache.muse.core.descriptor.WsdlConfig;
-import org.apache.muse.core.platform.osgi.util.OSGiReflectUtilHelper;
-import org.apache.muse.util.ReflectUtils;
-import org.apache.muse.util.messages.Messages;
-import org.apache.muse.util.messages.MessagesFactory;
-import org.apache.muse.util.xml.XmlUtils;
-import org.apache.muse.util.xml.XsdUtils;
-import org.apache.muse.ws.wsdl.WsdlUtils;
-
-/**
- *
- * OSGiResourceDescriptor is an OSGi-aware implementation of the
- * <code>SimpleResourceDescriptor</code> class, which implements the
- * <code>ResourceDescriptor</code> interface
- *
- * @see ResourceDecriptor
- * @author Joel Hawkins (joelh)
- *
- */
-
-public class OSGiResourceDescriptor extends SimpleResourceDescriptor {
-
- private static class OSGiWsdlLocator implements WSDLLocator {
-
- private Bundle bundle;
-
- private WsdlConfig wsdlConfig;
-
- private String baseURI = "";
-
- private String lastPath = "";
-
- public OSGiWsdlLocator(Bundle bundle, WsdlConfig wsdlConfig) {
- this.bundle = bundle;
- this.wsdlConfig = wsdlConfig;
- }
-
- public InputSource getBaseInputSource() {
- String path = wsdlConfig.getWsdlPath();
- URL url = bundle.getResource(path);
- InputStream stream = null;
- if(url == null){
- stream = OSGiReflectUtilHelper.getDefault().getResource(path);
- }
- try {
- if(stream == null) stream = url.openStream();
- } catch (Throwable t) {
- return null;
- }
- if (stream != null)
- return new InputSource(stream);
- return null;
- }
-
- public String getBaseURI() {
- // TODO clean up this code
- if (wsdlConfig.getWsdlPath().startsWith("/OSGI-INF/wsdl"))
- baseURI = "/OSGI-INF/wsdl";
- if(wsdlConfig.getWsdlPath().startsWith("/wsdl"))
- baseURI = "/wsdl";
- baseURI="";
- return baseURI;
- }
-
- public InputSource getImportInputSource(String base, String path) {
- lastPath = path;
- String fullPath = path;
- if (base != null) {
- fullPath = base + "/" + path;
- }
- URL url = bundle.getResource(fullPath);
- InputStream stream = null;
- if(url == null){
- stream = OSGiReflectUtilHelper.getDefault().getResource(fullPath);
- }
- try {
- if(stream == null) stream = url.openStream();
- this.lastPath = fullPath;
- } catch (Throwable t) {
- return null;
- }
- if (stream != null)
- return new InputSource(stream);
- return null;
- }
-
- public String getLatestImportURI() {
- return lastPath;
- }
-
- public void close(){
- // to satisfy WSDL4J 1.6.x
- }
-
- };
-
- private static Messages _MESSAGES = MessagesFactory
- .get(SimpleResourceDescriptor.class);
-
- protected Bundle bundle;
-
- public void setBundle(Bundle bundle) {
- this.bundle = bundle;
- }
-
- /**
- * resolves the resource class from the resource decriptor
- * @param xml the xml Element representing the resource class
- * @param env the Muse Environment
- * @return the Class for the resource
- */
- protected Class createResourceClass(Element xml, Environment env) {
- QName qname = DescriptorConstants.JAVA_RESOURCE_QNAME;
- String className = XmlUtils.getElementText(xml, qname);
-
- if (className == null)
- throw new RuntimeException(_MESSAGES.get("NullJavaBase"));
- ClassLoader loader = env.getClassLoader();
- Class resourceClass = null;
-
- if (bundle == null) {
- loader = env.getClassLoader();
- resourceClass = ReflectUtils.getClass(className, loader);
- } else {
- try {
- resourceClass = ReflectUtils.getClass(className,loader);
- if(resourceClass == null){
- resourceClass = bundle.loadClass(className);
- }
- } catch (ClassNotFoundException e) {
- throw new RuntimeException("Class Not Found " + className);
- }
- }
-
- if (!Resource.class.isAssignableFrom(resourceClass)) {
- Object[] filler = { className, Resource.class.getName() };
- String message = _MESSAGES.get("IncorrectResourceRoot", filler);
- throw new RuntimeException(message);
- }
-
- return resourceClass;
- }
-
-
- /**
- * returns the operations from the wsdl document, using an internal WSDLLocator implementation
- * that allows access to wsdl and schema imports from external Bundles.
- * @param wsdlDoc the <code>Document</code> representing the wsdl for the resource type
- * @param wsdlConfig the wsdl configuration used to establish context for other documents
- * referenced from the inital wsdl.
- * @param env the Muse Environment
- * @return a <code>Map</code> containing the wsdl Operations keyed by their respective
- * WSA Actions
- */
- protected Map getWsdlOperations(Document wsdlDoc,
- WsdlConfig wsdlConfig,
- Environment env)
- {
- String wsdlPath = wsdlConfig.getWsdlPath();
- String absolutePath = env.getRealDirectory().getAbsolutePath();
-
- if (wsdlPath.charAt(0) != '/')
- absolutePath += '/';
-
- absolutePath += wsdlPath;
- File wsdlFile = new File(absolutePath);
- File wsdlDir = wsdlFile.getParentFile();
-
- Definition def = null;
-
- //
- // use WSDL4J to parse/validate the WSDL
- //
- try {
-
- WSDLFactory factory = WSDLFactory.newInstance();
- WSDLReader reader = factory.newWSDLReader();
- javax.wsdl.xml.WSDLLocator locator = new OSGiWsdlLocator(bundle,
- wsdlConfig);
- reader.setFeature("javax.wsdl.verbose", false);
- def = reader.readWSDL(locator);
-
- }
-
- catch (Exception error) {
- throw new RuntimeException(error.getMessage(), error);
- }
-
-// find the port type named in the descriptor and process
-// all of the operations
-
- QName portTypeName = wsdlConfig.getWsdlPortType();
- PortType portType = def.getPortType(portTypeName);
-
- if (portType == null) // FIXME: extract message
- throw new RuntimeException("No port type of name " + portType);
-
- Collection ops = portType.getOperations();
- Iterator i = ops.iterator();
-
- Map opsByAction = new HashMap();
-
- while (i.hasNext())
- {
- Operation next = (Operation)i.next();
- String action = WsdlUtils.getAction(next);
- opsByAction.put(action, next);
- }
-
- return opsByAction;
- }
-
-
- /**
- * factory method for creating Capability Descriptors
- * @return a new OSGiCapabilityDescriptor
- */
- protected CapabilityDescriptor createCapabilityDescriptor() {
- return new OSGiCapabilityDescriptor(bundle);
- }
-
- /**
- * factory method for creating ResourceDefinitions
- * @return a new OSGiResourceDefinition
- */
- protected ResourceDefinition createResourceDefinition(){
- return new OSGiResourceDefinition(bundle);
- }
-
-
-}
+/*
+ * 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.muse.core.platform.osgi.descriptor;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.PortType;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.wsdl.xml.WSDLLocator;
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
+
+import org.osgi.framework.Bundle;
+
+import org.apache.muse.core.Environment;
+import org.apache.muse.core.Resource;
+import org.apache.muse.core.descriptor.CapabilityDescriptor;
+import org.apache.muse.core.descriptor.DescriptorConstants;
+import org.apache.muse.core.descriptor.ResourceDefinition;
+import org.apache.muse.core.descriptor.SimpleResourceDescriptor;
+import org.apache.muse.core.descriptor.WsdlConfig;
+import org.apache.muse.core.platform.osgi.util.OSGiReflectUtilHelper;
+import org.apache.muse.util.ReflectUtils;
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.util.xml.XsdUtils;
+import org.apache.muse.ws.wsdl.WsdlUtils;
+
+/**
+ *
+ * OSGiResourceDescriptor is an OSGi-aware implementation of the
+ * <code>SimpleResourceDescriptor</code> class, which implements the
+ * <code>ResourceDescriptor</code> interface
+ *
+ * @see ResourceDecriptor
+ * @author Joel Hawkins (joelh)
+ *
+ */
+
+public class OSGiResourceDescriptor extends SimpleResourceDescriptor {
+
+ private static class OSGiWsdlLocator implements WSDLLocator {
+
+ private Bundle bundle;
+
+ private WsdlConfig wsdlConfig;
+
+ private String baseURI = "";
+
+ private String lastPath = "";
+
+ public OSGiWsdlLocator(Bundle bundle, WsdlConfig wsdlConfig) {
+ this.bundle = bundle;
+ this.wsdlConfig = wsdlConfig;
+ }
+
+ public InputSource getBaseInputSource() {
+ String path = wsdlConfig.getWsdlPath();
+ URL url = bundle.getResource(path);
+ InputStream stream = null;
+ if(url == null){
+ stream = OSGiReflectUtilHelper.getDefault().getResource(path);
+ }
+ try {
+ if(stream == null) stream = url.openStream();
+ } catch (Throwable t) {
+ return null;
+ }
+ if (stream != null)
+ return new InputSource(stream);
+ return null;
+ }
+
+ public String getBaseURI() {
+ // TODO clean up this code
+ if (wsdlConfig.getWsdlPath().startsWith("/OSGI-INF/wsdl"))
+ baseURI = "/OSGI-INF/wsdl";
+ if(wsdlConfig.getWsdlPath().startsWith("/wsdl"))
+ baseURI = "/wsdl";
+ baseURI="";
+ return baseURI;
+ }
+
+ public InputSource getImportInputSource(String base, String path) {
+ lastPath = path;
+ String fullPath = path;
+ if (base != null) {
+ fullPath = base + "/" + path;
+ }
+ URL url = bundle.getResource(fullPath);
+ InputStream stream = null;
+ if(url == null){
+ stream = OSGiReflectUtilHelper.getDefault().getResource(fullPath);
+ }
+ try {
+ if(stream == null) stream = url.openStream();
+ this.lastPath = fullPath;
+ } catch (Throwable t) {
+ return null;
+ }
+ if (stream != null)
+ return new InputSource(stream);
+ return null;
+ }
+
+ public String getLatestImportURI() {
+ return lastPath;
+ }
+
+ public void close(){
+ // to satisfy WSDL4J 1.6.x
+ }
+
+ };
+
+ private static Messages _MESSAGES = MessagesFactory
+ .get(SimpleResourceDescriptor.class);
+
+ protected Bundle bundle;
+
+ public void setBundle(Bundle bundle) {
+ this.bundle = bundle;
+ }
+
+ /**
+ * resolves the resource class from the resource decriptor
+ * @param xml the xml Element representing the resource class
+ * @param env the Muse Environment
+ * @return the Class for the resource
+ */
+ protected Class createResourceClass(Element xml, Environment env) {
+ QName qname = DescriptorConstants.JAVA_RESOURCE_QNAME;
+ String className = XmlUtils.getElementText(xml, qname);
+
+ if (className == null)
+ throw new RuntimeException(_MESSAGES.get("NullJavaBase"));
+ ClassLoader loader = env.getClassLoader();
+ Class resourceClass = null;
+
+ if (bundle == null) {
+ loader = env.getClassLoader();
+ resourceClass = ReflectUtils.getClass(className, loader);
+ } else {
+ try {
+ resourceClass = ReflectUtils.getClass(className,loader);
+ if(resourceClass == null){
+ resourceClass = bundle.loadClass(className);
+ }
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Class Not Found " + className);
+ }
+ }
+
+ if (!Resource.class.isAssignableFrom(resourceClass)) {
+ Object[] filler = { className, Resource.class.getName() };
+ String message = _MESSAGES.get("IncorrectResourceRoot", filler);
+ throw new RuntimeException(message);
+ }
+
+ return resourceClass;
+ }
+
+
+ /**
+ * returns the operations from the wsdl document, using an internal WSDLLocator implementation
+ * that allows access to wsdl and schema imports from external Bundles.
+ * @param wsdlDoc the <code>Document</code> representing the wsdl for the resource type
+ * @param wsdlConfig the wsdl configuration used to establish context for other documents
+ * referenced from the inital wsdl.
+ * @param env the Muse Environment
+ * @return a <code>Map</code> containing the wsdl Operations keyed by their respective
+ * WSA Actions
+ */
+ protected Map getWsdlOperations(Document wsdlDoc,
+ WsdlConfig wsdlConfig,
+ Environment env)
+ {
+ String wsdlPath = wsdlConfig.getWsdlPath();
+ String absolutePath = env.getRealDirectory().getAbsolutePath();
+
+ if (wsdlPath.charAt(0) != '/')
+ absolutePath += '/';
+
+ absolutePath += wsdlPath;
+ File wsdlFile = new File(absolutePath);
+ File wsdlDir = wsdlFile.getParentFile();
+
+ Definition def = null;
+
+ //
+ // use WSDL4J to parse/validate the WSDL
+ //
+ try {
+
+ WSDLFactory factory = WSDLFactory.newInstance();
+ WSDLReader reader = factory.newWSDLReader();
+ javax.wsdl.xml.WSDLLocator locator = new OSGiWsdlLocator(bundle,
+ wsdlConfig);
+ reader.setFeature("javax.wsdl.verbose", false);
+ def = reader.readWSDL(locator);
+
+ }
+
+ catch (Exception error) {
+ throw new RuntimeException(error.getMessage(), error);
+ }
+
+// find the port type named in the descriptor and process
+// all of the operations
+
+ QName portTypeName = wsdlConfig.getWsdlPortType();
+ PortType portType = def.getPortType(portTypeName);
+
+ if (portType == null) // FIXME: extract message
+ throw new RuntimeException("No port type of name " + portType);
+
+ Collection ops = portType.getOperations();
+ Iterator i = ops.iterator();
+
+ Map opsByAction = new HashMap();
+
+ while (i.hasNext())
+ {
+ Operation next = (Operation)i.next();
+ String action = WsdlUtils.getAction(next);
+ opsByAction.put(action, next);
+ }
+
+ return opsByAction;
+ }
+
+
+ /**
+ * factory method for creating Capability Descriptors
+ * @return a new OSGiCapabilityDescriptor
+ */
+ protected CapabilityDescriptor createCapabilityDescriptor() {
+ return new OSGiCapabilityDescriptor(bundle);
+ }
+
+ /**
+ * factory method for creating ResourceDefinitions
+ * @return a new OSGiResourceDefinition
+ */
+ protected ResourceDefinition createResourceDefinition(){
+ return new OSGiResourceDefinition(bundle);
+ }
+
+
+}
Modified: webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiRouterDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiRouterDescriptor.java?view=diff&rev=522016&r1=522015&r2=522016
==============================================================================
--- webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiRouterDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/descriptor/OSGiRouterDescriptor.java Sat Mar 24 06:10:47 2007
@@ -1,34 +1,38 @@
-/*=============================================================================*
- * Copyright 2007 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-
-package org.apache.muse.core.platform.osgi.descriptor;
-
-import org.apache.muse.core.descriptor.SimpleRouterDescriptor;
-import org.apache.muse.core.descriptor.LoggingConfig;
-
-/**
- *
- * @author Barry Atkins
- *
- */
-
-public class OSGiRouterDescriptor extends SimpleRouterDescriptor
-{
- protected LoggingConfig createLoggingConfig()
- {
- return new OSGiLoggingConfig();
- }
-}
+/*
+ * 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.muse.core.platform.osgi.descriptor;
+
+import org.apache.muse.core.descriptor.SimpleRouterDescriptor;
+import org.apache.muse.core.descriptor.LoggingConfig;
+
+/**
+ *
+ * @author Barry Atkins
+ *
+ */
+
+public class OSGiRouterDescriptor extends SimpleRouterDescriptor
+{
+ protected LoggingConfig createLoggingConfig()
+ {
+ return new OSGiLoggingConfig();
+ }
+}
Modified: webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/internal/OSGiResourceManager.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/internal/OSGiResourceManager.java?view=diff&rev=522016&r1=522015&r2=522016
==============================================================================
--- webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/internal/OSGiResourceManager.java (original)
+++ webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/internal/OSGiResourceManager.java Sat Mar 24 06:10:47 2007
@@ -1,29 +1,49 @@
-package org.apache.muse.core.platform.osgi.internal;
-
-import java.util.Collection;
-
-import org.apache.muse.core.SimpleResourceManager;
-
-/**
- * this class is a stub implementaiton of a ResourceManager that allows
- * a resource manager to be instantiated with no resource definitions.
- * This manager is used by the <code>OSGiResourceRouter</code> and is really only intended
- * to be used by <code>ResourceManagementProvider</code> implementations
- *
- * @author Joel Hawkins(joelh)
- *
- */
-public class OSGiResourceManager extends SimpleResourceManager {
-
- /**
- * adds resource definitions to the manager. If the collection is
- * empty or null, no action is taken
- * @param definitions the collection of resource definitions to be added to the manager
- */
- public void addResourceDefinitions(Collection definitions) {
- if(definitions == null || definitions.isEmpty()) return;
- super.addResourceDefinitions(definitions);
- }
-
-
-}
+/*
+ * 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.muse.core.platform.osgi.internal;
+
+import java.util.Collection;
+
+import org.apache.muse.core.SimpleResourceManager;
+
+/**
+ * this class is a stub implementaiton of a ResourceManager that allows
+ * a resource manager to be instantiated with no resource definitions.
+ * This manager is used by the <code>OSGiResourceRouter</code> and is really only intended
+ * to be used by <code>ResourceManagementProvider</code> implementations
+ *
+ * @author Joel Hawkins(joelh)
+ *
+ */
+public class OSGiResourceManager extends SimpleResourceManager {
+
+ /**
+ * adds resource definitions to the manager. If the collection is
+ * empty or null, no action is taken
+ * @param definitions the collection of resource definitions to be added to the manager
+ */
+ public void addResourceDefinitions(Collection definitions) {
+ if(definitions == null || definitions.isEmpty()) return;
+ super.addResourceDefinitions(definitions);
+ }
+
+
+}
Modified: webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/routing/OSGiResourceIdFactory.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/routing/OSGiResourceIdFactory.java?view=diff&rev=522016&r1=522015&r2=522016
==============================================================================
--- webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/routing/OSGiResourceIdFactory.java (original)
+++ webservices/muse/trunk/modules/muse-osgi-core/src/org/apache/muse/core/platform/osgi/routing/OSGiResourceIdFactory.java Sat Mar 24 06:10:47 2007
@@ -1,85 +1,89 @@
-/*=============================================================================*
- * Copyright 2006 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-
-package org.apache.muse.core.platform.osgi.routing;
-
-import java.util.HashMap;
-
-import javax.xml.namespace.QName;
-
-import org.apache.muse.core.platform.osgi.util.OSGiReflectUtilHelper;
-import org.apache.muse.core.routing.ResourceIdFactory;
-import org.apache.muse.ws.addressing.WsaConstants;
-import org.osgi.framework.Bundle;
-
-/**
- *
- * OSGiResourceIdFactory is a simple ID factory that tracks ID values by Bundle
- *
- * @see ResourceIdFactory
- *
- * @author Joel Hawkins (joelh)
- *
- */
-
-public class OSGiResourceIdFactory implements ResourceIdFactory {
-
- protected HashMap bundleToCounterMap = new HashMap();
- protected String name;
- private static final String _DEFAULT_NAME = "MuseResource";
- private int count = 0;
- private Integer FIRST = new Integer(1);
-
- public OSGiResourceIdFactory(){
- name = _DEFAULT_NAME;
- }
-
- public OSGiResourceIdFactory(String name)
- {
- this.name = name;
- }
-
- /**
- * returns the QName for the ID factory's identifiers
- * @return the factory's resource id QName
- */
- public QName getIdentifierName() {
- return WsaConstants.DEFAULT_RESOURCE_ID_QNAME;
- }
-
- /**
- * returns the next identifier as a string. This method uses the thread local Bundle from
- * the <code>OSGiReflectUtilHelper</class> as the key to find the next counter to increment
- * if there is no active bundle, then a global counter is used
- *
- * @return the next identifier for the current thread's Bundle
- * @see OSGiReflectUtilHelper#getThreadLocalBundle()
- */
- public synchronized String getNextIdentifier() {
- Bundle bundle = OSGiReflectUtilHelper.getDefault().getThreadLocalBundle();
- if(bundle != null){
- Integer bCount = (Integer)bundleToCounterMap.get(bundle);
- if(bCount == null) bCount = FIRST;
- int value = bCount.intValue();
- bundleToCounterMap.put(bundle, new Integer(value+1));
- return name + '-' + value++;
-
- } else {
- return name + '-' + count++;
- }
- }
-
-}
+/*
+ * 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.muse.core.platform.osgi.routing;
+
+import java.util.HashMap;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.core.platform.osgi.util.OSGiReflectUtilHelper;
+import org.apache.muse.core.routing.ResourceIdFactory;
+import org.apache.muse.ws.addressing.WsaConstants;
+import org.osgi.framework.Bundle;
+
+/**
+ *
+ * OSGiResourceIdFactory is a simple ID factory that tracks ID values by Bundle
+ *
+ * @see ResourceIdFactory
+ *
+ * @author Joel Hawkins (joelh)
+ *
+ */
+
+public class OSGiResourceIdFactory implements ResourceIdFactory {
+
+ protected HashMap bundleToCounterMap = new HashMap();
+ protected String name;
+ private static final String _DEFAULT_NAME = "MuseResource";
+ private int count = 0;
+ private Integer FIRST = new Integer(1);
+
+ public OSGiResourceIdFactory(){
+ name = _DEFAULT_NAME;
+ }
+
+ public OSGiResourceIdFactory(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * returns the QName for the ID factory's identifiers
+ * @return the factory's resource id QName
+ */
+ public QName getIdentifierName() {
+ return WsaConstants.DEFAULT_RESOURCE_ID_QNAME;
+ }
+
+ /**
+ * returns the next identifier as a string. This method uses the thread local Bundle from
+ * the <code>OSGiReflectUtilHelper</class> as the key to find the next counter to increment
+ * if there is no active bundle, then a global counter is used
+ *
+ * @return the next identifier for the current thread's Bundle
+ * @see OSGiReflectUtilHelper#getThreadLocalBundle()
+ */
+ public synchronized String getNextIdentifier() {
+ Bundle bundle = OSGiReflectUtilHelper.getDefault().getThreadLocalBundle();
+ if(bundle != null){
+ Integer bCount = (Integer)bundleToCounterMap.get(bundle);
+ if(bCount == null) bCount = FIRST;
+ int value = bCount.intValue();
+ bundleToCounterMap.put(bundle, new Integer(value+1));
+ return name + '-' + value++;
+
+ } else {
+ return name + '-' + count++;
+ }
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org