private ApplicationLink getApplicationLink(final ApplicationId id) { final ApplicationLink applicationLink; try { applicationLink = applicationLinkService.getApplicationLink(id); } catch (TypeNotInstalledException e) { throw new IllegalStateException(String.format( "Failed to load application link %s as type %s is no longer installed.", id, e.getType())); } return applicationLink; }
private void removeStaleInstances(final List<FishEyeInstance> upgradedInstances) { for (FishEyeInstance upgradedInstance : upgradedInstances) { try { ApplicationId applinkId = applicationLinkIdMapper.fromInstanceId(upgradedInstance.getId()); if (applinkId == null ) { log.info(format("Found old fisheye instance [%s] with no matching application id. Deleting...", upgradedInstance)); deleteInstance(upgradedInstance, "Stale fisheye instance"); continue; } ApplicationLink found = applicationLinkService.getApplicationLink(applinkId); if (found == null) { //this upgraded instance is stale - need to delete it as the corresponding applinks is gone log.info(format("Found old fisheye instance [%s] with no matching application link. Deleting...", upgradedInstance)); deleteInstance(upgradedInstance, "Stale fisheye instance"); continue; } } catch (TypeNotInstalledException e) { log.info(format("Error trying to match instance [%s] with : %s", upgradedInstance, e.getMessage())); //continue to next instance deleteInstance(upgradedInstance, "bad url syntax"); continue; } } }
try { if (typeAccessor.loadApplicationType(manifest.getTypeId()) == null) { throw new TypeNotInstalledException(manifest.getTypeId().get(), manifest.getName(), manifest.getUrl()); LOG.error("TypeNotInstalledException thrown", e); sendFailureEvent(FAILURE_REASON.TYPE_NOT_INSTALLED); return badRequest(String.format(i18nResolver.getText("applinks.error.remote.type.not.installed", e.getType())));
private InternalApplicationLink retrieveApplicationLink(final ApplicationId id) throws TypeNotInstalledException { final ApplicationLinkProperties properties = propertyService.getApplicationLinkProperties(Preconditions.checkNotNull(id)); TypeId typeId = properties.getType(); if (typeId == null) { LOG.warn("Couldn't find type id for application link with id {}. Link is corrupted", id.get()); throw new TypeNotInstalledException("unknown", properties.getName(), properties.getRpcUrl()); } final ApplicationType type = typeAccessor.loadApplicationType(typeId); if (type == null) { LOG.debug("Couldn't load type {} for application link with id {}, name {}, rpc.url {} . The type may not be installed.", new Object[]{typeId, id.get(), properties.getName(), properties.getRpcUrl()}); throw new TypeNotInstalledException(typeId.get(), properties.getName(), properties.getRpcUrl()); } return new DefaultApplicationLink(id, type, properties, requestFactoryFactory, eventPublisher); }
if (applicationType == null) { LOG.warn(String.format("Couldn't load type %s for application link. Type is not installed?", applicationLink.getTypeId())); throw new TypeNotInstalledException(applicationLink.getTypeId().get(), applicationLink.getName(), applicationLink.getRpcUrl());
public Response toResponse(final TypeNotInstalledException e) { return badRequest(i18nResolver.getText("applinks.type.not.installed", e.getType())); } }
if (applicationType == null) { LOG.warn(String.format("Couldn't load type %s for application link. Type is not installed?", applicationLink.getTypeId())); throw new TypeNotInstalledException(applicationLink.getTypeId().get(), applicationLink.getName(), applicationLink.getRpcUrl());
@Override public void addOrphanedTrustToApplicationLink(final String id, final OrphanedTrustCertificate.Type type, final ApplicationId applicationId) { checkCertificateType(type); try { ApplicationLink applicationLink = applicationLinkService.getApplicationLink(applicationId); trustConfigurator.issueInboundTrust(applicationLink); log.debug("Associated Trusted Apps configuration for Application Link id='" + applicationLink.getId() + "' and name='" + applicationLink.getName() + "'"); } catch (TypeNotInstalledException e) { throw new RuntimeException("An application of the type " + e.getType() + " is not installed!", e); } catch (TrustConfigurator.ConfigurationException e) { throw new RuntimeException("Failed to add Trusted Apps configuration for Application Link with id '" + applicationId + '"', e); } } }
LOG.warn("Couldn't load type {} for application link id {}, name {}, rpc.url {}. Type is not installed?", applicationLink.getTypeId(), applicationLink.getId(), applicationLink.getName(), applicationLink.getRpcUrl()); throw new TypeNotInstalledException(applicationLink.getTypeId().get(), applicationLink.getName(), applicationLink.getRpcUrl());
@Override public void addOrphanedTrustToApplicationLink(final String id, final OrphanedTrustCertificate.Type type, final ApplicationId applicationId) { checkCertificateType(type); final ApplicationLink applicationLink; try { applicationLink = applicationLinkService.getApplicationLink(applicationId); if (applicationLink == null) { throw new RuntimeException("No Application Link with id '" + applicationId + "' found."); } } catch (TypeNotInstalledException e) { throw new IllegalStateException("An application of the type " + e.getType() + " is not installed!", e); } if (type == OrphanedTrustCertificate.Type.OAUTH) { registerOAuthConsumer(id, applicationLink); } else if (type == OrphanedTrustCertificate.Type.OAUTH_SERVICE_PROVIDER) { registerOAuthServiceProvider(id, applicationLink); } }
throw new TypeNotInstalledException(applicationLink.getTypeId().get(), applicationLink.getName(), applicationLink.getRpcUrl());
entityCount = Lists.newArrayList(entityLinkService.getEntityLinksForApplicationLink(applicationLink)).size(); } catch (TypeNotInstalledException e) { return notFound(i18nResolver.getText("applinks.type.not.installed", e.getType()));
logger.warn(String.format("Unable to load ApplicationLink %s due to uninstalled type definition (%s).", id.toString(), e.getType()), e);
logger.warn(String.format("Unable to load ApplicationLink %s due to uninstalled type definition (%s).", id.toString(), e.getType()), e);
logger.warn(String.format("Unable to load ApplicationLink %s due to uninstalled type definition (%s).", id.toString(), e.getType()), e);
logger.warn(String.format("Unable to load ApplicationLink %s due to uninstalled type definition (%s).", id.toString(), e.getType()), e);
public URI createSelfLinkFor(final ApplicationId id) { try { URI baseUri; HttpContext context = CurrentContext.getContext(); if (context != null) { baseUri = context.getUriInfo().getBaseUri(); } else { baseUri = internalHostApplication.getBaseUrl(); } final ApplicationLinkResource applicationLinkResource = restUrlBuilder.getUrlFor( baseUri, ApplicationLinkResource.class); final String idString = id.get(); final javax.ws.rs.core.Response applicationLink = applicationLinkResource.getApplicationLink(idString); return restUrlBuilder.getURI(applicationLink); } catch (TypeNotInstalledException e) { // this should _never_ happen, as com.atlassian.plugins.rest.common.util.RestUrlBuilder.getUrlFor() is just returning a proxy stub throw new IllegalStateException(String.format("Failed to load application %s as the %s type is not installed", id.get(), e.getType())); } }
} catch (TypeNotInstalledException e) { LOG.warn(String.format("Couldn't load application link with id %s, type %s is not installed. " + "All child entity links will be inaccessible.", applicationId, e.getType())); continue;
} catch (TypeNotInstalledException e) { throw new IllegalStateException(String.format("Failed to load application %s as the %s type is not installed", applicationId, e.getType()));