Package com.adito.extensions

Examples of com.adito.extensions.ExtensionDescriptor


        //
        parameterItems = new ArrayList<ShortcutParameterItem>();

        // Get the application selected in the previous step and retrieve all of
        // the shortcut parameter items
        ExtensionDescriptor des = ExtensionStore.getInstance().getExtensionDescriptor(
            ((ApplicationShortcut) resource).getApplication());
        if (des == null) {
            throw new Exception("No descriptor named " + ((ApplicationShortcut) resource).getApplication());
        }

        for (Iterator i = des.getParametersAndDefaults().entrySet().iterator(); i.hasNext();) {
            Map.Entry entry = (Map.Entry) i.next();
            ApplicationParameterDefinition def = (ApplicationParameterDefinition) entry.getValue();
            if (!def.isHidden()) {
                try {
                    String value = (String) ((ApplicationShortcut) resource).getParameters().get(def.getName());
View Full Code Here


  public void coreEvent(CoreEvent evt) {
    if (evt.getId() == CoreEventConstants.REMOVING_EXTENSION) {
      ExtensionBundle bundle = (ExtensionBundle) evt.getParameter();
      for (Iterator itr = bundle.iterator(); itr.hasNext();) {
        ExtensionDescriptor app = (ExtensionDescriptor) itr.next();
        try {
          ApplicationShortcutDatabaseFactory.getInstance().removeApplicationShortcuts(app.getId());
        } catch (Exception e) {
          log.error("Failed to remove application shortcuts for removed extension " + bundle.getId());
        }
      }
    }
View Full Code Here

   * @see com.adito.policyframework.actions.AbstractLaunchAction#isAgentRequired(com.adito.policyframework.Resource)
   */
  protected boolean isAgentRequired(Resource resource) {
    ApplicationShortcut shortcut = (ApplicationShortcut) resource;
    try {
      ExtensionDescriptor descriptor = ExtensionStore.getInstance().getExtensionDescriptor(shortcut.getApplication());
      return ((ApplicationLauncherType) descriptor.getExtensionType()).isAgentRequired(shortcut, descriptor);
    } catch (Exception e) {
      log.error("Failed to determine if agent is required. Assuming not.");
      return false;
    }
  }
View Full Code Here

   *      javax.servlet.http.HttpServletRequest, java.lang.String)
   */
  protected ActionForward launch(ActionMapping mapping, LaunchSession launchSession, HttpServletRequest request, String returnTo)
          throws Exception {
    ApplicationShortcut shortcut = (ApplicationShortcut) launchSession.getResource();
    ExtensionDescriptor descriptor = ExtensionStore.getInstance().getExtensionDescriptor(shortcut.getApplication());
    HashMap<String, String> parameters = new HashMap<String, String>();
    Enumeration e = request.getParameterNames();
    while (e.hasMoreElements()) {
      String nameParam = (String) e.nextElement();
      parameters.put(nameParam, request.getParameter(nameParam));
    }

    // Do the launch
    try {
      if(descriptor.getApplicationBundle().getStatus() != ExtensionBundleStatus.ACTIVATED) {
        throw new Exception("Extension bundle " + descriptor.getApplicationBundle().getId() +" is not activated, cannot launch applicaiton.");
      }
      ActionForward fwd = ((ApplicationLauncherType) descriptor.getExtensionType()).launch(parameters,
        descriptor,
        shortcut,
        mapping,
        launchSession,
        returnTo,
        request);

      CoreServlet.getServlet().fireCoreEvent(new ResourceAccessEvent(this,
          ApplicationShortcutEventConstants.APPLICATION_SHORTCUT_LAUNCHED,
              launchSession.getResource(),
              launchSession.getPolicy(),
              launchSession.getSession(),
              CoreEvent.STATE_SUCCESSFUL).addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_NAME,
        descriptor.getName()).addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_ID, descriptor.getId()));

      /*
       * If the launch implementation returns its own forward, it is
       * reponsible for setting up its 'launched' message
       */
      if (fwd == null) {
        ActionMessages msgs = new ActionMessages();
        msgs.add(Globals.MESSAGE_KEY, new BundleActionMessage(ApplicationsPlugin.MESSAGE_RESOURCES_KEY,
                "launchApplication.launched",
                shortcut.getResourceName()));
        saveMessages(request, msgs);
        return new RedirectWithMessages(returnTo, request);
      }
      return fwd;
    } catch (Exception ex) {
      CoreServlet.getServlet().fireCoreEvent(new ResourceAccessEvent(this,
          ApplicationShortcutEventConstants.APPLICATION_SHORTCUT_LAUNCHED,
              launchSession.getSession(),
              ex).addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_NAME, descriptor.getName())
              .addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_ID, descriptor.getId()));
      throw ex;

    }
  }
View Full Code Here

    public DefaultApplicationShortcut(int realmID, int resourceId, String resourceName, String resourceDescription, Calendar dateCreated,
                    Calendar dateAmended, String application, Map<String,String> parameters, boolean autoStart) {
        super(realmID, ApplicationsPlugin.APPLICATION_SHORTCUT_RESOURCE_TYPE, resourceId, resourceName, resourceDescription, dateCreated,
                        dateAmended);
       
        ExtensionDescriptor des = ExtensionStore.getInstance().getExtensionDescriptor(application);
        if(des != null) {
            setLaunchRequirement(des.getExtensionType().getLaunchRequirement());
        }
        this.application = application;
        this.parameters = parameters;
        this.autoStart = autoStart;
    }
