Examples of SubscriptionInfo


Examples of org.apache.jackrabbit.webdav.observation.SubscriptionInfo

        Document requestDocument = getRequestDocument();
        if (requestDocument != null) {
            Element root = requestDocument.getDocumentElement();
            if (ObservationConstants.XML_SUBSCRIPTIONINFO.equals(root.getLocalName())) {
                int depth = getDepth(DEPTH_0);
                return new SubscriptionInfo(root, getTimeout(), depth == DEPTH_INFINITY);
            }
        }
        return null;
    }
View Full Code Here

Examples of org.apache.stratos.adc.mgt.dto.SubscriptionInfo

    private static void addDNSEntry(String alias, String cartridgeType) {
        new DNSManager().addNewSubDomain(alias + "." + cartridgeType, System.getProperty(CartridgeConstants.ELB_IP));
    }

    private static SubscriptionInfo createSubscriptionResponse(CartridgeSubscription cartridgeSubscription, Repository repository) {
      SubscriptionInfo subscriptionInfo = new SubscriptionInfo();
     
        if (repository != null && repository.getRepoName() != null) {
          subscriptionInfo.setRepositoryURL(convertRepoURL(repository.getRepoName()));
        }
       
        subscriptionInfo.setHostname(cartridgeSubscription.getHostName());
       
        return subscriptionInfo;
    }
View Full Code Here

