Beispiel #1
0
def exportAll(exportConfigFile, generalConfigFile):
    try:
        print "Loading export config from :", exportConfigFile
        exportConfigProp = loadProps(exportConfigFile,generalConfigFile)
        adminUrl = exportConfigProp.get("adminUrl")
        user = exportConfigProp.get("user")
        passwd = exportConfigProp.get("password")

        jarFileName = exportConfigProp.get("jarFileName")
        customFile = exportConfigProp.get("customizationFile")

        passphrase = exportConfigProp.get("passphrase")
        project = exportConfigProp.get("project")

        connectToServer(user, passwd, adminUrl)
        print 'connected'

        ALSBConfigurationMBean = findService("ALSBConfiguration", "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")
        print "ALSBConfiguration MBean found"

        print project
        if project == None :
            ref = Ref.DOMAIN
            collection = Collections.singleton(ref)
            if passphrase == None :
                print "Export the config"
                theBytes = ALSBConfigurationMBean.export(collection, true, None)
            else :
                print "Export and encrypt the config"
                theBytes = ALSBConfigurationMBean.export(collection, true, passphrase)
        else :
            ref = Ref.makeProjectRef(project);
            print "Export the project", project
            collection = Collections.singleton(ref)
            theBytes = ALSBConfigurationMBean.exportProjects(collection, passphrase)
        print 'fileName',jarFileName
        aFile = File(jarFileName)
        print 'file',aFile
        out = FileOutputStream(aFile)
        out.write(theBytes)
        out.close()
        print "ALSB Configuration file: "+ jarFileName + " has been exported"

        if customFile != None:
            print collection
            query = EnvValueQuery(None, Collections.singleton(EnvValueTypes.WORK_MANAGER), collection, false, None, false)
            customEnv = FindAndReplaceCustomization('Set the right Work Manager', query, 'Production System Work Manager')
            print 'EnvValueCustomization created'
            customList = ArrayList()
            customList.add(customEnv)
            print customList
            aFile = File(customFile)
            out = FileOutputStream(aFile)
            Customization.toXML(customList, out)
            out.close()

#        print "ALSB Dummy Customization file: "+ customFile + " has been created"
    except:
        raise
Beispiel #2
0
def exportAll():
    try:

        ALSBConfigurationMBean = findService(
            "ALSBConfiguration",
            "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")
        print "ALSBConfiguration MBean found"

        print project
        if project == "None":
            ref = Ref.DOMAIN
            collection = Collections.singleton(ref)
            if passphrase == None:
                print "Export the config"
                theBytes = ALSBConfigurationMBean.export(
                    collection, true, None)
            else:
                print "Export and encrypt the config"
                theBytes = ALSBConfigurationMBean.export(
                    collection, true, passphrase)
        else:
            ref = Ref.makeProjectRef(project)
            print "Export the project", project
            collection = Collections.singleton(ref)
            theBytes = ALSBConfigurationMBean.exportProjects(
                collection, passphrase)

        aFile = File(exportJar)
        out = FileOutputStream(aFile)
        out.write(theBytes)
        out.close()
        print "ALSB Configuration file: " + exportJar + " has been exported"

        if customFile != "None":
            print collection
            query = EnvValueQuery(
                None, Collections.singleton(EnvValueTypes.WORK_MANAGER),
                collection, false, None, false)
            customEnv = FindAndReplaceCustomization(
                'Set the right Work Manager', query,
                'Production System Work Manager')
            print 'EnvValueCustomization created'
            customList = ArrayList()
            customList.add(customEnv)
            print customList
            aFile = File(customFile)
            out = FileOutputStream(aFile)
            Customization.toXML(customList, out)
            out.close()

        print "ALSB Dummy Customization file: " + customFile + " has been created"
    except:
        raise
