juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexo...@apache.org
Subject svn commit: r1558263 - in /juddi/trunk: juddi-client/src/main/java/org/apache/juddi/v3/client/config/ juddi-examples/subscription-notification-amqp/ juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/ juddi-examples/subscription-notifica...
Date Wed, 15 Jan 2014 01:44:57 GMT
Author: alexoree
Date: Wed Jan 15 01:44:56 2014
New Revision: 1558263

URL: http://svn.apache.org/r1558263
Log:
JUDDI-717 finished and confirmed working. instructions added. javadoc updated for UDDIClerk

Added:
    juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/
    juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/pom.xml
    juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/
    juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/
    juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/java/
    juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/java/org/
    juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/java/org/apache/
    juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/java/org/apache/juddi/
    juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/java/org/apache/juddi/subscription/
    juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/java/org/apache/juddi/subscription/notify/
    juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/java/org/apache/juddi/subscription/notify/AMQPNotifier.java
    juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/java/org/apache/juddi/subscription/notify/Demo.java
    juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/resources/
    juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/resources/META-INF/
    juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/resources/META-INF/subscription-notification-client-uddi.xml
    juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/test/
    juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/test/java/
    juddi/trunk/juddi-examples/subscription-notification-amqp/qpid-dependencies/
    juddi/trunk/juddi-examples/subscription-notification-amqp/qpid-dependencies/pom.xml
    juddi/trunk/juddi-examples/subscription-notification-amqp/readme.txt
Removed:
    juddi/trunk/juddi-examples/subscription-notification-amqp/src/
Modified:
    juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
    juddi/trunk/juddi-examples/subscription-notification-amqp/pom.xml

