AutoRefactor: collapse if statements
| | |
| | | } else { |
| | | throw new ServletException("Content-Type does not match SOAP 1.1 or SOAP 1.2"); |
| | | } |
| | | } else if (headerName.equalsIgnoreCase("authorization")) { |
| | | if (headerVal.startsWith("Basic ")) { |
| | | authenticationInHeader = true; |
| | | String authorization = headerVal.substring(6).trim(); |
| | | try { |
| | | String unencoded = new String(Base64.decode(authorization)); |
| | | int colon = unencoded.indexOf(':'); |
| | | if (colon > 0) { |
| | | if (useHTTPAuthzID) |
| | | { |
| | | connOptions.setSASLMechanism("mech=" + SASL_MECHANISM_PLAIN); |
| | | connOptions.addSASLProperty( |
| | | "authid=u:" + unencoded.substring(0, colon).trim()); |
| | | authenticationIsID = true; |
| | | } |
| | | else |
| | | { |
| | | bindDN = unencoded.substring(0, colon).trim(); |
| | | } |
| | | bindPassword = unencoded.substring(colon + 1); |
| | | } else if (headerName.equalsIgnoreCase("authorization") && headerVal.startsWith("Basic ")) |
| | | { |
| | | authenticationInHeader = true; |
| | | String authorization = headerVal.substring(6).trim(); |
| | | try { |
| | | String unencoded = new String(Base64.decode(authorization)); |
| | | int colon = unencoded.indexOf(':'); |
| | | if (colon > 0) { |
| | | if (useHTTPAuthzID) |
| | | { |
| | | connOptions.setSASLMechanism("mech=" + SASL_MECHANISM_PLAIN); |
| | | connOptions.addSASLProperty( |
| | | "authid=u:" + unencoded.substring(0, colon).trim()); |
| | | authenticationIsID = true; |
| | | } |
| | | } catch (ParseException ex) { |
| | | // user/DN:password parsing error |
| | | batchResponses.add( |
| | | createErrorResponse( |
| | | new LDAPException(LDAPResultCode.INVALID_CREDENTIALS, |
| | | LocalizableMessage.raw(ex.getMessage())))); |
| | | break; |
| | | else |
| | | { |
| | | bindDN = unencoded.substring(0, colon).trim(); |
| | | } |
| | | bindPassword = unencoded.substring(colon + 1); |
| | | } |
| | | } catch (ParseException ex) { |
| | | // user/DN:password parsing error |
| | | batchResponses.add( |
| | | createErrorResponse( |
| | | new LDAPException(LDAPResultCode.INVALID_CREDENTIALS, |
| | | LocalizableMessage.raw(ex.getMessage())))); |
| | | break; |
| | | } |
| | | } |
| | | StringTokenizer tk = new StringTokenizer(headerVal, ","); |
| | |
| | | if ( code != LDAPResultCode.SUCCESS |
| | | && code != LDAPResultCode.REFERRAL |
| | | && code != LDAPResultCode.COMPARE_TRUE |
| | | && code != LDAPResultCode.COMPARE_FALSE ) { |
| | | if ( ON_ERROR_EXIT.equals(batchRequest.getOnError()) ) { |
| | | break; |
| | | } |
| | | && code != LDAPResultCode.COMPARE_FALSE && ON_ERROR_EXIT.equals(batchRequest.getOnError()) ) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | Set<?> memberList = |
| | | (Set<?>)serverGroup.get(ServerGroupProperty.MEMBERS); |
| | | if (memberList != null) |
| | | if (memberList != null && memberList.remove(member)) |
| | | { |
| | | if (memberList.remove(member)) |
| | | { |
| | | HashMap<ServerGroupProperty, Object> serverGroupProperties = |
| | | new HashMap<ServerGroupProperty, Object>(); |
| | | serverGroupProperties.put(ServerGroupProperty.MEMBERS, memberList); |
| | | String groupName = (String)serverGroup.get(ServerGroupProperty.UID); |
| | | updateServerGroup(groupName, serverGroupProperties); |
| | | } |
| | | HashMap<ServerGroupProperty, Object> serverGroupProperties = |
| | | new HashMap<ServerGroupProperty, Object>(); |
| | | serverGroupProperties.put(ServerGroupProperty.MEMBERS, memberList); |
| | | String groupName = (String)serverGroup.get(ServerGroupProperty.UID); |
| | | updateServerGroup(groupName, serverGroupProperties); |
| | | } |
| | | } |
| | | |
| | |
| | | * @param serverProperties the server properties. |
| | | * @return the server ID for the given properties or null. |
| | | */ |
| | | private static String getServerID( |
| | | Map<ServerProperty, Object> serverProperties) |
| | | private static String getServerID(Map<ServerProperty, Object> serverProperties) |
| | | { |
| | | String result = (String) serverProperties.get(ServerProperty.ID); |
| | | if (result != null) |
| | | if (result != null && result.length() == 0) |
| | | { |
| | | if (result.length() == 0) |
| | | { |
| | | result = null; |
| | | } |
| | | result = null; |
| | | } |
| | | return result; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2007-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.admin.ads; |
| | |
| | | if (backend != null) |
| | | { |
| | | SortedSet<DN> suffixes = backend.getBaseDN(); |
| | | if (suffixes != null) |
| | | if (suffixes != null |
| | | && suffixes.remove(DN.valueOf(ADSContext.getAdministrationSuffixDN()))) |
| | | { |
| | | if (suffixes.remove( |
| | | DN.valueOf(ADSContext.getAdministrationSuffixDN()))) |
| | | if (suffixes.size() > 0) |
| | | { |
| | | if (suffixes.size() > 0) |
| | | { |
| | | backend.setBaseDN(suffixes); |
| | | backend.commit(); |
| | | } |
| | | else |
| | | { |
| | | root.removeBackend(backendName); |
| | | } |
| | | backend.setBaseDN(suffixes); |
| | | backend.commit(); |
| | | } |
| | | else |
| | | { |
| | | root.removeBackend(backendName); |
| | | } |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2011 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | @Override |
| | | public boolean equals(Object v) |
| | | { |
| | | boolean equals = false; |
| | | if (this != v) |
| | | if (this == v) |
| | | { |
| | | if (v instanceof BaseDNDescriptor) |
| | | { |
| | | BaseDNDescriptor desc = (BaseDNDescriptor)v; |
| | | equals = (getType() == desc.getType()) && |
| | | getDn().equals(desc.getDn()) && |
| | | (getAgeOfOldestMissingChange() == desc.getAgeOfOldestMissingChange()) && |
| | | (getMissingChanges() == desc.getMissingChanges()) && |
| | | (getEntries() == desc.getEntries()); |
| | | if (equals) |
| | | { |
| | | if ((getBackend() != null) && (desc.getBackend() != null)) |
| | | { |
| | | // Only compare the backend IDs. In this context is enough |
| | | equals = getBackend().getBackendID().equals( |
| | | desc.getBackend().getBackendID()); |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | else |
| | | if (!(v instanceof BaseDNDescriptor)) |
| | | { |
| | | equals = true; |
| | | return false; |
| | | } |
| | | return equals; |
| | | |
| | | BaseDNDescriptor desc = (BaseDNDescriptor)v; |
| | | return getType() == desc.getType() |
| | | && getDn().equals(desc.getDn()) |
| | | && getAgeOfOldestMissingChange() == desc.getAgeOfOldestMissingChange() |
| | | && getMissingChanges() == desc.getMissingChanges() |
| | | && getEntries() == desc.getEntries() |
| | | && backendIdEqual(desc); |
| | | } |
| | | |
| | | private boolean backendIdEqual(BaseDNDescriptor desc) |
| | | { |
| | | // Only compare the backend IDs. In this context is enough |
| | | return getBackend() != null |
| | | && desc.getBackend() != null |
| | | && getBackend().getBackendID().equals(desc.getBackend().getBackendID()); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | returnValue = getType().compareTo(desc.getType()); |
| | | } |
| | | if (returnValue == 0) |
| | | if (returnValue == 0 && getBackend() != null && desc.getBackend() != null) |
| | | { |
| | | if ((getBackend() != null) && (desc.getBackend() != null)) |
| | | { |
| | | // Only compare the backend IDs. In this context is enough |
| | | returnValue = getBackend().getBackendID().compareTo( |
| | | desc.getBackend().getBackendID()); |
| | | } |
| | | // Only compare the backend IDs. In this context is enough |
| | | returnValue = getBackend().getBackendID().compareTo( |
| | | desc.getBackend().getBackendID()); |
| | | } |
| | | if (returnValue == 0) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | */ |
| | | public String getBase64() |
| | | { |
| | | if (base64 == null) |
| | | if (base64 == null && bytes != null) |
| | | { |
| | | if (bytes != null) |
| | | { |
| | | base64 = Base64.encode(bytes); |
| | | } |
| | | base64 = Base64.encode(bytes); |
| | | } |
| | | return base64; |
| | | } |
| | |
| | | */ |
| | | public byte[] getBytes() throws ParseException |
| | | { |
| | | if (bytes == null) |
| | | if (bytes == null && base64 != null) |
| | | { |
| | | if (base64 != null) |
| | | { |
| | | bytes = Base64.decode(base64); |
| | | } |
| | | bytes = Base64.decode(base64); |
| | | } |
| | | return bytes; |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.datamodel; |
| | |
| | | */ |
| | | public boolean equals(Object o) |
| | | { |
| | | boolean equals = false; |
| | | if (o != null) |
| | | if (o instanceof CategorizedComboBoxElement) |
| | | { |
| | | if (o instanceof CategorizedComboBoxElement) |
| | | { |
| | | CategorizedComboBoxElement desc = (CategorizedComboBoxElement)o; |
| | | equals = (desc.getType() == getType()) && |
| | | (getValue().equals(desc.getValue())); |
| | | } |
| | | CategorizedComboBoxElement desc = (CategorizedComboBoxElement)o; |
| | | return desc.getType() == getType() |
| | | && getValue().equals(desc.getValue()); |
| | | } |
| | | return equals; |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public boolean equals(Object o) |
| | | { |
| | | boolean equals = o == this; |
| | | if (!equals) |
| | | if (o == this) |
| | | { |
| | | equals = o instanceof IndexDescriptor; |
| | | if (equals) |
| | | { |
| | | IndexDescriptor index = (IndexDescriptor)o; |
| | | equals = index.getName().equalsIgnoreCase(getName()) && |
| | | index.isDatabaseIndex() == isDatabaseIndex() && |
| | | index.getTypes().equals(getTypes()) && |
| | | index.getEntryLimit() == getEntryLimit(); |
| | | |
| | | if (equals) |
| | | { |
| | | if ((getBackend() != null) && (index.getBackend() != null)) |
| | | { |
| | | // Only compare the backend IDs. In this context is enough |
| | | equals = getBackend().getBackendID().equals( |
| | | index.getBackend().getBackendID()); |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | return equals; |
| | | if (!(o instanceof IndexDescriptor)) |
| | | { |
| | | return false; |
| | | } |
| | | IndexDescriptor index = (IndexDescriptor)o; |
| | | return index.getName().equalsIgnoreCase(getName()) |
| | | && index.isDatabaseIndex() == isDatabaseIndex() |
| | | && index.getTypes().equals(getTypes()) |
| | | && index.getEntryLimit() == getEntryLimit() |
| | | && backendIdEqual(index); |
| | | } |
| | | |
| | | private boolean backendIdEqual(IndexDescriptor index) |
| | | { |
| | | return getBackend() != null |
| | | && index.getBackend() != null |
| | | && getBackend().getBackendID().equals(index.getBackend().getBackendID()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public boolean equals(Object o) |
| | | { |
| | | boolean equals = o == this; |
| | | if (!equals) |
| | | if (o == this) |
| | | { |
| | | equals = o instanceof VLVIndexDescriptor; |
| | | if (equals) |
| | | { |
| | | VLVIndexDescriptor index = (VLVIndexDescriptor)o; |
| | | equals = index.getName().equalsIgnoreCase(getName()) && |
| | | index.getBaseDN().equals(getBaseDN()) && |
| | | index.getFilter().equals(getFilter()) && |
| | | index.getScope() == getScope() && |
| | | index.getSortOrder().equals(getSortOrder()); |
| | | if (equals) |
| | | { |
| | | if ((getBackend() != null) && (index.getBackend() != null)) |
| | | { |
| | | // Only compare the backend IDs. In this context is better to |
| | | // do this since the backend object contains some state (like |
| | | // number entries) that can change. |
| | | equals = getBackend().getBackendID().equals( |
| | | index.getBackend().getBackendID()); |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | return equals; |
| | | if (!(o instanceof VLVIndexDescriptor)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | VLVIndexDescriptor index = (VLVIndexDescriptor)o; |
| | | return index.getName().equalsIgnoreCase(getName()) |
| | | && index.getBaseDN().equals(getBaseDN()) |
| | | && index.getFilter().equals(getFilter()) |
| | | && index.getScope() == getScope() |
| | | && index.getSortOrder().equals(getSortOrder()) |
| | | && backendIdEqual(index); |
| | | } |
| | | |
| | | private boolean backendIdEqual(VLVIndexDescriptor index) |
| | | { |
| | | return getBackend() != null |
| | | && index.getBackend() != null |
| | | // Only compare the backend IDs. In this context is better to |
| | | // do this since the backend object contains some state (like |
| | | // number entries) that can change. |
| | | && getBackend().getBackendID().equals(index.getBackend().getBackendID()); |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.event; |
| | |
| | | |
| | | /* If we can get the current field parent directory set to it */ |
| | | String path = field.getText(); |
| | | if (path != null) |
| | | if (path != null && path.trim().length() > 0) |
| | | { |
| | | if (path.trim().length() > 0) |
| | | File f = new File(path); |
| | | while ((f != null) && !f.isDirectory()) |
| | | { |
| | | File f = new File(path); |
| | | while ((f != null) && !f.isDirectory()) |
| | | { |
| | | f = f.getParentFile(); |
| | | } |
| | | if (f != null) |
| | | { |
| | | fc.setCurrentDirectory(f); |
| | | } |
| | | f = f.getParentFile(); |
| | | } |
| | | if (f != null) |
| | | { |
| | | fc.setCurrentDirectory(f); |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | | boolean canLaunch = true; |
| | | if (!isServerRunning()) |
| | | if (!isServerRunning() |
| | | && state == State.RUNNING |
| | | && runningOnSameServer(taskToBeLaunched)) |
| | | { |
| | | if (state == State.RUNNING && runningOnSameServer(taskToBeLaunched)) |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | canLaunch = false; |
| | | } |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, taskToBeLaunched)); |
| | | return false; |
| | | } |
| | | } |
| | | return canLaunch; |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | | boolean canLaunch = true; |
| | | if (!isServerRunning()) |
| | | if (!isServerRunning() && state == State.RUNNING) |
| | | { |
| | | if (state == State.RUNNING) |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | canLaunch = false; |
| | | } |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, taskToBeLaunched)); |
| | | return false; |
| | | } |
| | | } |
| | | return canLaunch; |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | | boolean canLaunch = true; |
| | | if (!isServerRunning()) |
| | | if (!isServerRunning() |
| | | && state == State.RUNNING |
| | | && runningOnSameServer(taskToBeLaunched)) |
| | | { |
| | | if (state == State.RUNNING && runningOnSameServer(taskToBeLaunched)) |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | canLaunch = false; |
| | | } |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | return false; |
| | | } |
| | | } |
| | | return canLaunch; |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | | boolean canLaunch = true; |
| | | if (!isServerRunning()) |
| | | if (!isServerRunning() |
| | | && state == State.RUNNING |
| | | && runningOnSameServer(taskToBeLaunched)) |
| | | { |
| | | if (state == State.RUNNING && runningOnSameServer(taskToBeLaunched)) |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | canLaunch = false; |
| | | } |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | return false; |
| | | } |
| | | } |
| | | return canLaunch; |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | | boolean canLaunch = true; |
| | | if (!isServerRunning()) |
| | | if (!isServerRunning() |
| | | && state == State.RUNNING |
| | | && runningOnSameServer(taskToBeLaunched)) |
| | | { |
| | | if (state == State.RUNNING && runningOnSameServer(taskToBeLaunched)) |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | canLaunch = false; |
| | | } |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | return false; |
| | | } |
| | | } |
| | | return canLaunch; |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.task; |
| | |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | | boolean canLaunch = true; |
| | | if (!isServerRunning()) |
| | | if (!isServerRunning() |
| | | && state == State.RUNNING |
| | | && runningOnSameServer(taskToBeLaunched)) |
| | | { |
| | | if (state == State.RUNNING && runningOnSameServer(taskToBeLaunched)) |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | canLaunch = false; |
| | | } |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | return false; |
| | | } |
| | | } |
| | | return canLaunch; |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | for (int i=0; i<baseDNs.getModel().getSize(); i++) |
| | | { |
| | | Object item = baseDNs.getModel().getElementAt(i); |
| | | if (item instanceof CategorizedComboBoxElement) |
| | | if (item instanceof CategorizedComboBoxElement |
| | | && !isCategory(item)) |
| | | { |
| | | if (!isCategory(item)) |
| | | { |
| | | lastSelectedBaseDN = item; |
| | | break; |
| | | } |
| | | lastSelectedBaseDN = item; |
| | | break; |
| | | } |
| | | } |
| | | if (lastSelectedBaseDN != null) |
| | |
| | | { |
| | | try |
| | | { |
| | | if (displayAll || isBaseDN) |
| | | if ((displayAll || isBaseDN) |
| | | && !controller.hasSuffix(dn)) |
| | | { |
| | | if (!controller.hasSuffix(dn)) |
| | | { |
| | | controller.addSuffix(dn, null); |
| | | added = true; |
| | | } |
| | | controller.addSuffix(dn, null); |
| | | added = true; |
| | | } |
| | | } |
| | | catch (IllegalArgumentException iae) |
| | |
| | | if (index != null) |
| | | { |
| | | IndexType type = indexTypes[i]; |
| | | if (type != null) |
| | | if (type != null && !index.getTypes().contains(type)) |
| | | { |
| | | if (!index.getTypes().contains(type)) |
| | | { |
| | | msgs.add(INFO_CTRL_PANEL_MUST_UPDATE_INDEX_DEFINITION_TYPE.get( |
| | | filter.getAttributeType(), indexTypeNames[i])); |
| | | } |
| | | msgs.add(INFO_CTRL_PANEL_MUST_UPDATE_INDEX_DEFINITION_TYPE.get( |
| | | filter.getAttributeType(), indexTypeNames[i])); |
| | | } |
| | | } |
| | | else |
| | |
| | | model.getElementAt(j); |
| | | if (o.getType() == CategorizedComboBoxElement.Type.REGULAR) |
| | | { |
| | | if (dealingWithCustom == isCustom) |
| | | if (dealingWithCustom == isCustom |
| | | && attrName.compareTo(o.getValue().toString()) < 0) |
| | | { |
| | | if (attrName.compareTo(o.getValue().toString()) < 0) |
| | | { |
| | | model.insertElementAt(new CategorizedComboBoxElement( |
| | | attrName, |
| | | CategorizedComboBoxElement.Type.REGULAR), j); |
| | | break; |
| | | } |
| | | model.insertElementAt(new CategorizedComboBoxElement( |
| | | attrName, |
| | | CategorizedComboBoxElement.Type.REGULAR), j); |
| | | break; |
| | | } |
| | | } |
| | | else if (!o.getValue().equals(CUSTOM_ATTRIBUTES)) |
| | |
| | | */ |
| | | private boolean hasUserPassword(String[] ocs) |
| | | { |
| | | boolean hasUserPassword = false; |
| | | Schema schema = getInfo().getServerDescriptor().getSchema(); |
| | | if ((ocs != null) && (schema != null)) |
| | | if (ocs != null && schema != null) |
| | | { |
| | | AttributeType attr = schema.getAttributeType( |
| | | ServerConstants.ATTR_USER_PASSWORD); |
| | | for (String oc : ocs) |
| | | { |
| | | ObjectClass objectClass = schema.getObjectClass(oc); |
| | | if ((objectClass != null) && (attr != null)) |
| | | if (objectClass != null |
| | | && attr != null |
| | | && objectClass.isRequiredOrOptional(attr)) |
| | | { |
| | | if (objectClass.isRequiredOrOptional(attr)) |
| | | { |
| | | hasUserPassword = true; |
| | | break; |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return hasUserPassword; |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | lastCreatedIndex = null; |
| | | } |
| | | } |
| | | else if ((node instanceof VLVIndexTreeNode) && |
| | | (lastCreatedIndex instanceof VLVIndexDescriptor)) |
| | | else if (node instanceof VLVIndexTreeNode |
| | | && lastCreatedIndex instanceof VLVIndexDescriptor |
| | | && node.getName().equals(lastCreatedIndex.getName())) |
| | | { |
| | | if (node.getName().equals(lastCreatedIndex.getName())) |
| | | { |
| | | newSelectionPath = new TreePath(node.getPath()); |
| | | lastCreatedIndex = null; |
| | | } |
| | | newSelectionPath = new TreePath(node.getPath()); |
| | | lastCreatedIndex = null; |
| | | } |
| | | } |
| | | else if (node.getName().equals(lastSelectedNode.getUserObject())) |
| | |
| | | i++; |
| | | } |
| | | |
| | | if (newSelectionPath == null) |
| | | if (newSelectionPath == null && firstTreeRepopulate) |
| | | { |
| | | if (firstTreeRepopulate) |
| | | { |
| | | newSelectionPath = new TreePath(standardIndexes.getPath()); |
| | | } |
| | | newSelectionPath = new TreePath(standardIndexes.getPath()); |
| | | } |
| | | if (newSelectionPath != null) |
| | | { |
| | |
| | | launchOperation(newTask, |
| | | INFO_CTRL_PANEL_DELETING_INDEXES_SUMMARY.get(), |
| | | INFO_CTRL_PANEL_DELETING_INDEXES_COMPLETE.get(), |
| | | INFO_CTRL_PANEL_DELETING_INDEXES_SUCCESSFUL.get(nameLabel, |
| | | backendName), |
| | | INFO_CTRL_PANEL_DELETING_INDEXES_SUCCESSFUL.get(nameLabel, backendName), |
| | | ERR_CTRL_PANEL_DELETING_INDEXES_ERROR_SUMMARY.get(), |
| | | ERR_CTRL_PANEL_DELETING_INDEXES_ERROR_DETAILS.get(nameLabel), |
| | | null, |
| | |
| | | private ImageIcon getIcon(Object value) |
| | | { |
| | | ImageIcon icon = null; |
| | | if (value instanceof IndexTreeNode) |
| | | if (value instanceof IndexTreeNode |
| | | && ((IndexTreeNode)value).getIndex().isDatabaseIndex()) |
| | | { |
| | | if (((IndexTreeNode)value).getIndex().isDatabaseIndex()) |
| | | { |
| | | icon = readOnlyIndexIcon; |
| | | } |
| | | icon = readOnlyIndexIcon; |
| | | } |
| | | if (icon == null) |
| | | { |
| | |
| | | lastCreatedElement = null; |
| | | } |
| | | } |
| | | else if ((node instanceof CustomAttributeTreeNode) && |
| | | (lastCreatedElement instanceof AttributeType)) |
| | | else if (node instanceof CustomAttributeTreeNode |
| | | && lastCreatedElement instanceof AttributeType |
| | | && name.equals(lastCreatedElement.getNameOrOID())) |
| | | { |
| | | if (name.equals(lastCreatedElement.getNameOrOID())) |
| | | { |
| | | newSelectionPath = new TreePath(node.getPath()); |
| | | lastCreatedElement = null; |
| | | } |
| | | newSelectionPath = new TreePath(node.getPath()); |
| | | lastCreatedElement = null; |
| | | } |
| | | } |
| | | else if (name.equals(lastSelectedNode.getUserObject())) |
| | |
| | | DefaultMutableTreeNode[] ocAndAttrs = {objectClasses, attributes}; |
| | | for (DefaultMutableTreeNode node : ocAndAttrs) |
| | | { |
| | | if (node.getParent() != null) |
| | | if (node.getParent() != null && node.getChildCount() == 0) |
| | | { |
| | | if (node.getChildCount() == 0) |
| | | { |
| | | model.removeNodeFromParent(node); |
| | | model.nodeStructureChanged(node); |
| | | } |
| | | model.removeNodeFromParent(node); |
| | | model.nodeStructureChanged(node); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | setPrimaryValid(lUsage); |
| | | if (nonModifiable.isSelected()) |
| | | if (nonModifiable.isSelected() |
| | | && AttributeUsage.USER_APPLICATIONS.equals(usage.getSelectedItem())) |
| | | { |
| | | if (AttributeUsage.USER_APPLICATIONS.equals(usage.getSelectedItem())) |
| | | { |
| | | errors.add(ERR_NON_MODIFIABLE_CANNOT_BE_USER_APPLICATIONS.get()); |
| | | setPrimaryInvalid(lUsage); |
| | | } |
| | | errors.add(ERR_NON_MODIFIABLE_CANNOT_BE_USER_APPLICATIONS.get()); |
| | | setPrimaryInvalid(lUsage); |
| | | } |
| | | |
| | | if (errors.isEmpty()) |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.guitools.controlpanel.ui; |
| | | |
| | |
| | | errors.add(ERR_CTRL_PANEL_REJECTS_FILE_REQUIRED.get()); |
| | | setPrimaryInvalid(lRejectsFile); |
| | | } |
| | | else if (writeSkips.isSelected()) |
| | | else if (writeSkips.isSelected() |
| | | && new File(rejectPath).equals(new File(skipsFile.getText()))) |
| | | { |
| | | if (new File(rejectPath).equals(new File(skipsFile.getText()))) |
| | | { |
| | | errors.add(ERR_CTRL_PANEL_REJECTS_AND_SKIPS_MUST_BE_DIFFERENT.get()); |
| | | setPrimaryInvalid(lRejectsFile); |
| | | setPrimaryInvalid(lSkipsFile); |
| | | } |
| | | errors.add(ERR_CTRL_PANEL_REJECTS_AND_SKIPS_MUST_BE_DIFFERENT.get()); |
| | | setPrimaryInvalid(lRejectsFile); |
| | | setPrimaryInvalid(lSkipsFile); |
| | | } |
| | | } |
| | | |
| | |
| | | @Override |
| | | public boolean equals(Object o) |
| | | { |
| | | boolean equals = o == this; |
| | | if (!equals) |
| | | if (o == this) |
| | | { |
| | | if (o instanceof JavaArgumentsDescriptor) |
| | | { |
| | | equals = |
| | | commandName.equals(((JavaArgumentsDescriptor)o).getCommandName()) && |
| | | javaArguments.equals(((JavaArgumentsDescriptor)o).getJavaArguments()); |
| | | } |
| | | return true; |
| | | } |
| | | return equals; |
| | | if (!(o instanceof JavaArgumentsDescriptor)) |
| | | { |
| | | return false; |
| | | } |
| | | JavaArgumentsDescriptor desc = (JavaArgumentsDescriptor)o; |
| | | return commandName.equals(desc.getCommandName()) |
| | | && javaArguments.equals(desc.getJavaArguments()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * The table model used to display the java arguments. |
| | | * |
| | | */ |
| | | protected class JavaArgumentsTableModel extends SortableTableModel |
| | | implements Comparator<JavaArgumentsDescriptor> |
| | |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | | boolean canLaunch = true; |
| | | if (!isServerRunning()) |
| | | if (!isServerRunning() |
| | | && state == State.RUNNING |
| | | && runningOnSameServer(taskToBeLaunched)) |
| | | { |
| | | if (state == State.RUNNING && runningOnSameServer(taskToBeLaunched)) |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | // All the operations are incompatible if they apply to this |
| | | // backend for safety. This is a short operation so the limitation |
| | | // has not a lot of impact. |
| | | Set<String> backends = |
| | | new TreeSet<String>(taskToBeLaunched.getBackends()); |
| | | backends.retainAll(getBackends()); |
| | | if (backends.size() > 0) |
| | | { |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | canLaunch = false; |
| | | } |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | return false; |
| | | } |
| | | } |
| | | return canLaunch; |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | |
| | | break; |
| | | } |
| | | } |
| | | else if (theDN.isAncestorOf(baseDN.getDn())) |
| | | else if (theDN.isAncestorOf(baseDN.getDn()) |
| | | && backendName.equalsIgnoreCase(backend.getBackendID())) |
| | | { |
| | | if (backendName.equalsIgnoreCase(backend.getBackendID())) |
| | | { |
| | | errors.add(ERR_BASE_DN_DN_IS_ANCESTOR_OF.get(baseDN.getDn())); |
| | | setPrimaryInvalid(lDirectoryBaseDN); |
| | | baseDNAlreadyDefined = true; |
| | | break; |
| | | } |
| | | errors.add(ERR_BASE_DN_DN_IS_ANCESTOR_OF.get(baseDN.getDn())); |
| | | setPrimaryInvalid(lDirectoryBaseDN); |
| | | baseDNAlreadyDefined = true; |
| | | break; |
| | | } |
| | | } |
| | | if (baseDNAlreadyDefined) |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | staticMembers.setText(sb.toString()); |
| | | staticMembers.setCaretPosition(sb.length()); |
| | | } |
| | | else if (comp == referenceGroup) |
| | | else if (comp == referenceGroup |
| | | && nodes.getNodes().length > 0) |
| | | { |
| | | if (nodes.getNodes().length > 0) |
| | | { |
| | | String dn = nodes.getNodes()[0].getNode().getDN(); |
| | | referenceGroup.setText(dn); |
| | | referenceGroup.setCaretPosition(dn.length()); |
| | | } |
| | | String dn = nodes.getNodes()[0].getNode().getDN(); |
| | | referenceGroup.setText(dn); |
| | | referenceGroup.setCaretPosition(dn.length()); |
| | | } |
| | | e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE); |
| | | e.getDropTargetContext().dropComplete(true); |
| | |
| | | { |
| | | setEnabledOK(!error[0]); |
| | | errorPane.setVisible(error[0]); |
| | | if (schema != null) |
| | | if (schema != null && schemaChanged) |
| | | { |
| | | if (schemaChanged) |
| | | { |
| | | superiors.setSchema(schema); |
| | | updateAttributes(); |
| | | } |
| | | superiors.setSchema(schema); |
| | | updateAttributes(); |
| | | } |
| | | if (repack[0]) |
| | | { |
| | |
| | | break; |
| | | } |
| | | } |
| | | if (!isRequired) |
| | | if (!isRequired && attr.equalsIgnoreCase(NAMING_ATTRIBUTES[i])) |
| | | { |
| | | if (attr.equalsIgnoreCase(NAMING_ATTRIBUTES[i])) |
| | | String value = NAMING_ATTRIBUTE_TEXTFIELDS[i].getText().trim(); |
| | | if (value.length() == 0) |
| | | { |
| | | String value = NAMING_ATTRIBUTE_TEXTFIELDS[i].getText().trim(); |
| | | if (value.length() == 0) |
| | | { |
| | | errors.add(ERR_CTRL_PANEL_USER_NAMING_ATTRIBUTE_REQUIRED.get(attr)); |
| | | } |
| | | break; |
| | | errors.add(ERR_CTRL_PANEL_USER_NAMING_ATTRIBUTE_REQUIRED.get(attr)); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | { |
| | | task.canLaunch(newTask, errors); |
| | | } |
| | | if (errors.isEmpty()) |
| | | if (errors.isEmpty() && checkIndexRequired()) |
| | | { |
| | | // Check filters |
| | | if (checkIndexRequired()) |
| | | { |
| | | String indexName = name.getText().trim(); |
| | | launchOperation(newTask, |
| | | INFO_CTRL_PANEL_CREATING_NEW_VLV_INDEX_SUMMARY.get(indexName), |
| | | INFO_CTRL_PANEL_CREATING_NEW_VLV_INDEX_SUCCESSFUL_SUMMARY.get(), |
| | | INFO_CTRL_PANEL_CREATING_NEW_VLV_INDEX_SUCCESSFUL_DETAILS.get( |
| | | indexName), |
| | | ERR_CTRL_PANEL_CREATING_NEW_VLV_INDEX_ERROR_SUMMARY.get(), |
| | | ERR_CTRL_PANEL_CREATING_NEW_VLV_INDEX_ERROR_DETAILS.get(), |
| | | null, |
| | | dlg); |
| | | dlg.setVisible(true); |
| | | Utilities.getParentDialog(this).setVisible(false); |
| | | } |
| | | String indexName = name.getText().trim(); |
| | | launchOperation(newTask, |
| | | INFO_CTRL_PANEL_CREATING_NEW_VLV_INDEX_SUMMARY.get(indexName), |
| | | INFO_CTRL_PANEL_CREATING_NEW_VLV_INDEX_SUCCESSFUL_SUMMARY.get(), |
| | | INFO_CTRL_PANEL_CREATING_NEW_VLV_INDEX_SUCCESSFUL_DETAILS.get( |
| | | indexName), |
| | | ERR_CTRL_PANEL_CREATING_NEW_VLV_INDEX_ERROR_SUMMARY.get(), |
| | | ERR_CTRL_PANEL_CREATING_NEW_VLV_INDEX_ERROR_DETAILS.get(), |
| | | null, |
| | | dlg); |
| | | dlg.setVisible(true); |
| | | Utilities.getParentDialog(this).setVisible(false); |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | boolean allDisabled = false; |
| | | for (BackendDescriptor backend : desc.getBackends()) |
| | | { |
| | | if (displayBackend(backend)) |
| | | if (displayBackend(backend) && backend.isEnabled()) |
| | | { |
| | | if (backend.isEnabled()) |
| | | { |
| | | allDisabled = false; |
| | | break; |
| | | } |
| | | allDisabled = false; |
| | | break; |
| | | } |
| | | } |
| | | if (!allDisabled) |
| | |
| | | if (values.size() == 1) |
| | | { |
| | | Object v = values.get(0); |
| | | if (v instanceof String) |
| | | if (v instanceof String |
| | | && ((String) v).indexOf("\n") != -1) |
| | | { |
| | | if (((String)v).indexOf("\n") != -1) |
| | | { |
| | | gbc.anchor = GridBagConstraints.NORTHWEST; |
| | | } |
| | | gbc.anchor = GridBagConstraints.NORTHWEST; |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | String oc = (String)o; |
| | | ObjectClass objectClass = schema.getObjectClass(oc.toLowerCase()); |
| | | if (objectClass != null) |
| | | if (objectClass != null && objectClass.isRequired(attr)) |
| | | { |
| | | if (objectClass.isRequired(attr)) |
| | | { |
| | | isRequired = true; |
| | | break; |
| | | } |
| | | isRequired = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | |
| | | List<Object> values = new ArrayList<Object>(); |
| | | for (AttributeValuePair valuePair : dataArray) |
| | | { |
| | | if (valuePair.attrName.equalsIgnoreCase(attrName)) |
| | | if (valuePair.attrName.equalsIgnoreCase(attrName) |
| | | && hasValue(valuePair)) |
| | | { |
| | | if (hasValue(valuePair)) |
| | | if (valuePair.value instanceof Collection<?>) |
| | | { |
| | | if (valuePair.value instanceof Collection<?>) |
| | | { |
| | | values.addAll((Collection<?>) valuePair.value); |
| | | } |
| | | else |
| | | { |
| | | values.add(valuePair.value); |
| | | } |
| | | values.addAll((Collection<?>) valuePair.value); |
| | | } |
| | | else |
| | | { |
| | | values.add(valuePair.value); |
| | | } |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | { |
| | | task.canLaunch(newModifyTask, errors); |
| | | } |
| | | if (errors.isEmpty()) |
| | | if (errors.isEmpty() && checkIndexRequired()) |
| | | { |
| | | // Check filters |
| | | if (checkIndexRequired()) |
| | | { |
| | | String indexName = index.getName(); |
| | | String backendName = index.getBackend().getBackendID(); |
| | | launchOperation(newModifyTask, |
| | | INFO_CTRL_PANEL_MODIFYING_VLV_INDEX_SUMMARY.get(indexName), |
| | | INFO_CTRL_PANEL_MODIFYING_VLV_INDEX_COMPLETE.get(), |
| | | INFO_CTRL_PANEL_MODIFYING_VLV_INDEX_SUCCESSFUL.get(indexName, |
| | | backendName), |
| | | ERR_CTRL_PANEL_MODIFYING_VLV_INDEX_ERROR_SUMMARY.get(), |
| | | ERR_CTRL_PANEL_MODIFYING_VLV_INDEX_ERROR_DETAILS.get(indexName), |
| | | null, |
| | | dlg); |
| | | saveChanges.setEnabled(false); |
| | | dlg.setVisible(true); |
| | | } |
| | | String indexName = index.getName(); |
| | | String backendName = index.getBackend().getBackendID(); |
| | | launchOperation(newModifyTask, |
| | | INFO_CTRL_PANEL_MODIFYING_VLV_INDEX_SUMMARY.get(indexName), |
| | | INFO_CTRL_PANEL_MODIFYING_VLV_INDEX_COMPLETE.get(), |
| | | INFO_CTRL_PANEL_MODIFYING_VLV_INDEX_SUCCESSFUL.get(indexName, backendName), |
| | | ERR_CTRL_PANEL_MODIFYING_VLV_INDEX_ERROR_SUMMARY.get(), |
| | | ERR_CTRL_PANEL_MODIFYING_VLV_INDEX_ERROR_DETAILS.get(indexName), |
| | | null, |
| | | dlg); |
| | | saveChanges.setEnabled(false); |
| | | dlg.setVisible(true); |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui; |
| | |
| | | public boolean canLaunch(Task taskToBeLaunched, |
| | | Collection<LocalizableMessage> incompatibilityReasons) |
| | | { |
| | | boolean canLaunch = true; |
| | | if (state == State.RUNNING && runningOnSameServer(taskToBeLaunched)) |
| | | Type type = taskToBeLaunched.getType(); |
| | | if (state == State.RUNNING |
| | | && runningOnSameServer(taskToBeLaunched) |
| | | && (type == Type.ENABLE_WINDOWS_SERVICE |
| | | || type == Type.DISABLE_WINDOWS_SERVICE)) |
| | | { |
| | | if ((taskToBeLaunched.getType() == Type.ENABLE_WINDOWS_SERVICE) || |
| | | (taskToBeLaunched.getType() == Type.DISABLE_WINDOWS_SERVICE)) |
| | | { |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, |
| | | taskToBeLaunched)); |
| | | canLaunch = false; |
| | | } |
| | | incompatibilityReasons.add(getIncompatibilityMessage(this, taskToBeLaunched)); |
| | | return false; |
| | | } |
| | | return canLaunch; |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.ui.components; |
| | |
| | | notifyNewEvent(macEvent, NewEventType.MOUSE_PRESSED); |
| | | } |
| | | |
| | | if (ev.isPopupTrigger() && (popupMenu != null)) { |
| | | if ((getPathForLocation(ev.getPoint().x, ev.getPoint().y) != null) || |
| | | (newEvent != null)) |
| | | { |
| | | popupMenu.show(ev.getComponent(), ev.getX(), ev.getY()); |
| | | } |
| | | if (ev.isPopupTrigger() |
| | | && popupMenu != null |
| | | && (getPathForLocation(ev.getPoint().x, ev.getPoint().y) != null |
| | | || newEvent != null)) |
| | | { |
| | | popupMenu.show(ev.getComponent(), ev.getX(), ev.getY()); |
| | | } |
| | | if (newEvent != null) |
| | | { |
| | |
| | | return; |
| | | } |
| | | MouseEvent newEvent = getTranslatedEvent(ev); |
| | | if (ev.isPopupTrigger() && (popupMenu != null) && |
| | | !popupMenu.isVisible()) { |
| | | if ((getPathForLocation(ev.getPoint().x, ev.getPoint().y) != null) || |
| | | (newEvent != null)) |
| | | { |
| | | popupMenu.show(ev.getComponent(), ev.getX(), ev.getY()); |
| | | } |
| | | if (ev.isPopupTrigger() |
| | | && popupMenu != null |
| | | && !popupMenu.isVisible() |
| | | && (getPathForLocation(ev.getPoint().x, ev.getPoint().y) != null |
| | | || newEvent != null)) |
| | | { |
| | | popupMenu.show(ev.getComponent(), ev.getX(), ev.getY()); |
| | | } |
| | | |
| | | if (newEvent != null) |
| | |
| | | remove1Clicked(); |
| | | } |
| | | } |
| | | else if (e.getSource() == selectedList2) |
| | | else if (e.getSource() == selectedList2 |
| | | && selectedList2.getSelectedValue() != null) |
| | | { |
| | | if (selectedList2.getSelectedValue() != null) |
| | | { |
| | | remove2Clicked(); |
| | | } |
| | | remove2Clicked(); |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | public void setBorder(Border border) |
| | | { |
| | | if (constructorBorderSet) |
| | | if (constructorBorderSet && border != null) |
| | | { |
| | | if (border != null) |
| | | { |
| | | border = BorderFactory.createCompoundBorder(border, new IconBorder()); |
| | | } |
| | | border = BorderFactory.createCompoundBorder(border, new IconBorder()); |
| | | } |
| | | super.setBorder(border); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2011 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.guitools.controlpanel.util; |
| | |
| | | ex.add(new OfflineUpdateException(ERR_READING_CONFIG_LDAP.get(t.getMessage()), t)); |
| | | } |
| | | |
| | | if (ex.size() > 0) |
| | | if (ex.size() > 0 && environmentSettingException != null) |
| | | { |
| | | if (environmentSettingException != null) |
| | | { |
| | | ex.add(0, environmentSettingException); |
| | | } |
| | | ex.add(0, environmentSettingException); |
| | | } |
| | | |
| | | for (OpenDsException oe : ex) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.guitools.uninstaller; |
| | | |
| | |
| | | @Override |
| | | public void run() |
| | | { |
| | | if (startProgressDlg != null) |
| | | if (startProgressDlg != null && newLogDetail != null) |
| | | { |
| | | if (newLogDetail != null) |
| | | { |
| | | startProgressDetails.append(newLogDetail); |
| | | startProgressDlg.setDetails(startProgressDetails.toMessage()); |
| | | } |
| | | startProgressDetails.append(newLogDetail); |
| | | startProgressDlg.setDetails(startProgressDetails.toMessage()); |
| | | } |
| | | } |
| | | }); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.guitools.uninstaller.ui; |
| | |
| | | { |
| | | case EXTERNAL_DB_DIRECTORIES: |
| | | Set<String> s1 = new HashSet<String>(); |
| | | if (outsideDbs.size() > 0) |
| | | if (outsideDbs.size() > 0 |
| | | && getCheckBox(FieldName.EXTERNAL_DB_DIRECTORIES).isSelected()) |
| | | { |
| | | if (getCheckBox(FieldName.EXTERNAL_DB_DIRECTORIES).isSelected()) |
| | | { |
| | | s1.addAll(outsideDbs); |
| | | } |
| | | s1.addAll(outsideDbs); |
| | | } |
| | | value = s1; |
| | | break; |
| | | |
| | | case EXTERNAL_LOG_FILES: |
| | | Set<String> s2 = new HashSet<String>(); |
| | | if (outsideLogs.size() > 0) |
| | | if (outsideLogs.size() > 0 |
| | | && getCheckBox(FieldName.EXTERNAL_LOG_FILES).isSelected()) |
| | | { |
| | | if (getCheckBox(FieldName.EXTERNAL_LOG_FILES).isSelected()) |
| | | { |
| | | s2.addAll(outsideLogs); |
| | | } |
| | | s2.addAll(outsideLogs); |
| | | } |
| | | value = s2; |
| | | break; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS |
| | | */ |
| | | |
| | | package org.opends.quicksetup.event; |
| | |
| | | |
| | | /* If we can get the current field parent directory set to it */ |
| | | String path = field.getText(); |
| | | if (path != null) |
| | | if (path != null && path.trim().length() > 0) |
| | | { |
| | | if (path.trim().length() > 0) |
| | | File f = new File(path); |
| | | while ((f != null) && !f.isDirectory()) |
| | | { |
| | | File f = new File(path); |
| | | while ((f != null) && !f.isDirectory()) |
| | | { |
| | | f = f.getParentFile(); |
| | | } |
| | | if (f != null) |
| | | { |
| | | fc.setCurrentDirectory(f); |
| | | } |
| | | f = f.getParentFile(); |
| | | } |
| | | if (f != null) |
| | | { |
| | | fc.setCurrentDirectory(f); |
| | | } |
| | | } |
| | | |
| | |
| | | */ |
| | | public String getImportProgressMessage(String msg) |
| | | { |
| | | String parsedMsg = null; |
| | | if (msg != null) |
| | | if (msg != null |
| | | && (msg.contains("msgID=" + JebMessages.NOTE_JEB_IMPORT_FINAL_STATUS.ordinal()) |
| | | || msg.contains("msgID=" + JebMessages.NOTE_JEB_IMPORT_PROGRESS_REPORT.ordinal()))) |
| | | { |
| | | if ((msg.contains("msgID=" + JebMessages |
| | | .NOTE_JEB_IMPORT_FINAL_STATUS.ordinal())) || |
| | | (msg.contains("msgID=" + JebMessages |
| | | .NOTE_JEB_IMPORT_PROGRESS_REPORT.ordinal()))) |
| | | int index = msg.indexOf("msg="); |
| | | if (index != -1) |
| | | { |
| | | int index = msg.indexOf("msg="); |
| | | if (index != -1) |
| | | { |
| | | parsedMsg = msg.substring(index + 4); |
| | | } |
| | | return msg.substring(index + 4); |
| | | } |
| | | } |
| | | return parsedMsg; |
| | | return null; |
| | | } |
| | | } |
| | | |
| | |
| | | errorMsgs.add(ERR_MAX_MEMORY_VALUE.get()); |
| | | setValidLater(lMaxMemory, false); |
| | | } |
| | | if (maxMemory != -1 && initialMemory != -1) |
| | | if (maxMemory != -1 |
| | | && initialMemory != -1 |
| | | && initialMemory > maxMemory) |
| | | { |
| | | if (initialMemory > maxMemory) |
| | | { |
| | | errorMsgs.add(ERR_MAX_MEMORY_BIGGER_THAN_INITIAL_MEMORY.get()); |
| | | setValidLater(lMaxMemory, false); |
| | | setValidLater(lInitialMemory, false); |
| | | } |
| | | errorMsgs.add(ERR_MAX_MEMORY_BIGGER_THAN_INITIAL_MEMORY.get()); |
| | | setValidLater(lMaxMemory, false); |
| | | setValidLater(lInitialMemory, false); |
| | | } |
| | | if (errorMsgs.isEmpty()) |
| | | { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.quicksetup.ui; |
| | |
| | | getContentPane().add(createPanel()); |
| | | setModal(true); |
| | | pack(); |
| | | if (parent != null) |
| | | if (parent != null |
| | | && getPreferredSize().width > parent.getWidth()) |
| | | { |
| | | if (getPreferredSize().width > parent.getWidth()) |
| | | { |
| | | setPreferredSize(new Dimension(Math.max(parent.getWidth() - 20, 600), |
| | | getPreferredSize().height)); |
| | | } |
| | | setPreferredSize(new Dimension(Math.max(parent.getWidth() - 20, 600), |
| | | getPreferredSize().height)); |
| | | } |
| | | pack(); |
| | | int minWidth = (int) getPreferredSize().getWidth(); |
| | |
| | | "The host is null for the UserDataCertificateException")); |
| | | } |
| | | } |
| | | if (acceptPermanently) |
| | | if (acceptPermanently && chain != null) |
| | | { |
| | | if (chain != null) |
| | | try |
| | | { |
| | | try |
| | | { |
| | | UIKeyStore.acceptCertificate(chain); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | logger.warn(LocalizableMessage.raw("Error accepting certificate: "+t, t)); |
| | | } |
| | | UIKeyStore.acceptCertificate(chain); |
| | | } |
| | | catch (Throwable t) |
| | | { |
| | | logger.warn(LocalizableMessage.raw("Error accepting certificate: "+t, t)); |
| | | } |
| | | } |
| | | } |
| | |
| | | throws ApplicationException { |
| | | if (fileToRename != null && target != null) { |
| | | synchronized (target) { |
| | | if (target.exists()) { |
| | | if (!target.delete()) { |
| | | throw new ApplicationException( |
| | | ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | INFO_ERROR_DELETING_FILE.get(Utils.getPath(target)), null); |
| | | } |
| | | if (target.exists() && !target.delete()) |
| | | { |
| | | throw new ApplicationException( |
| | | ReturnCode.FILE_SYSTEM_ACCESS_ERROR, |
| | | INFO_ERROR_DELETING_FILE.get(Utils.getPath(target)), null); |
| | | } |
| | | } |
| | | if (!fileToRename.renameTo(target)) { |
| | |
| | | while ((i = fis.read(buf)) != -1) { |
| | | fos.write(buf, 0, i); |
| | | } |
| | | if (destination.exists()) { |
| | | if (destination.exists() && isUnix()) { |
| | | // TODO: set the file's permissions. This is made easier in |
| | | // Java 1.6 but until then use the TestUtilities methods |
| | | if (isUnix()) { |
| | | String permissions = |
| | | Utils.getFileSystemPermissions(objectFile); |
| | | Utils.setPermissionsUnix( |
| | | Utils.getPath(destination), |
| | | permissions); |
| | | } |
| | | String permissions = Utils.getFileSystemPermissions(objectFile); |
| | | Utils.setPermissionsUnix(Utils.getPath(destination), permissions); |
| | | } |
| | | |
| | | if ((application != null) && application.isVerbose()) { |
| | |
| | | { |
| | | throw new IOException("Could not create parent path: " + destination); |
| | | } |
| | | if (application != null) { |
| | | if (application.isVerbose()) |
| | | { |
| | | application.notifyListenersDone(ratioWhenCompleted); |
| | | } |
| | | if (application != null && application.isVerbose()) |
| | | { |
| | | application.notifyListenersDone(ratioWhenCompleted); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | // Make sure the reference managed object is enabled. |
| | | if (needsEnabling) { |
| | | if (!targetIsEnabledCondition.evaluate(context, ref)) { |
| | | LocalizableMessage msg = ERR_CLIENT_REFINT_TARGET_DISABLED.get(ufn, name, |
| | | getName()); |
| | | unacceptableReasons.add(msg); |
| | | isAcceptable = false; |
| | | } |
| | | if (needsEnabling |
| | | && !targetIsEnabledCondition.evaluate(context, ref)) { |
| | | unacceptableReasons.add(ERR_CLIENT_REFINT_TARGET_DISABLED.get(ufn, name, getName())); |
| | | isAcceptable = false; |
| | | } |
| | | } |
| | | return isAcceptable; |
| | |
| | | throws IllegalArgumentException { |
| | | ifNull(unit); |
| | | |
| | | // Make sure that the base unit is not bigger than the maximum |
| | | // unit. |
| | | if (maximumUnit != null) { |
| | | if (unit.getDuration() > maximumUnit.getDuration()) { |
| | | throw new IllegalArgumentException( |
| | | "Base unit greater than maximum unit"); |
| | | } |
| | | // Make sure that the base unit is not bigger than the maximum unit. |
| | | if (maximumUnit != null && unit.getDuration() > maximumUnit.getDuration()) { |
| | | throw new IllegalArgumentException("Base unit greater than maximum unit"); |
| | | } |
| | | |
| | | this.baseUnit = unit; |
| | |
| | | * The maximum unit, or <code>null</code> if there |
| | | * should not be a maximum unit. |
| | | * @throws IllegalArgumentException |
| | | * If the provided maximum unit is smaller than the base |
| | | * unit. |
| | | * If the provided maximum unit is smaller than the base unit. |
| | | */ |
| | | public final void setMaximumUnit(DurationUnit unit) |
| | | throws IllegalArgumentException { |
| | | if (unit != null) { |
| | | // Make sure that the maximum unit is not smaller than the |
| | | // base unit. |
| | | if (unit.getDuration() < baseUnit.getDuration()) { |
| | | throw new IllegalArgumentException( |
| | | "Maximum unit smaller than base unit"); |
| | | } |
| | | // Make sure that the maximum unit is not smaller than the base unit. |
| | | if (unit != null && unit.getDuration() < baseUnit.getDuration()) { |
| | | throw new IllegalArgumentException("Maximum unit smaller than base unit"); |
| | | } |
| | | |
| | | this.maximumUnit = unit; |
| | |
| | | public String encodeValue(Long value) throws PropertyException { |
| | | ifNull(value); |
| | | |
| | | // Make sure that we correctly encode negative values as |
| | | // "unlimited". |
| | | if (allowUnlimited) { |
| | | if (value < 0) { |
| | | return UNLIMITED; |
| | | } |
| | | // Make sure that we correctly encode negative values as "unlimited". |
| | | if (allowUnlimited && value < 0) { |
| | | return UNLIMITED; |
| | | } |
| | | |
| | | // Encode the size value using the base unit. |
| | |
| | | ifNull(value); |
| | | |
| | | // First check for the special "unlimited" value when necessary. |
| | | if (allowUnlimited) { |
| | | if (value.trim().equalsIgnoreCase(UNLIMITED)) { |
| | | return -1L; |
| | | } |
| | | if (allowUnlimited && value.trim().equalsIgnoreCase(UNLIMITED)) { |
| | | return -1L; |
| | | } |
| | | |
| | | // Parse the string representation. |
| | |
| | | ifNull(value); |
| | | |
| | | // Make sure that we correctly encode negative values as "unlimited". |
| | | if (allowUnlimited) { |
| | | if (value < 0) { |
| | | return UNLIMITED; |
| | | } |
| | | if (allowUnlimited && value < 0) { |
| | | return UNLIMITED; |
| | | } |
| | | |
| | | return value.toString(); |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Integer decodeValue(String value) |
| | | throws PropertyException { |
| | | public Integer decodeValue(String value) throws PropertyException { |
| | | ifNull(value); |
| | | |
| | | if (allowUnlimited) { |
| | | if (value.trim().equalsIgnoreCase(UNLIMITED)) { |
| | | return -1; |
| | | } |
| | | if (allowUnlimited && value.trim().equalsIgnoreCase(UNLIMITED)) { |
| | | return -1; |
| | | } |
| | | |
| | | Integer i; |
| | |
| | | return true; |
| | | } else if (o instanceof PropertyDefinition) { |
| | | PropertyDefinition<?> other = (PropertyDefinition<?>) o; |
| | | if (propertyName.equals(other.propertyName)) { |
| | | if (theClass.equals(other.theClass)) { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | return propertyName.equals(other.propertyName) |
| | | && theClass.equals(other.theClass); |
| | | } else { |
| | | return false; |
| | | } |
| | |
| | | ifNull(value); |
| | | |
| | | // Make sure that we correctly encode negative values as "unlimited". |
| | | if (allowUnlimited) { |
| | | if (value < 0) { |
| | | return UNLIMITED; |
| | | } |
| | | if (allowUnlimited && value < 0) { |
| | | return UNLIMITED; |
| | | } |
| | | |
| | | // Encode the size value using the best-fit unit. |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | public Long decodeValue(String value) |
| | | throws PropertyException { |
| | | public Long decodeValue(String value) throws PropertyException { |
| | | ifNull(value); |
| | | |
| | | // First check for the special "unlimited" value when necessary. |
| | | if (allowUnlimited) { |
| | | if (value.trim().equalsIgnoreCase(UNLIMITED)) { |
| | | return -1L; |
| | | } |
| | | if (allowUnlimited && value.trim().equalsIgnoreCase(UNLIMITED)) { |
| | | return -1L; |
| | | } |
| | | |
| | | // Decode the value. |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS. |
| | | * Portions Copyright 2013-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.admin.client.ldap; |
| | | |
| | |
| | | |
| | | newProperties.addProperty(pd, defaultValues, activeValues); |
| | | |
| | | if (activeValues.isEmpty() && defaultValues.isEmpty() |
| | | && pd.hasOption(PropertyOption.MANDATORY)) { |
| | | // The active values maybe empty because of a previous |
| | | // exception. |
| | | if (exception == null) { |
| | | exception = PropertyException.propertyIsMandatoryException(pd); |
| | | } |
| | | if (activeValues.isEmpty() |
| | | && defaultValues.isEmpty() |
| | | && pd.hasOption(PropertyOption.MANDATORY) |
| | | // The active values maybe empty because of a previous exception. |
| | | && exception == null) { |
| | | exception = PropertyException.propertyIsMandatoryException(pd); |
| | | } |
| | | |
| | | if (exception != null) { |
| | |
| | | throw PropertyException.propertyIsSingleValuedException(d); |
| | | } |
| | | |
| | | if (values.isEmpty() && d.hasOption(PropertyOption.MANDATORY)) { |
| | | // But only if there are no default values. |
| | | if (property.getDefaultValues().isEmpty()) { |
| | | throw PropertyException.propertyIsMandatoryException(d); |
| | | } |
| | | if (values.isEmpty() |
| | | && d.hasOption(PropertyOption.MANDATORY) |
| | | // But only if there are no default values. |
| | | && property.getDefaultValues().isEmpty()) { |
| | | throw PropertyException.propertyIsMandatoryException(d); |
| | | } |
| | | |
| | | // Validate each value. |
| | |
| | | heading3("Relations To this Component"); |
| | | } |
| | | |
| | | if (!mo.getReverseRelationDefinitions().isEmpty()) { |
| | | if (!isReverseCompRelsEmpty) { |
| | | paragraph( |
| | | "The following components have a direct COMPOSITION relation TO " + |
| | | mo.getUserFriendlyPluralName() + " :"); |
| | | for ( RelationDefinition rel : reverseCompRels) { |
| | | beginList(); |
| | | AbstractManagedObjectDefinition childRel = rel.getParentDefinition(); |
| | | link(childRel.getUserFriendlyName().toString(), childRel.getName() + |
| | | ".html"); |
| | | endList(); |
| | | } |
| | | if (!mo.getReverseRelationDefinitions().isEmpty() |
| | | && !isReverseCompRelsEmpty) |
| | | { |
| | | paragraph( |
| | | "The following components have a direct COMPOSITION relation TO " + |
| | | mo.getUserFriendlyPluralName() + " :"); |
| | | for ( RelationDefinition rel : reverseCompRels) { |
| | | beginList(); |
| | | AbstractManagedObjectDefinition childRel = rel.getParentDefinition(); |
| | | link(childRel.getUserFriendlyName().toString(), childRel.getName() + ".html"); |
| | | endList(); |
| | | } |
| | | } |
| | | if (!isReverseAggregPropsEmpty) { |
| | |
| | | pvalues.add(value); |
| | | } |
| | | |
| | | if (pvalues.isEmpty() && pd.hasOption(PropertyOption.MANDATORY)) { |
| | | // The values maybe empty because of a previous exception. |
| | | if (exception == null) { |
| | | exception = PropertyException.propertyIsMandatoryException(pd); |
| | | } |
| | | if (pvalues.isEmpty() |
| | | && pd.hasOption(PropertyOption.MANDATORY) |
| | | // The values maybe empty because of a previous exception. |
| | | && exception == null) { |
| | | exception = PropertyException.propertyIsMandatoryException(pd); |
| | | } |
| | | |
| | | if (exception != null) { |
| | | throw exception; |
| | | } else { |
| | | return pvalues; |
| | | } |
| | | return pvalues; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | if (timeValue == -1) |
| | | { |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | logger.trace("Returning -1 because attribute %s does not " |
| | | + "exist in user entry %s", attributeType.getNameOrOID(), entry.getName()); |
| | | } |
| | | if (timeValue == -1 && logger.isTraceEnabled()) |
| | | { |
| | | logger.trace("Returning -1 because attribute %s does not " |
| | | + "exist in user entry %s", attributeType.getNameOrOID(), entry.getName()); |
| | | } |
| | | // FIXME: else to be consistent... |
| | | |
| | | return timeValue; |
| | | } |
| | |
| | | * - TLS is the security provider, and |
| | | * - The client provided a certificate. |
| | | */ |
| | | if (authInfo.hasAuthenticationType(AuthenticationType.SASL) && |
| | | authInfo.hasSASLMechanism(saslMech)) { |
| | | |
| | | if(clientConnection instanceof LDAPClientConnection) { |
| | | LDAPClientConnection lc = |
| | | (LDAPClientConnection) clientConnection; |
| | | Certificate[] certChain = lc.getClientCertificateChain(); |
| | | if(certChain.length != 0) |
| | | matched = EnumEvalResult.TRUE; |
| | | if (authInfo.hasAuthenticationType(AuthenticationType.SASL) |
| | | && authInfo.hasSASLMechanism(saslMech) |
| | | && clientConnection instanceof LDAPClientConnection) { |
| | | LDAPClientConnection lc = (LDAPClientConnection) clientConnection; |
| | | Certificate[] certChain = lc.getClientCertificateChain(); |
| | | if (certChain.length != 0) { |
| | | matched = EnumEvalResult.TRUE; |
| | | } |
| | | } |
| | | } else { |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | * Portions Copyright 2013 Manuel Gaupp |
| | | */ |
| | | package org.opends.server.authorization.dseecompat; |
| | |
| | | // type are being replaced or deleted. If only a subset is being |
| | | // deleted than this access check is skipped. |
| | | ModificationType modType = m.getModificationType(); |
| | | if ((modType == ModificationType.DELETE && modAttr.isEmpty()) |
| | | || modType == ModificationType.REPLACE |
| | | || modType == ModificationType.INCREMENT) |
| | | if (((modType == ModificationType.DELETE && modAttr.isEmpty()) |
| | | || modType == ModificationType.REPLACE |
| | | || modType == ModificationType.INCREMENT) |
| | | /* |
| | | * Check if we have rights to delete all values of an attribute |
| | | * type in the resource entry. |
| | | */ |
| | | && resourceEntry.hasAttribute(modAttrType)) |
| | | { |
| | | /* |
| | | * Check if we have rights to delete all values of an attribute |
| | | * type in the resource entry. |
| | | */ |
| | | if (resourceEntry.hasAttribute(modAttrType)) |
| | | container.setCurrentAttributeType(modAttrType); |
| | | List<Attribute> attrList = |
| | | resourceEntry.getAttribute(modAttrType, modAttr.getOptions()); |
| | | if (attrList != null) |
| | | { |
| | | container.setCurrentAttributeType(modAttrType); |
| | | List<Attribute> attrList = |
| | | resourceEntry.getAttribute(modAttrType, modAttr.getOptions()); |
| | | if (attrList != null) |
| | | for (Attribute a : attrList) |
| | | { |
| | | for (Attribute a : attrList) |
| | | for (ByteString v : a) |
| | | { |
| | | for (ByteString v : a) |
| | | container.setCurrentAttributeValue(v); |
| | | container.setRights(ACI_WRITE_DELETE); |
| | | if (!skipAccessCheck && !accessAllowed(container)) |
| | | { |
| | | container.setCurrentAttributeValue(v); |
| | | container.setRights(ACI_WRITE_DELETE); |
| | | if (!skipAccessCheck && !accessAllowed(container)) |
| | | { |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | |
| | | |
| | |
| | | if(wildCardBitSet.cardinality() == IN4ADDRSZ) |
| | | return true; |
| | | for(int i=0;i <rulePrefixBytes.length; i++) { |
| | | if(!wildCardBitSet.get(i)) { |
| | | if((ruleAddrBytes[i] & rulePrefixBytes[i]) != |
| | | (addrBytes[i] & rulePrefixBytes[i])) |
| | | return false; |
| | | } |
| | | if (!wildCardBitSet.get(i) |
| | | && (ruleAddrBytes[i] & rulePrefixBytes[i]) != |
| | | (addrBytes[i] & rulePrefixBytes[i])) |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | |
| | | */ |
| | | package org.opends.server.authorization.dseecompat; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | import static org.opends.messages.AccessControlMessages.*; |
| | | import static org.opends.server.authorization.dseecompat.Aci.*; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.regex.Pattern; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.AttributeType; |
| | | |
| | |
| | | throws AciException { |
| | | this.operator = operator; |
| | | if (attrString != null) { |
| | | if (Pattern.matches(ALL_USER_ATTRS_WILD_CARD, attrString) ) |
| | | if (Pattern.matches(ALL_USER_ATTRS_WILD_CARD, attrString)) { |
| | | allUserAttributes = true ; |
| | | else if (Pattern.matches(ALL_OP_ATTRS_WILD_CARD, attrString) ) |
| | | } else if (Pattern.matches(ALL_OP_ATTRS_WILD_CARD, attrString)) { |
| | | allOpAttributes = true ; |
| | | else { |
| | | if (Pattern.matches(ZERO_OR_MORE_WHITESPACE, attrString)){ |
| | | allUserAttributes = false; |
| | | allOpAttributes=false; |
| | | } else { |
| | | if (Pattern.matches(attrListRegex, attrString)) { |
| | | // Remove the spaces in the attr string and |
| | | // split the list. |
| | | Pattern separatorPattern = |
| | | Pattern.compile(LOGICAL_OR); |
| | | attrString= |
| | | attrString.replaceAll(ZERO_OR_MORE_WHITESPACE, ""); |
| | | String[] attributeArray= |
| | | separatorPattern.split(attrString); |
| | | //Add each element of array to appropriate HashSet |
| | | //after conversion to AttributeType. |
| | | arrayToAttributeTypes(attributeArray, attrString); |
| | | } else { |
| | | LocalizableMessage message = |
| | | WARN_ACI_SYNTAX_INVALID_TARGETATTRKEYWORD_EXPRESSION. |
| | | get(attrString); |
| | | throw new AciException(message); |
| | | } |
| | | } |
| | | } else if (Pattern.matches(ZERO_OR_MORE_WHITESPACE, attrString)) { |
| | | allUserAttributes = false; |
| | | allOpAttributes = false; |
| | | } else if (Pattern.matches(attrListRegex, attrString)) { |
| | | // Remove the spaces in the attr string and |
| | | // split the list. |
| | | Pattern separatorPattern = Pattern.compile(LOGICAL_OR); |
| | | attrString = attrString.replaceAll(ZERO_OR_MORE_WHITESPACE, ""); |
| | | String[] attributeArray = separatorPattern.split(attrString); |
| | | // Add each element of array to appropriate HashSet |
| | | // after conversion to AttributeType. |
| | | arrayToAttributeTypes(attributeArray, attrString); |
| | | } else { |
| | | throw new AciException(WARN_ACI_SYNTAX_INVALID_TARGETATTRKEYWORD_EXPRESSION.get(attrString)); |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | private void arrayToAttributeTypes(String[] attributeArray, String attrStr) |
| | | throws AciException { |
| | | for (int i=0, n=attributeArray.length; i < n; i++) { |
| | | String attribute=attributeArray[i].toLowerCase(); |
| | | for (String attr : attributeArray) { |
| | | String attribute = attr.toLowerCase(); |
| | | if(attribute.equals("*")) { |
| | | if(!allUserAttributes) |
| | | allUserAttributes=true; |
| | |
| | | * @param targetAttr The targetAttr to apply to the attribute type. |
| | | * @return True if the attribute type is applicable to the targetAttr. |
| | | */ |
| | | private static |
| | | boolean evalAttrType(AttributeType a, TargetAttr targetAttr) { |
| | | boolean ret=false; |
| | | private static boolean evalAttrType(AttributeType a, TargetAttr targetAttr) { |
| | | final EnumTargetOperator op = targetAttr.getOperator(); |
| | | if(a.isOperational()) { |
| | | if(targetAttr.isAllOpAttributes() || |
| | | targetAttr.opAttributes.contains(a)) |
| | | ret=true; |
| | | if(targetAttr.isAllOpAttributes() || |
| | | !targetAttr.opAttributes.isEmpty()) { |
| | | if(targetAttr.getOperator(). |
| | | equals(EnumTargetOperator.NOT_EQUALITY)) |
| | | ret=!ret; |
| | | } |
| | | return evalAttrType(a, targetAttr.isAllOpAttributes(), targetAttr.opAttributes, op); |
| | | } else { |
| | | if(targetAttr.isAllUserAttributes() || |
| | | targetAttr.attributes.contains(a)) |
| | | ret=true; |
| | | if(targetAttr.isAllUserAttributes() || |
| | | !targetAttr.attributes.isEmpty()) { |
| | | if(targetAttr.getOperator(). |
| | | equals(EnumTargetOperator.NOT_EQUALITY)) |
| | | ret=!ret; |
| | | } |
| | | return evalAttrType(a, targetAttr.isAllUserAttributes(), targetAttr.attributes, op); |
| | | } |
| | | return ret; |
| | | } |
| | | |
| | | private static boolean evalAttrType(AttributeType attrType, boolean allAttrs, |
| | | HashSet<AttributeType> attrs, EnumTargetOperator op) { |
| | | boolean ret = allAttrs || attrs.contains(attrType); |
| | | if (op.equals(EnumTargetOperator.NOT_EQUALITY)) |
| | | { |
| | | return !ret; |
| | | } |
| | | return ret; |
| | | } |
| | | } |
| | |
| | | |
| | | if (incremental) |
| | | { |
| | | if (incrBaseID == null) |
| | | if (incrBaseID == null && backupDir.getLatestBackup() != null) |
| | | { |
| | | // The default is to use the latest backup as base. |
| | | if (backupDir.getLatestBackup() != null) |
| | | { |
| | | incrBaseID = backupDir.getLatestBackup().getBackupID(); |
| | | } |
| | | incrBaseID = backupDir.getLatestBackup().getBackupID(); |
| | | } |
| | | |
| | | if (incrBaseID == null) |
| | |
| | | // See if we need to restore the file. |
| | | File file = new File(restoreDir, name); |
| | | OutputStream outputStream = null; |
| | | if (includeFiles == null || includeFiles.contains(zipEntry.getName())) |
| | | if ((includeFiles == null || includeFiles.contains(zipEntry.getName())) |
| | | && !verifyOnly) |
| | | { |
| | | if (!verifyOnly) |
| | | { |
| | | outputStream = new FileOutputStream(file); |
| | | } |
| | | outputStream = new FileOutputStream(file); |
| | | } |
| | | |
| | | if (outputStream != null || mac != null || digest != null) |
| | |
| | | zipStream.close(); |
| | | |
| | | // Check the hash. |
| | | if (digest != null) |
| | | if (digest != null && !Arrays.equals(digest.digest(), hash)) |
| | | { |
| | | if (!Arrays.equals(digest.digest(), hash)) |
| | | { |
| | | LocalizableMessage message = ERR_JEB_BACKUP_UNSIGNED_HASH_ERROR.get(backupID); |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), |
| | | message); |
| | | } |
| | | LocalizableMessage message = ERR_JEB_BACKUP_UNSIGNED_HASH_ERROR.get(backupID); |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), message); |
| | | } |
| | | |
| | | if (mac != null) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.jeb; |
| | | |
| | |
| | | public void indexEntry(Entry entry, Set<ByteString> keys, IndexingOptions options) |
| | | { |
| | | List<Attribute> attrList = entry.getAttribute(attributeType); |
| | | if (attrList != null) |
| | | if (attrList != null && !attrList.isEmpty()) |
| | | { |
| | | if (!attrList.isEmpty()) |
| | | { |
| | | keys.add(presenceKey); |
| | | } |
| | | keys.add(presenceKey); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if (incremental) |
| | | { |
| | | if (incrBaseID == null) |
| | | if (incrBaseID == null && backupDir.getLatestBackup() != null) |
| | | { |
| | | // The default is to use the latest backup as base. |
| | | if (backupDir.getLatestBackup() != null) |
| | | { |
| | | incrBaseID = backupDir.getLatestBackup().getBackupID(); |
| | | } |
| | | incrBaseID = backupDir.getLatestBackup().getBackupID(); |
| | | } |
| | | |
| | | if (incrBaseID == null) |
| | |
| | | // See if we need to restore the file. |
| | | File file = new File(restoreDir, name); |
| | | OutputStream outputStream = null; |
| | | if (includeFiles == null || includeFiles.contains(zipEntry.getName())) |
| | | if ((includeFiles == null || includeFiles.contains(zipEntry.getName())) && !verifyOnly) |
| | | { |
| | | if (!verifyOnly) |
| | | { |
| | | outputStream = new FileOutputStream(file); |
| | | } |
| | | outputStream = new FileOutputStream(file); |
| | | } |
| | | |
| | | if (outputStream != null || mac != null || digest != null) |
| | |
| | | zipStream.close(); |
| | | |
| | | // Check the hash. |
| | | if (digest != null) |
| | | if (digest != null && !Arrays.equals(digest.digest(), hash)) |
| | | { |
| | | if (!Arrays.equals(digest.digest(), hash)) |
| | | { |
| | | LocalizableMessage message = ERR_JEB_BACKUP_UNSIGNED_HASH_ERROR.get(backupID); |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), |
| | | message); |
| | | } |
| | | LocalizableMessage message = ERR_JEB_BACKUP_UNSIGNED_HASH_ERROR.get(backupID); |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), |
| | | message); |
| | | } |
| | | |
| | | if (mac != null) |
| | |
| | | logIndexCorruptError(txn, key); |
| | | } |
| | | |
| | | if ((rebuildRunning || trusted) && isNotNullOrEmpty(addedIDs)) |
| | | if ((rebuildRunning || trusted) |
| | | && isNotNullOrEmpty(addedIDs) |
| | | && !insert(txn, key, addedIDs.toByteString())) |
| | | { |
| | | if(!insert(txn, key, addedIDs.toByteString())) |
| | | { |
| | | updateKeyWithRMW(txn, key, deletedIDs, addedIDs); |
| | | } |
| | | updateKeyWithRMW(txn, key, deletedIDs, addedIDs); |
| | | } |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.pluggable; |
| | | |
| | |
| | | public void indexEntry(Entry entry, Set<ByteString> keys, IndexingOptions options) |
| | | { |
| | | List<Attribute> attrList = entry.getAttribute(attributeType); |
| | | if (attrList != null) |
| | | if (attrList != null && !attrList.isEmpty()) |
| | | { |
| | | if (!attrList.isEmpty()) |
| | | { |
| | | keys.add(presenceKey); |
| | | } |
| | | keys.add(presenceKey); |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.backends.task; |
| | | |
| | |
| | | try |
| | | { |
| | | Entry e = t.getTaskEntry().duplicate(true); |
| | | if (filter.matchesEntry(e)) |
| | | if (filter.matchesEntry(e) && !searchOperation.returnEntry(e, null)) |
| | | { |
| | | if (! searchOperation.returnEntry(e, null)) |
| | | { |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | finally |
| | |
| | | try |
| | | { |
| | | Entry e = rt.getRecurringTaskEntry().duplicate(true); |
| | | if (filter.matchesEntry(e)) |
| | | if (filter.matchesEntry(e) && ! searchOperation.returnEntry(e, null)) |
| | | { |
| | | if (! searchOperation.returnEntry(e, null)) |
| | | { |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | finally |
| | |
| | | |
| | | // Make sure that the value limit will not be exceeded for a single-valued |
| | | // attribute. |
| | | if (! isMultiValued) |
| | | if (!isMultiValued) |
| | | { |
| | | if ((numValues > 1) || (hasPendingValues && (pendingValues.size() > 0)) || |
| | | ((! hasPendingValues) && (activeValues.size() > 0))) |
| | | if (numValues > 1 |
| | | || (hasPendingValues && pendingValues.size() > 0) |
| | | || (!hasPendingValues && activeValues.size() > 0)) |
| | | { |
| | | LocalizableMessage message = ERR_CONFIG_ATTR_ADD_VALUES_IS_SINGLE_VALUED.get(name); |
| | | throw new ConfigException(message); |
| | | throw new ConfigException(ERR_CONFIG_ATTR_ADD_VALUES_IS_SINGLE_VALUED.get(name)); |
| | | } |
| | | } |
| | | |
| | |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 Manuel Gaupp |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.controls; |
| | | |
| | |
| | | */ |
| | | public AttributeType getAttributeType() |
| | | { |
| | | if (attributeType == null) |
| | | if (attributeType == null && rawAttributeType != null) |
| | | { |
| | | if (rawAttributeType != null) |
| | | attributeType = DirectoryServer.getAttributeType(toLowerCase(rawAttributeType)); |
| | | if (attributeType == null) |
| | | { |
| | | attributeType = |
| | | DirectoryServer.getAttributeType(toLowerCase(rawAttributeType)); |
| | | if (attributeType == null) |
| | | { |
| | | attributeType = |
| | | DirectoryServer.getDefaultAttributeType(rawAttributeType); |
| | | } |
| | | attributeType = DirectoryServer.getDefaultAttributeType(rawAttributeType); |
| | | } |
| | | } |
| | | |
| | | return attributeType; |
| | | } |
| | | |
| | |
| | | */ |
| | | public MatchingRule getMatchingRule() |
| | | { |
| | | if (matchingRule == null) |
| | | if (matchingRule == null && matchingRuleID != null) |
| | | { |
| | | if (matchingRuleID != null) |
| | | { |
| | | matchingRule = |
| | | DirectoryServer.getMatchingRule(toLowerCase(matchingRuleID)); |
| | | } |
| | | matchingRule = DirectoryServer.getMatchingRule(toLowerCase(matchingRuleID)); |
| | | } |
| | | |
| | | return matchingRule; |
| | | } |
| | | |
| | |
| | | configuration.addChangeListener(this); |
| | | |
| | | // Check if there is another entry cache installed at the same level. |
| | | if (!cacheOrderMap.isEmpty()) { |
| | | if (cacheOrderMap.containsKey(configuration.getCacheLevel())) { |
| | | // Log error and skip this cache. |
| | | logger.error(ERR_CONFIG_ENTRYCACHE_CONFIG_LEVEL_NOT_ACCEPTABLE, |
| | | configuration.dn(), configuration.getCacheLevel()); |
| | | continue; |
| | | } |
| | | if (!cacheOrderMap.isEmpty() |
| | | && cacheOrderMap.containsKey(configuration.getCacheLevel())) |
| | | { |
| | | // Log error and skip this cache. |
| | | logger.error(ERR_CONFIG_ENTRYCACHE_CONFIG_LEVEL_NOT_ACCEPTABLE, |
| | | configuration.dn(), configuration.getCacheLevel()); |
| | | continue; |
| | | } |
| | | |
| | | // Initialize the entry cache. |
| | |
| | | { |
| | | // returned status -- all is fine by default |
| | | // Check if there is another entry cache installed at the same level. |
| | | if (!cacheOrderMap.isEmpty()) { |
| | | if (cacheOrderMap.containsKey(configuration.getCacheLevel())) { |
| | | unacceptableReasons.add( |
| | | ERR_CONFIG_ENTRYCACHE_CONFIG_LEVEL_NOT_ACCEPTABLE.get( |
| | | configuration.dn(), configuration.getCacheLevel())); |
| | | return false; |
| | | } |
| | | if (!cacheOrderMap.isEmpty() |
| | | && cacheOrderMap.containsKey(configuration.getCacheLevel())) |
| | | { |
| | | unacceptableReasons.add(ERR_CONFIG_ENTRYCACHE_CONFIG_LEVEL_NOT_ACCEPTABLE.get( |
| | | configuration.dn(), configuration.getCacheLevel())); |
| | | return false; |
| | | } |
| | | |
| | | if (configuration.isEnabled()) |
| | |
| | | { |
| | | // If this is going to be the default password policy then check the type is |
| | | // correct. |
| | | if (policyConfiguration.dn().equals( |
| | | DirectoryServer.getDefaultPasswordPolicyDN())) |
| | | if (policyConfiguration.dn().equals(DirectoryServer.getDefaultPasswordPolicyDN()) |
| | | && !(policyConfiguration instanceof PasswordPolicyCfg)) |
| | | { |
| | | if (!(policyConfiguration instanceof PasswordPolicyCfg)) |
| | | { |
| | | LocalizableMessage msg = ERR_CONFIG_PWPOLICY_DEFAULT_POLICY_IS_WRONG_TYPE.get(policyConfiguration.dn()); |
| | | throw new ConfigException(msg); |
| | | } |
| | | throw new ConfigException(ERR_CONFIG_PWPOLICY_DEFAULT_POLICY_IS_WRONG_TYPE.get(policyConfiguration.dn())); |
| | | } |
| | | |
| | | String className = policyConfiguration.getJavaClass(); |
| | |
| | | { |
| | | // If this is going to be the default password policy then check the type is |
| | | // correct. |
| | | if (policyConfiguration.dn().equals( |
| | | DirectoryServer.getDefaultPasswordPolicyDN())) |
| | | if (policyConfiguration.dn().equals(DirectoryServer.getDefaultPasswordPolicyDN()) |
| | | && !(policyConfiguration instanceof PasswordPolicyCfg)) |
| | | { |
| | | if (!(policyConfiguration instanceof PasswordPolicyCfg)) |
| | | { |
| | | LocalizableMessage msg = ERR_CONFIG_PWPOLICY_DEFAULT_POLICY_IS_WRONG_TYPE.get(policyConfiguration.dn()); |
| | | unacceptableReasons.add(msg); |
| | | return false; |
| | | } |
| | | unacceptableReasons.add(ERR_CONFIG_PWPOLICY_DEFAULT_POLICY_IS_WRONG_TYPE.get(policyConfiguration.dn())); |
| | | return false; |
| | | } |
| | | |
| | | String className = policyConfiguration.getJavaClass(); |
| | |
| | | |
| | | // Check to see if we should verify the whole password or the substrings. |
| | | int minSubstringLength = password.length(); |
| | | if (config.isCheckSubstrings()) |
| | | if (config.isCheckSubstrings() |
| | | // We apply the minimal substring length only if the provided value |
| | | // is smaller then the actual password length |
| | | && config.getMinSubstringLength() < password.length()) |
| | | { |
| | | // We apply the minimal substring length only if the provided value |
| | | // is smaller then the actual password length |
| | | if (config.getMinSubstringLength() < password.length()) |
| | | { |
| | | minSubstringLength = config.getMinSubstringLength(); |
| | | } |
| | | minSubstringLength = config.getMinSubstringLength(); |
| | | } |
| | | |
| | | // If we should check a specific set of attributes, then do that now. |
| | |
| | | // the password which is the default behaviour ('check-substrings: false') |
| | | int minSubstringLength = password.length(); |
| | | |
| | | if (config.isCheckSubstrings()) |
| | | if (config.isCheckSubstrings() |
| | | // We apply the minimal substring length only if the provided value |
| | | // is smaller then the actual password length |
| | | && config.getMinSubstringLength() < password.length()) |
| | | { |
| | | // We apply the minimal substring length only if the provided value |
| | | // is smaller then the actual password length |
| | | if (config.getMinSubstringLength() < password.length()) |
| | | { |
| | | minSubstringLength = config.getMinSubstringLength(); |
| | | } |
| | | minSubstringLength = config.getMinSubstringLength(); |
| | | } |
| | | |
| | | // Verify if the dictionary contains the word(s) in the password |
| | |
| | | |
| | | // If the reverse password checking is enabled, then verify if the |
| | | // reverse value of the password is in the dictionary. |
| | | if (config.isTestReversedPassword()) |
| | | if (config.isTestReversedPassword() |
| | | && isDictionaryBased( |
| | | new StringBuilder(password).reverse().toString(), minSubstringLength)) |
| | | { |
| | | if (isDictionaryBased( |
| | | new StringBuilder(password).reverse().toString(), minSubstringLength)) |
| | | { |
| | | invalidReason.append( |
| | | ERR_DICTIONARY_VALIDATOR_PASSWORD_IN_DICTIONARY.get()); |
| | | return false; |
| | | } |
| | | invalidReason.append(ERR_DICTIONARY_VALIDATOR_PASSWORD_IN_DICTIONARY.get()); |
| | | return false; |
| | | } |
| | | |
| | | |
| | |
| | | // If there is a PIN property, then make sure the corresponding |
| | | // property is set. |
| | | String pinProp = configuration.getTrustStorePinProperty(); |
| | | if (pinProp != null) |
| | | if (pinProp != null && System.getProperty(pinProp) == null) |
| | | { |
| | | if (System.getProperty(pinProp) == null) |
| | | { |
| | | LocalizableMessage message = ERR_FILE_TRUSTMANAGER_PIN_PROPERTY_NOT_SET.get(pinProp, cfgEntryDN); |
| | | unacceptableReasons.add(message); |
| | | configAcceptable = false; |
| | | } |
| | | unacceptableReasons.add(ERR_FILE_TRUSTMANAGER_PIN_PROPERTY_NOT_SET.get(pinProp, cfgEntryDN)); |
| | | configAcceptable = false; |
| | | } |
| | | |
| | | |
| | | // If there is a PIN environment variable, then make sure the corresponding |
| | | // environment variable is set. |
| | | String pinEnVar = configuration.getTrustStorePinEnvironmentVariable(); |
| | | if (pinEnVar != null) |
| | | if (pinEnVar != null && System.getenv(pinEnVar) == null) |
| | | { |
| | | if (System.getenv(pinEnVar) == null) |
| | | { |
| | | LocalizableMessage message = ERR_FILE_TRUSTMANAGER_PIN_ENVAR_NOT_SET.get(pinEnVar, cfgEntryDN); |
| | | unacceptableReasons.add(message); |
| | | configAcceptable = false; |
| | | } |
| | | unacceptableReasons.add(ERR_FILE_TRUSTMANAGER_PIN_ENVAR_NOT_SET.get(pinEnVar, cfgEntryDN)); |
| | | configAcceptable = false; |
| | | } |
| | | |
| | | |
| | |
| | | try |
| | | { |
| | | Entry e = memberList.nextMemberEntry(); |
| | | if (e.matchesBaseAndScope(baseDN, scope) && |
| | | filter.matchesEntry(e)) |
| | | if (e.matchesBaseAndScope(baseDN, scope) |
| | | && filter.matchesEntry(e) |
| | | // The set of returned DNs is only used for detecting set membership |
| | | // so it's ok to use the irreversible representation of the DN |
| | | && (returnedDNs == null || returnedDNs.add(e.getName().toIrreversibleNormalizedByteString())) |
| | | && !searchOperation.returnEntry(e, null)) |
| | | { |
| | | // The set of returned DNs is only used for detecting set membership |
| | | // so it's ok to use the irreversible representation of the DN |
| | | if (returnedDNs == null || returnedDNs.add(e.getName().toIrreversibleNormalizedByteString())) |
| | | { |
| | | if (!searchOperation.returnEntry(e, null)) |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | // Ensure that the search bind password is defined somewhere. |
| | | if (cfg.getMappingPolicy() == MappingPolicy.MAPPED_SEARCH |
| | | && cfg.getMappedSearchBindDN() != null |
| | | && !cfg.getMappedSearchBindDN().isRootDN()) |
| | | && !cfg.getMappedSearchBindDN().isRootDN() |
| | | && getMappedSearchBindPassword(cfg, unacceptableReasons) == null) |
| | | { |
| | | if (getMappedSearchBindPassword(cfg, unacceptableReasons) == null) |
| | | { |
| | | configurationIsAcceptable = false; |
| | | } |
| | | configurationIsAcceptable = false; |
| | | } |
| | | |
| | | return configurationIsAcceptable; |
| | |
| | | |
| | | |
| | | // If all of the changes were acceptable, then apply them. |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS) |
| | | if (ccr.getResultCode() == ResultCode.SUCCESS |
| | | && ! identityMapperDN.equals(mapperDN)) |
| | | { |
| | | if (! identityMapperDN.equals(mapperDN)) |
| | | { |
| | | identityMapper = mapper; |
| | | identityMapperDN = mapperDN; |
| | | } |
| | | identityMapper = mapper; |
| | | identityMapperDN = mapperDN; |
| | | } |
| | | |
| | | |
| | |
| | | private boolean filterRequest(final Operation operation) |
| | | { |
| | | // Check target DN. |
| | | if (targetDNNotEqualTo.length > 0 || targetDNEqualTo.length > 0) |
| | | if ((targetDNNotEqualTo.length > 0 || targetDNEqualTo.length > 0) |
| | | && !filterRequestTargetDN(operation)) |
| | | { |
| | | if (!filterRequestTargetDN(operation)) |
| | | { |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | // TODO: check required controls. |
| | |
| | | final long etime = operation.getProcessingTime(); |
| | | |
| | | final Integer etimeGT = cfg.getResponseEtimeGreaterThan(); |
| | | if (etimeGT != null) |
| | | if (etimeGT != null && etime <= ((long) etimeGT)) |
| | | { |
| | | if (etime <= ((long) etimeGT)) |
| | | { |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | final Integer etimeLT = cfg.getResponseEtimeLessThan(); |
| | | if (etimeLT != null) |
| | | if (etimeLT != null && etime >= ((long) etimeLT)) |
| | | { |
| | | if (etime >= ((long) etimeLT)) |
| | | { |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | // Check search response fields. |
| | |
| | | final int nentries = searchOperation.getEntriesSent(); |
| | | |
| | | final Integer nentriesGT = cfg.getSearchResponseNentriesGreaterThan(); |
| | | if (nentriesGT != null) |
| | | if (nentriesGT != null && nentries <= nentriesGT) |
| | | { |
| | | if (nentries <= nentriesGT) |
| | | { |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | final Integer nentriesLT = cfg.getSearchResponseNentriesLessThan(); |
| | | if (nentriesLT != null) |
| | | if (nentriesLT != null && nentries >= nentriesLT) |
| | | { |
| | | if (nentries >= nentriesLT) |
| | | { |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | |
| | | private boolean filterUser(final ClientConnection connection) |
| | | { |
| | | // Check user DN. |
| | | if (userDNNotEqualTo.length > 0 || userDNEqualTo.length > 0) |
| | | if ((userDNNotEqualTo.length > 0 || userDNEqualTo.length > 0) |
| | | && !filterUserBindDN(connection)) |
| | | { |
| | | if (!filterUserBindDN(connection)) |
| | | { |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | // Check group membership. |
| | | if (userIsNotMemberOf.length > 0 || userIsMemberOf.length > 0) |
| | | if ((userIsNotMemberOf.length > 0 || userIsMemberOf.length > 0) |
| | | && !filterUserIsMemberOf(connection)) |
| | | { |
| | | if (!filterUserIsMemberOf(connection)) |
| | | { |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | fis.close(); |
| | | inputStreamOpen = false; |
| | | |
| | | if(deleteOriginal) |
| | | if(deleteOriginal && !originalFile.delete()) |
| | | { |
| | | if(!originalFile.delete()) |
| | | { |
| | | System.err.println("Cannot delete original file:" + originalFile); |
| | | return false; |
| | | } |
| | | System.err.println("Cannot delete original file:" + originalFile); |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.loggers; |
| | | |
| | |
| | | fis.close(); |
| | | inputStreamOpen = false; |
| | | |
| | | if(deleteOriginal) |
| | | if(deleteOriginal && !originalFile.delete()) |
| | | { |
| | | if(!originalFile.delete()) |
| | | { |
| | | System.err.println("Cannot delete original file:" + originalFile); |
| | | return false; |
| | | } |
| | | System.err.println("Cannot delete original file:" + originalFile); |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | |
| | | */ |
| | | final DN authDN = extendedOperation.getAuthorizationDN(); |
| | | final DN sambaAdminDN = config.getSambaAdministratorDN(); |
| | | if (sambaAdminDN != null && !sambaAdminDN.isRootDN()) |
| | | if (sambaAdminDN != null |
| | | && !sambaAdminDN.isRootDN() |
| | | && authDN.equals(sambaAdminDN)) |
| | | { |
| | | if (authDN.equals(sambaAdminDN)) |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | logger.trace("This operation will be skipped because" |
| | | + " it was performed by Samba admin user: " + sambaAdminDN); |
| | | } |
| | | return PluginResult.PostOperation.continueOperationProcessing(); |
| | | logger.trace("This operation will be skipped because" |
| | | + " it was performed by Samba admin user: " + sambaAdminDN); |
| | | } |
| | | return PluginResult.PostOperation.continueOperationProcessing(); |
| | | } |
| | | |
| | | // Get the name of the entry and clear passwords from the operation |
| | |
| | | */ |
| | | final DN authDN = modifyOperation.getAuthorizationDN(); |
| | | final DN sambaAdminDN = config.getSambaAdministratorDN(); |
| | | if (sambaAdminDN != null && !sambaAdminDN.isRootDN()) |
| | | if (sambaAdminDN != null |
| | | && !sambaAdminDN.isRootDN() |
| | | && authDN.equals(sambaAdminDN)) |
| | | { |
| | | if (authDN.equals(sambaAdminDN)) |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | logger.trace("This operation will be skipped because" |
| | | + " it was performed by Samba admin user: " + sambaAdminDN); |
| | | } |
| | | return PluginResult.PreOperation.continueOperationProcessing(); |
| | | logger.trace("This operation will be skipped because" |
| | | + " it was performed by Samba admin user: " + sambaAdminDN); |
| | | } |
| | | return PluginResult.PreOperation.continueOperationProcessing(); |
| | | } |
| | | |
| | | /* |
| | |
| | | operationsPerformed.incrementAndGet(); |
| | | |
| | | final Operation operation = previousValue.operation; |
| | | if (operation.getOperationType() == OperationType.ABANDON) |
| | | if (operation.getOperationType() == OperationType.ABANDON |
| | | && keepStats |
| | | && operation.getResultCode() == ResultCode.CANCELLED) |
| | | { |
| | | if (keepStats && operation.getResultCode() == ResultCode.CANCELLED) |
| | | { |
| | | statTracker.updateAbandonedOperation(); |
| | | } |
| | | statTracker.updateAbandonedOperation(); |
| | | } |
| | | } |
| | | return previousValue != null; |
| | |
| | | } |
| | | } |
| | | |
| | | if (config.isEnabled()) |
| | | if (config.isEnabled() && config.isUseSSL()) |
| | | { |
| | | // Check that the SSL configuration is valid. |
| | | if (config.isUseSSL()) |
| | | try |
| | | { |
| | | try |
| | | { |
| | | createSSLEngineConfigurator(config); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | logger.traceException(e); |
| | | createSSLEngineConfigurator(config); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | unacceptableReasons.add(e.getMessageObject()); |
| | | return false; |
| | | } |
| | | unacceptableReasons.add(e.getMessageObject()); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | if (operation.getOperationType() == OperationType.ABANDON) |
| | | if (operation.getOperationType() == OperationType.ABANDON |
| | | && keepStats |
| | | && operation.getResultCode() == ResultCode.CANCELLED) |
| | | { |
| | | if (keepStats && operation.getResultCode() == ResultCode.CANCELLED) |
| | | { |
| | | statTracker.updateAbandonedOperation(); |
| | | } |
| | | statTracker.updateAbandonedOperation(); |
| | | } |
| | | |
| | | lastCompletionTime.set(TimeThread.getTime()); |
| | |
| | | // * num request handler |
| | | |
| | | // Clear the stat tracker if LDAPv2 is being enabled. |
| | | if (currentConfig.isAllowLDAPV2() != config.isAllowLDAPV2()) |
| | | if (currentConfig.isAllowLDAPV2() != config.isAllowLDAPV2() |
| | | && config.isAllowLDAPV2()) |
| | | { |
| | | if (config.isAllowLDAPV2()) |
| | | { |
| | | statTracker.clearStatistics(); |
| | | } |
| | | statTracker.clearStatistics(); |
| | | } |
| | | |
| | | // Apply the changes. |
| | |
| | | } |
| | | } |
| | | |
| | | if (config.isEnabled()) |
| | | if (config.isEnabled() |
| | | // Check that the SSL configuration is valid. |
| | | && (config.isUseSSL() || config.isAllowStartTLS())) |
| | | { |
| | | // Check that the SSL configuration is valid. |
| | | if (config.isUseSSL() || config.isAllowStartTLS()) |
| | | try |
| | | { |
| | | try |
| | | { |
| | | SSLContext sslContext = createSSLContext(config); |
| | | createSSLEngine(config, sslContext); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | logger.traceException(e); |
| | | createSSLEngine(config, createSSLContext(config)); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | unacceptableReasons.add(e.getMessageObject()); |
| | | return false; |
| | | } |
| | | unacceptableReasons.add(e.getMessageObject()); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | |
| | | "was sent at %d", now, session.getLastPublishTime()); |
| | | } |
| | | |
| | | if (now > session.getLastPublishTime() + heartbeatInterval) |
| | | if (now > session.getLastPublishTime() + heartbeatInterval |
| | | && !heartbeatsDisabled) |
| | | { |
| | | if (!heartbeatsDisabled) |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | logger.trace("Heartbeat sent at %d", now); |
| | | } |
| | | session.publish(heartbeatMessage); |
| | | logger.trace("Heartbeat sent at %d", now); |
| | | } |
| | | session.publish(heartbeatMessage); |
| | | } |
| | | |
| | | long sleepTime = session.getLastPublishTime() + heartbeatInterval - now; |
| | |
| | | * |
| | | * |
| | | * Copyright 2009-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | { |
| | | Attribute attr = mod.getAttribute(); |
| | | AttributeType type = attr.getAttributeType(); |
| | | if (type != null ) |
| | | if (type != null |
| | | && AttributeUsage.DSA_OPERATION.equals(type.getUsage()) ) |
| | | { |
| | | if (AttributeUsage.DSA_OPERATION.equals(type.getUsage())) |
| | | { |
| | | // Attributes with a dsaOperation usage should not be synchronized. |
| | | // skip them. |
| | | continue; |
| | | } |
| | | // Attributes with a dsaOperation usage should not be synchronized. |
| | | // skip them. |
| | | continue; |
| | | } |
| | | |
| | | if (!EntryHistorical.isHistoricalAttribute(attr)) |
| | |
| | | for (int serverId : serverIds) |
| | | { |
| | | boolean ackReceived = expectedServersAckStatus.get(serverId); |
| | | if (!ackReceived) |
| | | if (!ackReceived && !failedServers.contains(serverId)) |
| | | { |
| | | if (!failedServers.contains(serverId)) |
| | | { |
| | | failedServers.add(serverId); |
| | | serversInTimeout.add(serverId); |
| | | } |
| | | failedServers.add(serverId); |
| | | serversInTimeout.add(serverId); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | private void createRootDirIfNotExists() throws ChangelogException |
| | | { |
| | | if (!logPath.exists()) |
| | | if (!logPath.exists() && !logPath.mkdirs()) |
| | | { |
| | | if (!logPath.mkdirs()) |
| | | { |
| | | throw new ChangelogException(ERR_CHANGELOG_UNABLE_TO_CREATE_LOG_DIRECTORY.get(logPath.getPath())); |
| | | } |
| | | throw new ChangelogException(ERR_CHANGELOG_UNABLE_TO_CREATE_LOG_DIRECTORY.get(logPath.getPath())); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | // If the incremental base ID was specified, then make sure it is an |
| | | // incremental backup. |
| | | if (incrementalBase != null) |
| | | if (incrementalBase != null && ! incremental) |
| | | { |
| | | if (! incremental) |
| | | { |
| | | logger.error(ERR_BACKUPDB_INCREMENTAL_BASE_REQUIRES_INCREMENTAL, ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID, |
| | | ATTR_TASK_BACKUP_INCREMENTAL); |
| | | return false; |
| | | } |
| | | logger.error(ERR_BACKUPDB_INCREMENTAL_BASE_REQUIRES_INCREMENTAL, ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID, |
| | | ATTR_TASK_BACKUP_INCREMENTAL); |
| | | return false; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | // If the incremental base ID was specified, then make sure it is an |
| | | // incremental backup. |
| | | if (incrementalBaseID.isPresent()) |
| | | if (incrementalBaseID.isPresent() && ! incremental.isPresent()) |
| | | { |
| | | if (! incremental.isPresent()) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_BACKUPDB_INCREMENTAL_BASE_REQUIRES_INCREMENTAL.get( |
| | | incrementalBaseID.getLongIdentifier(), |
| | | incremental.getLongIdentifier()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | err.println(argParser.getUsage()); |
| | | return 1; |
| | | } |
| | | LocalizableMessage message = |
| | | ERR_BACKUPDB_INCREMENTAL_BASE_REQUIRES_INCREMENTAL.get( |
| | | incrementalBaseID.getLongIdentifier(), |
| | | incremental.getLongIdentifier()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | err.println(argParser.getUsage()); |
| | | return 1; |
| | | } |
| | | |
| | | // Encryption or signing requires the ADS backend be available for |
| | |
| | | } |
| | | |
| | | // Check that the keystore path values are valid. |
| | | if (keyManagerPath.isPresent()) |
| | | if (keyManagerPath.isPresent() && !keyManagerProviderDN.isPresent()) |
| | | { |
| | | if (!keyManagerProviderDN.isPresent()) |
| | | { |
| | | LocalizableMessage message = ERR_CONFIGDS_KEYMANAGER_PROVIDER_DN_REQUIRED.get( |
| | | keyManagerProviderDN.getLongIdentifier(), |
| | | keyManagerPath.getLongIdentifier()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | LocalizableMessage message = ERR_CONFIGDS_KEYMANAGER_PROVIDER_DN_REQUIRED.get( |
| | | keyManagerProviderDN.getLongIdentifier(), keyManagerPath.getLongIdentifier()); |
| | | err.println(wrapText(message, MAX_LINE_WIDTH)); |
| | | return 1; |
| | | } |
| | | |
| | | // If one or more base DNs were specified, then update the config |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013-2014 ForgeRock AS |
| | | * Portions Copyright 2013-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools; |
| | | |
| | |
| | | // and append data to it. |
| | | RandomAccessFile outputFile = null; |
| | | long outputFileOffset = 0L; |
| | | if (logFile != null) |
| | | if (logFile != null && outputFilePath.isPresent()) |
| | | { |
| | | if (outputFilePath.isPresent()) |
| | | try |
| | | { |
| | | try |
| | | File f = new File(outputFilePath.getValue()); |
| | | if (f.exists()) |
| | | { |
| | | File f = new File(outputFilePath.getValue()); |
| | | if (f.exists()) |
| | | { |
| | | outputFile = new RandomAccessFile(f, "rw"); |
| | | outputFileOffset = outputFile.length(); |
| | | outputFile.seek(outputFileOffset); |
| | | } |
| | | outputFile = new RandomAccessFile(f, "rw"); |
| | | outputFileOffset = outputFile.length(); |
| | | outputFile.seek(outputFileOffset); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | println(WARN_WAIT4DEL_CANNOT_OPEN_OUTPUT_FILE.get(outputFilePath.getValue(), e)); |
| | | outputFile = null; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | println(WARN_WAIT4DEL_CANNOT_OPEN_OUTPUT_FILE.get(outputFilePath.getValue(), e)); |
| | | outputFile = null; |
| | | } |
| | | } |
| | | // Figure out when to stop waiting. |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.makeldif; |
| | | |
| | |
| | | throw ioException; |
| | | } |
| | | |
| | | if ((entryBytes == null) || (! entryBytes.hasRemaining())) |
| | | if ((entryBytes == null || !entryBytes.hasRemaining()) |
| | | && !getNextEntry()) |
| | | { |
| | | if (! getNextEntry()) |
| | | { |
| | | closed = true; |
| | | return -1; |
| | | } |
| | | closed = true; |
| | | return -1; |
| | | } |
| | | |
| | | return (0xFF & entryBytes.get()); |
| | |
| | | throw ioException; |
| | | } |
| | | |
| | | if ((entryBytes == null) || (! entryBytes.hasRemaining())) |
| | | if ((entryBytes == null || !entryBytes.hasRemaining()) |
| | | && !getNextEntry()) |
| | | { |
| | | if (! getNextEntry()) |
| | | { |
| | | closed = true; |
| | | return -1; |
| | | } |
| | | closed = true; |
| | | return -1; |
| | | } |
| | | |
| | | int bytesRead = Math.min(len, entryBytes.remaining()); |
| | |
| | | |
| | | for (TemplateLine l : templateLines) |
| | | { |
| | | if (rdnAttrs.remove(l.getAttributeType())) |
| | | if (rdnAttrs.remove(l.getAttributeType()) |
| | | && rdnAttrs.isEmpty()) |
| | | { |
| | | if (rdnAttrs.isEmpty()) |
| | | { |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | synchronized (target) |
| | | { |
| | | if (target.exists()) |
| | | if (target.exists() && !target.delete()) |
| | | { |
| | | if (!target.delete()) |
| | | { |
| | | throw new IOException(INFO_ERROR_DELETING_FILE.get( |
| | | UpgradeUtils.getPath(target)).toString()); |
| | | } |
| | | throw new IOException(INFO_ERROR_DELETING_FILE.get( |
| | | UpgradeUtils.getPath(target)).toString()); |
| | | } |
| | | } |
| | | if (!fileToRename.renameTo(target)) |
| | |
| | | { |
| | | fos.write(buf, 0, i); |
| | | } |
| | | if (destination.exists()) |
| | | if (destination.exists() && isUnix()) |
| | | { |
| | | // TODO: set the file's permissions. This is made easier in |
| | | // Java 1.6 but until then use the TestUtilities methods |
| | | if (isUnix()) |
| | | { |
| | | final FilePermission permissions = |
| | | getFileSystemPermissions(objectFile); |
| | | FilePermission.setPermissions(destination, permissions); |
| | | } |
| | | final FilePermission permissions = getFileSystemPermissions(objectFile); |
| | | FilePermission.setPermissions(destination, permissions); |
| | | } |
| | | } |
| | | catch (IOException e) |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | |
| | | AttributeType superiorType) |
| | | { |
| | | List<AttributeType> subTypes = subordinateTypes.get(superiorType); |
| | | if (subTypes != null) |
| | | if (subTypes != null && subTypes.remove(attributeType)) |
| | | { |
| | | if (subTypes.remove(attributeType)) |
| | | AttributeType higherSuperior = superiorType.getSuperiorType(); |
| | | if (higherSuperior != null) |
| | | { |
| | | AttributeType higherSuperior = superiorType.getSuperiorType(); |
| | | if (higherSuperior != null) |
| | | { |
| | | deregisterSubordinateType(attributeType, higherSuperior); |
| | | } |
| | | deregisterSubordinateType(attributeType, higherSuperior); |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | synchronized (ldapSyntaxDescriptions) |
| | | { |
| | | String oid = toLowerCase( |
| | | syntax.getLdapSyntaxDescriptionSyntax().getOID()); |
| | | if (! overwriteExisting) |
| | | String oid = toLowerCase(syntax.getLdapSyntaxDescriptionSyntax().getOID()); |
| | | if (! overwriteExisting && ldapSyntaxDescriptions.containsKey(oid)) |
| | | { |
| | | if (ldapSyntaxDescriptions.containsKey(oid)) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_SCHEMA_MODIFY_MULTIPLE_CONFLICTS_FOR_ADD_LDAP_SYNTAX. |
| | | get(oid); |
| | | throw new DirectoryException( |
| | | ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, |
| | | ERR_SCHEMA_MODIFY_MULTIPLE_CONFLICTS_FOR_ADD_LDAP_SYNTAX.get(oid)); |
| | | } |
| | | |
| | | ldapSyntaxDescriptions.put(oid, syntax); |
| | |
| | | //Register the attribute syntax with the schema. It will ensure |
| | | // syntax is available along with the other virtual values for |
| | | // ldapsyntaxes. |
| | | registerSyntax(syntax.getLdapSyntaxDescriptionSyntax(), |
| | | overwriteExisting); |
| | | registerSyntax(syntax.getLdapSyntaxDescriptionSyntax(), overwriteExisting); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | MatchingRule matchingRule = matchingRuleUse.getMatchingRule(); |
| | | |
| | | if (! overwriteExisting) |
| | | if (!overwriteExisting && matchingRuleUses.containsKey(matchingRule)) |
| | | { |
| | | if (matchingRuleUses.containsKey(matchingRule)) |
| | | { |
| | | MatchingRuleUse conflictingUse = |
| | | matchingRuleUses.get(matchingRule); |
| | | MatchingRuleUse conflictingUse = matchingRuleUses.get(matchingRule); |
| | | |
| | | LocalizableMessage message = ERR_SCHEMA_CONFLICTING_MATCHING_RULE_USE. |
| | | get(matchingRuleUse.getNameOrOID(), |
| | | matchingRule.getNameOrOID(), |
| | | conflictingUse.getNameOrOID()); |
| | | throw new DirectoryException( |
| | | ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | LocalizableMessage message = ERR_SCHEMA_CONFLICTING_MATCHING_RULE_USE. |
| | | get(matchingRuleUse.getNameOrOID(), |
| | | matchingRule.getNameOrOID(), |
| | | conflictingUse.getNameOrOID()); |
| | | throw new DirectoryException( |
| | | ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | matchingRuleUses.put(matchingRule, matchingRuleUse); |
| | |
| | | { |
| | | ObjectClass objectClass = ditContentRule.getStructuralClass(); |
| | | |
| | | if (! overwriteExisting) |
| | | if (! overwriteExisting && ditContentRules.containsKey(objectClass)) |
| | | { |
| | | if (ditContentRules.containsKey(objectClass)) |
| | | { |
| | | DITContentRule conflictingRule = |
| | | ditContentRules.get(objectClass); |
| | | DITContentRule conflictingRule = |
| | | ditContentRules.get(objectClass); |
| | | |
| | | LocalizableMessage message = ERR_SCHEMA_CONFLICTING_DIT_CONTENT_RULE. |
| | | get(ditContentRule.getNameOrOID(), |
| | | objectClass.getNameOrOID(), |
| | | conflictingRule.getNameOrOID()); |
| | | throw new DirectoryException( |
| | | ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | LocalizableMessage message = ERR_SCHEMA_CONFLICTING_DIT_CONTENT_RULE. |
| | | get(ditContentRule.getNameOrOID(), |
| | | objectClass.getNameOrOID(), |
| | | conflictingRule.getNameOrOID()); |
| | | throw new DirectoryException( |
| | | ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | ditContentRules.put(objectClass, ditContentRule); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | * Portions Copyright 2013-2014 Manuel Gaupp |
| | | */ |
| | | package org.opends.server.types; |
| | |
| | | { |
| | | MatchingRuleUse mru = |
| | | DirectoryServer.getMatchingRuleUse(matchingRule); |
| | | if (mru != null) |
| | | if (mru != null && !mru.appliesToAttribute(attributeType)) |
| | | { |
| | | if (! mru.appliesToAttribute(attributeType)) |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | logger.trace( |
| | | "Attribute type %s is not allowed for use with " + |
| | | "matching rule %s because of matching rule use " + |
| | | "definition %s", attributeType.getNameOrOID(), |
| | | matchingRule.getNameOrOID(), mru.getNameOrOID()); |
| | | } |
| | | return ConditionResult.UNDEFINED; |
| | | logger.trace( |
| | | "Attribute type %s is not allowed for use with " + |
| | | "matching rule %s because of matching rule use " + |
| | | "definition %s", attributeType.getNameOrOID(), |
| | | matchingRule.getNameOrOID(), mru.getNameOrOID()); |
| | | } |
| | | return ConditionResult.UNDEFINED; |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | //The attribute is not being ignored so check for binary option. |
| | | if(checkSchema && !attrType.getSyntax().isBEREncodingRequired()) |
| | | if(checkSchema |
| | | && !attrType.getSyntax().isBEREncodingRequired() |
| | | && attribute.hasOption("binary")) |
| | | { |
| | | if(attribute.hasOption("binary")) |
| | | { |
| | | LocalizableMessage message = ERR_LDIF_INVALID_ATTR_OPTION.get( |
| | | entryDN, lastEntryLineNumber, attrName); |
| | | logToRejectWriter(lines, message); |
| | | throw new LDIFException(message, lastEntryLineNumber,true); |
| | | } |
| | | LocalizableMessage message = ERR_LDIF_INVALID_ATTR_OPTION.get( |
| | | entryDN, lastEntryLineNumber, attrName); |
| | | logToRejectWriter(lines, message); |
| | | throw new LDIFException(message, lastEntryLineNumber,true); |
| | | } |
| | | if (checkSchema && |
| | | (DirectoryServer.getSyntaxEnforcementPolicy() != |
| | |
| | | { |
| | | synchronized(target) |
| | | { |
| | | if (target.exists()) |
| | | if (target.exists() && !target.delete()) |
| | | { |
| | | if (!target.delete()) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_RENAMEFILE_CANNOT_DELETE_TARGET.get(target.getPath()); |
| | | throw new IOException(message.toString()); |
| | | } |
| | | LocalizableMessage message = |
| | | ERR_RENAMEFILE_CANNOT_DELETE_TARGET.get(target.getPath()); |
| | | throw new IOException(message.toString()); |
| | | } |
| | | } |
| | | if (!fileToRename.renameTo(target)) |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS. |
| | | * Portions Copyright 2011-2015 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.workflowelement.localbackend; |
| | | |
| | |
| | | if (DirectoryServer.lockdownMode()) |
| | | { |
| | | ResultCode resultCode = getResultCode(); |
| | | if (resultCode != ResultCode.SASL_BIND_IN_PROGRESS) |
| | | if (resultCode != ResultCode.SASL_BIND_IN_PROGRESS |
| | | && (resultCode != ResultCode.SUCCESS |
| | | || saslAuthUserEntry == null |
| | | || !ClientConnection.hasPrivilege(saslAuthUserEntry, Privilege.BYPASS_LOCKDOWN))) |
| | | { |
| | | if ((resultCode != ResultCode.SUCCESS) || |
| | | (saslAuthUserEntry == null) || |
| | | (! ClientConnection.hasPrivilege(saslAuthUserEntry, |
| | | Privilege.BYPASS_LOCKDOWN))) |
| | | { |
| | | throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, |
| | | ERR_BIND_REJECTED_LOCKDOWN_MODE.get()); |
| | | } |
| | | throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, |
| | | ERR_BIND_REJECTED_LOCKDOWN_MODE.get()); |
| | | } |
| | | } |
| | | |
| | |
| | | PasswordPolicyState pwPolicyState = |
| | | (PasswordPolicyState) authPolicyState; |
| | | |
| | | if (saslHandler.isPasswordBased(saslMechanism)) |
| | | if (saslHandler.isPasswordBased(saslMechanism) |
| | | && pwPolicyState.getAuthenticationPolicy().getLockoutFailureCount() > 0) |
| | | { |
| | | if (pwPolicyState.getAuthenticationPolicy() |
| | | .getLockoutFailureCount() > 0) |
| | | { |
| | | generateAccountStatusNotificationForLockedBindAccount( |
| | | saslAuthUserEntry, pwPolicyState); |
| | | } |
| | | generateAccountStatusNotificationForLockedBindAccount( |
| | | saslAuthUserEntry, pwPolicyState); |
| | | } |
| | | } |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2014 ForgeRock AS |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.workflowelement.localbackend; |
| | | |
| | |
| | | } |
| | | |
| | | // NYI -- Add support for additional controls. |
| | | else if (c.isCritical()) |
| | | else if (c.isCritical() |
| | | && (backend == null || !backend.supportsControl(oid))) |
| | | { |
| | | if ((backend == null) || (! backend.supportsControl(oid))) |
| | | { |
| | | throw new DirectoryException( |
| | | ResultCode.UNAVAILABLE_CRITICAL_EXTENSION, |
| | | ERR_COMPARE_UNSUPPORTED_CRITICAL_CONTROL.get(entryDN, oid)); |
| | | } |
| | | throw new DirectoryException( |
| | | ResultCode.UNAVAILABLE_CRITICAL_EXTENSION, |
| | | ERR_COMPARE_UNSUPPORTED_CRITICAL_CONTROL.get(entryDN, oid)); |
| | | } |
| | | } |
| | | } |