Beispiel #3
0
 def makeNextAssignmentValid(self):
     """ generated source for method makeNextAssignmentValid """
     if self.nextAssignment == None:
         return
     # Something new that can pop up with functional constants...
     i = 0
     while i < len(self.nextAssignment):
         if self.nextAssignment.get(i) == None:
             # Some function doesn't agree with the answer here
             # So what do we increment?
             incrementIndex(self.plan.getIndicesToChangeWhenNull().get(i))
             if self.nextAssignment == None:
                 return
             i = -1
         i += 1
     # Find all the unsatisfied distincts
     # Find the pair with the earliest var. that needs to be changed
     varsToChange = ArrayList()
     d = 0
     while d < self.plan.getDistincts().size():
         # The assignments must use the assignments implied by nextAssignment
         if term1 == term2:
             # need to change one of these
             varsToChange.add(self.plan.getVarsToChangePerDistinct().get(d))
         d += 1
     if not varsToChange.isEmpty():
         # We want just the one, as it is a full restriction on its
         # own behalf
         changeOneInNext(Collections.singleton(varToChange))
Beispiel #4
0
def removeFolderFromOSBDomain(folder):
    '''remove a folder'''
    try:
        domainRuntime()

        sessionName = "RemoveFolderSession_" + str(System.currentTimeMillis())
        msg("Trying to remove " + folder, _LOG_LEVEL.INFO)

        sessionManagementMBean = findService(SessionManagementMBean.NAME,
                                             SessionManagementMBean.TYPE)
        msg("SessionMBean started session", _LOG_LEVEL.INFO)
        sessionManagementMBean.createSession(sessionName)
        msg('Created session <' + sessionName + '>', _LOG_LEVEL.INFO)
        folderRef = Refs.makeParentRef(folder)
        alsbConfigurationMBean = findService(
            ALSBConfigurationMBean.NAME + "." + sessionName,
            ALSBConfigurationMBean.TYPE)
        if alsbConfigurationMBean.exists(folderRef):
            msg("#### removing OSB folder: " + folder, _LOG_LEVEL.INFO)
            alsbConfigurationMBean.delete(Collections.singleton(folderRef))
            sessionManagementMBean.activateSession(
                sessionName,
                "Complete service removal with customization using wlst")
        else:
            msg("OSB folder <" + folder + "> does not exist",
                _LOG_LEVEL.WARNING)
            discardSession(sessionManagementMBean, sessionName)
        print
    except:
        msg("Error whilst removing project:" + sys.exc_info()[0],
            _LOG_LEVEL.ERROR)
        discardSession(sessionManagementMBean, sessionName)
Beispiel #5
0
def undeployProxyFromOSBDomain(relativePath, proxyServiceName):
    '''Remove a proxyservice'''
    try:
        domainRuntime()

        sessionName = "UndeployProxySession_" + str(System.currentTimeMillis())
        msg("Trying to remove " + proxyServiceName, _LOG_LEVEL.INFO)

        sessionManagementMBean = findService(SessionManagementMBean.NAME,
                                             SessionManagementMBean.TYPE)
        msg("SessionMBean started session", _LOG_LEVEL.INFO)
        sessionManagementMBean.createSession(sessionName)
        msg('Created session <' + sessionName + '>', _LOG_LEVEL.INFO)
        serviceRef, sessionBean = findProxyService(relativePath,
                                                   proxyServiceName,
                                                   sessionName)
        alsbConfigurationMBean = findService(
            ALSBConfigurationMBean.NAME + "." + sessionName,
            ALSBConfigurationMBean.TYPE)
        if alsbConfigurationMBean.exists(serviceRef):
            msg("#### removing OSB proxy service: " + proxyServiceName,
                _LOG_LEVEL.INFO)
            alsbConfigurationMBean.delete(Collections.singleton(serviceRef))
            sessionManagementMBean.activateSession(
                sessionName,
                "Complete service removal with customization using wlst")
        else:
            msg("OSB project <" + proxyServiceName + "> does not exist",
                _LOG_LEVEL.WARNING)
            discardSession(sessionManagementMBean, sessionName)
    except:
        msg("Error whilst removing project:" + sys.exc_info()[0],
            _LOG_LEVEL.ERROR)
        discardSession(sessionManagementMBean, sessionName)
        raise
