List of usage examples for java.rmi RemoteException printStackTrace
public void printStackTrace()
From source file:org.ublog.benchmark.social.SocialBenchmark.java
public String getPowerLawTag() { Random rnd = new Random(); int val = 0; int i = 0;//from w w w .ja v a2 s . co m try { val = rnd.nextInt(this.remoteGraphServer.getSomaGraus()) + 1; int sum = 0; for (i = 0; i < 64; i++) { sum += this.remoteGraphServer.degreeOfGrausTags("topico" + i); if (sum >= val) { break; } } } catch (RemoteException e) { e.printStackTrace(); } return "topico" + i; }
From source file:org.ublog.benchmark.social.SocialBenchmark.java
public int getRandomFriend(User myUser) { int res;//from w w w . ja v a2 s .c o m try { res = this.remoteGraphServer.getRandomFriend(myUser); } catch (RemoteException e) { e.printStackTrace(); res = -1; } if (res == -1) return Utils.NUsers; else return res; }
From source file:org.ublog.benchmark.social.SocialBenchmark.java
@Override public ComplexBenchMarkClient createNewClient(Clock clock, int clientCount) { ComplexBenchMarkClient client;//from w w w . j a v a 2 s . co m try { client = new SocialClient(clock, clientCount, this.remoteGraphServer.getClientCount(clientCount), this.nOperations, this.getStatsCollector(), this.thinkTime, this.rndOp, this, this.opFactory); } catch (RemoteException e) { e.printStackTrace(); client = null; } return client; }
From source file:org.ublog.benchmark.social.SocialBenchmark.java
@Override public boolean hasMoreInitOperations() { int userID;/*from ww w .j a v a2 s.c om*/ if (this.hasInitiated == false) { try { userID = this.remoteGraphServer.getUserID(); // System.out.println("USERID HASMOREINIT:"+userID); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); userID = 1; } if (logger.isInfoEnabled()) logger.info("currentUser:" + this.currentUser + ";userID:" + userID + ";currentTweet:" + this.currentTweet + ";currentNTweets:" + this.currentNTweets); return this.missingCreatingTables || this.missingAddingUsers || this.currentUser < userID - 1 || this.currentTweetOp.hasMoreDBOperations() || this.currentTweet < this.currentNTweets - 1; } else return false; }
From source file:org.ublog.benchmark.social.SocialBenchmark.java
@SuppressWarnings("unchecked") @Override//from w w w. j a va 2s.c om public CollectionOperation nextInitOperation() throws UnsupportedEncodingException { CollectionOperation res; if (this.missingCreatingTables) { /* * TableMetaData<String> * metaData=this.collectionsMetadata.get(currentCollection); * this.currentCollection++; res=new * CreateTableOperation<String>(metaData); * this.missingCreatingCollections = false;///////fui q pus */ res = null; this.missingCreatingTables = false; } else { if (missingAddingUsers) { int userID; try { userID = this.remoteGraphServer.getUserID(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); userID = 1; } Map<String, Pair<Map<String, String>, List<Integer>>> puts = new HashMap<String, Pair<Map<String, String>, List<Integer>>>(); for (int i = 0; i < userID; i++) { // User currentUser=this.mapUser.get(i); User currentUser; try { currentUser = this.remoteGraphServer.getMapUser(i); } catch (RemoteException e1) { e1.printStackTrace(); currentUser = null; } Set<String> followers = new HashSet<String>(); Set<String> following = new HashSet<String>(); try { followers = this.remoteGraphServer.getFollowers(currentUser); following = this.remoteGraphServer.getFollowing(currentUser); } catch (RemoteException e) { e.printStackTrace(); } /* * for (DefaultEdge * edge:this.graph.incomingEdgesOf(currentUser)) { * followers. * add(this.graph.getEdgeSource(edge).getUsername()); } for * (DefaultEdge * edge:this.graph.outgoingEdgesOf(currentUser)) { * following. * add(this.graph.getEdgeTarget(edge).getUsername()); } */ // List<Integer> tags=new ArrayList<Integer>(); // tags.add(Utils.getTagUserID(currentUser.getUsername())); puts.put(currentUser.getUsername(), new Pair<Map<String, String>, List<Integer>>(this.clouderUserService.newUser( currentUser, Utils.toString(followers), Utils.toString(following)), null)); } CollectionOperation tmp = new MultiPutOperation(null, "users", puts); tmp.setInit(true); res = tmp; this.missingAddingUsers = false; this.currentUser = 0; this.currentTweet = 0; try { // this.currentNTweets=(int) // Math.ceil(this.graph.outDegreeOf(this.mapUser.get(this.currentUser))*initialTweetsFactor); this.currentNTweets = (int) Math .ceil(this.remoteGraphServer.getOutDegreeOf(currentUser) * initialTweetsFactor); // this.currentTweetOp=this.getNewTweetOperation(this.mapUser.get(this.currentUser), // null); this.currentTweetOp = this.getNewTweetOperation(this.remoteGraphServer.getMapUser(currentUser), null); // System.out.println("currentNTweets: "+currentNTweets); } catch (RemoteException e) { e.printStackTrace(); } this.currentTweetOp.setInit(true); // System.out.println("SET INIT op:"+this.currentTweetOp); } else { if (this.currentTweetOp.hasMoreDBOperations()) { res = this.currentTweetOp.getNextDBOperation(); } else { this.currentTweet++; if (this.currentTweet < this.currentNTweets) { try { // this.currentTweetOp=this.getNewTweetOperation(this.mapUser.get(this.currentUser), // null); this.currentTweetOp = this .getNewTweetOperation(this.remoteGraphServer.getMapUser(currentUser), null); } catch (RemoteException e) { e.printStackTrace(); } this.currentTweetOp.setInit(true); // System.out.println("SET INIT op:"+this.currentTweetOp); res = this.currentTweetOp.getNextDBOperation(); } else { this.currentUser++; this.currentTweet = 0; try { // this.currentNTweets=(int) // Math.ceil(this.graph.outDegreeOf(this.mapUser.get(this.currentUser))*initialTweetsFactor); this.currentNTweets = (int) Math .ceil(this.remoteGraphServer.getOutDegreeOf(currentUser) * initialTweetsFactor); // this.currentTweetOp=this.getNewTweetOperation(this.mapUser.get(this.currentUser), // null); this.currentTweetOp = this .getNewTweetOperation(this.remoteGraphServer.getMapUser(currentUser), null); } catch (RemoteException e) { e.printStackTrace(); } this.currentTweetOp.setInit(true); // System.out.println("SET INIT op:"+this.currentTweetOp); res = this.currentTweetOp.getNextDBOperation(); } } } } if (logger.isInfoEnabled()) logger.info("Next Init Operation is:" + res); return res; }
From source file:org.ublog.benchmark.social.SocialBenchmark.java
public String getNextStartFollowingUser(User user) { // Da o utilizador com mais seguidores ao qual o user ainda nao segue String res = null;/* www . j av a 2 s .c o m*/ while (true) { int userID = this.rndStartFollow.nextInt(Utils.NUsers); boolean containsEdge; try { containsEdge = this.remoteGraphServer.graphContainsEdge(user, userID); } catch (RemoteException e) { e.printStackTrace(); containsEdge = false; } if (!containsEdge) { try { res = this.remoteGraphServer.getMapUser(userID).getUsername(); } catch (RemoteException e) { e.printStackTrace(); } break; } } return res; }
From source file:org.ublog.benchmark.social.SocialBenchmark.java
public String getNextStopFollowingUser(User user) { // Da o utilizador com menos seguidores ao qual o user ainda segue try {//from w w w . ja v a 2 s .c o m return this.remoteGraphServer.getNextStopFollowingUser(user); } catch (RemoteException e) { e.printStackTrace(); return null; } }
From source file:org.wso2.carbon.appmgt.impl.idp.CarbonIdpManager.java
@Override public List<TrustedIdP> getIdPList(String serviceProvider) throws AppManagementException { List<TrustedIdP> idps = new ArrayList<TrustedIdP>(); if (canAddIdP()) { // return complete list of IdPs since we can add the IdP if non // existing one is selected by the subscriber try {//from w ww. j a va 2s . c om org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider[] idpDTOs = idpStub .getAllIdPs(); if (idpDTOs != null && idpDTOs.length > 0) { for (org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider dto : idpDTOs) { TrustedIdP idp = new TrustedIdP(); idp.setName(dto.getIdentityProviderName()); idps.add(idp); } } } catch (RemoteException e) { log.error(e); throw new AppManagementException(e.getMessage()); } catch (IdentityProviderMgtServiceIdentityProviderManagementExceptionException e) { log.error(e); throw new AppManagementException(e.getMessage()); } } else { // only returns the set of IdPs which are already added to the SP as // trusted. try { AuthenticationStep[] steps = appMgtStub.getApplication(serviceProvider) .getLocalAndOutBoundAuthenticationConfig().getAuthenticationSteps(); if (steps != null && steps.length > 0) { for (AuthenticationStep step : steps) { if (step.getFederatedIdentityProviders() != null && step.getFederatedIdentityProviders().length > 0) { for (IdentityProvider idp : step.getFederatedIdentityProviders()) { TrustedIdP tIdp = new TrustedIdP(); tIdp.setName(idp.getIdentityProviderName()); idps.add(tIdp); } } } } } catch (RemoteException e) { e.printStackTrace(); throw new AppManagementException(e.getMessage()); } catch (IdentityApplicationManagementServiceIdentityApplicationManagementException e) { e.printStackTrace(); throw new AppManagementException(e.getMessage()); } } return idps; }
From source file:org.wso2.carbon.identity.authorization.ui.IdentityAuthorizationClient.java
public List<PermissionModule> loadModules() { try {/*from w w w . j a va 2 s . c om*/ PermissionModule[] modules = stub.loadModules(); List<PermissionModule> moduleList = new ArrayList<PermissionModule>(); if (modules != null) { for (PermissionModule module : modules) { moduleList.add(module); if (module.getActions() != null && module.getActions().length > 0) { List<String> validActions = new ArrayList<String>(); for (String action : module.getActions()) { if (action != null && !action.equals("null")) { validActions.add(action); } } module.setActions(validActions.toArray(new String[validActions.size()])); } } return Arrays.asList(modules); } } catch (RemoteException e) { e.printStackTrace(); } catch (AuthorizationAdminServiceIdentityAuthorizationException e) { e.printStackTrace(); } return null; }
From source file:org.wso2.carbon.identity.certificateauthority.ui.client.CAAdminServiceClient.java
/** * Sign the CSR file with a given serial number and validity period * * @param serial serial number of signing CSR * @param validity validity period/*from w ww .j a va 2s .c o m*/ */ public void sign(String serial, int validity) { try { stub.signCSR(serial, validity); } catch (RemoteException e) { //todo: exception handling e.printStackTrace(); } catch (CAAdminServiceCaException e) { e.printStackTrace(); } }