Commit bd8daf8a authored by Rodrigo Carneiro Henrique's avatar Rodrigo Carneiro Henrique
Browse files

[SCS-343]: Erro ao carregar o XML na demo stockmarket


git-svn-id: https://subversion.tecgraf.puc-rio.br/engdist/scs/core/java/trunk@120647 ae0415b3-e90b-0410-900d-d0be9363c56b
parent 561cb73a
...@@ -19,6 +19,11 @@ ...@@ -19,6 +19,11 @@
<build> <build>
<sourceDirectory>src</sourceDirectory> <sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>resources</directory>
</resource>
</resources>
<plugins> <plugins>
<plugin> <plugin>
......
<?xml version="1.0" encoding="iso-8859-1" ?> <?xml version="1.0" encoding="iso-8859-1" ?>
<component xmlns="tecgraf.scs.core"> <scs:component xmlns:scs="tecgraf.scs.core">
<id> <id>
<name>StockLogger</name> <name>StockLogger</name>
<version>1.0.0</version> <version>1.0.0</version>
...@@ -17,4 +17,4 @@ ...@@ -17,4 +17,4 @@
<facetImpl>scs.demos.stockmarket.servant.FileExchangePrinterImpl</facetImpl> <facetImpl>scs.demos.stockmarket.servant.FileExchangePrinterImpl</facetImpl>
</facet> </facet>
</facets> </facets>
</component> </scs:component>
package scs.demos.stockmarket.server; package scs.demos.stockmarket.server;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.Properties; import java.util.Properties;
import javax.xml.parsers.ParserConfigurationException;
import org.omg.CORBA.ORB; import org.omg.CORBA.ORB;
import org.omg.CORBA.ORBPackage.InvalidName; import org.omg.CORBA.ORBPackage.InvalidName;
import org.omg.CORBA.TypeCodePackage.BadKind; import org.omg.CORBA.TypeCodePackage.BadKind;
...@@ -31,6 +33,7 @@ public class StockLoggerServer { ...@@ -31,6 +33,7 @@ public class StockLoggerServer {
/** /**
* @param args * @param args
*
* @throws InvalidName * @throws InvalidName
* @throws AdapterInactive * @throws AdapterInactive
* @throws WrongPolicy * @throws WrongPolicy
...@@ -43,13 +46,14 @@ public class StockLoggerServer { ...@@ -43,13 +46,14 @@ public class StockLoggerServer {
* @throws BadKind * @throws BadKind
* @throws SecurityException * @throws SecurityException
* @throws IllegalArgumentException * @throws IllegalArgumentException
* @throws FileNotFoundException * @throws SCSException
* @throws ParserConfigurationException
*/ */
public static void main(String[] args) throws InvalidName, AdapterInactive, public static void main(String[] args) throws InvalidName, AdapterInactive,
ServantNotActive, WrongPolicy, IllegalArgumentException, SecurityException, ServantNotActive, WrongPolicy, BadKind, InstantiationException,
BadKind, InstantiationException, IllegalAccessException, IllegalAccessException, ClassNotFoundException, InvocationTargetException,
ClassNotFoundException, InvocationTargetException, NoSuchMethodException, NoSuchMethodException, IOException, SCSException,
FileNotFoundException { ParserConfigurationException {
// These properties are used to force JacORB instead of Sun's ORB // These properties are used to force JacORB instead of Sun's ORB
// implementation. // implementation.
...@@ -63,14 +67,15 @@ public class StockLoggerServer { ...@@ -63,14 +67,15 @@ public class StockLoggerServer {
POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA")); POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
poa.the_POAManager().activate(); poa.the_POAManager().activate();
XMLComponentBuilder xmlBuilder = new XMLComponentBuilder(orb, poa);
// "Metadata-only" component creation // "Metadata-only" component creation
// The API will be responsible for creating the servants and registering // The API will be responsible for creating the servants and registering
// them with the POA. // them with the POA.
File is = new File("resources/" + args[0]); File is = new File("resources/" + args[0]);
XMLComponentBuilder xmlBuilder = new XMLComponentBuilder();
ComponentContext context; ComponentContext context;
try { try {
context = xmlBuilder.build(orb, poa, is); context = xmlBuilder.build(is);
} }
catch (SCSException e) { catch (SCSException e) {
e.getCause().printStackTrace(); e.getCause().printStackTrace();
...@@ -89,7 +94,7 @@ public class StockLoggerServer { ...@@ -89,7 +94,7 @@ public class StockLoggerServer {
ps.println(orb.object_to_string(context.getIComponent())); ps.println(orb.object_to_string(context.getIComponent()));
ps.close(); ps.close();
// Blocks the current thread, waiting for calls, until the ORB is // Blocks the current thread, waiting for calls, until the ORB is
// finalized // finalized
orb.run(); orb.run();
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment