Java Code Examples for java.rmi.RemoteException

The following examples show how to use java.rmi.RemoteException. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: oodt   Source File: RMIContext.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Get the RMI registry.
 *
 * @return a <code>Registry</code> value.
 * @throws NamingException if an error occurs.
 */
private Registry getRegistry() throws NamingException {
	if (registry != null) {
	  return registry;
	}
	try {
		String host = environment.containsKey("host")? (String) environment.get("host") : "localhost";
		int port = environment.containsKey("port")? (Integer) environment.get("port")
			: Registry.REGISTRY_PORT;

		
		registry = LocateRegistry.getRegistry(host, port);
	} catch (RemoteException ex) {
		throw new NamingException("Remote exception locating registry: " + ex.getMessage());
	}
	return registry;
}
 
Example 2
Source Project: openjdk-8-source   Source File: AppleImpl.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Return a newly created and exported orange implementation.
 */
public Orange newOrange(String name) throws RemoteException {
    try {
        String threadName = Thread.currentThread().getName();
        logger.log(Level.FINEST,
            threadName + ": " + toString() +
            ".newOrange(" + name + "): BEGIN");

        Orange orange = new OrangeImpl(name);

        logger.log(Level.FINEST,
            threadName + ": " + toString() +
            ".newOrange(" + name + "): END");

        return orange;
    } catch (RuntimeException e) {
        logger.log(Level.SEVERE, toString() + ".newOrange():", e);
        throw e;
    }
}
 
Example 3
Source Project: osp   Source File: DataTrackSupport.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sends a message to the remote DataTrackTool in the form of a String-to-Object mapping.
 * The message may include Data as a "data"-to-Data mapping.
 *
 * @param id a number to identify the data source (typically hashcode())
 * @param message the message to send
 * @return true if sent successfully
 */
public static boolean sendMessage(int id, Map<String, Object> message) {
	Tool tool = getRemoteTool();
	if (tool==null) return false;
// get message control and set properties based on info map
XMLControl control = getMessageControl(id);
Data data = null;
for (String key: message.keySet()) {
	Object value = message.get(key);
	if (key.equals("data")) { //$NON-NLS-1$
		data = (Data)value;
	}
	control.setValue(key, value);
}
	try {
	tool.send(new LocalJob(control.toXML()), getSupportTool());
} catch (RemoteException e) {
	return false;
}
	if (data!=null) {
  	dataNames.add(data.getName());
	}
	return true;
}
 
Example 4
Source Project: tomee   Source File: EntityEJBHomeHandler.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected Object removeByPrimaryKey(final Method method, final Object[] args, final Object proxy) throws Throwable {
    final Object primKey = args[0];

    if (primKey == null) {
        throw new NullPointerException("The primary key is null.");
    }

    final EJBRequest req = new EJBRequest(RequestMethodCode.EJB_HOME_REMOVE_BY_PKEY, ejb, method, args, primKey, client.getSerializer());

    final EJBResponse res = request(req);

    switch (res.getResponseCode()) {
        case ResponseCodes.EJB_ERROR:
            throw new SystemError((ThrowableArtifact) res.getResult());
        case ResponseCodes.EJB_SYS_EXCEPTION:
            throw new SystemException((ThrowableArtifact) res.getResult());
        case ResponseCodes.EJB_APP_EXCEPTION:
            throw new ApplicationException((ThrowableArtifact) res.getResult());
        case ResponseCodes.EJB_OK:
            invalidateAllHandlers(ejb.deploymentID + ":" + primKey);
            return null;
        default:
            throw new RemoteException("Received invalid response code from server: " + res.getResponseCode());
    }
}
 
Example 5
private void export(Remote obj) throws RemoteException {
    final RMIExporter exporter =
        (RMIExporter) env.get(RMIExporter.EXPORTER_ATTRIBUTE);
    final boolean daemon = EnvHelp.isServerDaemon(env);

    if (daemon && exporter != null) {
        throw new IllegalArgumentException("If "+EnvHelp.JMX_SERVER_DAEMON+
                " is specified as true, "+RMIExporter.EXPORTER_ATTRIBUTE+
                " cannot be used to specify an exporter!");
    }

    if (daemon) {
        if (csf == null && ssf == null) {
            new UnicastServerRef(port).exportObject(obj, null, true);
        } else {
            new UnicastServerRef2(port, csf, ssf).exportObject(obj, null, true);
        }
    } else if (exporter != null) {
        exporter.exportObject(obj, port, csf, ssf);
    } else {
        UnicastRemoteObject.exportObject(obj, port, csf, ssf);
    }
}
 
Example 6
Source Project: product-es   Source File: HumanTaskAdminClient.java    License: Apache License 2.0 6 votes vote down vote up
public WorkItem[] getWorkItems()
		throws IllegalStateFault, IllegalAccessFault, RemoteException, IllegalArgumentFault {

	TSimpleQueryInput queryInput = new TSimpleQueryInput();
	queryInput.setPageNumber(0);
	queryInput.setSimpleQueryCategory(TSimpleQueryCategory.ALL_TASKS);

	TTaskSimpleQueryResultSet resultSet = htStub.simpleQuery(queryInput);
	if (resultSet == null || resultSet.getRow() == null || resultSet.getRow().length == 0) {
		return new WorkItem[0];
	}
	List<WorkItem> workItems = new LinkedList<>();
	for (TTaskSimpleQueryResultRow row : resultSet.getRow()) {
		URI id = row.getId();
		String taskUser = "";
		//Ready state notification doesn't have taskUser
		if (htStub.loadTask(id) != null && htStub.loadTask(id).getActualOwner() != null) {
			taskUser = htStub.loadTask(id).getActualOwner().getTUser();
		}

		workItems.add(new WorkItem(id, row.getPresentationSubject(),
				row.getPresentationName(), row.getPriority(), row.getStatus(),
				row.getCreatedTime(), taskUser));
	}
	return workItems.toArray(new WorkItem[workItems.size()]);
}
 
Example 7
Source Project: tracker   Source File: DataTrackTool.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Sends a message to a replyTo tool in the form of a String-to-String mapping.
 *
 * @param id the replyTo identifier
 * @param message the information to send
 * @return true if sent successfully
 */
public boolean reply(int id, Map<String, String> message) {
	Tool tool = replyToTools.get(id);
	if (tool==null) return false;
// get message control and set properties based on info map
XMLControl control = DataTrackSupport.getMessageControl(id);
for (String key: message.keySet()) {
	control.setValue(key, message.get(key));
}
	try {
	tool.send(new LocalJob(control.toXML()), null);
} catch (RemoteException e) {
	return false;
}
	return true;
}
 
Example 8
public String getActiveEventPublisherConfigurationContent(String eventPublisherName)
        throws RemoteException {
    try {
        return eventPublisherAdminServiceStub.getActiveEventPublisherConfigurationContent(eventPublisherName);
    } catch (RemoteException e) {
        log.error("RemoteException", e);
        throw new RemoteException();
    }
}
 
Example 9
Source Project: openAGV   Source File: StandardRemoteKernel.java    License: Apache License 2.0 5 votes vote down vote up
@Deprecated
@Override
public Path createPath(ClientID clientID, TCSObjectReference<Point> srcRef,
                       TCSObjectReference<Point> destRef)
    throws CredentialsException, ObjectUnknownException, RemoteException {
  checkCredentialsForRole(clientID, UserPermission.MODIFY_MODEL);

  return localKernel.createPath(srcRef, destRef);
}
 
Example 10
private void clearUploadedResource()
        throws InterruptedException, ResourceAdminServiceExceptionException, RemoteException, XPathExpressionException {

    ResourceAdminServiceClient resourceAdminServiceStub =
            new ResourceAdminServiceClient(context.getContextUrls().getBackEndUrl(), getSessionCookie());

    resourceAdminServiceStub.deleteResource("/_system/config/script_xslt");
}
 
Example 11
public StreamDefinitionInfoDto[] getAllEventStreamInfoDto() throws RemoteException {
    try {
        return executionSimulatorAdminServiceStub.getAllEventStreamInfoDto();
    } catch (RemoteException e) {
        log.error("RemoteException", e);
        throw new RemoteException();
    }
}
 
Example 12
Source Project: saros   Source File: Chatroom.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean compareChatMessage(String jid, String message) throws RemoteException {
  try {
    chatTab.activate();
    SarosSWTBot bot = new SarosSWTBot(chatTab.widget);
    String text = bot.lastChatLine().getText();
    return text.equals(message);
  } catch (Exception e) {
    log.error(e.getMessage(), e);
    return false;
  }
}
 
Example 13
Source Project: dacapobench   Source File: TradeWSAction.java    License: Apache License 2.0 5 votes vote down vote up
public boolean logout(String userID) throws RemoteException {
	try {
           trade.logout(userID);
           return true;
       } catch (Exception e) {
           throw new RemoteException("", e);
       }
}
 
