Package org.apache.juddi.api_v3

Examples of org.apache.juddi.api_v3.SyncSubscriptionRequest


   private void savePublisher(String publisherId, String publisherXML) {
    try {
      String rootPublisherStr = AppConfig.getConfiguration().getString(Property.JUDDI_ROOT_PUBLISHER);
      authInfo = TckSecurity.getAuthToken(security, rootPublisherStr, "");
      logger.debug("Saving new publisher: " + publisherXML);
      SavePublisher sp = new SavePublisher();
      sp.setAuthInfo(authInfo);
      Publisher pubIn = (Publisher)EntityCreator.buildFromDoc(publisherXML, "org.apache.juddi.api_v3");
      sp.getPublisher().add(pubIn);
      publisher.savePublisher(sp);
 
      // Now get the entity and check the values
      GetPublisherDetail gp = new GetPublisherDetail();
      gp.getPublisherId().add(publisherId);
View Full Code Here


    HttpServletRequest request = this.getThreadLocalRequest();
    HttpSession session = request.getSession();
    try {
       Transport transport = WebHelper.getTransport(session.getServletContext());
            JUDDIApiPortType apiService = transport.getJUDDIApiService();
            SavePublisher savePublisher = new SavePublisher();
            savePublisher.setAuthInfo(token);
            org.apache.juddi.api_v3.Publisher apiPublisher = new org.apache.juddi.api_v3.Publisher();
            BeanUtils.copyProperties(apiPublisher, publisher);
            savePublisher.getPublisher().add(apiPublisher);
            PublisherDetail publisherDetail = apiService.savePublisher(savePublisher);
            List<Publisher> publishers = new ArrayList<Publisher>();
           for (org.apache.juddi.api_v3.Publisher apiPublisherOut : publisherDetail.getPublisher()) {
        Publisher publisherOut = new Publisher();
        BeanUtils.copyProperties(publisherOut, apiPublisherOut);
View Full Code Here

            //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

      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

        public SyncSubscriptionDetail invokeSyncSubscription(
                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 = null;
                                try {
                                        modelClientSubscriptionInfo = em.find(org.apache.juddi.model.ClientSubscriptionInfo.class, subscriptionKey);
                                } catch (ClassCastException e) {
                                }
                                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

TOP

Related Classes of org.apache.juddi.api_v3.SyncSubscriptionRequest

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.