Tabnine Logo
IllegalUpdateException.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.foilen.infra.plugin.v1.core.exception.IllegalUpdateException
constructor

Best Java code snippets using com.foilen.infra.plugin.v1.core.exception.IllegalUpdateException.<init> (Showing top 20 results out of 315)

origin: com.foilen/foilen-infra-plugin-core

public void resourceRefresh(Long resourceId) {
  if (resourceId == null) {
    throw new IllegalUpdateException("Cannot delete a resource without id");
  }
  if (!resourcesToRefresh.contains(resourceId)) {
    resourcesToRefresh.add(resourceId);
  }
}
origin: com.foilen/foilen-infra-plugins-core

private void validate(MariaDBDatabase resource) {
  if (blacklisted.contains(resource.getName().toLowerCase())) {
    throw new IllegalUpdateException("That database name is blacklisted");
  }
}
origin: com.foilen/foilen-infra-plugins-core

private void validate(MariaDBUser resource) {
  if (blacklisted.contains(resource.getName().toLowerCase())) {
    throw new IllegalUpdateException("That user name is blacklisted");
  }
}
origin: com.foilen/foilen-infra-plugin-core

public void resourceUpdate(Long resourceId, IPResource updatedResource) {
  if (resourceId == null) {
    throw new IllegalUpdateException("Cannot modify a resource without id");
  }
  // Remove previous update
  resourcesToUpdate.removeIf(it -> it.getA() == resourceId);
  resourcesToDelete.removeIf(it -> it == resourceId);
  resourcesToRefresh.removeIf(it -> it == resourceId);
  resourcesToUpdate.add(new Tuple2<>(resourceId, updatedResource));
}
origin: com.foilen/foilen-infra-plugins-core

