List of usage examples for java.security InvalidParameterException InvalidParameterException
public InvalidParameterException()
From source file:com.alibaba.jstorm.client.ConfigExtension.java
@Deprecated public static void setMemSlotPerTask(Map conf, int slotNum) { if (slotNum < 1) { throw new InvalidParameterException(); }/*from w w w. j a v a2s. c o m*/ conf.put(MEM_SLOTS_PER_TASK, Integer.valueOf(slotNum)); }
From source file:com.alibaba.jstorm.client.ConfigExtension.java
@Deprecated public static void setCpuSlotsPerTask(Map conf, int slotNum) { if (slotNum < 1) { throw new InvalidParameterException(); }//from w ww.jav a 2 s . com conf.put(CPU_SLOTS_PER_TASK, Integer.valueOf(slotNum)); }
From source file:com.abiquo.api.tasks.util.DatacenterTaskBuilder.java
/** * Add new {@link VirtualMachineStateTransition}. This method must be used to add transitions * that only needs {@link VirtualMachineDefinition} and {@link HypervisorConnection} to be * created.//w w w .j av a 2 s. c om * * @param transition The transition type to create * @param extraData map to add to the job. * @return The {@link DatacenterTaskBuilder} self */ protected DatacenterTaskBuilder add(final VirtualMachineDefinition definition, final HypervisorConnection hypervisor, final VirtualMachineStateTransition transition, final Map<String, String> extraData) { switch (transition) { case PAUSE: case POWEROFF: case POWERON: case RESET: case RESUME: case CONFIGURE: case DECONFIGURE: ApplyVirtualMachineStateOp job = new ApplyVirtualMachineStateOp(); job.setVirtualMachine(definition); job.setHypervisorConnection(hypervisor); job.setTransaction(toCommonsTransition(transition)); this.tarantinoTask.addDatacenterJob(job); Job redisJob = createRedisJob(job.getId(), this.getTaskTypeFromTransition(transition)); if (extraData != null) { redisJob.getData().putAll(extraData); } this.asyncTask.getJobs().add(redisJob); break; case ALLOCATE: case DEALLOCATE: case SNAPSHOT: case RECONFIGURE: throw new InvalidParameterException(); } return this; }
From source file:eu.gusak.orion.php.servlets.PhpServlet.java
private void doGetCodeValidation(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // Load script source String script = req.getParameter("script"); if (script == null) { handleException(resp, "No script parameter provided", new InvalidParameterException()); return;//from w ww . java 2s .c om } OrionPhpPlugin.debug("Script: " + script); // Set PHP Version if defined String versionString = req.getParameter("phpversion"); PHPVersion phpVersion = PHPVersion.PHP5_3; if (versionString != null) { try { int versionInt = Integer.parseInt(versionString); switch (versionInt) { case 4: phpVersion = PHPVersion.PHP4; break; case 5: phpVersion = PHPVersion.PHP5; break; default: phpVersion = PHPVersion.PHP5_3; break; } } catch (NumberFormatException e) { } } try { OrionPhpPlugin.setProjectPhpVersion(phpVersion); } catch (CoreException e) { handleException(resp, "Problem with setting PHP version", e); return; } OrionPhpPlugin.debug("PHPVersion: " + phpVersion.toString()); // Save script into file in the project and wait for build try { phpFile = project.getFile(FILE_NAME); phpFile.create(new ByteArrayInputStream(script.getBytes()), true, null); project.refreshLocal(IResource.DEPTH_INFINITE, null); project.build(IncrementalProjectBuilder.FULL_BUILD, null); } catch (CoreException e) { removeFile(); handleException(resp, "Problem with saving script file", e); return; } OrionPhpPlugin.waitForIndexer(); OrionPhpPlugin.waitForAutoBuild(); // Generate the markers array JSONArray result = new JSONArray(); StringBuilder markersString = new StringBuilder(); IMarker[] markers; try { markers = phpFile.findMarkers(null, true, IResource.DEPTH_ONE); for (IMarker marker : markers) { markersString.append("[line="); markersString.append(marker.getAttribute(IMarker.LINE_NUMBER)); markersString.append(", start="); markersString.append(marker.getAttribute(IMarker.CHAR_START)); markersString.append(", end="); markersString.append(marker.getAttribute(IMarker.CHAR_END)); markersString.append("] "); markersString.append(marker.getAttribute(IMarker.MESSAGE)).append('\n'); Map<String, Object> markerInfo = new HashMap<String, Object>(); markerInfo.put("line", marker.getAttribute(IMarker.LINE_NUMBER)); markerInfo.put("character", marker.getAttribute(IMarker.CHAR_START)); markerInfo.put("charend", marker.getAttribute(IMarker.CHAR_END)); markerInfo.put("reason", marker.getAttribute(IMarker.MESSAGE)); result.put(markerInfo); } } catch (CoreException e) { removeFile(); handleException(resp, "Problem with retrieving problem markers", e); return; } OrionPhpPlugin.debug("Problem markers: " + markersString); writeJSONResponse(req, resp, result); removeFile(); }
From source file:com.polyvi.xface.extension.messaging.XMessagingExt.java
/** * ????/* w w w. j a v a2 s . com*/ */ private int getRecordCount(Uri queryUri, String selection, String[] selectionArgs) throws InvalidParameterException { ContentResolver resolver = mContext.getContentResolver(); Cursor cursor = resolver.query(queryUri, new String[] { BaseColumns._ID }, selection, selectionArgs, null); if (null == cursor) { throw new InvalidParameterException(); } final int count = cursor.getCount(); cursor.close(); return count; }
From source file:com.polyvi.xface.extension.XMessagingExt.java
/** * ????//w w w . j a v a 2s . co m */ private int getRecordCount(Uri queryUri, String selection, String[] selectionArgs) throws InvalidParameterException { ContentResolver resolver = getContext().getContentResolver(); Cursor cursor = resolver.query(queryUri, new String[] { BaseColumns._ID }, selection, selectionArgs, null); if (null == cursor) { throw new InvalidParameterException(); } final int count = cursor.getCount(); cursor.close(); return count; }
From source file:com.alibaba.jstorm.daemon.worker.WorkerData.java
@SuppressWarnings({ "rawtypes", "unchecked" }) public WorkerData(Map conf, IContext context, String topology_id, String supervisor_id, int port, String worker_id, String jar_path) throws Exception { this.conf = conf; this.context = context; this.topologyId = topology_id; this.supervisorId = supervisor_id; this.port = port; this.workerId = worker_id; this.shutdown = new AtomicBoolean(false); this.monitorEnable = new AtomicBoolean(true); this.topologyStatus = StatusType.active; if (StormConfig.cluster_mode(conf).equals("distributed")) { String pidDir = StormConfig.worker_pids_root(conf, worker_id); JStormServerUtils.createPid(pidDir); }//from w ww . j a va 2s. c om // create zk interface this.zkClusterstate = ZkTool.mk_distributed_cluster_state(conf); this.zkCluster = Cluster.mk_storm_cluster_state(zkClusterstate); Map rawConf = StormConfig.read_supervisor_topology_conf(conf, topology_id); this.stormConf = new HashMap<Object, Object>(); this.stormConf.putAll(conf); this.stormConf.putAll(rawConf); JStormMetrics.setTopologyId(topology_id); JStormMetrics.setPort(port); JStormMetrics.setDebug(ConfigExtension.isEnableMetricDebug(stormConf)); JStormMetrics.setEnabled(ConfigExtension.isEnableMetrics(stormConf)); JStormMetrics.addDebugMetrics(ConfigExtension.getDebugMetricNames(stormConf)); AsmMetric.setSampleRate(ConfigExtension.getMetricSampleRate(stormConf)); ConfigExtension.setLocalSupervisorId(stormConf, supervisorId); ConfigExtension.setLocalWorkerId(stormConf, workerId); ConfigExtension.setLocalWorkerPort(stormConf, port); ControlMessage.setPort(port); JStormMetrics.registerWorkerTopologyMetric( JStormMetrics.workerMetricName(MetricDef.CPU_USED_RATIO, MetricType.GAUGE), new AsmGauge(new Gauge<Double>() { @Override public Double getValue() { return JStormUtils.getCpuUsage(); } })); JStormMetrics.registerWorkerTopologyMetric( JStormMetrics.workerMetricName(MetricDef.MEMORY_USED, MetricType.GAUGE), new AsmGauge(new Gauge<Double>() { @Override public Double getValue() { return JStormUtils.getMemUsage(); } })); JStormMetrics.registerWorkerMetric(JStormMetrics.workerMetricName(MetricDef.DISK_USAGE, MetricType.GAUGE), new AsmGauge(new Gauge<Double>() { @Override public Double getValue() { return JStormUtils.getDiskUsage(); } })); LOG.info("Worker Configuration " + stormConf); try { boolean enableClassloader = ConfigExtension.isEnableTopologyClassLoader(stormConf); boolean enableDebugClassloader = ConfigExtension.isEnableClassloaderDebug(stormConf); if (jar_path == null && enableClassloader == true && !conf.get(Config.STORM_CLUSTER_MODE).equals("local")) { LOG.error("enable classloader, but not app jar"); throw new InvalidParameterException(); } URL[] urlArray = new URL[0]; if (jar_path != null) { String[] paths = jar_path.split(":"); Set<URL> urls = new HashSet<URL>(); for (String path : paths) { if (StringUtils.isBlank(path)) continue; URL url = new URL("File:" + path); urls.add(url); } urlArray = urls.toArray(new URL[0]); } WorkerClassLoader.mkInstance(urlArray, ClassLoader.getSystemClassLoader(), ClassLoader.getSystemClassLoader().getParent(), enableClassloader, enableDebugClassloader); } catch (Exception e) { LOG.error("init jarClassLoader error!", e); throw new InvalidParameterException(); } if (this.context == null) { this.context = TransportFactory.makeContext(stormConf); } boolean disruptorUseSleep = ConfigExtension.isDisruptorUseSleep(stormConf); DisruptorQueue.setUseSleep(disruptorUseSleep); boolean isLimited = ConfigExtension.getTopologyBufferSizeLimited(stormConf); DisruptorQueue.setLimited(isLimited); LOG.info("Disruptor use sleep:" + disruptorUseSleep + ", limited size:" + isLimited); // this.transferQueue = new LinkedBlockingQueue<TransferData>(); int buffer_size = Utils.getInt(stormConf.get(Config.TOPOLOGY_TRANSFER_BUFFER_SIZE)); WaitStrategy waitStrategy = (WaitStrategy) JStormUtils.createDisruptorWaitStrategy(stormConf); this.transferQueue = DisruptorQueue.mkInstance("TotalTransfer", ProducerType.MULTI, buffer_size, waitStrategy); this.transferQueue.consumerStarted(); this.sendingQueue = DisruptorQueue.mkInstance("TotalSending", ProducerType.MULTI, buffer_size, waitStrategy); this.sendingQueue.consumerStarted(); this.nodeportSocket = new ConcurrentHashMap<WorkerSlot, IConnection>(); this.taskNodeport = new ConcurrentHashMap<Integer, WorkerSlot>(); this.workerToResource = new ConcurrentSkipListSet<ResourceWorkerSlot>(); this.innerTaskTransfer = new ConcurrentHashMap<Integer, DisruptorQueue>(); this.deserializeQueues = new ConcurrentHashMap<Integer, DisruptorQueue>(); this.tasksToComponent = new ConcurrentHashMap<Integer, String>(); this.componentToSortedTasks = new ConcurrentHashMap<String, List<Integer>>(); Assignment assignment = zkCluster.assignment_info(topologyId, null); if (assignment == null) { String errMsg = "Failed to get Assignment of " + topologyId; LOG.error(errMsg); throw new RuntimeException(errMsg); } workerToResource.addAll(assignment.getWorkers()); // get current worker's task list this.taskids = assignment.getCurrentWorkerTasks(supervisorId, port); if (taskids.size() == 0) { throw new RuntimeException("No tasks running current workers"); } LOG.info("Current worker taskList:" + taskids); // deserialize topology code from local dir rawTopology = StormConfig.read_supervisor_topology_code(conf, topology_id); sysTopology = Common.system_topology(stormConf, rawTopology); generateMaps(); contextMaker = new ContextMaker(this); outTaskStatus = new ConcurrentHashMap<Integer, Boolean>(); threadPool = Executors.newScheduledThreadPool(THREAD_POOL_NUM); TimerTrigger.setScheduledExecutorService(threadPool); if (!StormConfig.local_mode(stormConf)) { healthReporterThread = new AsyncLoopThread(new JStormHealthReporter(this)); } try { Long tmp = StormConfig.read_supervisor_topology_timestamp(conf, topology_id); assignmentTS = (tmp == null ? System.currentTimeMillis() : tmp); } catch (FileNotFoundException e) { assignmentTS = System.currentTimeMillis(); } outboundTasks = new HashSet<Integer>(); LOG.info("Successfully create WorkerData"); }
From source file:org.energy_home.jemma.osgi.ah.hap.client.HapCoreService.java
public void _cli(CommandInterpreter ci) { contentInstance = new ContentInstance(); String className = ci.nextArgument(); if (className == null) { ci.println("Invalid class name"); return;/*from w w w . j a v a 2s.c o m*/ } String param = ci.nextArgument(); Object value = null; Class c = null; try { if (className.indexOf('.') < 0) { try { c = Class.forName("java.lang." + className); } catch (Exception e) { c = Class.forName("org.energy_home.jemma.ah." + className); } } else c = Class.forName(className); if (param != null) value = c.getConstructor(String.class).newInstance(param); else value = c.newInstance(); if (value == null) throw new InvalidParameterException(); contentInstance.setContent(value); ci.println("Local content instance created"); } catch (Exception e) { ci.println("Invalid class name"); } }
From source file:com.sayar.requests.RequestArguments.java
/** * Setter for the request entity. The param, String-String Map, will be * encoded in URL format./*from w w w .j a va2s . c om*/ * * @param requestEntity * @throws UnsupportedEncodingException */ public void setRequestEntity(final Map<String, String> requestEntity) throws UnsupportedEncodingException { if (!requestEntity.isEmpty()) { final List<NameValuePair> nvpairs = new ArrayList<NameValuePair>(requestEntity.size()); // Iterate using the enhanced for loop synthax as the JIT will // optimize it away // See // http://developer.android.com/guide/practices/design/performance.html#foreach for (final Map.Entry<String, String> entry : requestEntity.entrySet()) { nvpairs.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); } this.requestEntity = new UrlEncodedFormEntity(nvpairs); } else { throw new InvalidParameterException(); } }
From source file:com.android.ddmuilib.log.event.EventDisplay.java
void setPidFilterList(ArrayList<Integer> pids) { if (mPidFiltering == false) { throw new InvalidParameterException(); }/* w w w. java 2 s . c om*/ mPidFilterList = pids; }