예제 #1
0
def executeAndDistribute(path,
                         project='project',
                         parameters=None,
                         action=None,
                         actionSettings=None):
    """Executes and distributes a report. Similar to scheduling a report
    to execute, except a schedule in not required to utilize this
    function. This is a great way to distribute the report on demand
    from a client.

    Args:
        path (str): The path to the existing report.
        project (str): The name of the project where the report is
            located. Optional in client scope.
        parameters (dict): An optional dictionary of parameter
            overrides, in the form name:value.
        action (str): The name of the distribution action to use.
        actionSettings (dict): An optional dictionary of settings
            particular to the action. Missing values will use the
            default value for that action.

    Raises:
        IllegalArgumentException: Thrown when any of the following
            occurs: If the file type is not recognized, path does not
            exist, project does not exist, or a key is not valid.
    """
    if project is None:
        raise IllegalArgumentException()
    else:
        print(path, project, parameters, action, actionSettings)
예제 #2
0
def executeReport(path, project='project', parameters=None, fileType='pdf'):
    """Immediately executes an existing report and returns a byte[] of
    the output.

    Args:
        path (str): The path to the existing report.
        project (str): The name of the project where the report is
            located. Optional in client scope.
        parameters (dict): An optional dictionary of parameter
            overrides, in the form name:value. Optional.
        fileType (str): The file type the resulting byte array should
            represent. Defaults to "pdf". Not case-sensitive. Optional.

    Returns:
        object: A byte array of the resulting report.

    Raises:
        IllegalArgumentException: Thrown when any of the following
            occurs: If the file type is not recognized, path does not
            exist, project does not exist.
    """
    _fileTypes = ['pdf', 'html', 'csv', 'rtf', 'jpeg', 'png', 'xml']
    if path is None or project is None or fileType not in _fileTypes:
        raise IllegalArgumentException()
    else:
        print(path, project, parameters, fileType)
        return None
예제 #3
0
 def getIngestJobSettingsPanel(self, settings):
     if not isinstance(settings, SampleFileIngestModuleWithUISettings):
         raise IllegalArgumentException(
             "Expected settings argument to be instanceof SampleIngestModuleSettings"
         )
     self.settings = settings
     return SampleFileIngestModuleWithUISettingsPanel(self.settings)
예제 #4
0
def setDeploymentClassLoader(appname,
                             mode='PARENT_LAST',
                             policy='SINGLE',
                             server=ApplicationServer()):
    if (mode != 'PARENT_LAST') and (mode != 'PARENT_FIRST'):
        raise IllealArgumentException('Illegal class loader mode: %s' % mode)
    logging.info(
        "Setting '%s' application classloader to mode '%s' and warClassLoaderPolicy '%s'"
        % (appname, mode, policy))
    #dep = AdminConfig.getid('/Deployment:%s/' % appname)
    #depObject = AdminConfig.showAttribute(dep, 'deployedObject')
    #classldr = AdminConfig.showAttribute(depObject, 'classloader')
    #AdminConfig.modify(classldr, [['mode', mode]])
    #AdminConfig.modify(depObject, [['warClassLoaderPolicy', policy]])
    deployment = Deployment(appname, server)
    if not deployment.exists():
        raise IllegalArgumentException(
            'Application deployment "%s" not found!' % appname)

    deployedObj = deployedObj.getDeployedObject()
    deployedObj.wasClassLoaderPolicy = policy
    if mode == 'PARENT_LAST':
        deployedObj.getClassLoader().setParentLast()
    else:
        deployedObj.getClassLoader().setParentFirst()
    deployment.update()
예제 #5
0
def getReportNamesAsDataset(project="project", includeReportName=True):
    """Gets a data of all reports for a project.

    This dataset is particularly suited for display in a Tree View
    component.

    Args:
        project (str): The name of the project where the reports are
            located. Optional in client scope.
        includeReportName (bool): When set to False, the end of Path
            does not include the report name. Default is True. Optional.

    Returns:
        Dataset: A dataset of report paths and names for the project.
            Returns an empty dataset if the project has no reports.

    Raises:
        IllegalArgumentException: Thrown when any of the following
            occurs: If the project name is omitted in the Gateway scope,
            project does not exist.
    """
    if project is None:
        raise IllegalArgumentException()

    print(project, includeReportName)
    return Dataset()
 def getIngestJobSettingsPanel(self, settings):
     if not isinstance(settings, DropboxInjestWithUISettings):
         raise IllegalArgumentException(
             "Expected settings argument to be instanceof DropboxInjestWithUISettings"
         )
     self.settings = settings
     return DropboxInjestWithUISettingsPanel(self.settings)
예제 #7
0
 def __init__(self, hostName, hostModel, hostSerialNum, hostOSVersion):
     if hostName is None:
         raise IllegalArgumentException("Host name cannot be null")
     self.hostName = hostName
     self.hostModel = hostModel
     self.hostSerialNum = hostSerialNum
     self.hostOSVersion = hostOSVersion
 def getIngestJobSettingsPanel(self, settings):
     if not isinstance(settings, ISmartAlarmIngestModuleSettings):
         raise IllegalArgumentException(
             "Expected settings argument to be instance of ISmartAlarmIngestModuleSettings"
         )
     self.settings = settings
     return ISmartAlarmIngestModuleSettingsPanel(self.settings)
 def __init__(self, centros, poblacion, pob_id, pob_edad, centro_id, centro_nombre, max_poblacion, max_distancia, edad_min, edad_max, progress):
   print "pob_id=", repr(pob_id)
   print "pob_edad=", repr(pob_edad)
   print "centro_id=", repr(centro_id)
   print "centro_nombre=", repr(centro_nombre)
   print "max_poblacion=", repr(max_poblacion)
   print "max_distancia=", repr(max_distancia)
   print "edad_min=", repr(edad_min)
   print "edad_max=", repr(edad_max)
   self.max_distancia = max_distancia # Buffer para calcular los centros vecinos
   self.max_poblacion = max_poblacion # por centro
   self.total_poblacion = 0
   self.pob_id = pob_id
   self.pob_edad = pob_edad
   self.centro_id = centro_id
   self.centro_nombre = centro_nombre
   self.progress = progress
   self.store_centros = centros
   self.store_poblacion = poblacion
   self.edad_min = edad_min
   self.edad_max = edad_max
   if self.edad_min <0:
     self.edad_min = 0
   if self.edad_max<1:
     self.edad_max = 2000000000
   if self.edad_min >= self.edad_max:
     raise IllegalArgumentException("Rango de edad incorrecto (min=%s, max=%s)" % (self.edad_min, self.edad_max))
   self.centros = list()