Beispiel #6
0
def exportAll():
    try:

        ALSBConfigurationMBean = findService("ALSBConfiguration", "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")
        print "ALSBConfiguration MBean found"

        print project
        if project == "None" :
            ref = Ref.DOMAIN
            collection = Collections.singleton(ref)
            if passphrase == None :
                print "Export the config"
                theBytes = ALSBConfigurationMBean.export(collection, true, None)
            else :
                print "Export and encrypt the config"
                theBytes = ALSBConfigurationMBean.export(collection, true, passphrase)
        else :
            ref = Ref.makeProjectRef(project);
            print "Export the project", project
            collection = Collections.singleton(ref)
            theBytes = ALSBConfigurationMBean.exportProjects(collection, passphrase)

        aFile = File(exportJar)
        out = FileOutputStream(aFile)
        out.write(theBytes)
        out.close()
        print "ALSB Configuration file: "+ exportJar + " has been exported"

        if customFile != "None":
            print collection
            query = EnvValueQuery(None, Collections.singleton(EnvValueTypes.WORK_MANAGER), collection, false, None, false)
            customEnv = FindAndReplaceCustomization('Set the right Work Manager', query, 'Production System Work Manager')
            print 'EnvValueCustomization created'
            customList = ArrayList()
            customList.add(customEnv)
            print customList
            aFile = File(customFile)
            out = FileOutputStream(aFile)
            Customization.toXML(customList, out)
            out.close()

        print "ALSB Dummy Customization file: "+ customFile + " has been created"
    except:
        raise
Beispiel #7
0
def deleteProject(alsbConfigurationMBean, projectName):
    try:
        projectRef = Ref(Ref.PROJECT_REF, Ref.DOMAIN, projectName)
        if alsbConfigurationMBean.exists(projectRef):
            print 'INFO: Removing OSB project: ' + projectName
            alsbConfigurationMBean.delete(Collections.singleton(projectRef))
            print 'INFO: Removed OSB project: ' + projectName
        else:
            raise ValueError('No OSB project exists with name ' + projectName)
    except:
        raise
Beispiel #8
0
def getDependentServices(ambiente, configMBean):
    psQuery = ProxyServiceQuery()
    myPSSet = configMBean.getRefs(psQuery)
    relDepServices = [];
    for myPS in myPSSet:
		depQuery = DependencyQuery(Collections.singleton(myPS), False)
		refs = configMBean.getRefs(depQuery)
		for ref in refs:
			if (ref.getTypeId() == "BusinessService" or ref.getTypeId() == "ProxyService"):
				update = "INSERT INTO izzi_service_dependencies (SERVICE,DEPENDENTSERVICE, AMBIENTE) values ('" + myPS.getFullName() + "','" + ref.getFullName() + "','"+ambiente+"')"
				print update
				relDepServices.append(update)

    return relDepServices
Beispiel #9
0
def undeployProjects():
    SessionMBean = None

    print 'Attempting to undeploy from ALSB Admin Server listening on ', adminUrl

    # domainRuntime()
    sessionName = "TransientWLSTSession_" + str(System.currentTimeMillis())
    sessMgmtMBean = findService(SessionManagementMBean.NAME,
                                SessionManagementMBean.TYPE)
    sessMgmtMBean.createSession(sessionName)

    print 'Created session [', sessionName, ']'

    alsbConfigMBean = findService(
        ALSBConfigurationMBean.NAME + "." + sessionName,
        ALSBConfigurationMBean.TYPE)

    projectRefs = alsbConfigMBean.getRefs(Ref.DOMAIN)

    projectList = projectRefs.iterator()

    while projectList.hasNext():
        projectRef = projectList.next()

        if projectRef.getTypeId() == Ref.PROJECT_REF:
            print "Project name : " + (projectRef.getProjectName())

            if alsbConfigMBean.exists(projectRef):
                print "#### removing OSB project: " + projectRef.getProjectName(
                )
                if projectRef.getProjectName() == "System":
                    print "Omitting System project ..."
                else:
                    alsbConfigMBean.delete(Collections.singleton(projectRef))
                print
            else:
                failed = "OSB project <" + projectRef.getProjectName(
                ) + "> does not exist"
                print failed
            print

    print "Activating session ... "
    sessMgmtMBean.activateSession(
        sessionName, "Complete project removal with customization using wlst")
    print "Session activated."

    cleanupSession(sessMgmtMBean, sessionName)

    print "done!"
