Package org.apache.jetspeed.profiler

Examples of org.apache.jetspeed.profiler.Profiler


     *
     * @throws SerializerException
     */
    private void getProfilingRules() throws SerializerException
    {
        Profiler pm = (Profiler) getCM()
                .getComponent("org.apache.jetspeed.profiler.Profiler");
        if (pm == null)

            throw new SerializerException(
                    SerializerException.COMPONENTMANAGER_DOES_NOT_EXIST
                            .create("org.apache.jetspeed.profiler.Profiler"));
        Class standardRuleClass = null;
        try
        {
          ProfilingRule tempStandardRule = pm.createProfilingRule(true);
          standardRuleClass = tempStandardRule.getClass();
        }
        catch (Exception e)
        {
          throw new SerializerException(
                SerializerException.CREATE_OBJECT_FAILED
                        .create(new String[]
                        { "Standard Rule", e.getMessage()}));
        }
       
        Iterator list = null;
        try
        {
            list = pm.getRules().iterator();
        } catch (Exception e)
        {
            throw new SerializerException(
                    SerializerException.GET_EXISTING_OBJECTS
                            .create(new String[]
                            { "ProfilingRules", e.getMessage()}));
        }
        while (list.hasNext())
        {
            try
            {
                ProfilingRule p = (ProfilingRule) list.next();
                if (!(this.rulesMap.containsKey(p.getId())))
                {
                    JSProfilingRule rule = createProfilingRule(p, (standardRuleClass == p.getClass()));
                    rulesMap.put(rule.getId(), rule);
                    ((JSSeedData)getSnapshot()).getRules().add(rule);

                }
            } catch (Exception e)
            {
                throw new SerializerException(
                        SerializerException.CREATE_SERIALIZED_OBJECT_FAILED
                                .create(new String[]
                                { "ProfilingRules", e.getMessage()}));
            }
        }

        // determine the defualt rule
        ProfilingRule defaultRule = pm.getDefaultRule();
        if (defaultRule != null)
          ((JSSeedData)getSnapshot()).setDefaultRule(defaultRule.getId());

        // get Rules for each user

        Iterator _itUsers = this.userMap.values().iterator();
        while (_itUsers.hasNext())
        {
            JSUser _user = (JSUser) _itUsers.next();
            Principal principal = _user.getPrincipal();
            if (principal != null)
            {
                Collection col = pm.getRulesForPrincipal(principal);
                Iterator _itCol = col.iterator();
                while (_itCol.hasNext())
                {
                    PrincipalRule p1 = (PrincipalRule) _itCol.next();
                    JSPrincipalRule pr = new JSPrincipalRule(p1
View Full Code Here


     
     
     private void recreateProfilingRules () throws SerializerException
      {
        logMe("recreateProfilingRules - processing");
          Profiler pm = (Profiler) getCM()
            .getComponent("org.apache.jetspeed.profiler.Profiler");
          if (pm == null)
            throw new SerializerException(
                SerializerException.COMPONENTMANAGER_DOES_NOT_EXIST
                          .create("org.apache.jetspeed.profiler.Profiler"));
        JSProfilingRules rules = ((JSSeedData)getSnapshot()).getRules();
        if ((rules != null) && (rules.size() > 0))
        {
          Iterator _it = rules.iterator();
          while (_it.hasNext())
          {
            JSProfilingRule _c = (JSProfilingRule)_it.next();

            try
            {
              ProfilingRule rule = null;
                
                 rule = pm.getRule(_c.getId());
                 if ((rule == null) || (this.getSetting(JetspeedSerializer.KEY_OVERWRITE_EXISTING)))
                 {
                   rule = recreateRule(pm,rule, _c);
                   pm.storeProfilingRule(rule);
                 }
            }
            catch (Exception e)
            {
              throw new SerializerException(
                        SerializerException.CREATE_OBJECT_FAILED
                          .create("org.apache.jetspeed.capabilities.Capabilities",e.getLocalizedMessage()));
         }
          }
          /** reset the default profiling rule */
          String defaultRuleID = ((JSSeedData)getSnapshot()).getDefaultRule();
          if (defaultRuleID != null)
          {
            ProfilingRule defaultRule = pm.getRule(defaultRuleID);
            if (defaultRule != null)
              pm.setDefaultRule(defaultRuleID);
          }
        }
        else
          logMe("NO PROFILING RULES?????");
        logMe("recreateProfilingRules - done");
View Full Code Here

     */
    private void recreateUserPrincipalRules() throws SerializerException
    {
      logMe("recreateUserPrincipalRules - started");
     
        Profiler pm = (Profiler) getCM()
        .getComponent("org.apache.jetspeed.profiler.Profiler");
        if (pm == null)

          throw new SerializerException(
            SerializerException.COMPONENTMANAGER_DOES_NOT_EXIST
                    .create("org.apache.jetspeed.profiler.Profiler"));
        UserManager userManager = (UserManager) getCM()
        .getComponent("org.apache.jetspeed.security.UserManager");
        if (userManager == null)
          throw new SerializerException(
            SerializerException.COMPONENTMANAGER_DOES_NOT_EXIST
                    .create("org.apache.jetspeed.security.UserManager"));

        // get Rules for each user

        Iterator _itUsers = ((JSSeedData)getSnapshot()).getUsers().iterator();
        while (_itUsers.hasNext())
        {
            JSUser _user = (JSUser) _itUsers.next();
            JSPrincipalRules jsRules = _user.getRules();
            try
            {
              User user = userManager.getUser(_user.getName());
              Principal principal = getUserPrincipal(user);
              if (jsRules != null)
              {
                Iterator _itRoles = jsRules.iterator();
                  while (_itRoles.hasNext())
                  {
                    JSPrincipalRule pr = (JSPrincipalRule) _itRoles.next();
                    ProfilingRule pRule = pm.getRule(pr.getRule());
                   
                    try
                    {
                      PrincipalRule p1 = pm.createPrincipalRule();
                      p1.setLocatorName(pr.getLocator());
                      p1.setProfilingRule(pRule);
                      p1.setPrincipalName(principal.getName());
                      pm.storePrincipalRule(p1);
                    }
                    catch (Exception eRole)
                    {
                      eRole.printStackTrace();
                    }
View Full Code Here

     */
    private void getProfilingRules() throws SerializerException
    {
        getPermissions();
        Object o = null;
        Profiler pm = (Profiler) getCM()
                .getComponent("org.apache.jetspeed.profiler.Profiler");
        if (pm == null)

            throw new SerializerException(
                    SerializerException.COMPONENTMANAGER_DOES_NOT_EXIST
                            .create("org.apache.jetspeed.profiler.Profiler"));
        Class standardRuleClass = null;
        try
        {
          ProfilingRule tempStandardRule = pm.createProfilingRule(true);
          standardRuleClass = tempStandardRule.getClass();
        }
        catch (Exception e)
        {
          throw new SerializerException(
                SerializerException.CREATE_OBJECT_FAILED
                        .create(new String[]
                        { "Standard Rule", e.getMessage()}));
        }
       
        Iterator list = null;
        try
        {
            list = pm.getRules().iterator();
        } catch (Exception e)
        {
            throw new SerializerException(
                    SerializerException.GET_EXISTING_OBJECTS
                            .create(new String[]
                            { "ProfilingRules", e.getMessage()}));
        }
        int count = 0;

        while (list.hasNext())
        {
            try
            {
                ProfilingRule p = (ProfilingRule) list.next();
                if (!(this.rulesMap.containsKey(p.getId())))
                {
                    JSProfilingRule rule = createProfilingRule(p, (standardRuleClass == p.getClass()));
                    rulesMap.put(rule.getId(), rule);
                    ((JSSeedData)getSnapshot()).getRules().add(rule);

                }
            } catch (Exception e)
            {
                throw new SerializerException(
                        SerializerException.CREATE_SERIALIZED_OBJECT_FAILED
                                .create(new String[]
                                { "ProfilingRules", e.getMessage()}));
            }
        }

        // determine the defualt rule
        ProfilingRule defaultRule = pm.getDefaultRule();
        if (defaultRule != null)
          ((JSSeedData)getSnapshot()).setDefaultRule(defaultRule.getId());

        // get Rules for each user

        Iterator _itUsers = this.userMap.values().iterator();
        while (_itUsers.hasNext())
        {
            JSUser _user = (JSUser) _itUsers.next();
            Principal principal = _user.getPrincipal();
            if (principal != null)
            {
                Collection col = pm.getRulesForPrincipal(principal);
                Iterator _itCol = col.iterator();
                while (_itCol.hasNext())
                {
                    PrincipalRule p1 = (PrincipalRule) _itCol.next();
                    JSPrincipalRule pr = new JSPrincipalRule(p1
View Full Code Here

     
     
     private void recreateProfilingRules () throws SerializerException
      {
        logMe("recreateProfilingRules - processing");
          Profiler pm = (Profiler) getCM()
            .getComponent("org.apache.jetspeed.profiler.Profiler");
          if (pm == null)
            throw new SerializerException(
                SerializerException.COMPONENTMANAGER_DOES_NOT_EXIST
                          .create("org.apache.jetspeed.profiler.Profiler"));
        JSProfilingRules rules = ((JSSeedData)getSnapshot()).getRules();
        if ((rules != null) && (rules.size() > 0))
        {
          Iterator _it = rules.iterator();
          while (_it.hasNext())
          {
            JSProfilingRule _c = (JSProfilingRule)_it.next();

            try
            {
              ProfilingRule rule = null;
                
                 rule = pm.getRule(_c.getId());
                 if ((rule == null) || (this.getSetting(JetspeedSerializer.KEY_OVERWRITE_EXISTING)))
                 {
                   rule = recreateRule(pm,rule, _c);
                   pm.storeProfilingRule(rule);
                 }
            }
            catch (Exception e)
            {
              throw new SerializerException(
                        SerializerException.CREATE_OBJECT_FAILED
                          .create("org.apache.jetspeed.capabilities.Capabilities",e.getLocalizedMessage()));
         }
          }
          /** reset the default profiling rule */
          String defaultRuleID = ((JSSeedData)getSnapshot()).getDefaultRule();
          if (defaultRuleID != null)
          {
            ProfilingRule defaultRule = pm.getRule(defaultRuleID);
            if (defaultRule != null)
              pm.setDefaultRule(defaultRuleID);
          }
        }
        else
          logMe("NO PROFILING RULES?????");
        logMe("recreateProfilingRules - done");
View Full Code Here

{
   
    public Collection getExtent()
    {
        Map appMap = (Map)FacesContext.getCurrentInstance().getExternalContext().getApplicationMap();
        Profiler profiler = (Profiler)appMap.get(CommonPortletServices.CPS_PROFILER_COMPONENT);
        return profiler.getRules(); // TODO: optimize with cache
    }
View Full Code Here

     */
    private void recreateUserPrincipalRules() throws SerializerException
    {
      logMe("recreateUserPrincipalRules - started");
     
        Profiler pm = (Profiler) getCM()
        .getComponent("org.apache.jetspeed.profiler.Profiler");
        if (pm == null)

          throw new SerializerException(
            SerializerException.COMPONENTMANAGER_DOES_NOT_EXIST
                    .create("org.apache.jetspeed.profiler.Profiler"));
        UserManager userManager = (UserManager) getCM()
        .getComponent("org.apache.jetspeed.security.UserManager");
        if (userManager == null)
          throw new SerializerException(
            SerializerException.COMPONENTMANAGER_DOES_NOT_EXIST
                    .create("org.apache.jetspeed.security.UserManager"));

        // get Rules for each user

        Iterator _itUsers = ((JSSeedData)getSnapshot()).getUsers().iterator();
        while (_itUsers.hasNext())
        {
            JSUser _user = (JSUser) _itUsers.next();
            JSPrincipalRules jsRules = _user.getRules();
            try
            {
              User user = userManager.getUser(_user.getName());
              Principal principal = getUserPrincipal(user);
              if (jsRules != null)
              {
                Iterator _itRoles = jsRules.iterator();
                  while (_itRoles.hasNext())
                  {
                    JSPrincipalRule pr = (JSPrincipalRule) _itRoles.next();
                    ProfilingRule pRule = pm.getRule(pr.getRule());
                   
                    try
                    {
                      PrincipalRule p1 = pm.createPrincipalRule();
                      p1.setLocatorName(pr.getLocator());
                      p1.setProfilingRule(pRule);
                      p1.setPrincipalName(principal.getName());
                      pm.storePrincipalRule(p1);
                    }
                    catch (Exception eRole)
                    {
                      eRole.printStackTrace();
                    }
View Full Code Here

     *
     * @throws SerializerException
     */
    private void getProfilingRules() throws SerializerException
    {
        Profiler pm = (Profiler) getCM()
                .getComponent("org.apache.jetspeed.profiler.Profiler");
        if (pm == null)

            throw new SerializerException(
                    SerializerException.COMPONENTMANAGER_DOES_NOT_EXIST
                            .create("org.apache.jetspeed.profiler.Profiler"));
        Class standardRuleClass = null;
        try
        {
          ProfilingRule tempStandardRule = pm.createProfilingRule(true);
          standardRuleClass = tempStandardRule.getClass();
        }
        catch (Exception e)
        {
          throw new SerializerException(
                SerializerException.CREATE_OBJECT_FAILED
                        .create(new String[]
                        { "Standard Rule", e.getMessage()}));
        }
       
        Iterator list = null;
        try
        {
            list = pm.getRules().iterator();
        } catch (Exception e)
        {
            throw new SerializerException(
                    SerializerException.GET_EXISTING_OBJECTS
                            .create(new String[]
                            { "ProfilingRules", e.getMessage()}));
        }
        while (list.hasNext())
        {
            try
            {
                ProfilingRule p = (ProfilingRule) list.next();
                if (!(this.rulesMap.containsKey(p.getId())))
                {
                    JSProfilingRule rule = createProfilingRule(p, (standardRuleClass == p.getClass()));
                    rulesMap.put(rule.getId(), rule);
                    ((JSSeedData)getSnapshot()).getRules().add(rule);

                }
            } catch (Exception e)
            {
                throw new SerializerException(
                        SerializerException.CREATE_SERIALIZED_OBJECT_FAILED
                                .create(new String[]
                                { "ProfilingRules", e.getMessage()}));
            }
        }

        // determine the defualt rule
        ProfilingRule defaultRule = pm.getDefaultRule();
        if (defaultRule != null)
          ((JSSeedData)getSnapshot()).setDefaultRule(defaultRule.getId());

        // get Rules for each user

        Iterator _itUsers = this.userMap.values().iterator();
        while (_itUsers.hasNext())
        {
            JSUser _user = (JSUser) _itUsers.next();
            Principal principal = _user.getPrincipal();
            if (principal != null)
            {
                Collection col = pm.getRulesForPrincipal(principal);
                Iterator _itCol = col.iterator();
                while (_itCol.hasNext())
                {
                    PrincipalRule p1 = (PrincipalRule) _itCol.next();
                    JSPrincipalRule pr = new JSPrincipalRule(p1
View Full Code Here

     
     
     private void recreateProfilingRules () throws SerializerException
      {
        logMe("recreateProfilingRules - processing");
          Profiler pm = (Profiler) getCM()
            .getComponent("org.apache.jetspeed.profiler.Profiler");
          if (pm == null)
            throw new SerializerException(
                SerializerException.COMPONENTMANAGER_DOES_NOT_EXIST
                          .create("org.apache.jetspeed.profiler.Profiler"));
        JSProfilingRules rules = ((JSSeedData)getSnapshot()).getRules();
        if ((rules != null) && (rules.size() > 0))
        {
          Iterator _it = rules.iterator();
          while (_it.hasNext())
          {
            JSProfilingRule _c = (JSProfilingRule)_it.next();

            try
            {
              ProfilingRule rule = null;
                
                 rule = pm.getRule(_c.getId());
                 if ((rule == null) || (this.getSetting(JetspeedSerializer.KEY_OVERWRITE_EXISTING)))
                 {
                   rule = recreateRule(pm,rule, _c);
                   pm.storeProfilingRule(rule);
                 }
            }
            catch (Exception e)
            {
              throw new SerializerException(
                        SerializerException.CREATE_OBJECT_FAILED
                          .create("org.apache.jetspeed.capabilities.Capabilities",e.getLocalizedMessage()));
         }
          }
          /** reset the default profiling rule */
          String defaultRuleID = ((JSSeedData)getSnapshot()).getDefaultRule();
          if (defaultRuleID != null)
          {
            ProfilingRule defaultRule = pm.getRule(defaultRuleID);
            if (defaultRule != null)
              pm.setDefaultRule(defaultRuleID);
          }
        }
        else
          logMe("NO PROFILING RULES?????");
        logMe("recreateProfilingRules - done");
View Full Code Here

                    if (locatorName != null && locatorName.trim().length() > 0)
                    {
                        try
                        {
                            String ruleName = getRuleName();
                            Profiler profiler = getServiceLocator().getProfiler();
                            ProfilingRule profilingRule = profiler.getRule(ruleName);
                            if (profilingRule != null)
                            {
                                profiler.setRuleForPrincipal(getPrincipal(), profilingRule, locatorName);
                            }
                            else
                            {
                                log.error("Failed to set profiling rule for the principal. Invalid profiling rule: " + ruleName);
                            }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.profiler.Profiler

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.