Package org.ow2.easybeans.api

Examples of org.ow2.easybeans.api.PermissionManagerException


            } catch (Exception e) {
                this.logger.error("Cannot configure Carol to use CMI", e);
                throw new EZBComponentException("Cannot configure Carol to use CMI", e);
            }

            ClusterViewManagerFactory clusterViewManagerFactory = ClusterViewManagerFactory.getFactory();

            // Start the manager
            try {
                this.clusterViewManager = (ServerClusterViewManager) clusterViewManagerFactory.create();
            } catch (Exception e) {
                this.logger.error("Cannot retrieve the CMI Server", e);
                throw new EZBComponentException("Cannot retrieve the CMI Server", e);
            }
            if (this.clusterViewManager != null
                    && this.clusterViewManager.getState().equals(ClusterViewManager.State.STOPPED)) {
                if (this.eventComponent != null) {
                    List<Component> components =
                        clusterViewManagerFactory.getConfig().getComponents().getComponents();
                    if (components != null) {
                        for (Component cmiEventComponent : components) {
                            if (org.ow2.cmi.component.event.EventComponent.class.isAssignableFrom(cmiEventComponent.getClass())) {
                                ((org.ow2.cmi.component.event.EventComponent) cmiEventComponent).setEventService(
                                        this.eventComponent.getEventService());
View Full Code Here


            return EASYBEANS_ROOT;
        } else if (EZBContainer.class.isAssignableFrom(clazz)) {
            // The object is an EJB container.

            EZBContainer container = (EZBContainer) instance;

            // Get the archive name (remove all character before the last slash/antislash).
            String archiveName = container.getName().replaceAll("(.*[/\\\\])", "");

            // Compute the application id.
            return EASYBEANS_ROOT + "/" + container.getApplicationName() + "/" + archiveName;
        } else if (Factory.class.isAssignableFrom(clazz)) {
            // The object is a bean factory.

            Factory<?, ?> factory = (Factory<?, ?>) instance;
            EZBContainer container = factory.getContainer();

            // Get the archive name (remove all character before the last slash/antislash).
            String archiveName = container.getName().replaceAll("(.*[/\\\\])", "");

            // Get the bean class name (remove all character before the last point).
            String factoryName = factory.getClassName().replaceAll("(.*\\.)", "");

            // Compute the bean id.
            return EASYBEANS_ROOT + "/" + container.getApplicationName() + "/" + archiveName + "/" + factoryName;
        } else {
            throw new java.lang.IllegalArgumentException("Name is not define for argument of type " + instance.getClass());
        }
    }
View Full Code Here

        PolicyConfigurationFactory policyConfigurationFactory = null;
        // Init JACC
        try {
            policyConfigurationFactory = PolicyConfigurationFactory.getPolicyConfigurationFactory();
        } catch (ClassNotFoundException e) {
            throw new PermissionManagerException("Error when trying to get the PolicyConfigurationFactory object", e);
        } catch (PolicyContextException e) {
            throw new PermissionManagerException("Error when trying to get the PolicyConfigurationFactory object", e);
        }
        try {
            this.policyConfiguration = policyConfigurationFactory.getPolicyConfiguration(this.contextId, remove);
        } catch (PolicyContextException pce) {
            throw new PermissionManagerException("Error when trying to get the PolicyConfiguration object with contextId '"
                    + this.contextId + "'.'", pce);
        }

        // Policy to use
        setPolicy(Policy.getPolicy());
View Full Code Here

    public void delete() throws PermissionManagerException {

        try {
            this.policyConfiguration.delete();
        } catch (PolicyContextException pce) {
            throw new PermissionManagerException("Cannot delete policyConfiguration object", pce);
        }
        this.policyConfiguration = null;

        // Policy need to be refresh
        policy.refresh();
View Full Code Here

    public void commit() throws PermissionManagerException {
        try {
            this.policyConfiguration.commit();
            policy.refresh();
        } catch (PolicyContextException pce) {
            throw new PermissionManagerException("Cannot commit configuration", pce);
        }
    }
View Full Code Here

                if (methodSecurityInfo.isUnchecked()) {
                    try {
                        this.logger.debug("Adding unchecked permission {0}", methodSecurityInfo.getPermission());
                        getPolicyConfiguration().addToUncheckedPolicy(methodSecurityInfo.getPermission());
                    } catch (PolicyContextException e) {
                        throw new PermissionManagerException("Cannot add unchecked policy for method '" + methodSecurityInfo
                                + "'.", e);
                    }
                } else {
                    for (String roleName : methodSecurityInfo.getRoles()) {
                        try {
                            this.logger.debug("Adding permission {0} to role {1}", methodSecurityInfo.getPermission(), roleName);
                            getPolicyConfiguration().addToRole(roleName, methodSecurityInfo.getPermission());
                        } catch (PolicyContextException e) {
                            throw new PermissionManagerException("Cannot add rolebase policy for method '" + methodSecurityInfo
                                    + "' and for role '" + roleName + "'.", e);
                        }
                    }
                }
            }
View Full Code Here

                if (methodSecurityInfo.isExcluded()) {
                    try {
                        this.logger.debug("Adding excluded permission {0}", methodSecurityInfo.getPermission());
                        getPolicyConfiguration().addToExcludedPolicy(methodSecurityInfo.getPermission());
                    } catch (PolicyContextException e) {
                        throw new PermissionManagerException("Cannot add excluded policy for method '" + methodSecurityInfo
                                + "'.", e);
                    }
                }
            }
        }
View Full Code Here

        if (declaredRoles != null) {
            for (String role : declaredRoles) {
                try {
                    getPolicyConfiguration().addToRole(role, new EJBRoleRefPermission(beanInfo.getName(), role));
                } catch (PolicyContextException e) {
                    throw new PermissionManagerException("Cannot add to role '" + role + "' an  EJBRoleRefPermission.", e);
                }
            }
        }

        // For each security-role-ref, add an entry
        List<ISecurityRoleRef> securityRoleRefs = securityInfo.getSecurityRoleRefList();
        if (securityRoleRefs != null) {
            for (ISecurityRoleRef securityRoleRef : securityRoleRefs) {
                try {
                    getPolicyConfiguration().addToRole(securityRoleRef.getRoleLink(), new EJBRoleRefPermission(beanInfo.getName(), securityRoleRef.getRoleName()));
                } catch (PolicyContextException e) {
                    throw new PermissionManagerException("Cannot add to role-link'" + securityRoleRef.getRoleLink() + "' the EJBRoleRefPermission build with role-name '" + securityRoleRef.getRoleName() + "'.", e);
                }
            }
        }

View Full Code Here

                    throw new EZBComponentException("Cannot start the CMI Server", e);
                }
            }
        }
        // register the listener.
        EZBEventListener eventListener = new CmiEventListener();
        this.eventComponent.registerEventListener(eventListener);

        this.logger.debug("The CMI configuration extension has been added.");
    }
View Full Code Here

            public synchronized void handle(final IEvent event) {
                if (EZBEventBeanInvocationBegin.class.isAssignableFrom(event.getClass())) {
                    EZBEventBeanInvocationBegin e = (EZBEventBeanInvocationBegin) event;
                    MeanCallTimeStatistic.this.pendingCall.put(Long.valueOf(e.getInvocationNumber()), e);
                } else {
                    EZBEventBeanInvocation eventEnd = (EZBEventBeanInvocation) event;
                    EZBEventBeanInvocation eventBegin =
                        MeanCallTimeStatistic.this.pendingCall.remove(Long.valueOf(eventEnd.getInvocationNumber()));

                    MeanCallTimeStatistic.this.count++;
                    MeanCallTimeStatistic.this.total += eventEnd.getTime() - eventBegin.getTime();
                    setLastSampleTime(System.currentTimeMillis());
                }
            }
View Full Code Here

TOP

Related Classes of org.ow2.easybeans.api.PermissionManagerException

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.