Beispiel #10
0
def getAllServiceURIs(ambiente, configMBean):

    relAllServicesURI = [];

    evquery = EnvValueQuery(None, Collections.singleton(EnvValueTypes.SERVICE_URI), None, False, None, False)

    founds = configMBean.findEnvValues(evquery)

    for value in founds:

        update = "UPDATE izzi_SERVICES set SERVICE_URI = '" + value.getValue() + "' where SERVICEFULLPATH ='" + value.getOwner().getFullName() + "'"

        relAllServicesURI.append(update)

    return relAllServicesURI
Beispiel #11
0
def deleteOSBProject(alsbConfigurationMBean, projectName):
    '''Delete a OSB project'''
    try:
        msg("Trying to remove " + projectName, _LOG_LEVEL.INFO)
        projectRef = Ref(Ref.PROJECT_REF, Ref.DOMAIN, projectName)
        if alsbConfigurationMBean.exists(projectRef):
            msg("#### removing OSB project: " + projectName, _LOG_LEVEL.INFO)
            alsbConfigurationMBean.delete(Collections.singleton(projectRef))
            msg("#### removed project: " + projectName, _LOG_LEVEL.INFO)
        else:
            msg("OSB project <" + projectName + "> does not exist",
                _LOG_LEVEL.WARNING)
    except:
        msg("Error whilst removing project:" + sys.exc_info()[0],
            _LOG_LEVEL.ERROR)
        raise
Beispiel #12
0
def getBusinessServiceURI(ref, configMBean):

    envValueTypesToSearch = HashSet()

    envValueTypesToSearch.add(EnvValueTypes.SERVICE_URI);

    evquery = EnvValueQuery(None, envValueTypesToSearch, Collections.singleton(ref), False, None, False)

    founds = configMBean.findEnvValues(evquery);

    uri = ""

    for qev in founds:

        if (qev.getEnvValueType() == EnvValueTypes.SERVICE_URI):

            uri = qev.getValue()

    return uri;
Beispiel #13
0
def computeHighlighting(text):
    lastKwEnd = 0
    spansBuilder = StyleSpansBuilder()
    for m in re.finditer(PATTERN,text):
        styleClass = "keyword"
        if m.group("keyword"):
            styleClass = "keyword"
        elif m.group("brace"):
            styleClass = "paren"
        elif m.group("comment"):
            styleClass = "comment"
        elif m.group("types"):
            styleClass = "types"
        elif m.group("cond"):
            styleClass = "conditional"
        spansBuilder.add(Collections.emptyList(), m.start() - lastKwEnd)
        spansBuilder.add(Collections.singleton(styleClass), m.end() - m.start())
        lastKwEnd = m.end()
    spansBuilder.add(Collections.emptyList(), len(text)- lastKwEnd)
    return spansBuilder.create()
Beispiel #14
0
def exportAll():
    try:

        ALSBConfigurationMBean = findService(
            "ALSBConfiguration",
            "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")
        print "ALSBConfiguration MBean found"

        print project
        if project == "None":
            ref = Ref.DOMAIN
            collection = Collections.singleton(ref)
            if passphrase == None:
                print "Export the config"
                theBytes = ALSBConfigurationMBean.export(
                    collection, true, None)
            else:
                print "Export and encrypt the config"
                theBytes = ALSBConfigurationMBean.export(
                    collection, true, passphrase)
        else:
            ref = Ref.makeProjectRef(project)
            print "Export the project", project
            collection = Collections.singleton(ref)
            theBytes = ALSBConfigurationMBean.exportProjects(
                collection, passphrase)

        aFile = File(exportJar)
        out = FileOutputStream(aFile)
        out.write(theBytes)
        out.close()
        print "ALSB Configuration file: " + exportJar + " has been exported"

        if customFile != "None":
            print collection
            # see com.bea.wli.sb.util.EnvValueTypes in sb-kernel-api.jar for the values

            #EnvValueQuery evquery =
            #     new EnvValueQuery(
            #         null,        // search across all resource types
            #         Collections.singleton(EnvValueTypes.URI_ENV_VALUE_TYPE), // search only the URIs
            #         null,        // search across all projects and folders.
            #         true,        // only search across resources that are
            #                      // actually modified/imported in this session
            #         "localhost", // the string we want to replace
            #         false        // not a complete match of URI. any URI
            #                      // that has "localhost" as substring will match
            #         );

            refTypes = HashSet()
            refTypes.add(EnvValueTypes.SERVICE_URI_TABLE)
            refTypes.add(EnvValueTypes.SERVICE_URI)
            query = EnvValueQuery(
                Collections.singleton(Refs.BUSINESS_SERVICE_TYPE), refTypes,
                collection, false, "search string", false)
            #           query = EnvValueQuery(None, Collections.singleton(EnvValueTypes.SERVICE_URI_TABLE), collection, false, "search string", false)
            customEnv = FindAndReplaceCustomization('new endpoint url', query,
                                                    'replace string')

            #            object = QualifiedEnvValue(Refs.makeBusinessSvcRef(ref,'file'), Refs.BUSINESS_SERVICE_TYPE, "XSDvalidation/file", "aaa")
            #            objects = ArrayList()
            #            objects.add(object)
            #            customEnv2 = EnvValueCustomization('Set the right endpoints', objects)

            print 'EnvValueCustomization created'
            customList = ArrayList()
            customList.add(customEnv)
            #            customList.add(customEnv2)

            print customList
            aFile = File(customFile)
            out = FileOutputStream(aFile)
            Customization.toXML(customList, out)
            out.close()

        print "ALSB Dummy Customization file: " + customFile + " has been created"
    except:
        raise
