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:09:38 UTC
svn commit: r522015 [1/5] - in /webservices/muse/trunk/modules/muse-core:
schemas/ src/org/apache/muse/core/ src/org/apache/muse/core/descriptor/
src/org/apache/muse/core/platform/ src/org/apache/muse/core/proxy/
src/org/apache/muse/core/routing/ src/o...
Author: danj
Date: Sat Mar 24 06:09:36 2007
New Revision: 522015
URL: http://svn.apache.org/viewvc?view=rev&rev=522015
Log:
Updating all source files to have new license header as mandated by ASF policy.
Modified:
webservices/muse/trunk/modules/muse-core/schemas/muse-descriptor.xsd
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractCapability.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractEnvironment.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractFilePersistence.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractResourceClient.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Capability.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/CapabilityContainer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Environment.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Initialization.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/InitializationFailure.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/InitializationParameters.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Persistence.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Resource.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/ResourceManager.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/ResourceManagerListener.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Shutdown.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/SimpleResource.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/SimpleResourceManager.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/CapabilityDefinition.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/CapabilityDescriptor.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/DeploymentDescriptor.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/DescriptorConstants.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/InitParamDescriptor.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/LoggingConfig.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/PersistenceDefinition.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/PersistenceDescriptor.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/ResourceDefinition.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/ResourceDescriptor.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/RouterDefinition.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/RouterDescriptor.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/RouterPersistenceDescriptor.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SerializerDefinition.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SerializerDescriptor.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleCapabilityDescriptor.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleDeploymentDescriptor.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleInitParamDescriptor.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimplePersistenceDescriptor.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleResourceDescriptor.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleRouterDescriptor.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleSerializerDescriptor.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/WsdlConfig.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/platform/AbstractIsolationLayer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/platform/IsolationLayer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/AbstractProxyHandler.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/ProxyHandler.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/ReflectionProxyHandler.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/AbstractMessageHandler.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/CounterResourceIdFactory.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/MessageHandler.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/RandomResourceIdFactory.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ReflectionMessageHandler.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ResourceIdFactory.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ResourceRouter.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/RouterFilePersistence.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/RouterPersistence.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/SimpleResourceRouter.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ArraySerializer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/BooleanSerializer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/DateSerializer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/DoubleSerializer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ElementSerializer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/FloatSerializer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/IntegerSerializer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/LongSerializer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/QNameSerializer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/Serializer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/SerializerRegistry.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/ShortSerializer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/StringSerializer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/UriSerializer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/UrlSerializer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/serializer/XmlSerializableSerializer.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/ws/wsdl/WsdlFileFilter.java
webservices/muse/trunk/modules/muse-core/src/org/apache/muse/ws/wsdl/WsdlUtils.java
Modified: webservices/muse/trunk/modules/muse-core/schemas/muse-descriptor.xsd
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/schemas/muse-descriptor.xsd?view=diff&rev=522015&r1=522014&r2=522015
==============================================================================
--- webservices/muse/trunk/modules/muse-core/schemas/muse-descriptor.xsd (original)
+++ webservices/muse/trunk/modules/muse-core/schemas/muse-descriptor.xsd Sat Mar 24 06:09:36 2007
@@ -2,19 +2,22 @@
<!--
-Copyright 2006 The Apache Software Foundation
+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
-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
- 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.
+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.
-->
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractCapability.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractCapability.java?view=diff&rev=522015&r1=522014&r2=522015
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractCapability.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractCapability.java Sat Mar 24 06:09:36 2007
@@ -1,18 +1,22 @@
-/*=============================================================================*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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.
*
- * 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;
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractEnvironment.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractEnvironment.java?view=diff&rev=522015&r1=522014&r2=522015
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractEnvironment.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractEnvironment.java Sat Mar 24 06:09:36 2007
@@ -1,18 +1,22 @@
-/*=============================================================================*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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.
*
- * 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;
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractFilePersistence.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractFilePersistence.java?view=diff&rev=522015&r1=522014&r2=522015
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractFilePersistence.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractFilePersistence.java Sat Mar 24 06:09:36 2007
@@ -1,473 +1,477 @@
-/*=============================================================================*
- * 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;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeSet;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-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.EndpointReference;
-import org.apache.muse.ws.addressing.soap.SoapFault;
-
-/**
- *
- * AbstractFilePersistence is an abstract component that provides generic
- * resource-state-to-file utilities without specifying the format of the XML
- * that goes into the files. It can be used by resources or capabilities that
- * wish to save state to disk and reload that state the next time the
- * application is initialized.
- *
- * @author Dan Jemiolo (danj)
- *
- */
-
-public abstract class AbstractFilePersistence implements Persistence
-{
- //
- // Used to look up all exception messages
- //
- private static Messages _MESSAGES = MessagesFactory.get(AbstractFilePersistence.class);
-
- //
- // Map[N -> EPR] for every resource type whose state (or partial state) is
- // being saved. here, N is a monotonically-increasing integer
- //
- private Map _fileNumberTablesByType = new HashMap();
-
- //
- // maps to the <persistence><location/></persistence> element in muse.xml.
- // here, "location" is the directory that contains sub-directories with
- // the state/partial-state of resource instances
- //
- private String _location = null;
-
- //
- // provides access to all of the resource instances that exist at runtime
- // so we can add and compare to that set
- //
- private ResourceManager _manager = null;
-
- //
- // name-value pairs specified with <init-param/>
- //
- private Map _parameters = null;
-
- /**
- *
- * Creates the proper file name for the given resource instance and then
- * delegates creation of the file's contents to the abstract method of
- * the same name.
- *
- * @param epr
- * @param resource
- *
- * @see #getNextFileNumber(String)
- * @see #createResourceFile(EndpointReference, Resource, File)
- *
- */
- protected void createResourceFile(EndpointReference epr, Resource resource)
- throws SoapFault
- {
- String contextPath = resource.getContextPath();
-
- int nextNumber = getNextFileNumber(contextPath);
- String nextFileName = getNextFileName(nextNumber);
- File resourceTypeDir = getResourceTypeDirectory(contextPath);
- File resourceFile = new File(resourceTypeDir, nextFileName);
-
- createResourceFile(epr, resource, resourceFile);
-
- Map fileNumbersByEPR = (Map)getFileNumberTables().get(contextPath);
- fileNumbersByEPR.put(epr, new Integer(nextNumber));
- }
-
- /**
- *
- * This method should be overridden by concrete file-based persistence
- * classes to create the given file and fill it with the appropriate
- * XML content. Classes that are only interested in the serialization of
- * a certain capability's data can use the Resource object to get access
- * to said capability.
- *
- * @param epr
- * The EPR that maps to the given Resource in the ResourceManager.
- *
- * @param resource
- * The resource instance whose state is being persisted.
- *
- * @param resourceFile
- * The File object that represents the yet-to-be-created XML file
- * that will contain the content generated by this method. The
- * implementation of this method must be sure to create the File
- * on disk somehow.
- *
- * @throws SoapFault
- * <ul>
- * <li>If there is an error generating the proper content for the
- * persistence file.</li>
- * <li>If there is an I/O error while reading or writing to the
- * file system.</li>
- * </ul>
- *
- */
- protected abstract void createResourceFile(EndpointReference epr, Resource resource, File resourceFile)
- throws SoapFault;
-
- /**
- *
- * Finds the file associated with the given resource EPR and removes it
- * from the file system. This method should be called when a resource is
- * destroyed (gone forever), but not when it is merely shutdown (because
- * of server reboot, etc.).
- *
- * @param epr
- * The EPR of the resource that has been permanently destroyed.
- *
- */
- protected void destroyResourceFile(EndpointReference epr)
- throws SoapFault
- {
- String contextPath = getContextPath(epr);
-
- Map fileNumbersByEPR = (Map)getFileNumberTables().get(contextPath);
- Integer fileNumber = (Integer)fileNumbersByEPR.get(epr);
- FileNumberFilter filter = new FileNumberFilter(fileNumber);
-
- File resourceTypeDir = getResourceTypeDirectory(contextPath);
- File[] results = resourceTypeDir.listFiles(filter);
-
- //
- // make sure we're not trying to delete state that doesn't exist,
- // which won't cause an immediate error but may point to problems
- // in the persistence impl
- //
- if (results.length == 0)
- {
- Object[] filler = { "\n\n" + epr };
- throw new SoapFault(_MESSAGES.get("NoFileForEPR", filler));
- }
-
- results[0].delete();
- fileNumbersByEPR.remove(epr);
- }
-
- /**
- *
- * @param epr
- *
- * @return The last token after the last slash in the EPR's address. That
- * is, for an EPR with address http://example.com/my-resource,
- * the method returns 'my-resource'.
- *
- */
- protected String getContextPath(EndpointReference epr)
- {
- String addressPath = epr.getAddress().getPath();
- int slash = addressPath.lastIndexOf('/');
- return addressPath.substring(slash + 1);
- }
-
- /**
- *
- * @param fileName
- *
- * @return The number at the end of the file name, before the suffix. That
- * is, for a file named 'my-file-14.xml', the method returns 14.
- *
- */
- protected Integer getFileNumber(String fileName)
- {
- int underscore = fileName.lastIndexOf('-');
- int extension = fileName.lastIndexOf('.');
- String numberString = fileName.substring(underscore + 1, extension);
- return new Integer(numberString);
- }
-
- protected Map getFileNumberTables()
- {
- return _fileNumberTablesByType;
- }
-
- /**
- *
- * @return The common string that will start all files created by the
- * persistence implementation. This string will have the next
- * file number appended to it in order to create unique file names.
- *
- * @see #getNextFileNumber(String)
- *
- */
- protected abstract String getFilePrefix();
-
- public String getInitializationParameter(String name)
- {
- return (String)getInitializationParameters().get(name);
- }
-
- public Map getInitializationParameters()
- {
- return _parameters;
- }
-
- /**
- *
- * @param fileNumber
- *
- * @return A string of the following format: {file-prefix}{file-number}.xml
- *
- */
- protected String getNextFileName(int fileNumber)
- {
- return getFilePrefix() + fileNumber + ".xml";
- }
-
- /**
- *
- * @return The next number that is available for creation of unique file
- * names; this number is determined by taking the largest number
- * currently used and incrementing it by one. The method does not
- * attempt to reuse numbers in 'gaps' caused by deletions (that is,
- * if numbers 1, 2, 5, and 6 are used, the method returns 7, not 3).
- *
- */
- protected int getNextFileNumber(String contextPath)
- {
- Map fileNumbersByEPR = (Map)getFileNumberTables().get(contextPath);
-
- if (fileNumbersByEPR.isEmpty())
- return 1;
-
- //
- // create a binary tree of numbers, pick the last one (= largest)
- //
- TreeSet sortedNumbers = new TreeSet(fileNumbersByEPR.values());
- Integer largest = (Integer)sortedNumbers.last();
- return largest.intValue() + 1;
- }
-
- /**
- *
- * @return The File directory that was specified as the persistence location
- * in muse.xml. The directory may not exist, so use File.exists()
- * and/or File.mkdirs() to prevent I/O errors.
- *
- */
- protected File getPersistenceDirectory()
- {
- String path = getPersistenceLocation();
-
- if (path == null)
- throw new RuntimeException(_MESSAGES.get("NoPersistenceLocation"));
-
- File workingDir = getResourceManager().getEnvironment().getRealDirectory();
- return new File(workingDir, path);
- }
-
- public String getPersistenceLocation()
- {
- return _location;
- }
-
- public ResourceManager getResourceManager()
- {
- return _manager;
- }
-
- /**
- *
- * @param contextPath
- *
- * @return Returns a directory for a given resource type, under the
- * specified persistence location. The name of the directory
- * is the context path provided. If the directory does not
- * exist, this method will create it before returning the
- * File object.
- *
- * @see #getPersistenceDirectory()
- * @see File#mkdirs()
- *
- */
- protected File getResourceTypeDirectory(String contextPath)
- {
- File dir = new File(getPersistenceDirectory(), contextPath);
-
- if (!dir.exists())
- dir.mkdirs();
-
- return dir;
- }
-
- /**
- *
- * This implementation re-loads all saved instances of the resource types
- * found in the ResourceManager. It delegates the actual reloading work
- * to reloadResources(String, File).
- *
- * @see #reloadResources(String, File)
- *
- */
- public void reload()
- throws SoapFault
- {
- ResourceManager manager = getResourceManager();
- Iterator i = manager.getResourceContextPaths().iterator();
-
- while (i.hasNext())
- {
- String contextPath = (String)i.next();
-
- //
- // all router persistence is opt-in
- //
- if (!manager.isUsingPersistence(contextPath))
- continue;
-
- getFileNumberTables().put(contextPath, new HashMap());
-
- File resourceTypeDir = getResourceTypeDirectory(contextPath);
- reloadResources(contextPath, resourceTypeDir);
- }
- }
-
- /**
- *
- * This method should be overridden by concrete file-based persistence
- * classes to update a resource instance with the saved data from the
- * XML fragment. The resource instance may be created by this method, or
- * it may exist prior to invocation.
- *
- * @param contextPath
- * The context path of the instance's resource type.
- *
- * @param resourceXML
- * The persisted data that must be reloaded.
- *
- * @return The Resource instance whose state (or part of it) has been
- * reloaded from XML. The Resource may have already existed
- * prior to the method being called, and simply had one of its
- * capabilities updated with saved data; it may also have been
- * created by the method and initialized right before return.
- *
- */
- protected abstract Resource reloadResource(String contextPath, Element resourceXML)
- throws SoapFault;
-
- /**
- *
- * This method finds all of the files in the resource type's persistence
- * directory and reloads them one at a time. It delegates the reloading of
- * individual resource instances to reloadResource(String, Element).
- *
- * @param contextPath
- * @param resourceTypeDir
- *
- * @see #reloadResource(String, Element)
- *
- */
- protected void reloadResources(String contextPath, File resourceTypeDir)
- throws SoapFault
- {
- File[] resourceFiles = resourceTypeDir.listFiles(new ResourceFileFilter());
-
- for (int n = 0; n < resourceFiles.length; ++n)
- {
- Document xmlDoc = null;
-
- try
- {
- xmlDoc = XmlUtils.createDocument(resourceFiles[n]);
- }
-
- catch (Throwable error)
- {
- throw new RuntimeException(error.getMessage(), error);
- }
-
- Element root = XmlUtils.getFirstElement(xmlDoc);
- Resource resource = reloadResource(contextPath, root);
-
- String fileName = resourceFiles[n].getName();
- Integer fileNumber = getFileNumber(fileName);
-
- Map fileNumbersByEPR = (Map)getFileNumberTables().get(contextPath);
- fileNumbersByEPR.put(resource.getEndpointReference(), fileNumber);
- }
- }
-
- public void setInitializationParameters(Map parameters)
- {
- _parameters = parameters;
- }
-
- public void setPersistenceLocation(String location)
- {
- _location = location;
- }
-
- public void setResourceManager(ResourceManager manager)
- {
- _manager = manager;
- }
-
- /**
- *
- * FileNumberFilter finds files that end with a given number (excluding
- * the file suffix).
- *
- * @author Dan Jemiolo (danj)
- *
- */
- private class FileNumberFilter implements FileFilter
- {
- private Integer _fileNumber = null;
-
- public FileNumberFilter(Integer fileNumber)
- {
- _fileNumber = fileNumber;
- }
-
- public boolean accept(File file)
- {
- return file.getName().indexOf("-" + _fileNumber + ".xml") >= 0;
- }
- }
-
- /**
- *
- * ResourceFileFilter finds files that start with the value returned by
- * getFilePrefix().
- *
- * @author Dan Jemiolo (danj)
- *
- */
- private class ResourceFileFilter implements FileFilter
- {
- public boolean accept(File file)
- {
- return file.getName().startsWith(getFilePrefix());
- }
- }
-}
+/*
+ * 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;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeSet;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+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.EndpointReference;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+
+/**
+ *
+ * AbstractFilePersistence is an abstract component that provides generic
+ * resource-state-to-file utilities without specifying the format of the XML
+ * that goes into the files. It can be used by resources or capabilities that
+ * wish to save state to disk and reload that state the next time the
+ * application is initialized.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public abstract class AbstractFilePersistence implements Persistence
+{
+ //
+ // Used to look up all exception messages
+ //
+ private static Messages _MESSAGES = MessagesFactory.get(AbstractFilePersistence.class);
+
+ //
+ // Map[N -> EPR] for every resource type whose state (or partial state) is
+ // being saved. here, N is a monotonically-increasing integer
+ //
+ private Map _fileNumberTablesByType = new HashMap();
+
+ //
+ // maps to the <persistence><location/></persistence> element in muse.xml.
+ // here, "location" is the directory that contains sub-directories with
+ // the state/partial-state of resource instances
+ //
+ private String _location = null;
+
+ //
+ // provides access to all of the resource instances that exist at runtime
+ // so we can add and compare to that set
+ //
+ private ResourceManager _manager = null;
+
+ //
+ // name-value pairs specified with <init-param/>
+ //
+ private Map _parameters = null;
+
+ /**
+ *
+ * Creates the proper file name for the given resource instance and then
+ * delegates creation of the file's contents to the abstract method of
+ * the same name.
+ *
+ * @param epr
+ * @param resource
+ *
+ * @see #getNextFileNumber(String)
+ * @see #createResourceFile(EndpointReference, Resource, File)
+ *
+ */
+ protected void createResourceFile(EndpointReference epr, Resource resource)
+ throws SoapFault
+ {
+ String contextPath = resource.getContextPath();
+
+ int nextNumber = getNextFileNumber(contextPath);
+ String nextFileName = getNextFileName(nextNumber);
+ File resourceTypeDir = getResourceTypeDirectory(contextPath);
+ File resourceFile = new File(resourceTypeDir, nextFileName);
+
+ createResourceFile(epr, resource, resourceFile);
+
+ Map fileNumbersByEPR = (Map)getFileNumberTables().get(contextPath);
+ fileNumbersByEPR.put(epr, new Integer(nextNumber));
+ }
+
+ /**
+ *
+ * This method should be overridden by concrete file-based persistence
+ * classes to create the given file and fill it with the appropriate
+ * XML content. Classes that are only interested in the serialization of
+ * a certain capability's data can use the Resource object to get access
+ * to said capability.
+ *
+ * @param epr
+ * The EPR that maps to the given Resource in the ResourceManager.
+ *
+ * @param resource
+ * The resource instance whose state is being persisted.
+ *
+ * @param resourceFile
+ * The File object that represents the yet-to-be-created XML file
+ * that will contain the content generated by this method. The
+ * implementation of this method must be sure to create the File
+ * on disk somehow.
+ *
+ * @throws SoapFault
+ * <ul>
+ * <li>If there is an error generating the proper content for the
+ * persistence file.</li>
+ * <li>If there is an I/O error while reading or writing to the
+ * file system.</li>
+ * </ul>
+ *
+ */
+ protected abstract void createResourceFile(EndpointReference epr, Resource resource, File resourceFile)
+ throws SoapFault;
+
+ /**
+ *
+ * Finds the file associated with the given resource EPR and removes it
+ * from the file system. This method should be called when a resource is
+ * destroyed (gone forever), but not when it is merely shutdown (because
+ * of server reboot, etc.).
+ *
+ * @param epr
+ * The EPR of the resource that has been permanently destroyed.
+ *
+ */
+ protected void destroyResourceFile(EndpointReference epr)
+ throws SoapFault
+ {
+ String contextPath = getContextPath(epr);
+
+ Map fileNumbersByEPR = (Map)getFileNumberTables().get(contextPath);
+ Integer fileNumber = (Integer)fileNumbersByEPR.get(epr);
+ FileNumberFilter filter = new FileNumberFilter(fileNumber);
+
+ File resourceTypeDir = getResourceTypeDirectory(contextPath);
+ File[] results = resourceTypeDir.listFiles(filter);
+
+ //
+ // make sure we're not trying to delete state that doesn't exist,
+ // which won't cause an immediate error but may point to problems
+ // in the persistence impl
+ //
+ if (results.length == 0)
+ {
+ Object[] filler = { "\n\n" + epr };
+ throw new SoapFault(_MESSAGES.get("NoFileForEPR", filler));
+ }
+
+ results[0].delete();
+ fileNumbersByEPR.remove(epr);
+ }
+
+ /**
+ *
+ * @param epr
+ *
+ * @return The last token after the last slash in the EPR's address. That
+ * is, for an EPR with address http://example.com/my-resource,
+ * the method returns 'my-resource'.
+ *
+ */
+ protected String getContextPath(EndpointReference epr)
+ {
+ String addressPath = epr.getAddress().getPath();
+ int slash = addressPath.lastIndexOf('/');
+ return addressPath.substring(slash + 1);
+ }
+
+ /**
+ *
+ * @param fileName
+ *
+ * @return The number at the end of the file name, before the suffix. That
+ * is, for a file named 'my-file-14.xml', the method returns 14.
+ *
+ */
+ protected Integer getFileNumber(String fileName)
+ {
+ int underscore = fileName.lastIndexOf('-');
+ int extension = fileName.lastIndexOf('.');
+ String numberString = fileName.substring(underscore + 1, extension);
+ return new Integer(numberString);
+ }
+
+ protected Map getFileNumberTables()
+ {
+ return _fileNumberTablesByType;
+ }
+
+ /**
+ *
+ * @return The common string that will start all files created by the
+ * persistence implementation. This string will have the next
+ * file number appended to it in order to create unique file names.
+ *
+ * @see #getNextFileNumber(String)
+ *
+ */
+ protected abstract String getFilePrefix();
+
+ public String getInitializationParameter(String name)
+ {
+ return (String)getInitializationParameters().get(name);
+ }
+
+ public Map getInitializationParameters()
+ {
+ return _parameters;
+ }
+
+ /**
+ *
+ * @param fileNumber
+ *
+ * @return A string of the following format: {file-prefix}{file-number}.xml
+ *
+ */
+ protected String getNextFileName(int fileNumber)
+ {
+ return getFilePrefix() + fileNumber + ".xml";
+ }
+
+ /**
+ *
+ * @return The next number that is available for creation of unique file
+ * names; this number is determined by taking the largest number
+ * currently used and incrementing it by one. The method does not
+ * attempt to reuse numbers in 'gaps' caused by deletions (that is,
+ * if numbers 1, 2, 5, and 6 are used, the method returns 7, not 3).
+ *
+ */
+ protected int getNextFileNumber(String contextPath)
+ {
+ Map fileNumbersByEPR = (Map)getFileNumberTables().get(contextPath);
+
+ if (fileNumbersByEPR.isEmpty())
+ return 1;
+
+ //
+ // create a binary tree of numbers, pick the last one (= largest)
+ //
+ TreeSet sortedNumbers = new TreeSet(fileNumbersByEPR.values());
+ Integer largest = (Integer)sortedNumbers.last();
+ return largest.intValue() + 1;
+ }
+
+ /**
+ *
+ * @return The File directory that was specified as the persistence location
+ * in muse.xml. The directory may not exist, so use File.exists()
+ * and/or File.mkdirs() to prevent I/O errors.
+ *
+ */
+ protected File getPersistenceDirectory()
+ {
+ String path = getPersistenceLocation();
+
+ if (path == null)
+ throw new RuntimeException(_MESSAGES.get("NoPersistenceLocation"));
+
+ File workingDir = getResourceManager().getEnvironment().getRealDirectory();
+ return new File(workingDir, path);
+ }
+
+ public String getPersistenceLocation()
+ {
+ return _location;
+ }
+
+ public ResourceManager getResourceManager()
+ {
+ return _manager;
+ }
+
+ /**
+ *
+ * @param contextPath
+ *
+ * @return Returns a directory for a given resource type, under the
+ * specified persistence location. The name of the directory
+ * is the context path provided. If the directory does not
+ * exist, this method will create it before returning the
+ * File object.
+ *
+ * @see #getPersistenceDirectory()
+ * @see File#mkdirs()
+ *
+ */
+ protected File getResourceTypeDirectory(String contextPath)
+ {
+ File dir = new File(getPersistenceDirectory(), contextPath);
+
+ if (!dir.exists())
+ dir.mkdirs();
+
+ return dir;
+ }
+
+ /**
+ *
+ * This implementation re-loads all saved instances of the resource types
+ * found in the ResourceManager. It delegates the actual reloading work
+ * to reloadResources(String, File).
+ *
+ * @see #reloadResources(String, File)
+ *
+ */
+ public void reload()
+ throws SoapFault
+ {
+ ResourceManager manager = getResourceManager();
+ Iterator i = manager.getResourceContextPaths().iterator();
+
+ while (i.hasNext())
+ {
+ String contextPath = (String)i.next();
+
+ //
+ // all router persistence is opt-in
+ //
+ if (!manager.isUsingPersistence(contextPath))
+ continue;
+
+ getFileNumberTables().put(contextPath, new HashMap());
+
+ File resourceTypeDir = getResourceTypeDirectory(contextPath);
+ reloadResources(contextPath, resourceTypeDir);
+ }
+ }
+
+ /**
+ *
+ * This method should be overridden by concrete file-based persistence
+ * classes to update a resource instance with the saved data from the
+ * XML fragment. The resource instance may be created by this method, or
+ * it may exist prior to invocation.
+ *
+ * @param contextPath
+ * The context path of the instance's resource type.
+ *
+ * @param resourceXML
+ * The persisted data that must be reloaded.
+ *
+ * @return The Resource instance whose state (or part of it) has been
+ * reloaded from XML. The Resource may have already existed
+ * prior to the method being called, and simply had one of its
+ * capabilities updated with saved data; it may also have been
+ * created by the method and initialized right before return.
+ *
+ */
+ protected abstract Resource reloadResource(String contextPath, Element resourceXML)
+ throws SoapFault;
+
+ /**
+ *
+ * This method finds all of the files in the resource type's persistence
+ * directory and reloads them one at a time. It delegates the reloading of
+ * individual resource instances to reloadResource(String, Element).
+ *
+ * @param contextPath
+ * @param resourceTypeDir
+ *
+ * @see #reloadResource(String, Element)
+ *
+ */
+ protected void reloadResources(String contextPath, File resourceTypeDir)
+ throws SoapFault
+ {
+ File[] resourceFiles = resourceTypeDir.listFiles(new ResourceFileFilter());
+
+ for (int n = 0; n < resourceFiles.length; ++n)
+ {
+ Document xmlDoc = null;
+
+ try
+ {
+ xmlDoc = XmlUtils.createDocument(resourceFiles[n]);
+ }
+
+ catch (Throwable error)
+ {
+ throw new RuntimeException(error.getMessage(), error);
+ }
+
+ Element root = XmlUtils.getFirstElement(xmlDoc);
+ Resource resource = reloadResource(contextPath, root);
+
+ String fileName = resourceFiles[n].getName();
+ Integer fileNumber = getFileNumber(fileName);
+
+ Map fileNumbersByEPR = (Map)getFileNumberTables().get(contextPath);
+ fileNumbersByEPR.put(resource.getEndpointReference(), fileNumber);
+ }
+ }
+
+ public void setInitializationParameters(Map parameters)
+ {
+ _parameters = parameters;
+ }
+
+ public void setPersistenceLocation(String location)
+ {
+ _location = location;
+ }
+
+ public void setResourceManager(ResourceManager manager)
+ {
+ _manager = manager;
+ }
+
+ /**
+ *
+ * FileNumberFilter finds files that end with a given number (excluding
+ * the file suffix).
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+ private class FileNumberFilter implements FileFilter
+ {
+ private Integer _fileNumber = null;
+
+ public FileNumberFilter(Integer fileNumber)
+ {
+ _fileNumber = fileNumber;
+ }
+
+ public boolean accept(File file)
+ {
+ return file.getName().indexOf("-" + _fileNumber + ".xml") >= 0;
+ }
+ }
+
+ /**
+ *
+ * ResourceFileFilter finds files that start with the value returned by
+ * getFilePrefix().
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+ private class ResourceFileFilter implements FileFilter
+ {
+ public boolean accept(File file)
+ {
+ return file.getName().startsWith(getFilePrefix());
+ }
+ }
+}
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractResourceClient.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractResourceClient.java?view=diff&rev=522015&r1=522014&r2=522015
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractResourceClient.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/AbstractResourceClient.java Sat Mar 24 06:09:36 2007
@@ -1,18 +1,22 @@
-/*=============================================================================*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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.
*
- * 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;
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Capability.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Capability.java?view=diff&rev=522015&r1=522014&r2=522015
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Capability.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Capability.java Sat Mar 24 06:09:36 2007
@@ -1,18 +1,22 @@
-/*=============================================================================*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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.
*
- * 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;
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/CapabilityContainer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/CapabilityContainer.java?view=diff&rev=522015&r1=522014&r2=522015
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/CapabilityContainer.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/CapabilityContainer.java Sat Mar 24 06:09:36 2007
@@ -1,18 +1,22 @@
-/*=============================================================================*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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.
*
- * 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;
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Environment.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Environment.java?view=diff&rev=522015&r1=522014&r2=522015
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Environment.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Environment.java Sat Mar 24 06:09:36 2007
@@ -1,18 +1,22 @@
-/*=============================================================================*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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.
*
- * 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;
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Initialization.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Initialization.java?view=diff&rev=522015&r1=522014&r2=522015
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Initialization.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Initialization.java Sat Mar 24 06:09:36 2007
@@ -1,18 +1,22 @@
-/*=============================================================================*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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.
*
- * 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;
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/InitializationFailure.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/InitializationFailure.java?view=diff&rev=522015&r1=522014&r2=522015
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/InitializationFailure.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/InitializationFailure.java Sat Mar 24 06:09:36 2007
@@ -1,18 +1,22 @@
-/*=============================================================================*
- * Copyright 2006 The Apache Software Foundation
+/*
+ * 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.
*
- * 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;
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/InitializationParameters.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/InitializationParameters.java?view=diff&rev=522015&r1=522014&r2=522015
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/InitializationParameters.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/InitializationParameters.java Sat Mar 24 06:09:36 2007
@@ -1,65 +1,69 @@
-/*=============================================================================*
- * 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;
-
-import java.util.Map;
-
-/**
- *
- * InitializationParameters is an interface for components that can be loaded
- * with zero or more name-value pairs for configuration.
- *
- * @author Dan Jemiolo (danj)
- *
- */
-
-public interface InitializationParameters
-{
- /**
- *
- * @param name
- *
- * @return The value of the initialization parameter, or null if it does
- * not exist.
- *
- */
- String getInitializationParameter(String name);
-
- /**
- *
- * @return The set of name-value pairs provided at initialization time.
- * The Map may be empty.
- *
- */
- Map getInitializationParameters();
-
- /**
- *
- * Allows the resource's creator to provide it with arbitrary name-value
- * pairs that may be used during initialization. The way that these
- * values are used and/or stored is an implementation detail, and there
- * is no requirement that this feature be used - it is a generic way to
- * specify deployment/initialization parameters. This method <b>should</b>
- * be called before the resource is initialized.
- *
- * @param parameters
- * A simple set of name-value pairs - Map[String, String] - that
- * contains initialization parameters for the resource.
- *
- */
- void setInitializationParameters(Map parameters);
-}
+/*
+ * 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;
+
+import java.util.Map;
+
+/**
+ *
+ * InitializationParameters is an interface for components that can be loaded
+ * with zero or more name-value pairs for configuration.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
+public interface InitializationParameters
+{
+ /**
+ *
+ * @param name
+ *
+ * @return The value of the initialization parameter, or null if it does
+ * not exist.
+ *
+ */
+ String getInitializationParameter(String name);
+
+ /**
+ *
+ * @return The set of name-value pairs provided at initialization time.
+ * The Map may be empty.
+ *
+ */
+ Map getInitializationParameters();
+
+ /**
+ *
+ * Allows the resource's creator to provide it with arbitrary name-value
+ * pairs that may be used during initialization. The way that these
+ * values are used and/or stored is an implementation detail, and there
+ * is no requirement that this feature be used - it is a generic way to
+ * specify deployment/initialization parameters. This method <b>should</b>
+ * be called before the resource is initialized.
+ *
+ * @param parameters
+ * A simple set of name-value pairs - Map[String, String] - that
+ * contains initialization parameters for the resource.
+ *
+ */
+ void setInitializationParameters(Map parameters);
+}
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Persistence.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Persistence.java?view=diff&rev=522015&r1=522014&r2=522015
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Persistence.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Persistence.java Sat Mar 24 06:09:36 2007
@@ -1,76 +1,80 @@
-/*=============================================================================*
- * 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;
-
-import org.apache.muse.ws.addressing.soap.SoapFault;
-
-/**
- *
- * Persistence is a mechanism used by resources and/or capabilities to save
- * some or all of their state across application reboots. Concrete persistence
- * classes provide the means for storage (file, database, etc.) as well as
- * the logic to determine what content is stored. Note that this interface
- * only describes how the persistence class should reload its data - not how
- * it should initially find and save this data.
- * <br><br>
- * Peristence implementations are usually specified with the <em>persistence</em>
- * element in muse.xml. This element allows users to specify the persistence
- * location (the semantics of which are implementation-specific) and the concrete
- * class that implements this interface.
- *
- * @author Dan Jemiolo (danj)
- *
- */
-public interface Persistence extends InitializationParameters
-{
- /**
- *
- * @return The value specified in muse.xml under the <em>persistence</em>
- * element. The semantics of this value are dependent on the type
- * of storage used by the implementation class. As an example, a
- * simple file-based persistence class might interpret the location
- * to be the directory where files are stored; a database-oriented
- * class might interpret it as the JNDI URI for the database.
- *
- */
- String getPersistenceLocation();
-
- /**
- *
- * @return The ResourceManager that stores all of the resource type
- * definitions and all current resource instances.
- *
- */
- ResourceManager getResourceManager();
-
- /**
- *
- * Reads any data that was persisted by the class back into memory and
- * provides it to the proper components (resource or capability). This
- * method is normally called during the initialization of said components,
- * before any requests are handled by the application.
- *
- * @throws SoapFault
- *
- */
- void reload()
- throws SoapFault;
-
- void setPersistenceLocation(String location);
-
- void setResourceManager(ResourceManager manager);
-}
+/*
+ * 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;
+
+import org.apache.muse.ws.addressing.soap.SoapFault;
+
+/**
+ *
+ * Persistence is a mechanism used by resources and/or capabilities to save
+ * some or all of their state across application reboots. Concrete persistence
+ * classes provide the means for storage (file, database, etc.) as well as
+ * the logic to determine what content is stored. Note that this interface
+ * only describes how the persistence class should reload its data - not how
+ * it should initially find and save this data.
+ * <br><br>
+ * Peristence implementations are usually specified with the <em>persistence</em>
+ * element in muse.xml. This element allows users to specify the persistence
+ * location (the semantics of which are implementation-specific) and the concrete
+ * class that implements this interface.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+public interface Persistence extends InitializationParameters
+{
+ /**
+ *
+ * @return The value specified in muse.xml under the <em>persistence</em>
+ * element. The semantics of this value are dependent on the type
+ * of storage used by the implementation class. As an example, a
+ * simple file-based persistence class might interpret the location
+ * to be the directory where files are stored; a database-oriented
+ * class might interpret it as the JNDI URI for the database.
+ *
+ */
+ String getPersistenceLocation();
+
+ /**
+ *
+ * @return The ResourceManager that stores all of the resource type
+ * definitions and all current resource instances.
+ *
+ */
+ ResourceManager getResourceManager();
+
+ /**
+ *
+ * Reads any data that was persisted by the class back into memory and
+ * provides it to the proper components (resource or capability). This
+ * method is normally called during the initialization of said components,
+ * before any requests are handled by the application.
+ *
+ * @throws SoapFault
+ *
+ */
+ void reload()
+ throws SoapFault;
+
+ void setPersistenceLocation(String location);
+
+ void setResourceManager(ResourceManager manager);
+}
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Resource.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Resource.java?view=diff&rev=522015&r1=522014&r2=522015
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Resource.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/Resource.java Sat Mar 24 06:09:36 2007
@@ -1,150 +1,154 @@
-/*=============================================================================*
- * 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;
-
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-
-import org.w3c.dom.Element;
-
-import org.apache.muse.ws.addressing.EndpointReference;
-
-/**
- *
- * Resource is an aggregate of Capability objects, providing a common
- * host for them to share information and sub-components. The
- * {@linkplain CapabilityContainer CapabilityContainer} interface, while
- * small, is the most important part of the Resource interface, for it
- * describes Resource's primary role in the Muse framework.
- * <br><br>
- * This interface also acts as the final stop in the request delegation process,
- * taking method invocation requests from the
- * {@linkplain org.apache.muse.core.routing.ResourceRouter ResourceRouter}
- * and passing them along to the appropriate Capability based on its
- * knowledge of each Capability's supported operations. This allows the
- * Capability classes to do their work in a way that is independent of
- * SOAP request-handling and other plumbing.
- * <br><br>
- * From a remote client perspective, Resource is the atomic unit of
- * definition, since WSDL 1.1 does not allow resource interfaces to
- * be broken down into distinct sub-interfaces (capabilities). However,
- * from a server-side programming model perspective, Resource is not the
- * most granular level of resource definition - users should focus on creating
- * {@linkplain Capability capabilities} and use Resource as a means of
- * communicating between those capabilities.
- *
- * @author Dan Jemiolo (danj)
- *
- * @see CapabilityContainer
- * @see Capability
- * @see Capability#getResource()
- *
- */
-
-public interface Resource
- extends Initialization, InitializationParameters, Shutdown, CapabilityContainer
-{
- /**
- *
- * @return The unique part of the SOAP endpoint URL that defines this
- * resource's type. Every resource type should have a unique
- * SOAP endpoint. This value should map to a <em>context-path</em>
- * value in muse.
- *
- */
- String getContextPath();
-
- /**
- *
- * @return The unique EPR of the resource instance.
- *
- */
- EndpointReference getEndpointReference();
-
- /**
- *
- * @return The resource's access point for things such as the
- * WS-Addressing context, file system resources, and more.
- *
- */
- Environment getEnvironment();
-
- /**
- *
- * @return The JDK logger that writes to the Muse log file.
- *
- */
- Logger getLog();
-
- /**
- *
- * @return The ResourceManager that stores all of the resource type
- * definitions and all current resource instances.
- *
- */
- ResourceManager getResourceManager();
-
- /**
- *
- * @return The relative path of the WSDL file with the resource's portType.
- *
- */
- String getWsdlPath();
-
- /**
- *
- * @return The WSDL portType that defines the resource.
- *
- */
- QName getWsdlPortType();
-
- /**
- *
- * This is a generic method invocation mechanism that can be used to
- * delegate request handling to a capability or some other component.
- * It is intended to be used by code that is handling external requests,
- * and it may not allow the invocation of all methods defined by the type.
- * Internal clients should make 'normal' Java method calls with the actual
- * method parameters; the getCapability(String) method provides access
- * to the Capability objects that make up the resource type, all of which
- * will have 'normal' Java methods for their operations.
- *
- * @param soapBody
- * The parameters for the method, still in their SOAP Body form.
- *
- * @return The return value of the method, in SOAP Body form. If the
- * operation resulted in a fault, the response XML should be
- * the fault XML.
- *
- */
- Element invoke(Element soapBody);
-
- void setContextPath(String contextPath);
-
- void setEndpointReference(EndpointReference epr);
-
- void setEnvironment(Environment environment);
-
- void setLog(Logger log);
-
- void setResourceManager(ResourceManager manager);
-
- void setWsdlPath(String wsdlPath);
-
- void setWsdlPortType(QName wsdlPortType);
-}
+/*
+ * 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;
+
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+
+import org.apache.muse.ws.addressing.EndpointReference;
+
+/**
+ *
+ * Resource is an aggregate of Capability objects, providing a common
+ * host for them to share information and sub-components. The
+ * {@linkplain CapabilityContainer CapabilityContainer} interface, while
+ * small, is the most important part of the Resource interface, for it
+ * describes Resource's primary role in the Muse framework.
+ * <br><br>
+ * This interface also acts as the final stop in the request delegation process,
+ * taking method invocation requests from the
+ * {@linkplain org.apache.muse.core.routing.ResourceRouter ResourceRouter}
+ * and passing them along to the appropriate Capability based on its
+ * knowledge of each Capability's supported operations. This allows the
+ * Capability classes to do their work in a way that is independent of
+ * SOAP request-handling and other plumbing.
+ * <br><br>
+ * From a remote client perspective, Resource is the atomic unit of
+ * definition, since WSDL 1.1 does not allow resource interfaces to
+ * be broken down into distinct sub-interfaces (capabilities). However,
+ * from a server-side programming model perspective, Resource is not the
+ * most granular level of resource definition - users should focus on creating
+ * {@linkplain Capability capabilities} and use Resource as a means of
+ * communicating between those capabilities.
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ * @see CapabilityContainer
+ * @see Capability
+ * @see Capability#getResource()
+ *
+ */
+
+public interface Resource
+ extends Initialization, InitializationParameters, Shutdown, CapabilityContainer
+{
+ /**
+ *
+ * @return The unique part of the SOAP endpoint URL that defines this
+ * resource's type. Every resource type should have a unique
+ * SOAP endpoint. This value should map to a <em>context-path</em>
+ * value in muse.
+ *
+ */
+ String getContextPath();
+
+ /**
+ *
+ * @return The unique EPR of the resource instance.
+ *
+ */
+ EndpointReference getEndpointReference();
+
+ /**
+ *
+ * @return The resource's access point for things such as the
+ * WS-Addressing context, file system resources, and more.
+ *
+ */
+ Environment getEnvironment();
+
+ /**
+ *
+ * @return The JDK logger that writes to the Muse log file.
+ *
+ */
+ Logger getLog();
+
+ /**
+ *
+ * @return The ResourceManager that stores all of the resource type
+ * definitions and all current resource instances.
+ *
+ */
+ ResourceManager getResourceManager();
+
+ /**
+ *
+ * @return The relative path of the WSDL file with the resource's portType.
+ *
+ */
+ String getWsdlPath();
+
+ /**
+ *
+ * @return The WSDL portType that defines the resource.
+ *
+ */
+ QName getWsdlPortType();
+
+ /**
+ *
+ * This is a generic method invocation mechanism that can be used to
+ * delegate request handling to a capability or some other component.
+ * It is intended to be used by code that is handling external requests,
+ * and it may not allow the invocation of all methods defined by the type.
+ * Internal clients should make 'normal' Java method calls with the actual
+ * method parameters; the getCapability(String) method provides access
+ * to the Capability objects that make up the resource type, all of which
+ * will have 'normal' Java methods for their operations.
+ *
+ * @param soapBody
+ * The parameters for the method, still in their SOAP Body form.
+ *
+ * @return The return value of the method, in SOAP Body form. If the
+ * operation resulted in a fault, the response XML should be
+ * the fault XML.
+ *
+ */
+ Element invoke(Element soapBody);
+
+ void setContextPath(String contextPath);
+
+ void setEndpointReference(EndpointReference epr);
+
+ void setEnvironment(Environment environment);
+
+ void setLog(Logger log);
+
+ void setResourceManager(ResourceManager manager);
+
+ void setWsdlPath(String wsdlPath);
+
+ void setWsdlPortType(QName wsdlPortType);
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org