You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pubscribe-commits@ws.apache.org by ip...@apache.org on 2005/07/20 17:06:10 UTC
svn commit: r219923 - in
/webservices/pubscribe/trunk/src/java/org/apache/ws: eventing/
eventing/pubsub/ notification/base/impl/ notification/base/v2004_06/impl/
notification/base/v2004_06/porttype/impl/ notification/pubsub/
Author: ips
Date: Wed Jul 20 08:06:09 2005
New Revision: 219923
URL: http://svn.apache.org/viewcvs?rev=219923&view=rev
Log:
updated to compile against recent refactorings in WSRF
Removed:
webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/pubsub/AbstractSubscriptionHome.java
webservices/pubscribe/trunk/src/java/org/apache/ws/notification/pubsub/AbstractSubscriptionHome.java
Modified:
webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/AbstractSubscription.java
webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/Subscription.java
webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/SubscriptionHome.java
webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/pubsub/Subscriber.java
webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/pubsub/Subscription.java
webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/pubsub/SubscriptionHome.java
webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java
webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionHome.java
webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionResource.java
webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java
webservices/pubscribe/trunk/src/java/org/apache/ws/notification/pubsub/Subscriber.java
webservices/pubscribe/trunk/src/java/org/apache/ws/notification/pubsub/SubscriptionHome.java
Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/AbstractSubscription.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/AbstractSubscription.java?rev=219923&r1=219922&r2=219923&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/AbstractSubscription.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/AbstractSubscription.java Wed Jul 20 08:06:09 2005
@@ -20,7 +20,6 @@
import org.apache.ws.pubsub.NotificationProducer;
import org.apache.ws.pubsub.SubscriptionEndConsumer;
import org.apache.ws.resource.ResourceHome;
-import org.apache.ws.resource.ResourceKey;
import org.apache.ws.resource.lifetime.ResourceTerminationListener;
import java.util.Calendar;
@@ -34,17 +33,10 @@
protected Calendar m_terminationTime;
protected Calendar m_creationTime;
protected ResourceHome rH;
- protected ResourceKey rK;
protected boolean m_usenotify;
/** The EndpointReference for this resource **/
protected EndpointReference m_endpointReference;
- public void setResourceKey(ResourceKey rK){
- this.rK=rK;
- }
- public ResourceKey getResourceKey(){
- return(this.rK);
- }
public void setResourceHome(ResourceHome rH){
this.rH=rH;
}
Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/Subscription.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/Subscription.java?rev=219923&r1=219922&r2=219923&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/Subscription.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/Subscription.java Wed Jul 20 08:06:09 2005
@@ -54,7 +54,7 @@
}
public void unsubscribe(){
try{
- this.rH.remove(this.rK);
+ this.rH.remove(getID());
}catch(Exception e){
e.printStackTrace();
//TODO
Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/SubscriptionHome.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/SubscriptionHome.java?rev=219923&r1=219922&r2=219923&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/SubscriptionHome.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/SubscriptionHome.java Wed Jul 20 08:06:09 2005
@@ -20,7 +20,6 @@
import edu.berkeley.cs.db.yfilterplus.queryparser.Query;
import edu.berkeley.cs.db.yfilterplus.queryparser.XPQuery;
import edu.berkeley.cs.db.yfilterplus.xmltree.XMLTree;
-import org.apache.axis.message.addressing.Constants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ws.addressing.EndpointReference;
@@ -29,14 +28,15 @@
import org.apache.ws.resource.JndiConstants;
import org.apache.ws.resource.RemoveNotSupportedException;
import org.apache.ws.resource.ResourceException;
-import org.apache.ws.resource.ResourceKey;
import org.apache.ws.resource.ResourceUnknownException;
-import org.apache.ws.resource.impl.SimpleTypeResourceKey;
+import org.apache.ws.resource.impl.AbstractResourceHome;
+import org.apache.axis.message.addressing.Constants;
import javax.xml.namespace.QName;
import java.util.Calendar;
+import java.util.Map;
-public class SubscriptionHome extends AbstractSubscriptionHome{
+public class SubscriptionHome extends AbstractResourceHome{
private static final Log LOG = LogFactory.getLog( SubscriptionHome.class.getName() );
/** The service endpoint name as registered with the SOAP Platform. This is useful for building EPR's. **/
public static final javax.xml.namespace.QName SERVICE_NAME = javax.xml.namespace.QName.valueOf("{http://ws.apache.org/notification/base/service/SubscriptionManager}SubscriptionManager");
@@ -71,23 +71,14 @@
LOG.info("ResourceHome"+this.toString());
}
- public org.apache.ws.resource.Resource getInstance(org.apache.ws.resource.ResourceContext resourceContext) throws org.apache.ws.resource.ResourceException, org.apache.ws.resource.ResourceContextException, org.apache.ws.resource.ResourceUnknownException {
- LOG.info("getInstance ResourceHome");
- return find( resourceContext.getResourceKey() );
- }
-
public Subscription create(Filter filter, Calendar expires, java.net.URI delivery){
Subscription rs = new Subscription(filter,expires, delivery);
rs.setResourceHome(this);
String id = (String) rs.getID();
-
- SimpleTypeResourceKey resourceKey = new SimpleTypeResourceKey( QName.valueOf( getResourceKeyName()), id);
//TODO !!!!! woher kommt publisher epr url ??? HACK for tcpmon 12345-8080
String subscriptionAddress = "http://localhost:12345/axis/services/SubscriptionManager";
- EndpointReference subscriptionEPR = getEndpointReference( subscriptionAddress, resourceKey, Constants.NS_URI_ADDRESSING_2004_08 );
+ EndpointReference subscriptionEPR = getEndpointReference( subscriptionAddress, id, Constants.NS_URI_ADDRESSING_2004_08 );
rs.setEpr(subscriptionEPR);
- rs.setResourceKey(resourceKey);
-
addSubscription(rs);
return rs;
}
@@ -102,8 +93,7 @@
Query query = XPQuery.parseQuery((String)s.getFilter().getExpression(),c);
LOG.info("addSubscription "+s.getID()+" query :"+query);
yfilter.addQuery(query);
-
- add(s.getResourceKey(),s);
+ add(s.getID(),s);
queriesBack.put(s.getID(),query);
queries[c]=(String)s.getID();
}catch(Exception e){
@@ -121,20 +111,19 @@
}
*/
/**
- * Removes a resource. If the resource implements the {@link RemoveCallback RemoveCallback} interface, the
- * implementation must invoke the remove() operation on the resource itself.
+ * Removes a resource.
*
* @throws ResourceUnknownException if no resource exists with the given key
* @throws InvalidResourceKeyException if the resource key is invalid.
* @throws RemoveNotSupportedException if remove operation is not supported.
* @throws ResourceException if any other error occurs.
*/
- public void remove( ResourceKey key ) throws ResourceException {
- LOG.info("removeSubscription : "+key.getValue());
- Query q=(Query)queriesBack.get(key.getValue());
+ public void remove( Object id ) throws ResourceException {
+ LOG.info("removeSubscription : "+id);
+ Query q=(Query)queriesBack.get(id);
yfilter.deleteQuery(q,q.getQueryId());
//TODO remove from Hashmap
- super.remove(key);
+ super.remove(id);
}
public void notify(Object message) {
@@ -162,8 +151,7 @@
while(it.hasNext()){
Integer qid = (Integer) it.next();
String sid = queries[qid.intValue()];
- SimpleTypeResourceKey rk = new SimpleTypeResourceKey( QName.valueOf( getResourceKeyName()), sid);
- Subscription s = (Subscription)super.find(rk);
+ Subscription s = (Subscription)super.find(sid);
//notify matches
LOG.info("notify : "+sid);
s.getNotificationConsumer().notify(s,env.getBody());
@@ -193,6 +181,25 @@
public QName getResourceKeyNameQName()
{
return RESOURCE_KEY_NAME;
+ }
+
+ /**
+ * Map containing all FilesystemResource instances - this map <em>must</em> be static for
+ * compatibility with certain JNDI providers.
+ */
+ private static Map s_resources;
+
+ /**
+ * Returns a map of all FilesystemResource instances. Used by the {@link AbstractResourceHome}
+ * superclass.
+ */
+ protected synchronized final Map getResourceMap()
+ {
+ if ( s_resources == null )
+ {
+ s_resources = AbstractResourceHome.createResourceMap( m_resourceIsPersistent );
+ }
+ return s_resources;
}
}
Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/pubsub/Subscriber.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/pubsub/Subscriber.java?rev=219923&r1=219922&r2=219923&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/pubsub/Subscriber.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/pubsub/Subscriber.java Wed Jul 20 08:06:09 2005
@@ -16,51 +16,38 @@
package org.apache.ws.eventing.pubsub;
-import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeDocument;
-import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeResponseDocument;
-import org.xmlsoap.schemas.ws.x2004.x08.eventing.DeliveryType;
-import org.xmlsoap.schemas.ws.x2004.x08.eventing.ExpirationType;
-import org.xmlsoap.schemas.ws.x2004.x08.eventing.FilterType;
-
+import org.apache.axis.AxisProperties;
+import org.apache.axis.configuration.EngineConfigurationFactoryDefault;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.XmlObjectWrapper;
import org.apache.ws.addressing.EndpointReference;
import org.apache.ws.addressing.XmlBeansEndpointReference;
-
-import org.apache.ws.util.XmlBeanUtils;
-
-import org.apache.axis.configuration.FileProvider;
-
-import org.apache.ws.pubsub.NotificationProducer;
import org.apache.ws.pubsub.NotificationConsumer;
+import org.apache.ws.pubsub.NotificationProducer;
import org.apache.ws.pubsub.SubscriptionEndConsumer;
import org.apache.ws.pubsub.TopicFilter;
import org.apache.ws.pubsub.XPathFilter;
-
import org.apache.ws.pubsub.wsaSOAPConnection;
-
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPMessage;
-
-import org.apache.ws.XmlObjectWrapper;
-import org.apache.axis.AxisProperties;
-import org.apache.axis.configuration.EngineConfigurationFactoryDefault;
-import java.util.Calendar;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
+import org.apache.ws.util.XmlBeanUtils;
import org.apache.ws.util.jndi.XmlBeanJndiUtils;
-
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlObject;
import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
-
import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
import org.xmlsoap.schemas.ws.x2004.x08.addressing.ReferencePropertiesType;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.DeliveryType;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.ExpirationType;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.FilterType;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeResponseDocument;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.ws.util.XmlBeanUtils;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+import java.util.Calendar;
@@ -107,8 +94,7 @@
public void init(String configfile)
throws Exception {
LOG.info(this.getClass().getName()+" : initialize with "+configfile);
- // XmlBeanJndiUtils.initializeFromInputStream(new java.io.FileInputStream(configfile));
- XmlBeanJndiUtils.initializeFromInputStream(Thread.currentThread().getContextClassLoader().getResourceAsStream(configfile/*XmlBeanJndiUtils.JNDI_CONFIG_FILENAME*/));
+ XmlBeanJndiUtils.initFromInputStream(Thread.currentThread().getContextClassLoader().getResourceAsStream(configfile));
}
@@ -127,9 +113,9 @@
EndpointReferenceType nepr = (EndpointReferenceType)((XmlObjectWrapper)notificationConsumer.getEPR()).getXmlObject();
//add ReferenceProperties
ReferencePropertiesType refProps = nepr.addNewReferenceProperties();
- XmlObject xmlObject = XmlBeanUtils.addChildElement( refProps, ls.getResourceKey().getName());
+ XmlObject xmlObject = XmlBeanUtils.addChildElement( refProps, new QName( "TODO" ));
XmlCursor xmlCursor = xmlObject.newCursor();
- xmlCursor.setTextValue(ls.getResourceKey().getValue().toString());
+ xmlCursor.setTextValue(String.valueOf( ls.getID() ));
xmlCursor.dispose();
//notifications are send to:
DeliveryType delivery = s.addNewDelivery();
Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/pubsub/Subscription.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/pubsub/Subscription.java?rev=219923&r1=219922&r2=219923&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/pubsub/Subscription.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/pubsub/Subscription.java Wed Jul 20 08:06:09 2005
@@ -84,7 +84,7 @@
}
public void destroy() {
try{
- this.rH.remove(this.rK);
+ this.rH.remove(getID());
}catch(Exception e){
e.printStackTrace();
}
Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/pubsub/SubscriptionHome.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/pubsub/SubscriptionHome.java?rev=219923&r1=219922&r2=219923&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/pubsub/SubscriptionHome.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/eventing/pubsub/SubscriptionHome.java Wed Jul 20 08:06:09 2005
@@ -19,18 +19,19 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ws.resource.JndiConstants;
-import org.apache.ws.resource.impl.SimpleTypeResourceKey;
+import org.apache.ws.resource.impl.AbstractResourceHome;
import javax.xml.namespace.QName;
+import java.util.Map;
/**
*
* @author Stefan Lischke
*/
-public class SubscriptionHome extends AbstractSubscriptionHome /* implements org.apache.ws.resource.ResourceHome*/{
+public class SubscriptionHome extends AbstractResourceHome
+{
/** The service endpoint name as registered with the SOAP Platform. This is useful for building EPR's. **/
public static final javax.xml.namespace.QName SERVICE_NAME = javax.xml.namespace.QName.valueOf("{http://ws.apache.org/notification/base/service/SubscriptionEndPort}SubscriptionEndPort");
-
/** The management PortType associated with this resource. This is useful for building EPR's.**/
public static final javax.xml.namespace.QName PORT_TYPE = javax.xml.namespace.QName.valueOf("http://ws.apache.org/notification/base/service/SubscriptionEndPort}SubscriptionEndPortPortType");
@@ -47,7 +48,7 @@
private static int num=0;
private static final Log LOG = LogFactory.getLog( SubscriptionHome.class.getName() );
- public void SubscriptionHome(){
+ public SubscriptionHome(){
num++;
LOG.info("create SubscriptionHome number : "+num);
}
@@ -55,21 +56,13 @@
public Subscription create(){
Subscription s = new Subscription();
- SimpleTypeResourceKey resourceKey = new SimpleTypeResourceKey( QName.valueOf( getResourceKeyName()), (String) s.getID());
- s.setResourceKey(resourceKey);
s.setResourceHome(this);
LOG.info("before add "+ m_resources.size()+" instance "+this);
- add(resourceKey,s);
- // m_resources.put(resourceKey,s);
-
+ add(s.getID(),s);
LOG.info("after add "+ m_resources.size());
return s;
}
- public org.apache.ws.resource.Resource getInstance(org.apache.ws.resource.ResourceContext resourceContext) throws org.apache.ws.resource.ResourceException, org.apache.ws.resource.ResourceContextException, org.apache.ws.resource.ResourceUnknownException {
- LOG.info("getInstance "+ m_resources.size()+" SubscriptionHome : "+resourceContext.getResourceKey().getValue()+ " instance "+this);
- return find( resourceContext.getResourceKey() );
- }
/*
public org.apache.ws.resource.Resource find(org.apache.ws.resource.ResourceKey key) throws org.apache.ws.resource.ResourceException, org.apache.ws.resource.NoSuchResourceException, org.apache.ws.resource.InvalidResourceKeyException {
return((org.apache.ws.resource.Resource)m_resources.get(key));
@@ -91,8 +84,6 @@
public String getWsdlTargetNamespace() {
}*/
- public void remove(org.apache.ws.resource.ResourceKey key) throws org.apache.ws.resource.ResourceException, org.apache.ws.resource.InvalidResourceKeyException, org.apache.ws.resource.RemoveNotSupportedException {
- } //todo I removed org.apache.ws.resource.NoSuchResourceException, from signature above to be able to compile
/*
public void setResourceClassName(String className) {
}
@@ -127,5 +118,24 @@
public QName getResourceKeyNameQName()
{
return RESOURCE_KEY_NAME;
+ }
+
+ /**
+ * Map containing all FilesystemResource instances - this map <em>must</em> be static for
+ * compatibility with certain JNDI providers.
+ */
+ private static Map s_resources;
+
+ /**
+ * Returns a map of all FilesystemResource instances. Used by the {@link org.apache.ws.resource.impl.AbstractResourceHome}
+ * superclass.
+ */
+ protected synchronized final Map getResourceMap()
+ {
+ if ( s_resources == null )
+ {
+ s_resources = AbstractResourceHome.createResourceMap( m_resourceIsPersistent );
+ }
+ return s_resources;
}
}
Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java?rev=219923&r1=219922&r2=219923&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java Wed Jul 20 08:06:09 2005
@@ -31,7 +31,6 @@
import org.apache.ws.resource.PropertiesResource;
import org.apache.ws.resource.Resource;
import org.apache.ws.resource.ResourceHome;
-import org.apache.ws.resource.ResourceKey;
import org.apache.ws.resource.lifetime.ResourceTerminationEvent;
import org.apache.ws.resource.lifetime.ResourceTerminationListener;
import org.apache.ws.resource.lifetime.impl.ResourceTerminationEventImpl;
@@ -61,7 +60,6 @@
protected Object m_policy;
protected QueryExpression m_precondition;
protected QueryExpression m_selector;
- protected ResourceKey m_producerKey;
protected String m_producerHomeLocation;
protected TopicExpression m_topicExpression;
protected boolean m_isPaused;
@@ -83,27 +81,27 @@
* A list of termination listeners to be notified when the resource is terminated.
*/
private List m_terminationListeners = new ArrayList();
+ private Object m_producerId;
/**
* Construct a new subscription resource.
*
* @param consumerReference The WS-Addressing endpoint reference of the consumer
* @param producerReference The WS-Addressing endpoint reference of the producer
- * @param producerKey The key of the producer resource
* @param producerHomeLocation The JNDI location of the home of the producer resource
* @param topicExpression The topic expression for this subscription
*/
public AbstractSubscription( EndpointReference consumerReference,
EndpointReference producerReference,
- ResourceKey producerKey,
String producerHomeLocation,
+ Object producerId,
TopicExpression topicExpression )
{
m_id = UUID_GEN.generateUuid();
m_consumerReference = consumerReference;
m_producerReference = producerReference;
- m_producerKey = producerKey;
m_producerHomeLocation = producerHomeLocation;
+ m_producerId = producerId;
m_topicExpression = topicExpression;
m_creationTime = Calendar.getInstance();
}
@@ -158,7 +156,7 @@
try
{
ResourceHome producerHome = (ResourceHome) new InitialContext().lookup( m_producerHomeLocation );
- return (NotificationProducerResource) producerHome.find( m_producerKey );
+ return (NotificationProducerResource) producerHome.find( m_producerId );
}
catch ( Exception e )
{
@@ -206,9 +204,9 @@
return m_id;
}
- public void setID( Object o )
+ public void setID( Object id )
{
- m_id = (String) o;
+ m_id = (String) id;
}
public void destroy()
@@ -236,11 +234,10 @@
//TopicSpace topicSpace = topicSpaceSet.getTopicSpace();
//topics = topicSpace.getTopics( m_topicExpression );
topics = evaluateTopicExpression();
-
}
catch ( Exception e )
{
- ;
+ // TODO...
}
synchronized ( producerResource )
Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionHome.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionHome.java?rev=219923&r1=219922&r2=219923&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionHome.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionHome.java Wed Jul 20 08:06:09 2005
@@ -15,31 +15,25 @@
*=============================================================================*/
package org.apache.ws.notification.base.v2004_06.impl;
+import org.apache.commons.collections.map.ReferenceMap;
import org.apache.ws.addressing.EndpointReference;
import org.apache.ws.notification.base.Subscription;
import org.apache.ws.notification.base.WsnNamespaceVersionHolder;
import org.apache.ws.notification.topics.expression.TopicExpression;
import org.apache.ws.resource.JndiConstants;
-import org.apache.ws.resource.Resource;
-import org.apache.ws.resource.ResourceContext;
-import org.apache.ws.resource.ResourceContextException;
import org.apache.ws.resource.ResourceException;
-import org.apache.ws.resource.ResourceKey;
-import org.apache.ws.resource.ResourceUnknownException;
-import org.apache.ws.resource.impl.SimpleTypeResourceKey;
import org.apache.ws.resource.impl.AbstractResourceHome;
import org.apache.ws.resource.properties.query.QueryExpression;
-import org.apache.commons.collections.map.ReferenceMap;
-import javax.xml.namespace.QName;
-import javax.naming.NamingException;
import javax.naming.Context;
import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.xml.namespace.QName;
import java.lang.reflect.Constructor;
import java.util.Calendar;
-import java.util.Map;
-import java.util.HashMap;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
/**
* The home for the builtin SubscriptionManager service.
@@ -74,8 +68,6 @@
"/" +
JndiConstants.ATOMIC_NAME_HOME;
- private static Map s_resources;
-
/**
* Do not modify this method.
*/
@@ -97,21 +89,6 @@
return s_resources;
}
- /**
- * @param resourceContext
- *
- * @return
- *
- * @throws ResourceException
- * @throws ResourceContextException
- * @throws ResourceUnknownException
- */
- public Resource getInstance( ResourceContext resourceContext ) throws ResourceException, ResourceContextException,
- ResourceUnknownException
- {
- return find( resourceContext.getResourceKey() );
- }
-
public Subscription create( Class subscriptionResourceClass,
EndpointReference consumerReference,
EndpointReference producerReference,
@@ -119,7 +96,7 @@
Object policy,
QueryExpression precondition,
QueryExpression selector,
- ResourceKey producerKey,
+ Object producerId,
String producerHomeLocation,
TopicExpression topicExpression,
boolean useNotify, WsnNamespaceVersionHolder nsSet ) throws ResourceException
@@ -129,11 +106,11 @@
Constructor constructor = subscriptionResourceClass.getConstructor( new Class[]{
EndpointReference.class,
EndpointReference.class,
- ResourceKey.class,
+ Object.class,
String.class,
TopicExpression.class} );
Subscription subscription = (Subscription) constructor.newInstance(
- new Object[]{consumerReference, producerReference, producerKey, producerHomeLocation,
+ new Object[]{consumerReference, producerReference, producerId, producerHomeLocation,
topicExpression} );
subscription.setTerminationTime( initialTerminationTime );
subscription.setUseNotify( useNotify );
@@ -142,11 +119,10 @@
subscription.setPolicy( policy );
subscription.init(); // initialize resource properties
String id = (String) subscription.getID();
- SimpleTypeResourceKey resourceKey = new SimpleTypeResourceKey( QName.valueOf( getResourceKeyName() ), id );
EndpointReference subscriptionEPR = getEndpointReference( getSubscriptionAddress( producerReference ),
- resourceKey, nsSet.getAddressingNamespace() );
+ id, nsSet.getAddressingNamespace() );
subscription.setEndpointReference( subscriptionEPR );
- add( resourceKey, subscription );
+ add( id, subscription );
return subscription;
}
catch ( Exception e )
@@ -180,4 +156,24 @@
{
return RESOURCE_KEY_NAME;
}
+
+ /**
+ * Map containing all FilesystemResource instances - this map <em>must</em> be static for
+ * compatibility with certain JNDI providers.
+ */
+ private static Map s_resources;
+
+ /**
+ * Returns a map of all FilesystemResource instances. Used by the {@link AbstractResourceHome}
+ * superclass.
+ */
+ protected synchronized final Map getResourceMap()
+ {
+ if ( s_resources == null )
+ {
+ s_resources = AbstractResourceHome.createResourceMap( m_resourceIsPersistent );
+ }
+ return s_resources;
+ }
+
}
Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionResource.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionResource.java?rev=219923&r1=219922&r2=219923&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionResource.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionResource.java Wed Jul 20 08:06:09 2005
@@ -22,7 +22,6 @@
import org.apache.ws.notification.base.v2004_06.porttype.SubscriptionManagerPortType;
import org.apache.ws.notification.topics.expression.TopicExpression;
import org.apache.ws.pubsub.SubscriptionEndConsumer;
-import org.apache.ws.resource.ResourceKey;
import org.apache.ws.resource.lifetime.v2004_06.porttype.ScheduledResourceTerminationPortType;
import org.apache.ws.resource.lifetime.callback.CurrentTimeCallback;
import org.apache.ws.resource.properties.ResourceProperty;
@@ -60,10 +59,10 @@
};
public SubscriptionResource(EndpointReference consumerReference, EndpointReference producerReference,
- ResourceKey producerKey, String producerHomeLocation,
+ Object producerId, String producerHomeLocation,
TopicExpression topicExpression) {
- super(consumerReference, producerReference,
- producerKey, producerHomeLocation, topicExpression);
+ super(consumerReference, producerReference
+ , producerHomeLocation, producerId, topicExpression);
}
public void init() {
Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java?rev=219923&r1=219922&r2=219923&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java Wed Jul 20 08:06:09 2005
@@ -129,7 +129,7 @@
{
subscription = subscriptionHome.create( SubscriptionResource.class,
new XmlBeansEndpointReference( request.getConsumerReference() ), producerEPR, initialTerminationTime,
- subPolicy, precondition, selector, getResourceKey(),
+ subPolicy, precondition, selector, getResource().getID(),
( (AbstractResourceContext) getResourceContext() ).getResourceHomeLocation(), topicExpr, useNotify, (WsnNamespaceVersionHolder) getNamespaceSet() );
}
catch ( Exception e )
Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/pubsub/Subscriber.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/pubsub/Subscriber.java?rev=219923&r1=219922&r2=219923&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/pubsub/Subscriber.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/pubsub/Subscriber.java Wed Jul 20 08:06:09 2005
@@ -17,46 +17,31 @@
package org.apache.ws.notification.pubsub;
//import org.xmlsoap.schemas.ws.x2003.x03.addressing.EEndpointReference;
-import org.apache.ws.addressing.XmlBeansEndpointReference;
-import org.apache.ws.addressing.EndpointReference;
-
-import org.apache.ws.util.XmlBeanUtils;
-
-import org.apache.axis.configuration.FileProvider;
-
-import org.apache.ws.pubsub.NotificationProducer;
-import org.apache.ws.pubsub.NotificationConsumer;
-import org.apache.ws.pubsub.SubscriptionEndConsumer;
-import org.apache.ws.pubsub.XPathFilter;
-import org.apache.ws.pubsub.TopicFilter;
-
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPMessage;
-
-
-
-import org.apache.ws.XmlObjectWrapper;
import org.apache.axis.AxisProperties;
import org.apache.axis.configuration.EngineConfigurationFactoryDefault;
-import java.util.Calendar;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
+import org.apache.ws.XmlObjectWrapper;
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.pubsub.NotificationConsumer;
+import org.apache.ws.pubsub.NotificationProducer;
+import org.apache.ws.pubsub.SubscriptionEndConsumer;
+import org.apache.ws.pubsub.TopicFilter;
+import org.apache.ws.pubsub.XPathFilter;
+import org.apache.ws.pubsub.wsaSOAPConnection;
import org.apache.ws.util.jndi.XmlBeanJndiUtils;
-
-import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
-
+import org.apache.xmlbeans.XmlCursor;
import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscribeDocument;
import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscribeResponseDocument;
import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType;
+import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
-import org.apache.ws.pubsub.wsaSOAPConnection;
-
-import org.apache.xmlbeans.XmlCursor;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+import java.util.Calendar;
/**
*
* @author Stefan Lischke
@@ -164,7 +149,6 @@
throws Exception
{
LOG.info(this.getClass().getName()+" : initialize with "+configfile);
-// XmlBeanJndiUtils.initializeFromInputStream(new java.io.FileInputStream(configfile));
- XmlBeanJndiUtils.initializeFromInputStream(Thread.currentThread().getContextClassLoader().getResourceAsStream(configfile/*XmlBeanJndiUtils.JNDI_CONFIG_FILENAME*/));
+ XmlBeanJndiUtils.initFromInputStream(Thread.currentThread().getContextClassLoader().getResourceAsStream(configfile));
}
}
Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/pubsub/SubscriptionHome.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/pubsub/SubscriptionHome.java?rev=219923&r1=219922&r2=219923&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/pubsub/SubscriptionHome.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/pubsub/SubscriptionHome.java Wed Jul 20 08:06:09 2005
@@ -17,21 +17,16 @@
package org.apache.ws.notification.pubsub;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscribeResponseDocument;
-
import org.apache.ws.resource.JndiConstants;
-import org.apache.ws.resource.impl.SimpleTypeResourceKey;
+import org.apache.ws.resource.impl.AbstractResourceHome;
import javax.xml.namespace.QName;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import java.util.Map;
/**
*
* @author Stefan Lischke
*/
-public class SubscriptionHome extends AbstractSubscriptionHome {
+public class SubscriptionHome extends AbstractResourceHome {
/** The service endpoint name as registered with the SOAP Platform. This is useful for building EPR's. **/
public static final javax.xml.namespace.QName SERVICE_NAME = javax.xml.namespace.QName.valueOf("{http://ws.apache.org/notification/base/service/NotificationPort}NotificationPort");
@@ -48,21 +43,13 @@
public static final String HOME_LOCATION = JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME.getLocalPart() + "/" + JndiConstants.ATOMIC_NAME_HOME;
- private static final Log LOG = LogFactory.getLog( SubscriptionHome.class.getName() );
+ //private static final Log LOG = LogFactory.getLog( SubscriptionHome.class.getName() );
public Subscription create(){
Subscription s = new Subscription();
- String id = (String) s.getID();
-
- SimpleTypeResourceKey resourceKey = new SimpleTypeResourceKey( QName.valueOf( getResourceKeyName()), id);
- add(resourceKey,s);
+ add(s.getID(),s);
return s;
}
-
- public org.apache.ws.resource.Resource getInstance(org.apache.ws.resource.ResourceContext resourceContext) throws org.apache.ws.resource.ResourceException, org.apache.ws.resource.ResourceContextException, org.apache.ws.resource.ResourceUnknownException {
- LOG.info("getInstance SubscriptionHome");
- return find( resourceContext.getResourceKey() );
- }
public QName getServiceName()
{
@@ -83,4 +70,24 @@
{
return RESOURCE_KEY_NAME;
}
+
+ /**
+ * Map containing all FilesystemResource instances - this map <em>must</em> be static for
+ * compatibility with certain JNDI providers.
+ */
+ private static Map s_resources;
+
+ /**
+ * Returns a map of all FilesystemResource instances. Used by the {@link AbstractResourceHome}
+ * superclass.
+ */
+ protected synchronized final Map getResourceMap()
+ {
+ if ( s_resources == null )
+ {
+ s_resources = AbstractResourceHome.createResourceMap( m_resourceIsPersistent );
+ }
+ return s_resources;
+ }
+
}