Examples of org.apache.stratos.adc.mgt.dto.xsd.SubscriptionInfo

  public void subscribe(String cartridgeType, String alias, String policy, String externalRepoURL,
      boolean privateRepo, String username, String password, String dataCartridgeType, String dataCartridgeAlias)
      throws CommandException {
   
    SubscriptionInfo subcriptionConnectInfo = null;
    if (StringUtils.isNotBlank(dataCartridgeType) && StringUtils.isNotBlank(dataCartridgeAlias)) {
      System.out.format("Subscribing to data cartridge %s with alias %s.%n", dataCartridgeType,
          dataCartridgeAlias);
      try {
        subcriptionConnectInfo = stub.subscribe(dataCartridgeType, dataCartridgeAlias, null, null, false, null,
            null, null, null);
        System.out.format("You have successfully subscribed to %s cartridge with alias %s.%n",
            dataCartridgeType, dataCartridgeAlias);
        System.out.format("%nSubscribing to %s cartridge and connecting with %s data cartridge.%n", alias,
            dataCartridgeAlias);
      } catch (RemoteException e) {
        handleException(e);
      } catch (ApplicationManagementServiceADCExceptionException e) {
        handleException("cannot.subscribe", e);
      } catch (ApplicationManagementServiceRepositoryRequiredExceptionException e) {
        handleException("repository.required", e);
      } catch (ApplicationManagementServiceUnregisteredCartridgeExceptionException e) {
        handleException("cartridge.notregistered", e, dataCartridgeType);
      } catch (ApplicationManagementServiceInvalidCartridgeAliasExceptionException e) {
        handleException("cartridge.invalid.alias", e);
      } catch (ApplicationManagementServiceAlreadySubscribedExceptionException e) {
        handleException("cartridge.already.subscribed", e, e.getFaultMessage().getAlreadySubscribedException()
            .getCartridgeType());
      } catch (ApplicationManagementServiceDuplicateCartridgeAliasExceptionException e) {
        handleException("cartridge.alias.duplicate", e, dataCartridgeAlias);
      } catch (ApplicationManagementServicePolicyExceptionException e) {
        handleException("policy.error", e);
      } catch (ApplicationManagementServiceRepositoryTransportExceptionException e) {
        handleException("repository.transport.error", e, externalRepoURL);
      } catch (ApplicationManagementServiceRepositoryCredentialsRequiredExceptionException e) {
        handleException("repository.credentials.required", e, externalRepoURL);
      } catch (ApplicationManagementServiceInvalidRepositoryExceptionException e) {
        handleException("repository.invalid.error", e, externalRepoURL);
      }
    }
   
   
    try {
      SubscriptionInfo subcriptionInfo = stub.subscribe(cartridgeType, alias, policy, externalRepoURL,
          privateRepo, username, password, dataCartridgeType, dataCartridgeAlias);

      System.out
          .format("You have successfully subscribed to %s cartridge with alias %s.%n", cartridgeType, alias);

      String repoURL = null;
      String hostnames = null;
      String hostnamesLabel = null;
      if (subcriptionInfo != null) {
        repoURL = subcriptionInfo.getRepositoryURL();
        hostnames = subcriptionInfo.getHostname();
        hostnamesLabel = "host name";

        if (repoURL != null) {
          System.out.println("GIT Repository URL: " + repoURL);
        }
View Full Code Here

Examples of org.apache.stratos.cli.beans.SubscriptionInfo

                System.out.println("Error in response");
                return;
            }

            String  subscriptionOutputJSON=  subscriptionOutput.substring(20, subscriptionOutput.length() -1);
            SubscriptionInfo subcriptionInfo = gson.fromJson(subscriptionOutputJSON, SubscriptionInfo.class);

            System.out.format("You have successfully subscribed to %s cartridge with alias %s.%n", cartridgeType, alias);

            String repoURL = null;
            String hostnames = null;
            String hostnamesLabel = null;
            if (subcriptionInfo != null) {
                repoURL = subcriptionInfo.getRepositoryURL();
                hostnames = subcriptionInfo.getHostname();
                hostnamesLabel = "host name";

                if (repoURL != null) {
                    System.out.println("GIT Repository URL: " + repoURL);
                }
View Full Code Here

Examples of org.apache.stratos.manager.dto.SubscriptionInfo

        copy.setHostName("dummy.stratos.com");
        copy.setRepoURL("http://dummy.stratos.com/myrepo.git");

        subscribedCartridges.put(alias,copy);

        SubscriptionInfo subscriptionInfo = new SubscriptionInfo();
        subscriptionInfo.setHostname(copy.getHostName());
        subscriptionInfo.setRepositoryURL(copy.getRepoURL());

        return subscriptionInfo;
    }
View Full Code Here

Examples of org.jboss.jms.server.destination.SubscriptionInfo

     
      assertNotNull(subs);
     
      assertEquals(1, subs.size());
     
      SubscriptionInfo info = (SubscriptionInfo)subs.get(0);

      assertEquals("monicabelucci", info.getName());

      prod.send(s.createTextMessage("k"));

      conn.close();

      subs = (List)ServerManagement.invoke(destObjectName, "listAllSubscriptions", null, null);

      assertEquals(1, subs.size());
     
      info = (SubscriptionInfo)subs.get(0);

      assertEquals("monicabelucci", info.getName());

      conn = cf.createConnection();
      conn.setClientID("brookeburke");

      s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
View Full Code Here

Examples of org.olat.core.util.notifications.SubscriptionInfo

   */
  public SubscriptionInfo createSubscriptionInfo(Subscriber subscriber, Locale locale, Date compareDate) {
    Publisher p = subscriber.getPublisher();
    final Date latestNews = p.getLatestNewsDate();

    SubscriptionInfo si;
    // there could be news for me, investigate deeper
    try {
      if (NotificationsManager.getInstance().isPublisherValid(p) && compareDate.before(latestNews)) {
        String displayname = RepositoryManager.getInstance().lookupDisplayNameByOLATResourceableId(p.getResId());
        if(displayname == null) {
          if(!checkPublisher(subscriber.getPublisher())) {
            return NotificationsManager.getInstance().getNoSubscriptionInfo();
          }
        }
        DialogElementsPropertyManager mgr = DialogElementsPropertyManager.getInstance();
        DialogPropertyElements elements = mgr.findDialogElements(p.getResId(), p.getSubidentifier());
        final List<DialogElement> dialogElements = elements.getDialogPropertyElements();
        final Translator translator = Util.createPackageTranslator(FileUploadNotificationHandler.class, locale);

        si = new SubscriptionInfo(new TitleItem(translator.translate("notifications.header", new String[]{displayname}), CSSS_CLASS_UPLOAD_ICON), null);
        SubscriptionListItem subListItem;
        for (DialogElement element : dialogElements) {
          // do only show entries newer then the ones already seen
          if (element.getDate().after(compareDate)) {
            String filename = element.getFilename();
            String creator = element.getAuthor();
            Identity ident = ManagerFactory.getManager().findIdentityByName(creator);
            Date modDate = element.getDate();

            String desc = translator.translate("notifications.entry", new String[] { filename, NotificationHelper.getFormatedName(ident) });
            String urlToSend = NotificationHelper.getURLFromBusinessPathString(p, p.getBusinessPath());
            String cssClass = CSSHelper.createFiletypeIconCssClassFor(filename);

            subListItem = new SubscriptionListItem(desc, urlToSend, modDate, cssClass);
            si.addSubscriptionListItem(subListItem);
          }
        }
      } else {
        si = NotificationsManager.getInstance().getNoSubscriptionInfo();
      }
View Full Code Here

Examples of org.olat.core.util.notifications.SubscriptionInfo

  public SubscriptionInfo createSubscriptionInfo(final Subscriber subscriber, Locale locale, Date compareDate) {
    try {
      Publisher p = subscriber.getPublisher();
      Date latestNews = p.getLatestNewsDate();
     
      SubscriptionInfo si;
      // there could be news for me, investigate deeper
      if (NotificationsManager.getInstance().isPublisherValid(p) && compareDate.before(latestNews)) {
        String businessControlString = "";
        Long forumKey = Long.valueOf(0);
        try {
          forumKey = Long.parseLong(p.getData());
        } catch (NumberFormatException e) {
          logError("Could not parse forum key!", e);
          NotificationsManager.getInstance().deactivate(p);
          return NotificationsManager.getInstance().getNoSubscriptionInfo();
        }
        final List<Message> mInfos = ForumManager.getInstance().getNewMessageInfo(forumKey, compareDate);
        final Translator translator = Util.createPackageTranslator(ForumNotificationsHandler.class, locale);
       
        businessControlString = p.getBusinessPath() + "[Message:";
       
        si = new SubscriptionInfo(getTitleItem(p, translator), null);
        for (Message mInfo : mInfos) {
          String title = mInfo.getTitle();
          Identity creator = mInfo.getCreator();
          Identity modifier = mInfo.getModifier();
          Date modDate = mInfo.getLastModified();
         
          String name;
          if(modifier != null) {
            name = NotificationHelper.getFormatedName(modifier);
          } else {
            name = NotificationHelper.getFormatedName(creator);
          }
          String desc = translator.translate("notifications.entry", new String[] { title, name })
          String urlToSend = null;
          if(p.getBusinessPath() != null) {
            urlToSend = NotificationHelper.getURLFromBusinessPathString(p, businessControlString + mInfo.getKey().toString() + "]");
          }
         
          SubscriptionListItem subListItem = new SubscriptionListItem(desc, urlToSend, modDate, ForumHelper.CSS_ICON_CLASS_MESSAGE);
          si.addSubscriptionListItem(subListItem);
        }
      } else {
        si = NotificationsManager.getInstance().getNoSubscriptionInfo();
      }
      return si;
View Full Code Here

Examples of org.olat.core.util.notifications.SubscriptionInfo

  public SubscriptionInfo createSubscriptionInfo(Subscriber subscriber, final Locale locale, Date compareDate) {
    Publisher p = subscriber.getPublisher();

    final Date latestNews = p.getLatestNewsDate();
    Long resId = p.getResId();
    SubscriptionInfo si;
    // there could be news for me, investigate deeper
    logDebug("compareDate=" + compareDate + " ; latestNews=" + latestNews, null);
    try {
      if (NotificationsManager.getInstance().isPublisherValid(p) && compareDate.before(latestNews)) {
        OLATResourceable ores = null;
        if (p.getResName().equals( CourseModule.getCourseTypeName() ) ) {
          // resId = CourseResourceableId           p.getSubidentifier() = wikiCourseNode.getIdent()
          ICourse course = CourseFactory.loadCourse(resId);
          CourseEnvironment cenv = course.getCourseEnvironment();
          CourseNode courseNode = cenv.getRunStructure().getNode(p.getSubidentifier());
          if(courseNode == null){
            //OLAT-3356 because removing wikicoursenodes was not propagated to
            // disable subcriptions, we may end up here with a NULL wikicoursenode
            // Best we can do here -> return noSubsInfo and clean up
            NotificationsManager.getInstance().deactivate(p);
            // return nothing available
            return NotificationsManager.getInstance().getNoSubscriptionInfo();
          }
          ModuleConfiguration config = ((WikiCourseNode)courseNode).getModuleConfiguration();
          RepositoryEntry re = WikiEditController.getWikiRepoReference(config, true);
          resId = re.getOlatResource().getResourceableId();
          logDebug("resId=" + resId, null);
          ores = OresHelper.createOLATResourceableInstance(WikiResource.TYPE_NAME, resId);
          businessControlString = p.getBusinessPath() + "[path=";
        } else {
          // resName = 'BusinessGroup' or 'FileResource.WIKI'
          logDebug("p.getResName()=" + p.getResName(), null);
          ores = OresHelper.createOLATResourceableInstance(p.getResName(), resId);
          businessControlString = p.getBusinessPath() + "[path=";
        }
       
        Wiki wiki = WikiManager.getInstance().getOrLoadWiki(ores);
        final List<WikiPage> pages = wiki.getPagesByDate();
        Translator translator = Util.createPackageTranslator(WikiPageChangeOrCreateNotificationHandler.class, locale);
       
        TitleItem title = getTitleItem(p, translator);
        si = new SubscriptionInfo(title, null);
          SubscriptionListItem subListItem;
            for (Iterator<WikiPage> it = pages.listIterator(); it.hasNext();) {           
              WikiPage element = it.next();
             
              // do only show entries newer then the ones already seen
              Date modDate = new Date(element.getModificationTime());
              logDebug("modDate=" + modDate + " ; compareDate=" + compareDate, null);
              if (modDate.after(compareDate)) {
                if((element.getPageName().startsWith("O_") || element.getPageName().startsWith(WikiPage.WIKI_MENU_PAGE)) &&
                    (element.getModifyAuthor() <= 0)) {
                    //theses pages are created sometimes automatically. Check if this is the case
                    continue;
                }

                //build Businesscontrol-Path           
                String bControlString = businessControlString + element.getPageName() + "]";           
                String urlToSend = null;
                if(p.getBusinessPath() != null) {
                  urlToSend = NotificationHelper.getURLFromBusinessPathString(p, bControlString);
                }
               
                // string[] gets filled into translation key by adding {0...n} to
                // the string
                Identity ident = ManagerFactory.getManager().loadIdentityByKey(Long.valueOf(element.getModifyAuthor()));
                String desc = translator.translate("notifications.entry", new String[] { element.getPageName(), NotificationHelper.getFormatedName(ident)});             
                subListItem = new SubscriptionListItem(desc, urlToSend, modDate, CSS_CLASS_WIKI_PAGE_CHANGED_ICON);
                si.addSubscriptionListItem(subListItem);
              } else {
                //there are no more new pages so we stop here
                break;
              }
            }
View Full Code Here

Examples of org.olat.core.util.notifications.SubscriptionInfo

  /**
   * @see org.olat.notifications.NotificationsHandler#createSubscriptionInfo(org.olat.notifications.Subscriber,
   *      java.util.Locale, java.util.Date)
   */
  public SubscriptionInfo createSubscriptionInfo(final Subscriber subscriber, Locale locale, Date compareDate) {
    SubscriptionInfo si = null;
    Publisher p = subscriber.getPublisher();
    if(!NotificationsUpgradeHelper.checkCourse(p)) {
      //course don't exist anymore
      NotificationsManager.getInstance().deactivate(p);
      return NotificationsManager.getInstance().getNoSubscriptionInfo();
    }
   
    try {
      Date latestNews = p.getLatestNewsDate();
      Identity identity = subscriber.getIdentity();

      // do not try to create a subscription info if state is deleted - results in
      // exceptions, course
      // can't be loaded when already deleted
      if (NotificationsManager.getInstance().isPublisherValid(p) && compareDate.before(latestNews)) {
        Long courseId = new Long(p.getData());
        final ICourse course = loadCourseFromId(courseId);
        if (course != null) {
          // course admins or users with the course right to have full access to
          // the assessment tool will have full access to user tests
          CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager();
          final boolean hasFullAccess = (cgm.isIdentityCourseAdministrator(identity) ? true : cgm.hasRight(identity,
              CourseRights.RIGHT_ASSESSMENT));
          final List<Identity> coachedUsers = new ArrayList<Identity>();
          if (!hasFullAccess) {
            // initialize list of users, only when user has not full access
            List<BusinessGroup> coachedGroups = cgm.getOwnedLearningGroupsFromAllContexts(identity);
            Manager securityManager = ManagerFactory.getManager();
            for (Iterator<BusinessGroup> iter = coachedGroups.iterator(); iter.hasNext();) {
              BusinessGroup group = iter.next();
              coachedUsers.addAll(securityManager.getIdentitiesOfSecurityGroup(group.getPartipiciantGroup()));
            }
          }

          List<IQTESTCourseNode> testNodes = getCourseTestNodes(course);
          Translator translator = Util.createPackageTranslator(AssessmentNotificationsHandler.class, locale);

          String title = translator.translate("notifications.header", new String[]{course.getCourseTitle()});
          si = new SubscriptionInfo(new TitleItem(title, CSS_CLASSS_IQTEST_ICON), null);

          for (Iterator<IQTESTCourseNode> i = testNodes.iterator(); i.hasNext();) {
            IQTESTCourseNode test = i.next();

            QTIResultManager qrm = QTIResultManager.getInstance();
            List testResultSets = qrm.getResultSets(course.getResourceableId(), test.getIdent(),
                test.getReferencedRepositoryEntry().getKey(), null);

            for (Iterator j = testResultSets.iterator(); j.hasNext();) {
              QTIResultSet qrs = (QTIResultSet) j.next();
              // - modify date on test set must be newer than last visit of
              // assessment tool
              // - user must either be course administrator (access to all
              // users granted)
              // or in a course right group with the assessment tool right or
              // a course
              // coach. in the second case, only tests of users are shown that
              // the coach does actually
              // coach himself. he does not have access to other users
              Date modDate = qrs.getLastModified();
              if (modDate.after(compareDate) && (hasFullAccess || PersistenceHelper.listContainsObjectByKey(coachedUsers, qrs.getIdentity()))) {
                String score = (new Float(qrs.getScore())).toString();
                String desc = translator.translate("notifications.entry", new String[] { test.getShortTitle(),
                    NotificationHelper.getFormatedName(qrs.getIdentity()), score });

                String urlToSend = null;
                if(p.getBusinessPath() != null) {
                  String businessPath = p.getBusinessPath() + "[assessmentTool:0][Identity:" + qrs.getIdentity().getKey() + "][CourseNode:" + test.getIdent() + "]";
                  urlToSend = NotificationHelper.getURLFromBusinessPathString(p, businessPath);
                }
                SubscriptionListItem subListItem = new SubscriptionListItem(desc, urlToSend, modDate, CSS_CLASS_USER_ICON);
                si.addSubscriptionListItem(subListItem);
              }
            }
          }
        }
      } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.