/** * Get instance level preferences */ public Map<String, String> getProperties() { return getConfigProperties(new InstanceId("")); }
/** * Set instance level preferences */ public void setProperties(Map<String, String> propMap) throws NotFoundException, ProfileConflictException, BadRequestException { setConfig(new InstanceId(""), propMap); }
/** * Delete instance level preferences */ public void deleteProperties() { deleteConfig(new InstanceId("")); }
/** * Get instance level resolved preferences */ public Map<String, String> getResolvedProperties() { return getConfigResolvedProperties(new InstanceId("")); }
/** * Get instance level preferences */ public Map<String, String> getProperties() { return getConfigProperties(new InstanceId("")); }
/** * Delete instance level preferences */ public void deleteProperties() { deleteConfig(new InstanceId("")); }
@SuppressWarnings("unused") public static InstanceId fromIdParts(Iterable<String> idString) { Iterator<String> iterator = idString.iterator(); return new InstanceId(nextAndEnd(iterator, "instance")); }
/** * Get instance level resolved preferences */ public Map<String, String> getResolvedProperties() { return getConfigResolvedProperties(new InstanceId("")); }
@SuppressWarnings("unused") public static InstanceId fromIdParts(Iterable<String> idString) { Iterator<String> iterator = idString.iterator(); return new InstanceId(nextAndEnd(iterator, "instance")); }
/** * Set instance level preferences */ public void setProperties(Map<String, String> propMap) throws NotFoundException, ProfileConflictException, BadRequestException { setConfig(new InstanceId(""), propMap); }
InstanceId instanceId = new InstanceId("");
InstanceId instanceId = new InstanceId("");
/** * Get the resolved preferences for the entity id, the preferences are resolved from instance -> namespace -> app * -> program level * * @param entityId the entity id to get the preferences from * @return the map which contains the preferences */ public Map<String, String> getResolvedPreferences(EntityId entityId) { // if it is instance level get the properties and return if (entityId.getEntityType().equals(EntityType.INSTANCE)) { return getPreferences(entityId); } Map<String, String> properties = new HashMap<>(); // if the entity id has a parent id, get the preference from its parent if (entityId instanceof ParentedId) { properties.putAll(getResolvedPreferences(((ParentedId) entityId).getParent())); } else if (entityId.getEntityType() == EntityType.NAMESPACE) { // otherwise it is a namespace id, which we want to look at the instance level properties.putAll(getResolvedPreferences(new InstanceId(""))); } // put the current level property properties.putAll(getPreferences(entityId)); return properties; }
/** * Get the resolved preferences for the entity id, the preferences are resolved from instance -> namespace -> app * -> program level * * @param entityId the entity id to get the preferences from * @return the map which contains the preferences */ public Map<String, String> getResolvedPreferences(EntityId entityId) { // if it is instance level get the properties and return if (entityId.getEntityType().equals(EntityType.INSTANCE)) { return getPreferences(entityId); } Map<String, String> properties = new HashMap<>(); // if the entity id has a parent id, get the preference from its parent if (entityId instanceof ParentedId) { properties.putAll(getResolvedPreferences(((ParentedId) entityId).getParent())); } else if (entityId.getEntityType() == EntityType.NAMESPACE) { // otherwise it is a namespace id, which we want to look at the instance level properties.putAll(getResolvedPreferences(new InstanceId(""))); } // put the current level property properties.putAll(getPreferences(entityId)); return properties; }
InstanceId instance = new InstanceId(cConf.get(Constants.INSTANCE_NAME)); Principal principal = new Principal(System.getProperty("user.name"), Principal.PrincipalType.USER); authorizerInstantiator.get().grant(Authorizable.fromEntityId(instance), principal, ImmutableSet.of(Action.ADMIN));
InstanceId instance = new InstanceId(cConf.get(Constants.INSTANCE_NAME)); Principal principal = new Principal(System.getProperty("user.name"), Principal.PrincipalType.USER); authorizerInstantiator.get().grant(Authorizable.fromEntityId(instance), principal, ImmutableSet.of(Action.ADMIN));
expected.add(new InstanceId("")); expected.add(NamespaceId.DEFAULT); expected.add(myApp);
@Test @SuppressWarnings("unchecked") public void testExists() throws NotFoundException { existenceVerifier.ensureExists(new InstanceId(EXISTS)); existenceVerifier.ensureExists(NAMESPACE); existenceVerifier.ensureExists(ARTIFACT); ApplicationId app = NAMESPACE.app(AllProgramsApp.NAME); existenceVerifier.ensureExists(app); existenceVerifier.ensureExists(app.mr(AllProgramsApp.NoOpMR.NAME)); existenceVerifier.ensureExists(NAMESPACE.dataset(AllProgramsApp.DATASET_NAME)); }
@Test public void testDoesNotExist() { assertDoesNotExist(new InstanceId(DOES_NOT_EXIST)); assertDoesNotExist(new NamespaceId(DOES_NOT_EXIST)); assertDoesNotExist(NamespaceId.DEFAULT.artifact(DOES_NOT_EXIST, "1.0")); ApplicationId app = NamespaceId.DEFAULT.app(AllProgramsApp.NAME); assertDoesNotExist(NamespaceId.DEFAULT.app(DOES_NOT_EXIST)); assertDoesNotExist(app.mr(DOES_NOT_EXIST)); assertDoesNotExist(NamespaceId.DEFAULT.dataset(DOES_NOT_EXIST)); }
InstanceId instanceId = new InstanceId(""); ApplicationId myApp = NamespaceId.DEFAULT.app("myApp"); ProgramId myProgram = myApp.workflow("myProgram");