Beispiel #15
0
def exportAll():
    try:

        ALSBConfigurationMBean = findService("ALSBConfiguration", "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")
        print "ALSBConfiguration MBean found"

        print project
        if project == "None" :
            ref = Ref.DOMAIN
            collection = Collections.singleton(ref)
            if passphrase == None :
                print "Export the config"
                theBytes = ALSBConfigurationMBean.export(collection, true, None)
            else :
                print "Export and encrypt the config"
                theBytes = ALSBConfigurationMBean.export(collection, true, passphrase)
        else :
            ref = Ref.makeProjectRef(project);
            print "Export the project", project
            collection = Collections.singleton(ref)
            theBytes = ALSBConfigurationMBean.exportProjects(collection, passphrase)

        aFile = File(exportJar)
        out = FileOutputStream(aFile)
        out.write(theBytes)
        out.close()
        print "ALSB Configuration file: "+ exportJar + " has been exported"

        if customFile != "None":
            print collection
# see com.bea.wli.sb.util.EnvValueTypes in sb-kernel-api.jar for the values

#EnvValueQuery evquery =
#     new EnvValueQuery(
#         null,        // search across all resource types
#         Collections.singleton(EnvValueTypes.URI_ENV_VALUE_TYPE), // search only the URIs
#         null,        // search across all projects and folders.
#         true,        // only search across resources that are
#                      // actually modified/imported in this session
#         "localhost", // the string we want to replace
#         false        // not a complete match of URI. any URI
#                      // that has "localhost" as substring will match
#         );

            refTypes = HashSet()
            refTypes.add(EnvValueTypes.SERVICE_URI_TABLE)
            refTypes.add(EnvValueTypes.SERVICE_URI)
            query = EnvValueQuery(Collections.singleton(Refs.BUSINESS_SERVICE_TYPE), refTypes, collection, false, "search string", false)
#           query = EnvValueQuery(None, Collections.singleton(EnvValueTypes.SERVICE_URI_TABLE), collection, false, "search string", false)
            customEnv = FindAndReplaceCustomization('new endpoint url', query, 'replace string')

#            object = QualifiedEnvValue(Refs.makeBusinessSvcRef(ref,'file'), Refs.BUSINESS_SERVICE_TYPE, "XSDvalidation/file", "aaa")
#            objects = ArrayList()
#            objects.add(object)
#            customEnv2 = EnvValueCustomization('Set the right endpoints', objects)

            print 'EnvValueCustomization created'
            customList = ArrayList()
            customList.add(customEnv)
#            customList.add(customEnv2)

            print customList
            aFile = File(customFile)
            out = FileOutputStream(aFile)
            Customization.toXML(customList, out)
            out.close()

        print "ALSB Dummy Customization file: "+ customFile + " has been created"
    except:
        raise