Modified: juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java?rev=1558263&r1=1558262&r2=1558263&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
(original)
+++ juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
Wed Jan 15 01:44:56 2014
@@ -506,6 +506,10 @@ public class UDDIClerk implements Serial
         public BusinessService register(BusinessService service, Node node) {
 
                 BusinessService businessService = null;
+                if (service.getName().isEmpty()){
+                        log.error("Unable to register service, a 'name' element is required");
+                        return null;
+                }
                 log.info("Registering service " + service.getName().get(0).getValue()
                         + " with key " + service.getServiceKey());
                 try {

Added: juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/pom.xml?rev=1558263&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/pom.xml
(added)
+++ juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/pom.xml
Wed Jan 15 01:44:56 2014
@@ -0,0 +1,94 @@
+<?xml version="1.0"?>
+<project
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.juddi.example.qpid</groupId>
+		<artifactId>juddi-examples-qpid</artifactId>
+		<version>3.2.0-SNAPSHOT</version>
+	</parent>
+
+	<artifactId>juddi-qpid-notifier</artifactId>
+	<version>3.2-SNAPSHOT</version>
+	<name>jUDDI Example AMQP Notifier for Subscription callbacks</name>
+	<description>Demonstrates how to write a custom notifier for subscriptions</description>
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.juddi</groupId>
+			<artifactId>uddi-ws</artifactId>
+			<version>3.2.0-SNAPSHOT</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.juddi</groupId>
+			<artifactId>juddi-client</artifactId>
+			<version>3.2.0-SNAPSHOT</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.geronimo.specs</groupId>
+			<artifactId>geronimo-jms_1.1_spec</artifactId>
+			<version>1.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.qpid</groupId>
+			<artifactId>qpid-client</artifactId>
+			<version>0.24</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.qpid</groupId>
+			<artifactId>qpid-amqp-1-0-client-jms</artifactId>
+			<version>0.24</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.juddi</groupId>
+			<artifactId>juddi-core</artifactId>
+			<version>3.2.0-SNAPSHOT</version>
+			<scope>provided</scope>
+		</dependency>
+	</dependencies>
+	   
+     <profiles>
+        <profile>
+            <id>default</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <skip>true</skip>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>demo</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <version>1.1.1</version>
+                        <executions>
+                            <execution>
+                                <phase>test</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>org.apache.juddi.subscription.notify.Demo</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>

Added: juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/java/org/apache/juddi/subscription/notify/AMQPNotifier.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/java/org/apache/juddi/subscription/notify/AMQPNotifier.java?rev=1558263&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/java/org/apache/juddi/subscription/notify/AMQPNotifier.java
(added)
+++ juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/java/org/apache/juddi/subscription/notify/AMQPNotifier.java
Wed Jan 15 01:44:56 2014
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2013 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.juddi.subscription.notify;
+
+import java.net.URISyntaxException;
+import java.rmi.RemoteException;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.juddi.api_v3.AccessPointType;
+import org.apache.juddi.config.AppConfig;
+import org.apache.juddi.jaxb.JAXBMarshaller;
+import org.apache.juddi.model.BindingTemplate;
+import org.uddi.api_v3.DispositionReport;
+import org.uddi.api_v3.Result;
+import org.uddi.subr_v3.NotifySubscriptionListener;
+import org.uddi.v3_service.DispositionReportFaultMessage;
+
+/**
+ * AMQP Notifier
+ *
+ * This is designed to enable users to setup AMQP based alerts for UDDI
+ * subscriptions
+ *
+ * This class is partically complete, but it is largely untested and lacks any
+ * kind of
+ *
+ * the following settings need to be added to the juddiv3.xml file
+ * amqp.java.naming.factory.initial=org.apache.qpid.jndi.PropertiesFileInitialContextFactory
+ * amqp.connectionfactory.qpidConnectionfactory amqp.destination=(some topic or
+ * queue name) amqp.destination.type=topic
+ *
+ * usage create a service/bindingtemplate/accessPoint where the value is
+ * amqp://url_to_qpid/amqp The useType must be "endPoint". create a subscription
+ * where the binding template reference points to this endpoint. trigger the
+ * subscription and wait for delivery.
+ *
+ * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>
+ */
+public class AMQPNotifier implements Notifier {
+
+        Log log = LogFactory.getLog(this.getClass());
+        String destination = null;
+
+        String exchangeType = null;
+        String exchangeName = null;
+
+        public AMQPNotifier(BindingTemplate bindingTemplate) throws URISyntaxException, ConfigurationException
{
+                super();
+                if (!AccessPointType.END_POINT.toString().equalsIgnoreCase(bindingTemplate.getAccessPointType()))
{
+                        log.error("AMQP enpoints only support AccessPointType " + AccessPointType.END_POINT);
+                }
+                String accessPointUrl = bindingTemplate.getAccessPointUrl().toLowerCase();
+                if (!accessPointUrl.startsWith("amqp:")) {
+                        log.warn("AMQP accessPointUrl for bindingTemplate " + bindingTemplate.getEntityKey()
+                                + " should start with 'amqp:'");
+                } 
+                destination = accessPointUrl;
+                for (int i = 0; i < bindingTemplate.getTmodelInstanceInfos().size(); i++)
{
+                        if (bindingTemplate.getTmodelInstanceInfos().get(i).getTmodelKey().equals(Demo.TMODEL_DESTINATION_TYPE))
{
+                                exchangeType = bindingTemplate.getTmodelInstanceInfos().get(i).getInstanceParms();
+                        }
+                        if (bindingTemplate.getTmodelInstanceInfos().get(i).getTmodelKey().equals(Demo.TMODEL_DESTINATION_NAME))
{
+                                exchangeName = bindingTemplate.getTmodelInstanceInfos().get(i).getInstanceParms();
+                        }
+                }
+        }
+
+        @Override
+        public DispositionReport notifySubscriptionListener(NotifySubscriptionListener body)
throws DispositionReportFaultMessage, RemoteException {
+                Connection connection = null;
+                Context context = null;
+                boolean success = false;
+                String err = null;
+                try {
+                        if (destination != null && exchangeType != null &&
exchangeName != null) {
+                                log.info("Sending notification AMQP to " + destination);
+                                Properties properties = new Properties();
+
+                                properties.put("java.naming.factory.initial", "org.apache.qpid.jndi.PropertiesFileInitialContextFactory");
+                                properties.put("connectionfactory.qpidConnectionfactory",
destination);
+                                properties.put("destination." + exchangeName,exchangeType);
+
+                                context = new InitialContext(properties);
+
+                                ConnectionFactory connectionFactory = (ConnectionFactory)
context.lookup("qpidConnectionfactory");
+                                connection = connectionFactory.createConnection();
+                                connection.start();
+
+                                Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+                                Destination destinationLocal = (Destination) context.lookup(exchangeName);
+
+                                MessageProducer messageProducer = session.createProducer(destinationLocal);
+
+                                String subscriptionResultXML = JAXBMarshaller.marshallToString(body,
JAXBMarshaller.PACKAGE_SUBSCR_RES);
+                                TextMessage message = session.createTextMessage(subscriptionResultXML);
+                                messageProducer.send(message);
+                                success = true;
+
+                        }
+                } catch (Exception e) {
+                        e.printStackTrace();
+                        log.error("Error deliverying AMQP subscription " + e.getMessage());
+                        log.debug("Error deliverying AMQP subscription " + e.getMessage(),e);
+                        err = e.getMessage();
+
+                } finally {
+                        try {
+                                if (connection != null) {
+                                        connection.close();
+                                }
+                        } catch (JMSException ex) {
+                                log.error(null, ex);
+                        }
+                        try {
+                                if (context != null) {
+                                        context.close();
+                                }
+                        } catch (NamingException ex) {
+                                log.error(null, ex);
+                        }
+                }
+                if (!success) {
+                        throw new DispositionReportFaultMessage(err, null);
+                }
+                DispositionReport dr = new DispositionReport();
+                Result res = new Result();
+                dr.getResult().add(res);
+
+                return dr;
+        }
+}

Added: juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/java/org/apache/juddi/subscription/notify/Demo.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/java/org/apache/juddi/subscription/notify/Demo.java?rev=1558263&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/java/org/apache/juddi/subscription/notify/Demo.java
(added)
+++ juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/java/org/apache/juddi/subscription/notify/Demo.java
Wed Jan 15 01:44:56 2014
@@ -0,0 +1,221 @@
+/*
+ * Copyright 2014 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.juddi.subscription.notify;
+
+import java.util.Properties;
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.Session;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.xml.datatype.DatatypeFactory;
+import org.apache.juddi.api_v3.AccessPointType;
+import org.apache.juddi.v3.client.UDDIConstants;
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClient;
+import org.apache.qpid.client.AMQAnyDestination;
+import org.apache.qpid.client.AMQConnection;
+import org.apache.qpid.client.AMQTopic;
+import org.uddi.api_v3.AccessPoint;
+import org.uddi.api_v3.BindingTemplate;
+import org.uddi.api_v3.BindingTemplates;
+import org.uddi.api_v3.BusinessEntity;
+import org.uddi.api_v3.BusinessService;
+import org.uddi.api_v3.BusinessServices;
+import org.uddi.api_v3.Description;
+import org.uddi.api_v3.FindBusiness;
+import org.uddi.api_v3.FindQualifiers;
+import org.uddi.api_v3.FindService;
+import org.uddi.api_v3.FindTModel;
+import org.uddi.api_v3.InstanceDetails;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.TModel;
+import org.uddi.api_v3.TModelInstanceDetails;
+import org.uddi.api_v3.TModelInstanceInfo;
+import org.uddi.sub_v3.Subscription;
+import org.uddi.sub_v3.SubscriptionFilter;
+
+/**
+ *
+ * @author Alex O'Ree
+ */
+public class Demo implements MessageListener {
+
+        public static void main(String[] args) throws Exception {
+                System.out.println("Hello world!");
+                new Demo().Fire();
+        }
+
+        public static final String TOPIC = "UDDI";
+        public static final String TMODEL_KEY_BASE = "uddi:amqptestdomain:";
+        public static final String TMODEL_KEY_TOPIC = TMODEL_KEY_BASE + ":topic";
+        public static final String TMODEL_DESTINATION_TYPE = TMODEL_KEY_BASE + "amqp.destination.type";
+        public static final String TMODEL_DESTINATION_NAME = TMODEL_KEY_BASE + "amqp.destination";
+
+        private void Fire() throws Exception {
+                String amqpURL = "amqp://guest:guest@clientid/?brokerlist='tcp://localhost:5672'";
+                UDDIClient client = new UDDIClient("META-INF/subscription-notification-client-uddi.xml");
+                UDDIClerk clerk = client.getClerk("default");
+                String base = "uddi:amqptestdomain:";
+                String lang = "en";
+
+                TModel destinationType = new TModel();
+                destinationType.setName(new Name("AMQP Destination Type", lang));
+                destinationType.getDescription().add(new Description("topicExchange, queue,
etc", lang));
+                destinationType.setTModelKey(TMODEL_DESTINATION_TYPE);
+
+                TModel destinationName = new TModel();
+                destinationName.setName(new Name("AMQP Destination Name", lang));
+                destinationName.getDescription().add(new Description("The name of the topic
or queue", lang));
+                destinationName.setTModelKey(TMODEL_DESTINATION_NAME);
+
+                TModel createKeyGenator = UDDIClerk.createKeyGenator(base + "keygenerator",
"AMQP Test Key domain", lang);
+                BusinessEntity be = new BusinessEntity();
+                be.setBusinessKey(base + "business");
+                be.getName().add(new Name("AMQP Test callbacks", lang));
+                be.setBusinessServices(new BusinessServices());
+                BusinessService bs = new BusinessService();
+                bs.getName().add(new Name("AMQP Test service", lang));
+                bs.setBindingTemplates(new BindingTemplates());
+                bs.setBusinessKey(base + "business");
+                bs.setServiceKey(base + "service");
+
+                BindingTemplate bt = new BindingTemplate();
+                bt.setBindingKey(base + "binding");
+                bt.setServiceKey(base + "service");
+                bt.setAccessPoint(new AccessPoint(amqpURL, AccessPointType.END_POINT.toString()));
+                bt.setTModelInstanceDetails(new TModelInstanceDetails());
+
+                TModelInstanceInfo version = UDDIClerk.createServiceInterfaceVersion("1.0",
lang);
+                bt.getTModelInstanceDetails().getTModelInstanceInfo().add(version);
+
+                TModelInstanceInfo transport = new TModelInstanceInfo();
+                transport.setTModelKey(UDDIConstants.TRANSPORT_AMQP);
+                bt.getTModelInstanceDetails().getTModelInstanceInfo().add(transport);
+
+                TModelInstanceInfo topic = new TModelInstanceInfo();
+                topic.setTModelKey(TMODEL_DESTINATION_TYPE);
+                topic.setInstanceDetails(new InstanceDetails());
+                topic.getInstanceDetails().setInstanceParms("amq.topic");
+                bt.getTModelInstanceDetails().getTModelInstanceInfo().add(topic);
+
+                TModelInstanceInfo name = new TModelInstanceInfo();
+                name.setTModelKey(TMODEL_DESTINATION_NAME);
+                name.setInstanceDetails(new InstanceDetails());
+                name.getInstanceDetails().setInstanceParms(TOPIC);
+                bt.getTModelInstanceDetails().getTModelInstanceInfo().add(name);
+
+                bs.getBindingTemplates().getBindingTemplate().add(bt);
+
+                be.getBusinessServices().getBusinessService().add(bs);
+                try {
+                        System.out.println("Registering tModel");
+                        clerk.register(createKeyGenator);
+                        System.out.println("Registering destination type tmodel");
+                        clerk.register(destinationType);
+                        System.out.println("Registering destination name tmodel");
+                        clerk.register(destinationName);
+
+                        System.out.println("Registering business with callback definition");
+                        clerk.register(be);
+
+                        Properties p = new Properties();
+                        p.setProperty("java.naming.factory.initial", "org.apache.qpid.jndi.PropertiesFileInitialContextFactory");
+                        p.setProperty("connectionfactory.qpidConnectionfactory", amqpURL);
+                        p.setProperty("destination." + TOPIC, "amq.topic");
+
+                        System.out.println("Connecting to AMQP at " + amqpURL);
+
+                        Context context = new InitialContext(p);
+
+                        ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup("qpidConnectionfactory");
+                        Connection connection = connectionFactory.createConnection();
+                        connection.start();
+
+                        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+                        Destination destination = (Destination) context.lookup(TOPIC);
+
+                        MessageConsumer consumer = session.createConsumer(destination);
+
+                        consumer.setMessageListener(this);
+                        System.out.println("Connected and listening...");
+
+                        Subscription sub = new Subscription();
+                        sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(1000));
+                        sub.setBindingKey(base + "binding");
+                        sub.setSubscriptionKey(base + "sub-fb");
+                        sub.setSubscriptionFilter(new SubscriptionFilter());
+                        sub.getSubscriptionFilter().setFindBusiness(new FindBusiness());
+                        sub.getSubscriptionFilter().getFindBusiness().setFindQualifiers(new
FindQualifiers());
+                        sub.getSubscriptionFilter().getFindBusiness().getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+                        sub.getSubscriptionFilter().getFindBusiness().getName().add(new Name(UDDIConstants.WILDCARD,
null));
+
+                        Subscription subscriptionBiz = clerk.register(sub, clerk.getUDDINode().getApiNode());
+
+                        System.out.println("Registered FindBusiness subscription key: " +
(subscriptionBiz.getSubscriptionKey()) + " bindingkey: " + subscriptionBiz.getBindingKey());
+
+                        sub = new Subscription();
+                        sub.setSubscriptionKey(base + "sub-fs");
+                        sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(1000));
+                        sub.setBindingKey(base + "binding");
+                        sub.setSubscriptionFilter(new SubscriptionFilter());
+                        sub.getSubscriptionFilter().setFindService(new FindService());
+                        sub.getSubscriptionFilter().getFindService().setFindQualifiers(new
FindQualifiers());
+                        sub.getSubscriptionFilter().getFindService().getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+                        sub.getSubscriptionFilter().getFindService().getName().add(new Name(UDDIConstants.WILDCARD,
null));
+
+                        Subscription subscriptionSvc = clerk.register(sub, clerk.getUDDINode().getApiNode());
+
+                        System.out.println("Registered FindService subscription key: " +
(subscriptionSvc.getSubscriptionKey()) + " bindingkey: " + subscriptionSvc.getBindingKey());
+
+                        sub = new Subscription();
+                        sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(1000));
+                        sub.setBindingKey(base + "binding");
+                        sub.setSubscriptionKey(base + "sub-ft");
+                        sub.setSubscriptionFilter(new SubscriptionFilter());
+                        sub.getSubscriptionFilter().setFindTModel(new FindTModel());
+                        sub.getSubscriptionFilter().getFindTModel().setFindQualifiers(new
FindQualifiers());
+                        sub.getSubscriptionFilter().getFindTModel().getFindQualifiers().getFindQualifier().add(UDDIConstants.APPROXIMATE_MATCH);
+                        sub.getSubscriptionFilter().getFindTModel().setName(new Name(UDDIConstants.WILDCARD,
null));
+
+                        Subscription subscriptionTM = clerk.register(sub, clerk.getUDDINode().getApiNode());
+
+                        System.out.println("Registered FindTModel subscription key: " + (subscriptionTM.getSubscriptionKey())
+ " bindingkey: " + subscriptionTM.getBindingKey());
+
+                        System.out.println("Waiting for callbacks. Now would be a good time
to launch either another program or juddi-gui to make some changes. Press any key to stop!");
+
+                        System.out.println("Listening, press any key to quit");
+                        System.in.read();
+                        connection.close();
+
+                } catch (Exception ex) {
+                        ex.printStackTrace();
+                } finally {
+                        //clerk.unRegisterBusiness(be.getBusinessKey());
+                        //clerk.unRegisterTModel(createKeyGenator.getTModelKey());
+                }
+        }
+
+        @Override
+        public void onMessage(Message msg) {
+
+                System.out.println("Message received: " + msg);
+        }
+}

Added: juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/resources/META-INF/subscription-notification-client-uddi.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/resources/META-INF/subscription-notification-client-uddi.xml?rev=1558263&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/resources/META-INF/subscription-notification-client-uddi.xml
(added)
+++ juddi/trunk/juddi-examples/subscription-notification-amqp/juddi-qpid-notifier/src/main/resources/META-INF/subscription-notification-client-uddi.xml
Wed Jan 15 01:44:56 2014
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<uddi xmlns="urn:juddi-apache-org:v3_client" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="classpath:/xsd/uddi-client.xsd">
+        <reloadDelay>5000</reloadDelay>
+        <client name="example-client">
+                <nodes>
+                        <node>
+                                <!-- required 'default' node -->
+                                <name>default</name> 
+                                <properties>
+                                        <property name="serverName" value="localhost"/>
+                                        <property name="serverPort" value="8080"/>
+                                        <!-- for UDDI nodes that use HTTP u/p, using the
following 
+                                        <property name="basicAuthUsername" value="root"
/>
+                                        <property name="basicAuthPassword" value="password"
/>
+                                        <property name="basicAuthPasswordIsEncrypted"
value="false" />
+                                        <property name="basicAuthPasswordCryptoProvider"
value="org.apache.juddi.v3.client.crypto.AES128Cryptor (an example)" />-->
+                                </properties>
+                                <description>Main jUDDI node</description>
+                                <!-- JAX-WS Transport -->
+                                <proxyTransport>org.apache.juddi.v3.client.transport.JAXWSTransport</proxyTransport>
+                                <custodyTransferUrl>http://${serverName}:${serverPort}/juddiv3/services/custody-transfer</custodyTransferUrl>
+                                <inquiryUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiry</inquiryUrl>
+                                <inquiryRESTUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiryRest</inquiryRESTUrl>
+                                <publishUrl>http://${serverName}:${serverPort}/juddiv3/services/publish</publishUrl>
+                                <securityUrl>http://${serverName}:${serverPort}/juddiv3/services/security</securityUrl>
+                                <subscriptionUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription</subscriptionUrl>
+                                <subscriptionListenerUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription-listener</subscriptionListenerUrl>
+                                <juddiApiUrl>http://${serverName}:${serverPort}/juddiv3/services/juddi-api</juddiApiUrl>
+                        </node>
+                </nodes>
+                <clerks registerOnStartup="false" >
+                        <clerk name="default" node="default" publisher="uddi" password="uddi"
+                               isPasswordEncrypted="false" cryptoProvider="org.apache.juddi.v3.client.cryptor.AES128Cryptor"/>
+                </clerks>
+                <signature>
+                        <!-- signing stuff -->
+                        <signingKeyStorePath>keystore.jks</signingKeyStorePath>
+                        <signingKeyStoreType>JKS</signingKeyStoreType>
+                        <signingKeyStoreFilePassword 
+                                isPasswordEncrypted="false" 
+                                cryptoProvider="org.apache.juddi.v3.client.crypto.AES128Cryptor">password</signingKeyStoreFilePassword>
+                        <signingKeyPassword
+                                isPasswordEncrypted="false" 
+                                cryptoProvider="org.apache.juddi.v3.client.crypto.AES128Cryptor">password</signingKeyPassword>
+                        <signingKeyAlias>my special key</signingKeyAlias>
+                        
+                        <canonicalizationMethod>http://www.w3.org/2001/10/xml-exc-c14n#</canonicalizationMethod>
+                        <signatureMethod>http://www.w3.org/2000/09/xmldsig#rsa-sha1</signatureMethod>
+                        <XML_DIGSIG_NS>http://www.w3.org/2000/09/xmldsig#</XML_DIGSIG_NS>
+
+                        <!-- validation stuff 
+                        Used whenever someone views an entity that is signed and validation
is required	-->
+                        <!-- if this doesn't exist or is incorrect, the client will atempt
to load the standard jdk trust store-->
+                        <trustStorePath>truststore.jks</trustStorePath>
+                        <trustStoreType>JKS</trustStoreType>
+                        <trustStorePassword
+                                isPasswordEncrypted="false" 
+                                cryptoProvider="org.apache.juddi.v3.client.crypto.AES128Cryptor">password</trustStorePassword>
+			
+                        <checkTimestamps>true</checkTimestamps>
+                        <checkTrust>true</checkTrust>
+                        <checkRevocationCRL>true</checkRevocationCRL>
+                        <keyInfoInclusionSubjectDN>false</keyInfoInclusionSubjectDN>
+                        <keyInfoInclusionSerial>false</keyInfoInclusionSerial>
+                        <keyInfoInclusionBase64PublicKey>true</keyInfoInclusionBase64PublicKey>
+                        <digestMethod>http://www.w3.org/2000/09/xmldsig#sha1</digestMethod>
+                </signature>
+                <subscriptionCallbacks>
+                        <keyDomain>uddi:somebusiness</keyDomain>
+                        <listenUrl>http://MyHostname:4444/callback</listenUrl>
+                        <autoRegisterBindingTemplate>false</autoRegisterBindingTemplate>
+                        <autoRegisterBusinessServiceKey>uddi:somebusiness:someservicekey</autoRegisterBusinessServiceKey>
+                        <signatureBehavior>DoNothing</signatureBehavior>
+                        <!--valid values are AbortIfSigned,Sign,DoNothing,SignOnlyIfParentIsntSigned,
default is DoNothing-->
+                </subscriptionCallbacks>
+                <XtoWsdl>
+                        <IgnoreSSLErrors>false</IgnoreSSLErrors>
+                </XtoWsdl>
+        </client>
+</uddi>

Modified: juddi/trunk/juddi-examples/subscription-notification-amqp/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/subscription-notification-amqp/pom.xml?rev=1558263&r1=1558262&r2=1558263&view=diff
==============================================================================
--- juddi/trunk/juddi-examples/subscription-notification-amqp/pom.xml (original)
+++ juddi/trunk/juddi-examples/subscription-notification-amqp/pom.xml Wed Jan 15 01:44:56
2014
@@ -1,121 +1,32 @@
-<?xml version="1.0"?>
-<project
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
-	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+		* Copyright 2001-2009 The Apache Software Foundation. * * Licensed
+		under the Apache License, Version 2.0 (the "License"); * you may not
+		use this file except in compliance with the License. * You may obtain
+		a copy of the License at * *
+		http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by
+		applicable law or agreed to in writing, software * distributed under
+		the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES
+		OR CONDITIONS OF ANY KIND, either express or implied. * See the
+		License for the specific language governing permissions and *
+		limitations under the License. * */
+	--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 	<modelVersion>4.0.0</modelVersion>
 	<parent>
 		<groupId>org.apache.juddi.example</groupId>
 		<artifactId>juddi-examples</artifactId>
 		<version>3.2.0-SNAPSHOT</version>
+		<relativePath>../pom.xml</relativePath>
 	</parent>
-
-	<artifactId>subscription-notification-amqp</artifactId>
-	<version>1.0-SNAPSHOT</version>
-	<name>jUDDI Example AMQP Notifier for Subscription callbacks</name>
-	<description>Demonstrates how to write a custom notifier for subscriptions</description>
-	<dependencies>
-		<dependency>
-			<groupId>org.apache.juddi</groupId>
-			<artifactId>uddi-ws</artifactId>
-			<version>3.2.0-SNAPSHOT</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.juddi</groupId>
-			<artifactId>juddi-client</artifactId>
-			<version>3.2.0-SNAPSHOT</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.geronimo.specs</groupId>
-			<artifactId>geronimo-jms_1.1_spec</artifactId>
-			<version>1.0</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.qpid</groupId>
-			<artifactId>qpid-client</artifactId>
-			<version>0.24</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.qpid</groupId>
-			<artifactId>qpid-amqp-1-0-client-jms</artifactId>
-			<version>0.24</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.juddi</groupId>
-			<artifactId>juddi-core</artifactId>
-			<version>3.2.0-SNAPSHOT</version>
-			<scope>provided</scope>
-		</dependency>
-	</dependencies>
-	   <build>
-        <finalName>${artifactId}-${version}</finalName>
-        <plugins>
-            <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <version>2.4</version>
-                <configuration>
-                    <descriptorRefs>
-                        <descriptorRef>jar-with-dependencies</descriptorRef>
-                    </descriptorRefs>
-                    <archive>
-                        <manifest>
-                            <mainClass>org.apache.juddi.subscription.notify.Demo</mainClass>
-                        </manifest>
-                    </archive>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>make-assembly</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-     <profiles>
-        <profile>
-            <id>default</id>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-surefire-plugin</artifactId>
-                        <configuration>
-                            <skip>true</skip>
-                        </configuration>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-        <profile>
-            <id>demo</id>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.codehaus.mojo</groupId>
-                        <artifactId>exec-maven-plugin</artifactId>
-                        <version>1.1.1</version>
-                        <executions>
-                            <execution>
-                                <phase>test</phase>
-                                <goals>
-                                    <goal>java</goal>
-                                </goals>
-                                <configuration>
-                                    <mainClass>org.apache.juddi.subscription.notify.Demo</mainClass>
-                                </configuration>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-    </profiles>
-</project>
+	<groupId>org.apache.juddi.example.qpid</groupId>
+	<artifactId>juddi-examples-qpid</artifactId>
+	<name>jUDDI Qpid AMQP Notifier</name>
+	<packaging>pom</packaging>
+	<prerequisites>
+		<maven>3.0.3</maven>
+	</prerequisites>
+	<modules>
+		<module>juddi-qpid-notifier</module>
+		<module>qpid-dependencies</module>
+	</modules>
+</project>
\ No newline at end of file

Added: juddi/trunk/juddi-examples/subscription-notification-amqp/qpid-dependencies/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/subscription-notification-amqp/qpid-dependencies/pom.xml?rev=1558263&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/subscription-notification-amqp/qpid-dependencies/pom.xml (added)
+++ juddi/trunk/juddi-examples/subscription-notification-amqp/qpid-dependencies/pom.xml Wed
Jan 15 01:44:56 2014
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+ 
+  <groupId>org.apache.juddi.qpid</groupId>
+  <artifactId>service-version</artifactId>
+  <version>3.2-SNAPSHOT</version>
+  <name>Qpid Client with dependencies</name>
+  <url>http://maven.apache.org</url>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+  <dependencies>
+  <dependency>
+			<groupId>org.apache.geronimo.specs</groupId>
+			<artifactId>geronimo-jms_1.1_spec</artifactId>
+			<version>1.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.qpid</groupId>
+			<artifactId>qpid-client</artifactId>
+			<version>0.24</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.qpid</groupId>
+			<artifactId>qpid-amqp-1-0-client-jms</artifactId>
+			<version>0.24</version>
+		</dependency>
+  </dependencies>
+  
+   <build>
+		<finalName>qpid-with-dependencies</finalName>
+		<plugins>
+			<plugin>
+				<artifactId>maven-assembly-plugin</artifactId>
+				<version>2.4</version>
+				<configuration>
+					<descriptorRefs>
+						<descriptorRef>jar-with-dependencies</descriptorRef>
+					</descriptorRefs>
+	
+				</configuration>
+				<executions>
+					<execution>
+						<id>make-assembly</id>
+						<phase>package</phase>
+						<goals>
+							<goal>single</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+	
+	
+</project>

Added: juddi/trunk/juddi-examples/subscription-notification-amqp/readme.txt
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/subscription-notification-amqp/readme.txt?rev=1558263&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/subscription-notification-amqp/readme.txt (added)
+++ juddi/trunk/juddi-examples/subscription-notification-amqp/readme.txt Wed Jan 15 01:44:56
2014
@@ -0,0 +1,22 @@
+To run this demo, first go here
+http://qpid.apache.org/
+
+1) Download the following:
+ - Java broker
+2) Start Qpid Java broker (qpid-server)
+	- Reconfigure Qpid. The goal here is to have Qpid's http management interface rerouted to
another port that 8080
+	- Login with admin/admin, add a new HTTP port and delete the old one
+	- Restart Qpid
+3) juddi-examples/subscription-notification-amqp> mvn clean install
+4) copy juddi-qpid-notifier/target/juddi-qpid-notifier-3.2-SNAPSHOT.jar to tomcat/webapps/juddiv3.war/WEB-INF/lib
+5) copy qpid-dependencies/target/qpid-with-dependencies-jar-with-dependencies.jar to tomcat/webapps/juddiv3.war/WEB-INF/lib
+6) Start Tomcat with jUDDI
+7) run juddi-qpid-notifier> mvn clean install -Pdemo
+
+At this point, our AMQP client will sit and listen for changes to business, services and
tModels.
+
+It's pretty each to change something using the juddi-gui.
+	http://localhost:8080/juddi-gui
+
+	
+Notes: this example is very basic and does not consider cases such as authentication and
SSL key information for connecting to Qpid.
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org


Mime
View raw message