Examples of ProjectId


Examples of org.platformlayer.ids.ProjectId

  public void recordJobEnd(PlatformLayerKey jobKey, String executionId, Date endedAt, JobState state, String logCookie)
      throws RepositoryException {

    DbHelper db = new DbHelper();
    try {
      ProjectId project = jobKey.getProject();
      String jobId = jobKey.getItemIdString();

      int projectId = db.mapToValue(project);
      int updateCount = db.queries.updateExecution(logCookie, endedAt, state, projectId, jobId, executionId);
      if (updateCount != 1) {
View Full Code Here

Examples of org.platformlayer.ids.ProjectId

  @Override
  @JdbcTransaction
  public String insertExecution(PlatformLayerKey jobKey, Date startedAt) throws RepositoryException {
    DbHelper db = new DbHelper();
    try {
      ProjectId projectId = jobKey.getProject();
      String jobId = jobKey.getItemIdString();

      String executionId = UUID.randomUUID().toString();

      JobExecutionEntity execution = new JobExecutionEntity();
View Full Code Here

Examples of org.platformlayer.ids.ProjectId

  public ProjectContext() {
  }

  public ProjectId getProjectId() {
    ServiceConfiguration serviceConfiguration = OpsContext.get().getServiceConfiguration();
    ProjectId project = serviceConfiguration.getProject();

    PlatformLayerKey targetItemKey = opsContext.getJobRecord().getTargetItemKey();
    if (targetItemKey != null) {
      ProjectId project2 = targetItemKey.getProject();
      if (!project.equals(project2)) {
        // Not sure yet which one we should be using if these differ!
        throw new IllegalStateException();
      }
    }
View Full Code Here

Examples of org.platformlayer.ids.ProjectId

  public CertificateAndKey getProjectCredentials() throws OpsException {
    // OK... this is weird... we sign the project cert with the project cert.
    // It sort of makes sense, in that we don't want to share the project signing cert outside the auth server

    ProjectId projectId = getProjectId();

    KeyPair keyPair = privateData.findKeyPair(projectId, null, METADATA_PROJECT_KEY);
    List<X509Certificate> chain = privateData.findCertificate(projectId, null, METADATA_PROJECT_CERT);

    if (keyPair == null) {
      keyPair = RsaUtils.generateRsaKeyPair();
      privateData.putKeyPair(projectId, null, METADATA_PROJECT_KEY, keyPair);
    }

    if (chain == null) {
      AuthenticationTokenValidator authenticationTokenValidator = OpsContext.get().getInjector()
          .getInstance(AuthenticationTokenValidator.class);

      ProjectAuthorization projectAuthorization = Scope.get().get(ProjectAuthorization.class);
      String projectKey = projectAuthorization.getName();

      if (!projectKey.equals(projectId.getKey())) {
        throw new IllegalStateException();
      }

      PlatformLayerAuthAdminClient adminClient = PlatformLayerAuthAdminClient.find(authenticationTokenValidator);
      Csr csr = Csr.buildCsr(keyPair, getX500Principal());
      chain = adminClient.signCsr(projectId.getKey(), projectAuthorization.getProjectSecret(), csr.getEncoded());

      privateData.putCertificate(projectId, null, METADATA_PROJECT_CERT, chain);
    }

    // privateData.getOrCreate(projectId, null, sshKeyName, user)
View Full Code Here

Examples of org.platformlayer.ids.ProjectId

    MultitenantConfiguration multitenant = opsSystem.getMultitenantConfiguration();
    if (multitenant != null) {
      runAsProject = multitenant.getMasterProject();
    }

    ProjectId runAsProjectId = new ProjectId(runAsProject.getName());
    return runAsProjectId;
  }
View Full Code Here

Examples of org.platformlayer.ids.ProjectId

    if (multitenant != null) {
      ProjectAuthorization localProject = projectAuthz; // .getProject();
      TypedPlatformLayerClient localClient = buildClient(localProject);

      FederationKey host = FederationKey.LOCAL;
      ProjectId project = localClient.getProject();
      FederationMapping mapKey = new FederationMapping(host, project);

      federationMap.addMapping(mapKey, localClient);

      for (PlatformLayerKey mappedService : multitenant.getMappedItems()) {
        FederationMap.Rule rule = new FederationMap.Rule();
        rule.mappedItems = mappedService;
        rule.targetKey = mapKey;
        federationMap.addRule(rule);
      }
    }

    ProjectId runAsProjectId = new ProjectId(runAsProject.getName());

    PlatformLayerClient platformLayerClient;
    if (federationMap.isEmpty()) {
      platformLayerClient = defaultClient;
    } else {
View Full Code Here

Examples of org.platformlayer.ids.ProjectId

  public Class<?> getJavaClass(PlatformLayerKey key) {
    return opsSystem.getJavaClass(key);
  }

  private TypedPlatformLayerClient buildClient(ProjectAuthorization project) throws OpsException {
    ProjectId projectId = new ProjectId(project.getName());

    DirectAuthenticator directAuthenticator = buildDirectAuthenticator(project);
    // TODO: Introduce a direct client for "loopback" (normal) calls?
    String platformLayerUrl = OpsSystem.getPlatformLayerUrlBase();
    List<String> trustKeys = opsSystem.getServerTrustKeys();
View Full Code Here

Examples of org.platformlayer.ids.ProjectId

    String secret = config.secret;
    List<String> authTrustKeys = config.authTrustKeys;

    Authenticator authenticator = new PlatformlayerAuthenticator(httpStrategy, username, secret, server,
        authTrustKeys);
    ProjectId projectId = new ProjectId(project);

    return build(httpStrategy, config.platformlayerEndpoint, authenticator, projectId,
        config.platformlayerTrustKeys);
  }
View Full Code Here

Examples of org.platformlayer.ids.ProjectId

    ServiceType serviceType = new ServiceType(service.getServiceType());
    ItemType itemType = new ItemType(nodeName);

    FederationKey host = null;
    ProjectId project = null;
    return new PlatformLayerKey(host, project, serviceType, itemType, id);
  }
View Full Code Here

Examples of org.platformlayer.ids.ProjectId

    if (components.size() < 4) {
      throw new IllegalArgumentException();
    }

    String componentProject = components.get(0);
    ProjectId project = !Strings.isNullOrEmpty(componentProject) ? new ProjectId(componentProject) : null;

    String serviceComponent = components.get(1);
    ServiceType serviceType = !Strings.isNullOrEmpty(serviceComponent) ? new ServiceType(serviceComponent) : null;

    ItemType itemType = new ItemType(components.get(2));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.