View Full Code Here

        SessionInfo sessionInfo = LogonControllerFactory.getInstance().getSessionInfo(request);
        ApplicationShortcut as = ApplicationShortcutDatabaseFactory.getInstance().getShortcut(resourceId);
        if (as == null) {
            return null;
        }
        ExtensionDescriptor des = ExtensionStore.getInstance().getExtensionDescriptor(as.getApplication());
        if (des == null) {
            throw new Exception("No application extension with ID of " + as.getApplication() + ", skipping favorite.");
        } else {
            SessionInfo inf = LogonControllerFactory.getInstance().getSessionInfo(request);
            ApplicationShortcutItem it = new ApplicationShortcutItem(des, as, PolicyDatabaseFactory.getInstance()
View Full Code Here

        throw new ChannelOpenException(ChannelOpenException.CHANNEL_REFUSED, "No launch session with ID " + launchId + ", cannot read file " + filename + " for " + name);
      }

      launchSession.checkAccessRights(null, agent.getSession());

      ExtensionDescriptor descriptor = ExtensionStore.getInstance().getExtensionDescriptor(name);
      if (!descriptor.containsFile(filename))
        throw new ChannelOpenException(ChannelOpenException.CHANNEL_REFUSED, "Application does not contain file " + filename + " in extension " + name);

      this.file = descriptor.getFile(filename);
      this.in = new FileInputStream(file);

    } catch (Exception e) {
      throw new ChannelOpenException(ChannelOpenException.CHANNEL_REFUSED, e.getMessage());
    }
View Full Code Here

    public ApplicationShortcutDeleteEvent(Object source, int id, ApplicationShortcut shortcut, SessionInfo session, int state) {
        super(source, id, shortcut, session, state);
        if(shortcut != null) {
            addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_ID, shortcut.getApplication());
            try {
                ExtensionDescriptor des = ExtensionStore.getInstance().getExtensionDescriptor(shortcut.getApplication());
                if(des != null) {
                    addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_NAME, des.getName());
                }
            }
            catch(Exception e) {               
            }
        }
View Full Code Here

    public ApplicationShortcutChangeEvent(Object source, int id, ApplicationShortcut shortcut, SessionInfo session, int state) {
        super(source, id, shortcut, session, state);
        if(shortcut != null) {
            addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_ID, shortcut.getApplication());
            try {
                ExtensionDescriptor des = ExtensionStore.getInstance().getExtensionDescriptor(shortcut.getApplication());
                if(des != null) {
                    addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_NAME, des.getName());
                    for (Iterator i = des.getParametersAndDefaults().entrySet().iterator(); i.hasNext();) {
                        Map.Entry entry = (Map.Entry) i.next();
                        String val = (String)shortcut.getParameters().get(entry.getKey());
                        ApplicationParameterDefinition def = (ApplicationParameterDefinition) entry.getValue();
                        addAttribute(def.getName(), def.getType() == ApplicationParameterDefinition.TYPE_PASSWORD ? "******" : ( val == null ? "" : val ) );
                    }
View Full Code Here

  public Request launchApplication(LaunchSession launchSession) throws Exception {
    ApplicationShortcut shortcut = (ApplicationShortcut) launchSession.getResource();
    ByteArrayWriter msg = new ByteArrayWriter();
   
    // If this is a service side application launcher then launch now and inform the agent not to go any further
    ExtensionDescriptor descriptor = ExtensionStore.getInstance().getExtensionDescriptor(shortcut.getApplication());
    if(((ApplicationLauncherType)descriptor.getExtensionType()).isServerSide()) {
      msg.writeBoolean(true);


      // Do the launch
      try {
        if(descriptor.getApplicationBundle().getStatus() != ExtensionBundleStatus.ACTIVATED) {
          throw new Exception("Extension bundle " + descriptor.getApplicationBundle().getId() +" is not activated, cannot launch applicaiton.");
        }
       
        ((ApplicationLauncherType) descriptor.getExtensionType()).launch(new HashMap<String, String>(),
          descriptor,
          shortcut,
          null,
          launchSession,
          null,
          null);

        CoreServlet.getServlet().fireCoreEvent(new ResourceAccessEvent(this,
                ApplicationShortcutEventConstants.APPLICATION_SHORTCUT_LAUNCHED,
                launchSession.getResource(),
                launchSession.getPolicy(),
                launchSession.getSession(),
                CoreEvent.STATE_SUCCESSFUL).addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_NAME,
          descriptor.getName()).addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_ID, descriptor.getId()));

      } catch (Exception ex) {
        CoreServlet.getServlet().fireCoreEvent(new ResourceAccessEvent(this,
            ApplicationShortcutEventConstants.APPLICATION_SHORTCUT_LAUNCHED,
                launchSession.getSession(),
                ex).addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_NAME, descriptor.getName())
                .addAttribute(CoreAttributeConstants.EVENT_ATTR_APPLICATION_ID, descriptor.getId()));
        throw ex;

      }
    }
    else {   
View Full Code Here

TOP

Related Classes of com.adito.extensions.ExtensionDescriptor

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.