public void setEnforceRM(boolean enforceRM) throws AxisFault { this.axisDescription.addParameter(MercuryConstants.ENFORCE_RM, String.valueOf(enforceRM)); } }
private PolicyInclude getParent() { if (description != null && description.getParent() != null) { return description.getParent().getPolicyInclude(); } return null; }
public long getRMSSequenceTimeout() { long rmsSequeenceTimeout = 60000; if (axisDescription.getParameter(MercuryConstants.RMS_SEQUENCE_TIMEOUT) != null) { rmsSequeenceTimeout = Long.parseLong((String) axisDescription.getParameter( MercuryConstants.RMS_SEQUENCE_TIMEOUT).getValue()); } return rmsSequeenceTimeout; }
public boolean isParameterLocked(String parameterName) { if (this.parent != null && this.parent.isParameterLocked(parameterName)) { return true; } Parameter parameter = getParameter(parameterName); return parameter != null && parameter.isLocked(); }
/** * Applies the policies on the Description Hierarchy recursively. * * @throws AxisFault an error occurred applying the policy */ public void applyPolicy() throws AxisFault { AxisConfiguration configuration = getAxisConfiguration(); if (configuration == null) { return; } Policy applicablePolicy = getApplicablePolicy(this); if (applicablePolicy != null) { engageModulesForPolicy(applicablePolicy, configuration); } for (Iterator<? extends AxisDescription> children = getChildren(); children.hasNext();) { AxisDescription child = children.next(); child.applyPolicy(); } }
public void engageNotify(AxisDescription axisDescription) throws AxisFault { if(log.isDebugEnabled()) log.debug("Entry: SandeshaModule::engageNotify, " + axisDescription); AxisDescription parent = axisDescription.getParent(); SandeshaPolicyBean parentPropertyBean = null; if(parent != null) parentPropertyBean = SandeshaUtil.getPropertyBean(parent); parameter.setName(Sandesha2Constants.SANDESHA_PROPERTY_BEAN); parameter.setValue(axisDescPropertyBean); axisDescription.addParameter(parameter); op.getParent().addParameter(p);
axisDescription.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER); axisDescription.addParameter(param); } catch (AxisFault af) {
public boolean isEngaged(AxisModule axisModule) { boolean isEngaged = super.isEngaged(axisModule); if (!isEngaged) { isEngaged = engagedModules != null && engagedModules.values().contains(axisModule); } return isEngaged; }
public static String generateId(AxisDescription description) { PolicySubject policySubject = description.getPolicySubject(); String identifier = "-policy-1"; if (description instanceof AxisMessage) { identifier = "msg-" + ((AxisMessage) description).getName() + identifier; description = description.getParent(); } if (description instanceof AxisOperation) { identifier = "op-" + ((AxisOperation) description).getName() + identifier; description = description.getParent(); } if (description instanceof AxisService) { identifier = "service-" + ((AxisService) description).getName() + identifier; } /* * Int 49 is the value of the Character '1'. Here we want to change '1' * to '2' or '2' to '3' .. etc. to construct a unique identifier. */ for (int index = 49; policySubject.getAttachedPolicyComponent(identifier) != null; index++) { identifier = identifier.replace((char) index, (char) (index + 1)); } return identifier; }
/** * @deprecated As of 1.4 release. You can't override a policies that * applicable for the current policy scope via * {@link PolicyInclude #setEffectivePolicy(Policy)}. In case * you need to make a policy the only policy that is within the * policy cache of an {@link AxisDescription} please use * {@link PolicySubject #clear()} and * {@link PolicySubject #attachPolicy(Policy)} accordingly. * */ public void setEffectivePolicy(Policy effectivePolicy) { this.effectivePolicy = effectivePolicy; if (description != null && effectivePolicy != null) { description.getPolicySubject().clear(); description.getPolicySubject().attachPolicy(effectivePolicy); } }
private static AxisService getAxisService(AxisDescription description) { if (description == null || description instanceof AxisService) { return (AxisService) description; } else { return getAxisService(description.getParent()); } }
/** * Engages the list of Modules to the specified AxisDescription. */ private void engageModulesToAxisDescription(List modulesToEngage, AxisDescription axisDescription) throws AxisFault { AxisModule axisModule; String moduleName; for (Iterator iterator = modulesToEngage.iterator(); iterator.hasNext();) { axisModule = (AxisModule) iterator.next(); moduleName = axisModule.getName(); if (!axisDescription.isEngaged(moduleName)) { axisDescription.engageModule(axisModule); (axisModule.getModule()).engageNotify(axisDescription); } } } }
public void disengageModule(AxisModule module) throws AxisFault { if (module == null || engagedModules == null) return; // String id = Utils.getModuleName(module.getName(), // module.getVersion()); if (isEngaged(module)) { onDisengage(module); engagedModules.remove(module.getArchiveName()); /** * if a Disengaged module belogs to an AxisService or an Operation * notify with a serviceUpdate */ getAxisConfiguration().notifyObservers(new AxisEvent(AxisEvent.MODULE_DISENGAGED, this), module); } }
private Policy findPolicy(String id, AxisDescription des) { Collection<PolicyComponent> policyElements = des.getPolicySubject().getAttachedPolicyComponents(); PolicyRegistry registry = new PolicyRegistryImpl(); Object policyComponent; Policy policy = registry.lookup(id); if (policy != null) { return policy; } for (Iterator<PolicyComponent> iterator = policyElements.iterator(); iterator.hasNext();) { policyComponent = iterator.next(); if (policyComponent instanceof Policy) { // policy found for the id if (id.equals(((Policy) policyComponent).getId())) { return (Policy) policyComponent; } } } AxisDescription child; for (Iterator<? extends AxisDescription> iterator = des.getChildren(); iterator.hasNext();) { child = (AxisDescription) iterator.next(); policy = findPolicy(id, child); if (policy != null) { return policy; } } return null; }
/** * This method sets the policy as the default of this AxisDescription instance. Further more * this method does the followings. <p/> (1) Engage whatever modules necessary to execute new * the effective policy of this AxisDescription instance. (2) Disengage whatever modules that * are not necessary to execute the new effective policy of this AxisDescription instance. (3) * Check whether each module can execute the new effective policy of this AxisDescription * instance. (4) If not throw an AxisFault to notify the user. (5) Else notify each module about * the new effective policy. * * @param policy the new policy of this AxisDescription instance. The effective policy is the * merge of this argument with effective policy of parent of this * AxisDescription. * @throws AxisFault if any module is unable to execute the effective policy of this * AxisDescription instance successfully or no module to execute some portion * (one or more PrimtiveAssertions ) of that effective policy. */ public void applyPolicy(Policy policy) throws AxisFault { // sets AxisDescription policy getPolicySubject().clear(); getPolicySubject().attachPolicy(policy); /* * now we try to engage appropriate modules based on the merged policy * of axis description object and the corresponding axis binding * description object. */ applyPolicy(); }
public static void addPoliciesAsExtensibleElement( AxisDescription description, OMElement descriptionElement) { PolicySubject policySubject = description.getPolicySubject(); Collection attachPolicyComponents = policySubject .getAttachedPolicyComponents(); filter = new ExternalPolicySerializer(); AxisConfiguration axisConfiguration = description .getAxisConfiguration(); if (axisConfiguration != null) { filter.setAssertionsToFilter(axisConfiguration
public Iterator<AxisBindingOperation> getChildren(){ return (Iterator<AxisBindingOperation>) super.getChildren(); }
public void applyPolicy(AxisDescription axisDescription, Element policy) { try { OMElement policyElement = (OMElement) new OMDOMFactory().getDocument().importNode(policy, true); axisDescription.applyPolicy(PolicyEngine.getPolicy(policyElement)); } catch (Exception e) { // TODO Handle exception properly throw new AssertionError(e); } }
public static SandeshaPolicyBean loadPropertiesFromAxisDescription(AxisDescription desc, SandeshaPolicyBean parentPropertyBean) throws SandeshaException { Policy policy = desc.getPolicyInclude().getEffectivePolicy();