Beispiel #16
0
def unpublish():
    try:
        # Declare Variables
        sessionMBean = None
        alsbConfigurationMBean = None
        packageHome = sys.argv[4]

        # Connect to Server
        print "Connecting to server: ", sys.argv[3]
        connectToServer()

        # Create unique session name
        print "Creating unique session name"
        sessionName = createSessionName()
        print "Created session name :", sessionName

        # Create and start session
        print "Creating SessionMBean"
        sessionMBean = getSessionMBean(sessionName)
        print "SessionMBean started new session"

        # obtain the ALSBConfigurationMBean instance that operates
        # on the session that has just been created. Notice that
        # the name of the mbean contains the session name.
        print "Create ALSBConfiguration"
        alsbConfigurationMBean = findService(
            String(ALSBConfigurationMBean.NAME + ".").concat(sessionName), ALSBConfigurationMBean.TYPE
        )
        print "ALSBConfiguration MBean found", alsbConfigurationMBean

        # Perform updates or read operations in the session using alsbSession
        # sys.arg[4] is the root of the package
        print "INFO package root is " + packageHome
        psc_list = []

        try:
            file = open(packageHome + "/" + "osbundeployables.properties", "rb")
        except:
            print "ERROR failed to open osbundeployables.properties"
            raise
        for line in file.readlines():
            print "INFO removing " + line.rstrip()
            pscName = line.rstrip()
            if len(pscName) != 0:
                psc_list.append(pscName)
                projectRef = com.bea.wli.config.Ref(
                    com.bea.wli.config.Ref.PROJECT_REF, com.bea.wli.config.Ref.DOMAIN, pscName
                )
                if alsbConfigurationMBean.exists(projectRef):
                    alsbConfigurationMBean.delete(Collections.singleton(projectRef))

        print "INFO This session has removed for the following projects:"
        for psc in psc_list:
            print "\t" + psc

        try:
            sessionMBean.activateSession(sessionName, "Deleted projects" + "\t" + "\n\t".join(psc_list))
        except:
            print "ERROR problem encountered activating the session"
            print "INFO this can happen if one or more of the managed servers are not running"
            raise

    except:
        print "ERROR Unexpected error:", sys.exc_info()[0]
        if sessionMBean != None:
            sessionMBean.discardSession(sessionName)
            file.close()
            raise
Beispiel #17
0
    def translateAttributes(self, context, configurationAttributes):
        print "Idp extension. Method: translateAttributes"

        # Return False to use default method
        #return False

        request = context.getRequest()
        userProfile = context.getUserProfile()
        principalAttributes = self.defaultNameTranslator.produceIdpAttributePrincipal(
            userProfile.getAttributes())
        print "Idp extension. Converted user profile: '%s' to attribute principal: '%s'" % (
            userProfile, principalAttributes)

        if not principalAttributes.isEmpty():
            print "Idp extension. Found attributes from oxAuth. Processing..."

            # Start: Custom part
            # Add givenName attribute
            givenNameAttribute = IdPAttribute("oxEnrollmentCode")
            givenNameAttribute.setValues(
                ArrayList(Arrays.asList(StringAttributeValue("Dummy"))))
            principalAttributes.add(IdPAttributePrincipal(givenNameAttribute))
            print "Idp extension. Updated attribute principal: '%s'" % principalAttributes
            # End: Custom part

            principals = HashSet()
            principals.addAll(principalAttributes)
            principals.add(UsernamePrincipal(userProfile.getId()))

            request.setAttribute(
                ExternalAuthentication.SUBJECT_KEY,
                Subject(False, Collections.singleton(principals),
                        Collections.emptySet(), Collections.emptySet()))

            print "Created an IdP subject instance with principals containing attributes for: '%s'" % userProfile.getId(
            )

            if False:
                idpAttributes = ArrayList()
                for principalAttribute in principalAttributes:
                    idpAttributes.add(principalAttribute.getAttribute())

                request.setAttribute(ExternalAuthentication.ATTRIBUTES_KEY,
                                     idpAttributes)

                authenticationKey = context.getAuthenticationKey()
                profileRequestContext = ExternalAuthentication.getProfileRequestContext(
                    authenticationKey, request)
                authContext = profileRequestContext.getSubcontext(
                    AuthenticationContext)
                extContext = authContext.getSubcontext(
                    ExternalAuthenticationContext)

                extContext.setSubject(
                    Subject(False, Collections.singleton(principals),
                            Collections.emptySet(), Collections.emptySet()))

                extContext.getSubcontext(
                    AttributeContext,
                    True).setUnfilteredIdPAttributes(idpAttributes)
                extContext.getSubcontext(AttributeContext).setIdPAttributes(
                    idpAttributes)
        else:
            print "No attributes released from oxAuth. Creating an IdP principal for: '%s'" % userProfile.getId(
            )
            request.setAttribute(ExternalAuthentication.PRINCIPAL_NAME_KEY,
                                 userProfile.getId())

        #Return True to specify that default method is not needed
        return False
