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 2006/08/23 06:02:35 UTC
svn commit: r433870 [2/3] - in
/webservices/muse/trunk/modules/muse-core/src/org/apache/muse: core/
core/descriptor/ core/platform/ core/proxy/ core/routing/ core/serializer/
ws/wsdl/
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/DescriptorConstants.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/DescriptorConstants.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/DescriptorConstants.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/DescriptorConstants.java Tue Aug 22 21:02:32 2006
@@ -29,97 +29,98 @@
public class DescriptorConstants
{
- //
- // The target namespace for the Muse deployment descriptor
- //
+ /**
+ *
+ * The target namespace for the Muse deployment descriptor
+ *
+ */
public static final String NAMESPACE_URI = "http://ws.apache.org/muse/descriptor";
-
+
public static final String PREFIX = "desc";
- //
- // This is the standard name for DD file names. All applications should
- // be described using a file with the given name, located somewhere in
- // the application's installation directory.
- //
+ /**
+ *
+ * This is the standard name for descriptor files. All applications should
+ * be described using a file with the given name, located somewhere in
+ * the application's installation directory.
+ *
+ */
public static final String DESCRIPTOR_FILE_NAME = "muse.xml";
- //
- // below are the elements and attributes in the standard DD
- //
- public static final QName MUSE_QNAME =
- new QName(NAMESPACE_URI, "muse", PREFIX);
+ public static final QName CAPABILITY_QNAME =
+ new QName(NAMESPACE_URI, "capability", PREFIX);
- public static final QName JAVA_RESOURCE_QNAME =
- new QName(NAMESPACE_URI, "java-resource-class", PREFIX);
+ public static final QName CAPABILITY_URI_QNAME =
+ new QName(NAMESPACE_URI, "capability-uri", PREFIX);
- public static final QName JAVA_ID_FACTORY_QNAME =
- new QName(NAMESPACE_URI, "java-id-factory-class", PREFIX);
+ public static final QName CONTEXT_PATH_QNAME =
+ new QName(NAMESPACE_URI, "context-path", PREFIX);
- public static final QName JAVA_ROUTER_QNAME =
- new QName(NAMESPACE_URI, "java-router-class", PREFIX);
+ public static final QName CUSTOM_SERIALIZER_QNAME =
+ new QName(NAMESPACE_URI, "custom-serializer", PREFIX);
- public static final QName ROUTER_QNAME =
- new QName(NAMESPACE_URI, "router", PREFIX);
+ public static final QName INIT_PARAM_QNAME =
+ new QName(NAMESPACE_URI, "init-param", PREFIX);
- public static final QName PERSISTENCE_QNAME =
- new QName(NAMESPACE_URI, "persistence", PREFIX);
+ public static final QName JAVA_CAPABILITY_QNAME =
+ new QName(NAMESPACE_URI, "java-capability-class", PREFIX);
+
+ public static final QName JAVA_ID_FACTORY_QNAME =
+ new QName(NAMESPACE_URI, "java-id-factory-class", PREFIX);
public static final QName JAVA_PERSISTENCE_QNAME =
new QName(NAMESPACE_URI, "java-persistence-class", PREFIX);
- public static final QName PERSISTENCE_LOCATION_QNAME =
- new QName(NAMESPACE_URI, "persistence-location", PREFIX);
-
- public static final QName CAPABILITY_QNAME =
- new QName(NAMESPACE_URI, "capability", PREFIX);
-
- public static final QName CAPABILITY_URI_QNAME =
- new QName(NAMESPACE_URI, "capability-uri", PREFIX);
-
- public static final QName JAVA_CAPABILITY_QNAME =
- new QName(NAMESPACE_URI, "java-capability-class", PREFIX);
+ public static final QName JAVA_RESOURCE_QNAME =
+ new QName(NAMESPACE_URI, "java-resource-class", PREFIX);
- public static final QName JAVA_SERIALIZER_QNAME =
- new QName(NAMESPACE_URI, "java-serializer-class", PREFIX);
+ public static final QName JAVA_ROUTER_QNAME =
+ new QName(NAMESPACE_URI, "java-router-class", PREFIX);
public static final QName JAVA_SERIALIZABLE_QNAME =
new QName(NAMESPACE_URI, "java-serializable-type", PREFIX);
- public static final QName CUSTOM_SERIALIZER_QNAME =
- new QName(NAMESPACE_URI, "custom-serializer", PREFIX);
+ public static final QName JAVA_SERIALIZER_QNAME =
+ new QName(NAMESPACE_URI, "java-serializer-class", PREFIX);
- public static final QName WSDL_FILE_QNAME =
- new QName(NAMESPACE_URI, "wsdl-file", PREFIX);
+ public static final QName LOG_FILE_QNAME =
+ new QName(NAMESPACE_URI, "log-file", PREFIX);
- public static final QName WSDL_QNAME =
- new QName(NAMESPACE_URI, "wsdl", PREFIX);
+ public static final QName LOG_LEVEL_QNAME =
+ new QName(NAMESPACE_URI, "log-level", PREFIX);
- public static final QName WSDL_PORT_TYPE_QNAME =
- new QName(NAMESPACE_URI, "wsdl-port-type", PREFIX);
+ public static final QName LOGGING_QNAME =
+ new QName(NAMESPACE_URI, "logging", PREFIX);
- public static final QName RESOURCE_TYPE_QNAME =
- new QName(NAMESPACE_URI, "resource-type", PREFIX);
+ public static final QName MUSE_QNAME =
+ new QName(NAMESPACE_URI, "muse", PREFIX);
- public static final QName INIT_PARAM_QNAME =
- new QName(NAMESPACE_URI, "init-param", PREFIX);
-
public static final QName PARAM_NAME_QNAME =
new QName(NAMESPACE_URI, "param-name", PREFIX);
public static final QName PARAM_VALUE_QNAME =
new QName(NAMESPACE_URI, "param-value", PREFIX);
+
+ public static final QName PERSISTENCE_LOCATION_QNAME =
+ new QName(NAMESPACE_URI, "persistence-location", PREFIX);
+
+ public static final QName PERSISTENCE_QNAME =
+ new QName(NAMESPACE_URI, "persistence", PREFIX);
+
+ public static final QName RESOURCE_TYPE_QNAME =
+ new QName(NAMESPACE_URI, "resource-type", PREFIX);
- public static final QName LOGGING_QNAME =
- new QName(NAMESPACE_URI, "logging", PREFIX);
+ public static final QName ROUTER_QNAME =
+ new QName(NAMESPACE_URI, "router", PREFIX);
- public static final QName LOG_FILE_QNAME =
- new QName(NAMESPACE_URI, "log-file", PREFIX);
+ public static final String USE_ROUTER_PERSISTENCE = "use-router-persistence";
- public static final QName LOG_LEVEL_QNAME =
- new QName(NAMESPACE_URI, "log-level", PREFIX);
+ public static final QName WSDL_FILE_QNAME =
+ new QName(NAMESPACE_URI, "wsdl-file", PREFIX);
- public static final QName CONTEXT_PATH_QNAME =
- new QName(NAMESPACE_URI, "context-path", PREFIX);
+ public static final QName WSDL_PORT_TYPE_QNAME =
+ new QName(NAMESPACE_URI, "wsdl-port-type", PREFIX);
- public static final String USE_ROUTER_PERSISTENCE = "use-router-persistence";
+ public static final QName WSDL_QNAME =
+ new QName(NAMESPACE_URI, "wsdl", PREFIX);
}
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/InitParamDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/InitParamDescriptor.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/InitParamDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/InitParamDescriptor.java Tue Aug 22 21:02:32 2006
@@ -27,7 +27,7 @@
* InitParamDescriptor defines a sub-section of the Muse deployment descriptor
* that may be used in multiple places - the sequence of initialization
* parameters. This mini-descriptor can be used to load the name-value pairs
- * found in <init-param> elements and read them as a java.util.Map.
+ * found in <em>init-param</em> elements and read them as a java.util.Map.
*
* @author Dan Jemiolo (danj)
*
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/LoggingConfig.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/LoggingConfig.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/LoggingConfig.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/LoggingConfig.java Tue Aug 22 21:02:32 2006
@@ -27,8 +27,6 @@
/**
*
- * LoggingConfig is ...
- *
* @author Dan Jemiolo (danj)
*
*/
@@ -41,23 +39,6 @@
private Level _logLevel = null;
- public Logger newInstance()
- {
- File logFile = getLogFile();
- Level logLevel = getLogLevel();
-
- File logDir = logFile.getParentFile();
- logDir.mkdirs();
-
- Logger log = Logger.getLogger(MUSE_LOGGER_NAME);
- log.setLevel(logLevel);
-
- Handler handler = createLogHandler(logFile);
- log.addHandler(handler);
-
- return log;
- }
-
protected Handler createLogHandler(File logFile)
{
Handler handler = null;
@@ -88,6 +69,23 @@
public Level getLogLevel()
{
return _logLevel;
+ }
+
+ public Logger newInstance()
+ {
+ File logFile = getLogFile();
+ Level logLevel = getLogLevel();
+
+ File logDir = logFile.getParentFile();
+ logDir.mkdirs();
+
+ Logger log = Logger.getLogger(MUSE_LOGGER_NAME);
+ log.setLevel(logLevel);
+
+ Handler handler = createLogHandler(logFile);
+ log.addHandler(handler);
+
+ return log;
}
public void setLogFile(File logFile)
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/Messages.properties?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/Messages.properties (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/Messages.properties Tue Aug 22 21:02:32 2006
@@ -2,17 +2,18 @@
NullWSDLPortType=The muse.xml has a null wsdl-file/port-type element. You must specify the WSDL portType that defines the resource's interface.
NullWSDLFile=The muse.xml has null wsdl-file element. Please fill in the values needed to find and parse the WSDL.
IncorrectResourceRoot=XXX does not implement XXX, which is a required base type for all resource classes.
-NotResourceIdFactory=The Java type 'XXX' is not an instance of org.apache.muse.core.routing.ResourceIdFactory - all ID factories must implement this interface.
+NotResourceIdFactory=XXX does not implement, which is required of all ID factory classes.
NullDescriptorDocument=The XML Document containing the muse.xml is null.
-NullJavaBase=There is a resource in the muse.xml with a null java-base-type value.
+NullJavaResourceClass=There is a java-resource-class element in muse.xml that does not have a value (or it is empty).
RequiredCapability=The capability defined by URI 'XXX' already has an implementation class specified by this platform. The required implementation class is 'XXX', and it will be loaded automatically when you declare a capability of this URI. You should remove the <java-capability-class/> element from the <capability/> definition in muse.xml and restart the application.
IncorrectPersistenceRoot=XXX does not implement XXX, which is a required interface for all persistence classes.
NullWSDLLocation=The muse.xml has a null wsdl-file/location element. You must specify the WSDL file location; the path should be relative to the application's context root.
-NullResourceElement=The DOM Element with the resource definition is null.
-NullEndpoint=There is a resource element in the muse.xml with a null endpoint element.
+NullContextPath=There is a context-path element in muse.xml that does not have a value (or it is empty).
IncorrectRouterRoot=XXX does not implement XXX, which is a required base type for all router classes.
-NullEnvironment=The Environment is null.
-NotSerializer=The serializer class specified - XXX - is not an instance of org.apache.muse.core.serializer.Serializer.
+NotSerializer=XXX does not implement XXX, which is a required interface for all custom serializer classes.
NoSerializerClass=There is a custom-serializer element in muse.xml that does not have a java-serializer-class value (or it is empty).
NoSerializableClass=There is a custom-serializer element in muse.xml that does not have a java-serializable-type value (or it is empty).
IncorrectCapabilityRoot=XXX does not implement XXX, which is a required interface for all capability classes.
+InvalidDescriptorRoot=The muse.xml file must start with the root element XXX, but yours has a root element named XXX. Make sure to validate your muse.xml against the Muse descriptor schema.
+MissingOperationImplementations=The WSDL file 'XXX' has the following operations which have no match in any of the resource's capabilities: XXX
+PortTypeNotFound=The WSDL file 'XXX' does not have a portType named XXX.
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/PersistenceDefinition.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/PersistenceDefinition.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/PersistenceDefinition.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/PersistenceDefinition.java Tue Aug 22 21:02:32 2006
@@ -21,6 +21,12 @@
import org.apache.muse.core.Persistence;
import org.apache.muse.util.ReflectUtils;
+/**
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
public class PersistenceDefinition
{
private Map _parameters = null;
@@ -29,16 +35,21 @@
private String _persistenceLocation = null;
+ public Map getInitializationParameters()
+ {
+ return _parameters;
+ }
+
public Class getPersistenceClass()
{
return _persistenceClass;
}
-
+
public String getPersistenceLocation()
{
return _persistenceLocation;
}
-
+
public Persistence newInstance()
{
Persistence persistence = (Persistence)ReflectUtils.newInstance(getPersistenceClass());
@@ -46,6 +57,11 @@
return persistence;
}
+ public void setInitializationParameters(Map parameters)
+ {
+ _parameters = parameters;
+ }
+
public void setPersistenceClass(Class persistenceClass)
{
_persistenceClass = persistenceClass;
@@ -54,15 +70,5 @@
public void setPersistenceLocation(String persistenceLocation)
{
_persistenceLocation = persistenceLocation;
- }
-
- public Map getInitializationParameters()
- {
- return _parameters;
- }
-
- public void setInitializationParameters(Map parameters)
- {
- _parameters = parameters;
}
}
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/PersistenceDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/PersistenceDescriptor.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/PersistenceDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/PersistenceDescriptor.java Tue Aug 22 21:02:32 2006
@@ -21,6 +21,12 @@
import org.apache.muse.core.Environment;
import org.apache.muse.ws.addressing.soap.SoapFault;
+/**
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
public interface PersistenceDescriptor
{
PersistenceDefinition getPersistenceDefinition();
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/ResourceDefinition.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/ResourceDefinition.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/ResourceDefinition.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/ResourceDefinition.java Tue Aug 22 21:02:32 2006
@@ -28,8 +28,6 @@
import org.apache.muse.core.Resource;
import org.apache.muse.core.routing.ResourceIdFactory;
import org.apache.muse.util.ReflectUtils;
-import org.apache.muse.util.messages.Messages;
-import org.apache.muse.util.messages.MessagesFactory;
import org.apache.muse.ws.addressing.EndpointReference;
/**
@@ -40,25 +38,10 @@
public class ResourceDefinition
{
- //
- // Used to lookup all exception messages
- //
- private static Messages _MESSAGES =
- MessagesFactory.get(ResourceDefinition.class);
-
private Collection _capabilities = null;
- //
- // The unique part of the resource's URL - the part that identifies
- // this factory's resource type from other types that might be in the
- // same application
- //
private String _contextPath = null;
- //
- // The deployment environment - this is given to all new resources
- // created with the factory
- //
private Environment _environment = null;
private ResourceIdFactory _idFactory = null;
@@ -73,14 +56,65 @@
private WsdlConfig _wsdl = null;
+ public Collection getCapabilityDefinitions()
+ {
+ return _capabilities;
+ }
+
+ public String getContextPath()
+ {
+ return _contextPath;
+ }
+
+ public Environment getEnvironment()
+ {
+ return _environment;
+ }
+
+ public Map getInitializationParameters()
+ {
+ return _parameters;
+ }
+
+ public Logger getLog()
+ {
+ return _log;
+ }
+
+ public Class getResourceClass()
+ {
+ return _resourceClass;
+ }
+
+ public ResourceIdFactory getResourceIdFactory()
+ {
+ return _idFactory;
+ }
+
+ public WsdlConfig getWsdlConfig()
+ {
+ return _wsdl;
+ }
+
+ public boolean isUsingPersistence()
+ {
+ return _isUsingPersistence;
+ }
+
public Resource newInstance()
{
Environment env = getEnvironment();
Logger log = getLog();
+ //
+ // instantiate the resource object itself
+ //
Class resourceClass = getResourceClass();
Resource resource = (Resource)ReflectUtils.newInstance(resourceClass);
+ //
+ // give the resource access to all the standard Muse components
+ //
resource.setEnvironment(env);
resource.setLog(log);
resource.setContextPath(getContextPath());
@@ -122,77 +156,19 @@
return resource;
}
- public Logger getLog()
- {
- return _log;
- }
-
- public void setLog(Logger log)
- {
- _log = log;
- }
-
- public Collection getCapabilityDefinitions()
- {
- return _capabilities;
- }
-
- public Class getResourceClass()
- {
- return _resourceClass;
- }
-
- public String getContextPath()
- {
- return _contextPath;
- }
-
- public Environment getEnvironment()
- {
- return _environment;
- }
-
- public Map getInitializationParameters()
- {
- return _parameters;
- }
-
- public ResourceIdFactory getResourceIdFactory()
- {
- return _idFactory;
- }
-
- public WsdlConfig getWsdlConfig()
- {
- return _wsdl;
- }
-
- public boolean isUsingPersistence()
- {
- return _isUsingPersistence;
- }
-
public void setCapabilityDefinitions(Collection capabilities)
{
_capabilities = capabilities;
}
- public void setEnvironment(Environment environment)
- {
- if (environment == null)
- throw new NullPointerException(_MESSAGES.get("NullEnvironment"));
-
- _environment = environment;
- }
-
public void setContextPath(String contextPath)
{
_contextPath = contextPath;
}
- public void setResourceIdFactory(ResourceIdFactory idFactory)
+ public void setEnvironment(Environment environment)
{
- _idFactory = idFactory;
+ _environment = environment;
}
public void setInitializationParameters(Map parameters)
@@ -200,9 +176,19 @@
_parameters = parameters;
}
+ public void setLog(Logger log)
+ {
+ _log = log;
+ }
+
public void setResourceClass(Class resourceClass)
{
_resourceClass = resourceClass;
+ }
+
+ public void setResourceIdFactory(ResourceIdFactory idFactory)
+ {
+ _idFactory = idFactory;
}
public void setUsingPersistence(boolean isUsingPersistence)
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/ResourceDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/ResourceDescriptor.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/ResourceDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/ResourceDescriptor.java Tue Aug 22 21:02:32 2006
@@ -23,8 +23,6 @@
/**
*
- * ResourceDescriptor is ...
- *
* @author Dan Jemiolo (danj)
*
*/
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/RouterDefinition.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/RouterDefinition.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/RouterDefinition.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/RouterDefinition.java Tue Aug 22 21:02:32 2006
@@ -26,8 +26,6 @@
/**
*
- * RouterDefinition is ...
- *
* @author Dan Jemiolo (danj)
*
*/
@@ -38,12 +36,12 @@
private LoggingConfig _logging = null;
- private Class _theClass = null;
-
private PersistenceDefinition _persistence = null;
private Collection _resourceDefinitions = null;
+ private Class _theClass = null;
+
public Environment getEnvironment()
{
return _environment;
@@ -54,6 +52,11 @@
return _logging;
}
+ public PersistenceDefinition getPersistenceDefinition()
+ {
+ return _persistence;
+ }
+
public Collection getResourceDefinitions()
{
return _resourceDefinitions;
@@ -64,26 +67,6 @@
return _theClass;
}
- public void setEnvironment(Environment environment)
- {
- _environment = environment;
- }
-
- public void setLoggingConfig(LoggingConfig logging)
- {
- _logging = logging;
- }
-
- public void setResourceDefinitions(Collection resourceDefinitions)
- {
- _resourceDefinitions = resourceDefinitions;
- }
-
- public void setRouterClass(Class theClass)
- {
- _theClass = theClass;
- }
-
public ResourceRouter newInstance()
{
Class theClass = getRouterClass();
@@ -109,14 +92,29 @@
return router;
}
-
- public PersistenceDefinition getPersistenceDefinition()
+
+ public void setEnvironment(Environment environment)
{
- return _persistence;
+ _environment = environment;
}
-
+
+ public void setLoggingConfig(LoggingConfig logging)
+ {
+ _logging = logging;
+ }
+
public void setPersistenceDefinition(PersistenceDefinition persistence)
{
_persistence = persistence;
+ }
+
+ public void setResourceDefinitions(Collection resourceDefinitions)
+ {
+ _resourceDefinitions = resourceDefinitions;
+ }
+
+ public void setRouterClass(Class theClass)
+ {
+ _theClass = theClass;
}
}
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/RouterDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/RouterDescriptor.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/RouterDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/RouterDescriptor.java Tue Aug 22 21:02:32 2006
@@ -23,8 +23,6 @@
/**
*
- * RouterDescriptor is ...
- *
* @author Dan Jemiolo (danj)
*
*/
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/RouterPersistenceDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/RouterPersistenceDescriptor.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/RouterPersistenceDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/RouterPersistenceDescriptor.java Tue Aug 22 21:02:32 2006
@@ -24,6 +24,12 @@
import org.apache.muse.util.messages.MessagesFactory;
import org.apache.muse.ws.addressing.soap.SoapFault;
+/**
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
public class RouterPersistenceDescriptor extends SimplePersistenceDescriptor
{
//
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SerializerDefinition.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SerializerDefinition.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SerializerDefinition.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SerializerDefinition.java Tue Aug 22 21:02:32 2006
@@ -22,8 +22,6 @@
/**
*
- * SerializerDefinition is ...
- *
* @author Dan Jemiolo (danj)
*
*/
@@ -56,6 +54,11 @@
return _serializerClass;
}
+ public void setEnvironment(Environment environment)
+ {
+ _environment = environment;
+ }
+
public void setSerializableType(Class serializableType)
{
_serializableType = serializableType;
@@ -64,10 +67,5 @@
public void setSerializerClass(Class serializerClass)
{
_serializerClass = serializerClass;
- }
-
- public void setEnvironment(Environment environment)
- {
- _environment = environment;
}
}
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SerializerDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SerializerDescriptor.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SerializerDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SerializerDescriptor.java Tue Aug 22 21:02:32 2006
@@ -23,8 +23,6 @@
/**
*
- * SerializerDescriptor is ...
- *
* @author Dan Jemiolo (danj)
*
*/
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleCapabilityDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleCapabilityDescriptor.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleCapabilityDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleCapabilityDescriptor.java Tue Aug 22 21:02:32 2006
@@ -27,8 +27,6 @@
/**
*
- * SimpleCapabilityDescriptor is ...
- *
* @author Dan Jemiolo (danj)
*
*/
@@ -37,24 +35,6 @@
{
private CapabilityDefinition _definition = null;
- public void load(Element xml, Environment environment)
- throws SoapFault
- {
- String uri = createURI(xml);
- Class implClass = createImplementationClass(xml, environment);
- PersistenceDefinition persistence = createPersistence(xml, environment);
-
- InitParamDescriptor paramDesc = createInitParamDescriptor();
- paramDesc.load(xml);
- Map parameters = paramDesc.getInitializationParameters();
-
- _definition = new CapabilityDefinition();
- _definition.setURI(uri);
- _definition.setImplementationClass(implClass);
- _definition.setPersistenceDefinition(persistence);
- _definition.setInitializationParameters(parameters);
- }
-
protected Class createImplementationClass(Element xml, Environment env)
{
String className = XmlUtils.getElementText(xml, DescriptorConstants.JAVA_CAPABILITY_QNAME);
@@ -101,5 +81,23 @@
public CapabilityDefinition getCapabilityDefinition()
{
return _definition;
+ }
+
+ public void load(Element xml, Environment environment)
+ throws SoapFault
+ {
+ String uri = createURI(xml);
+ Class implClass = createImplementationClass(xml, environment);
+ PersistenceDefinition persistence = createPersistence(xml, environment);
+
+ InitParamDescriptor paramDesc = createInitParamDescriptor();
+ paramDesc.load(xml);
+ Map parameters = paramDesc.getInitializationParameters();
+
+ _definition = new CapabilityDefinition();
+ _definition.setURI(uri);
+ _definition.setImplementationClass(implClass);
+ _definition.setPersistenceDefinition(persistence);
+ _definition.setInitializationParameters(parameters);
}
}
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleDeploymentDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleDeploymentDescriptor.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleDeploymentDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleDeploymentDescriptor.java Tue Aug 22 21:02:32 2006
@@ -43,10 +43,9 @@
//
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.
+ // The resource type definitions in muse.xml
//
private Collection _resourceDefinitions = null;
@@ -55,43 +54,11 @@
//
private RouterDefinition _routerDefinition = null;
+ //
+ // The custom serializers defined by the user
+ //
private Collection _serializerDefinitions = null;
- public void load(Document xml, Environment environment)
- throws SoapFault
- {
- if (xml == null)
- throw new NullPointerException(_MESSAGES.get("NullDescriptorDocument"));
-
- if (environment == null)
- throw new NullPointerException(_MESSAGES.get("NullEnvironment"));
-
- 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...
- //
- _routerDefinition= createRouterDefinition(root, environment);
-
- //
- // there will be one definition for each resource type
- //
- _resourceDefinitions = createResourceDefinitions(root, environment);
-
- _routerDefinition.setResourceDefinitions(_resourceDefinitions);
- }
-
protected Collection createResourceDefinitions(Element xml, Environment env)
throws SoapFault
{
@@ -116,11 +83,6 @@
return new SimpleResourceDescriptor();
}
- protected RouterDescriptor createRouterDescriptor()
- {
- return new SimpleRouterDescriptor();
- }
-
protected RouterDefinition createRouterDefinition(Element xml, Environment env)
throws SoapFault
{
@@ -132,9 +94,9 @@
return rd.getRouterDefinition();
}
- protected SerializerDescriptor createSerializerDescriptor()
+ protected RouterDescriptor createRouterDescriptor()
{
- return new SimpleSerializerDescriptor();
+ return new SimpleRouterDescriptor();
}
public Collection createSerializerDefinitions(Element xml, Environment env)
@@ -157,9 +119,9 @@
return definitions;
}
- public Collection getSerializerDefinitions()
+ protected SerializerDescriptor createSerializerDescriptor()
{
- return _serializerDefinitions;
+ return new SimpleSerializerDescriptor();
}
public Collection getResourceDefinitions()
@@ -170,5 +132,44 @@
public RouterDefinition getRouterDefinition()
{
return _routerDefinition;
+ }
+
+ public Collection getSerializerDefinitions()
+ {
+ return _serializerDefinitions;
+ }
+
+ public void load(Document xml, Environment environment)
+ throws SoapFault
+ {
+ Element root = XmlUtils.getFirstElement(xml);
+ QName rootName = XmlUtils.getElementQName(root);
+
+ //
+ // make sure we're starting with a valid muse.xml
+ //
+ if (!rootName.equals(DescriptorConstants.MUSE_QNAME))
+ {
+ Object[] filler = { DescriptorConstants.MUSE_QNAME, rootName };
+ throw new RuntimeException(_MESSAGES.get("InvalidDescriptorRoot", filler));
+ }
+
+ //
+ // 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...
+ //
+ _routerDefinition= createRouterDefinition(root, environment);
+
+ //
+ // there will be one definition for each resource type
+ //
+ _resourceDefinitions = createResourceDefinitions(root, environment);
+
+ _routerDefinition.setResourceDefinitions(_resourceDefinitions);
}
}
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimplePersistenceDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimplePersistenceDescriptor.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimplePersistenceDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimplePersistenceDescriptor.java Tue Aug 22 21:02:32 2006
@@ -29,6 +29,13 @@
import org.apache.muse.util.xml.XmlUtils;
import org.apache.muse.ws.addressing.soap.SoapFault;
+/**
+ *
+ *
+ * @author Dan Jemiolo (danj)
+ *
+ */
+
public class SimplePersistenceDescriptor implements PersistenceDescriptor
{
//
@@ -44,27 +51,6 @@
return new SimpleInitParamDescriptor();
}
- public PersistenceDefinition getPersistenceDefinition()
- {
- return _definition;
- }
-
- public void load(Element persistenceXML, Environment env)
- throws SoapFault
- {
- Class theClass = createPersistenceClass(persistenceXML, env);
- String location = createPersistenceLocation(persistenceXML);
-
- InitParamDescriptor paramDesc = createInitParamDescriptor();
- paramDesc.load(persistenceXML);
- Map parameters = paramDesc.getInitializationParameters();
-
- _definition = new PersistenceDefinition();
- _definition.setPersistenceClass(theClass);
- _definition.setPersistenceLocation(location);
- _definition.setInitializationParameters(parameters);
- }
-
protected Class createPersistenceClass(Element persistenceXML, Environment env)
{
String className = XmlUtils.getElementText(persistenceXML, DescriptorConstants.JAVA_PERSISTENCE_QNAME);
@@ -84,9 +70,30 @@
return theClass;
}
-
+
protected String createPersistenceLocation(Element persistenceXML)
{
return XmlUtils.getElementText(persistenceXML, DescriptorConstants.PERSISTENCE_LOCATION_QNAME);
+ }
+
+ public PersistenceDefinition getPersistenceDefinition()
+ {
+ return _definition;
+ }
+
+ public void load(Element persistenceXML, Environment env)
+ throws SoapFault
+ {
+ Class theClass = createPersistenceClass(persistenceXML, env);
+ String location = createPersistenceLocation(persistenceXML);
+
+ InitParamDescriptor paramDesc = createInitParamDescriptor();
+ paramDesc.load(persistenceXML);
+ Map parameters = paramDesc.getInitializationParameters();
+
+ _definition = new PersistenceDefinition();
+ _definition.setPersistenceClass(theClass);
+ _definition.setPersistenceLocation(location);
+ _definition.setInitializationParameters(parameters);
}
}
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleResourceDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleResourceDescriptor.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleResourceDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleResourceDescriptor.java Tue Aug 22 21:02:32 2006
@@ -51,156 +51,21 @@
/**
*
- * SimpleResourceDescriptor is ...
- *
* @author Dan Jemiolo (danj)
*
*/
public class SimpleResourceDescriptor implements ResourceDescriptor
{
- private static final String _REQUIRED_CAPABILITIES = "org.apache.muse.core.descriptor.ext.RequiredCapabilityImplementations";
-
//
// Used to lookup all exception messages
//
private static Messages _MESSAGES =
MessagesFactory.get(SimpleResourceDescriptor.class);
- private ResourceDefinition _definition = null;
-
- public void load(Element xml, Environment environment)
- throws SoapFault
- {
- if (xml == null)
- throw new NullPointerException(_MESSAGES.get("NullResourceElement"));
-
- if (environment == null)
- throw new NullPointerException(_MESSAGES.get("NullEnvironment"));
-
- boolean isUsingPersistence = createUsingPersistence(xml);
- String contextPath = createContextPath(xml);
- WsdlConfig wsdl = createWSDL(xml);
- ResourceIdFactory idFactory = createResourceIdFactory(xml, environment);
- Class resourceClass = createResourceClass(xml, environment);
- Collection capabilities = createCapabilityDefinitions(xml, environment, wsdl);
-
- InitParamDescriptor paramDesc = createInitParamDescriptor();
- paramDesc.load(xml);
- Map parameters = paramDesc.getInitializationParameters();
-
- _definition = new ResourceDefinition();
- _definition.setEnvironment(environment);
- _definition.setUsingPersistence(isUsingPersistence);
- _definition.setContextPath(contextPath);
- _definition.setWsdlConfig(wsdl);
- _definition.setResourceIdFactory(idFactory);
- _definition.setResourceClass(resourceClass);
- _definition.setCapabilityDefinitions(capabilities);
- _definition.setInitializationParameters(parameters);
- }
-
- private String getMethodName(String actionName)
- {
- return Character.toLowerCase(actionName.charAt(0)) + actionName.substring(1);
- }
-
- protected InitParamDescriptor createInitParamDescriptor()
- {
- return new SimpleInitParamDescriptor();
- }
-
- protected MessageHandler createMessageHandler(String actionURI,
- QName operationName,
- QName returnValueName)
- {
- return new ReflectionMessageHandler(actionURI, operationName, returnValueName);
- }
-
- protected Collection createMessageHandlers(Document wsdlDoc, Map opsByAction, Class theClass)
- {
- Map methodsByName = new HashMap();
-
- Method[] methods = theClass.getMethods();
-
- for (int n = 0; n < methods.length; ++n)
- {
- Class declaringClass = methods[n].getDeclaringClass();
-
- if (declaringClass != Object.class &&
- declaringClass != Capability.class)
- methodsByName.put(methods[n].getName(), methods[n]);
- }
-
- Collection handlers = new ArrayList(opsByAction.size());
- Iterator i = opsByAction.keySet().iterator();
-
- while (i.hasNext())
- {
- String action = (String)i.next();
- Operation next = (Operation)opsByAction.get(action);
-
- QName inputName = WsdlUtils.getInputPartName(next);
- QName outputName = WsdlUtils.getOutputPartName(next, wsdlDoc);
-
- String localName = next.getName();
- String methodName = getMethodName(localName);
- Method method = (Method)methodsByName.get(methodName);
-
- if (method != null)
- {
- MessageHandler handler = createMessageHandler(action, inputName, outputName);
- handler.setMethod(method);
-
- handlers.add(handler);
-
- i.remove();
- }
- }
-
- return handlers;
- }
+ private static final String _REQUIRED_CAPABILITIES = "org.apache.muse.core.descriptor.ext.RequiredCapabilityImplementations";
- 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 = WsdlUtils.createDefinition(wsdlDoc, wsdlDir);
-
- //
- // 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 " + portTypeName);
-
- 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;
- }
+ private ResourceDefinition _definition = null;
protected Collection createCapabilityDefinitions(Element xml,
Environment env,
@@ -267,8 +132,11 @@
definitions.add(definition);
}
- if (!opsByAction.isEmpty()) // FIXME: extract message
- throw new SoapFault("Not all operations were implemented: " + opsByAction.keySet());
+ if (!opsByAction.isEmpty())
+ {
+ Object[] filler = { wsdlConfig.getWsdlPath(), opsByAction.keySet() };
+ throw new RuntimeException(_MESSAGES.get("MissingOperationImplementations", filler));
+ }
return definitions;
}
@@ -284,11 +152,67 @@
String path = XmlUtils.getElementText(xml, qname);
if (path == null)
- throw new RuntimeException(_MESSAGES.get("NullEndpoint"));
+ throw new RuntimeException(_MESSAGES.get("NullContextPath"));
return path;
}
+ protected InitParamDescriptor createInitParamDescriptor()
+ {
+ return new SimpleInitParamDescriptor();
+ }
+
+ protected MessageHandler createMessageHandler(String actionURI,
+ QName operationName,
+ QName returnValueName)
+ {
+ return new ReflectionMessageHandler(actionURI, operationName, returnValueName);
+ }
+
+ protected Collection createMessageHandlers(Document wsdlDoc, Map opsByAction, Class theClass)
+ {
+ Map methodsByName = new HashMap();
+
+ Method[] methods = theClass.getMethods();
+
+ for (int n = 0; n < methods.length; ++n)
+ {
+ Class declaringClass = methods[n].getDeclaringClass();
+
+ if (declaringClass != Object.class &&
+ declaringClass != Capability.class)
+ methodsByName.put(methods[n].getName(), methods[n]);
+ }
+
+ Collection handlers = new ArrayList(opsByAction.size());
+ Iterator i = opsByAction.keySet().iterator();
+
+ while (i.hasNext())
+ {
+ String action = (String)i.next();
+ Operation next = (Operation)opsByAction.get(action);
+
+ QName inputName = WsdlUtils.getInputPartName(next);
+ QName outputName = WsdlUtils.getOutputPartName(next, wsdlDoc);
+
+ String localName = next.getName();
+ String methodName = getMethodName(localName);
+ Method method = (Method)methodsByName.get(methodName);
+
+ if (method != null)
+ {
+ MessageHandler handler = createMessageHandler(action, inputName, outputName);
+ handler.setMethod(method);
+
+ handlers.add(handler);
+
+ i.remove();
+ }
+ }
+
+ return handlers;
+ }
+
protected Map createRequiredClasses(Environment env)
{
ResourceBundle bundle = null;
@@ -322,6 +246,27 @@
return requiredClassesByURI;
}
+ 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("NullJavaResourceClass"));
+
+ ClassLoader loader = env.getClassLoader();
+ Class resourceClass = ReflectUtils.getClass(className, loader);
+
+ if (!Resource.class.isAssignableFrom(resourceClass))
+ {
+ Object[] filler = { className, Resource.class.getName() };
+ String message = _MESSAGES.get("IncorrectResourceRoot", filler);
+ throw new RuntimeException(message);
+ }
+
+ return resourceClass;
+ }
+
protected ResourceIdFactory createResourceIdFactory(Element xml,
Environment env)
{
@@ -338,7 +283,7 @@
if (!ResourceIdFactory.class.isAssignableFrom(theClass))
{
- Object[] filler = { className };
+ Object[] filler = { className, ResourceIdFactory.class.getName() };
throw new RuntimeException(_MESSAGES.get("NotResourceIdFactory", filler));
}
@@ -353,7 +298,7 @@
String attr = xml.getAttribute(DescriptorConstants.USE_ROUTER_PERSISTENCE);
return Boolean.valueOf(attr).booleanValue();
}
-
+
protected WsdlConfig createWSDL(Element xml)
{
QName qname = DescriptorConstants.WSDL_QNAME;
@@ -387,29 +332,82 @@
return wsdl;
}
- protected Class createResourceClass(Element xml, Environment env)
+ private String getMethodName(String actionName)
{
- QName qname = DescriptorConstants.JAVA_RESOURCE_QNAME;
- String className = XmlUtils.getElementText(xml, qname);
+ return Character.toLowerCase(actionName.charAt(0)) + actionName.substring(1);
+ }
- if (className == null)
- throw new RuntimeException(_MESSAGES.get("NullJavaBase"));
+ public ResourceDefinition getResourceDefinition()
+ {
+ return _definition;
+ }
+
+ protected Map getWsdlOperations(Document wsdlDoc,
+ WsdlConfig wsdlConfig,
+ Environment env)
+ {
+ String wsdlPath = wsdlConfig.getWsdlPath();
+ String absolutePath = env.getRealDirectory().getAbsolutePath();
- ClassLoader loader = env.getClassLoader();
- Class resourceClass = ReflectUtils.getClass(className, loader);
+ if (wsdlPath.charAt(0) != '/')
+ absolutePath += '/';
- if (!Resource.class.isAssignableFrom(resourceClass))
+ absolutePath += wsdlPath;
+ File wsdlFile = new File(absolutePath);
+ File wsdlDir = wsdlFile.getParentFile();
+
+ Definition def = WsdlUtils.createDefinition(wsdlDoc, wsdlDir);
+
+ //
+ // 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)
{
- Object[] filler = { className, Resource.class.getName() };
- String message = _MESSAGES.get("IncorrectResourceRoot", filler);
- throw new RuntimeException(message);
+ Object[] filler = { absolutePath, portTypeName };
+ throw new RuntimeException(_MESSAGES.get("PortTypeNotFound", filler));
}
- return resourceClass;
+ 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;
}
- public ResourceDefinition getResourceDefinition()
+ public void load(Element xml, Environment environment)
+ throws SoapFault
{
- return _definition;
+ boolean isUsingPersistence = createUsingPersistence(xml);
+ String contextPath = createContextPath(xml);
+ WsdlConfig wsdl = createWSDL(xml);
+ ResourceIdFactory idFactory = createResourceIdFactory(xml, environment);
+ Class resourceClass = createResourceClass(xml, environment);
+ Collection capabilities = createCapabilityDefinitions(xml, environment, wsdl);
+
+ InitParamDescriptor paramDesc = createInitParamDescriptor();
+ paramDesc.load(xml);
+ Map parameters = paramDesc.getInitializationParameters();
+
+ _definition = new ResourceDefinition();
+ _definition.setEnvironment(environment);
+ _definition.setUsingPersistence(isUsingPersistence);
+ _definition.setContextPath(contextPath);
+ _definition.setWsdlConfig(wsdl);
+ _definition.setResourceIdFactory(idFactory);
+ _definition.setResourceClass(resourceClass);
+ _definition.setCapabilityDefinitions(capabilities);
+ _definition.setInitializationParameters(parameters);
}
}
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleRouterDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleRouterDescriptor.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleRouterDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleRouterDescriptor.java Tue Aug 22 21:02:32 2006
@@ -33,8 +33,6 @@
/**
*
- * SimpleRouterDescriptor is ...
- *
* @author Dan Jemiolo (danj)
*
*/
@@ -49,18 +47,9 @@
private RouterDefinition _definition = null;
- public void load(Element xml, Environment environment)
- throws SoapFault
+ protected InitParamDescriptor createInitParamDescriptor()
{
- Class routerClass = createRouterClass(xml, environment);
- LoggingConfig logging = createLogging(xml, environment);
- PersistenceDefinition persistence = createPersistence(xml, environment);
-
- _definition = new RouterDefinition();
- _definition.setEnvironment(environment);
- _definition.setRouterClass(routerClass);
- _definition.setLoggingConfig(logging);
- _definition.setPersistenceDefinition(persistence);
+ return new SimpleInitParamDescriptor();
}
protected File createLogFile(Element logging, Environment env)
@@ -70,21 +59,6 @@
return new File(env.getRealDirectory(), location);
}
- protected Level createLogLevel(Element logging)
- {
- //
- // get the logging level - this will be default for all resource
- // instances created by the application
- //
- QName qname = DescriptorConstants.LOG_LEVEL_QNAME;
- String levelString = XmlUtils.getElementText(logging, qname);
-
- if (levelString == null)
- return Level.INFO;
-
- return Level.parse(levelString.trim());
- }
-
protected LoggingConfig createLogging(Element xml, Environment env)
{
QName qname = DescriptorConstants.LOGGING_QNAME;
@@ -101,9 +75,19 @@
return logging;
}
- protected InitParamDescriptor createInitParamDescriptor()
+ protected Level createLogLevel(Element logging)
{
- return new SimpleInitParamDescriptor();
+ //
+ // get the logging level - this will be default for all resource
+ // instances created by the application
+ //
+ QName qname = DescriptorConstants.LOG_LEVEL_QNAME;
+ String levelString = XmlUtils.getElementText(logging, qname);
+
+ if (levelString == null)
+ return Level.INFO;
+
+ return Level.parse(levelString.trim());
}
protected PersistenceDefinition createPersistence(Element xml, Environment env)
@@ -148,5 +132,19 @@
public RouterDefinition getRouterDefinition()
{
return _definition;
+ }
+
+ public void load(Element xml, Environment environment)
+ throws SoapFault
+ {
+ Class routerClass = createRouterClass(xml, environment);
+ LoggingConfig logging = createLogging(xml, environment);
+ PersistenceDefinition persistence = createPersistence(xml, environment);
+
+ _definition = new RouterDefinition();
+ _definition.setEnvironment(environment);
+ _definition.setRouterClass(routerClass);
+ _definition.setLoggingConfig(logging);
+ _definition.setPersistenceDefinition(persistence);
}
}
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleSerializerDescriptor.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleSerializerDescriptor.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleSerializerDescriptor.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/SimpleSerializerDescriptor.java Tue Aug 22 21:02:32 2006
@@ -27,8 +27,6 @@
/**
*
- * SimpleSerializerDescriptor is ...
- *
* @author Dan Jemiolo (danj)
*
*/
@@ -43,17 +41,6 @@
private SerializerDefinition _definition = null;
- public void load(Element xml, Environment environment)
- {
- Class serializableType = createSerializableType(xml, environment);
- Class serializerClass = createSerializerClass(xml, environment);
-
- _definition = new SerializerDefinition();
- _definition.setEnvironment(environment);
- _definition.setSerializableType(serializableType);
- _definition.setSerializerClass(serializerClass);
- }
-
protected Class createSerializableType(Element xml, Environment env)
{
String className = XmlUtils.getElementText(xml, DescriptorConstants.JAVA_SERIALIZABLE_QNAME);
@@ -76,7 +63,7 @@
if (!Serializer.class.isAssignableFrom(serializerClass))
{
- Object[] filler = { serializerName };
+ Object[] filler = { serializerName, Serializer.class.getName() };
throw new RuntimeException(_MESSAGES.get("NotSerializer", filler));
}
@@ -86,5 +73,16 @@
public SerializerDefinition getSerializerDefinition()
{
return _definition;
+ }
+
+ public void load(Element xml, Environment environment)
+ {
+ Class serializableType = createSerializableType(xml, environment);
+ Class serializerClass = createSerializerClass(xml, environment);
+
+ _definition = new SerializerDefinition();
+ _definition.setEnvironment(environment);
+ _definition.setSerializableType(serializableType);
+ _definition.setSerializerClass(serializerClass);
}
}
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/WsdlConfig.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/WsdlConfig.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/WsdlConfig.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/descriptor/WsdlConfig.java Tue Aug 22 21:02:32 2006
@@ -20,8 +20,6 @@
/**
*
- * WsdlConfig is ...
- *
* @author Dan Jemiolo (danj)
*
*/
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/platform/AbstractIsolationLayer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/platform/AbstractIsolationLayer.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/platform/AbstractIsolationLayer.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/platform/AbstractIsolationLayer.java Tue Aug 22 21:02:32 2006
@@ -88,7 +88,15 @@
// are transformed into POJOs and actual implementations invoked.
//
private static ResourceRouter _router = null;
-
+
+ /**
+ *
+ * This method can be overridden to provide a different deployment
+ * descriptor parser implementation.
+ *
+ * @return An instance of SimpleDeploymentDescriptor
+ *
+ */
protected DeploymentDescriptor createDeploymentDescriptor()
{
return new SimpleDeploymentDescriptor();
@@ -96,12 +104,10 @@
/**
*
- * @return The Environment provides a platform-independent interface
- * into many tasks that rely on platform-specific APIs. It is
- * also the glue that ties together resource management and
- * resource discovery services. Resource classes will often use
- * the Environment to find information about other resources
- * and find artifacts that are local and remote.
+ * @return A concrete instance of the Environment class, specific to
+ * the deployment platform.
+ *
+ * @see Environment
*
*/
protected abstract Environment createEnvironment();
@@ -128,6 +134,9 @@
try
{
+ //
+ // load the muse.xml descriptor file
+ //
Environment env = createEnvironment();
DeploymentDescriptor dd = createDeploymentDescriptor();
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/platform/IsolationLayer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/platform/IsolationLayer.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/platform/IsolationLayer.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/platform/IsolationLayer.java Tue Aug 22 21:02:32 2006
@@ -26,7 +26,8 @@
* IsolationLayer is the web service that is registered with the service
* container; it is the starting point for all Muse application initialization
* and request handling events. The behavior of this component is mostly
- * defined by an instance of {@linkplain org.apache.muse.core.descriptor.DeploymentDescriptor DeploymentDescriptor},
+ * defined by an instance of
+ * {@linkplain org.apache.muse.core.descriptor.DeploymentDescriptor DeploymentDescriptor},
* although concrete isolation layers will also rely on platform-specific
* deployment artifacts and APIs.
* <br><br>
@@ -45,5 +46,11 @@
public interface IsolationLayer
extends Initialization, InitializationFailure, Shutdown
{
+ /**
+ *
+ * @return The router instance that is responsible for delegating SOAP
+ * requests in a platform-independent way.
+ *
+ */
ResourceRouter getRouter();
}
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/ReflectionProxyHandler.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/ReflectionProxyHandler.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/ReflectionProxyHandler.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/proxy/ReflectionProxyHandler.java Tue Aug 22 21:02:32 2006
@@ -39,6 +39,8 @@
* a Serializer for that type in order to take advantage of this class.
*
* @author Dan Jemiolo (danj)
+ *
+ * @see Serializer
*
*/
@@ -103,6 +105,41 @@
}
}
+ public Object fromXML(Element xml)
+ throws SoapFault
+ {
+ //
+ // make sure the response fits the callout definition
+ //
+ QName correctName = getResponseName();
+ QName actualName = XmlUtils.getElementQName(xml);
+
+ //
+ // if no response name is provided, it means we accept "xsd:anyType"
+ //
+ if (correctName != null && !correctName.equals(actualName))
+ {
+ Object[] filler = { correctName, actualName };
+ String message = _MESSAGES.get("InvalidProxyResponse", filler);
+ throw new SoapFault(message);
+ }
+
+ //
+ // if the value is a simple type, use the root of the
+ // response body
+ //
+ Element child = XmlUtils.getFirstElement(xml);
+ Class returnType = getReturnType();
+
+ if (child == null || returnType.isArray())
+ child = xml;
+
+ //
+ // now we can deserialize the contents
+ //
+ return deserialize(child, returnType);
+ }
+
/**
*
* Serializes the given object using the Serializer registered for the
@@ -177,41 +214,6 @@
fixComplexType(child);
return xml;
- }
-
- public Object fromXML(Element xml)
- throws SoapFault
- {
- //
- // make sure the response fits the callout definition
- //
- QName correctName = getResponseName();
- QName actualName = XmlUtils.getElementQName(xml);
-
- //
- // if no response name is provided, it means we accept "xsd:anyType"
- //
- if (correctName != null && !correctName.equals(actualName))
- {
- Object[] filler = { correctName, actualName };
- String message = _MESSAGES.get("InvalidProxyResponse", filler);
- throw new SoapFault(message);
- }
-
- //
- // if the value is a simple type, use the root of the
- // response body
- //
- Element child = XmlUtils.getFirstElement(xml);
- Class returnType = getReturnType();
-
- if (child == null || returnType.isArray())
- child = xml;
-
- //
- // now we can deserialize the contents
- //
- return deserialize(child, returnType);
}
public Element toXML(Object[] parameters)
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/AbstractMessageHandler.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/AbstractMessageHandler.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/AbstractMessageHandler.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/AbstractMessageHandler.java Tue Aug 22 21:02:32 2006
@@ -49,6 +49,9 @@
*/
public static final Object[] EMPTY_REQUEST = new Object[0];
+ //
+ // The WS-A Action URI that maps to the operation
+ //
private String _actionURI = null;
//
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/CounterResourceIdFactory.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/CounterResourceIdFactory.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/CounterResourceIdFactory.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/CounterResourceIdFactory.java Tue Aug 22 21:02:32 2006
@@ -36,16 +36,16 @@
private int _count = 1;
- private String _name = null;
+ private String _counterPrefix = null;
public CounterResourceIdFactory()
{
this(_DEFAULT_NAME);
}
- public CounterResourceIdFactory(String name)
+ public CounterResourceIdFactory(String counterPrefix)
{
- _name = name;
+ _counterPrefix = counterPrefix;
}
/**
@@ -66,6 +66,6 @@
*/
public String getNextIdentifier()
{
- return _name + '-' + _count++;
+ return _counterPrefix + '-' + _count++;
}
}
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/MessageHandler.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/MessageHandler.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/MessageHandler.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/MessageHandler.java Tue Aug 22 21:02:32 2006
@@ -28,9 +28,7 @@
*
* MessageHandler defines the methods needed to serialize and deserialize the
* parameters and responses for a web service operation. It also references a
- * Java method that is used to invoke the operation; this method can be used
- * by implementations of this interface to perform serialization and type
- * safety checks.
+ * Java method that is used to invoke the operation.
* <br><br>
* This interface is used for <b>receiving</b> incoming messages on the
* server-side, not the client-side. <b>Sending</b> web service requests is
@@ -67,13 +65,17 @@
* <li>If any child elements could not be deserialized into an object.</li>
* </ul>
*
- * @see org.apache.muse.core.serializer.Serializer#fromXML(Element)
- *
+ * @see org.apache.muse.core.serializer.Serializer#fromXML(Element)
*
*/
Object[] fromXML(Element xml)
throws SoapFault;
+ /**
+ *
+ * @return The WS-A Action associated with the handler's operation.
+ *
+ */
String getAction();
/**
@@ -127,7 +129,6 @@
* </ul>
*
* @see #getResponseName()
- *
* @see org.apache.muse.core.serializer.Serializer#toXML(Object, QName)
*
*/
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/Messages.properties?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/Messages.properties (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/Messages.properties Tue Aug 22 21:02:32 2006
@@ -10,3 +10,6 @@
IncorrectParams=The target method 'XXX' expected XXX parameters, but the caller sent XXX.
NoEnvironment=The router's Environment must be set with setEnvironment() before it can be initialized (via initialize()). Make sure that a org.apache.muse.core.Environment is provided right after the router is instantiated.
RouterIsInitialized=The resource router has been initialized.
+NoAddressingContext = There is no addressing context available for this request (thread).
+NullResourceDefinitions=The collection of ResourceDefinition objects is null.
+NullResourceManager=The ResourceManager reference is null.
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ReflectionMessageHandler.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ReflectionMessageHandler.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ReflectionMessageHandler.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ReflectionMessageHandler.java Tue Aug 22 21:02:32 2006
@@ -34,7 +34,7 @@
* ReflectionMessageHandler is a generic implementation of
* {@linkplain org.apache.muse.core.routing.MessageHandler MessageHandler}
* that can be applied to any Java method. It uses reflection to determine
- * what types are being used by a method and then invokes the
+ * what types are being used by a method signature and then invokes the
* {@linkplain Serializer Serializers} that have been registered with Muse
* to do the XML/POJO transformations. If a method references a type that is
* not included in Muse's set of built-in Serializers, you must register a
@@ -42,7 +42,9 @@
* <br><br>
* Muse uses this class by default if no MessageHandler is specified for
* a user-defined operation. Application initialization will fail if this
- * default is specified but no Serializer is provided for a user-defined type.
+ * default is specified but no Serializer is provided for a user-defined type.
+ * You can add custom MessageHandlers to your own capabilities programmatically
+ * using the Capability.setMessageHandlers() method.
*
* @author Dan Jemiolo (danj)
*
@@ -160,9 +162,17 @@
Class returnType = method.getReturnType();
+ //
+ // void methods -> empty element
+ //
if (returnType == Void.TYPE)
return XmlUtils.createElement(getResponseName());
-
+
+ //
+ // for all non-void methods, we need to find the serializer
+ // for the return type, then determine if it's an array and
+ // deal with it accordingly
+ //
SerializerRegistry registry = SerializerRegistry.getInstance();
Serializer ser = registry.getSerializer(returnType);
@@ -170,15 +180,27 @@
QName responseBodyName = getResponseName();
boolean isComplex = true;
+ //
+ // for many simple return types, we just embed the value in
+ // the body's response element
+ //
if (returnValueName == null)
{
isComplex = false;
returnValueName = responseBodyName;
}
+ //
+ // for complex types, we need a child element under the
+ // response body element
+ //
Element responseXML = XmlUtils.createElement(responseBodyName);
Element valueXML = ser.toXML(result, returnValueName);
+ //
+ // for arrays, we put the children (array items) under the
+ // response body element
+ //
if (returnType.isArray())
XmlUtils.moveSubTree(valueXML, responseXML);
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ResourceIdFactory.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ResourceIdFactory.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ResourceIdFactory.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ResourceIdFactory.java Tue Aug 22 21:02:32 2006
@@ -23,11 +23,10 @@
* ResourceIdFactory is an interface for classes that provide a name-value
* pair that is inserted into a WS-Addressing endpoint reference's set of
* properties in order to distinguish it from other EPRs that target the
- * same endpoint (the implied resource pattern). A resource's
- * {@linkplain org.apache.muse.core.descriptor.ResourceDefinition ResourceDefinition}
- * uses instances of this interface to provide the resource with a unique EPR.
- * You can set which ResourceIdFactory is used for a resource type using
- * the <code><java-id-factory-class/></code> element in muse.xml.
+ * same endpoint (the implied resource pattern). The resource creation
+ * process uses instances of this interface to provide the resource with a
+ * unique EPR. You can set which ResourceIdFactory is used for a resource type
+ * using the <em>java-id-factory-class</em> element in muse.xml.
*
* @author Dan Jemiolo (danj)
*
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ResourceRouter.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ResourceRouter.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ResourceRouter.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/ResourceRouter.java Tue Aug 22 21:02:32 2006
@@ -28,14 +28,13 @@
/**
*
* ResourceRouter is the gateway to the generic resource layer that sits on
- * top of the {@linkplain org.apache.muse.core.platform.IsolationLayer isolation layer}.
- * It is <em>generic</em> because it has no platform-specific dependencies -
- * it uses raw SOAP and WS-Addressing data to match requests with the resources
- * being targeted by the client. The concrete
- * {@linkplain org.apache.muse.core.platform.IsolationLayer IsolationLayer}
- * classes simply extract this data in the platform-specific way and then
- * delegate control to the ResourceRouter. There should only be one
- * ResourceRouter per application.
+ * top of the isolation layer. It is <em>generic</em> because it has no
+ * platform-specific dependencies - it uses raw SOAP and WS-Addressing data
+ * to match requests with the resources being targeted by the client. The
+ * isolation layer simply extracts this data in the platform-specific way and
+ * then delegates control to the ResourceRouter, which further delegates to
+ * an individual {@linkplain org.apache.muse.core.Resource Resource object}.
+ * There should only be one ResourceRouter per application.
*
* @author Dan Jemiolo (danj)
*
@@ -45,69 +44,58 @@
{
/**
*
- * @return The Muse Environment that is used to provide the resource
- * with access to the "outside world" (deployment information
- * and underlying platform).
- *
+ * @return The router's access point for things such as the
+ * WS-Addressing context, file system resources, and more.
+ *
*/
Environment getEnvironment();
/**
*
- * @return The Logger used to record router-generated events. Concrete
- * classes may choose to record resource-generated events as well.
+ * @return The JDK logger that writes to the Muse log file.
*
*/
Logger getLog();
+ /**
+ *
+ * @return The persistence mechanism for the router, or null if none
+ * was defined.
+ *
+ */
RouterPersistence getPersistence();
+ /**
+ *
+ * @return The collection of ResourceDefinition objects representing
+ * all of the resource types that the router controls.
+ *
+ */
Collection getResourceDefinitions();
/**
*
* This is a generic method invocation mechanism that can be used to
- * delegate request handling to a specific method. The method in question
- * may be implemented by the router class itself (rare) or by one of its
- * resource classes (common). Normal behavior would be for the router to
- * first see if it could handle the operation itself, and if not, try to
- * delegate it to a resource before giving up. This method should be used
- * by the isolation layer in order to process external requests.
+ * delegate request handling to a specific Resource. This method should be
+ * used by the isolation layer in order to process external requests.
*
* @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 there was
- * an error while processing the request, the value will be a WS-BF
- * BaseFault in XML form.
+ * an error while processing the request, the value will be a
+ * SOAP v1.2 fault, in XML form.
*
* @see org.apache.muse.core.Resource#invoke(Element)
*
*/
Element invoke(Element soapBody);
-
- /**
- *
- * Provides the router with the Muse Environment needed to access
- * deployment information and underlying platform features. <b>This field
- * must be set before the router can be initialized.</b>
- *
- * @param environment
- *
- */
+
void setEnvironment(Environment environment);
- /**
- *
- * Provides the router with the Logger it should use to record events.
- * <b>This field must be set before the router can be initialized.</b>
- *
- * @param log
- *
- */
void setLog(Logger log);
- void setResourceDefinitions(Collection definitions);
-
void setPersistence(RouterPersistence persistence);
+
+ void setResourceDefinitions(Collection definitions);
}
Modified: webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/RouterFilePersistence.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/RouterFilePersistence.java?rev=433870&r1=433869&r2=433870&view=diff
==============================================================================
--- webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/RouterFilePersistence.java (original)
+++ webservices/muse/trunk/modules/muse-core/src/org/apache/muse/core/routing/RouterFilePersistence.java Tue Aug 22 21:02:32 2006
@@ -42,6 +42,15 @@
public class RouterFilePersistence
extends AbstractFilePersistence implements RouterPersistence
{
+ /**
+ *
+ * {@inheritDoc}
+ * <br><br>
+ * This implementation serializes the EPR to XML, then writes the
+ * wsa:ReferenceParameters element to the file. If the EPR had no
+ * reference parameters, an empty element is written.
+ *
+ */
protected void createResourceFile(EndpointReference epr, Resource resource, File resourceFile)
throws SoapFault
{
@@ -67,6 +76,26 @@
}
}
+ /**
+ *
+ * @return The string 'resource-instance-'.
+ *
+ */
+ protected String getFilePrefix()
+ {
+ return "resource-instance-";
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ * <br><br>
+ * This implementation treats the XML fragment as a wsa:ReferenceParameters
+ * element. It creates an EPR for the given resource type (context path)
+ * and then adds the reference parameters to it. Finally, it creates an
+ * instance of the resource type and (re-)sets the EPR that it has constructed.
+ *
+ */
protected Resource reloadResource(String contextPath, Element resourceXML)
throws SoapFault
{
@@ -113,6 +142,12 @@
return resource;
}
+ /**
+ *
+ * This implementation checks to see if the resource type is one that
+ * is being persisted, and if so, creates a file for the instance.
+ *
+ */
public void resourceAdded(EndpointReference epr, Resource resource)
throws SoapFault
{
@@ -122,6 +157,12 @@
createResourceFile(epr, resource);
}
+ /**
+ *
+ * This implementation checks to see if the resource type is one that
+ * is being persisted, and if so, tries to delete the resource's file.
+ *
+ */
public void resourceRemoved(EndpointReference epr)
throws SoapFault
{
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org