Package org.apache.juddi.api_v3.rest

Examples of org.apache.juddi.api_v3.rest.UriContainer


            //Creating a new publisher that can be used to publish business entities
            Publisher publisher = new Publisher();
            publisher.setAuthorizedName(PUBLISHER_USER_ID);
            publisher.setPublisherName(PUBLISHER_NAME);

            SavePublisher savePublisher = new SavePublisher();
            savePublisher.getPublisher().add(publisher);

            savePublisher.setAuthInfo(rootAuthToken.getAuthInfo());

            JUDDIApiImpl juddiApi = new JUDDIApiImpl();
            juddiApi.savePublisher(savePublisher);

        } catch (Exception e) {
View Full Code Here


      coverage.setEndPoint(calendarEnd);
      getSubscriptionResults.setCoveragePeriod(coverage);
     
      String authToken = (String) session.getAttribute("token-" + modelSubscription.getFromClerkName());
      getSubscriptionResults.setAuthInfo(authToken);
            SyncSubscription syncSubscription = new SyncSubscription();
            syncSubscription.getGetSubscriptionResultsList().add(getSubscriptionResults);
     
          Transport transport = WebHelper.getTransport(session.getServletContext());
             JUDDIApiPortType apiService = transport.getJUDDIApiService();
     
             syncSubscription.setAuthInfo(userAuthToken);
             SyncSubscriptionDetail detail = apiService.invokeSyncSubscription(syncSubscription);
      SubscriptionResultsList list = detail.getSubscriptionResultsList().get(0);
      System.out.println("list=" + list);
     
      response.setSuccess(true);
View Full Code Here

     
          Transport transport = WebHelper.getTransport(session.getServletContext());
             JUDDIApiPortType apiService = transport.getJUDDIApiService();
     
             syncSubscription.setAuthInfo(userAuthToken);
             SyncSubscriptionDetail detail = apiService.invokeSyncSubscription(syncSubscription);
      SubscriptionResultsList list = detail.getSubscriptionResultsList().get(0);
      System.out.println("list=" + list);
     
      response.setSuccess(true);
    } catch (Exception e) {
      logger.error("Could not save subscription. " + e.getMessage(), e);
View Full Code Here

      SyncSubscription body) throws DispositionReportFaultMessage,
      RemoteException {
   
    //validate
   
    SyncSubscriptionDetail syncSubscriptionDetail = new SyncSubscriptionDetail();
   
    Map<String,org.apache.juddi.api_v3.ClientSubscriptionInfo> clientSubscriptionInfoMap
        = new HashMap<String,org.apache.juddi.api_v3.ClientSubscriptionInfo>();
    //find the clerks to go with these subscriptions
    EntityManager em = PersistenceManager.getEntityManager();
    EntityTransaction tx = em.getTransaction();
    try {
      tx.begin();
 
      this.getEntityPublisher(em, body.getAuthInfo());
      for (GetSubscriptionResults getSubscriptionResult : body.getGetSubscriptionResultsList()) {
        String subscriptionKey = getSubscriptionResult.getSubscriptionKey();
        org.apache.juddi.model.ClientSubscriptionInfo modelClientSubscriptionInfo =
          em.find(org.apache.juddi.model.ClientSubscriptionInfo.class, subscriptionKey);
        if (modelClientSubscriptionInfo == null) {
          throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.SubscripKeyNotFound", subscriptionKey));
        }
        org.apache.juddi.api_v3.ClientSubscriptionInfo apiClientSubscriptionInfo = new org.apache.juddi.api_v3.ClientSubscriptionInfo();
        MappingModelToApi.mapClientSubscriptionInfo(modelClientSubscriptionInfo, apiClientSubscriptionInfo);
        clientSubscriptionInfoMap.put(apiClientSubscriptionInfo.getSubscriptionKey(),apiClientSubscriptionInfo);
      }
 
      tx.commit();
    } finally {
      if (tx.isActive()) {
        tx.rollback();
      }
      em.close();
    }
   
    for (GetSubscriptionResults getSubscriptionResult : body.getGetSubscriptionResultsList()) {
      try {
        String subscriptionKey = getSubscriptionResult.getSubscriptionKey();
        Clerk fromClerk = clientSubscriptionInfoMap.get(subscriptionKey).getFromClerk();
        Clerk toClerk = clientSubscriptionInfoMap.get(subscriptionKey).getToClerk();
        String clazz = fromClerk.getNode().getProxyTransport();
        Class<?> transportClass = Loader.loadClass(clazz);
        Transport transport = (Transport) transportClass.getConstructor(String.class).newInstance(fromClerk.getNode().getName());
        UDDISubscriptionPortType subscriptionService = transport.getUDDISubscriptionService(fromClerk.getNode().getSubscriptionUrl());
        SubscriptionResultsList list = subscriptionService.getSubscriptionResults(getSubscriptionResult);
       
        JAXBContext context = JAXBContext.newInstance(list.getClass());
        Marshaller marshaller = context.createMarshaller();
        StringWriter sw = new StringWriter();
        marshaller.marshal(list, sw);

        log.info("Notification received by UDDISubscriptionListenerService : " + sw.toString());
       
        NotificationList<String> nl = NotificationList.getInstance();
        nl.getNotifications().add(sw.toString());
       
        //update the registry with the notification list.
        XRegisterHelper.handle(fromClerk, toClerk, list);
       
        syncSubscriptionDetail.getSubscriptionResultsList().add(list);
      } catch (Exception ce) {
        log.error(ce.getMessage(),ce);
        if (ce instanceof DispositionReportFaultMessage) {
          throw (DispositionReportFaultMessage) ce;
        }
View Full Code Here

      SyncSubscription body) throws DispositionReportFaultMessage,
      RemoteException {
   
    //validate
   
    SyncSubscriptionDetail syncSubscriptionDetail = new SyncSubscriptionDetail();
   
    Map<String,org.apache.juddi.api_v3.ClientSubscriptionInfo> clientSubscriptionInfoMap
        = new HashMap<String,org.apache.juddi.api_v3.ClientSubscriptionInfo>();
    //find the clerks to go with these subscriptions
    EntityManager em = PersistenceManager.getEntityManager();
    EntityTransaction tx = em.getTransaction();
    try {
      tx.begin();
 
      this.getEntityPublisher(em, body.getAuthInfo());
      for (GetSubscriptionResults getSubscriptionResult : body.getGetSubscriptionResultsList()) {
        String subscriptionKey = getSubscriptionResult.getSubscriptionKey();
        org.apache.juddi.model.ClientSubscriptionInfo modelClientSubscriptionInfo =
          em.find(org.apache.juddi.model.ClientSubscriptionInfo.class, subscriptionKey);
        if (modelClientSubscriptionInfo == null) {
          throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.SubscripKeyNotFound", subscriptionKey));
        }
        org.apache.juddi.api_v3.ClientSubscriptionInfo apiClientSubscriptionInfo = new org.apache.juddi.api_v3.ClientSubscriptionInfo();
        MappingModelToApi.mapClientSubscriptionInfo(modelClientSubscriptionInfo, apiClientSubscriptionInfo);
        clientSubscriptionInfoMap.put(apiClientSubscriptionInfo.getSubscriptionKey(),apiClientSubscriptionInfo);
      }
 
      tx.commit();
    } finally {
      if (tx.isActive()) {
        tx.rollback();
      }
      em.close();
    }
   
    for (GetSubscriptionResults getSubscriptionResult : body.getGetSubscriptionResultsList()) {
      try {
        String subscriptionKey = getSubscriptionResult.getSubscriptionKey();
        Clerk fromClerk = clientSubscriptionInfoMap.get(subscriptionKey).getFromClerk();
        Clerk toClerk = clientSubscriptionInfoMap.get(subscriptionKey).getToClerk();
        String clazz = fromClerk.getNode().getProxyTransport();
        Class<?> transportClass = ClassUtil.forName(clazz, this.getClass());
        Transport transport = (Transport) transportClass.getConstructor(String.class).newInstance(fromClerk.getNode().getName());
        UDDISubscriptionPortType subscriptionService = transport.getUDDISubscriptionService(fromClerk.getNode().getSubscriptionUrl());
        SubscriptionResultsList list = subscriptionService.getSubscriptionResults(getSubscriptionResult);
       
        JAXBContext context = JAXBContext.newInstance(list.getClass());
        Marshaller marshaller = context.createMarshaller();
        StringWriter sw = new StringWriter();
        marshaller.marshal(list, sw);

        log.info("Notification received by UDDISubscriptionListenerService : " + sw.toString());
       
        NotificationList<String> nl = NotificationList.getInstance();
        nl.getNotifications().add(sw.toString());
       
        //update the registry with the notification list.
        XRegisterHelper.handle(fromClerk, toClerk, list);
       
        syncSubscriptionDetail.getSubscriptionResultsList().add(list);
      } catch (Exception ce) {
        log.error(ce.getMessage(),ce);
        if (ce instanceof DispositionReportFaultMessage) {
          throw (DispositionReportFaultMessage) ce;
        }
View Full Code Here

                @QueryParam("offset") Integer offset) throws WebApplicationException {
                return getTModelSearch(name, lang, findQualifiers, maxrows, offset);
        }

        private UriContainer getEndpointsByService(String id) throws WebApplicationException {
                UriContainer c = new UriContainer();
                List<String> ret = new ArrayList<String>();
                GetServiceDetail fs = new GetServiceDetail();

                fs.getServiceKey().add(id);
                try {
                        ServiceDetail serviceDetail = inquiry.getServiceDetail(fs);
                        if (serviceDetail == null || serviceDetail.getBusinessService().isEmpty()) {
                                throw new WebApplicationException(400);
                        } else {
                                List<String> endpoints = GetEndpoints(serviceDetail, null);
                                ret.addAll(endpoints);
                        }
                } catch (DispositionReportFaultMessage ex) {
                        HandleException(ex);
                }
                c.setUriList(ret);
                return c;
        }
View Full Code Here

        @Test(expected = WebApplicationException.class)
        public void testGeEndpointsByServiceJSON_NULL() {
                System.out.println("geEndpointsByServiceJSON_NULL");
                String id = UUID.randomUUID().toString();

                UriContainer expResult = null;
                UriContainer result = instance.geEndpointsByServiceJSON(id);

        }
View Full Code Here

        @Test
        public void testGeEndpointsByServiceJSON() {
                System.out.println("geEndpointsByServiceJSON");
                String id = UUID.randomUUID().toString();

                UriContainer expResult = null;
                UriContainer result = instance.geEndpointsByServiceJSON(JUDDI_SVC);
                Assert.assertNotNull(result);


        }
View Full Code Here

        @Test(expected = WebApplicationException.class)
        public void testGetEndpointsByServiceXML_NULL() {
                System.out.println("getEndpointsByServiceXML_NULL");
                String id = UUID.randomUUID().toString();

                UriContainer expResult = null;
                UriContainer result = instance.getEndpointsByServiceXML(id);

        }
View Full Code Here

        @Test
        public void testGeTEndpointsByServiceXML() {
                System.out.println("geEndpointsByServiceXML");
                String id = UUID.randomUUID().toString();

                UriContainer expResult = null;
                UriContainer result = instance.getEndpointsByServiceXML(JUDDI_SVC);
                Assert.assertNotNull(result);
        }
View Full Code Here

TOP

Related Classes of org.apache.juddi.api_v3.rest.UriContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.