Beispiel #18
0
 def create_0(cls, description, verbose):
     """ generated source for method create_0 """
     print "Building propnet..."
     startTime = System.currentTimeMillis()
     description = GdlCleaner.run(description)
     description = DeORer.run(description)
     description = VariableConstrainer.replaceFunctionValuedVariables(description)
     description = Relationizer.run(description)
     description = CondensationIsolator.run(description)
     if verbose:
         for gdl in description:
             print gdl
     # We want to start with a rule graph and follow the rule graph.
     # Start by finding general information about the game
     model = SentenceDomainModelFactory.createWithCartesianDomains(description)
     # Restrict domains to values that could actually come up in rules.
     # See chinesecheckers4's "count" relation for an example of why this
     # could be useful.
     model = SentenceDomainModelOptimizer.restrictDomainsToUsefulValues(model)
     if verbose:
         print "Setting constants..."
     constantChecker = ConstantCheckerFactory.createWithForwardChaining(model)
     if verbose:
         print "Done setting constants"
     sentenceFormNames = SentenceForms.getNames(model.getSentenceForms())
     usingBase = sentenceFormNames.contains("base")
     usingInput = sentenceFormNames.contains("input")
     # For now, we're going to build this to work on those with a
     # particular restriction on the dependency graph:
     # Recursive loops may only contain one sentence form.
     # This describes most games, but not all legal games.
     dependencyGraph = model.getDependencyGraph()
     if verbose:
         print "Computing topological ordering... ",
         System.out.flush()
     ConcurrencyUtils.checkForInterruption()
     topologicalOrdering = getTopologicalOrdering(model.getSentenceForms(), dependencyGraph, usingBase, usingInput)
     if verbose:
         print "done"
     roles = Role.computeRoles(description)
     components = HashMap()
     negations = HashMap()
     trueComponent = Constant(True)
     falseComponent = Constant(False)
     functionInfoMap = HashMap()
     completedSentenceFormValues = HashMap()
     for form in topologicalOrdering:
         ConcurrencyUtils.checkForInterruption()
         if verbose:
             print "Adding sentence form " + form,
             System.out.flush()
         if constantChecker.isConstantForm(form):
             if verbose:
                 print " (constant)"
             # Only add it if it's important
             if form.__name__ == cls.LEGAL or form.__name__ == cls.GOAL or form.__name__ == cls.INIT:
                 # Add it
                 for trueSentence in constantChecker.getTrueSentences(form):
                     trueProp.addInput(trueComponent)
                     trueComponent.addOutput(trueProp)
                     components.put(trueSentence, trueComponent)
             if verbose:
                 print "Checking whether " + form + " is a functional constant..."
             addConstantsToFunctionInfo(form, constantChecker, functionInfoMap)
             addFormToCompletedValues(form, completedSentenceFormValues, constantChecker)
             continue 
         if verbose:
             print 
         # TODO: Adjust "recursive forms" appropriately
         # Add a temporary sentence form thingy? ...
         addSentenceForm(form, model, components, negations, trueComponent, falseComponent, usingBase, usingInput, Collections.singleton(form), temporaryComponents, temporaryNegations, functionInfoMap, constantChecker, completedSentenceFormValues)
         # TODO: Pass these over groups of multiple sentence forms
         if verbose and not temporaryComponents.isEmpty():
             print "Processing temporary components..."
         processTemporaryComponents(temporaryComponents, temporaryNegations, components, negations, trueComponent, falseComponent)
         addFormToCompletedValues(form, completedSentenceFormValues, components)
         # if(verbose)
         # TODO: Add this, but with the correct total number of components (not just Propositions)
         # print "  "+completedSentenceFormValues.get(form).size() + " components added";
     # Connect "next" to "true"
     if verbose:
         print "Adding transitions..."
     addTransitions(components)
     # Set up "init" proposition
     if verbose:
         print "Setting up 'init' proposition..."
     setUpInit(components, trueComponent, falseComponent)
     # Now we can safely...
     removeUselessBasePropositions(components, negations, trueComponent, falseComponent)
     if verbose:
         print "Creating component set..."
     componentSet = HashSet(components.values())
     # Try saving some memory here...
     components = None
     negations = None
     completeComponentSet(componentSet)
     ConcurrencyUtils.checkForInterruption()
     if verbose:
         print "Initializing propnet object..."
     # Make it look the same as the PropNetFactory results, until we decide
     # how we want it to look
     normalizePropositions(componentSet)
     propnet = PropNet(roles, componentSet)
     if verbose:
         print "Done setting up propnet; took " + (System.currentTimeMillis() - startTime) + "ms, has " + len(componentSet) + " components and " + propnet.getNumLinks() + " links"
         print "Propnet has " + propnet.getNumAnds() + " ands; " + propnet.getNumOrs() + " ors; " + propnet.getNumNots() + " nots"
     # print propnet;
     return propnet
 def __authorize_with_service_account(service_account_json):
     credential = GoogleCredential.fromStream(IOUtils.toInputStream(service_account_json, StandardCharsets.UTF_8)).createScoped(Collections.singleton(AndroidPublisherScopes.ANDROIDPUBLISHER))
     return credential