Example 14
Source Project: product-ei   Source File: ESBIntegrationTest.java    License: Apache License 2.0 5 votes vote down vote up
protected  void uploadConnector(String repoLocation, String strFileName) throws MalformedURLException,
                                                                                RemoteException {
	List<LibraryFileItem> uploadLibraryInfoList = new ArrayList<LibraryFileItem>();
	LibraryFileItem uploadedFileItem = new LibraryFileItem();
	uploadedFileItem.setDataHandler(new DataHandler(new FileDataSource(new File(repoLocation +
	                                                        File.separator + strFileName))));
	uploadedFileItem.setFileName(strFileName);
	uploadedFileItem.setFileType("zip");
	uploadLibraryInfoList.add(uploadedFileItem);
	LibraryFileItem[] uploadServiceTypes = new LibraryFileItem[uploadLibraryInfoList.size()];
	uploadServiceTypes = uploadLibraryInfoList.toArray(uploadServiceTypes);
	esbUtils.uploadConnector(contextUrls.getBackEndUrl(),sessionCookie,uploadServiceTypes);
}
 
Example 15
Source Project: openjdk-8-source   Source File: Chaining.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    Exception t = new RuntimeException();
    String foo = "foo";
    String fooMsg = "foo; nested exception is: \n\t" + t;
    test(new RemoteException(), null, null);
    test(new RemoteException(foo), foo, null);
    test(new RemoteException(foo, t), fooMsg, t);
    test(new ActivationException(), null, null);
    test(new ActivationException(foo), foo, null);
    test(new ActivationException(foo, t), fooMsg, t);
    test(new ServerCloneException(foo), foo, null);
    test(new ServerCloneException(foo, t), fooMsg, t);
}
 
Example 16
Source Project: JDKSourceCode1.8   Source File: Stub.java    License: MIT License 5 votes vote down vote up
/**
 * Connects this stub to an ORB. Required after the stub is deserialized
 * but not after it is demarshalled by an ORB stream. If an unconnected
 * stub is passed to an ORB stream for marshalling, it is implicitly
 * connected to that ORB. Application code should not call this method
 * directly, but should call the portable wrapper method
 * {@link javax.rmi.PortableRemoteObject#connect}.
 * @param orb the ORB to connect to.
 * @exception RemoteException if the stub is already connected to a different
 * ORB, or if the stub does not represent an exported remote or local object.
 */
public void connect(ORB orb) throws RemoteException {

    if (stubDelegate == null) {
        setDefaultDelegate();
    }

    if (stubDelegate != null) {
        stubDelegate.connect(this, orb);
    }

}
 
Example 17
Source Project: product-ei   Source File: ESBTestCaseUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @param backEndUrl
 * @param sessionCookie
 * @param sequenceName
 * @return
 * @throws org.wso2.carbon.sequences.stub.types.SequenceEditorException
 * @throws java.rmi.RemoteException
 */
public boolean isSequenceExist(String backEndUrl, String sessionCookie, String sequenceName)
		throws SequenceEditorException, RemoteException {
	SequenceAdminServiceClient sequenceAdminServiceClient = new SequenceAdminServiceClient(backEndUrl,
	                                                                                       sessionCookie);
	String[] sequences = sequenceAdminServiceClient.getSequences();
	if (sequences == null || sequences.length == 0) {
		return false;
	}
	return ArrayUtils.contains(sequences, sequenceName);
}
 
Example 18
Source Project: openAGV   Source File: StandardRemoteKernel.java    License: Apache License 2.0 5 votes vote down vote up
@Deprecated
@Override
public void activateTransportOrder(ClientID clientID, TCSObjectReference<TransportOrder> ref)
    throws CredentialsException, ObjectUnknownException, RemoteException {
  checkCredentialsForRole(clientID, UserPermission.MODIFY_ORDER);

  localKernel.activateTransportOrder(ref);
}
 
Example 19
Source Project: saros   Source File: MenuFileTest.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testNewProjectWithClass() throws RemoteException {
  assertFalse(
      ALICE
          .superBot()
          .views()
          .packageExplorerView()
          .tree()
          .existsWithRegex(Pattern.quote(Constants.PROJECT1) + ".*"));
  ALICE
      .superBot()
      .views()
      .packageExplorerView()
      .tree()
      .newC()
      .javaProjectWithClasses(Constants.PROJECT1, "pkg", "Cls");
  assertTrue(
      ALICE
          .superBot()
          .views()
          .packageExplorerView()
          .tree()
          .existsWithRegex(Pattern.quote(Constants.PROJECT1) + ".*"));
  assertTrue(
      ALICE
          .superBot()
          .views()
          .packageExplorerView()
          .selectPkg(Constants.PROJECT1, "pkg")
          .existsWithRegex(Pattern.quote("Cls" + SUFFIX_JAVA) + ".*"));
}
 
