List of usage examples for javax.naming OperationNotSupportedException OperationNotSupportedException
public OperationNotSupportedException(String explanation)
From source file:io.pivotal.poc.gemfire.gtx.jndi.SimpleNamingContext.java
@Override public Name composeName(Name name, Name prefix) throws NamingException { throw new OperationNotSupportedException("SimpleNamingContext does not support [javax.naming.Name]"); }
From source file:com.dattack.naming.AbstractContext.java
@Override public Object lookup(final Name name) throws NamingException { ensureContextNotClosed();//from ww w . ja v a2 s .co m /* * Extract from Context Javadoc: If name is empty, returns a new instance of this context (which represents the * same naming context as this context, but its environment may be modified independently and it may be accessed * concurrently). */ if (name.isEmpty()) { try { return this.clone(); } catch (final CloneNotSupportedException e) { // this shouldn't happen, since we are Cloneable throw (NamingException) new OperationNotSupportedException(e.getMessage()).initCause(e); } } if (name.size() > 1) { if (subContexts.containsKey(name.getPrefix(1))) { return subContexts.get(name.getPrefix(1)).lookup(name.getSuffix(1)); } throw new NamingException( String.format("Invalid subcontext '%s' in context '%s'", name.getPrefix(1).toString(), StringUtils.isBlank(getNameInNamespace()) ? "/" : getNameInNamespace())); } Object result = null; // not found if (objectTable.containsKey(name)) { result = objectTable.get(name); } else if (subContexts.containsKey(name)) { result = subContexts.get(name); } else if (env.containsKey(name.toString())) { result = env.get(name.toString()); } return result; }
From source file:com.alliander.osgp.acceptancetests.basicfunctions.VerifyAuthorizeDeviceFunctionSteps.java
@DomainStep("device function (.*) is called") public void whenDeviceFunctionIsCalled(final String function) { LOGGER.info("Executing device function: {}", function); try {/*from w w w . java 2 s .co m*/ switch (function) { case "START_SELF_TEST": this.startSelfTest(); break; case "STOP_SELF_TEST": this.stopSelfTest(); break; case "SET_LIGHT": this.setLight(); break; case "GET_DEVICE_AUTHORIZATION": this.getDeviceAuthorization(); break; case "SET_EVENT_NOTIFICATIONS": this.setEventNotifications(); break; case "GET_EVENT_NOTIFICATIONS": this.getEventNotifications(); break; case "UPDATE_FIRMWARE": this.updateFirmware(); break; case "GET_FIRMWARE_VERSION": this.getFirmwareVersion(); break; case "SET_SCHEDULE": this.setSchedule(); break; case "SET_TARIFF_SCHEDULE": this.setTariffSchedule(); break; case "SET_CONFIGURATION": this.setConfiguration(); break; case "GET_CONFIGURATION": this.getConfiguration(); break; case "GET_STATUS": this.getStatus(); break; case "REMOVE_DEVICE": this.removeDevice(); break; case "GET_ACTUAL_POWER_USAGE": this.getActualPowerUsage(); break; case "GET_POWER_USAGE_HISTORY": this.getPowerUsageHistory(); break; case "RESUME_SCHEDULE": this.resumeSchedule(); break; case "SET_REBOOT": this.setReboot(); break; case "SET_TRANSITION": this.setTransition(); break; default: throw new OperationNotSupportedException("Function " + function + " does not exist."); } } catch (final Throwable t) { LOGGER.info("Exception: {}", t.getClass().getSimpleName()); this.throwable = t; } }
From source file:org.apache.geode.admin.jmx.internal.CacheServerJmxImpl.java
/** * RefreshInterval is now set only through the AdminDistributedSystem property refreshInterval. * Attempt to set refreshInterval on CacheServerJmx MBean would result in an * OperationNotSupportedException Auto-refresh is enabled on demand when a call to refreshConfig * is made//from www . java 2 s. c o m * * @param refreshInterval the new refresh interval in seconds * @deprecated since 6.0 use DistributedSystemConfig.refreshInterval instead */ @Deprecated public void setRefreshInterval(int refreshInterval) throws OperationNotSupportedException { throw new OperationNotSupportedException( LocalizedStrings.MANAGED_RESOURCE_REFRESH_INTERVAL_CANT_BE_SET_DIRECTLY.toLocalizedString()); }
From source file:org.apache.naming.NamingContext.java
/** * Retrieves the full name of this context within its own namespace. * <p>/*ww w . ja v a 2 s . c o m*/ * Many naming services have a notion of a "full name" for objects in * their respective namespaces. For example, an LDAP entry has a * distinguished name, and a DNS record has a fully qualified name. This * method allows the client application to retrieve this name. The string * returned by this method is not a JNDI composite name and should not be * passed directly to context methods. In naming systems for which the * notion of full name does not make sense, * OperationNotSupportedException is thrown. * * @return this context's name in its own namespace; never null * @exception OperationNotSupportedException if the naming system does * not have the notion of a full name * @exception NamingException if a naming exception is encountered */ public String getNameInNamespace() throws NamingException { throw new OperationNotSupportedException(sm.getString("namingContext.noAbsoluteName")); //FIXME ? }
From source file:org.chililog.server.workbench.workers.RepositoryRuntimeWorker.java
/** * Read/* ww w.j av a 2 s .c o m*/ * * @throws Exception */ @SuppressWarnings("rawtypes") @Override public ApiResult processGet() throws Exception { try { UserBO user = this.getAuthenticatedUser(); List<String> allowedRepositories = Arrays.asList(this.getAuthenticatedUserAllowedRepository()); DB db = MongoConnection.getInstance().getConnection(); Object responseContent = null; // Get info on all repositories // HTTP GET /api/repositories if (this.getUriPathParameters() == null || this.getUriPathParameters().length == 0) { Repository[] list = RepositoryService.getInstance().getRepositories(); if (list != null && list.length > 0) { ArrayList<RepositoryStatusAO> aoList = new ArrayList<RepositoryStatusAO>(); for (Repository repo : list) { if (user.isSystemAdministrator() || allowedRepositories.contains(repo.getRepoConfig().getName())) { aoList.add(new RepositoryStatusAO(repo)); } } if (!aoList.isEmpty()) { responseContent = aoList.toArray(new RepositoryStatusAO[] {}); } } } else if (this.getUriPathParameters().length == 1) { // Get info on specified repository // HTTP GET /api/repositories/{id} String id = this.getUriPathParameters()[ID_URI_PATH_PARAMETER_INDEX]; ObjectId objectId = parseDocumentObjectID(id); Repository repo = RepositoryService.getInstance().getRepository(objectId); if (user.isSystemAdministrator() || allowedRepositories.contains(repo.getRepoConfig().getName())) { responseContent = new RepositoryStatusAO(repo); } else { // Assume not found throw new ChiliLogException(Strings.REPOSITORY_NOT_FOUND_ERROR, id); } } else if (this.getUriPathParameters().length == 2) { // HTTP GET /api/repositories/{id}/entries?query_type=find // Get entries for a specific repository String id = this.getUriPathParameters()[ID_URI_PATH_PARAMETER_INDEX]; ObjectId objectId = parseDocumentObjectID(id); Repository repo = RepositoryService.getInstance().getRepository(objectId); if (!user.isSystemAdministrator() && !allowedRepositories.contains(repo.getRepoConfig().getName())) { // Assume not found throw new ChiliLogException(Strings.REPOSITORY_NOT_FOUND_ERROR, id); } else if (repo.getStatus() == Status.OFFLINE) { // Cannot search if repository is offline throw new ChiliLogException(Strings.REPOSITORY_OFFLINE_ERROR, id); } // Load criteria QueryType queryType = Enum.valueOf(QueryType.class, this.getQueryStringOrHeaderValue(ENTRY_QUERY_TYPE_QUERYSTRING_PARAMETER_NAME, ENTRY_QUERY_TYPE_HEADER_NAME, false).toUpperCase()); RepositoryEntryListCriteria criteria = loadCriteria(); // Convert to JSON ourselves because this is not a simple AO object. // mongoDB object JSON serialization required StringBuilder json = new StringBuilder(); // Get controller and execute query RepositoryEntryController controller = RepositoryEntryController.getInstance(repo.getRepoConfig()); if (queryType == QueryType.FIND) { ArrayList<DBObject> list = controller.executeFindQuery(db, criteria); if (list != null && !list.isEmpty()) { MongoJsonSerializer.serialize(new BasicDBObject("find", list), json); } } else if (queryType == QueryType.COUNT) { int count = controller.executeCountQuery(db, criteria); MongoJsonSerializer.serialize(new BasicDBObject("count", count), json); } else if (queryType == QueryType.DISTINCT) { List l = controller.executeDistinctQuery(db, criteria); MongoJsonSerializer.serialize(new BasicDBObject("distinct", l), json); } else if (queryType == QueryType.GROUP) { DBObject groupObject = controller.executeGroupQuery(db, criteria); MongoJsonSerializer.serialize(new BasicDBObject("group", groupObject), json); } else { throw new OperationNotSupportedException("Unsupported query type: " + queryType.toString()); } // If there is no json, skip this and a 204 No Content will be returned if (json.length() > 0) { responseContent = json.toString().getBytes(Worker.JSON_CHARSET); ApiResult result = new ApiResult(this.getAuthenticationToken(), JSON_CONTENT_TYPE, responseContent); if (criteria.getDoPageCount()) { result.getHeaders().put(PAGE_COUNT_HEADER, new Integer(criteria.getPageCount()).toString()); } return result; } } // Return response return new ApiResult(this.getAuthenticationToken(), JSON_CONTENT_TYPE, responseContent); } catch (Exception ex) { return new ApiResult(HttpResponseStatus.BAD_REQUEST, ex); } }
From source file:org.eclipse.ice.item.utilities.moose.MOOSEFileHandler.java
@Override public void replace(IFile file, String regex, String value) { try {//from w w w . j ava2s . co m throw new OperationNotSupportedException( "MOOSEFileHandler Error: " + "IWriter.replace() is not supported."); } catch (OperationNotSupportedException e) { logger.error(getClass().getName() + " Exception!", e); } return; }
From source file:org.kuali.student.enrollment.class2.courseoffering.controller.TestStatePropagationController.java
@Transactional @RequestMapping(params = "methodToCall=changeSocState") public ModelAndView changeSocState(@ModelAttribute("KualiForm") TestStatePropagationForm form) throws PermissionDeniedException, OperationFailedException, OperationNotSupportedException, InvalidParameterException, MissingParameterException, DoesNotExistException, DataValidationErrorException, VersionMismatchException, ReadOnlyException { String environment = StringUtils.defaultIfBlank( ConfigContext.getCurrentContextConfig().getProperty("environment"), StringUtils.EMPTY); if (!"DEV".equalsIgnoreCase(environment)) { throw new OperationNotSupportedException( "Cannot change state of SOC in non-dev environment (env is:" + environment + ")"); }//w w w.jav a 2 s . c o m // update soc-state ContextInfo contextInfo = new ContextInfo(); SocInfo targetSocInfo = getTargetSocInfoForTerm(form.getTermCodeForSocStateChange(), contextInfo); targetSocInfo.setStateKey(form.getNewSocStateForSocStateChange()); putBypassBusinessLogicFlagOntoContext(contextInfo); this.getSocService().updateSoc(targetSocInfo.getId(), targetSocInfo, contextInfo); populateFormWithTargetSocInfo(form); return getUIFModelAndView(form); }
From source file:org.rhq.enterprise.server.rest.ReportsInterceptor.java
@AroundInvoke public Object setCaller(final InvocationContext ctx) throws Exception { AbstractRestBean target = (AbstractRestBean) ctx.getTarget(); boolean fromRest = false; // If we are "forwarded" from the "normal" rest-api, we have a principal, that we can use java.security.Principal p = ejbContext.getCallerPrincipal(); if (p != null) { target.caller = subjectManager.getSubjectByName(p.getName()); fromRest = true;//from w ww. j av a 2s .com } // If no caller was set from the "normal" api, we need to check if it is // available in cookies, as in this case we were invoked // from the Coregui reports function if (target.caller == null) { HttpServletRequest request = getRequest(ctx.getParameters()); if (request == null) { // TODO should we throw a different exception? String msg = "No " + HttpServletRequest.class.getName() + " parameter was found for " + getMethodName(ctx) + ". An " + HttpServletRequest.class.getName() + " parameter must be specified in order to support authentication"; log.error(msg); throw new OperationNotSupportedException(msg); } Subject subject = getSubject(request); if (subject == null) { throw new IllegalAccessException( "Failed to validate request: could not access subject for request URL " + request.getRequestURL()); } target.caller = subject; } // Invoke the target method Object result = ctx.proceed(); if (result instanceof StreamingOutput) { return new LoggingStreamingOutput((StreamingOutput) result, getMethodName(ctx)); } // TODO invalidate session? return result; }
From source file:pl.psnc.synat.wrdz.zmd.download.DownloadManagerBean.java
/** * Creates connection adapter appropriate for the given protocol, using provided connection information. * //w w w .j a v a 2 s .c o m * @param protocol * protocol symbol present in the URL. * @param connectionInfo * connection information including authentication information. * @return adapter suitable for connection to the requested repository. * @throws OperationNotSupportedException * if no suitable adapter was found. * @throws DownloadAdapterException * if adapter configuration failed. */ private DownloadAdapter getAdapterForProtocolName(String protocol, ConnectionInformation connectionInfo) throws OperationNotSupportedException, DownloadAdapterException { DownloadAdapterFactory protocolDownloadAdapter = null; try { protocolDownloadAdapter = DownloadAdapterFactory.valueOf(protocol); } catch (IllegalArgumentException illegalArgumentException) { throw new OperationNotSupportedException( "No adapter for the protocol found. Protocol name: " + protocol); } if (protocolDownloadAdapter != null) { return protocolDownloadAdapter.getAdapter(connectionInfo, cacheHome); } else { return null; } }