Beispiel #20
0
def exportAll(exportConfigFile):
    try:
        print "Loading export config from :", exportConfigFile
        exportConfigProp = loadProps(exportConfigFile)
        adminUrl = exportConfigProp.get("adminUrl")
        exportUser = exportConfigProp.get("exportUser")
        exportPasswd = exportConfigProp.get("exportPassword")

        exportJar = exportConfigProp.get("exportJar")
        customFile = exportConfigProp.get("customizationFile")

        passphrase = exportConfigProp.get("passphrase")
        project = exportConfigProp.get("project")

        connectToServer(exportUser, exportPasswd, adminUrl)

        ALSBConfigurationMBean = findService(
            "ALSBConfiguration",
            "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")
        print "ALSBConfiguration MBean found"

        print project
        if project == None:
            ref = Ref.DOMAIN
            collection = Collections.singleton(ref)
            if passphrase == None:
                print "Export the config"
                theBytes = ALSBConfigurationMBean.export(
                    collection, true, None)
            else:
                print "Export and encrypt the config"
                theBytes = ALSBConfigurationMBean.export(
                    collection, true, passphrase)
        else:
            ref = Ref.makeProjectRef(project)
            print "Export the project", project
            collection = Collections.singleton(ref)
            theBytes = ALSBConfigurationMBean.exportProjects(
                collection, passphrase)

        aFile = File(exportJar)
        out = FileOutputStream(aFile)
        out.write(theBytes)
        out.close()
        print "ALSB Configuration file: " + exportJar + " has been exported"

        if customFile != None:
            print collection
            customList = ArrayList()
            query = EnvValueQuery(
                None, Collections.singleton(EnvValueTypes.WORK_MANAGER),
                collection, false, None, false)
            customEnv = FindAndReplaceCustomization(
                'Set the right Work Manager', query,
                'Production System Work Manager')
            customList.add(customEnv)

            # Uncomment the next three lines to update the server and port to the
            # alsb30_prod environment correctly
            #query = EnvValueQuery(None, Collections.singleton(EnvValueTypes.SERVICE_URI), collection, false, 'localhost:7001', false)
            #customEnv = FindAndReplaceCustomization('Update to the correct server and port number', query, 'localhost:7101')
            #customList.add(customEnv)

            print 'EnvValueCustomization created'
            print customList
            aFile = File(customFile)
            out = FileOutputStream(aFile)
            Customization.toXML(customList, out)
            out.close()

        print "ALSB Customization file: " + customFile + " has been created"
    except:
        raise