/*
(non-Javadoc)
@see
org.fcrepo.server.security.xacml.pdp.data.PolicyDataManager#getPolicy
(java.lang.String)
760817
@Override
    public AbstractPolicy getPolicy(String name, PolicyFinder policyFinder) throws PolicyIndexException {
        log.debug("Getting document: " + name);
        XmlDocument doc = null;
        DbXmlManager.readLock.lock();
        try {
            doc = m_dbXmlManager.container.getDocument(name);
            return handleDocument(m_policyReader.readPolicy(doc.getContent()), policyFinder);
        } catch (XmlException xe) {
            throw new PolicyIndexException("Error getting Policy: " + name + xe.getMessage()  + " - " + xe.getDatabaseException().getMessage(), xe);
        } catch (ParsingException pe) {
            throw new PolicyIndexException("Error getting Policy: " + name + pe.getMessage(), pe);
        } finally {
            DbXmlManager.readLock.unlock();
        }
    }
34098
@Override
    public boolean deletePolicy(String name) throws PolicyIndexException {

        writeLock.lock();
        try {
            logger.debug("Deleting policy named: " + name);
            return doDelete(name);
        } finally {
            writeLock.unlock();
        }
    }
952957
func (m *Manager) GetPolicy(id string) (policies.Policy, bool) {
	if m.PolicyMap != nil {
		policy, ok := m.PolicyMap[id]
		if ok {
			return policy, true
		}
	}
	return m.Policy, m.Policy != nil
}
460295
public static policydataset get(nitro_service service, String name) throws Exception{
		policydataset obj = new policydataset();
		obj.set_name(name);
		policydataset response = (policydataset) obj.get_resource(service);
		return response;
	}
952464
func (m *InMem) GetPolicy(name storage.CollectorSetName) (*policy.Policy, bool) {
	m.Lock()
	defer m.Unlock()

	p, ok := m.policies[name]

	return p, ok
}
1228472
public static cachepolicylabel[] get(nitro_service service) throws Exception{
		cachepolicylabel obj = new cachepolicylabel();
		cachepolicylabel[] response = (cachepolicylabel[])obj.get_resources(service);
		return response;
	}
1066028
public com.google.api.ads.admanager.axis.v201808.SecurityPolicyType getSecurityPolicyType() {
        return securityPolicyType;
    }
329881
func NewGetPolicy(ctx *middleware.Context, handler GetPolicyHandler) *GetPolicy {
	return &GetPolicy{Context: ctx, Handler: handler}
}
350028
public static appfwpolicy[] get(nitro_service service) throws Exception{
		appfwpolicy obj = new appfwpolicy();
		appfwpolicy[] response = (appfwpolicy[])obj.get_resources(service);
		return response;
	}
666983
static Policy getIamPolicySource(SourceName sourceName) {
    try (SecurityCenterClient client = SecurityCenterClient.create()) {
      // Start setting up a request to get IAM policy for a source.
      // SourceName sourceName = SourceName.of(/*organization=*/"123234324",/*source=*/
      // "423432321");
      GetIamPolicyRequest request =
          GetIamPolicyRequest.newBuilder().setResource(sourceName.toString()).build();

      // Call the API.
      Policy response = client.getIamPolicy(request);

      System.out.println("Policy: " + response);
      return response;
    } catch (IOException e) {
      throw new RuntimeException("Couldn't create client.", e);
    }
  }
458967
@Override
    public boolean updatePolicy(String name, String newDocument)
    throws PolicyStoreException {

        String pid = this.getPID(name);

        if (!contains(name)) {
            throw new PolicyStoreException("Update:  policy " + pid
                                                 + " not found");
        }

        if (datastreamControlGroup.equals("X")) {
            // inline, modify by value
            try {
                this.apiMService
                .modifyDatastreamByValue(getContext(),
                                         pid,
                                         FESL_POLICY_DATASTREAM,
                                         null,
                                         null,
                                         null,
                                         null,
                                         new ByteArrayInputStream(newDocument
                                                                  .getBytes("UTF-8")),
                                                                  "DISABLED",
                                                                  null,
                                                                  "Modifying policy " + pid,
                                                                  null);
            } catch (Exception e) {
                throw new PolicyStoreException("Update:  error modifying datastream by value for "
                                                     + pid
                                                     + " - "
                                                     + e.getMessage(),
                                                     e);
            }

        } else if (datastreamControlGroup.equals("M")) {
            // managed, generate temp location, modify by reference
            String dsLocation = null;
            try {
                ByteArrayInputStream is =
                    new ByteArrayInputStream(newDocument.getBytes("UTF-8"));
                dsLocation = apiMService.putTempStream(getContext(), is);
            } catch (Exception e) {
                throw new PolicyStoreException("Update: error generating temp datastream location - "
                                                     + e.getMessage(),
                                                     e);
            }
            try {
                apiMService.modifyDatastreamByReference(getContext(),
                                                        pid,
                                                        FESL_POLICY_DATASTREAM,
                                                        null,
                                                        null,
                                                        null,
                                                        null,
                                                        dsLocation,
                                                        "DISABLED",
                                                        null,
                                                        "Modifying policy "
                                                        + pid,
                                                        null);
            } catch (ServerException e) {
                throw new PolicyStoreException("Update:  error modifying datastream by reference for "
                                                     + pid
                                                     + " - "
                                                     + e.getMessage(),
                                                     e);
            }

        } else {
            throw new PolicyStoreException("Update:  Invalid datastream control group "
                                                 + datastreamControlGroup + " - use M or X");
        }

        return true;
    }
351200
public static dospolicy[] get(nitro_service service) throws Exception{
		dospolicy obj = new dospolicy();
		dospolicy[] response = (dospolicy[])obj.get_resources(service);
		return response;
	}
1130298
public java.util.List<PolicyDescription> getPolicyDescriptions() {
        if (policyDescriptions == null) {
            policyDescriptions = new com.amazonaws.internal.SdkInternalList<PolicyDescription>();
        }
        return policyDescriptions;
    }
309843
func (ps *PolicyStore) GetPolicy(ctx context.Context, name string, policyType PolicyType) (*Policy, error) {
	return ps.switchedGetPolicy(ctx, name, policyType, true)
}
22633
public com.google.iam.v1.PolicyDelta getPolicyDelta() {
    return policyDelta_ == null ? com.google.iam.v1.PolicyDelta.getDefaultInstance() : policyDelta_;
  }
1114565
public java.util.List<PolicyAttribute> getPolicyAttributes() {
        if (policyAttributes == null) {
            policyAttributes = new com.amazonaws.internal.SdkInternalList<PolicyAttribute>();
        }
        return policyAttributes;
    }
583948
@Override
    public Map<String, AbstractPolicy> getPolicies(EvaluationCtx eval, PolicyFinder policyFinder)
    throws PolicyIndexException {
        // no indexing, return everything
        // return a copy, otherwise the map could change during evaluation if policies are added, deleted etc
        readLock.lock();
        try {
            Map<String, AbstractPolicy> result = new ConcurrentHashMap<String, AbstractPolicy>();
            for(String id:policies.keySet()){
                AbstractPolicy policy = handleDocument(m_policyReader.readPolicy(policies.get(id)),policyFinder);
                result.put(id, policy);
            }
            return result;
        }
        catch (ParsingException pe) {
            throw new PolicyIndexException(pe.getMessage(),pe);
        }finally {
            readLock.unlock();
        }
    }