use of org.wso2.siddhi.query.api.expression.condition.Not in project jaggery by wso2.
the class TomcatJaggeryWebappsDeployer method handleZipWebappDeployment.
/**
* Handle the deployment of a an archive Jaggery app. i.e., a WAR
*
* @param webapp The WAR Jaggery app file
* @param webContextParams ServletContext params for this webapp
* @param applicationEventListeners Application event listeners
* @throws CarbonException If a deployment error occurs
*/
@SuppressFBWarnings("PATH_TRAVERSAL_IN")
protected void handleZipWebappDeployment(File webapp, List<WebContextParameter> webContextParams, List<Object> applicationEventListeners) throws CarbonException {
synchronized (this) {
String appPath = webapp.getAbsolutePath().substring(0, webapp.getAbsolutePath().indexOf(".zip"));
try {
JaggeryDeploymentUtil.unZip(new FileInputStream(webapp), appPath);
if (!webapp.delete()) {
throw new CarbonException(appPath + "could not be deleted");
}
} catch (FileNotFoundException e) {
throw new CarbonException(e);
}
File unzippedWebapp = new File(appPath);
handleExplodedWebappDeployment(unzippedWebapp, webContextParams, applicationEventListeners);
}
}
use of org.wso2.siddhi.query.api.expression.condition.Not in project jaggery by wso2.
the class RegistryHostObject method jsFunction_newResource.
public static Scriptable jsFunction_newResource(Context cx, Scriptable thisObj, Object[] arguments, Function funObj) throws ScriptException {
RegistryHostObject registryHostObject = (RegistryHostObject) thisObj;
if (arguments.length == 0) {
if (registryHostObject.registry != null) {
try {
Resource resource = registryHostObject.registry.newResource();
ResourceHostObject rho = (ResourceHostObject) cx.newObject(registryHostObject, "Resource", new Object[] { resource });
return rho;
} catch (RegistryException e) {
throw new ScriptException("Error occurred while creating a new Resource", e);
}
} else {
throw new ScriptException("Registry has not initialized");
}
} else {
throw new ScriptException("newResource() Method doesn't accept arguments");
}
}
use of org.wso2.siddhi.query.api.expression.condition.Not in project jaggery by wso2.
the class RegistryHostObject method jsFunction_newCollection.
public static Scriptable jsFunction_newCollection(Context cx, Scriptable thisObj, Object[] arguments, Function funObj) throws ScriptException {
RegistryHostObject rho = (RegistryHostObject) thisObj;
if (arguments.length == 0) {
if (rho.registry != null) {
try {
Collection collection = rho.registry.newCollection();
CollectionHostObject cho = (CollectionHostObject) cx.newObject(rho, "Collection", new Object[] { collection });
return cho;
} catch (RegistryException e) {
throw new ScriptException("Error occurred while creating a new Collection", e);
}
} else {
throw new ScriptException("Registry has not initialized");
}
} else {
throw new ScriptException("newCollection() Method doesn't accept arguments");
}
}
use of org.wso2.siddhi.query.api.expression.condition.Not in project siddhi by wso2.
the class SiddhiAnnotationProcessor method process.
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
// Iterate over all @Extension annotated elements.
for (Element element : roundEnv.getElementsAnnotatedWith(Extension.class)) {
// Check if a class has been annotated with @Extension.
if (element.getKind() == ElementKind.CLASS) {
String superClass = getMatchingSuperClass(element, new String[] { AnnotationConstants.SINK_MAPPER_SUPER_CLASS, AnnotationConstants.SINK_SUPER_CLASS, AnnotationConstants.FUNCTION_EXECUTOR_SUPER_CLASS, AnnotationConstants.AGGREGATION_ATTRIBUTE_SUPER_CLASS, AnnotationConstants.DISTRIBUTION_STRATEGY_SUPER_CLASS, AnnotationConstants.STREAM_PROCESSOR_SUPER_CLASS, AnnotationConstants.STREAM_FUNCTION_PROCESSOR_SUPER_CLASS, AnnotationConstants.STORE_SUPER_CLASS, AnnotationConstants.SOURCE_SUPER_CLASS, AnnotationConstants.SOURCE_MAPPER_SUPER_CLASS, AnnotationConstants.WINDOW_PROCESSOR_CLASS, AnnotationConstants.SCRIPT_SUPER_CLASS, AnnotationConstants.INCREMENTAL_ATTRIBUTE_AGGREGATOR_SUPER_CLASS });
AbstractAnnotationProcessor abstractAnnotationProcessor = null;
Extension annotation = element.getAnnotation(Extension.class);
String name = annotation.name();
String description = annotation.description();
String namespace = annotation.namespace();
Parameter[] parameters = annotation.parameters();
ReturnAttribute[] returnAttributes = annotation.returnAttributes();
SystemParameter[] systemParameters = annotation.systemParameter();
Example[] examples = annotation.examples();
String extensionClassFullName = element.asType().toString();
if (superClass != null) {
switch(superClass) {
case AnnotationConstants.DISTRIBUTION_STRATEGY_SUPER_CLASS:
abstractAnnotationProcessor = new DistributionStrategyValidationAnnotationProcessor(extensionClassFullName);
break;
case AnnotationConstants.SINK_MAPPER_SUPER_CLASS:
abstractAnnotationProcessor = new SinkMapperValidationAnnotationProcessor(extensionClassFullName);
break;
case AnnotationConstants.SINK_SUPER_CLASS:
abstractAnnotationProcessor = new SinkValidationAnnotationProcessor(extensionClassFullName);
break;
case AnnotationConstants.FUNCTION_EXECUTOR_SUPER_CLASS:
abstractAnnotationProcessor = new FunctionExecutorValidationAnnotationProcessor(extensionClassFullName);
break;
case AnnotationConstants.AGGREGATION_ATTRIBUTE_SUPER_CLASS:
abstractAnnotationProcessor = new AggregationAttributeValidationAnnotationProcessor(extensionClassFullName);
break;
case AnnotationConstants.STREAM_PROCESSOR_SUPER_CLASS:
abstractAnnotationProcessor = new StreamProcessorValidationAnnotationProcessor(extensionClassFullName);
break;
case AnnotationConstants.SOURCE_SUPER_CLASS:
abstractAnnotationProcessor = new SourceValidationAnnotationProcessor(extensionClassFullName);
break;
case AnnotationConstants.SOURCE_MAPPER_SUPER_CLASS:
abstractAnnotationProcessor = new SourceMapperValidationAnnotationProcessor(extensionClassFullName);
break;
case AnnotationConstants.STORE_SUPER_CLASS:
abstractAnnotationProcessor = new StoreValidationAnnotationProcessor(extensionClassFullName);
break;
case AnnotationConstants.STREAM_FUNCTION_PROCESSOR_SUPER_CLASS:
abstractAnnotationProcessor = new StreamFunctionProcessorValidationAnnotationProcessor(extensionClassFullName);
break;
case AnnotationConstants.WINDOW_PROCESSOR_CLASS:
abstractAnnotationProcessor = new WindowProcessorValidationAnnotationProcessor(extensionClassFullName);
break;
case AnnotationConstants.SCRIPT_SUPER_CLASS:
abstractAnnotationProcessor = new ScriptValidationAnnotationProcessor(extensionClassFullName);
break;
case AnnotationConstants.INCREMENTAL_ATTRIBUTE_AGGREGATOR_SUPER_CLASS:
abstractAnnotationProcessor = new IncrementalAggregationAttributeValidationAnnotationProcessor(extensionClassFullName);
break;
default:
// Throw error if no matching super class.
showBuildError(MessageFormat.format("Default switch case executed as there is no " + "matching super class option for @{0}.", superClass), element);
break;
}
if (abstractAnnotationProcessor != null) {
try {
abstractAnnotationProcessor.basicParameterValidation(name, description, namespace);
abstractAnnotationProcessor.parameterValidation(parameters);
abstractAnnotationProcessor.returnAttributesValidation(returnAttributes);
abstractAnnotationProcessor.systemParametersValidation(systemParameters);
abstractAnnotationProcessor.examplesValidation(examples);
} catch (AnnotationValidationException e) {
showBuildError(e.getMessage(), element);
}
} else {
showBuildError(MessageFormat.format("Error while validation, " + "abstractAnnotationProcessor cannot be null.", superClass), element);
}
} else {
// Throw error if no matching super class.
showBuildError("Class does not have a matching Siddhi Extension super class.", element);
}
} else {
// Throw error if the element returned is method or package.
showBuildError(MessageFormat.format("Only classes can be annotated with @{0}.", Extension.class.getCanonicalName()), element);
}
}
// Returning false since this processor only validates.
return false;
}
use of org.wso2.siddhi.query.api.expression.condition.Not in project siddhi by wso2.
the class SelectiveStateEventPopulator method populateStateEvent.
public void populateStateEvent(ComplexEvent complexEvent) {
StateEvent stateEvent = (StateEvent) complexEvent;
for (StateMappingElement stateMappingElement : stateMappingElements) {
int toPosition = stateMappingElement.getToPosition();
stateEvent.setOutputData(getFromData(stateEvent, stateMappingElement.getFromPosition()), toPosition);
// switch (toPosition[0]) {
// case 0:
// stateEvent.setPreOutputData(getFromData(stateEvent, stateMappingElement.getFromPosition()),
// toPosition[1]);
// break;
// case 1:
// stateEvent.setOutputData(getFromData(stateEvent, stateMappingElement.getFromPosition()),
// toPosition[1]);
// break;
// default:
// //will not happen
// throw new IllegalStateException("To Position cannot be :" + toPosition[0]);
// }
}
}
Aggregations