예제 #10
0
 def __init__(self, ip, netArray=None, interfaceName = None, interfaceDescr=None, mask=None):
     '''
     @types str, str, str, str
     @raise IllegalArgumentException: if ip is None  
     '''
     if ip is None:
         raise IllegalArgumentException("IP cannot be null")
     self.ip = ip
     self.netArray = netArray
     self.interfaceDescr = interfaceDescr
     self.interfaceName = interfaceName
     self.mask = mask
예제 #11
0
def centerDisplay(viewId, useProjection=False):
    control = findDisplayControl(id)
    if not control:
        raise IllegalArgumentException('Could not find display: %s' % (id))

    mcv = McIDASV.getStaticMcv()
    if mcv:
        viewManagers = getViewManagers(viewId)
        if useProjection and control.getDataProjection():
            mapProjection = control.getDataProjection()
            mcv.getVMManager().center(mapProjection, viewManagers)
        elif control.getDisplayCenter():
            centerPoint = Util.makeEarthLocation(control.getDisplayCenter())
            mcv.getVMManager().center(centerPoint, viewManagers)
예제 #12
0
def getReportNamesAsList(project='project'):
    """Gets a list of all reports for a project.

    Args:
        project (str):  The name of the project where the reports are
            located. Optional in client scope.

    Returns:
        list[str]: A list of report paths for the project. Returns an
            empty list if the project has no reports.

    Raises:
        IllegalArgumentException: Thrown when any of the following
            occurs: If the project name is omitted in the Gateway scope,
            project does not exist.
    """
    if project is None:
        raise IllegalArgumentException()
    else:
        return []
예제 #13
0
def getReportNamesAsDataset(project='project'):
    """Gets a data of all reports for a project. This dataset is
    particularly suited for display in a Tree View component.

    Args:
        project (str):  The name of the project where the reports are
            located. Optional in client scope.

    Returns:
        Dataset: A dataset of report paths and names for the project.
            Returns an empty dataset if the project has no reports.

    Raises:
        IllegalArgumentException: Thrown when any of the following
            occurs: If the project name is omitted in the Gateway scope,
            project does not exist.
    """
    if project is None:
        raise IllegalArgumentException()
    else:
        return Dataset()
 def raise_iae_for_sigint(signum, handler):
     if signum == signal.SIGINT:
         raise IllegalArgumentException('xxx')
예제 #15
0
def main():
    global debug
    global shallow_delete
    global api_ses
    global user_name
    global password

    # options
    debug = 0
    # quick_load won't call api.synchScopes() - to be used when bulk-loading multiple scopes
    # the last scope loaded must not use this flag, so all scopes get synchronized then
    quick_load = 0
    shallow_delete = 0
    user_name = ""
    password = ""
    scope_set = ""
    load_scopegroups = 0
    load_scopesets = 0

    # Parse command line
    try:
        (opts, pargs) = getopt.getopt(sys.argv[1:], 'dqCu:p:s:g:')

        for (opt, opt_val) in opts:
            if opt == '-u':
                user_name = opt_val
            elif opt == '-p':
                password = opt_val
            elif opt == '-s':
                scope_set = opt_val
                load_scopesets = 1
            elif opt == '-g':
                scope_set = opt_val
                load_scopegroups = 1
            elif opt == '-d':
                debug = 1
            elif opt == '-q':
                quick_load = 1
            elif opt == '-C':
                shallow_delete = 1

        operation = pargs[0]
        if operation == "load" or operation == "clearScope" or operation == "clearScopeSet":
            op_arg = pargs[1]

        # check operation
        if operation != "load" and operation != "clearScope" and operation != "clearScopeSet" and operation != "clearAll":
            raise IllegalArgumentException("Unknown command: " + operation)

        # check options
        if user_name == "" or password == "":
            raise IllegalArgumentException(
                "Username and Password are required")
        if operation == "load" and scope_set == "":
            raise IllegalArgumentException("ScopeSet is required for load")
        if operation != "load" and scope_set != "":
            raise IllegalArgumentException(
                "ScopeSet option is only applicable for load command")
        if load_scopegroups == 1 and load_scopesets == 1:
            raise IllegalArgumentException(
                "Only one option of -g and -s can be specified at the same time"
            )

        # check invalid characters
        if "." in scope_set or "/" in scope_set or "'" in scope_set:
            print "Scope Set name cannot contain following characters: , ' / \nScoping properties to such Scope Set will not work.\n"

    except GetoptError, e:  # unknown option
        print str(e)
        usage()
        exit(1)
예제 #16
0
 def getIngestJobSettingsPanel(self, settings):
     if not isinstance(settings, GenericIngestModuleJobSettings):
         raise IllegalArgumentException("Expected settings argument to be instanceof GenericIngestModuleJobSettings")
     self.settings = settings
     return VadCheckModuleSettingsPanel(self.settings)