throw new IllegalUpdateException("Can only use a single certificate");
throw new IllegalUpdateException("Can only use a single database server");
throw new IllegalUpdateException("Can only use a single database");
throw new IllegalUpdateException("Can only use a single database user");
throw new IllegalUpdateException("Can only use a single unix user");
MariaDBUser mariaDBUser = mariaDBUsers.get(0);
if (!resourceService.linkExistsByFromResourceAndLinkTypeAndToResource(mariaDBDatabase, LinkTypeConstants.INSTALLED_ON, mariaDBServer)) {
  throw new IllegalUpdateException("The database is not installed on the database server");
  throw new IllegalUpdateException("The database user is not an ADMIN on the database");
  throw new IllegalUpdateException("The database user is not a READER on the database");
  throw new IllegalUpdateException("The database user is not a WRITER on the database");
origin: com.foilen/foilen-infra-resource-infraconfig

throw new IllegalUpdateException("Can only use a single certificate");
throw new IllegalUpdateException("Can only use a single database server");
throw new IllegalUpdateException("Can only use a single database");
throw new IllegalUpdateException("Can only use a single database user");
throw new IllegalUpdateException("Can only use a single unix user");
MariaDBUser mariaDBUser = mariaDBUsers.get(0);
if (!resourceService.linkExistsByFromResourceAndLinkTypeAndToResource(mariaDBDatabase, LinkTypeConstants.INSTALLED_ON, mariaDBServer)) {
  throw new IllegalUpdateException("The database is not installed on the database server");
  throw new IllegalUpdateException("The database user is not an ADMIN on the database");
  throw new IllegalUpdateException("The database user is not a READER on the database");
  throw new IllegalUpdateException("The database user is not a WRITER on the database");
origin: com.foilen/foilen-infra-plugin-core

public void resourceDelete(Long resourceId) {
  if (resourceId == null) {
    throw new IllegalUpdateException("Cannot delete a resource without id");
  }
  resourcesToDelete.add(resourceId);
  // Remove in add and update
  Optional<IPResource> resourceOptional = resourceService.resourceFind(resourceId);
  if (resourceOptional.isPresent()) {
    IPResource resource = resourceOptional.get();
    resourcesToAdd.removeIf(it -> resourceService.resourceEqualsPk(resource, it));
  }
  resourcesToUpdate.removeIf(it -> it.getA() == resourceId);
}
origin: com.foilen/foilen-infra-plugins-core

private void checkUniqueName(CommonServicesContext services, String name) {
  IPResourceService resourceService = services.getResourceService();
  List<UnixUser> unixUsers = resourceService.resourceFindAll(resourceService.createResourceQuery(UnixUser.class) //
      .propertyEquals(UnixUser.PROPERTY_NAME, name));
  if (unixUsers.size() > 1) {
    throw new IllegalUpdateException("Unix User name " + name + " is already used");
  }
}
origin: com.foilen/foilen-infra-resource-unixuser

private void checkUniqueName(CommonServicesContext services, String name) {
  IPResourceService resourceService = services.getResourceService();
  List<UnixUser> unixUsers = resourceService.resourceFindAll(resourceService.createResourceQuery(UnixUser.class) //
      .propertyEquals(UnixUser.PROPERTY_NAME, name));
  if (unixUsers.size() > 1) {
    throw new IllegalUpdateException("Unix User name " + name + " is already used");
  }
}
origin: com.foilen/foilen-infra-plugins-core

@Override
protected void commonHandlerExecute(CommonServicesContext services, ChangesContext changes, CommonMethodUpdateEventHandlerContext<EmailDomain> context) {
  EmailDomain emailDomain = context.getResource();
  // Ensure all account names are unique per account and per redirection (can be shared)
  Set<String> accountNames = new HashSet<>();
  services.getResourceService().linkFindAllByFromResourceClassAndLinkTypeAndToResource(EmailAccount.class, LinkTypeConstants.INSTALLED_ON, emailDomain).forEach(account -> {
    if (!accountNames.add(account.getAccountName())) {
      throw new IllegalUpdateException("The email account [" + account.getAccountName() + "@" + emailDomain.getDomainName() + "] exists multiple times");
    }
  });
  accountNames.clear();
  services.getResourceService().linkFindAllByFromResourceClassAndLinkTypeAndToResource(EmailRedirection.class, LinkTypeConstants.INSTALLED_ON, emailDomain).forEach(redirection -> {
    if (!accountNames.add(redirection.getAccountName())) {
      throw new IllegalUpdateException("The email redirection [" + redirection.getAccountName() + "@" + emailDomain.getDomainName() + "] exists multiple times");
    }
  });
  // Ensure only linked to one EmailServer
  if (services.getResourceService().linkFindAllByFromResourceAndLinkTypeAndToResourceClass(emailDomain, LinkTypeConstants.INSTALLED_ON, EmailServer.class).size() > 1) {
    throw new IllegalUpdateException("The email domain [" + emailDomain.getDomainName() + "] is installed on more than one Email server");
  }
}
origin: com.foilen/foilen-infra-plugins-core

static protected void validate(CommonServicesContext services, DnsEntry dnsEntry) {
  if (!Strings.isNullOrEmpty(dnsEntry.getName())) {
    if (typesWithDomain.contains(dnsEntry.getType()) && !DomainValidator.getInstance().isValid(dnsEntry.getName())) {
      throw new IllegalUpdateException(services.getTranslationService().translate("error.notADomainName"));
    }
    if (strictTypesWithDomain.contains(dnsEntry.getType()) && !startWithLetterValidationRegex.matcher(dnsEntry.getName()).matches()) {
      throw new IllegalUpdateException(services.getTranslationService().translate("error.notStartingWithLetter"));
    }
    if (dnsEntry.getType() == DnsEntryType.A && !validIp(dnsEntry.getDetails())) {
      throw new IllegalUpdateException(services.getTranslationService().translate("error.notAnIp"));
    }
    if (dnsEntry.getName().contains(" ")) {
      throw new IllegalUpdateException(services.getTranslationService().translate("error.notADomainName"));
    }
  }
}
origin: com.foilen/foilen-infra-resource-dns

static protected void validate(CommonServicesContext services, DnsEntry dnsEntry) {
  if (!Strings.isNullOrEmpty(dnsEntry.getName())) {
    if (typesWithDomain.contains(dnsEntry.getType()) && !DomainValidator.getInstance().isValid(dnsEntry.getName())) {
      throw new IllegalUpdateException(services.getTranslationService().translate("error.notADomainName"));
    }
    if (strictTypesWithDomain.contains(dnsEntry.getType()) && !startWithLetterValidationRegex.matcher(dnsEntry.getName()).matches()) {
      throw new IllegalUpdateException(services.getTranslationService().translate("error.notStartingWithLetter"));
    }
    if (dnsEntry.getType() == DnsEntryType.A && !validIp(dnsEntry.getDetails())) {
      throw new IllegalUpdateException(services.getTranslationService().translate("error.notAnIp"));
    }
    if (dnsEntry.getName().contains(" ")) {
      throw new IllegalUpdateException(services.getTranslationService().translate("error.notADomainName"));
    }
  }
}
origin: com.foilen/foilen-infra-plugins-core

@Override
public void attachTo(AttachablePartContext context) {
  // Command
  IPApplicationDefinitionService service = new IPApplicationDefinitionService(name, command);
  service.setWorkingDirectory(workingDirectory);
  // Unix user
  List<UnixUser> unixUsers = context.getServices().getResourceService().linkFindAllByFromResourceAndLinkTypeAndToResourceClass(this, LinkTypeConstants.RUN_AS, UnixUser.class);
  if (unixUsers.size() > 1) {
    throw new IllegalUpdateException("Must have a singe unix user to run as. Got " + unixUsers.size());
  }
  if (!unixUsers.isEmpty()) {
    service.setRunAs(unixUsers.get(0).getId());
  }
  context.getApplicationDefinition().getServices().add(service);
}
origin: com.foilen/foilen-infra-plugins-core

@Override
public void attachTo(AttachablePartContext context) {
  // Get the MongoDBServer (fail if more than one)
  CommonServicesContext services = context.getServices();
  List<MongoDBServer> servers = services.getResourceService().linkFindAllByFromResourceAndLinkTypeAndToResourceClass(this, LinkTypeConstants.POINTS_TO, MongoDBServer.class);
  if (servers.size() > 1) {
    throw new IllegalUpdateException("There cannot be more than 1 MongoDB Server. Has " + servers.size());
  }
  if (servers.isEmpty()) {
    return;
  }
  MongoDBServer server = servers.get(0);
  // Get the Machines on the MongoDBServer
  List<Machine> machines = services.getResourceService().linkFindAllByFromResourceAndLinkTypeAndToResourceClass(server, LinkTypeConstants.INSTALLED_ON, Machine.class);
  if (machines.isEmpty()) {
    return;
  }
  // Add the infra on the Application
  Machine machine = machines.get(0);
  context.getApplicationDefinition().addPortRedirect(localPort, machine.getName(), server.getName(), "MONGODB_TCP");
}
origin: com.foilen/foilen-infra-plugins-core

@Override
public void attachTo(AttachablePartContext context) {
  // Get the PostgreSqlServer (fail if more than one)
  CommonServicesContext services = context.getServices();
  List<PostgreSqlServer> servers = services.getResourceService().linkFindAllByFromResourceAndLinkTypeAndToResourceClass(this, LinkTypeConstants.POINTS_TO, PostgreSqlServer.class);
  if (servers.size() > 1) {
    throw new IllegalUpdateException("There cannot be more than 1 PostgreSql Server. Has " + servers.size());
  }
  if (servers.isEmpty()) {
    return;
  }
  PostgreSqlServer server = servers.get(0);
  // Get the Machines on the PostgreSqlServer
  List<Machine> machines = services.getResourceService().linkFindAllByFromResourceAndLinkTypeAndToResourceClass(server, LinkTypeConstants.INSTALLED_ON, Machine.class);
  if (machines.isEmpty()) {
    return;
  }
  // Add the infra on the Application
  Machine machine = machines.get(0);
  context.getApplicationDefinition().addPortRedirect(localPort, machine.getName(), server.getName(), "POSTGRESQL_TCP");
}
origin: com.foilen/foilen-infra-plugins-core

@Override
public void attachTo(AttachablePartContext context) {
  // Get the MariaDBServer (fail if more than one)
  CommonServicesContext services = context.getServices();
  List<MariaDBServer> servers = services.getResourceService().linkFindAllByFromResourceAndLinkTypeAndToResourceClass(this, LinkTypeConstants.POINTS_TO, MariaDBServer.class);
  if (servers.size() > 1) {
    throw new IllegalUpdateException("There cannot be more than 1 MariaDB Server. Has " + servers.size());
  }
  if (servers.isEmpty()) {
    return;
  }
  MariaDBServer server = servers.get(0);
  // Get the Machines on the MariaDBServer
  List<Machine> machines = services.getResourceService().linkFindAllByFromResourceAndLinkTypeAndToResourceClass(server, LinkTypeConstants.INSTALLED_ON, Machine.class);
  if (machines.isEmpty()) {
    return;
  }
  // Add the infra on the Application
  Machine machine = machines.get(0);
  context.getApplicationDefinition().addPortRedirect(localPort, machine.getName(), server.getName(), DockerContainerEndpoints.MYSQL_TCP);
}
origin: com.foilen/foilen-infra-resource-application

throw new IllegalUpdateException("An application cannot have multiple users to run as (only 0 or 1)");
  for (Integer port : application.getApplicationDefinition().getPortsExposed().keySet()) {
    if (!endpointPorts.add(port)) {
      throw new IllegalUpdateException("The port " + port + " is exposed by many applications installed on " + installedOnMachine.getName());
origin: com.foilen/foilen-infra-plugins-core

throw new IllegalUpdateException("An application cannot have multiple users to run as (only 0 or 1)");
  for (Integer port : application.getApplicationDefinition().getPortsExposed().keySet()) {
    if (!endpointPorts.add(port)) {
      throw new IllegalUpdateException("The port " + port + " is exposed by many applications installed on " + installedOnMachine.getName());
origin: com.foilen/foilen-infra-plugins-core

@Override
protected void commonHandlerExecute(CommonServicesContext services, ChangesContext changes, CommonMethodUpdateEventHandlerContext<Machine> context) {
  Machine resource = context.getResource();
  if (context.getOldResource() != null && !StringTools.safeEquals(context.getOldResource().getName(), resource.getName())) {
    throw new IllegalUpdateException("You cannot change a Machine's name");
  }
  context.getManagedResourceTypes().add(DnsEntry.class);
  if (resource.getPublicIp() != null) {
    // Use a DnsEntry
    context.getManagedResources().add(new DnsEntry(resource.getName(), DnsEntryType.A, resource.getPublicIp()));
  }
}
origin: com.foilen/foilen-infra-resource-dns

@Override
protected void commonHandlerExecute(CommonServicesContext services, ChangesContext changes, CommonMethodUpdateEventHandlerContext<Machine> context) {
  Machine resource = context.getResource();
  if (context.getOldResource() != null && !StringTools.safeEquals(context.getOldResource().getName(), resource.getName())) {
    throw new IllegalUpdateException("You cannot change a Machine's name");
  }
  context.getManagedResourceTypes().add(DnsEntry.class);
  if (resource.getPublicIp() != null) {
    // Use a DnsEntry
    context.getManagedResources().add(new DnsEntry(resource.getName(), DnsEntryType.A, resource.getPublicIp()));
  }
}
com.foilen.infra.plugin.v1.core.exceptionIllegalUpdateException<init>

Popular methods of IllegalUpdateException

    Popular in Java

    • Making http post requests using okhttp
    • scheduleAtFixedRate (ScheduledExecutorService)
    • requestLocationUpdates (LocationManager)
    • onCreateOptionsMenu (Activity)
    • HttpServer (com.sun.net.httpserver)
      This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
    • BufferedImage (java.awt.image)
      The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
    • Socket (java.net)
      Provides a client-side TCP socket.
    • DecimalFormat (java.text)
      A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
    • TimeUnit (java.util.concurrent)
      A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
    • HttpServlet (javax.servlet.http)
      Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
    • Top Sublime Text plugins
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now