Example 20
Source Project: gemfirexd-oss   Source File: RBQTasks.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * A hydra ENDTASK that validates values in the blackboard.
 *
 * @throws TestException
 *         If the number of poll operations does not equal the
 *         number of offer operations.
 */
public static void validate() throws RemoteException {
  RBQBlackboard bb = RBQBlackboard.getBB();
  bb.print();   // shows the contents of shared counters and the shared map

  // read and log the min and max times
  long minOfferTime = bb.getMinOfferTime();
  long maxOfferTime = bb.getMaxOfferTime();
  long minPollTime = bb.getMinPollTime();
  long maxPollTime = bb.getMaxPollTime();

  LogWriter log = Log.getLogWriter();
  log.info("Minimum time for offer: " + minOfferTime + " nanos");
  log.info("Maximum time for offer: " + maxOfferTime + " nanos");
  log.info("Minimum time for poll : " + minPollTime + " nanos");
  log.info("Maximum time for poll : " + maxPollTime + " nanos");

  // check that all elements put into the queue were actually removed
  long numPolls = bb.getNumPolls();
  long numOffers = bb.getNumOffers();

  if (numPolls != numOffers) {
    String s = "Expected number of poll operations " + numPolls +
      " to equal number of offer operations " + numOffers;
     throw new TestException(s); 
  }
}
 
Example 21
Source Project: jdk8u_jdk   Source File: IntArrayCalls.java    License: GNU General Public License v2.0 4 votes vote down vote up
public Remote create() throws RemoteException {
    return new ServerImpl();
}
 
Example 22
Source Project: ramus   Source File: RMIAccessRules.java    License: GNU General Public License v3.0 4 votes vote down vote up
public boolean canUpdateElement(long elementId, long attributeId)
throws RemoteException;
 
Example 23
Source Project: openAGV   Source File: RemoteDispatcherService.java    License: Apache License 2.0 4 votes vote down vote up
void withdrawByVehicle(ClientID clientId,
                   TCSObjectReference<Vehicle> ref,
                   boolean immediateAbort)
throws RemoteException;
 
Example 24
Source Project: product-ei   Source File: DataServiceAdminClient.java    License: Apache License 2.0 4 votes vote down vote up
public void editDataService(String serviceName, String serviceHierachy,
                            String dataServiceContent) throws RemoteException {
    dataServiceAdminStub.saveDataService(serviceName, serviceHierachy, dataServiceContent);
}
 
Example 25
Source Project: juddi   Source File: UDDIPublicationService.java    License: Apache License 2.0 4 votes vote down vote up
public RegisteredInfo getRegisteredInfo(GetRegisteredInfo body)
		throws RemoteException {
	return publication.getRegisteredInfo(body);
}
 
Example 26
Source Project: product-ei   Source File: SQLDriverGspreadSheetTestCase.java    License: Apache License 2.0 4 votes vote down vote up
@Test(groups = "wso2.dss", description = "add customer", dependsOnMethods = "testDropSheet", enabled = false)
public void testAddEmployee() throws RemoteException {
    new AxisServiceClient().sendRobust(addEmployeePayload(), serverEpr, "addCustomerSQL");
    OMElement result = new AxisServiceClient().sendReceive(getPayload(), serverEpr, "getCustomersSQL");
    assertTrue(result.toString().contains("<customerName>" + inputValue + "</customerName>"));
}
 
Example 27
Source Project: spotbugs   Source File: Bug2421277.java    License: GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void setSessionContext(SessionContext arg0) throws EJBException, RemoteException {
    // TODO Auto-generated method stub

}
 
Example 28
Source Project: jdk8u_jdk   Source File: ExceptionCalls.java    License: GNU General Public License v2.0 4 votes vote down vote up
public void call() throws RemoteException, FooException {
    throw new FooException();
}
 
Example 29
Source Project: gemfirexd-oss   Source File: FakeMaster.java    License: Apache License 2.0 4 votes vote down vote up
public void recordPID(HostDescription hd, int pid)
    throws RemoteException {
  // TODO Auto-generated method stub
  
}
 
Example 30
Source Project: saros   Source File: NetworkManipulatorImpl.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public void setDiscardIncomingXMPPPackets(JID jid, boolean discard) throws RemoteException {
  // TODO Auto-generated method stub
  throw new UnsupportedOperationException("not yet implemented");
}